[Sync] Some long overdue project sync pt2

This commit is contained in:
Antz 2019-01-09 23:01:24 +00:00 committed by Antz
parent 65ec4ea06e
commit f5bb0529c1
70 changed files with 1211 additions and 736 deletions

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -21,6 +21,7 @@
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef __BATTLEGROUNDAA_H
#define __BATTLEGROUNDAA_H

View file

@ -321,6 +321,13 @@ class BattleGroundAB : public BattleGround
* @param delay
*/
void _CreateBanner(uint8 node, uint8 type, uint8 teamIndex, bool delay);
/**
* @brief
*
* @param node
* @param type
* @param teamIndex
*/
void _DelBanner(uint8 node, uint8 type, uint8 teamIndex);
/**
* @brief

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -21,6 +21,7 @@
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef __BATTLEGROUNDBE_H
#define __BATTLEGROUNDBE_H

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -21,6 +21,7 @@
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef __BATTLEGROUNDDS_H
#define __BATTLEGROUNDDS_H
@ -41,7 +42,11 @@ class BattleGroundDS : public BattleGround
public:
BattleGroundDS();
/* inherited from BattlegroundClass */
/**
* @brief inherited from BattlegroundClass
*
* @param plr
*/
virtual void AddPlayer(Player* plr) override;
};
#endif

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -61,7 +61,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recv_data)
BattleGroundTypeId bgTypeId = sBattleGroundMgr.GetBattleMasterBG(pCreature->GetEntry());
if (bgTypeId == BATTLEGROUND_TYPE_NONE)
return;
{ return; }
if (!_player->GetBGAccessByLevel(bgTypeId))
{
@ -112,7 +112,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
// ignore if player is already in BG
if (_player->InBattleGround())
return;
{ return; }
// get bg instance or bg template if instance not found
BattleGround* bg = NULL;
@ -158,7 +158,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recv_data)
if (!grp)
{ return; }
if (grp->GetLeaderGuid() != _player->GetObjectGuid())
return;
{ return; }
err = grp->CanJoinBattleGroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
isPremade = sWorld.getConfig(CONFIG_UINT32_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH) &&
(grp->GetMembersCount() >= bg->GetMinPlayersPerTeam());
@ -286,7 +286,7 @@ void WorldSession::HandlePVPLogDataOpcode(WorldPacket & /*recv_data*/)
BattleGround* bg = _player->GetBattleGround();
if (!bg)
{ return; }
return;
// arena finish version will send in BattleGround::EndBattleGround directly
if (bg->isArena())

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -41,7 +41,11 @@ class BattleGroundIC : public BattleGround
public:
BattleGroundIC();
/* inherited from BattlegroundClass */
/**
* @brief inherited from BattlegroundClass
*
* @param plr
*/
virtual void AddPlayer(Player* plr) override;
/* Scorekeeping */

View file

@ -2300,8 +2300,9 @@ void BattleGroundMgr::LoadBattleMastersEntry()
{
BarGoLink bar(1);
bar.step();
sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
sLog.outString();
sLog.outString(">> Loaded 0 battlemaster entries - table is empty!");
return;
}
@ -2328,8 +2329,8 @@ void BattleGroundMgr::LoadBattleMastersEntry()
delete result;
sLog.outString(">> Loaded %u battlemaster entries", count);
sLog.outString();
sLog.outString(">> Loaded %u battlemaster entries", count);
}
HolidayIds BattleGroundMgr::BGTypeToWeekendHolidayId(BattleGroundTypeId bgTypeId)
@ -2417,8 +2418,9 @@ void BattleGroundMgr::LoadBattleEventIndexes()
{
BarGoLink bar(1);
bar.step();
sLog.outErrorDb(">> Loaded 0 battleground eventindexes.");
sLog.outString();
sLog.outErrorDb(">> Loaded 0 battleground eventindexes.");
return;
}
@ -2477,7 +2479,7 @@ void BattleGroundMgr::LoadBattleEventIndexes()
}
while (result->NextRow());
sLog.outString(">> Loaded %u battleground eventindexes", count);
sLog.outString();
sLog.outString(">> Loaded %u battleground eventindexes", count);
delete result;
}

View file

@ -132,6 +132,15 @@ class BattleGroundQueue
*/
~BattleGroundQueue();
/**
* @brief
*
* @param bgTypeId
* @param bracket_id
* @param ArenaType
* @param isRated
* @param minRating
*/
void Update(BattleGroundTypeId bgTypeId, BattleGroundBracketId bracket_id, ArenaType arenaType = ARENA_TYPE_NONE, bool isRated = false, uint32 minRating = 0);
/**

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -21,6 +21,7 @@
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef __BATTLEGROUNDNA_H
#define __BATTLEGROUNDNA_H

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -41,7 +41,11 @@ class BattleGroundRB : public BattleGround
public:
BattleGroundRB();
/* inherited from BattlegroundClass */
/**
* @brief inherited from BattlegroundClass
*
* @param plr
*/
virtual void AddPlayer(Player* plr) override;
/* Scorekeeping */

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -21,6 +21,7 @@
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef __BATTLEGROUNDRL_H
#define __BATTLEGROUNDRL_H

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -21,6 +21,7 @@
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef __BATTLEGROUNDRV_H
#define __BATTLEGROUNDRV_H
@ -41,7 +42,11 @@ class BattleGroundRV : public BattleGround
public:
BattleGroundRV();
/* inherited from BattlegroundClass */
/**
* @brief inherited from BattlegroundClass
*
* @param plr
*/
virtual void AddPlayer(Player* plr) override;
};
#endif

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -44,7 +44,11 @@ class BattleGroundSA : public BattleGround
public:
BattleGroundSA();
/* inherited from BattlegroundClass */
/**
* @brief inherited from BattlegroundClass
*
* @param plr
*/
virtual void AddPlayer(Player* plr) override;
/* Scorekeeping */

View file

@ -165,7 +165,9 @@ bool ChatHandler::HandleGMCommand(char* args)
m_session->SendNotification(LANG_GM_ON);
}
else
{
m_session->SendNotification(LANG_GM_OFF);
}
return true;
}

View file

@ -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)

View file

@ -33,11 +33,11 @@ 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);
@ -64,15 +64,15 @@ void ObjectPosSelector::AddUsedArea(WorldObject const* obj, float angle, float d
// 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())
@ -218,7 +219,7 @@ 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;
{ return false; }
// ++ direction less updated
if (m_nextUsedAreaItr[USED_POS_PLUS] != m_UsedAreaLists[USED_POS_PLUS].end() &&

View file

@ -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();
@ -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)
{
@ -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,24 +612,23 @@ 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;
{ mode = PET_SAVE_NOT_IN_SLOT; }
if (mode == PET_SAVE_REAGENTS)
{
@ -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);
@ -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;
@ -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,7 +1938,7 @@ 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;
@ -1949,7 +1948,7 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
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); }
}
}
@ -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();

View file

@ -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); }
}

View file

@ -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;
{ 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();
@ -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,7 +6976,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
// Used by Eluna
#ifdef ENABLE_ELUNA
sEluna->OnUpdateZone(this, newZone, newArea);
#endif /* ENABLE_ELUNA */
#endif
m_zoneUpdateId = newZone;
m_zoneUpdateTimer = ZONE_UPDATE_INTERVAL;

View file

@ -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);
@ -1571,7 +1584,7 @@ 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;
/*********************************************************/

View file

@ -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;

View file

@ -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:

View file

