mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 07:37:02 +00:00
[Sync] Some long overdue project sync pt2
This commit is contained in:
parent
65ec4ea06e
commit
f5bb0529c1
70 changed files with 1211 additions and 736 deletions
|
|
@ -59,7 +59,6 @@ AuctionHouseMgr::~AuctionHouseMgr()
|
|||
{ delete itr->second; }
|
||||
}
|
||||
|
||||
|
||||
AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(AuctionHouseEntry const* house)
|
||||
{
|
||||
if (sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
|
|
@ -381,7 +380,6 @@ void AuctionHouseMgr::LoadAuctions()
|
|||
auction->itemTemplate = fields[3].GetUInt32();
|
||||
auction->itemCount = fields[4].GetUInt32();
|
||||
auction->itemRandomPropertyId = fields[5].GetUInt32();
|
||||
|
||||
auction->owner = fields[6].GetUInt32();
|
||||
|
||||
if (auction->owner)
|
||||
|
|
|
|||
|
|
@ -807,7 +807,7 @@ class GameObject : public WorldObject
|
|||
GridReference<GameObject>& GetGridRef() { return m_gridRef; }
|
||||
|
||||
GameObjectModel* m_model;
|
||||
|
||||
|
||||
// Event Handler
|
||||
EventProcessor m_Events;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ ObjectPosSelector::ObjectPosSelector(float x, float y, float dist, float searche
|
|||
{
|
||||
// if size == 0, m_anglestep will become 0 -> freeze
|
||||
if (searchedForSize == 0.0f)
|
||||
searchedForSize = DEFAULT_WORLD_OBJECT_SIZE;
|
||||
{ searchedForSize = DEFAULT_WORLD_OBJECT_SIZE; }
|
||||
|
||||
// undefined behaviour
|
||||
if (m_searcherDist == 0.0f)
|
||||
m_searcherDist = DEFAULT_WORLD_OBJECT_SIZE;
|
||||
|
||||
{ m_searcherDist = DEFAULT_WORLD_OBJECT_SIZE; }
|
||||
|
||||
m_searchedForReqHAngle = atan(OCCUPY_POS_ANGLE_ATAN_FACTOR * searchedForSize / m_searcherDist);
|
||||
|
||||
// Really init in InitilizeAngle
|
||||
|
|
@ -61,18 +61,18 @@ ObjectPosSelector::ObjectPosSelector(float x, float y, float dist, float searche
|
|||
void ObjectPosSelector::AddUsedArea(WorldObject const* obj, float angle, float dist)
|
||||
{
|
||||
MANGOS_ASSERT(obj);
|
||||
|
||||
|
||||
// skip some unexpected results.
|
||||
if (dist == 0.0f)
|
||||
return;
|
||||
|
||||
{ return; }
|
||||
|
||||
// (half) angle that obj occupies
|
||||
float sr_angle = atan(OCCUPY_POS_ANGLE_ATAN_FACTOR * obj->GetObjectBoundingRadius() / dist);
|
||||
|
||||
if (angle >= 0)
|
||||
m_UsedAreaLists[USED_POS_PLUS].insert(UsedArea(angle, OccupiedArea(sr_angle, obj)));
|
||||
{ m_UsedAreaLists[USED_POS_PLUS].insert(UsedArea(angle, OccupiedArea(sr_angle, obj))); }
|
||||
else
|
||||
m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj)));
|
||||
{ m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj))); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -86,9 +86,9 @@ void ObjectPosSelector::AddUsedArea(WorldObject const* obj, float angle, float d
|
|||
*/
|
||||
bool ObjectPosSelector::CheckAngle(UsedArea const& usedArea, UsedAreaSide side, float angle) const
|
||||
{
|
||||
float used_offset = usedArea.second.angleOffset;
|
||||
float used_angle = usedArea.first * SignOf(side);
|
||||
// check first left/right used angles if exists
|
||||
float used_offset = usedArea.second.angleOffset;
|
||||
|
||||
return fabs(used_angle - angle) > used_offset || (m_searchPosFor && usedArea.second.occupyingObj == m_searchPosFor);
|
||||
}
|
||||
|
||||
|
|
@ -119,6 +119,7 @@ void ObjectPosSelector::InitializeAngle()
|
|||
void ObjectPosSelector::InitializeAngle(UsedAreaSide side)
|
||||
{
|
||||
m_nextUsedAreaItr[side] = m_UsedAreaLists[side].begin();
|
||||
|
||||
// if another side not alow use 0.0f angle calculate possible value in 0..m_searchedForReqHAngle range
|
||||
if (!m_UsedAreaLists[~side].empty())
|
||||
{
|
||||
|
|
@ -126,7 +127,7 @@ void ObjectPosSelector::InitializeAngle(UsedAreaSide side)
|
|||
m_stepAngle[side] = std::max(m_searchedForReqHAngle + otherArea.second.angleOffset - otherArea.first, 0.0f);
|
||||
}
|
||||
else // Other side empty. start from 0
|
||||
m_stepAngle[side] = 0.0f;
|
||||
{ m_stepAngle[side] = 0.0f; }
|
||||
|
||||
// As m_stepAngle will be incremented first in ::NextSideAngle
|
||||
m_stepAngle[side] -= m_searchedForReqHAngle;
|
||||
|
|
@ -148,17 +149,17 @@ bool ObjectPosSelector::NextAngle(float& angle)
|
|||
if (m_stepAngle[USED_POS_PLUS] < M_PI_F && m_stepAngle[USED_POS_PLUS] <= m_stepAngle[USED_POS_MINUS])
|
||||
{
|
||||
if (NextSideAngle(USED_POS_PLUS, angle))
|
||||
return true;
|
||||
{ return true; }
|
||||
}
|
||||
// -- direction less updated
|
||||
else if (m_stepAngle[USED_POS_MINUS] < M_PI_F)
|
||||
{
|
||||
if (NextSideAngle(USED_POS_MINUS, angle))
|
||||
return true;
|
||||
{ return true; }
|
||||
}
|
||||
// both sides finishes
|
||||
else
|
||||
break;
|
||||
{ break; }
|
||||
}
|
||||
|
||||
// no angles
|
||||
|
|
@ -181,7 +182,7 @@ bool ObjectPosSelector::NextSideAngle(UsedAreaSide side, float& angle)
|
|||
|
||||
// prevent jump to another side
|
||||
if (m_stepAngle[side] > M_PI_F)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// no used area anymore on this side
|
||||
if (m_nextUsedAreaItr[side] == m_UsedAreaLists[side].end())
|
||||
|
|
@ -189,19 +190,19 @@ bool ObjectPosSelector::NextSideAngle(UsedAreaSide side, float& angle)
|
|||
angle = m_stepAngle[side] * SignOf(side);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Already occupied and no better found
|
||||
if ((m_searchPosFor && m_nextUsedAreaItr[side]->second.occupyingObj == m_searchPosFor) ||
|
||||
// Next occupied is too far away
|
||||
// Next occupied is too far away
|
||||
(m_stepAngle[side] + m_searchedForReqHAngle < m_nextUsedAreaItr[side]->first - m_nextUsedAreaItr[side]->second.angleOffset))
|
||||
{
|
||||
angle = m_stepAngle[side] * SignOf(side);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// angle set at first possible pos after passed m_nextUsedAreaItr
|
||||
m_stepAngle[side] = m_nextUsedAreaItr[side]->first + m_nextUsedAreaItr[side]->second.angleOffset;
|
||||
|
||||
|
||||
++m_nextUsedAreaItr[side];
|
||||
|
||||
return false;
|
||||
|
|
@ -217,13 +218,13 @@ bool ObjectPosSelector::NextSideAngle(UsedAreaSide side, float& angle)
|
|||
bool ObjectPosSelector::NextUsedAngle(float& angle)
|
||||
{
|
||||
if (m_nextUsedAreaItr[USED_POS_PLUS] == m_UsedAreaLists[USED_POS_PLUS].end() &&
|
||||
m_nextUsedAreaItr[USED_POS_MINUS] == m_UsedAreaLists[USED_POS_MINUS].end())
|
||||
return false;
|
||||
m_nextUsedAreaItr[USED_POS_MINUS] == m_UsedAreaLists[USED_POS_MINUS].end())
|
||||
{ return false; }
|
||||
|
||||
// ++ direction less updated
|
||||
if (m_nextUsedAreaItr[USED_POS_PLUS] != m_UsedAreaLists[USED_POS_PLUS].end() &&
|
||||
(m_nextUsedAreaItr[USED_POS_MINUS] == m_UsedAreaLists[USED_POS_MINUS].end() ||
|
||||
m_nextUsedAreaItr[USED_POS_PLUS]->first <= m_nextUsedAreaItr[USED_POS_MINUS]->first))
|
||||
(m_nextUsedAreaItr[USED_POS_MINUS] == m_UsedAreaLists[USED_POS_MINUS].end() ||
|
||||
m_nextUsedAreaItr[USED_POS_PLUS]->first <= m_nextUsedAreaItr[USED_POS_MINUS]->first))
|
||||
{
|
||||
angle = m_nextUsedAreaItr[USED_POS_PLUS]->first * SignOf(USED_POS_PLUS);
|
||||
++m_nextUsedAreaItr[USED_POS_PLUS];
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ Pet::Pet(PetType type) :
|
|||
CharmInfo* charmInfo = InitCharmInfo(this);
|
||||
|
||||
if (type == MINI_PET) // always passive
|
||||
charmInfo->SetReactState(REACT_PASSIVE);
|
||||
{ charmInfo->SetReactState(REACT_PASSIVE); }
|
||||
}
|
||||
|
||||
Pet::~Pet()
|
||||
|
|
@ -63,7 +63,7 @@ void Pet::AddToWorld()
|
|||
{
|
||||
///- Register the pet for guid lookup
|
||||
if (!IsInWorld())
|
||||
GetMap()->GetObjectsStore().insert<Pet>(GetObjectGuid(), (Pet*)this);
|
||||
{ GetMap()->GetObjectsStore().insert<Pet>(GetObjectGuid(), (Pet*)this); }
|
||||
|
||||
Unit::AddToWorld();
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ void Pet::RemoveFromWorld()
|
|||
{
|
||||
///- Remove the pet from the accessor
|
||||
if (IsInWorld())
|
||||
GetMap()->GetObjectsStore().erase<Pet>(GetObjectGuid(), (Pet*)NULL);
|
||||
{ GetMap()->GetObjectsStore().erase<Pet>(GetObjectGuid(), (Pet*)NULL); }
|
||||
|
||||
///- Don't call the function for Creature, normal mobs + totems go in a different storage
|
||||
Unit::RemoveFromWorld();
|
||||
|
|
@ -89,19 +89,19 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
if (petnumber)
|
||||
// known petnumber entry 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
||||
ownerid, petnumber);
|
||||
"FROM character_pet WHERE owner = '%u' AND id = '%u'",
|
||||
ownerid, petnumber);
|
||||
else if (current)
|
||||
// current pet (slot 0) 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND slot = '%u'",
|
||||
ownerid, PET_SAVE_AS_CURRENT );
|
||||
"FROM character_pet WHERE owner = '%u' AND slot = '%u'",
|
||||
ownerid, PET_SAVE_AS_CURRENT);
|
||||
else if (petentry)
|
||||
// known petentry entry (unique for summoned pet, but non unique for hunter pet (only from current or not stabled pets)
|
||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
result = CharacterDatabase.PQuery("SELECT id, entry, owner, modelid, level, exp, Reactstate, slot, name, renamed, curhealth, curmana, abdata, savetime, resettalents_cost, resettalents_time, CreatedBySpell, PetType "
|
||||
"FROM character_pet WHERE owner = '%u' AND entry = '%u' AND (slot = '%u' OR slot > '%u') ",
|
||||
ownerid, petentry,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
|
||||
"FROM character_pet WHERE owner = '%u' AND entry = '%u' AND (slot = '%u' OR slot > '%u') ",
|
||||
ownerid, petentry, PET_SAVE_AS_CURRENT, PET_SAVE_LAST_STABLE_SLOT);
|
||||
else
|
||||
// any current or other non-stabled pet (for hunter "call pet")
|
||||
// 0 1 2(?) 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
||||
|
|
@ -200,7 +200,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
sLog.outError("Pet have incorrect type (%u) for pet loading.", getPetType());
|
||||
|
||||
if (owner->IsPvP())
|
||||
SetPvP(true);
|
||||
{ SetPvP(true); }
|
||||
|
||||
if (owner->IsFFAPvP())
|
||||
SetFFAPvP(true);
|
||||
|
|
@ -292,7 +292,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
{
|
||||
((Player*)owner)->PetSpellInitialize();
|
||||
if (((Player*)owner)->GetGroup())
|
||||
((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_PET);
|
||||
{ ((Player*)owner)->SetGroupUpdateFlag(GROUP_UPDATE_PET); }
|
||||
|
||||
((Player*)owner)->SendTalentsInfoData(true);
|
||||
}
|
||||
|
|
@ -323,19 +323,19 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||
void Pet::SavePetToDB(PetSaveMode mode)
|
||||
{
|
||||
if (!GetEntry())
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
// save only fully controlled creature
|
||||
if (!isControlled())
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
// not save not player pets
|
||||
if (!GetOwnerGuid().IsPlayer())
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
Player* pOwner = (Player*)GetOwner();
|
||||
if (!pOwner)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
// current/stable/not_in_slot
|
||||
if (mode >= PET_SAVE_AS_CURRENT)
|
||||
|
|
@ -355,7 +355,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
{
|
||||
// pet will lost anyway at restore temporary unsummoned
|
||||
if (getPetType() == HUNTER_PET)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
// for warlock case
|
||||
mode = PET_SAVE_NOT_IN_SLOT;
|
||||
|
|
@ -366,7 +366,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
|
||||
// stable and not in slot saves
|
||||
if (mode != PET_SAVE_AS_CURRENT)
|
||||
RemoveAllAuras();
|
||||
{ RemoveAllAuras(); }
|
||||
|
||||
// save pet's data as one single transaction
|
||||
CharacterDatabase.BeginTransaction();
|
||||
|
|
@ -445,7 +445,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
|||
void Pet::DeleteFromDB(uint32 guidlow, bool separate_transaction)
|
||||
{
|
||||
if (separate_transaction)
|
||||
CharacterDatabase.BeginTransaction();
|
||||
{ CharacterDatabase.BeginTransaction(); }
|
||||
|
||||
static SqlStatementID delPet ;
|
||||
static SqlStatementID delDeclName ;
|
||||
|
|
@ -469,7 +469,7 @@ void Pet::DeleteFromDB(uint32 guidlow, bool separate_transaction)
|
|||
stmt.PExecute(guidlow);
|
||||
|
||||
if (separate_transaction)
|
||||
CharacterDatabase.CommitTransaction();
|
||||
{ CharacterDatabase.CommitTransaction(); }
|
||||
}
|
||||
|
||||
void Pet::SetDeathState(DeathState s) // overwrite virtual Creature::SetDeathState and Unit::SetDeathState
|
||||
|
|
@ -479,7 +479,7 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual
|
|||
{
|
||||
// remove summoned pet (no corpse)
|
||||
if (getPetType() == SUMMON_PET)
|
||||
Unsummon(PET_SAVE_NOT_IN_SLOT);
|
||||
{ Unsummon(PET_SAVE_NOT_IN_SLOT); }
|
||||
// other will despawn at corpse desppawning (Pet::Update code)
|
||||
else
|
||||
{
|
||||
|
|
@ -500,7 +500,7 @@ void Pet::SetDeathState(DeathState s) // overwrite virtual
|
|||
void Pet::Update(uint32 update_diff, uint32 diff)
|
||||
{
|
||||
if (m_removed) // pet already removed, just wait in remove queue, no updates
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
switch (m_deathState)
|
||||
{
|
||||
|
|
@ -519,8 +519,8 @@ void Pet::Update(uint32 update_diff, uint32 diff)
|
|||
// unsummon pet that lost owner
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner ||
|
||||
(!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGuid() && (owner->GetCharmGuid() != GetObjectGuid()))) ||
|
||||
(isControlled() && !owner->GetPetGuid()))
|
||||
(!IsWithinDistInMap(owner, GetMap()->GetVisibilityDistance()) && (owner->GetCharmGuid() && (owner->GetCharmGuid() != GetObjectGuid()))) ||
|
||||
(isControlled() && !owner->GetPetGuid()))
|
||||
{
|
||||
Unsummon(PET_SAVE_REAGENTS);
|
||||
return;
|
||||
|
|
@ -538,7 +538,7 @@ void Pet::Update(uint32 update_diff, uint32 diff)
|
|||
if (m_duration > 0)
|
||||
{
|
||||
if (m_duration > (int32)update_diff)
|
||||
m_duration -= (int32)update_diff;
|
||||
{ m_duration -= (int32)update_diff; }
|
||||
else
|
||||
{
|
||||
Unsummon(getPetType() != SUMMON_PET ? PET_SAVE_AS_DELETED : PET_SAVE_NOT_IN_SLOT, owner);
|
||||
|
|
@ -560,14 +560,14 @@ void Pet::RegenerateAll(uint32 update_diff)
|
|||
if (m_regenTimer <= update_diff)
|
||||
{
|
||||
if (!IsInCombat() || IsPolymorphed())
|
||||
RegenerateHealth();
|
||||
{ RegenerateHealth(); }
|
||||
|
||||
RegeneratePower();
|
||||
|
||||
m_regenTimer = 4000;
|
||||
}
|
||||
else
|
||||
m_regenTimer -= update_diff;
|
||||
{ m_regenTimer -= update_diff; }
|
||||
}
|
||||
|
||||
bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
||||
|
|
@ -576,17 +576,17 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
|||
uint32 chainstartstore[ACTIVE_SPELLS_MAX];
|
||||
|
||||
if (IsPassiveSpell(spellid))
|
||||
return true;
|
||||
{ return true; }
|
||||
|
||||
chainstartstore[0] = sSpellMgr.GetFirstSpellInChain(spellid);
|
||||
|
||||
for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
|
||||
{
|
||||
if (itr->second.state == PETSPELL_REMOVED)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
if (IsPassiveSpell(itr->first))
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
uint32 chainstart = sSpellMgr.GetFirstSpellInChain(itr->first);
|
||||
|
||||
|
|
@ -595,14 +595,14 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
|||
for (x = 0; x < activecount; ++x)
|
||||
{
|
||||
if (chainstart == chainstartstore[x])
|
||||
break;
|
||||
{ break; }
|
||||
}
|
||||
|
||||
if (x == activecount) // spellchain not yet saved -> add active count
|
||||
{
|
||||
++activecount;
|
||||
if (activecount > ACTIVE_SPELLS_MAX)
|
||||
return false;
|
||||
{ return false; }
|
||||
chainstartstore[x] = chainstart;
|
||||
}
|
||||
}
|
||||
|
|
@ -612,30 +612,29 @@ bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
|
|||
void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
||||
{
|
||||
if (!owner)
|
||||
owner = GetOwner();
|
||||
{ owner = GetOwner(); }
|
||||
|
||||
CombatStop();
|
||||
|
||||
if (owner)
|
||||
{
|
||||
if (GetOwnerGuid() != owner->GetObjectGuid())
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
Player* p_owner = owner->GetTypeId() == TYPEID_PLAYER ? (Player*)owner : NULL;
|
||||
|
||||
if (p_owner)
|
||||
{
|
||||
|
||||
// not save secondary permanent pet as current
|
||||
if (mode == PET_SAVE_AS_CURRENT && p_owner->GetTemporaryUnsummonedPetNumber() &&
|
||||
p_owner->GetTemporaryUnsummonedPetNumber() != GetCharmInfo()->GetPetNumber())
|
||||
mode = PET_SAVE_NOT_IN_SLOT;
|
||||
p_owner->GetTemporaryUnsummonedPetNumber() != GetCharmInfo()->GetPetNumber())
|
||||
{ mode = PET_SAVE_NOT_IN_SLOT; }
|
||||
|
||||
if (mode == PET_SAVE_REAGENTS)
|
||||
{
|
||||
// returning of reagents only for players, so best done here
|
||||
uint32 spellId = GetUInt32Value(UNIT_CREATED_BY_SPELL);
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
SpellReagentsEntry const* spellReagents = spellInfo ? spellInfo->GetSpellReagents() : NULL;
|
||||
|
||||
if (spellReagents)
|
||||
|
|
@ -644,7 +643,7 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
{
|
||||
if (spellReagents->Reagent[i] > 0)
|
||||
{
|
||||
ItemPosCountVec dest; //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout)
|
||||
ItemPosCountVec dest; // for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout)
|
||||
uint8 msg = p_owner->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellReagents->Reagent[i], spellReagents->ReagentCount[i]);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
|
|
@ -662,7 +661,7 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
p_owner->RemovePetActionBar();
|
||||
|
||||
if (p_owner->GetGroup())
|
||||
p_owner->SetGroupUpdateFlag(GROUP_UPDATE_PET);
|
||||
{ p_owner->SetGroupUpdateFlag(GROUP_UPDATE_PET); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -679,7 +678,7 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
break;
|
||||
default:
|
||||
if (owner->GetPetGuid() == GetObjectGuid())
|
||||
owner->SetPet(NULL);
|
||||
{ owner->SetPet(NULL); }
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -692,20 +691,20 @@ void Pet::Unsummon(PetSaveMode mode, Unit* owner /*= NULL*/)
|
|||
void Pet::GivePetXP(uint32 xp)
|
||||
{
|
||||
if (getPetType() != HUNTER_PET)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
if (xp < 1)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
if (!IsAlive())
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
uint32 level = getLevel();
|
||||
uint32 maxlevel = std::min(sWorld.getConfig(CONFIG_UINT32_MAX_PLAYER_LEVEL), GetOwner()->getLevel());
|
||||
|
||||
// pet not receive xp for level equal to owner level
|
||||
if (level >= maxlevel)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
xp *= sWorld.getConfig(CONFIG_FLOAT_RATE_PET_XP_KILL);
|
||||
|
||||
|
|
@ -729,7 +728,7 @@ void Pet::GivePetXP(uint32 xp)
|
|||
void Pet::GivePetLevel(uint32 level)
|
||||
{
|
||||
if (!level || level == getLevel())
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
if (getPetType() == HUNTER_PET)
|
||||
{
|
||||
|
|
@ -757,7 +756,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
|||
BASIC_LOG("Create pet");
|
||||
uint32 pet_number = sObjectMgr.GeneratePetNumber();
|
||||
if (!Create(guid, pos, creature->GetCreatureInfo(), pet_number))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
|
|
@ -775,9 +774,9 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
|
|||
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
|
||||
if (CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family))
|
||||
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
|
||||
{ SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]); }
|
||||
else
|
||||
SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex()));
|
||||
{ SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex())); }
|
||||
|
||||
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_WARRIOR);
|
||||
SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_NONE);
|
||||
|
|
@ -906,9 +905,9 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
case CLASS_WARLOCK:
|
||||
{
|
||||
// the damage bonus used for pets is either fire or shadow damage, whatever is higher
|
||||
uint32 fire = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
|
||||
uint32 fire = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FIRE);
|
||||
uint32 shadow = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW);
|
||||
uint32 val = (fire > shadow) ? fire : shadow;
|
||||
uint32 val = (fire > shadow) ? fire : shadow;
|
||||
|
||||
SetBonusDamage(int32(val * 0.15f));
|
||||
// bonusAP += val * 0.57;
|
||||
|
|
@ -919,7 +918,7 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
// 40% damage bonus of mage's frost damage
|
||||
float val = owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST) * 0.4f;
|
||||
if (val < 0)
|
||||
val = 0;
|
||||
{ val = 0; }
|
||||
SetBonusDamage(int32(val));
|
||||
break;
|
||||
}
|
||||
|
|
@ -1098,15 +1097,15 @@ void Pet::InitStatsForLevel(uint32 petlevel)
|
|||
bool Pet::HaveInDiet(ItemPrototype const* item) const
|
||||
{
|
||||
if (!item->FoodType)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family);
|
||||
if (!cFamily)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
uint32 diet = cFamily->petFoodMask;
|
||||
uint32 FoodMask = 1 << (item->FoodType - 1);
|
||||
|
|
@ -1117,16 +1116,16 @@ uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
|
|||
{
|
||||
// -5 or greater food level
|
||||
if (getLevel() <= itemlevel + 5) // possible to feed level 60 pet with level 55 level food for full effect
|
||||
return 35000;
|
||||
{ return 35000; }
|
||||
// -10..-6
|
||||
else if (getLevel() <= itemlevel + 10) // pure guess, but sounds good
|
||||
return 17000;
|
||||
{ return 17000; }
|
||||
// -14..-11
|
||||
else if (getLevel() <= itemlevel + 14) // level 55 food gets green on 70, makes sense to me
|
||||
return 8000;
|
||||
{ return 8000; }
|
||||
// -15 or less
|
||||
else
|
||||
return 0; // food too low level
|
||||
{ return 0; } // food too low level
|
||||
}
|
||||
|
||||
void Pet::_LoadSpellCooldowns()
|
||||
|
|
@ -1159,7 +1158,7 @@ void Pet::_LoadSpellCooldowns()
|
|||
|
||||
// skip outdated cooldown
|
||||
if (db_time <= curTime)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
data << uint32(spell_id);
|
||||
data << uint32(uint32(db_time - curTime)*IN_MILLISECONDS);
|
||||
|
|
@ -1193,7 +1192,7 @@ void Pet::_SaveSpellCooldowns()
|
|||
for (CreatureSpellCooldowns::iterator itr = m_CreatureSpellCooldowns.begin(); itr != m_CreatureSpellCooldowns.end();)
|
||||
{
|
||||
if (itr->second <= curTime)
|
||||
m_CreatureSpellCooldowns.erase(itr++);
|
||||
{ m_CreatureSpellCooldowns.erase(itr++); }
|
||||
else
|
||||
{
|
||||
stmt = CharacterDatabase.CreateStatement(insSpellCD, "INSERT INTO pet_spell_cooldown (guid,spell,time) VALUES (?, ?, ?)");
|
||||
|
|
@ -1232,7 +1231,7 @@ void Pet::_SaveSpells()
|
|||
|
||||
// prevent saving family passives to DB
|
||||
if (itr->second.type == PETSPELL_FAMILY)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
switch (itr->second.state)
|
||||
{
|
||||
|
|
@ -1304,12 +1303,12 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
|
||||
// do not load single target auras (unless they were cast by the player)
|
||||
if (casterGuid != GetObjectGuid() && IsSingleTargetSpell(spellproto))
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
if (remaintime != -1 && !IsPositiveSpell(spellproto))
|
||||
{
|
||||
if (remaintime / IN_MILLISECONDS <= int32(timediff))
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
remaintime -= timediff * IN_MILLISECONDS;
|
||||
}
|
||||
|
|
@ -1322,15 +1321,15 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
remaincharges = procCharges;
|
||||
}
|
||||
else
|
||||
remaincharges = 0;
|
||||
{ remaincharges = 0; }
|
||||
|
||||
uint32 defstackamount = spellproto->GetStackAmount();
|
||||
if (!defstackamount)
|
||||
stackcount = 1;
|
||||
{ stackcount = 1; }
|
||||
else if (defstackamount < stackcount)
|
||||
stackcount = defstackamount;
|
||||
else if (!stackcount)
|
||||
stackcount = 1;
|
||||
{ stackcount = 1; }
|
||||
|
||||
SpellAuraHolder* holder = CreateSpellAuraHolder(spellproto, this, NULL);
|
||||
holder->SetLoadedState(casterGuid, ObjectGuid(HIGHGUID_ITEM, item_lowguid), stackcount, remaincharges, maxduration, remaintime);
|
||||
|
|
@ -1338,20 +1337,20 @@ void Pet::_LoadAuras(uint32 timediff)
|
|||
for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if ((effIndexMask & (1 << i)) == 0)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
Aura* aura = CreateAura(spellproto, SpellEffectIndex(i), NULL, holder, this);
|
||||
if (!damage[i])
|
||||
damage[i] = aura->GetModifier()->m_amount;
|
||||
{ damage[i] = aura->GetModifier()->m_amount; }
|
||||
|
||||
aura->SetLoadedState(damage[i], periodicTime[i]);
|
||||
holder->AddAura(aura, SpellEffectIndex(i));
|
||||
}
|
||||
|
||||
if (!holder->IsEmptyHolder())
|
||||
AddSpellAuraHolder(holder);
|
||||
{ AddSpellAuraHolder(holder); }
|
||||
else
|
||||
delete holder;
|
||||
{ delete holder; }
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
|
|
@ -1370,7 +1369,7 @@ void Pet::_SaveAuras()
|
|||
SpellAuraHolderMap const& auraHolders = GetSpellAuraHolderMap();
|
||||
|
||||
if (auraHolders.empty())
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
stmt = CharacterDatabase.CreateStatement(insAuras, "INSERT INTO pet_aura (guid, caster_guid, item_guid, spell, stackcount, remaincharges, "
|
||||
"basepoints0, basepoints1, basepoints2, periodictime0, periodictime1, periodictime2, maxduration, remaintime, effIndexMask) "
|
||||
|
|
@ -1414,7 +1413,7 @@ void Pet::_SaveAuras()
|
|||
{
|
||||
// don't save not own area auras
|
||||
if (aur->IsAreaAura() && holder->GetCasterGuid() != GetObjectGuid())
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
damage[i] = aur->GetModifier()->m_amount;
|
||||
periodicTime[i] = aur->GetModifier()->periodictime;
|
||||
|
|
@ -1423,7 +1422,7 @@ void Pet::_SaveAuras()
|
|||
}
|
||||
|
||||
if (!effIndexMask)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
stmt.addUInt32(m_charmInfo->GetPetNumber());
|
||||
stmt.addUInt64(holder->GetCasterGuid().GetRawValue());
|
||||
|
|
@ -1433,10 +1432,10 @@ void Pet::_SaveAuras()
|
|||
stmt.addUInt8(holder->GetAuraCharges());
|
||||
|
||||
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
stmt.addInt32(damage[i]);
|
||||
{ stmt.addInt32(damage[i]); }
|
||||
|
||||
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
stmt.addUInt32(periodicTime[i]);
|
||||
{ stmt.addUInt32(periodicTime[i]); }
|
||||
|
||||
stmt.addInt32(holder->GetAuraMaxDuration());
|
||||
stmt.addInt32(holder->GetAuraDuration());
|
||||
|
|
@ -1458,7 +1457,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'", spell_id);
|
||||
}
|
||||
else
|
||||
sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id);
|
||||
{ sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id); }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1477,14 +1476,14 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
itr->second.state = PETSPELL_UNCHANGED;
|
||||
|
||||
if (active == ACT_ENABLED)
|
||||
ToggleAutocast(spell_id, true);
|
||||
{ ToggleAutocast(spell_id, true); }
|
||||
else if (active == ACT_DISABLED)
|
||||
ToggleAutocast(spell_id, false);
|
||||
{ ToggleAutocast(spell_id, false); }
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
{ return false; }
|
||||
}
|
||||
|
||||
uint32 oldspell_id = 0;
|
||||
|
|
@ -1496,12 +1495,12 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
if (active == ACT_DECIDE) // active was not used before, so we save it's autocast/passive state here
|
||||
{
|
||||
if (IsPassiveSpell(spellInfo))
|
||||
newspell.active = ACT_PASSIVE;
|
||||
{ newspell.active = ACT_PASSIVE; }
|
||||
else
|
||||
newspell.active = ACT_DISABLED;
|
||||
{ newspell.active = ACT_DISABLED; }
|
||||
}
|
||||
else
|
||||
newspell.active = active;
|
||||
{ newspell.active = active; }
|
||||
|
||||
// talent: unlearn all other talent ranks (high and low)
|
||||
if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
|
||||
|
|
@ -1544,7 +1543,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
}
|
||||
// ignore new lesser rank
|
||||
else if (sSpellMgr.IsHighRankOfSpell(itr2->first, spell_id))
|
||||
return false;
|
||||
{ return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1552,12 +1551,12 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
|
|||
m_spells[spell_id] = newspell;
|
||||
|
||||
if (IsPassiveSpell(spellInfo))
|
||||
CastSpell(this, spell_id, true);
|
||||
{ CastSpell(this, spell_id, true); }
|
||||
else
|
||||
m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active));
|
||||
{ m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active)); }
|
||||
|
||||
if (newspell.active == ACT_ENABLED)
|
||||
ToggleAutocast(spell_id, true);
|
||||
{ ToggleAutocast(spell_id, true); }
|
||||
|
||||
uint32 talentCost = GetTalentSpellCost(spell_id);
|
||||
if (talentCost)
|
||||
|
|
@ -1572,7 +1571,7 @@ bool Pet::learnSpell(uint32 spell_id)
|
|||
{
|
||||
// prevent duplicated entires in spell book
|
||||
if (!addSpell(spell_id))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
if (!m_loading)
|
||||
{
|
||||
|
|
@ -1583,7 +1582,7 @@ bool Pet::learnSpell(uint32 spell_id)
|
|||
data << uint32(spell_id);
|
||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||
|
||||
((Player*)owner)->PetSpellInitialize();
|
||||
{ ((Player*)owner)->PetSpellInitialize(); }
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1620,7 +1619,7 @@ void Pet::InitLevelupSpellsForLevel()
|
|||
|
||||
// will called first if level down
|
||||
if(spellEntry->GetSpellLevel() > level)
|
||||
unlearnSpell(spellEntry->Id,true);
|
||||
unlearnSpell(spellEntry->Id, true);
|
||||
// will called if level up
|
||||
else
|
||||
learnSpell(spellEntry->Id);
|
||||
|
|
@ -1644,7 +1643,7 @@ bool Pet::unlearnSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
{ return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1653,15 +1652,15 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
{
|
||||
PetSpellMap::iterator itr = m_spells.find(spell_id);
|
||||
if (itr == m_spells.end())
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
if (itr->second.state == PETSPELL_REMOVED)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
if (itr->second.state == PETSPELL_NEW)
|
||||
m_spells.erase(itr);
|
||||
{ m_spells.erase(itr); }
|
||||
else
|
||||
itr->second.state = PETSPELL_REMOVED;
|
||||
{ itr->second.state = PETSPELL_REMOVED; }
|
||||
|
||||
RemoveAurasDueToSpell(spell_id);
|
||||
|
||||
|
|
@ -1679,9 +1678,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
if (learn_prev)
|
||||
{
|
||||
if (uint32 prev_id = sSpellMgr.GetPrevSpellInChain(spell_id))
|
||||
learnSpell(prev_id);
|
||||
{ learnSpell(prev_id); }
|
||||
else
|
||||
learn_prev = false;
|
||||
{ learn_prev = false; }
|
||||
}
|
||||
|
||||
// if remove last rank or non-ranked then update action bar at server and client if need
|
||||
|
|
@ -1692,7 +1691,7 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
|
|||
// need update action bar for last removed rank
|
||||
if (Unit* owner = GetOwner())
|
||||
if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)owner)->PetSpellInitialize();
|
||||
{ ((Player*)owner)->PetSpellInitialize(); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1705,7 +1704,7 @@ void Pet::CleanupActionBar()
|
|||
if (UnitActionBarEntry const* ab = m_charmInfo->GetActionBarEntry(i))
|
||||
if (uint32 action = ab->GetAction())
|
||||
if (ab->IsActionBarForSpell() && !HasSpell(action))
|
||||
m_charmInfo->SetActionBar(i, 0, ACT_DISABLED);
|
||||
{ m_charmInfo->SetActionBar(i, 0, ACT_DISABLED); }
|
||||
}
|
||||
|
||||
void Pet::InitPetCreateSpells()
|
||||
|
|
@ -1915,16 +1914,16 @@ uint32 Pet::resetTalentsCost() const
|
|||
|
||||
// The first time reset costs 10 silver; after 1 day cost is reset to 10 silver
|
||||
if (m_resetTalentsCost < 10 * SILVER || days > 0)
|
||||
return 10 * SILVER;
|
||||
{ return 10 * SILVER; }
|
||||
// then 50 silver
|
||||
else if (m_resetTalentsCost < 50 * SILVER)
|
||||
return 50 * SILVER;
|
||||
{ return 50 * SILVER; }
|
||||
// then 1 gold
|
||||
else if (m_resetTalentsCost < 1 * GOLD)
|
||||
return 1 * GOLD;
|
||||
{ return 1 * GOLD; }
|
||||
// then increasing at a rate of 1 gold; cap 10 gold
|
||||
else
|
||||
return (m_resetTalentsCost + 1 * GOLD > 10 * GOLD ? 10 * GOLD : m_resetTalentsCost + 1 * GOLD);
|
||||
{ return (m_resetTalentsCost + 1 * GOLD > 10 * GOLD ? 10 * GOLD : m_resetTalentsCost + 1 * GOLD); }
|
||||
}
|
||||
|
||||
uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
|
||||
|
|
@ -1939,17 +1938,17 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
|
|||
void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
||||
{
|
||||
if (IsPassiveSpell(spellid))
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
PetSpellMap::iterator itr = m_spells.find(spellid);
|
||||
PetSpell& petSpell = itr->second;
|
||||
PetSpell &petSpell = itr->second;
|
||||
|
||||
uint32 i;
|
||||
|
||||
if (apply)
|
||||
{
|
||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i)
|
||||
; // just search
|
||||
{ ; } // just search
|
||||
|
||||
if (i == m_autospells.size())
|
||||
{
|
||||
|
|
@ -1959,7 +1958,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
{
|
||||
petSpell.active = ACT_ENABLED;
|
||||
if (petSpell.state != PETSPELL_NEW)
|
||||
petSpell.state = PETSPELL_CHANGED;
|
||||
{ petSpell.state = PETSPELL_CHANGED; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1967,7 +1966,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
{
|
||||
AutoSpellList::iterator itr2 = m_autospells.begin();
|
||||
for (i = 0; i < m_autospells.size() && m_autospells[i] != spellid; ++i, ++itr2)
|
||||
; // just search
|
||||
{ ; } // just search
|
||||
|
||||
if (i < m_autospells.size())
|
||||
{
|
||||
|
|
@ -1976,7 +1975,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
|
|||
{
|
||||
petSpell.active = ACT_DISABLED;
|
||||
if (petSpell.state != PETSPELL_NEW)
|
||||
petSpell.state = PETSPELL_CHANGED;
|
||||
{ petSpell.state = PETSPELL_CHANGED; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1992,17 +1991,17 @@ bool Pet::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const* ci
|
|||
m_originalEntry = cinfo->Entry;
|
||||
|
||||
if (!InitEntry(cinfo->Entry))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
cPos.SelectFinalPoint(this);
|
||||
|
||||
if (!cPos.Relocate(this))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
SetSheath(SHEATH_STATE_MELEE);
|
||||
|
||||
if (getPetType() == MINI_PET) // always non-attackable
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
{ SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2018,17 +2017,17 @@ void Pet::LearnPetPassives()
|
|||
{
|
||||
CreatureInfo const* cInfo = GetCreatureInfo();
|
||||
if (!cInfo)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(cInfo->Family);
|
||||
if (!cFamily)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
PetFamilySpellsStore::const_iterator petStore = sPetFamilySpellsStore.find(cFamily->ID);
|
||||
if (petStore != sPetFamilySpellsStore.end())
|
||||
{
|
||||
for (PetFamilySpellsSet::const_iterator petSet = petStore->second.begin(); petSet != petStore->second.end(); ++petSet)
|
||||
addSpell(*petSet, ACT_DECIDE, PETSPELL_NEW, PETSPELL_FAMILY);
|
||||
{ addSpell(*petSet, ACT_DECIDE, PETSPELL_NEW, PETSPELL_FAMILY); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2045,9 +2044,9 @@ void Pet::CastPetAuras(bool current)
|
|||
++itr;
|
||||
|
||||
if (!current && pa->IsRemovedOnChangePet())
|
||||
owner->RemovePetAura(pa);
|
||||
{ owner->RemovePetAura(pa); }
|
||||
else
|
||||
CastPetAura(pa);
|
||||
{ CastPetAura(pa); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2056,7 +2055,7 @@ void Pet::CastOwnerTalentAuras()
|
|||
if (!GetOwner() || GetOwner()->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* pOwner = static_cast<Player*>(GetOwner());
|
||||
Player* pOwner = static_cast<Player *>(GetOwner());
|
||||
|
||||
// Handle Ferocious Inspiration Talent
|
||||
if (pOwner && pOwner->getClass() == CLASS_HUNTER)
|
||||
|
|
@ -2093,7 +2092,7 @@ void Pet::CastPetAura(PetAura const* aura)
|
|||
{
|
||||
uint32 auraId = aura->GetAura(GetEntry());
|
||||
if (!auraId)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
if (auraId == 35696) // Demonic Knowledge
|
||||
{
|
||||
|
|
@ -2101,7 +2100,7 @@ void Pet::CastPetAura(PetAura const* aura)
|
|||
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
|
||||
}
|
||||
else
|
||||
CastSpell(this, auraId, true);
|
||||
{ CastSpell(this, auraId, true); }
|
||||
}
|
||||
|
||||
struct DoPetLearnSpell
|
||||
|
|
@ -2123,7 +2122,7 @@ void Pet::SynchronizeLevelWithOwner()
|
|||
{
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
switch (getPetType())
|
||||
{
|
||||
|
|
@ -2134,7 +2133,7 @@ void Pet::SynchronizeLevelWithOwner()
|
|||
// can't be greater owner level
|
||||
case HUNTER_PET:
|
||||
if (getLevel() > owner->getLevel())
|
||||
GivePetLevel(owner->getLevel());
|
||||
{ GivePetLevel(owner->getLevel()); }
|
||||
else if (getLevel() + 5 < owner->getLevel())
|
||||
GivePetLevel(owner->getLevel() - 5);
|
||||
break;
|
||||
|
|
@ -2149,7 +2148,7 @@ void Pet::SetModeFlags(PetModeFlags mode)
|
|||
|
||||
Unit* owner = GetOwner();
|
||||
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
WorldPacket data(SMSG_PET_MODE, 12);
|
||||
data << GetObjectGuid();
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ typedef std::vector<uint32> AutoSpellList;
|
|||
|
||||
class Player;
|
||||
|
||||
class Pet : public Creature
|
||||
class Pet : public Creature
|
||||
{
|
||||
public:
|
||||
explicit Pet(PetType type = MAX_PET_TYPE);
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
int PetAI::Permissible(const Creature* creature)
|
||||
{
|
||||
if (creature->IsPet())
|
||||
return PERMIT_BASE_SPECIAL;
|
||||
{ return PERMIT_BASE_SPECIAL; }
|
||||
|
||||
return PERMIT_BASE_NO;
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ void PetAI::MoveInLineOfSight(Unit* pWho)
|
|||
void PetAI::AttackStart(Unit* u)
|
||||
{
|
||||
if (!u || (m_creature->IsPet() && ((Pet*)m_creature)->getPetType() == MINI_PET))
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
if (m_creature->Attack(u, true))
|
||||
{
|
||||
|
|
@ -103,7 +103,7 @@ bool PetAI::_needToStop() const
|
|||
{
|
||||
// This is needed for charmed creatures, as once their target was reset other effects can trigger threat
|
||||
if (m_creature->IsCharmed() && m_creature->getVictim() == m_creature->GetCharmer())
|
||||
return true;
|
||||
{ return true; }
|
||||
|
||||
return !m_creature->getVictim()->IsTargetableForAttack();
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ void PetAI::_stopAttack()
|
|||
void PetAI::UpdateAI(const uint32 diff)
|
||||
{
|
||||
if (!m_creature->IsAlive())
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
Unit* owner = m_creature->GetCharmerOrOwner();
|
||||
Unit* victim = NULL;
|
||||
|
|
@ -144,9 +144,9 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
|
||||
if (m_updateAlliesTimer <= diff)
|
||||
// UpdateAllies self set update timer
|
||||
UpdateAllies();
|
||||
{ UpdateAllies(); }
|
||||
else
|
||||
m_updateAlliesTimer -= diff;
|
||||
{ m_updateAlliesTimer -= diff; }
|
||||
|
||||
if (inCombat && !victim)
|
||||
{
|
||||
|
|
@ -218,21 +218,21 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
{
|
||||
uint32 spellID = m_creature->GetPetAutoSpellOnPos(i);
|
||||
if (!spellID)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellID);
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
if (m_creature->GetCharmInfo() && m_creature->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(spellInfo))
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
// ignore some combinations of combat state and combat/noncombat spells
|
||||
if (!inCombat)
|
||||
{
|
||||
// ignore attacking spells, and allow only self/around spells
|
||||
if (!IsPositiveSpell(spellInfo->Id))
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
// non combat spells allowed
|
||||
// only pet spells have IsNonCombatSpell and not fit this reqs:
|
||||
|
|
@ -242,14 +242,14 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
int32 duration = GetSpellDuration(spellInfo);
|
||||
SpellPowerEntry const* spellPower = spellInfo->GetSpellPower();
|
||||
if (spellPower && (spellPower->manaCost || spellPower->ManaCostPercentage || spellPower->manaPerSecond) && duration > 0)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
// allow only spell without cooldown > duration
|
||||
int32 cooldown = GetSpellRecoveryTime(spellInfo);
|
||||
|
||||
// allow only spell not on cooldown
|
||||
if (cooldown != 0 && duration < cooldown)
|
||||
continue;
|
||||
{ continue; }
|
||||
}
|
||||
}
|
||||
// just ignore non-combat spells
|
||||
|
|
@ -272,7 +272,7 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
|
||||
// only buff targets that are in combat, unless the spell can only be cast while out of combat
|
||||
if (!Target)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
if (spell->CanAutoCast(Target))
|
||||
{
|
||||
|
|
@ -282,7 +282,7 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
}
|
||||
}
|
||||
if (!spellUsed)
|
||||
delete spell;
|
||||
{ delete spell; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -303,10 +303,10 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
{
|
||||
m_creature->SetInFront(target);
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
m_creature->SendCreateUpdateToPlayer((Player*)target);
|
||||
{ m_creature->SendCreateUpdateToPlayer((Player*)target); }
|
||||
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
m_creature->SendCreateUpdateToPlayer((Player*)owner);
|
||||
{ m_creature->SendCreateUpdateToPlayer((Player*)owner); }
|
||||
}
|
||||
|
||||
m_creature->AddCreatureSpellCooldown(spell->m_spellInfo->Id);
|
||||
|
|
@ -316,7 +316,7 @@ void PetAI::UpdateAI(const uint32 diff)
|
|||
|
||||
// deleted cached Spell objects
|
||||
for (TargetSpellList::const_iterator itr = targetSpellStore.begin(); itr != targetSpellStore.end(); ++itr)
|
||||
delete itr->second;
|
||||
{ delete itr->second; }
|
||||
}
|
||||
|
||||
// Guardians will always look in threat list for victim
|
||||
|
|
@ -433,16 +433,16 @@ void PetAI::UpdateAllies()
|
|||
m_updateAlliesTimer = 10 * IN_MILLISECONDS; // update friendly targets every 10 seconds, lesser checks increase performance
|
||||
|
||||
if (!owner)
|
||||
return;
|
||||
{ return; }
|
||||
else if (owner->GetTypeId() == TYPEID_PLAYER)
|
||||
pGroup = ((Player*)owner)->GetGroup();
|
||||
{ pGroup = ((Player*)owner)->GetGroup(); }
|
||||
|
||||
// only pet and owner/not in group->ok
|
||||
if (m_AllySet.size() == 2 && !pGroup)
|
||||
return;
|
||||
{ return; }
|
||||
// owner is in group; group members filled in already (no raid -> subgroupcount = whole count)
|
||||
if (pGroup && !pGroup->isRaidGroup() && m_AllySet.size() == (pGroup->GetMembersCount() + 2))
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
m_AllySet.clear();
|
||||
m_AllySet.insert(m_creature->GetObjectGuid());
|
||||
|
|
@ -452,16 +452,16 @@ void PetAI::UpdateAllies()
|
|||
{
|
||||
Player* target = itr->getSource();
|
||||
if (!target || !pGroup->SameSubGroup((Player*)owner, target))
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
if (target->GetObjectGuid() == owner->GetObjectGuid())
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
m_AllySet.insert(target->GetObjectGuid());
|
||||
}
|
||||
}
|
||||
else // remove group
|
||||
m_AllySet.insert(owner->GetObjectGuid());
|
||||
{ m_AllySet.insert(owner->GetObjectGuid()); }
|
||||
}
|
||||
|
||||
void PetAI::AttackedBy(Unit* attacker)
|
||||
|
|
@ -470,5 +470,5 @@ void PetAI::AttackedBy(Unit* attacker)
|
|||
if (!(m_creature->getVictim() || ((Pet*)m_creature)->GetIsRetreating() == true)
|
||||
&& !(m_creature->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)
|
||||
|| (m_creature->GetCharmInfo() && m_creature->GetCharmInfo()->HasReactState(REACT_PASSIVE))))
|
||||
AttackStart(attacker);
|
||||
{ AttackStart(attacker); }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
#include "Calendar.h"
|
||||
#ifdef ENABLE_ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif /*ENABLE_ELUNA*/
|
||||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
|
@ -223,11 +223,11 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
|
|||
}
|
||||
|
||||
if (m_TaxiDestinations.empty())
|
||||
return true;
|
||||
{ return true; }
|
||||
|
||||
// Check integrity
|
||||
if (m_TaxiDestinations.size() < 2)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
for (size_t i = 1; i < m_TaxiDestinations.size(); ++i)
|
||||
{
|
||||
|
|
@ -235,12 +235,12 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
|
|||
uint32 path;
|
||||
sObjectMgr.GetTaxiPath(m_TaxiDestinations[i - 1], m_TaxiDestinations[i], path, cost);
|
||||
if (!path)
|
||||
return false;
|
||||
{ return false; }
|
||||
}
|
||||
|
||||
// can't load taxi path without mount set (quest taxi path?)
|
||||
if (!sObjectMgr.GetTaxiMountDisplayId(GetTaxiSource(), team, true))
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -248,12 +248,12 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
|
|||
std::string PlayerTaxi::SaveTaxiDestinationsToString()
|
||||
{
|
||||
if (m_TaxiDestinations.empty())
|
||||
return "";
|
||||
{ return ""; }
|
||||
|
||||
std::ostringstream ss;
|
||||
|
||||
for (size_t i = 0; i < m_TaxiDestinations.size(); ++i)
|
||||
ss << m_TaxiDestinations[i] << " ";
|
||||
{ ss << m_TaxiDestinations[i] << " "; }
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
|
@ -261,7 +261,7 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString()
|
|||
uint32 PlayerTaxi::GetCurrentTaxiPath() const
|
||||
{
|
||||
if (m_TaxiDestinations.size() < 2)
|
||||
return 0;
|
||||
{ return 0; }
|
||||
|
||||
uint32 path;
|
||||
uint32 cost;
|
||||
|
|
@ -293,10 +293,11 @@ bool TradeData::HasItem(ObjectGuid item_guid) const
|
|||
{
|
||||
for (int i = 0; i < TRADE_SLOT_COUNT; ++i)
|
||||
if (m_items[i] == item_guid)
|
||||
return true;
|
||||
{ return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Item* TradeData::GetSpellCastItem() const
|
||||
{
|
||||
return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : NULL;
|
||||
|
|
@ -307,7 +308,7 @@ void TradeData::SetItem(TradeSlots slot, Item* item)
|
|||
ObjectGuid itemGuid = item ? item->GetObjectGuid() : ObjectGuid();
|
||||
|
||||
if (m_items[slot] == itemGuid)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
m_items[slot] = itemGuid;
|
||||
|
||||
|
|
@ -318,7 +319,7 @@ void TradeData::SetItem(TradeSlots slot, Item* item)
|
|||
|
||||
// need remove possible trader spell applied to changed item
|
||||
if (slot == TRADE_SLOT_NONTRADED)
|
||||
GetTraderData()->SetSpell(0);
|
||||
{ GetTraderData()->SetSpell(0); }
|
||||
|
||||
// need remove possible player spell applied (possible move reagent)
|
||||
SetSpell(0);
|
||||
|
|
@ -329,7 +330,7 @@ void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/)
|
|||
ObjectGuid itemGuid = castItem ? castItem->GetObjectGuid() : ObjectGuid();
|
||||
|
||||
if (m_spell == spell_id && m_spellCastItem == itemGuid)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
m_spell = spell_id;
|
||||
m_spellCastItem = itemGuid;
|
||||
|
|
@ -344,7 +345,7 @@ void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/)
|
|||
void TradeData::SetMoney(uint64 money)
|
||||
{
|
||||
if (m_money == money)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
if (money > m_player->GetMoney())
|
||||
{
|
||||
|
|
@ -363,9 +364,9 @@ void TradeData::SetMoney(uint64 money)
|
|||
void TradeData::Update(bool for_trader /*= true*/)
|
||||
{
|
||||
if (for_trader)
|
||||
m_trader->GetSession()->SendUpdateTrade(true); // player state for trader
|
||||
{ m_trader->GetSession()->SendUpdateTrade(true); } // player state for trader
|
||||
else
|
||||
m_player->GetSession()->SendUpdateTrade(false); // player state for player
|
||||
{ m_player->GetSession()->SendUpdateTrade(false); } // player state for player
|
||||
}
|
||||
|
||||
void TradeData::SetAccepted(bool state, bool crosssend /*= false*/)
|
||||
|
|
@ -375,9 +376,9 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/)
|
|||
if (!state)
|
||||
{
|
||||
if (crosssend)
|
||||
m_trader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE);
|
||||
{ m_trader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); }
|
||||
else
|
||||
m_player->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE);
|
||||
{ m_player->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -403,11 +404,11 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
|
|||
|
||||
m_ExtraFlags = 0;
|
||||
if (GetSession()->GetSecurity() >= SEC_GAMEMASTER)
|
||||
SetAcceptTicket(true);
|
||||
{ SetAcceptTicket(true); }
|
||||
|
||||
// players always accept
|
||||
if (GetSession()->GetSecurity() == SEC_PLAYER)
|
||||
SetAcceptWhispers(true);
|
||||
{ SetAcceptWhispers(true); }
|
||||
|
||||
m_comboPoints = 0;
|
||||
|
||||
|
|
@ -471,7 +472,7 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
|
|||
m_lastLiquid = NULL;
|
||||
|
||||
for (int i = 0; i < MAX_TIMERS; ++i)
|
||||
m_MirrorTimer[i] = DISABLED_MIRROR_TIMER;
|
||||
{ m_MirrorTimer[i] = DISABLED_MIRROR_TIMER; }
|
||||
|
||||
m_MirrorTimerFlags = UNDERWATER_NONE;
|
||||
m_MirrorTimerFlagsLast = UNDERWATER_NONE;
|
||||
|
|
@ -520,7 +521,7 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
|
|||
m_itemUpdateQueueBlocked = false;
|
||||
|
||||
for (int i = 0; i < MAX_MOVE_TYPE; ++i)
|
||||
m_forced_speed_changes[i] = 0;
|
||||
{ m_forced_speed_changes[i] = 0; }
|
||||
|
||||
m_stableSlots = 0;
|
||||
|
||||
|
|
@ -591,10 +592,10 @@ Player::~Player()
|
|||
|
||||
// all mailed items should be deleted, also all mail should be deallocated
|
||||
for (PlayerMails::const_iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
|
||||
delete *itr;
|
||||
{ delete *itr; }
|
||||
|
||||
for (ItemMap::const_iterator iter = mMitems.begin(); iter != mMitems.end(); ++iter)
|
||||
delete iter->second; // if item is duplicated... then server may crash ... but that item should be deallocated
|
||||
{ delete iter->second; } // if item is duplicated... then server may crash ... but that item should be deallocated
|
||||
|
||||
delete PlayerTalkClass;
|
||||
|
||||
|
|
@ -604,7 +605,7 @@ Player::~Player()
|
|||
}
|
||||
|
||||
for (size_t x = 0; x < ItemSetEff.size(); ++x)
|
||||
delete ItemSetEff[x];
|
||||
{ delete ItemSetEff[x]; }
|
||||
|
||||
// clean up player-instance binds, may unload some instance saves
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
|
|
@ -659,7 +660,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
}
|
||||
|
||||
for (int i = 0; i < PLAYER_SLOTS_COUNT; ++i)
|
||||
m_items[i] = NULL;
|
||||
{ m_items[i] = NULL; }
|
||||
|
||||
SetLocationMapId(info->mapId);
|
||||
Relocate(info->positionX, info->positionY, info->positionZ, info->orientation);
|
||||
|
|
@ -675,7 +676,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
SetByteValue(UNIT_FIELD_BYTES_0, 2, gender);
|
||||
SetByteValue(UNIT_FIELD_BYTES_0, 3, powertype);
|
||||
|
||||
InitDisplayIds(); // model, Scale and model data
|
||||
InitDisplayIds(); // model, scale and model data
|
||||
|
||||
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_PVP);
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
|
||||
|
|
@ -784,14 +785,14 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
|
||||
{
|
||||
if (oEntry->ItemId[j] <= 0)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
uint32 item_id = oEntry->ItemId[j];
|
||||
|
||||
// just skip, reported in ObjectMgr::LoadItemPrototypes
|
||||
ItemPrototype const* iProto = ObjectMgr::GetItemPrototype(item_id);
|
||||
if (!iProto)
|
||||
continue;
|
||||
{ continue; }
|
||||
|
||||
// BuyCount by default
|
||||
int32 count = iProto->BuyCount;
|
||||
|
|
@ -817,7 +818,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
}
|
||||
|
||||
for (PlayerCreateInfoItems::const_iterator item_id_itr = info->item.begin(); item_id_itr != info->item.end(); ++item_id_itr)
|
||||
StoreNewItemInBestSlots(item_id_itr->item_id, item_id_itr->item_amount);
|
||||
{ StoreNewItemInBestSlots(item_id_itr->item_id, item_id_itr->item_amount); }
|
||||
|
||||
// bags and main-hand weapon must equipped at this moment
|
||||
// now second pass for not equipped (offhand weapon/shield if it attempt equipped before main-hand weapon)
|
||||
|
|
@ -848,7 +849,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||
// if this is ammo then use it
|
||||
msg = CanUseAmmo(pItem->GetEntry());
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
SetAmmo(pItem->GetEntry());
|
||||
{ SetAmmo(pItem->GetEntry()); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -870,7 +871,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
|
|||
uint16 eDest;
|
||||
uint8 msg = CanEquipNewItem(NULL_SLOT, eDest, titem_id, false);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
break;
|
||||
{ break; }
|
||||
|
||||
EquipNewItem(eDest, titem_id, true);
|
||||
AutoUnequipOffhandIfNeed();
|
||||
|
|
@ -878,7 +879,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
|
|||
}
|
||||
|
||||
if (titem_amount == 0)
|
||||
return true; // equipped
|
||||
{ return true; } // equipped
|
||||
|
||||
// attempt store
|
||||
ItemPosCountVec sDest;
|
||||
|
|
@ -905,7 +906,7 @@ Item* Player::StoreNewItemInInventorySlot(uint32 itemEntry, uint32 amount)
|
|||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
if (Item* pItem = StoreNewItem(vDest, itemEntry, true, Item::GenerateItemRandomPropertyId(itemEntry)))
|
||||
return pItem;
|
||||
{ return pItem; }
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
@ -916,7 +917,7 @@ void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 Curre
|
|||
if (int(MaxValue) == DISABLED_MIRROR_TIMER)
|
||||
{
|
||||
if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
|
||||
StopMirrorTimer(Type);
|
||||
{ StopMirrorTimer(Type); }
|
||||
return;
|
||||
}
|
||||
WorldPacket data(SMSG_START_MIRROR_TIMER, (21));
|
||||
|
|
@ -940,15 +941,15 @@ void Player::StopMirrorTimer(MirrorTimerType Type)
|
|||
uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
|
||||
{
|
||||
if (!IsAlive() || isGameMaster())
|
||||
return 0;
|
||||
{ return 0; }
|
||||
|
||||
// Absorb, resist some environmental damage type
|
||||
uint32 absorb = 0;
|
||||
uint32 resist = 0;
|
||||
if (type == DAMAGE_LAVA)
|
||||
CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
{ CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist); }
|
||||
else if (type == DAMAGE_SLIME)
|
||||
CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist);
|
||||
{ CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist); }
|
||||
|
||||
damage -= absorb + resist;
|
||||
|
||||
|
|
@ -991,23 +992,23 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
|
|||
{
|
||||
case FATIGUE_TIMER:
|
||||
if (GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_GMLEVEL))
|
||||
return DISABLED_MIRROR_TIMER;
|
||||
{ return DISABLED_MIRROR_TIMER; }
|
||||
return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_MAX) * IN_MILLISECONDS;
|
||||
case BREATH_TIMER:
|
||||
{
|
||||
if (!IsAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) ||
|
||||
GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_GMLEVEL))
|
||||
return DISABLED_MIRROR_TIMER;
|
||||
GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_GMLEVEL))
|
||||
{ return DISABLED_MIRROR_TIMER; }
|
||||
int32 UnderWaterTime = sWorld.getConfig(CONFIG_UINT32_TIMERBAR_BREATH_MAX) * IN_MILLISECONDS;
|
||||
AuraList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING);
|
||||
for (AuraList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
|
||||
UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetModifier()->m_amount) / 100.0f);
|
||||
{ UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetModifier()->m_amount) / 100.0f); }
|
||||
return UnderWaterTime;
|
||||
}
|
||||
case FIRE_TIMER:
|
||||
{
|
||||
if (!IsAlive() || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL))
|
||||
return DISABLED_MIRROR_TIMER;
|
||||
{ return DISABLED_MIRROR_TIMER; }
|
||||
return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_MAX) * IN_MILLISECONDS;
|
||||
}
|
||||
default:
|
||||
|
|
@ -1020,13 +1021,13 @@ void Player::UpdateMirrorTimers()
|
|||
{
|
||||
// Desync flags for update on next HandleDrowning
|
||||
if (m_MirrorTimerFlags)
|
||||
m_MirrorTimerFlagsLast = ~m_MirrorTimerFlags;
|
||||
{ m_MirrorTimerFlagsLast = ~m_MirrorTimerFlags; }
|
||||
}
|
||||
|
||||
void Player::HandleDrowning(uint32 time_diff)
|
||||
{
|
||||
if (!m_MirrorTimerFlags)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
// In water
|
||||
if (m_MirrorTimerFlags & UNDERWATER_INWATER)
|
||||
|
|
@ -1050,7 +1051,7 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
EnvironmentalDamage(DAMAGE_DROWNING, damage);
|
||||
}
|
||||
else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INWATER)) // Update time in client if need
|
||||
SendMirrorTimer(BREATH_TIMER, getMaxTimer(BREATH_TIMER), m_MirrorTimer[BREATH_TIMER], -1);
|
||||
{ SendMirrorTimer(BREATH_TIMER, getMaxTimer(BREATH_TIMER), m_MirrorTimer[BREATH_TIMER], -1); }
|
||||
}
|
||||
}
|
||||
else if (m_MirrorTimer[BREATH_TIMER] != DISABLED_MIRROR_TIMER) // Regen timer
|
||||
|
|
@ -1059,9 +1060,9 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
// Need breath regen
|
||||
m_MirrorTimer[BREATH_TIMER] += 10 * time_diff;
|
||||
if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !IsAlive())
|
||||
StopMirrorTimer(BREATH_TIMER);
|
||||
{ StopMirrorTimer(BREATH_TIMER); }
|
||||
else if (m_MirrorTimerFlagsLast & UNDERWATER_INWATER)
|
||||
SendMirrorTimer(BREATH_TIMER, UnderWaterTime, m_MirrorTimer[BREATH_TIMER], 10);
|
||||
{ SendMirrorTimer(BREATH_TIMER, UnderWaterTime, m_MirrorTimer[BREATH_TIMER], 10); }
|
||||
}
|
||||
|
||||
// In dark water
|
||||
|
|
@ -1086,10 +1087,10 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
EnvironmentalDamage(DAMAGE_EXHAUSTED, damage);
|
||||
}
|
||||
else if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) // Teleport ghost to graveyard
|
||||
RepopAtGraveyard();
|
||||
{ RepopAtGraveyard(); }
|
||||
}
|
||||
else if (!(m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER))
|
||||
SendMirrorTimer(FATIGUE_TIMER, getMaxTimer(FATIGUE_TIMER), m_MirrorTimer[FATIGUE_TIMER], -1);
|
||||
{ SendMirrorTimer(FATIGUE_TIMER, getMaxTimer(FATIGUE_TIMER), m_MirrorTimer[FATIGUE_TIMER], -1); }
|
||||
}
|
||||
}
|
||||
else if (m_MirrorTimer[FATIGUE_TIMER] != DISABLED_MIRROR_TIMER) // Regen timer
|
||||
|
|
@ -1097,16 +1098,16 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
int32 DarkWaterTime = getMaxTimer(FATIGUE_TIMER);
|
||||
m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff;
|
||||
if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !IsAlive())
|
||||
StopMirrorTimer(FATIGUE_TIMER);
|
||||
{ StopMirrorTimer(FATIGUE_TIMER); }
|
||||
else if (m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER)
|
||||
SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE_TIMER], 10);
|
||||
{ SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE_TIMER], 10); }
|
||||
}
|
||||
|
||||
if (m_MirrorTimerFlags & (UNDERWATER_INLAVA /*| UNDERWATER_INSLIME*/) && !(m_lastLiquid && m_lastLiquid->SpellId))
|
||||
{
|
||||
// Breath timer not activated - activate it
|
||||
if (m_MirrorTimer[FIRE_TIMER] == DISABLED_MIRROR_TIMER)
|
||||
m_MirrorTimer[FIRE_TIMER] = getMaxTimer(FIRE_TIMER);
|
||||
{ m_MirrorTimer[FIRE_TIMER] = getMaxTimer(FIRE_TIMER); }
|
||||
else
|
||||
{
|
||||
m_MirrorTimer[FIRE_TIMER] -= time_diff;
|
||||
|
|
@ -1117,7 +1118,7 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
// TODO: Check this formula
|
||||
uint32 damage = urand(600, 700);
|
||||
if (m_MirrorTimerFlags & UNDERWATER_INLAVA)
|
||||
EnvironmentalDamage(DAMAGE_LAVA, damage);
|
||||
{ EnvironmentalDamage(DAMAGE_LAVA, damage); }
|
||||
// need to skip Slime damage in Undercity,
|
||||
// maybe someone can find better way to handle environmental damage
|
||||
//else if (m_zoneUpdateId != 1497)
|
||||
|
|
@ -1126,7 +1127,7 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
}
|
||||
}
|
||||
else
|
||||
m_MirrorTimer[FIRE_TIMER] = DISABLED_MIRROR_TIMER;
|
||||
{ m_MirrorTimer[FIRE_TIMER] = DISABLED_MIRROR_TIMER; }
|
||||
|
||||
// Recheck timers flag
|
||||
m_MirrorTimerFlags &= ~UNDERWATER_EXIST_TIMERS;
|
||||
|
|
@ -1139,7 +1140,7 @@ void Player::HandleDrowning(uint32 time_diff)
|
|||
m_MirrorTimerFlagsLast = m_MirrorTimerFlags;
|
||||
}
|
||||
|
||||
// The player sobers by 1% every 9 seconds
|
||||
/// The player sobers by 1% every 9 seconds
|
||||
void Player::HandleSobering()
|
||||
{
|
||||
uint8 currentDrunkValue = GetDrunkValue();
|
||||
|
|
@ -2434,7 +2435,7 @@ void Player::SetGameMaster(bool on)
|
|||
}
|
||||
else
|
||||
{
|
||||
m_ExtraFlags &= ~PLAYER_EXTRA_GM_ON;
|
||||
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
|
||||
setFactionForRace(getRace());
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_GM);
|
||||
|
||||
|
|
@ -5561,7 +5562,7 @@ bool Player::UpdateSkill(uint32 skill_id, uint32 step)
|
|||
uint16 value = GetUInt16Value(PLAYER_SKILL_RANK_0 + field, offset);
|
||||
uint16 max = GetUInt16Value(PLAYER_SKILL_MAX_RANK_0 + field, offset);
|
||||
|
||||
if (!max || !value || value >= max)
|
||||
if ((!max) || (!value) || (value >= max))
|
||||
return false;
|
||||
|
||||
uint32 new_value = value + step;
|
||||
|
|
@ -6975,9 +6976,9 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
|||
// Used by Eluna
|
||||
#ifdef ENABLE_ELUNA
|
||||
sEluna->OnUpdateZone(this, newZone, newArea);
|
||||
#endif /* ENABLE_ELUNA */
|
||||
|
||||
m_zoneUpdateId = newZone;
|
||||
#endif
|
||||
|
||||
m_zoneUpdateId = newZone;
|
||||
m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL;
|
||||
|
||||
// zone changed, so area changed as well, update it
|
||||
|
|
@ -6987,19 +6988,19 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
|||
// in PvE, only opposition team capital
|
||||
switch (zone->team)
|
||||
{
|
||||
case AREATEAM_ALLY:
|
||||
pvpInfo.inHostileArea = GetTeam() != ALLIANCE && (sWorld.IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
|
||||
break;
|
||||
case AREATEAM_HORDE:
|
||||
pvpInfo.inHostileArea = GetTeam() != HORDE && (sWorld.IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
|
||||
break;
|
||||
case AREATEAM_NONE:
|
||||
// overwrite for battlegrounds, maybe batter some zone flags but current known not 100% fit to this
|
||||
pvpInfo.inHostileArea = sWorld.IsPvPRealm() || InBattleGround();
|
||||
break;
|
||||
default: // 6 in fact
|
||||
pvpInfo.inHostileArea = false;
|
||||
break;
|
||||
case AREATEAM_ALLY:
|
||||
pvpInfo.inHostileArea = GetTeam() != ALLIANCE && (sWorld.IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
|
||||
break;
|
||||
case AREATEAM_HORDE:
|
||||
pvpInfo.inHostileArea = GetTeam() != HORDE && (sWorld.IsPvPRealm() || zone->flags & AREA_FLAG_CAPITAL);
|
||||
break;
|
||||
case AREATEAM_NONE:
|
||||
// overwrite for battlegrounds, maybe batter some zone flags but current known not 100% fit to this
|
||||
pvpInfo.inHostileArea = sWorld.IsPvPRealm() || InBattleGround();
|
||||
break;
|
||||
default: // 6 in fact
|
||||
pvpInfo.inHostileArea = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (pvpInfo.inHostileArea) // in hostile area
|
||||
|
|
|
|||
|
|
@ -577,13 +577,13 @@ enum PlayerExtraFlags
|
|||
// 2^n values
|
||||
enum AtLoginFlags
|
||||
{
|
||||
AT_LOGIN_NONE = 0x00,
|
||||
AT_LOGIN_RENAME = 0x01,
|
||||
AT_LOGIN_RESET_SPELLS = 0x02,
|
||||
AT_LOGIN_RESET_TALENTS = 0x04,
|
||||
AT_LOGIN_CUSTOMIZE = 0x08,
|
||||
AT_LOGIN_RESET_PET_TALENTS = 0x10,
|
||||
AT_LOGIN_FIRST = 0x20,
|
||||
AT_LOGIN_NONE = 0x00,
|
||||
AT_LOGIN_RENAME = 0x01,
|
||||
AT_LOGIN_RESET_SPELLS = 0x02,
|
||||
AT_LOGIN_RESET_TALENTS = 0x04,
|
||||
AT_LOGIN_CUSTOMIZE = 0x08,
|
||||
AT_LOGIN_RESET_PET_TALENTS = 0x10,
|
||||
AT_LOGIN_FIRST = 0x20,
|
||||
};
|
||||
|
||||
typedef std::map<uint32, QuestStatusData> QuestStatusMap;
|
||||
|
|
@ -1132,8 +1132,14 @@ class Player : public Unit
|
|||
|
||||
void ToggleAFK();
|
||||
void ToggleDND();
|
||||
bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); }
|
||||
bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); }
|
||||
bool isAFK() const
|
||||
{
|
||||
return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK);
|
||||
}
|
||||
bool isDND() const
|
||||
{
|
||||
return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND);
|
||||
}
|
||||
ChatTagFlags GetChatTag() const;
|
||||
|
||||
std::string autoReplyMsg;
|
||||
|
|
@ -1163,10 +1169,17 @@ class Player : public Unit
|
|||
void SetTaxiCheater(bool on) { if (on) { m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; } else { m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; } }
|
||||
bool isGMVisible() const { return !(m_ExtraFlags & PLAYER_EXTRA_GM_INVISIBLE); }
|
||||
void SetGMVisible(bool on);
|
||||
void SetPvPDeath(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; else m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
|
||||
void SetPvPDeath(bool on)
|
||||
{
|
||||
if (on) { m_ExtraFlags |= PLAYER_EXTRA_PVP_DEATH; }
|
||||
else { m_ExtraFlags &= ~PLAYER_EXTRA_PVP_DEATH; }
|
||||
}
|
||||
|
||||
// 0 = own auction, -1 = enemy auction, 1 = goblin auction
|
||||
int GetAuctionAccessMode() const { return m_ExtraFlags & PLAYER_EXTRA_AUCTION_ENEMY ? -1 : (m_ExtraFlags & PLAYER_EXTRA_AUCTION_NEUTRAL ? 1 : 0); }
|
||||
int GetAuctionAccessMode() const
|
||||
{
|
||||
return m_ExtraFlags & PLAYER_EXTRA_AUCTION_ENEMY ? -1 : (m_ExtraFlags & PLAYER_EXTRA_AUCTION_NEUTRAL ? 1 : 0);
|
||||
}
|
||||
void SetAuctionAccessMode(int state)
|
||||
{
|
||||
m_ExtraFlags &= ~(PLAYER_EXTRA_AUCTION_ENEMY | PLAYER_EXTRA_AUCTION_NEUTRAL);
|
||||
|
|
@ -1206,15 +1219,15 @@ class Player : public Unit
|
|||
return m_rest_bonus;
|
||||
}
|
||||
void SetRestBonus(float rest_bonus_new);
|
||||
|
||||
|
||||
/**
|
||||
* \brief: compute rest bonus
|
||||
* \param: time_t timePassed > time from last check
|
||||
* \param: bool offline > is the player was offline?
|
||||
* \param: bool inRestPlace > if it was offline, is the player was in city/tavern/inn?
|
||||
* \returns: float
|
||||
**/
|
||||
float ComputeRest(time_t timePassed, bool offline = false, bool inRestPlace = false);
|
||||
* \brief: compute rest bonus
|
||||
* \param: time_t timePassed > time from last check
|
||||
* \param: bool offline > is the player was offline?
|
||||
* \param: bool inRestPlace > if it was offline, is the player was in city/tavern/inn?
|
||||
* \returns: float
|
||||
**/
|
||||
float ComputeRest(time_t timePassed, bool offline = false, bool inRestPlace = false);
|
||||
|
||||
/**
|
||||
* \brief: player is interacting with something.
|
||||
|
|
@ -1570,8 +1583,8 @@ class Player : public Unit
|
|||
|
||||
void AddTimedQuest(uint32 quest_id) { m_timedquests.insert(quest_id); }
|
||||
void RemoveTimedQuest(uint32 quest_id) { m_timedquests.erase(quest_id); }
|
||||
|
||||
//! Return collision height sent to client
|
||||
|
||||
/// Return collision height sent to client
|
||||
float GetCollisionHeight(bool mounted) const;
|
||||
|
||||
/*********************************************************/
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
bool Player::UpdateStats(Stats stat)
|
||||
{
|
||||
if (stat > STAT_SPIRIT)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// value = ((base_value * base_pct) + total_value) * total_pct
|
||||
float value = GetTotalStatValue(stat);
|
||||
|
|
@ -135,7 +135,7 @@ bool Player::UpdateAllStats()
|
|||
UpdateMaxHealth();
|
||||
|
||||
for (uint32 i = POWER_MANA; i < MAX_POWERS; ++i)
|
||||
UpdateMaxPower(Powers(i));
|
||||
{ UpdateMaxPower(Powers(i)); }
|
||||
|
||||
UpdateAllRatings();
|
||||
UpdateAllCritPercentages();
|
||||
|
|
@ -150,7 +150,7 @@ bool Player::UpdateAllStats()
|
|||
UpdateExpertise(BASE_ATTACK);
|
||||
UpdateExpertise(OFF_ATTACK);
|
||||
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
||||
UpdateResistances(i);
|
||||
{ UpdateResistances(i); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -167,7 +167,7 @@ void Player::UpdateResistances(uint32 school)
|
|||
pet->UpdateResistances(school);
|
||||
}
|
||||
else
|
||||
UpdateArmor();
|
||||
{ UpdateArmor(); }
|
||||
}
|
||||
|
||||
void Player::UpdateArmor()
|
||||
|
|
@ -346,7 +346,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
|||
{
|
||||
UpdateDamagePhysical(BASE_ATTACK);
|
||||
if (CanDualWield() && haveOffhandWeapon()) // allow update offhand damage only if player knows DualWield Spec and has equipped offhand weapon
|
||||
UpdateDamagePhysical(OFF_ATTACK);
|
||||
{ UpdateDamagePhysical(OFF_ATTACK); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -638,7 +638,7 @@ void Player::UpdateSpellHitChances()
|
|||
void Player::UpdateAllSpellCritChances()
|
||||
{
|
||||
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
||||
UpdateSpellCritChance(i);
|
||||
{ UpdateSpellCritChance(i); }
|
||||
}
|
||||
|
||||
void Player::UpdateExpertise(WeaponAttackType attack)
|
||||
|
|
@ -711,7 +711,7 @@ void Player::UpdateManaRegen()
|
|||
// Set regen rate in cast state apply only on spirit based regen
|
||||
int32 modManaRegenInterrupt = GetTotalAuraModifier(SPELL_AURA_MOD_MANA_REGEN_INTERRUPT);
|
||||
if (modManaRegenInterrupt > 100)
|
||||
modManaRegenInterrupt = 100;
|
||||
{ modManaRegenInterrupt = 100; }
|
||||
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, base_regen + power_regen_mp5 + spirit_regen * modManaRegenInterrupt / 100.0f);
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, base_regen + 0.001f + power_regen_mp5 + spirit_regen);
|
||||
|
|
@ -803,10 +803,10 @@ bool Creature::UpdateAllStats()
|
|||
UpdateAttackPowerAndDamage();
|
||||
|
||||
for (uint32 i = POWER_MANA; i < MAX_POWERS; ++i)
|
||||
UpdateMaxPower(Powers(i));
|
||||
{ UpdateMaxPower(Powers(i)); }
|
||||
|
||||
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
||||
UpdateResistances(i);
|
||||
{ UpdateResistances(i); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -819,7 +819,7 @@ void Creature::UpdateResistances(uint32 school)
|
|||
SetResistance(SpellSchools(school), int32(value));
|
||||
}
|
||||
else
|
||||
UpdateArmor();
|
||||
{ UpdateArmor(); }
|
||||
}
|
||||
|
||||
void Creature::UpdateArmor()
|
||||
|
|
@ -868,7 +868,7 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
|
|||
SetFloatValue(index_mult, attPowerMultiplier); // UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field
|
||||
|
||||
if (ranged)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
// automatically update weapon damage after attack power modification
|
||||
UpdateDamagePhysical(BASE_ATTACK);
|
||||
|
|
@ -878,7 +878,7 @@ void Creature::UpdateAttackPowerAndDamage(bool ranged)
|
|||
void Creature::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
{
|
||||
if (attType > OFF_ATTACK)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
UnitMods unitMod = (attType == BASE_ATTACK ? UNIT_MOD_DAMAGE_MAINHAND : UNIT_MOD_DAMAGE_OFFHAND);
|
||||
|
||||
|
|
@ -909,7 +909,7 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
|
|||
bool Pet::UpdateStats(Stats stat)
|
||||
{
|
||||
if (stat > STAT_SPIRIT)
|
||||
return false;
|
||||
{ return false; }
|
||||
|
||||
// value = ((base_value * base_pct) + total_value) * total_pct
|
||||
float value = GetTotalStatValue(stat);
|
||||
|
|
@ -946,13 +946,13 @@ bool Pet::UpdateStats(Stats stat)
|
|||
bool Pet::UpdateAllStats()
|
||||
{
|
||||
for (int i = STAT_STRENGTH; i < MAX_STATS; ++i)
|
||||
UpdateStats(Stats(i));
|
||||
{ UpdateStats(Stats(i)); }
|
||||
|
||||
for (uint32 i = POWER_MANA; i < MAX_POWERS; ++i)
|
||||
UpdateMaxPower(Powers(i));
|
||||
{ UpdateMaxPower(Powers(i)); }
|
||||
|
||||
for (int i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
||||
UpdateResistances(i);
|
||||
{ UpdateResistances(i); }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -971,7 +971,7 @@ void Pet::UpdateResistances(uint32 school)
|
|||
SetResistance(SpellSchools(school), int32(value));
|
||||
}
|
||||
else
|
||||
UpdateArmor();
|
||||
{ UpdateArmor(); }
|
||||
}
|
||||
|
||||
void Pet::UpdateArmor()
|
||||
|
|
@ -1026,16 +1026,16 @@ void Pet::UpdateMaxPower(Powers power)
|
|||
void Pet::UpdateAttackPowerAndDamage(bool ranged)
|
||||
{
|
||||
if (ranged)
|
||||
return;
|
||||
{ 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;
|
||||
{ val = GetStat(STAT_STRENGTH) - 10.0f; }
|
||||
else
|
||||
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
|
||||
{ val = 2 * GetStat(STAT_STRENGTH) - 20.0f; }
|
||||
|
||||
Unit* owner = GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER)
|
||||
|
|
@ -1087,7 +1087,7 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
|
|||
void Pet::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
{
|
||||
if (attType > BASE_ATTACK)
|
||||
return;
|
||||
{ return; }
|
||||
|
||||
UnitMods unitMod = UNIT_MOD_DAMAGE_MAINHAND;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
|
|||
m_timer -= update_diff;
|
||||
}
|
||||
else if (m_timer != m_lifetime)
|
||||
m_timer = m_lifetime;
|
||||
{ m_timer = m_lifetime; }
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -122,10 +122,10 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
|
|||
return;
|
||||
}
|
||||
else
|
||||
m_timer -= update_diff;
|
||||
{ m_timer -= update_diff; }
|
||||
}
|
||||
else if (m_timer != m_lifetime)
|
||||
m_timer = m_lifetime;
|
||||
{ m_timer = m_lifetime; }
|
||||
break;
|
||||
}
|
||||
case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN:
|
||||
|
|
@ -145,10 +145,10 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
|
|||
return;
|
||||
}
|
||||
else
|
||||
m_timer -= update_diff;
|
||||
{ m_timer -= update_diff; }
|
||||
}
|
||||
else if (m_timer != m_lifetime)
|
||||
m_timer = m_lifetime;
|
||||
{ m_timer = m_lifetime; }
|
||||
break;
|
||||
}
|
||||
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue