diff options
Diffstat (limited to 'src/game/Creature.cpp')
-rw-r--r-- | src/game/Creature.cpp | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 42557af7c99..24677237ac8 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -60,9 +60,9 @@ TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const return NULL; } -bool VendorItemData::RemoveItem( uint32 item_id ) +bool VendorItemData::RemoveItem(uint32 item_id) { - for (VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i ) + for (VendorItemList::iterator i = m_items.begin(); i != m_items.end(); ++i) { if ((*i)->item==item_id) { @@ -83,7 +83,7 @@ size_t VendorItemData::FindItemSlot(uint32 item_id) const VendorItem const* VendorItemData::FindItem(uint32 item_id) const { - for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i ) + for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i) if ((*i)->item==item_id) return *i; return NULL; @@ -263,7 +263,7 @@ void Creature::RemoveCorpse() /** * change the entry of creature until respawn */ -bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) +bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data) { CreatureInfo const *normalInfo = objmgr.GetCreatureTemplate(Entry); if (!normalInfo) @@ -337,12 +337,12 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) SetName(normalInfo->Name); // at normal entry always SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS,minfo->bounding_radius); - SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach ); + SetFloatValue(UNIT_FIELD_COMBATREACH,minfo->combat_reach); SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); - SetSpeed(MOVE_WALK, cinfo->speed_walk ); - SetSpeed(MOVE_RUN, cinfo->speed_run ); + SetSpeed(MOVE_WALK, cinfo->speed_walk); + SetSpeed(MOVE_RUN, cinfo->speed_run); SetSpeed(MOVE_SWIM, 1.0f); // using 1.0 rate SetSpeed(MOVE_FLIGHT, 1.0f); // using 1.0 rate @@ -359,7 +359,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 team, const CreatureData *data ) return true; } -bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data ) +bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data) { if (!InitEntry(Entry,team,data)) return false; @@ -449,19 +449,19 @@ void Creature::Update(uint32 diff) else m_GlobalCooldown -= diff; - switch( m_deathState ) + switch(m_deathState) { case JUST_ALIVED: // Don't must be called, see Creature::setDeathState JUST_ALIVED -> ALIVE promoting. - sLog.outError("Creature (GUID: %u Entry: %u ) in wrong state: JUST_ALIVED (4)",GetGUIDLow(),GetEntry()); + sLog.outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_ALIVED (4)",GetGUIDLow(),GetEntry()); break; case JUST_DIED: // Don't must be called, see Creature::setDeathState JUST_DIED -> CORPSE promoting. - sLog.outError("Creature (GUID: %u Entry: %u ) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry()); + sLog.outError("Creature (GUID: %u Entry: %u) in wrong state: JUST_DEAD (1)",GetGUIDLow(),GetEntry()); break; case DEAD: { - if ( m_respawnTime <= time(NULL) ) + if (m_respawnTime <= time(NULL)) { if (!GetLinkedCreatureRespawnTime()) // Can respawn Respawn(); @@ -519,7 +519,7 @@ void Creature::Update(uint32 diff) { if (m_isDeadByDefault) { - if ( m_deathTimer <= diff ) + if (m_deathTimer <= diff) { RemoveCorpse(); DEBUG_LOG("Removing alive corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY)); @@ -530,7 +530,7 @@ void Creature::Update(uint32 diff) } } - Unit::Update( diff ); + Unit::Update(diff); // creature can be dead after Unit::Update call // CORPSE/DEAD state will processed at next tick (in other case death timer will be updated unexpectedly) @@ -658,7 +658,7 @@ void Creature::RegenerateHealth() float HealthIncreaseRate = sWorld.getRate(RATE_HEALTH); float Spirit = GetStat(STAT_SPIRIT); - if ( GetPower(POWER_MANA) > 0 ) + if (GetPower(POWER_MANA) > 0) addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); else addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); @@ -835,15 +835,15 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const pPlayer->PlayerTalkClass->ClearMenus(); switch(GetCreatureInfo()->trainer_class) { - case CLASS_DRUID: pPlayer->PlayerTalkClass->SendGossipMenu( 4913,GetGUID()); break; + case CLASS_DRUID: pPlayer->PlayerTalkClass->SendGossipMenu(4913,GetGUID()); break; case CLASS_HUNTER: pPlayer->PlayerTalkClass->SendGossipMenu(10090,GetGUID()); break; - case CLASS_MAGE: pPlayer->PlayerTalkClass->SendGossipMenu( 328,GetGUID()); break; - case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu( 1635,GetGUID()); break; - case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu( 4436,GetGUID()); break; - case CLASS_ROGUE: pPlayer->PlayerTalkClass->SendGossipMenu( 4797,GetGUID()); break; - case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu( 5003,GetGUID()); break; - case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu( 5836,GetGUID()); break; - case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu( 4985,GetGUID()); break; + case CLASS_MAGE: pPlayer->PlayerTalkClass->SendGossipMenu(328,GetGUID()); break; + case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu(1635,GetGUID()); break; + case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu(4436,GetGUID()); break; + case CLASS_ROGUE: pPlayer->PlayerTalkClass->SendGossipMenu(4797,GetGUID()); break; + case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu(5003,GetGUID()); break; + case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu(5836,GetGUID()); break; + case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu(4985,GetGUID()); break; } } return false; @@ -872,7 +872,7 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const case RACE_ORC: pPlayer->PlayerTalkClass->SendGossipMenu(5863,GetGUID()); break; case RACE_TAUREN: pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break; case RACE_TROLL: pPlayer->PlayerTalkClass->SendGossipMenu(5816,GetGUID()); break; - case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu( 624,GetGUID()); break; + case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu(624,GetGUID()); break; case RACE_BLOODELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862,GetGUID()); break; case RACE_DRAENEI: pPlayer->PlayerTalkClass->SendGossipMenu(5864,GetGUID()); break; } @@ -941,8 +941,8 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3 /* uint32 timeElap = getMSTime(); if ((timeElap - m_startMove) < m_moveTime) { - oX = (dX - oX) * ( (timeElap - m_startMove) / m_moveTime ); - oY = (dY - oY) * ( (timeElap - m_startMove) / m_moveTime ); + oX = (dX - oX) * ((timeElap - m_startMove) / m_moveTime); + oY = (dY - oY) * ((timeElap - m_startMove) / m_moveTime); } else { @@ -1087,7 +1087,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) << (m_isDeadByDefault ? 1 : 0) << "," //is_dead << GetDefaultMovementType() << ")"; //default movement generator type - WorldDatabase.PExecuteLog( ss.str( ).c_str( ) ); + WorldDatabase.PExecuteLog(ss.str().c_str()); WorldDatabase.CommitTransaction(); } @@ -1445,7 +1445,7 @@ float Creature::GetAttackDistance(Unit const* pl) const int32 leveldif = int32(playerlevel) - int32(creaturelevel); // "The maximum Aggro Radius has a cap of 25 levels under. Example: A level 30 char has the same Aggro Radius of a level 5 char on a level 60 mob." - if ( leveldif < - 25) + if (leveldif < - 25) leveldif = -25; // "The aggro radius of a mob having the same level as the player is roughly 20 yards" @@ -1491,7 +1491,7 @@ void Creature::setDeathState(DeathState s) setActive(false); if (!isPet() && GetCreatureInfo()->SkinLootId) - if ( LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId) ) + if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId)) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); if (HasSearchedAssistance()) @@ -1589,7 +1589,7 @@ void Creature::Respawn(bool force) LoadCreaturesAddon(true); } else - setDeathState( JUST_ALIVED ); + setDeathState(JUST_ALIVED); CreatureModelInfo const *minfo = objmgr.GetCreatureModelRandomGender(GetNativeDisplayId()); if (minfo) // Cancel load if no model defined @@ -1657,7 +1657,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) { if (!m_spells[i]) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i] ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %i", m_spells[i]); @@ -1667,11 +1667,11 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) bool bcontinue = true; for (uint32 j=0; j<3; j++) { - if ( (spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ) || + if ((spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE) || (spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) || (spellInfo->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) || - (spellInfo->Effect[j] == SPELL_EFFECT_HEALTH_LEECH ) - ) + (spellInfo->Effect[j] == SPELL_EFFECT_HEALTH_LEECH) +) { bcontinue = false; break; @@ -1685,9 +1685,9 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim) float range = GetSpellMaxRangeForHostile(srange); float minrange = GetSpellMinRangeForHostile(srange); float dist = GetDistance(pVictim); - //if (!isInFront( pVictim, range ) && spellInfo->AttributesEx ) + //if (!isInFront(pVictim, range) && spellInfo->AttributesEx) // continue; - if ( dist > range || dist < minrange ) + if (dist > range || dist < minrange) continue; if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) continue; @@ -1707,7 +1707,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) { if (!m_spells[i]) continue; - SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i] ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]); if (!spellInfo) { sLog.outError("WORLD: unknown spell id %i", m_spells[i]); @@ -1717,7 +1717,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) bool bcontinue = true; for (uint32 j=0; j<3; j++) { - if ( (spellInfo->Effect[j] == SPELL_EFFECT_HEAL ) ) + if ((spellInfo->Effect[j] == SPELL_EFFECT_HEAL)) { bcontinue = false; break; @@ -1729,11 +1729,11 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim) continue; SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex); float range = GetSpellMaxRangeForFriend(srange); - float minrange = GetSpellMinRangeForFriend( srange); + float minrange = GetSpellMinRangeForFriend(srange); float dist = GetDistance(pVictim); - //if (!isInFront( pVictim, range ) && spellInfo->AttributesEx ) + //if (!isInFront(pVictim, range) && spellInfo->AttributesEx) // continue; - if ( dist > range || dist < minrange ) + if (dist > range || dist < minrange) continue; if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) continue; @@ -1757,7 +1757,7 @@ bool Creature::IsVisibleInGridForPlayer(Player const* pl) const // Live player (or with not release body see live creatures or death creatures with corpse disappearing time > 0 if (pl->isAlive() || pl->GetDeathTimer() > 0) { - if ( GetEntry() == VISUAL_WAYPOINT ) + if (GetEntry() == VISUAL_WAYPOINT) return false; return (isAlive() || m_deathTimer > 0 || (m_isDeadByDefault && m_deathState==CORPSE)); } @@ -1819,7 +1819,7 @@ void Creature::SendAIReaction(AiReaction reactionType) void Creature::CallAssistance() { - if ( !m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed()) + if (!m_AlreadyCallAssistance && getVictim() && !isPet() && !isCharmed()) { SetNoCallAssistance(true); @@ -2184,7 +2184,7 @@ time_t Creature::GetRespawnTimeEx() const return now; } -void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float* dist ) const +void Creature::GetRespawnCoord(float &x, float &y, float &z, float* ori, float* dist) const { if (m_DBTableGuid) { @@ -2282,12 +2282,12 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem) time_t ptime = time(NULL); - if ( vCount->lastIncrementTime + vItem->incrtime <= ptime ) + if (vCount->lastIncrementTime + vItem->incrtime <= ptime) { ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); - if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount ) + if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount) { m_vendorItemCounts.erase(itr); return vItem->maxcount; @@ -2321,12 +2321,12 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us time_t ptime = time(NULL); - if ( vCount->lastIncrementTime + vItem->incrtime <= ptime ) + if (vCount->lastIncrementTime + vItem->incrtime <= ptime) { ItemPrototype const* pProto = objmgr.GetItemPrototype(vItem->item); uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime); - if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount ) + if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount) vCount->count += diff * pProto->BuyCount; else vCount->count = vItem->maxcount; |