@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "OutdoorPvP.h"
@ -50,7 +53,7 @@ void OutdoorPvP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
// remove the world state information from the player
if (isMainZone && !player->GetSession()->PlayerLogout())
SendRemoveWorldStates(player);
{ SendRemoveWorldStates(player); }
sLog.outDebug("Player %s left an Outdoor PvP zone", player->GetName());
}
@ -68,10 +71,10 @@ void OutdoorPvP::SendUpdateWorldState(uint32 field, uint32 value)
{
// only send world state update to main zone
if (!itr->second)
continue;
{ continue; }
if (Player* player = sObjectMgr.GetPlayer(itr->first))
player->SendUpdateWorldState(field, value);
{ player->SendUpdateWorldState(field, value); }
}
}
@ -114,23 +117,23 @@ void OutdoorPvP::HandlePlayerKill(Player* killer, Player* victim)
Player* groupMember = itr->getSource();
if (!groupMember)
continue;
{ continue; }
// skip if too far away
if (!groupMember->IsAtGroupRewardDistance(victim))
continue;
{ continue; }
// creature kills must be notified, even if not inside objective / not outdoor pvp active
// player kills only count if active and inside objective
if (groupMember->CanUseCapturePoint())
HandlePlayerKillInsideArea(groupMember);
{ HandlePlayerKillInsideArea(groupMember); }
}
}
else
{
// creature kills must be notified, even if not inside objective / not outdoor pvp active
if (killer && killer->CanUseCapturePoint())
HandlePlayerKillInsideArea(killer);
{ HandlePlayerKillInsideArea(killer); }
}
}
@ -143,9 +146,9 @@ void OutdoorPvP::BuffTeam(Team team, uint32 spellId, bool remove /*= false*/)
if (player && player->GetTeam() == team)
{
if (remove)
player->RemoveAurasDueToSpell(spellId);
{ player->RemoveAurasDueToSpell(spellId); }
else
player->CastSpell(player, spellId, true);
{ player->CastSpell(player, spellId, true); }
}
}
}
@ -166,7 +169,7 @@ uint32 OutdoorPvP::GetBannerArtKit(Team team, uint32 artKitAlliance /*= CAPTURE_
void OutdoorPvP::SetBannerVisual(const WorldObject* objRef, ObjectGuid goGuid, uint32 artKit, uint32 animId)
{
if (GameObject* go = objRef->GetMap()->GetGameObject(goGuid))
SetBannerVisual(go, artKit, animId);
{ SetBannerVisual(go, artKit, animId); }
}
void OutdoorPvP::SetBannerVisual(GameObject* go, uint32 artKit, uint32 animId)
@ -183,8 +186,8 @@ void OutdoorPvP::RespawnGO(const WorldObject* objRef, ObjectGuid goGuid, bool re
go->SetRespawnTime(7 * DAY);
if (respawn)
go->Refresh();
{ go->Refresh(); }
else if (go->isSpawned())
go->SetLootState(GO_JUST_DEACTIVATED);
{ go->SetLootState(GO_JUST_DEACTIVATED); }
}
}

View file

@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef OUTDOOR_PVP_H
@ -27,6 +30,7 @@
#include "SharedDefines.h"
#include "OutdoorPvPMgr.h"
// forward declaration
class WorldPacket;
class WorldObject;
class Player;
@ -34,6 +38,10 @@ class GameObject;
class Unit;
class Creature;
/**
* @brief
*
*/
enum CapturePointArtKits
{
CAPTURE_ARTKIT_ALLIANCE = 2,
@ -41,6 +49,10 @@ enum CapturePointArtKits
CAPTURE_ARTKIT_NEUTRAL = 21
};
/**
* @brief
*
*/
enum CapturePointAnimations
{
CAPTURE_ANIM_ALLIANCE = 1,
@ -48,80 +60,216 @@ enum CapturePointAnimations
CAPTURE_ANIM_NEUTRAL = 2
};
/**
* @brief
*
*/
typedef std::map < ObjectGuid /*playerGuid*/, bool /*isMainZone*/ > GuidZoneMap;
/**
* @brief
*
*/
class OutdoorPvP
{
friend class OutdoorPvPMgr;
public:
/**
* @brief
*
*/
OutdoorPvP() {}
/**
* @brief
*
*/
virtual ~OutdoorPvP() {}
// called when the zone is initialized
/**
* @brief called when the zone is initialized
*
* @param
* @param
*/
virtual void FillInitialWorldStates(WorldPacket& /*data*/, uint32& /*count*/) {}
// Process Capture event
/**
* @brief Process Capture event
*
* @param uint32
* @param
* @return bool
*/
virtual bool HandleEvent(uint32 /*eventId*/, GameObject* /*go*/) { return false; }
// handle capture objective complete
/**
* @brief handle capture objective complete
*
* @param uint32
* @param >
* @param Team
*/
virtual void HandleObjectiveComplete(uint32 /*eventId*/, const std::list<Player*>& /*players*/, Team /*team*/) {}
// Called when a creature is created
/**
* @brief Called when a creature is created
*
* @param
*/
virtual void HandleCreatureCreate(Creature* /*creature*/) {}
// Called when a gameobject is created or removed
/**
* @brief Called when a gameobject is created or removed
*
* @param
*/
virtual void HandleGameObjectCreate(GameObject* /*go*/);
/**
* @brief
*
* @param
*/
virtual void HandleGameObjectRemove(GameObject* /*go*/);
// Called on creature death
/**
* @brief Called on creature death
*
* @param
*/
virtual void HandleCreatureDeath(Creature* /*creature*/) {}
// called when a player uses a gameobject related to outdoor pvp events
/**
* @brief called when a player uses a gameobject related to outdoor pvp events
*
* @param
* @param
* @return bool
*/
virtual bool HandleGameObjectUse(Player* /*player*/, GameObject* /*go*/) { return false; }
// called when a player triggers an areatrigger
/**
* @brief called when a player triggers an areatrigger
*
* @param
* @param uint32
* @return bool
*/
virtual bool HandleAreaTrigger(Player* /*player*/, uint32 /*triggerId*/) { return false; }
// called when a player drops a flag
/**
* @brief called when a player drops a flag
*
* @param
* @param uint32
* @return bool
*/
virtual bool HandleDropFlag(Player* /*player*/, uint32 /*spellId*/) { return false; }
// update - called by the OutdoorPvPMgr
/**
* @brief update - called by the OutdoorPvPMgr
*
* @param uint32
*/
virtual void Update(uint32 /*diff*/) {}
// Handle player kill
/**
* @brief Handle player kill
*
* @param killer
* @param victim
*/
void HandlePlayerKill(Player* killer, Player* victim);
protected:
// Player related stuff
/**
* @brief
*
* @param
* @param bool
*/
virtual void HandlePlayerEnterZone(Player* /*player*/, bool /*isMainZone*/);
/**
* @brief
*
* @param
* @param bool
*/
virtual void HandlePlayerLeaveZone(Player* /*player*/, bool /*isMainZone*/);
// remove world states
//
/**
* @brief remove world states
*
* @param
*/
virtual void SendRemoveWorldStates(Player* /*player*/) {}
// handle npc/player kill
/**
* @brief handle npc/player kill
*
* @param
*/
virtual void HandlePlayerKillInsideArea(Player* /*killer*/) {}
// send world state update to all players present
/**
* @brief send world state update to all players present
*
* @param field
* @param value
*/
void SendUpdateWorldState(uint32 field, uint32 value);
// applies buff to a team inside the specific zone
/**
* @brief applies buff to a team inside the specific zone
*
* @param team
* @param spellId
* @param remove
*/
void BuffTeam(Team team, uint32 spellId, bool remove = false);
// get banner artkit based on controlling team
/**
* @brief get banner artkit based on controlling team
*
* @param team
* @param artKitAlliance
* @param artKitHorde
* @param artKitNeutral
* @return uint32
*/
uint32 GetBannerArtKit(Team team, uint32 artKitAlliance = CAPTURE_ARTKIT_ALLIANCE, uint32 artKitHorde = CAPTURE_ARTKIT_HORDE, uint32 artKitNeutral = CAPTURE_ARTKIT_NEUTRAL);
// set banner visual
/**
* @brief set banner visual
*
* @param objRef
* @param goGuid
* @param artKit
* @param animId
*/
void SetBannerVisual(const WorldObject* objRef, ObjectGuid goGuid, uint32 artKit, uint32 animId);
/**
* @brief
*
* @param go
* @param artKit
* @param animId
*/
void SetBannerVisual(GameObject* go, uint32 artKit, uint32 animId);
// Handle gameobject spawn / despawn
/**
* @brief Handle gameobject spawn / despawn
*
* @param objRef
* @param goGuid
* @param respawn
*/
void RespawnGO(const WorldObject* objRef, ObjectGuid goGuid, bool respawn);
// store the players inside the area
GuidZoneMap m_zonePlayers;
GuidZoneMap m_zonePlayers; /**< store the players inside the area */
};
#endif

View file

@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "OutdoorPvPEP.h"
@ -38,7 +41,7 @@ OutdoorPvPEP::OutdoorPvPEP() : OutdoorPvP(),
m_towerWorldState[3] = WORLD_STATE_EP_PLAGUEWOOD_NEUTRAL;
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
m_towerOwner[i] = TEAM_NONE;
{ m_towerOwner[i] = TEAM_NONE; }
// initially set graveyard owner to neither faction
sObjectMgr.SetGraveYardLinkTeam(GRAVEYARD_ID_EASTERN_PLAGUE, GRAVEYARD_ZONE_EASTERN_PLAGUE, TEAM_INVALID);
@ -50,13 +53,13 @@ void OutdoorPvPEP::FillInitialWorldStates(WorldPacket& data, uint32& count)
FillInitialWorldState(data, count, WORLD_STATE_EP_TOWER_COUNT_HORDE, m_towersHorde);
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD);
{ FillInitialWorldState(data, count, m_towerWorldState[i], WORLD_STATE_ADD); }
}
void OutdoorPvPEP::SendRemoveWorldStates(Player* player)
{
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE);
{ player->SendUpdateWorldState(m_towerWorldState[i], WORLD_STATE_REMOVE); }
}
void OutdoorPvPEP::HandlePlayerEnterZone(Player* player, bool isMainZone)
@ -65,18 +68,18 @@ void OutdoorPvPEP::HandlePlayerEnterZone(Player* player, bool isMainZone)
// remove the buff from the player first; Sometimes on relog players still have the aura
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
player->RemoveAurasDueToSpell(player->GetTeam() == ALLIANCE ? plaguelandsTowerBuffs[i].spellIdAlliance : plaguelandsTowerBuffs[i].spellIdHorde);
{ player->RemoveAurasDueToSpell(player->GetTeam() == ALLIANCE ? plaguelandsTowerBuffs[i].spellIdAlliance : plaguelandsTowerBuffs[i].spellIdHorde); }
// buff the player
switch (player->GetTeam())
{
case ALLIANCE:
if (m_towersAlliance > 0)
player->CastSpell(player, plaguelandsTowerBuffs[m_towersAlliance - 1].spellIdAlliance, true);
{ player->CastSpell(player, plaguelandsTowerBuffs[m_towersAlliance - 1].spellIdAlliance, true); }
break;
case HORDE:
if (m_towersHorde > 0)
player->CastSpell(player, plaguelandsTowerBuffs[m_towersHorde - 1].spellIdHorde, true);
{ player->CastSpell(player, plaguelandsTowerBuffs[m_towersHorde - 1].spellIdHorde, true); }
break;
default:
break;
@ -87,7 +90,7 @@ void OutdoorPvPEP::HandlePlayerLeaveZone(Player* player, bool isMainZone)
{
// remove the buff from the player
for (uint8 i = 0; i < MAX_EP_TOWERS; ++i)
player->RemoveAurasDueToSpell(player->GetTeam() == ALLIANCE ? plaguelandsTowerBuffs[i].spellIdAlliance : plaguelandsTowerBuffs[i].spellIdHorde);
{ player->RemoveAurasDueToSpell(player->GetTeam() == ALLIANCE ? plaguelandsTowerBuffs[i].spellIdAlliance : plaguelandsTowerBuffs[i].spellIdHorde); }
OutdoorPvP::HandlePlayerLeaveZone(player, isMainZone);
}
@ -131,13 +134,13 @@ void OutdoorPvPEP::HandleGameObjectCreate(GameObject* go)
case GO_TOWER_BANNER:
// sort banners
if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_NORTHPASS][0], plaguelandsTowerLocations[TOWER_ID_NORTHPASS][1], 50.0f))
InitBanner(go, TOWER_ID_NORTHPASS);
{ InitBanner(go, TOWER_ID_NORTHPASS); }
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][0], plaguelandsTowerLocations[TOWER_ID_CROWNGUARD][1], 50.0f))
InitBanner(go, TOWER_ID_CROWNGUARD);
{ InitBanner(go, TOWER_ID_CROWNGUARD); }
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_EASTWALL][0], plaguelandsTowerLocations[TOWER_ID_EASTWALL][1], 50.0f))
InitBanner(go, TOWER_ID_EASTWALL);
{ InitBanner(go, TOWER_ID_EASTWALL); }
else if (go->IsWithinDist2d(plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][0], plaguelandsTowerLocations[TOWER_ID_PLAGUEWOOD][1], 50.0f))
InitBanner(go, TOWER_ID_PLAGUEWOOD);
{ InitBanner(go, TOWER_ID_PLAGUEWOOD); }
break;
case GO_LORDAERON_SHRINE_ALLIANCE:
m_lordaeronShrineAlliance = go->GetObjectGuid();
@ -199,7 +202,7 @@ bool OutdoorPvPEP::HandleEvent(uint32 eventId, GameObject* go)
if (plaguelandsTowerEvents[i][j].team != m_towerOwner[i])
{
if (plaguelandsTowerEvents[i][j].defenseMessage)
sWorld.SendDefenseMessage(ZONE_ID_EASTERN_PLAGUELANDS, plaguelandsTowerEvents[i][j].defenseMessage);
{ sWorld.SendDefenseMessage(ZONE_ID_EASTERN_PLAGUELANDS, plaguelandsTowerEvents[i][j].defenseMessage); }
return ProcessCaptureEvent(go, i, plaguelandsTowerEvents[i][j].team, plaguelandsTowerEvents[i][j].worldState);
}
@ -221,7 +224,7 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
{
// update banner
for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr)
SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE);
{ SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_ALLIANCE, CAPTURE_ANIM_ALLIANCE); }
// update counter
++m_towersAlliance;
@ -234,7 +237,7 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
{
// update banner
for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr)
SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE);
{ SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_HORDE, CAPTURE_ANIM_HORDE); }
// update counter
++m_towersHorde;
@ -247,7 +250,7 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
{
// update banner
for (GuidList::const_iterator itr = m_towerBanners[towerId].begin(); itr != m_towerBanners[towerId].end(); ++itr)
SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL);
{ SetBannerVisual(go, (*itr), CAPTURE_ARTKIT_NEUTRAL, CAPTURE_ANIM_NEUTRAL); }
if (m_towerOwner[towerId] == ALLIANCE)
{
@ -256,7 +259,7 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_ALLIANCE, m_towersAlliance);
if (m_towersAlliance == 0)
BuffTeam(ALLIANCE, plaguelandsTowerBuffs[0].spellIdAlliance, true);
{ BuffTeam(ALLIANCE, plaguelandsTowerBuffs[0].spellIdAlliance, true); }
}
else
{
@ -265,7 +268,7 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
SendUpdateWorldState(WORLD_STATE_EP_TOWER_COUNT_HORDE, m_towersHorde);
if (m_towersHorde == 0)
BuffTeam(HORDE, plaguelandsTowerBuffs[0].spellIdHorde, true);
{ BuffTeam(HORDE, plaguelandsTowerBuffs[0].spellIdHorde, true); }
}
}
@ -288,7 +291,7 @@ bool OutdoorPvPEP::ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team
case TOWER_ID_EASTWALL:
// Return false - allow the DB to handle summons
if (m_towerOwner[TOWER_ID_NORTHPASS] != team)
eventHandled = false;
{ eventHandled = false; }
break;
case TOWER_ID_PLAGUEWOOD:
// Return false - allow the DB to handle summons
@ -332,7 +335,7 @@ bool OutdoorPvPEP::HandleGameObjectUse(Player* /*player*/, GameObject* go)
{
// prevent despawning after go use
if (go->GetEntry() == GO_LORDAERON_SHRINE_ALLIANCE || go->GetEntry() == GO_LORDAERON_SHRINE_HORDE)
go->SetRespawnTime(0);
{ go->SetRespawnTime(0); }
return false;
}
@ -347,7 +350,7 @@ void OutdoorPvPEP::InitBanner(GameObject* go, uint32 towerId)
void OutdoorPvPEP::UnsummonFlightMaster(const WorldObject* objRef)
{
if (Creature* flightMaster = objRef->GetMap()->GetCreature(m_flightMaster))
flightMaster->ForcedDespawn();
{ flightMaster->ForcedDespawn(); }
}
// Handle the unsummon of the soldiers when the Eastwall tower is lost
@ -356,7 +359,7 @@ void OutdoorPvPEP::UnsummonSoldiers(const WorldObject* objRef)
for (GuidList::const_iterator itr = m_soldiers.begin(); itr != m_soldiers.end(); ++itr)
{
if (Creature* soldier = objRef->GetMap()->GetCreature(*itr))
soldier->ForcedDespawn();
{ soldier->ForcedDespawn(); }
}
m_soldiers.clear();

