本文整理汇总了C++中GetEntry函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEntry函数的具体用法?C++ GetEntry怎么用?C++ GetEntry使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetEntry函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetEntry
Item::~Item()
{
// WARNING : THAT CHECK MAY CAUSE LAGS !
if (Player * plr = GetOwner())
if (plr->RemoveItemByDelete(this))
sLog->OutPandashan("Item %u on player guid %u is in destructor, and pointer is still referenced in player's data ...", GetEntry(), plr->GetGUIDLow());
}
开发者ID:3DViking,项目名称:TrinityCore-MOP-5.0.5,代码行数:7,代码来源:Item.cpp
示例2: GetGiftCreatorGUID
void Item::SaveToDB(int8 containerslot, int8 slot, bool firstsave, QueryBuffer* buf)
{
if(GetOwner() && GetOwner()->IsSaveBlocked())
return;
if(!m_isDirty && !firstsave)
return;
uint64 GiftCreatorGUID = GetGiftCreatorGUID();
uint64 CreatorGUID = GetCreatorGUID();
std::stringstream ss;
ss << "DELETE FROM playeritems WHERE guid = " << GetLowGUID() << ";";
if(firstsave)
CharacterDatabase.WaitExecute(ss.str().c_str());
else
{
if(buf == NULL)
CharacterDatabase.Execute(ss.str().c_str());
else
buf->AddQueryNA(ss.str().c_str());
}
ss.rdbuf()->str("");
uint64 ownerGUID = GetOwnerGUID();
ss << "INSERT INTO playeritems VALUES(";
ss << (Arcemu::Util::GUID_LOPART(ownerGUID)) << ",";
ss << GetLowGUID() << ",";
ss << GetEntry() << ",";
ss << wrapped_item_id << ",";
ss << (Arcemu::Util::GUID_LOPART(GiftCreatorGUID)) << ",";
ss << (Arcemu::Util::GUID_LOPART(CreatorGUID)) << ",";
ss << GetStackCount() << ",";
ss << int32(GetChargesLeft()) << ",";
ss << uint32(m_uint32Values[ ITEM_FIELD_FLAGS ]) << ",";
ss << random_prop << ", " << random_suffix << ", ";
ss << 0 << ",";
ss << GetDurability() << ",";
ss << static_cast<int>(containerslot) << ",";
ss << static_cast<int>(slot) << ",'";
// Pack together enchantment fields
if(Enchantments.size() > 0)
{
EnchantmentMap::iterator itr = Enchantments.begin();
for(; itr != Enchantments.end(); ++itr)
{
if(itr->second.RemoveAtLogout)
continue;
uint32 elapsed_duration = uint32(UNIXTIME - itr->second.ApplyTime);
int32 remaining_duration = itr->second.Duration - elapsed_duration;
if(remaining_duration < 0)
remaining_duration = 0;
try
{
if(itr->second.Enchantment && (remaining_duration > 5 || itr->second.Duration == 0))
{
ss << itr->second.Enchantment->Id << ",";
ss << remaining_duration << ",";
ss << itr->second.Slot << ";";
}
}
catch (...)
{
printf("Caught fatal exception: Item.cpp < void Item::SaveToDB(...)\n");
}
}
}
ss << "','";
ss << ItemExpiresOn << "','";
////////////////////////////////////////////////// Refund stuff /////////////////////////////////
// Check if the owner is instantiated. When sending mail he/she obviously will not be :P
if(this->GetOwner() != NULL)
{
std::pair< time_t, uint32 > refundentry;
refundentry.first = 0;
refundentry.second = 0;
refundentry = this->GetOwner()->GetItemInterface()->LookupRefundable(this->GetGUID());
ss << uint32(refundentry.first) << "','";
ss << uint32(refundentry.second);
}
else
{
ss << uint32(0) << "','";
ss << uint32(0);
}
//.........这里部分代码省略.........
开发者ID:treetrees,项目名称:Edge-of-Chaos,代码行数:101,代码来源:Item.cpp
示例3: GetEntry
void Creature::_LoadQuests()
{
mQuests.clear();
mInvolvedQuests.clear();
Field *fields;
QueryResult *result = sDatabase.PQuery("SELECT `quest` FROM `creature_questrelation` WHERE `id` = '%u'", GetEntry());
if(result)
{
do
{
fields = result->Fetch();
Quest* qInfo = objmgr.QuestTemplates[fields[0].GetUInt32()];
if (!qInfo) continue;
addQuest(qInfo->GetQuestId());
}
while( result->NextRow() );
delete result;
}
QueryResult *result1 = sDatabase.PQuery("SELECT `quest` FROM `creature_involvedrelation` WHERE `id` = '%u'", GetEntry());
if(!result1) return;
do
{
fields = result1->Fetch();
Quest* qInfo = objmgr.QuestTemplates[fields[0].GetUInt32()];
if (!qInfo) continue;
addInvolvedQuest(qInfo->GetQuestId());
}
while( result1->NextRow() );
delete result1;
}
开发者ID:chrayn,项目名称:mangos-06,代码行数:40,代码来源:Creature.cpp
示例4: GetTemplate
ItemTemplate const* Item::GetTemplate() const
{
return sObjectMgr->GetItemTemplate(GetEntry());
}
开发者ID:jacobmain1,项目名称:ApocalypseCore,代码行数:4,代码来源:Item.cpp
示例5: data0
void Vehicle::AddPassenger(Unit *unit, int8 seatId, bool force)
{
SeatMap::iterator seat;
seat = m_Seats.find(seatId);
// this should never happen
if(seat == m_Seats.end())
return;
unit->SetVehicleGUID(GetGUID());
unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ONTRANSPORT);
unit->m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT);
seat->second.passenger = unit;
if(unit->GetTypeId() == TYPEID_UNIT && ((Creature*)unit)->isVehicle())
{
if(((Vehicle*)unit)->GetEmptySeatsCount(true) == 0)
seat->second.flags = SEAT_VEHICLE_FULL;
else
seat->second.flags = SEAT_VEHICLE_FREE;
}
else
{
seat->second.flags = SEAT_FULL;
}
if(unit->GetTypeId() == TYPEID_PLAYER)
{
WorldPacket data0(SMSG_FORCE_MOVE_ROOT, 10);
data0 << unit->GetPackGUID();
data0 << (uint32)((seat->second.vs_flags & SF_CAN_CAST) ? 2 : 0);
unit->SendMessageToSet(&data0,true);
}
if(seat->second.vs_flags & SF_MAIN_RIDER)
{
if(!(GetVehicleFlags() & VF_MOVEMENT))
{
GetMotionMaster()->Clear(false);
GetMotionMaster()->MoveIdle();
SetCharmerGUID(unit->GetGUID());
unit->SetUInt64Value(UNIT_FIELD_CHARM, GetGUID());
if(unit->GetTypeId() == TYPEID_PLAYER)
{
((Player*)unit)->SetMover(this);
((Player*)unit)->SetClientControl(this, 1);
((Player*)unit)->GetCamera().SetView(this);
}
if(canFly() || HasAuraType(SPELL_AURA_FLY) || HasAuraType(SPELL_AURA_MOD_FLIGHT_SPEED))
{
WorldPacket data3(SMSG_MOVE_SET_CAN_FLY, 12);
data3<< GetPackGUID();
data3 << (uint32)(0);
SendMessageToSet(&data3,false);
}
}
SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(GetEntry());
for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
{
if (unit->GetTypeId() == TYPEID_UNIT || itr->second.IsFitToRequirements((Player*)unit))
{
Unit *caster = (itr->second.castFlags & 0x1) ? unit : this;
Unit *target = (itr->second.castFlags & 0x2) ? unit : this;
caster->CastSpell(target, itr->second.spellId, true);
}
}
if(unit->GetTypeId() == TYPEID_PLAYER)
{
// it should be added only on rider enter?
if(((Player*)unit)->GetGroup())
((Player*)unit)->SetGroupUpdateFlag(GROUP_UPDATE_VEHICLE);
BuildVehicleActionBar((Player*)unit);
}
if(!(GetVehicleFlags() & VF_FACTION))
setFaction(unit->getFaction());
if(GetVehicleFlags() & VF_CANT_MOVE)
{
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10);
data2<< GetPackGUID();
data2 << (uint32)(2);
SendMessageToSet(&data2,false);
}
if(GetVehicleFlags() & VF_NON_SELECTABLE)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
}
if(seat->second.vs_flags & SF_UNATTACKABLE)
unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
EmptySeatsCountChanged();
}
开发者ID:marx123,项目名称:core,代码行数:96,代码来源:Vehicle.cpp
示例6: switch
//.........这里部分代码省略.........
break;
}
case GAMEOBJECT_TYPE_FLAGSTAND: // 24
{
if(user->GetTypeId()!=TYPEID_PLAYER)
return;
Player* player = (Player*)user;
if( player->CanUseBattleGroundObject() )
{
// in battleground check
BattleGround *bg = player->GetBattleGround();
if(!bg)
return;
// BG flag click
// AB:
// 15001
// 15002
// 15003
// 15004
// 15005
bg->EventPlayerClickedOnFlag(player, this);
return; //we don;t need to delete flag ... it is despawned!
}
break;
}
case GAMEOBJECT_TYPE_FLAGDROP: // 26
{
if(user->GetTypeId()!=TYPEID_PLAYER)
return;
Player* player = (Player*)user;
if( player->CanUseBattleGroundObject() )
{
// in battleground check
BattleGround *bg = player->GetBattleGround();
if(!bg)
return;
// BG flag dropped
// WS:
// 179785 - Silverwing Flag
// 179786 - Warsong Flag
// EotS:
// 184142 - Netherstorm Flag
GameObjectInfo const* info = GetGOInfo();
if(info)
{
switch(info->id)
{
case 179785: // Silverwing Flag
// check if it's correct bg
if(bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 179786: // Warsong Flag
if(bg->GetTypeID() == BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag(player, this);
break;
case 184142: // Netherstorm Flag
if(bg->GetTypeID() == BATTLEGROUND_EY)
bg->EventPlayerClickedOnFlag(player, this);
break;
}
}
//this cause to call return, all flags must be deleted here!!
spellId = 0;
Delete();
}
break;
}
default:
sLog.outDebug("Unknown Object Type %u", GetGoType());
break;
}
if(!spellId)
return;
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellId );
if(!spellInfo)
{
if(user->GetTypeId()!=TYPEID_PLAYER || !sOutdoorPvPMgr.HandleCustomSpell((Player*)user,spellId,this))
sLog.outError("WORLD: unknown spell id %u at use action for gameobject (Entry: %u GoType: %u )", spellId,GetEntry(),GetGoType());
else
sLog.outDebug("WORLD: %u non-dbc spell was handled by OutdoorPvP", spellId);
return;
}
Spell *spell = new Spell(spellCaster, spellInfo, false, GetGUID());
// spell target is user of GO
SpellCastTargets targets;
targets.setUnitTarget( user );
spell->prepare(&targets);
}
开发者ID:wk23,项目名称:tst,代码行数:101,代码来源:GameObject.cpp
示例7: TC_LOG_DEBUG
void Item::UpdateDuration(Player* owner, uint32 diff)
{
if (!GetUInt32Value(ITEM_FIELD_DURATION))
return;
TC_LOG_DEBUG(LOG_FILTER_PLAYER_ITEMS, "Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff);
if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff)
{
sScriptMgr->OnItemExpire(owner, GetTemplate());
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
return;
}
SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION) - diff);
SetState(ITEM_CHANGED, owner); // save new time in database
}
开发者ID:jacobmain1,项目名称:ApocalypseCore,代码行数:17,代码来源:Item.cpp
示例8: UpdateAttackPowerAndDamage
void Pet::UpdateAttackPowerAndDamage(bool ranged)
{
if(ranged)
return;
float val = 0.0f;
float bonusAP = 0.0f;
UnitMods unitMod = UNIT_MOD_ATTACK_POWER;
if(GetEntry() == 416) // imp's attack power
val = GetStat(STAT_STRENGTH) - 10.0f;
else
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
Unit* owner = GetOwner();
if( owner && owner->GetTypeId()==TYPEID_PLAYER)
{
if(getPetType() == HUNTER_PET) //hunter pets benefit from owner's attack power
{
bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f;
SetBonusDamage( int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f));
}
//ghouls benefit from deathknight's attack power
else if(getPetType() == SUMMON_PET && owner->getClass() == CLASS_DEATH_KNIGHT)
{
bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.82f;
SetBonusDamage( int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.8287f));
}
//demons benefit from warlocks shadow or fire damage
else if(getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)
{
int32 fire = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
if(maximum < 0)
maximum = 0;
SetBonusDamage( int32(maximum * 0.15f));
bonusAP = maximum * 0.57f;
}
//water elementals benefit from mage's frost damage
else if(getPetType() == SUMMON_PET && owner->getClass() == CLASS_MAGE)
{
int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
if(frost < 0)
frost = 0;
SetBonusDamage( int32(frost * 0.4f));
}
}
SetModifierValue(UNIT_MOD_ATTACK_POWER, BASE_VALUE, val + bonusAP);
//in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB
float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
float attPowerMultiplier = GetModifierValue(unitMod, TOTAL_PCT) - 1.0f;
//UNIT_FIELD_(RANGED)_ATTACK_POWER field
SetInt32Value(UNIT_FIELD_ATTACK_POWER, (int32)base_attPower);
//UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field
SetInt32Value(UNIT_FIELD_ATTACK_POWER_MODS, (int32)attPowerMod);
//UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
SetFloatValue(UNIT_FIELD_ATTACK_POWER_MULTIPLIER, attPowerMultiplier);
//automatically update weapon damage after attack power modification
UpdateDamagePhysical(BASE_ATTACK);
}
开发者ID:Kishii,项目名称:Dev,代码行数:66,代码来源:StatSystem.cpp
示例9: sourceModel
bool SortFilterProxyModel::filterAcceptsRow (int row, const QModelIndex& parent) const
{
if (MUCMode_)
{
if (!MUCEntry_)
return false;
const QModelIndex& idx = sourceModel ()->index (row, 0, parent);
switch (GetType (idx))
{
case Core::CLETAccount:
{
QObject *acc = qobject_cast<ICLEntry*> (MUCEntry_)->GetParentAccount ();
return acc == idx.data (Core::CLRAccountObject).value<QObject*> ();
}
case Core::CLETCategory:
{
const QString& gName = idx.data ().toString ();
return gName == qobject_cast<IMUCEntry*> (MUCEntry_)->GetGroupName () ||
qobject_cast<ICLEntry*> (MUCEntry_)->Groups ().contains (gName);
}
default:
break;
}
}
else
{
const QModelIndex& idx = sourceModel ()->index (row, 0, parent);
if (!filterRegExp ().isEmpty ())
return GetType (idx) == Core::CLETContact ?
idx.data ().toString ().contains (filterRegExp ()) :
true;
if (idx.data (Core::CLRUnreadMsgCount).toInt ())
return true;
const auto type = GetType (idx);
if (type == Core::CLETContact)
{
ICLEntry *entry = GetEntry (idx);
const State state = entry->GetStatus ().State_;
if (!ShowOffline_ &&
state == SOffline &&
!idx.data (Core::CLRUnreadMsgCount).toInt ())
return false;
if (HideMUCParts_ &&
entry->GetEntryType () == ICLEntry::ETPrivateChat)
return false;
if (!ShowSelfContacts_ &&
entry->GetEntryFeatures () & ICLEntry::FSelfContact)
return false;
}
else if (type == Core::CLETCategory)
{
if (!ShowOffline_ &&
!idx.data (Core::CLRNumOnline).toInt ())
return false;
for (int subRow = 0; subRow < sourceModel ()->rowCount (idx); ++subRow)
if (filterAcceptsRow (subRow, idx))
return true;
return false;
}
else if (type == Core::CLETAccount)
{
const auto& accObj = idx.data (Core::CLRAccountObject).value<QObject*> ();
auto acc = qobject_cast<IAccount*> (accObj);
return acc->IsShownInRoster ();
}
}
return QSortFilterProxyModel::filterAcceptsRow (row, parent);
}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:78,代码来源:sortfilterproxymodel.cpp
示例10: Pending
void Transporter::TransportPassengers(uint32 mapid, uint32 oldmap, float x, float y, float z)
{
sEventMgr.RemoveEvents(this, EVENT_TRANSPORTER_NEXT_WAYPOINT);
if(mPassengers.size() > 0)
{
PassengerIterator itr = mPassengers.begin();
PassengerIterator it2;
WorldPacket Pending(SMSG_TRANSFER_PENDING, 12);
Pending << mapid << GetEntry() << oldmap;
WorldPacket NewWorld;
LocationVector v;
for(; itr != mPassengers.end();)
{
it2 = itr;
++itr;
Player *plr = objmgr.GetPlayer(it2->first);
if(!plr)
{
// remove from map
mPassengers.erase(it2);
continue;
}
if(!plr->GetSession() || !plr->IsInWorld())
continue;
plr->m_lockTransportVariables = true;
v.x = x + plr->m_TransporterX;
v.y = y + plr->m_TransporterY;
v.z = z + plr->m_TransporterZ;
v.o = plr->GetOrientation();
if(mapid == 530 && !plr->GetSession()->HasFlag(ACCOUNT_FLAG_XPACK_01))
{
// player is not flagged to access bc content, repop at graveyard
plr->RepopAtGraveyard(plr->GetPositionX(), plr->GetPositionY(), plr->GetPositionZ(), plr->GetMapId());
continue;
}
plr->GetSession()->SendPacket(&Pending);
plr->_Relocate(mapid, v, false, true, 0);
// Lucky bitch. Do it like on official.
if(plr->isDead())
{
plr->ResurrectPlayer();
plr->SetUInt32Value(UNIT_FIELD_HEALTH, plr->GetUInt32Value(UNIT_FIELD_MAXHEALTH));
plr->SetUInt32Value(UNIT_FIELD_POWER1, plr->GetUInt32Value(UNIT_FIELD_MAXPOWER1));
}
}
}
// Set our position
RemoveFromWorld(false);
SetMapId(mapid);
SetPosition(x,y,z,m_position.o,false);
AddToWorld();
}
开发者ID:Goatform,项目名称:ascent,代码行数:63,代码来源:TransporterHandler.cpp
示例11: generateLoot
void Creature::generateLoot()
{
if (!loot.items.empty()) return;
lootmgr.FillCreatureLoot(&loot,GetEntry(), m_mapMgr ? (m_mapMgr->iInstanceMode > 0 ? true : false) : false);
loot.gold = proto ? proto->money : 0;
// Master Looting Ninja Checker
if(sWorld.antiMasterLootNinja && this->m_lootMethod == PARTY_LOOT_MASTER)
{
Player *looter = objmgr.GetPlayer((uint32)this->TaggerGuid);
if(looter && looter->GetGroup())
{
uint16 lootThreshold = looter->GetGroup()->GetThreshold();
for(vector<__LootItem>::iterator itr = loot.items.begin(); itr != loot.items.end(); itr++)
{
if(itr->item.itemproto->Quality < lootThreshold)
continue;
// Master Loot Stuff - Let the rest of the raid know what dropped..
//TODO: Shouldn't we move this array to a global position? Or maybe it allready exists^^ (VirtualAngel) --- I can see (dead) talking pigs...^^
char* itemColours[7] = { "9d9d9d", "ffffff", "1eff00", "0070dd", "a335ee", "ff8000", "e6cc80" };
char buffer[256];
sprintf(buffer, "\174cff%s\174Hitem:%u:0:0:0:0:0:0:0\174h[%s]\174h\174r", itemColours[itr->item.itemproto->Quality], itr->item.itemproto->ItemId, itr->item.itemproto->Name1);
this->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, buffer);
}
}
}
/*
* If there's an amount given, take it as an expected value and
* generated a corresponding random value. The random value is
* something similar to a normal distribution.
*
* You'd get a ``better'' distribution if you called `rand()' for each
* copper individually. However, if the loot was 1G we'd call `rand()'
* 15000 times, which is not ideal. So we use one call to `rand()' to
* (hopefully) get 24 random bits, which is then used to create a
* normal distribution over 1/24th of the difference.
*/
if ((loot.gold > 0) && (loot.gold < 12))
{
/* Don't use the below formula for very small cash - rouding
* errors will be too bad.. */
}
else if (loot.gold >= 12)
{
uint32 random_bits;
double chunk_size;
double gold_fp;
/* Split up the difference into 12 chunks.. */
chunk_size = ((double) loot.gold) / 12.0;
/* Get 24 random bits. We use the low order bits, because we're
* too lazy to check how many random bits the system actually
* returned. */
random_bits = rand () & 0x00ffffff;
gold_fp = 0.0;
while (random_bits != 0)
{
/* If last bit is one .. */
if ((random_bits & 0x01) == 1)
/* .. increase loot by 1/12th of expected value */
gold_fp += chunk_size;
/* Shift away the LSB */
random_bits >>= 1;
}
/* To hide your discrete values a bit, add another random
* amount between -(chunk_size/2) and +(chunk_size/2). */
gold_fp += chunk_size
* ((((double) rand ()) / (((double) RAND_MAX) + 1.0)) - .5);
/*
* In theory we can end up with a negative amount. Give at
* least one chunk_size here to prevent this from happening. In
* case you're interested, the probability is around 2.98e-8.
*/
if (gold_fp < chunk_size)
gold_fp = chunk_size;
/* Convert the floating point gold value to an integer again
* and we're done. */
loot.gold = (uint32) (.5 + gold_fp);
}
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:89,代码来源:Creature.cpp
示例12: int32
void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
{
if (attType > BASE_ATTACK)
return;
float bonusDamage = 0.0f;
if (Unit* owner = GetOwner())
{
//force of nature
if (GetEntry() == 1964)
{
int32 spellDmg = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_NATURE)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_NATURE);
if (spellDmg > 0)
bonusDamage = spellDmg * 0.09f;
}
//greater fire elemental
else if (GetEntry() == 15438)
{
if (Unit* shaman = owner->GetOwner())
{
int32 spellDmg = int32(shaman->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE)) - shaman->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FIRE);
if (spellDmg > 0)
bonusDamage = spellDmg * 0.4f;
}
}
// shadowfiend 65.7% per 10 hits so 6.57 per hit
else if (GetEntry() == 19668)
{
if (Unit* owner = GetOwner())
{
int32 spellDmg = int32(owner->SpellBaseDamageBonus(SPELL_SCHOOL_MASK_SHADOW));
if (spellDmg > 0)
bonusDamage = spellDmg * 0.0657f;
}
}
}
UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND;
float att_speed = float(GetAttackTime(BASE_ATTACK))/1000.0f;
float base_value = GetModifierValue(unitMod, BASE_VALUE) + GetTotalAttackPowerValue(attType)/ 14.0f * att_speed + bonusDamage;
float base_pct = GetModifierValue(unitMod, BASE_PCT);
float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
float weapon_mindamage = GetWeaponDamageRange(BASE_ATTACK, MINDAMAGE);
float weapon_maxdamage = GetWeaponDamageRange(BASE_ATTACK, MAXDAMAGE);
int32 speed_mod = GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKSPEED);
base_pct *= 100.0f/(100.0f+float(speed_mod/2));
float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct;
float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct;
// Pet's base damage changes depending on happiness
if (isHunterPet() && attType == BASE_ATTACK)
{
switch (ToPet()->GetHappinessState())
{
case HAPPY:
// 125% of normal damage
mindamage = mindamage * 1.25f;
maxdamage = maxdamage * 1.25f;
break;
case CONTENT:
// 100% of normal damage, nothing to modify
break;
case UNHAPPY:
// 75% of normal damage
mindamage = mindamage * 0.75f;
maxdamage = maxdamage * 0.75f;
break;
}
}
SetStatFloatValue(UNIT_FIELD_MINDAMAGE, mindamage);
SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, maxdamage);
}
开发者ID:ahuraa,项目名称:blizzlikecore,代码行数:79,代码来源:StatSystem.cpp
示例13: GetTotalStatValue
bool Guardian::UpdateStats(Stats stat)
{
if (stat >= MAX_STATS)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
ApplyStatBuffMod(stat, m_statFromOwner[stat], false);
float ownersBonus = 0.0f;
Unit* owner = GetOwner();
float mod = 0.75f;
switch (stat)
{
case STAT_STRENGTH:
{
if (IsPetGhoul())
{
mod = 0.7f;
// Glyph of the Ghoul
if (AuraEffect const* aurEff = owner->GetAuraEffect(58686, 0))
mod += CalculatePct(1.0f, aurEff->GetAmount());
ownersBonus = owner->GetStat(stat) * mod;
value += ownersBonus;
}
break;
}
case STAT_STAMINA:
{
mod = 0.0f;
if (IsPetGhoul() || IsPetGargoyle())
{
// Glyph of the Ghoul
if (AuraEffect const* aurEff = owner->GetAuraEffect(58686, 0))
mod += CalculatePct(1.0f, aurEff->GetAmount());
}
ownersBonus = owner->GetStat(stat) * mod;
ownersBonus *= GetModifierValue(UNIT_MOD_STAT_STAMINA, TOTAL_PCT);
value += ownersBonus;
break;
}
case STAT_INTELLECT:
{
if (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE)
{
mod = 0.3f;
ownersBonus = owner->GetStat(stat) * mod;
}
else if (owner->getClass() == CLASS_DEATH_KNIGHT && GetEntry() == 31216)
{
mod = 0.3f;
if (owner->getSimulacrumTarget())
ownersBonus = owner->getSimulacrumTarget()->GetStat(stat) * mod;
else
ownersBonus = owner->GetStat(stat) * mod;
}
value += ownersBonus;
break;
}
}
SetStat(stat, int32(value));
m_statFromOwner[stat] = ownersBonus;
ApplyStatBuffMod(stat, m_statFromOwner[stat], true);
switch (stat)
{
case STAT_STRENGTH: UpdateAttackPowerAndDamage(); break;
case STAT_AGILITY: UpdateArmor(); break;
case STAT_STAMINA: UpdateMaxHealth(); break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
if (isPet() && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
UpdateAttackPowerAndDamage();
break;
case STAT_SPIRIT:
default:
break;
}
return true;
}
开发者ID:Lbniese,项目名称:WoWCircle434,代码行数:87,代码来源:StatSystem.cpp
示例14: GetProto
ItemPrototype const* Item::GetProto() const
{
return ObjectMgr::GetItemPrototype(GetEntry());
}
开发者ID:cipherCOM,项目名称:mangos,代码行数:4,代码来源:Item.cpp
示例15: UnSummon
//.........这里部分代码省略.........
if (m_timer <= diff)
{
UnSummon();
return;
}
m_timer -= diff;
}
else if (m_timer != m_lifetime)
m_timer = m_lifetime;
break;
}
case TEMPSUMMON_CORPSE_TIMED_DESPAWN:
{
if (m_deathState == CORPSE)
{
if (m_timer <= diff)
{
UnSummon();
return;
}
m_timer -= diff;
}
break;
}
case TEMPSUMMON_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE || m_deathState == DEAD)
{
UnSummon();
return;
}
break;
}
case TEMPSUMMON_DEAD_DESPAWN:
{
if (m_deathState == DEAD)
{
UnSummon();
return;
}
break;
}
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == CORPSE || m_deathState == DEAD)
{
UnSummon();
return;
}
if (!isInCombat())
{
if (m_timer <= diff)
{
UnSummon();
return;
}
else
m_timer -= diff;
}
else if (m_timer != m_lifetime)
m_timer = m_lifetime;
break;
}
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (m_deathState == DEAD)
{
UnSummon();
return;
}
if (!isInCombat() && isAlive())
{
if (m_timer <= diff)
{
UnSummon();
return;
}
else
m_timer -= diff;
}
else if (m_timer != m_lifetime)
m_timer = m_lifetime;
break;
}
default:
UnSummon();
sLog->outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);
break;
}
}
开发者ID:Krill156,项目名称:FreyaCore,代码行数:101,代码来源:TemporarySummon.cpp
示例16: switch
//.........这里部分代码省略.........
return;
}
break;
}
case TEMPSUMMON_DEAD_DESPAWN:
{
if (IsDespawned())
{
UnSummon();
return;
}
break;
}
case TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (IsDead())
{
UnSummon();
return;
}
if (!IsInCombat())
{
if (m_timer <= update_diff)
{
UnSummon();
return;
}
else
{ m_timer -= update_diff; }
}
else if (m_timer != m_lifetime)
{ m_timer = m_lifetime; }
break;
}
case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (IsDespawned())
{
UnSummon();
return;
}
if (!IsInCombat() && IsAlive())
{
if (m_timer <= update_diff)
{
UnSummon();
return;
}
else
{ m_timer -= update_diff; }
}
else if (m_timer != m_lifetime)
{ m_timer = m_lifetime; }
break;
}
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (IsDead())
{
UnSummon();
return;
}
if (m_timer <= update_diff)
{
UnSummon();
return;
}
m_timer -= update_diff;
break;
}
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (IsDespawned())
{
UnSummon();
return;
}
if (m_timer <= update_diff)
{
UnSummon();
return;
}
m_timer -= update_diff;
break;
}
default:
UnSummon();
sLog.outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);
break;
}
Creature::Update(update_diff, diff);
}
开发者ID:Numielle,项目名称:server,代码行数:101,代码来源:TemporarySummon.cpp
示例17: GetGUIDLow
bool Item::ItemContainerLoadLootFromDB()
{
// Loads the money and item loot associated with an openable item from the DB
// Default. If there are no records for this item then it will be rolled for in Player::SendLoot()
m_lootGenerated = false;
uint32 container_id = GetGUIDLow();
// Save this for later use
loot.containerID = container_id;
// First, see if there was any money loot. This gets added directly to the container.
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_MONEY);
stmt->setUInt32(0, container_id);
PreparedQueryResult money_result = CharacterDatabase.Query(stmt);
if (money_result)
{
Field* fields = money_result->Fetch();
loot.gold = fields[0].GetUInt32();
}
// Next, load any items that were saved
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_ITEMCONTAINER_ITEMS);
stmt->setUInt32(0, container_id);
PreparedQueryResult item_result = CharacterDatabase.Query(stmt);
if (item_result)
{
// Get a LootTemplate for the container item. This is where
// the saved loot was originally rolled from, we will copy conditions from it
LootTemplate const* lt = LootTemplates_Item.GetLootFor(GetEntry());
if (lt)
{
do
{
// Create an empty LootItem
LootItem loot_item = LootItem();
// Fill in the rest of the LootItem from the DB
Field* fields = item_result->Fetch();
// item_id, itm_count, follow_rules, ffa, blocked, counted, under_threshold, needs_quest, rnd_prop, rnd_suffix
loot_item.itemid = fields[0].GetUInt32();
loot_item.count = fields[1].GetUInt32();
loot_item.follow_loot_rules = fields[2].GetBool();
loot_item.freeforall = fields[3].GetBool();
loot_item.is_blocked = fields[4].GetBool();
loot_item.is_counted = fields[5].GetBool();
loot_item.canSave = true;
loot_item.is_underthreshold = fields[6].GetBool();
loot_item.needs_quest = fields[7].GetBool();
loot_item.randomPropertyId = fields[8].GetInt32();
loot_item.randomSuffix = fields[9].GetUInt32();
// Copy the extra loot conditions from the item in the loot template
lt->CopyConditions(&loot_item);
// If container item is in a bag, add that player as an allowed looter
if (GetBagSlot())
loot_item.allowedGUIDs.insert(GetOwner()->GetGUIDLow());
// Finally add the LootItem to the container
loot.items.push_back(loot_item);
// Increment unlooted count
loot.unlootedCount++;
}
while (item_result->NextRow());
}
}
// Mark the item if it has loot so it won't be generated again on open
m_lootGenerated = !loot.isLooted();
return m_lootGenerated;
}
开发者ID:jacobmain1,项目名称:ApocalypseCore,代码行数:78,代码来源:Item.cpp
示例18: GetStat
void Guardian::UpdateAttackPowerAndDamage(bool ranged)
{
if (ranged)
return;
float val = 0.0f;
float bonusAP = 0.0f;
UnitMods unitMod = UNIT_MOD_ATTACK_POWER;
if (GetEntry() == ENTRY_IMP) // imp's attack power
val = GetStat(STAT_STRENGTH) - 10.0f;
else
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
Unit* owner = GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
{
if (IsHunterPet()) //hunter pets benefit from owner's attack power
{
float mod = 1.0f; //Hunter contribution modifier
bonusAP = owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.22f * mod;
SetBonusDamage(int32(owner->GetTotalAttackPowerValue(RANGED_ATTACK) * 0.1287f * mod));
}
else if (IsPetGhoul()) //ghouls benefit from deathknight's attack power (may be summon pet or not)
{
bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.22f;
SetBonusDamage(int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.1287f));
}
else if (IsSpiritWolf()) //wolf benefit from shaman's attack power
{
float dmg_multiplier = 0.31f;
if (m_owner->GetAuraEffect(63271, 0)) // Glyph of Feral Spirit
dmg_multiplier = 0.61f;
bonusAP = owner->GetTotalAttackPowerValue(BASE_ATTACK) * dmg_multiplier;
SetBonusDamage(int32(owner->GetTotalAttackPowerValue(BASE_ATTACK) * dmg_multiplier));
}
//demons benefit from warlocks shadow or fire damage
else if (IsPet
|
请发表评论