View file

@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef WORLD_PVP_EP
@ -26,6 +29,10 @@
#include "OutdoorPvP.h"
#include "Language.h"
/**
* @brief
*
*/
enum
{
TOWER_ID_NORTHPASS = 0,
@ -167,12 +174,16 @@ enum
WORLD_STATE_EP_CROWNGUARD_NEUTRAL = 2355
};
/**
* @brief
*
*/
struct PlaguelandsTowerBuff
{
uint32 spellIdAlliance, spellIdHorde;
uint32 spellIdAlliance, spellIdHorde; /**< TODO */
};
static const PlaguelandsTowerBuff plaguelandsTowerBuffs[MAX_EP_TOWERS] =
static const PlaguelandsTowerBuff plaguelandsTowerBuffs[MAX_EP_TOWERS] = /**< TODO */
{
{SPELL_ECHOES_OF_LORDAERON_ALLIANCE_1, SPELL_ECHOES_OF_LORDAERON_HORDE_1},
{SPELL_ECHOES_OF_LORDAERON_ALLIANCE_2, SPELL_ECHOES_OF_LORDAERON_HORDE_2},
@ -180,8 +191,7 @@ static const PlaguelandsTowerBuff plaguelandsTowerBuffs[MAX_EP_TOWERS] =
{SPELL_ECHOES_OF_LORDAERON_ALLIANCE_4, SPELL_ECHOES_OF_LORDAERON_HORDE_4}
};
// capture points coordinates to sort the banners
static const float plaguelandsTowerLocations[MAX_EP_TOWERS][2] =
static const float plaguelandsTowerLocations[MAX_EP_TOWERS][2] = /**< capture points coordinates to sort the banners */
{
{3181.08f, -4379.36f}, // Northpass
{1860.85f, -3731.23f}, // Crownguard
@ -189,15 +199,19 @@ static const float plaguelandsTowerLocations[MAX_EP_TOWERS][2] =
{2962.71f, -3042.31f} // Plaguewood
};
/**
* @brief
*
*/
struct PlaguelandsTowerEvent
{
uint32 eventEntry;
Team team;
uint32 defenseMessage;
uint32 worldState;
uint32 eventEntry; /**< TODO */
Team team; /**< TODO */
uint32 defenseMessage; /**< TODO */
uint32 worldState; /**< TODO */
};
static const PlaguelandsTowerEvent plaguelandsTowerEvents[MAX_EP_TOWERS][4] =
static const PlaguelandsTowerEvent plaguelandsTowerEvents[MAX_EP_TOWERS][4] = /**< TODO */
{
{
{EVENT_NORTHPASS_PROGRESS_ALLIANCE, ALLIANCE, LANG_OPVP_EP_CAPTURE_NPT_A, WORLD_STATE_EP_NORTHPASS_ALLIANCE},
@ -225,48 +239,132 @@ static const PlaguelandsTowerEvent plaguelandsTowerEvents[MAX_EP_TOWERS][4] =
},
};
static const uint32 plaguelandsBanners[MAX_EP_TOWERS] = {GO_TOWER_BANNER_NORTHPASS, GO_TOWER_BANNER_CROWNGUARD, GO_TOWER_BANNER_EASTWALL, GO_TOWER_BANNER_PLAGUEWOOD};
static const uint32 plaguelandsBanners[MAX_EP_TOWERS] = {GO_TOWER_BANNER_NORTHPASS, GO_TOWER_BANNER_CROWNGUARD, GO_TOWER_BANNER_EASTWALL, GO_TOWER_BANNER_PLAGUEWOOD}; /**< TODO */
/**
* @brief
*
*/
class OutdoorPvPEP : public OutdoorPvP
{
public:
/**
* @brief
*
*/
OutdoorPvPEP();
/**
* @brief
*
* @param player
* @param isMainZone
*/
void HandlePlayerEnterZone(Player* player, bool isMainZone) override;
/**
* @brief
*
* @param player
* @param isMainZone
*/
void HandlePlayerLeaveZone(Player* player, bool isMainZone) override;
/**
* @brief
*
* @param data
* @param count
*/
void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
/**
* @brief
*
* @param player
*/
void SendRemoveWorldStates(Player* player) override;
/**
* @brief
*
* @param eventId
* @param go
* @return bool
*/
bool HandleEvent(uint32 eventId, GameObject* go) override;
/**
* @brief
*
* @param eventId
* @param players
* @param team
*/
void HandleObjectiveComplete(uint32 eventId, const std::list<Player*>& players, Team team) override;
/**
* @brief
*
* @param creature
*/
void HandleCreatureCreate(Creature* creature) override;
/**
* @brief
*
* @param go
*/
void HandleGameObjectCreate(GameObject* go) override;
/**
* @brief
*
* @param player
* @param go
* @return bool
*/
bool HandleGameObjectUse(Player* player, GameObject* go) override;
private:
// process capture events
/**
* @brief process capture events
*
* @param go
* @param towerId
* @param team
* @param newWorldState
* @return bool
*/
bool ProcessCaptureEvent(GameObject* go, uint32 towerId, Team team, uint32 newWorldState);
/**
* @brief
*
* @param go
* @param towerId
*/
void InitBanner(GameObject* go, uint32 towerId);
// Plaguewood bonus - flight master
/**
* @brief Plaguewood bonus - flight master
*
* @param objRef
*/
void UnsummonFlightMaster(const WorldObject* objRef);
// Eastwall bonus - soldiers
/**
* @brief Eastwall bonus - soldiers
*
* @param objRef
*/
void UnsummonSoldiers(const WorldObject* objRef);
Team m_towerOwner[MAX_EP_TOWERS];
uint32 m_towerWorldState[MAX_EP_TOWERS];
uint8 m_towersAlliance;
uint8 m_towersHorde;
Team m_towerOwner[MAX_EP_TOWERS]; /**< TODO */
uint32 m_towerWorldState[MAX_EP_TOWERS]; /**< TODO */
uint8 m_towersAlliance; /**< TODO */
uint8 m_towersHorde; /**< TODO */
ObjectGuid m_flightMaster;
ObjectGuid m_lordaeronShrineAlliance;
ObjectGuid m_lordaeronShrineHorde;
ObjectGuid m_flightMaster; /**< TODO */
ObjectGuid m_lordaeronShrineAlliance; /**< TODO */
ObjectGuid m_lordaeronShrineHorde; /**< TODO */
GuidList m_soldiers;
GuidList m_soldiers; /**< TODO */
GuidList m_towerBanners[MAX_EP_TOWERS];
GuidList m_towerBanners[MAX_EP_TOWERS]; /**< TODO */
};
#endif

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "OutdoorPvPHP.h"

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef WORLD_PVP_HP

View file

@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "OutdoorPvPMgr.h"
@ -43,7 +46,7 @@ OutdoorPvPMgr::OutdoorPvPMgr()
OutdoorPvPMgr::~OutdoorPvPMgr()
{
for (uint8 i = 0; i < MAX_OPVP_ID; ++i)
delete m_scripts[i];
{ delete m_scripts[i]; }
}
#define LOAD_OPVP_ZONE(a) \
@ -135,7 +138,7 @@ OutdoorPvP* OutdoorPvPMgr::GetScriptOfAffectedZone(uint32 zoneId)
void OutdoorPvPMgr::HandlePlayerEnterZone(Player* player, uint32 zoneId)
{
if (OutdoorPvP* script = GetScript(zoneId))
script->HandlePlayerEnterZone(player, true);
{ script->HandlePlayerEnterZone(player, true); }
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
affectedScript->HandlePlayerEnterZone(player, false);
}
@ -150,7 +153,7 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* player, uint32 zoneId)
{
// teleport: called once from Player::CleanupsBeforeDelete, once from Player::UpdateZone
if (OutdoorPvP* script = GetScript(zoneId))
script->HandlePlayerLeaveZone(player, true);
{ script->HandlePlayerLeaveZone(player, true); }
else if (OutdoorPvP* affectedScript = GetScriptOfAffectedZone(zoneId))
affectedScript->HandlePlayerLeaveZone(player, false);
}
@ -159,11 +162,11 @@ void OutdoorPvPMgr::Update(uint32 diff)
{
m_updateTimer.Update(diff);
if (!m_updateTimer.Passed())
return;
{ return; }
for (uint8 i = 0; i < MAX_OPVP_ID; ++i)
if (m_scripts[i])
m_scripts[i]->Update(m_updateTimer.GetCurrent());
{ m_scripts[i]->Update(m_updateTimer.GetCurrent()); }
m_updateTimer.Reset();
}

View file

@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef WORLD_PVP_MGR_H
@ -26,11 +29,19 @@
#include "Policies/Singleton.h"
#include "Timer.h"
/**
* @brief
*
*/
enum
{
TIMER_OPVP_MGR_UPDATE = MINUTE * IN_MILLISECONDS // 1 minute is enough for us but this might change with wintergrasp support
};
/**
* @brief
*
*/
enum OutdoorPvPTypes
{
OPVP_ID_SI = 0,
@ -44,6 +55,10 @@ enum OutdoorPvPTypes
MAX_OPVP_ID
};
/**
* @brief
*
*/
enum OutdoorPvPZones
{
ZONE_ID_SILITHUS = 1377,
@ -88,48 +103,96 @@ struct CapturePointSlider
bool IsLocked;
};
// forward declaration
class Player;
class GameObject;
class Creature;
class OutdoorPvP;
/**
* @brief
*
*/
typedef std::map<uint32 /*capture point entry*/, CapturePointSlider /*slider value and lock state*/> CapturePointSliderMap;
class OutdoorPvPMgr
{
public:
/**
* @brief
*
*/
OutdoorPvPMgr();
/**
* @brief
*
*/
~OutdoorPvPMgr();
// load all outdoor pvp scripts
/**
* @brief load all outdoor pvp scripts
*
*/
void InitOutdoorPvP();
// called when a player enters an outdoor pvp area
/**
* @brief called when a player enters an outdoor pvp area
*
* @param player
* @param zoneId
*/
void HandlePlayerEnterZone(Player* player, uint32 zoneId);
// called when player leaves an outdoor pvp area
/**
* @brief called when player leaves an outdoor pvp area
*
* @param player
* @param zoneId
*/
void HandlePlayerLeaveZone(Player* player, uint32 zoneId);
// return assigned outdoor pvp script
/**
* @brief return assigned outdoor pvp script
*
* @param zoneId
* @return OutdoorPvP
*/
OutdoorPvP* GetScript(uint32 zoneId);
/**
* @brief
*
* @param diff
*/
void Update(uint32 diff);
// Save and load capture point slider
/**
* Save and load capture point slider
*
* @param entry
* @param value
*/
CapturePointSliderMap const* GetCapturePointSliderMap() const { return &m_capturePointSlider; }
void SetCapturePointSlider(uint32 entry, CapturePointSlider value) { m_capturePointSlider[entry] = value; }
private:
// return assigned outdoor pvp script
/**
* @brief return assigned outdoor pvp script
*
* @param zoneId
* @return OutdoorPvP
*/
OutdoorPvP* GetScriptOfAffectedZone(uint32 zoneId);
// contains all outdoor pvp scripts
OutdoorPvP* m_scripts[MAX_OPVP_ID];
OutdoorPvP* m_scripts[MAX_OPVP_ID]; /**< contains all outdoor pvp scripts */
/**
* @brief
*
*/
CapturePointSliderMap m_capturePointSlider;
// update interval
ShortIntervalTimer m_updateTimer;
ShortIntervalTimer m_updateTimer; /**< update interval */
};
#define sOutdoorPvPMgr MaNGOS::Singleton<OutdoorPvPMgr>::Instance()

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "OutdoorPvPNA.h"

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef WORLD_PVP_NA

View file

@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "OutdoorPvPSI.h"
@ -53,7 +56,7 @@ void OutdoorPvPSI::HandlePlayerEnterZone(Player* player, bool isMainZone)
// buff the player if same team is controlling the zone
if (player->GetTeam() == m_zoneOwner)
player->CastSpell(player, SPELL_CENARION_FAVOR, true);
{ player->CastSpell(player, SPELL_CENARION_FAVOR, true); }
}
// Remove buffs when player leaves zone
@ -69,13 +72,13 @@ void OutdoorPvPSI::HandlePlayerLeaveZone(Player* player, bool isMainZone)
bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId)
{
if (player->isGameMaster() || player->IsDead())
return false;
{ return false; }
switch (triggerId)
{
case AREATRIGGER_SILITHUS_ALLIANCE:
if (player->GetTeam() != ALLIANCE || !player->HasAura(SPELL_SILITHYST))
return false;
{ return false; }
// update counter
++ m_resourcesAlliance;
@ -101,11 +104,11 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId)
// give quest credit if necessary
if (player->GetQuestStatus(QUEST_SCOURING_DESERT_ALLIANCE) == QUEST_STATUS_INCOMPLETE)
player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_ALLIANCE);
{ player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_ALLIANCE); }
break;
case AREATRIGGER_SILITHUS_HORDE:
if (player->GetTeam() != HORDE || !player->HasAura(SPELL_SILITHYST))
return false;
{ return false; }
// update counter
++ m_resourcesHorde;
@ -131,7 +134,7 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* player, uint32 triggerId)
// give quest credit if necessary
if (player->GetQuestStatus(QUEST_SCOURING_DESERT_HORDE) == QUEST_STATUS_INCOMPLETE)
player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_HORDE);
{ player->KilledMonsterCredit(NPC_SILITHUS_DUST_QUEST_HORDE); }
break;
default:
return false;
@ -164,7 +167,7 @@ static SilithusSpawnLocation silithusFlagDropLocations[2] =
bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
{
if (spellId != SPELL_SILITHYST)
return false;
{ return false; }
// don't drop flag at area trigger
// we are checking distance from the AT hard-coded coordinates because it's much faster than checking the area trigger store
@ -172,11 +175,11 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId)
{
case ALLIANCE:
if (player->IsWithinDist3d(silithusFlagDropLocations[0].x, silithusFlagDropLocations[0].y, silithusFlagDropLocations[0].z, 5.0f))
return false;
{ return false; }
break;
case HORDE:
if (player->IsWithinDist3d(silithusFlagDropLocations[1].x, silithusFlagDropLocations[1].y, silithusFlagDropLocations[1].z, 5.0f))
return false;
{ return false; }
break;
default:
break;

View file

@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef WORLD_PVP_SI
@ -26,6 +29,10 @@
#include "OutdoorPvP.h"
#include "Language.h"
/**
* @brief
*
*/
enum
{
// npcs
@ -63,23 +70,70 @@ enum
WORLD_STATE_SI_SILITHYST_MAX = 2317
};
/**
* @brief
*
*/
class OutdoorPvPSI : public OutdoorPvP
{
public:
/**
* @brief
*
*/
OutdoorPvPSI();
/**
* @brief
*
* @param player
* @param isMainZone
*/
void HandlePlayerEnterZone(Player* player, bool isMainZone) override;
/**
* @brief
*
* @param player
* @param isMainZone
*/
void HandlePlayerLeaveZone(Player* player, bool isMainZone) override;
/**
* @brief
*
* @param data
* @param count
*/
void FillInitialWorldStates(WorldPacket& data, uint32& count) override;
/**
* @brief
*
* @param player
* @param triggerId
* @return bool
*/
bool HandleAreaTrigger(Player* player, uint32 triggerId) override;
/**
* @brief
*
* @param player
* @param go
* @return bool
*/
bool HandleGameObjectUse(Player* player, GameObject* go) override;
/**
* @brief
*
* @param player
* @param spellId
* @return bool
*/
bool HandleDropFlag(Player* player, uint32 spellId) override;
private:
uint8 m_resourcesAlliance;
uint8 m_resourcesHorde;
Team m_zoneOwner;
uint8 m_resourcesAlliance; /**< TODO */
uint8 m_resourcesHorde; /**< TODO */
Team m_zoneOwner; /**< TODO */
};
#endif

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "OutdoorPvPTF.h"

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef WORLD_PVP_TF

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#include "OutdoorPvPZM.h"

View file

@ -1,4 +1,4 @@
/*
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
@ -17,6 +17,9 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef WORLD_PVP_ZM

View file

@ -40,7 +40,7 @@ class MapReference : public Reference<Map, Player>
void targetObjectDestroyLink() override
{
// called from unlink()
if (isValid()) getTarget()->m_mapRefManager.decSize();
if (isValid()) { getTarget()->m_mapRefManager.decSize(); }
}
void sourceObjectDestroyLink() override
{

View file

@ -40,18 +40,18 @@ float ThreatCalcHelper::CalcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, floa
{
// all flat mods applied early
if (!threat)
return 0.0f;
{ return 0.0f; }
if (pThreatSpell)
{
if (pThreatSpell->HasAttribute(SPELL_ATTR_EX_NO_THREAT))
return 0.0f;
{ return 0.0f; }
if (Player* modOwner = pHatedUnit->GetSpellModOwner())
modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, threat);
{ modOwner->ApplySpellMod(pThreatSpell->Id, SPELLMOD_THREAT, threat); }
if (crit)
threat *= pHatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT, schoolMask);
{ threat *= pHatedUnit->GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_CRITICAL_THREAT, schoolMask); }
}
threat = pHatedUnit->ApplyTotalThreatModifier(threat, schoolMask);
@ -100,7 +100,7 @@ void HostileReference::sourceObjectDestroyLink()
void HostileReference::fireStatusChanged(ThreatRefStatusChangeEvent& pThreatRefStatusChangeEvent)
{
if (getSource())
getSource()->processThreatEvent(&pThreatRefStatusChangeEvent);
{ getSource()->processThreatEvent(&pThreatRefStatusChangeEvent); }
}
//============================================================
@ -114,7 +114,7 @@ void HostileReference::addThreat(float pMod)
// the threat is changed. Source and target unit have to be availabe
// if the link was cut before relink it again
if (!isOnline())
updateOnlineStatus();
{ updateOnlineStatus(); }
if (pMod != 0.0f)
{
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_THREAT_CHANGE, this, pMod);
@ -125,7 +125,7 @@ void HostileReference::addThreat(float pMod)
{
Unit* victim_owner = getTarget()->GetOwner();
if (victim_owner && victim_owner->IsAlive())
getSource()->addThreat(victim_owner, 0.0f); // create a threat to the owner of a pet, if the pet attacks
{ getSource()->addThreat(victim_owner, 0.0f); } // create a threat to the owner of a pet, if the pet attacks
}
}
@ -140,7 +140,7 @@ void HostileReference::updateOnlineStatus()
if (!isValid())
{
if (Unit* target = ObjectAccessor::GetUnit(*getSourceUnit(), getUnitGuid()))
link(target, getSource());
{ link(target, getSource()); }
}
// only check for online status if
// ref is valid
@ -155,10 +155,10 @@ void HostileReference::updateOnlineStatus()
if (!online)
{
if (creature->AI()->canReachByRangeAttack(getTarget()))
online = true; // not accessable but stays online
{ online = true; } // not accessable but stays online
}
else
accessible = true;
{ accessible = true; }
}
setAccessibleState(accessible);
setOnlineOfflineState(online);
@ -173,7 +173,7 @@ void HostileReference::setOnlineOfflineState(bool pIsOnline)
{
iOnline = pIsOnline;
if (!iOnline)
setAccessibleState(false); // if not online that not accessable as well
{ setAccessibleState(false); } // if not online that not accessable as well
ThreatRefStatusChangeEvent event(UEV_THREAT_REF_ONLINE_STATUS, this);
fireStatusChanged(event);
@ -251,7 +251,7 @@ HostileReference* ThreatContainer::addThreat(Unit* pVictim, float pThreat)
{
HostileReference* ref = getReferenceByTarget(pVictim);
if (ref)
ref->addThreat(pThreat);
{ ref->addThreat(pThreat); }
return ref;
}
@ -267,7 +267,7 @@ void ThreatContainer::modifyThreatPercent(Unit* pVictim, int32 pPercent)
delete ref;
}
else
ref->addThreatPercent(pPercent);
{ ref->addThreatPercent(pPercent); }
}
}
@ -318,7 +318,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
if (!onlySecondChoiceTargetsFound && pAttacker->IsSecondChoiceTarget(pTarget, pCurrentRef == pCurrentVictim))
{
if (iter != lastRef)
++iter;
{ ++iter; }
else
{
// if we reached to this point, everyone in the threatlist is a second choice target. In such a situation the target with the highest threat should be attacked.
@ -328,7 +328,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
// current victim is a second choice target, so don't compare threat with it below
if (pCurrentRef == pCurrentVictim)
pCurrentVictim = NULL;
{ pCurrentVictim = NULL; }
// second choice targets are only handled threat dependend if we have only have second choice targets
continue;
@ -385,7 +385,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* pAttacker, Hostile
++iter;
}
if (!found)
pCurrentRef = NULL;
{ pCurrentRef = NULL; }
return pCurrentRef;
}
@ -421,15 +421,15 @@ void ThreatManager::addThreat(Unit* pVictim, float pThreat, bool crit, SpellScho
// not to self
if (pVictim == getOwner())
return;
{ return; }
// not to GM
if (!pVictim || (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster()))
return;
{ return; }
// not to dead and not for dead
if (!pVictim->IsAlive() || !getOwner()->IsAlive())
return;
{ return; }
MANGOS_ASSERT(getOwner()->GetTypeId() == TYPEID_UNIT);
@ -472,7 +472,7 @@ void ThreatManager::addThreatDirectly(Unit* pVictim, float threat)
hostileReference->addThreat(threat); // now we add the real threat
iUpdateNeed = true;
if (pVictim->GetTypeId() == TYPEID_PLAYER && ((Player*)pVictim)->isGameMaster())
hostileReference->setOnlineOfflineState(false); // GM is always offline
{ hostileReference->setOnlineOfflineState(false); } // GM is always offline
}
}
@ -570,7 +570,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
case UEV_THREAT_REF_THREAT_CHANGE:
if ((getCurrentVictim() == hostileReference && threatRefStatusChangeEvent->getFValue() < 0.0f) ||
(getCurrentVictim() != hostileReference && threatRefStatusChangeEvent->getFValue() > 0.0f))
setDirty(true); // the order in the threat list might have changed
{ setDirty(true); } // the order in the threat list might have changed
break;
case UEV_THREAT_REF_ONLINE_STATUS:
if (!hostileReference->isOnline())
@ -588,7 +588,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
else
{
if (getCurrentVictim() && hostileReference->getThreat() > (1.1f * getCurrentVictim()->getThreat()))
setDirty(true);
{ setDirty(true); }
iThreatContainer.addReference(hostileReference);
iUpdateNeed = true;
iThreatOfflineContainer.remove(hostileReference);
@ -607,7 +607,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
iUpdateNeed = true;
}
else
iThreatOfflineContainer.remove(hostileReference);
{ iThreatOfflineContainer.remove(hostileReference); }
break;
}
}

View file

@ -78,7 +78,7 @@ class HostileReference : public Reference<Unit, ThreatManager>
// used for temporary setting a threat and reducting it later again.
// the threat modification is stored
void setTempThreat(float pThreat) { iTempThreatModifyer = pThreat - getThreat(); if (iTempThreatModifyer != 0.0f) addThreat(iTempThreatModifyer); }
void setTempThreat(float pThreat) { iTempThreatModifyer = pThreat - getThreat(); if (iTempThreatModifyer != 0.0f) { addThreat(iTempThreatModifyer); } }
void resetTempThreat()
{
@ -169,7 +169,7 @@ class ThreatContainer
bool isDirty() const { return iDirty; }
bool empty() const { return iThreatList.empty(); }
bool empty() const { return(iThreatList.empty()); }
HostileReference* getMostHated() { return iThreatList.empty() ? NULL : iThreatList.front(); }

View file

@ -539,11 +539,17 @@ enum SpellCastTargetFlags
TARGET_FLAG_VISUAL_CHAIN = 0x00080000 // uint32, loop { vec3, guid -> if guid == 0 break }
};
/**
* Used in \ref Unit::HasAura for example, also used in \ref Spell::m_currentBasePoints. These
* reference the three effects a \ref Spell can have which do different things, for instance it
* can be applying a \ref Aura. For a reference see QSW which you can get at
* https://bitbucket.org/sidsukana/qsw
*/
enum SpellEffectIndex
{
EFFECT_INDEX_0 = 0,
EFFECT_INDEX_1 = 1,
EFFECT_INDEX_2 = 2
EFFECT_INDEX_0 = 0, ///< The first spell effect
EFFECT_INDEX_1 = 1, ///< The second spell effect
EFFECT_INDEX_2 = 2 ///< The third spell effect
};
#define MAX_EFFECT_INDEX 3

View file

@ -260,7 +260,7 @@ bool IsAcceptableClientBuild(uint32 build)
int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD;
for (int i = 0; accepted_versions[i]; ++i)
if (int(build) == accepted_versions[i])
return true;
{ return true; }
return false;
}
@ -270,7 +270,7 @@ std::string AcceptableClientBuildsListStr()
std::ostringstream data;
int accepted_versions[] = EXPECTED_MANGOSD_CLIENT_BUILD;
for (int i = 0; accepted_versions[i]; ++i)
data << accepted_versions[i] << " ";
{ data << accepted_versions[i] << " "; }
return data.str();
}

View file

@ -69,7 +69,6 @@ enum ContentLevels
CONTENT_71_80,
CONTENT_81_85,
};
ContentLevels GetContentLevelsForMapAndZone(uint32 mapId, uint32 zoneId);
ChatChannelsEntry const* GetChannelEntryFor(uint32 channel_id);

View file

@ -157,6 +157,10 @@ enum Stats
#define MAX_STATS 5
/**
* These are the different possible powers that are available to us, they should
* be fairly familiar if you've played WoW.
*/
enum Powers
{
POWER_MANA = 0,
@ -233,7 +237,7 @@ inline SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
{
for (int i = 0; i < MAX_SPELL_SCHOOL; ++i)
if (mask & (1 << i))
return SpellSchools(i);
{ return SpellSchools(i); }
return SPELL_SCHOOL_NORMAL;
}
@ -1349,7 +1353,7 @@ enum Mechanics
#define IMMUNE_TO_INTERRUPT_AND_SILENCE_MASK ( \
(1<<(MECHANIC_INTERRUPT-1))|(1<<(MECHANIC_SILENCE-1)))
// Daze and all croud control spells except polymorph are not removed
/// Daze and all crowd control spells except polymorph are not removed
#define MECHANIC_NOT_REMOVED_BY_SHAPESHIFT ( \
(1<<(MECHANIC_CHARM -1))|(1<<(MECHANIC_DISORIENTED-1))|(1<<(MECHANIC_FEAR -1))| \
(1<<(MECHANIC_PACIFY-1))|(1<<(MECHANIC_STUN -1))|(1<<(MECHANIC_FREEZE-1))| \
@ -1397,10 +1401,12 @@ enum SpellImmunity
*/
enum WeaponAttackType // The different weapon attack-types
{
BASE_ATTACK = 0, // Main-hand weapon
OFF_ATTACK = 1, // Off-hand weapon
RANGED_ATTACK = 2 ///Ranged weapon, bow/wand etc.
///Main-hand weapon
BASE_ATTACK = 0,
///Off-hand weapon
OFF_ATTACK = 1,
///Ranged weapon, bow/wand etc.
RANGED_ATTACK = 2
};
#define MAX_ATTACK 3
@ -1503,7 +1509,7 @@ enum Targets
TARGET_VEHICLE_PASSENGER_6 = 102,
TARGET_VEHICLE_PASSENGER_7 = 103,
TARGET_IN_FRONT_OF_CASTER_30 = 104,
TARGET_105 = 105,
TARGET_105 = 105, // 1 spell
TARGET_106 = 106,
TARGET_107 = 107, // possible TARGET_WMO(GO?)_IN_FRONT_OF_CASTER(_30 ?) TODO: Verify the angle!
TARGET_GO_IN_FRONT_OF_CASTER_90 = 108,
@ -1528,11 +1534,16 @@ enum Targets
TARGET_127 = 127,
};
/**
* Tells how a spell that was cast missed or hit, ie it might have been
* resisted or dodged etc. This enum tells which of those it was. The only
* one which indicates a hit is SPELL_MISS_NONE
*/
enum SpellMissInfo
{
SPELL_MISS_NONE = 0,
SPELL_MISS_NONE = 0, ///< Indicates an actual hit
SPELL_MISS_MISS = 1,
SPELL_MISS_RESIST = 2,
SPELL_MISS_RESIST = 2, ///< The spell was resisted
SPELL_MISS_DODGE = 3,
SPELL_MISS_PARRY = 4,
SPELL_MISS_BLOCK = 5,
@ -1597,9 +1608,8 @@ enum DamageEffectType
DOT = 2,
HEAL = 3,
/// used also in case when damage applied to health but not applied to spell channelInterruptFlags/etc
NODAMAGE = 4,
/// used to avoid rogue loosing stealth on falling damage
SELF_DAMAGE_ROGUE_FALL = 5,
NODAMAGE = 4, //< used also in case when damage applied to health but not applied to spell channelInterruptFlags/etc
SELF_DAMAGE_ROGUE_FALL = 5, //< used to avoid rogue loosing stealth on falling damage
SELF_DAMAGE = 6
};
@ -3206,7 +3216,7 @@ enum UnitDynFlags
UNIT_DYNFLAG_NONE = 0x0000,
UNIT_DYNFLAG_LOOTABLE = 0x0001,
UNIT_DYNFLAG_TRACK_UNIT = 0x0002,
UNIT_DYNFLAG_TAPPED = 0x0004, // Lua_UnitIsTapped
UNIT_DYNFLAG_TAPPED = 0x0004, // Lua_UnitIsTapped - Indicates the target as grey for the client.
UNIT_DYNFLAG_TAPPED_BY_PLAYER = 0x0008, // Lua_UnitIsTappedByPlayer
UNIT_DYNFLAG_SPECIALINFO = 0x0010,
UNIT_DYNFLAG_DEAD = 0x0020,
@ -3652,7 +3662,12 @@ enum PetTameFailureReason
PETTAME_UNKNOWNERROR = 14,
};
// Stored in SummonProperties.dbc with slot+1 values
/**
* These are the different totem types that are available.
* Stored in SummonProperties.dbc with slot+1 values
* \see Totem
* \see Unit::GetTotemGuid
*/
enum TotemSlot
{
TOTEM_SLOT_FIRE = 0,

View file

@ -129,7 +129,7 @@ WorldSocket::~WorldSocket(void)
delete m_RecvWPct;
if (m_OutBuffer)
m_OutBuffer->release();
{ m_OutBuffer->release(); }
closing_ = true;
@ -147,7 +147,7 @@ void WorldSocket::CloseSocket(void)
ACE_GUARD(LockType, Guard, m_OutBufferLock);
if (closing_)
return;
{ return; }
closing_ = true;
peer().close_writer();
@ -170,7 +170,7 @@ int WorldSocket::SendPacket(const WorldPacket& pct)
ACE_GUARD_RETURN(LockType, Guard, m_OutBufferLock, -1);
if (closing_)
return -1;
{ return -1; }
// Dump outgoing packet.
sLog.outWorldPacketDump(uint32(get_handle()), pct.GetOpcode(), pct.GetOpcodeName(), &pct, false);
@ -232,7 +232,7 @@ int WorldSocket::open(void* a)
// Prevent double call to this func.
if (m_OutBuffer)
return -1;
{ return -1; }
// This will also prevent the socket from being Updated
// while we are initializing it.
@ -240,7 +240,7 @@ int WorldSocket::open(void* a)
// Hook for the manager.
if (sWorldSocketMgr->OnSocketOpen(this) == -1)
return -1;
{ return -1; }
// Allocate the buffer.
ACE_NEW_RETURN(m_OutBuffer, ACE_Message_Block(m_OutBufferSize), -1);
@ -273,7 +273,7 @@ int WorldSocket::open(void* a)
packet << uint8(1);
if (SendPacket(packet) == -1)
return -1;
{ return -1; }
// Register with ACE Reactor
if (reactor()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
@ -309,7 +309,7 @@ int WorldSocket::close (int)
int WorldSocket::handle_input(ACE_HANDLE)
{
if (closing_)
return -1;
{ return -1; }
switch (handle_input_missing_data())
{
@ -347,7 +347,7 @@ int WorldSocket::handle_output(ACE_HANDLE)
ACE_GUARD_RETURN(LockType, Guard, m_OutBufferLock, -1);
if (closing_)
return -1;
{ return -1; }
const size_t send_len = m_OutBuffer->length();
@ -361,11 +361,11 @@ int WorldSocket::handle_output(ACE_HANDLE)
#endif // MSG_NOSIGNAL
if (n == 0)
return -1;
{ return -1; }
else if (n == -1)
{
if (errno == EWOULDBLOCK || errno == EAGAIN)
return schedule_wakeup_output(Guard);
{ return schedule_wakeup_output(Guard); }
return -1;
}
@ -458,7 +458,7 @@ int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask)
closing_ = true;
if (h == ACE_INVALID_HANDLE)
peer().close_writer();
{ peer().close_writer(); }
}
// Critical section
@ -475,10 +475,10 @@ int WorldSocket::handle_close(ACE_HANDLE h, ACE_Reactor_Mask)
int WorldSocket::Update(void)
{
if (closing_)
return -1;
{ return -1; }
if (m_OutActive || (m_OutBuffer->length() == 0 && msg_queue()->is_empty()))
return 0;
{ return 0; }
int ret;
do
@ -545,7 +545,7 @@ int WorldSocket::handle_input_payload(void)
m_Header.reset();
if (ret == -1)
errno = EINVAL;
{ errno = EINVAL; }
return ret;
}
@ -572,7 +572,7 @@ int WorldSocket::handle_input_missing_data(void)
recv_size);
if (n <= 0)
return (int)n;
{ return (int)n; }
message_block.wr_ptr(n);
@ -642,7 +642,7 @@ int WorldSocket::handle_input_missing_data(void)
int WorldSocket::cancel_wakeup_output(GuardType& g)
{
if (!m_OutActive)
return 0;
{ return 0; }
m_OutActive = false;
@ -662,7 +662,7 @@ int WorldSocket::cancel_wakeup_output(GuardType& g)
int WorldSocket::schedule_wakeup_output(GuardType& g)
{
if (m_OutActive)
return 0;
{ return 0; }
m_OutActive = true;
@ -688,7 +688,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
const ACE_UINT16 opcode = new_pct->GetOpcode();
if (closing_)
return -1;
{ return -1; }
// Dump received packet.
sLog.outWorldPacketDump(uint32(get_handle()), new_pct->GetOpcode(), new_pct->GetOpcodeName(), new_pct, true);
@ -759,7 +759,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
return -1;
}
else
return 0;
{ return 0; }
}
ACE_NOTREACHED(return 0);
@ -917,7 +917,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
id = fields[0].GetUInt32();
security = fields[1].GetUInt16();
if (security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB
security = SEC_ADMINISTRATOR;
{ security = SEC_ADMINISTRATOR; }
K.SetHexStr(fields[2].GetString());
@ -925,7 +925,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
locale = LocaleConstant(fields[9].GetUInt8());
if (locale >= MAX_LOCALE)
locale = LOCALE_enUS;
{ locale = LOCALE_enUS; }
delete result;
@ -1032,7 +1032,7 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
recvPacket >> latency;
if (m_LastPingTime == ACE_Time_Value::zero)
m_LastPingTime = ACE_OS::gettimeofday(); // for 1st ping
{ m_LastPingTime = ACE_OS::gettimeofday(); } // for 1st ping
else
{
ACE_Time_Value cur_time = ACE_OS::gettimeofday();
@ -1061,7 +1061,7 @@ int WorldSocket::HandlePing(WorldPacket& recvPacket)
}
}
else
m_OverSpeedPings = 0;
{ m_OverSpeedPings = 0; }
}
// critical section

View file

@ -29,7 +29,6 @@
*/
#ifndef MANGOS_H_WORLDSOCKETMGR
#define MANGOS_H_WORLDSOCKETMGR
#include <ace/Basic_Types.h>

View file

@ -33,14 +33,14 @@ void CharacterDatabaseCleaner::CleanDatabase()
{
// config to disable
if (!sWorld.getConfig(CONFIG_BOOL_CLEAN_CHARACTER_DB))
return;
{ return; }
sLog.outString("Cleaning character database...");
// check flags which clean ups are necessary
QueryResult* result = CharacterDatabase.PQuery("SELECT cleaning_flags FROM saved_variables");
if (!result)
return;
{ return; }
uint32 flags = (*result)[0].GetUInt32();
delete result;
@ -48,9 +48,9 @@ void CharacterDatabaseCleaner::CleanDatabase()
if (flags & CLEANING_FLAG_ACHIEVEMENT_PROGRESS)
CleanCharacterAchievementProgress();
if (flags & CLEANING_FLAG_SKILLS)
CleanCharacterSkills();
{ CleanCharacterSkills(); }
if (flags & CLEANING_FLAG_SPELLS)
CleanCharacterSpell();
{ CleanCharacterSpell(); }
if (flags & CLEANING_FLAG_TALENTS)
CleanCharacterTalent();
CharacterDatabase.Execute("UPDATE saved_variables SET cleaning_flags = 0");
@ -84,7 +84,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table
found = true;
}
else
ss << ",";
{ ss << ","; }
ss << id;
}
}

View file

@ -1037,5 +1037,4 @@ enum MangosStrings
// `db_script_string` table index 2000000000-2000999999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
// For other tables maybe 2001000000-2147483647 (max index)
};
#endif

View file

@ -78,9 +78,9 @@ static bool findtoknth(std::string& str, int n, std::string::size_type& s, std::
{
int i; s = e = 0;
std::string::size_type size = str.size();
for (i = 1; s < size && i < n; ++s) if (str[s] == ' ') ++i;
for (i = 1; s < size && i < n; ++s) if (str[s] == ' ') { ++i; }
if (i < n)
return false;
{ return false; }
e = str.find(' ', s);
@ -91,7 +91,7 @@ std::string gettoknth(std::string& str, int n)
{
std::string::size_type s = 0, e = 0;
if (!findtoknth(str, n, s, e))
return "";
{ return ""; }
return str.substr(s, e - s);
}
@ -100,13 +100,13 @@ bool findnth(std::string& str, int n, std::string::size_type& s, std::string::si
{
s = str.find("VALUES ('") + 9;
if (s == std::string::npos)
return false;
{ return false; }
do
{
e = str.find("'", s);
if (e == std::string::npos)
return false;
{ return false; }
}
while (str[e - 1] == '\\');
@ -117,7 +117,7 @@ bool findnth(std::string& str, int n, std::string::size_type& s, std::string::si
s = e + 4;
e = str.find("'", s);
if (e == std::string::npos)
return false;
{ return false; }
}
while (str[e - 1] == '\\');
}
@ -129,7 +129,7 @@ std::string gettablename(std::string& str)
std::string::size_type s = 13;
std::string::size_type e = str.find(_TABLE_SIM_, s);
if (e == std::string::npos)
return "";
{ return ""; }
return str.substr(s, e - s);
}
@ -138,14 +138,14 @@ bool changenth(std::string& str, int n, const char* with, bool insert = false, b
{
std::string::size_type s, e;
if (!findnth(str, n, s, e))
return false;
{ return false; }
if (nonzero && str.substr(s, e - s) == "0")
return true; // not an error
{ return true; } // not an error
if (!insert)
str.replace(s, e - s, with);
{ str.replace(s, e - s, with); }
else
str.insert(s, with);
{ str.insert(s, with); }
return true;
}
@ -154,7 +154,7 @@ std::string getnth(std::string& str, int n)
{
std::string::size_type s, e;
if (!findnth(str, n, s, e))
return "";
{ return ""; }
return str.substr(s, e - s);
}
@ -163,13 +163,13 @@ bool changetoknth(std::string& str, int n, const char* with, bool insert = false
{
std::string::size_type s = 0, e = 0;
if (!findtoknth(str, n, s, e))
return false;
{ return false; }
if (nonzero && str.substr(s, e - s) == "0")
return true; // not an error
{ return true; } // not an error
if (!insert)
str.replace(s, e - s, with);
{ str.replace(s, e - s, with); }
else
str.insert(s, with);
{ str.insert(s, with); }
return true;
}
@ -178,7 +178,7 @@ uint32 registerNewGuid(uint32 oldGuid, std::map<uint32, uint32>& guidMap, uint32
{
std::map<uint32, uint32>::const_iterator itr = guidMap.find(oldGuid);
if (itr != guidMap.end())
return itr->second;
{ return itr->second; }
uint32 newguid = hiGuid + guidMap.size();
guidMap[oldGuid] = newguid;
@ -190,7 +190,7 @@ bool changeGuid(std::string& str, int n, std::map<uint32, uint32>& guidMap, uint
char chritem[20];
uint32 oldGuid = atoi(getnth(str, n).c_str());
if (nonzero && oldGuid == 0)
return true; // not an error
{ return true; } // not an error
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
snprintf(chritem, 20, "%u", newGuid);
@ -203,7 +203,7 @@ bool changetokGuid(std::string& str, int n, std::map<uint32, uint32>& guidMap, u
char chritem[20];
uint32 oldGuid = atoi(gettoknth(str, n).c_str());
if (nonzero && oldGuid == 0)
return true; // not an error
{ return true; } // not an error
uint32 newGuid = registerNewGuid(oldGuid, guidMap, hiGuid);
snprintf(chritem, 20, "%u", newGuid);
@ -214,7 +214,7 @@ bool changetokGuid(std::string& str, int n, std::map<uint32, uint32>& guidMap, u
std::string CreateDumpString(char const* tableName, QueryResult* result)
{
if (!tableName || !result)
return "";
{ return ""; }
std::ostringstream ss;
ss << "INSERT INTO " << _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES (";
@ -222,10 +222,10 @@ std::string CreateDumpString(char const* tableName, QueryResult* result)
for (uint32 i = 0; i < result->GetFieldCount(); ++i)
{
if (i != 0)
ss << ", ";
{ ss << ", "; }
if (fields[i].IsNULL())
ss << "NULL";
{ ss << "NULL"; }
else
{
std::string s = fields[i].GetCppString();
@ -261,7 +261,7 @@ std::string PlayerDumpWriter::GenerateWhereStr(char const* field, GUIDs const& g
GUIDs::const_iterator itr2 = itr;
if (++itr2 != guids.end())
wherestr << "','";
{ wherestr << "','"; }
}
wherestr << "')";
return wherestr.str();
@ -272,7 +272,7 @@ void StoreGUID(QueryResult* result, uint32 field, std::set<uint32>& guids)
Field* fields = result->Fetch();
uint32 guid = fields[field].GetUInt32();
if (guid)
guids.insert(guid);
{ guids.insert(guid); }
}
void StoreGUID(QueryResult* result, uint32 data, uint32 field, std::set<uint32>& guids)
@ -281,7 +281,7 @@ void StoreGUID(QueryResult* result, uint32 data, uint32 field, std::set<uint32>&
std::string dataStr = fields[data].GetCppString();
uint32 guid = atoi(gettoknth(dataStr, field).c_str());
if (guid)
guids.insert(guid);
{ guids.insert(guid); }
}
// Writing - High-level functions
@ -305,25 +305,25 @@ void PlayerDumpWriter::DumpTableContent(std::string& dump, uint32 guid, char con
// for guid set stop if set is empty
if (guids && guids->empty())
return; // nothing to do
{ return; } // nothing to do
// setup for guids case start position
GUIDs::const_iterator guids_itr;
if (guids)
guids_itr = guids->begin();
{ guids_itr = guids->begin(); }
do
{
std::string wherestr;
if (guids) // set case, get next guids string
wherestr = GenerateWhereStr(fieldname, *guids, guids_itr);
{ wherestr = GenerateWhereStr(fieldname, *guids, guids_itr); }
else // not set case, get single guid string
wherestr = GenerateWhereStr(fieldname, guid);
{ wherestr = GenerateWhereStr(fieldname, guid); }
QueryResult* result = CharacterDatabase.PQuery("SELECT * FROM %s WHERE %s", tableFrom, wherestr.c_str());
if (!result)
return;
{ return; }
do
{
@ -379,15 +379,15 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
dump += "UPDATE character_db_version SET " + reqName + " = 1 WHERE FALSE;\n\n";
}
else
sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump.");
{ sLog.outError("Table 'character_db_version' not have revision guard field, revision guard query not added to pdump."); }
delete result;
}
else
sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump.");
{ sLog.outError("Character DB not have 'character_db_version' table, revision guard query not added to pdump."); }
for (DumpTable* itr = &dumpTables[0]; itr->isValid(); ++itr)
DumpTableContent(dump, guid, itr->name, itr->name, itr->type);
{ DumpTableContent(dump, guid, itr->name, itr->name, itr->type); }
// TODO: Add instance/group..
// TODO: Add a dump level option to skip some non-important tables
@ -399,7 +399,7 @@ DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid)
{
FILE* fout = fopen(file.c_str(), "w");
if (!fout)
return DUMP_FILE_OPEN_ERROR;
{ return DUMP_FILE_OPEN_ERROR; }
std::string dump = GetDump(guid);
@ -418,11 +418,11 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
// check character count
uint32 charcount = sAccountMgr.GetCharactersCount(account);
if (charcount >= 10)
return DUMP_TOO_MANY_CHARS;
{ return DUMP_TOO_MANY_CHARS; }
FILE* fin = fopen(file.c_str(), "r");
if (!fin)
return DUMP_FILE_OPEN_ERROR;
{ return DUMP_FILE_OPEN_ERROR; }
QueryResult* result = NULL;
char newguid[20], chraccount[20], newpetid[20], currpetid[20], lastpetid[20];
@ -437,10 +437,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
delete result;
}
else incHighest = false;
else { incHighest = false; }
}
else
guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed();
{ guid = sObjectMgr.m_CharGuids.GetNextAfterMaxUsed(); }
// normalize the name if specified and check if it exists
if (!normalizePlayerName(name))
@ -480,7 +480,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
{
if (!fgets(buf, 32000, fin))
{
if (feof(fin)) break;
if (feof(fin)) { break; }
ROLLBACK(DUMP_FILE_BROKEN);
}
@ -489,17 +489,17 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
// skip empty strings
size_t nw_pos = line.find_first_not_of(" \t\n\r\7");
if (nw_pos == std::string::npos)
continue;
{ continue; }
// skip NOTE
if (line.substr(nw_pos, 15) == "IMPORTANT NOTE:")
continue;
{ continue; }
// add required_ check
if (line.substr(nw_pos, 41) == "UPDATE character_db_version SET required_")
{
if (!CharacterDatabase.Execute(line.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
continue;
}
@ -536,7 +536,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
{
case DTT_CHAR_TABLE:
if (!changenth(line, 1, newguid)) // character_*.guid update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
case DTT_CHAR_NAME_TABLE:
@ -553,10 +553,10 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
case DTT_CHARACTER:
{
if (!changenth(line, 1, newguid)) // characters.guid update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
if (!changenth(line, 2, chraccount)) // characters.account update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
if (name.empty())
{
@ -570,7 +570,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
delete result;
if (!changenth(line, 36, "1")) // characters.at_login set to "rename on login"
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
nameInvalidated = true;
}
@ -578,7 +578,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
else
{
if (!changenth(line, 3, name.c_str())) // characters.name update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
nameInvalidated = true;
}
@ -588,45 +588,45 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
case DTT_INVENTORY:
{
if (!changenth(line, 1, newguid)) // character_inventory.guid update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed(), true))
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.bag update
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_inventory.bag update
if (!changeGuid(line, 4, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // character_inventory.item update
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_inventory.item update
break;
}
case DTT_ITEM:
{
// item, owner, data field:item, owner guid
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // item_instance.guid update
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.guid update
if (!changenth(line, 2, newguid)) // item_instance.owner_guid update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
std::string vals = getnth(line, 3); // item_instance.data get
if (!changetokGuid(vals, OBJECT_FIELD_GUID + 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // item_instance.data.OBJECT_FIELD_GUID update
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.data.OBJECT_FIELD_GUID update
if (!changetoknth(vals, ITEM_FIELD_OWNER + 1, newguid))
ROLLBACK(DUMP_FILE_BROKEN); // item_instance.data.ITEM_FIELD_OWNER update
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_instance.data.ITEM_FIELD_OWNER update
if (!changenth(line, 3, vals.c_str())) // item_instance.data update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
case DTT_ITEM_GIFT:
{
if (!changenth(line, 1, newguid)) // character_gifts.guid update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // character_gifts.item_guid update
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_gifts.item_guid update
break;
}
case DTT_ITEM_LOOT:
{
// item, owner
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // item_loot.guid update
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_loot.guid update
if (!changenth(line, 2, newguid)) // item_Loot.owner_guid update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
case DTT_PET:
@ -634,7 +634,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
// store a map of old pet id to new inserted pet id for use by type 5 tables
snprintf(currpetid, 20, "%s", getnth(line, 1).c_str());
if (strlen(lastpetid) == 0)
snprintf(lastpetid, 20, "%s", currpetid);
{ snprintf(lastpetid, 20, "%s", currpetid); }
if (strcmp(lastpetid, currpetid) != 0)
{
@ -650,9 +650,9 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
}
if (!changenth(line, 1, newpetid)) // character_pet.id update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
if (!changenth(line, 3, newguid)) // character_pet.owner update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
@ -663,12 +663,12 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
// lookup currpetid and match to new inserted pet id
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
if (petids_iter == petids.end()) // couldn't find new inserted id
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
snprintf(newpetid, 20, "%d", petids_iter->second);
if (!changenth(line, 1, newpetid)) // pet_*.guid -> petid in fact
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
@ -694,19 +694,19 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
case DTT_MAIL: // mail
{
if (!changeGuid(line, 1, mails, sObjectMgr.m_MailIds.GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // mail.id update
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail.id update
if (!changenth(line, 6, newguid)) // mail.receiver update
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
case DTT_MAIL_ITEM: // mail_items
{
if (!changeGuid(line, 1, mails, sObjectMgr.m_MailIds.GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.id
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail_items.id
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
ROLLBACK(DUMP_FILE_BROKEN); // mail_items.item_guid
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail_items.item_guid
if (!changenth(line, 4, newguid)) // mail_items.receiver
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
case DTT_EQSET_TABLE:
@ -726,7 +726,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
}
if (execute_ok && !CharacterDatabase.Execute(line.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
{ ROLLBACK(DUMP_FILE_BROKEN); }
}
CharacterDatabase.CommitTransaction();
@ -737,7 +737,7 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
sObjectMgr.m_EquipmentSetIds.Set(sObjectMgr.m_EquipmentSetIds.GetNextAfterMaxUsed() + eqsets.size());
if (incHighest)
sObjectMgr.m_CharGuids.Set(sObjectMgr.m_CharGuids.GetNextAfterMaxUsed() + 1);
{ sObjectMgr.m_CharGuids.Set(sObjectMgr.m_CharGuids.GetNextAfterMaxUsed() + 1); }
fclose(fin);

View file

@ -44,18 +44,18 @@ AccountMgr::~AccountMgr()
AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password)
{
if (utf8length(username) > MAX_ACCOUNT_STR)
return AOR_NAME_TOO_LONG; // username's too long
{ return AOR_NAME_TOO_LONG; } // username's too long
normalizeString(username);
normalizeString(password);
if (GetId(username))
{
return AOR_NAME_ALREADY_EXIST; // username does already exist
{ return AOR_NAME_ALREADY_EXIST; } // username does already exist
}
if (!LoginDatabase.PExecute("INSERT INTO account(username,sha_pass_hash,joindate) VALUES('%s','%s',NOW())", username.c_str(), CalculateShaPassHash(username, password).c_str()))
return AOR_DB_INTERNAL_ERROR; // unexpected error
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
LoginDatabase.Execute("INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist,account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL");
return AOR_OK; // everything's fine
@ -85,7 +85,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
{
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
if (!result)
return AOR_NAME_NOT_EXIST; // account doesn't exist
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
delete result;
// existing characters list
@ -119,7 +119,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
LoginDatabase.CommitTransaction();
if (!res)
return AOR_DB_INTERNAL_ERROR; // unexpected error;
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error;
return AOR_OK;
}
@ -128,14 +128,14 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
{
QueryResult* result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%u'", accid);
if (!result)
return AOR_NAME_NOT_EXIST; // account doesn't exist
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
delete result;
if (utf8length(new_uname) > MAX_ACCOUNT_STR)
return AOR_NAME_TOO_LONG;
{ return AOR_NAME_TOO_LONG; }
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
return AOR_PASS_TOO_LONG;
{ return AOR_PASS_TOO_LONG; }
normalizeString(new_uname);
normalizeString(new_passwd);
@ -145,7 +145,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accid, std::string new_uname,
if (!LoginDatabase.PExecute("UPDATE account SET v='0',s='0',username='%s',sha_pass_hash='%s' WHERE id='%u'", safe_new_uname.c_str(),
CalculateShaPassHash(new_uname, new_passwd).c_str(), accid))
return AOR_DB_INTERNAL_ERROR; // unexpected error
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
return AOR_OK;
}
@ -155,17 +155,17 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accid, std::string new_passwd)
std::string username;
if (!GetName(accid, username))
return AOR_NAME_NOT_EXIST; // account doesn't exist
{ return AOR_NAME_NOT_EXIST; } // account doesn't exist
if (utf8length(new_passwd) > MAX_ACCOUNT_STR)
return AOR_PASS_TOO_LONG;
{ return AOR_PASS_TOO_LONG; }
normalizeString(new_passwd);
// also reset s and v to force update at next realmd login
if (!LoginDatabase.PExecute("UPDATE account SET v='0', s='0', sha_pass_hash='%s' WHERE id='%u'",
CalculateShaPassHash(username, new_passwd).c_str(), accid))
return AOR_DB_INTERNAL_ERROR; // unexpected error
{ return AOR_DB_INTERNAL_ERROR; } // unexpected error
return AOR_OK;
}
@ -175,7 +175,7 @@ uint32 AccountMgr::GetId(std::string username)
LoginDatabase.escape_string(username);
QueryResult* result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str());
if (!result)
return 0;
{ return 0; }
else
{
uint32 id = (*result)[0].GetUInt32();
@ -222,14 +222,14 @@ uint32 AccountMgr::GetCharactersCount(uint32 acc_id)
return charcount;
}
else
return 0;
{ return 0; }
}
bool AccountMgr::CheckPassword(uint32 accid, std::string passwd)
{
std::string username;
if (!GetName(accid, username))
return false;
{ return false; }
normalizeString(passwd);
normalizeString(username);
@ -250,7 +250,7 @@ bool AccountMgr::normalizeString(std::string& utf8str)
size_t wstr_len = MAX_ACCOUNT_STR;
if (!Utf8toWStr(utf8str, wstr_buf, wstr_len))
return false;
{ return false; }
for (uint32 i = 0; i <= wstr_len; ++i)
wstr_buf[i] = wcharToUpperOnlyLatin(wstr_buf[i]);

View file

@ -42,7 +42,7 @@ namespace MMAP
MMapManager* MMapFactory::createOrGetMMapManager()
{
if (g_MMapManager == NULL)
g_MMapManager = new MMapManager();
{ g_MMapManager = new MMapManager(); }
return g_MMapManager;
}
@ -50,7 +50,7 @@ namespace MMAP
void MMapFactory::preventPathfindingOnMaps(const char* ignoreMapIds)
{
if (!g_mmapDisabledIds)
g_mmapDisabledIds = new std::set<uint32>();
{ g_mmapDisabledIds = new std::set<uint32>(); }
uint32 strLenght = strlen(ignoreMapIds) + 1;
char* mapList = new char[strLenght];
@ -133,7 +133,7 @@ namespace MMAP
MMapManager::~MMapManager()
{
for (MMapDataSet::iterator i = loadedMMaps.begin(); i != loadedMMaps.end(); ++i)
delete i->second;
{ delete i->second; }
// by now we should not have maps loaded
// if we had, tiles in MMapData->mmapLoadedTiles, their actual data is lost!
@ -143,7 +143,7 @@ namespace MMAP
{
// we already have this map loaded?
if (loadedMMaps.find(mapId) != loadedMMaps.end())
return true;
{ return true; }
// load and init dtNavMesh - read parameters from file
uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%03i.mmap") + 1;
@ -154,7 +154,7 @@ namespace MMAP
if (!file)
{
if (MMapFactory::IsPathfindingEnabled(mapId))
sLog.outError("MMAP:loadMapData: Error: Could not open mmap file '%s'", fileName);
{ sLog.outError("MMAP:loadMapData: Error: Could not open mmap file '%s'", fileName); }
delete[] fileName;
return false;
}
@ -194,7 +194,7 @@ namespace MMAP
{
// make sure the mmap is loaded and ready to load tiles
if (!loadMapData(mapId))
return false;
{ return false; }
// get this mmap data
MMapData* mmap = loadedMMaps[mapId];