Core: Codestyle clean-up
"pl"->"player" Note: codestyle methods needs maintained, Player* player. still to do properly clean-up chat.cpp.
This commit is contained in:
@@ -46,8 +46,8 @@ namespace Trinity
|
|||||||
class AchievementChatBuilder
|
class AchievementChatBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AchievementChatBuilder(Player const& pl, ChatMsg msgtype, int32 textId, uint32 ach_id)
|
AchievementChatBuilder(Player const& player, ChatMsg msgtype, int32 textId, uint32 ach_id)
|
||||||
: i_player(pl), i_msgtype(msgtype), i_textId(textId), i_achievementId(ach_id) {}
|
: i_player(player), i_msgtype(msgtype), i_textId(textId), i_achievementId(ach_id) {}
|
||||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||||
{
|
{
|
||||||
char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx);
|
char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx);
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ class WorldPacket;
|
|||||||
class AchievementMgr
|
class AchievementMgr
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AchievementMgr(Player* pl);
|
AchievementMgr(Player* player);
|
||||||
~AchievementMgr();
|
~AchievementMgr();
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|||||||
@@ -1823,8 +1823,8 @@ uint32 Battleground::GetAlivePlayersCountByTeam(uint32 Team) const
|
|||||||
{
|
{
|
||||||
if (itr->second.Team == Team)
|
if (itr->second.Team == Team)
|
||||||
{
|
{
|
||||||
Player* pl = ObjectAccessor::FindPlayer(itr->first);
|
Player* player = ObjectAccessor::FindPlayer(itr->first);
|
||||||
if (pl && pl->isAlive() && !pl->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION))
|
if (player && player->isAlive() && !player->HasByteFlag(UNIT_FIELD_BYTES_2, 3, FORM_SPIRITOFREDEMPTION))
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ class Battleground
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void DestroyGate(Player* /*pl*/, GameObject* /*go*/) {}
|
virtual void DestroyGate(Player* /*player*/, GameObject* /*go*/) {}
|
||||||
|
|
||||||
/* achievement req. */
|
/* achievement req. */
|
||||||
virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; }
|
virtual bool IsAllNodesConrolledByTeam(uint32 /*team*/) const { return false; }
|
||||||
|
|||||||
@@ -868,35 +868,35 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundMgr::SendToBattleground(Player* pl, uint32 instanceId, BattlegroundTypeId bgTypeId)
|
void BattlegroundMgr::SendToBattleground(Player* player, uint32 instanceId, BattlegroundTypeId bgTypeId)
|
||||||
{
|
{
|
||||||
Battleground* bg = GetBattleground(instanceId, bgTypeId);
|
Battleground* bg = GetBattleground(instanceId, bgTypeId);
|
||||||
if (bg)
|
if (bg)
|
||||||
{
|
{
|
||||||
uint32 mapid = bg->GetMapId();
|
uint32 mapid = bg->GetMapId();
|
||||||
float x, y, z, O;
|
float x, y, z, O;
|
||||||
uint32 team = pl->GetBGTeam();
|
uint32 team = player->GetBGTeam();
|
||||||
if (team == 0)
|
if (team == 0)
|
||||||
team = pl->GetTeam();
|
team = player->GetTeam();
|
||||||
bg->GetTeamStartLoc(team, x, y, z, O);
|
bg->GetTeamStartLoc(team, x, y, z, O);
|
||||||
|
|
||||||
sLog->outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", pl->GetName(), mapid, x, y, z, O);
|
sLog->outDetail("BATTLEGROUND: Sending %s to map %u, X %f, Y %f, Z %f, O %f", player->GetName(), mapid, x, y, z, O);
|
||||||
pl->TeleportTo(mapid, x, y, z, O);
|
player->TeleportTo(mapid, x, y, z, O);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sLog->outError("player %u is trying to port to non-existent bg instance %u", pl->GetGUIDLow(), instanceId);
|
sLog->outError("player %u is trying to port to non-existent bg instance %u", player->GetGUIDLow(), instanceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* pl, Battleground* bg, uint64 guid)
|
void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12);
|
||||||
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
|
uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds
|
||||||
if (time_ == uint32(-1))
|
if (time_ == uint32(-1))
|
||||||
time_ = 0;
|
time_ = 0;
|
||||||
data << guid << time_;
|
data << guid << time_;
|
||||||
pl->GetSession()->SendPacket(&data);
|
player->GetSession()->SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
|
bool BattlegroundMgr::IsArenaType(BattlegroundTypeId bgTypeId)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class BattlegroundMgr
|
|||||||
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
|
void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg);
|
||||||
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1);
|
void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1);
|
||||||
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid);
|
||||||
void SendAreaSpiritHealerQueryOpcode(Player* pl, Battleground* bg, uint64 guid);
|
void SendAreaSpiritHealerQueryOpcode(Player* player, Battleground* bg, uint64 guid);
|
||||||
|
|
||||||
/* Battlegrounds */
|
/* Battlegrounds */
|
||||||
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
|
Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId);
|
||||||
@@ -91,7 +91,7 @@ class BattlegroundMgr
|
|||||||
void CreateInitialBattlegrounds();
|
void CreateInitialBattlegrounds();
|
||||||
void DeleteAllBattlegrounds();
|
void DeleteAllBattlegrounds();
|
||||||
|
|
||||||
void SendToBattleground(Player* pl, uint32 InstanceID, BattlegroundTypeId bgTypeId);
|
void SendToBattleground(Player* player, uint32 InstanceID, BattlegroundTypeId bgTypeId);
|
||||||
|
|
||||||
/* Battleground queues */
|
/* Battleground queues */
|
||||||
//these queues are instantiated when creating BattlegroundMrg
|
//these queues are instantiated when creating BattlegroundMrg
|
||||||
|
|||||||
@@ -713,18 +713,18 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
|
|||||||
|
|
||||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
{
|
{
|
||||||
Player* pl = itr->getSource();
|
Player* player = itr->getSource();
|
||||||
|
|
||||||
if (!pl || pl == m_session->GetPlayer() || !pl->GetSession())
|
if (!player || player == m_session->GetPlayer() || !player->GetSession())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (HasLowerSecurity(pl, 0))
|
if (HasLowerSecurity(player, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string plNameLink = GetNameLink(pl);
|
std::string plNameLink = GetNameLink(player);
|
||||||
|
|
||||||
if (pl->IsBeingTeleported() == true)
|
if (player->IsBeingTeleported() == true)
|
||||||
{
|
{
|
||||||
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||||
SetSentErrorMessage(true);
|
SetSentErrorMessage(true);
|
||||||
@@ -733,7 +733,7 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
|
|||||||
|
|
||||||
if (to_instance)
|
if (to_instance)
|
||||||
{
|
{
|
||||||
Map* plMap = pl->GetMap();
|
Map* plMap = player->GetMap();
|
||||||
|
|
||||||
if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
|
if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
|
||||||
{
|
{
|
||||||
@@ -745,23 +745,23 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
|
PSendSysMessage(LANG_SUMMONING, plNameLink.c_str(), "");
|
||||||
if (needReportToTarget(pl))
|
if (needReportToTarget(player))
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
|
ChatHandler(player).PSendSysMessage(LANG_SUMMONED_BY, GetNameLink().c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if (pl->isInFlight())
|
if (player->isInFlight())
|
||||||
{
|
{
|
||||||
pl->GetMotionMaster()->MovementExpired();
|
player->GetMotionMaster()->MovementExpired();
|
||||||
pl->CleanupAfterTaxiFlight();
|
player->CleanupAfterTaxiFlight();
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
pl->SaveRecallPosition();
|
player->SaveRecallPosition();
|
||||||
|
|
||||||
// before GM
|
// before GM
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
m_session->GetPlayer()->GetClosePoint(x, y, z, pl->GetObjectSize());
|
m_session->GetPlayer()->GetClosePoint(x, y, z, player->GetObjectSize());
|
||||||
pl->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, pl->GetOrientation());
|
player->TeleportTo(m_session->GetPlayer()->GetMapId(), x, y, z, player->GetOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -256,10 +256,10 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
|
|||||||
if (count == 0)
|
if (count == 0)
|
||||||
count = 1;
|
count = 1;
|
||||||
|
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
Player* plTarget = getSelectedPlayer();
|
Player* plTarget = getSelectedPlayer();
|
||||||
if (!plTarget)
|
if (!plTarget)
|
||||||
plTarget = pl;
|
plTarget = player;
|
||||||
|
|
||||||
sLog->outDetail(GetTrinityString(LANG_ADDITEM), itemId, count);
|
sLog->outDetail(GetTrinityString(LANG_ADDITEM), itemId, count);
|
||||||
|
|
||||||
@@ -298,15 +298,15 @@ bool ChatHandler::HandleAddItemCommand(const char *args)
|
|||||||
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
Item* item = plTarget->StoreNewItem(dest, itemId, true, Item::GenerateItemRandomPropertyId(itemId));
|
||||||
|
|
||||||
// remove binding (let GM give it to another player later)
|
// remove binding (let GM give it to another player later)
|
||||||
if (pl == plTarget)
|
if (player == plTarget)
|
||||||
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
|
for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
|
||||||
if (Item* item1 = pl->GetItemByPos(itr->pos))
|
if (Item* item1 = player->GetItemByPos(itr->pos))
|
||||||
item1->SetBinding(false);
|
item1->SetBinding(false);
|
||||||
|
|
||||||
if (count > 0 && item)
|
if (count > 0 && item)
|
||||||
{
|
{
|
||||||
pl->SendNewItem(item, count, false, true);
|
player->SendNewItem(item, count, false, true);
|
||||||
if (pl != plTarget)
|
if (player != plTarget)
|
||||||
plTarget->SendNewItem(item, count, true, false);
|
plTarget->SendNewItem(item, count, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -637,9 +637,9 @@ bool ChatHandler::HandleListObjectCommand(const char *args)
|
|||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
{
|
{
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
||||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), go_id, uint32(count));
|
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), go_id, uint32(count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
|
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
|
||||||
@@ -709,9 +709,9 @@ bool ChatHandler::HandleListCreatureCommand(const char *args)
|
|||||||
|
|
||||||
if (m_session)
|
if (m_session)
|
||||||
{
|
{
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
|
||||||
pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ(), cr_id, uint32(count));
|
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), cr_id, uint32(count));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
|
result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
|
||||||
@@ -3458,11 +3458,11 @@ bool ChatHandler::HandleBanListIPCommand(const char *args)
|
|||||||
|
|
||||||
bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
|
bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
|
||||||
{
|
{
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
|
|
||||||
// accept only explicitly selected target (not implicitly self targeting case)
|
// accept only explicitly selected target (not implicitly self targeting case)
|
||||||
Unit* target = getSelectedUnit();
|
Unit* target = getSelectedUnit();
|
||||||
if (pl->GetSelection() && target)
|
if (player->GetSelection() && target)
|
||||||
{
|
{
|
||||||
if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
|
if (target->GetTypeId() != TYPEID_UNIT || target->isPet())
|
||||||
{
|
{
|
||||||
@@ -3476,15 +3476,15 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
CellCoord p(Trinity::ComputeCellCoord(pl->GetPositionX(), pl->GetPositionY()));
|
CellCoord p(Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY()));
|
||||||
Cell cell(p);
|
Cell cell(p);
|
||||||
cell.SetNoCreate();
|
cell.SetNoCreate();
|
||||||
|
|
||||||
Trinity::RespawnDo u_do;
|
Trinity::RespawnDo u_do;
|
||||||
Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(pl, u_do);
|
Trinity::WorldObjectWorker<Trinity::RespawnDo> worker(player, u_do);
|
||||||
|
|
||||||
TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
|
TypeContainerVisitor<Trinity::WorldObjectWorker<Trinity::RespawnDo>, GridTypeMapContainer > obj_worker(worker);
|
||||||
cell.Visit(p, obj_worker, *pl->GetMap(), *pl, pl->GetGridActivationRange());
|
cell.Visit(p, obj_worker, *player->GetMap(), *player, player->GetGridActivationRange());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -4031,9 +4031,9 @@ bool ChatHandler::HandleComeToMeCommand(const char *args)
|
|||||||
|
|
||||||
caster->SetUnitMovementFlags(newFlags);
|
caster->SetUnitMovementFlags(newFlags);
|
||||||
|
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
|
|
||||||
caster->GetMotionMaster()->MovePoint(0, pl->GetPositionX(), pl->GetPositionY(), pl->GetPositionZ());
|
caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4177,9 +4177,9 @@ bool ChatHandler::HandleInstanceStatsCommand(const char* /*args*/)
|
|||||||
|
|
||||||
bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/)
|
bool ChatHandler::HandleInstanceSaveDataCommand(const char * /*args*/)
|
||||||
{
|
{
|
||||||
Player* pl = m_session->GetPlayer();
|
Player* player = m_session->GetPlayer();
|
||||||
|
|
||||||
Map* map = pl->GetMap();
|
Map* map = player->GetMap();
|
||||||
if (!map->IsDungeon())
|
if (!map->IsDungeon())
|
||||||
{
|
{
|
||||||
PSendSysMessage("Map is not a dungeon.");
|
PSendSysMessage("Map is not a dungeon.");
|
||||||
|
|||||||
@@ -1438,14 +1438,14 @@ bool Creature::canStartAttack(Unit const* who, bool force) const
|
|||||||
return IsWithinLOSInMap(who);
|
return IsWithinLOSInMap(who);
|
||||||
}
|
}
|
||||||
|
|
||||||
float Creature::GetAttackDistance(Unit const* pl) const
|
float Creature::GetAttackDistance(Unit const* player) const
|
||||||
{
|
{
|
||||||
float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
|
float aggroRate = sWorld->getRate(RATE_CREATURE_AGGRO);
|
||||||
if (aggroRate == 0)
|
if (aggroRate == 0)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|
||||||
uint32 playerlevel = pl->getLevelForTarget(this);
|
uint32 playerlevel = player->getLevelForTarget(this);
|
||||||
uint32 creaturelevel = getLevelForTarget(pl);
|
uint32 creaturelevel = getLevelForTarget(player);
|
||||||
|
|
||||||
int32 leveldif = int32(playerlevel) - int32(creaturelevel);
|
int32 leveldif = int32(playerlevel) - int32(creaturelevel);
|
||||||
|
|
||||||
@@ -1466,7 +1466,7 @@ float Creature::GetAttackDistance(Unit const* pl) const
|
|||||||
RetDistance += GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE);
|
RetDistance += GetTotalAuraModifier(SPELL_AURA_MOD_DETECT_RANGE);
|
||||||
|
|
||||||
// detected range auras
|
// detected range auras
|
||||||
RetDistance += pl->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
|
RetDistance += player->GetTotalAuraModifier(SPELL_AURA_MOD_DETECTED_RANGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
|
// "Minimum Aggro Radius for a mob seems to be combat range (5 yards)"
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
|
|||||||
CreatureSpellCooldowns m_CreatureCategoryCooldowns;
|
CreatureSpellCooldowns m_CreatureCategoryCooldowns;
|
||||||
|
|
||||||
bool canStartAttack(Unit const* u, bool force) const;
|
bool canStartAttack(Unit const* u, bool force) const;
|
||||||
float GetAttackDistance(Unit const* pl) const;
|
float GetAttackDistance(Unit const* player) const;
|
||||||
|
|
||||||
void SendAIReaction(AiReaction reactionType);
|
void SendAIReaction(AiReaction reactionType);
|
||||||
|
|
||||||
|
|||||||
@@ -780,13 +780,13 @@ void Object::ClearUpdateMask(bool remove)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::BuildFieldsUpdate(Player* pl, UpdateDataMapType& data_map) const
|
void Object::BuildFieldsUpdate(Player* player, UpdateDataMapType& data_map) const
|
||||||
{
|
{
|
||||||
UpdateDataMapType::iterator iter = data_map.find(pl);
|
UpdateDataMapType::iterator iter = data_map.find(player);
|
||||||
|
|
||||||
if (iter == data_map.end())
|
if (iter == data_map.end())
|
||||||
{
|
{
|
||||||
std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert(UpdateDataMapType::value_type(pl, UpdateData()));
|
std::pair<UpdateDataMapType::iterator, bool> p = data_map.insert(UpdateDataMapType::value_type(player, UpdateData()));
|
||||||
ASSERT(p.second);
|
ASSERT(p.second);
|
||||||
iter = p.first;
|
iter = p.first;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2338,7 +2338,7 @@ class Player : public Unit, public GridObject<Player>
|
|||||||
|
|
||||||
bool IsNeverVisible() const;
|
bool IsNeverVisible() const;
|
||||||
|
|
||||||
bool IsVisibleGloballyFor(Player* pl) const;
|
bool IsVisibleGloballyFor(Player* player) const;
|
||||||
|
|
||||||
void SendInitialVisiblePackets(Unit* target);
|
void SendInitialVisiblePackets(Unit* target);
|
||||||
void UpdateObjectVisibility(bool forced = true);
|
void UpdateObjectVisibility(bool forced = true);
|
||||||
|
|||||||
@@ -584,13 +584,13 @@ void Transport::Update(uint32 p_diff)
|
|||||||
|
|
||||||
void Transport::UpdateForMap(Map const* targetMap)
|
void Transport::UpdateForMap(Map const* targetMap)
|
||||||
{
|
{
|
||||||
Map::PlayerList const& pl = targetMap->GetPlayers();
|
Map::PlayerList const& player = targetMap->GetPlayers();
|
||||||
if (pl.isEmpty())
|
if (player.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (GetMapId() == targetMap->GetId())
|
if (GetMapId() == targetMap->GetId())
|
||||||
{
|
{
|
||||||
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
|
for (Map::PlayerList::const_iterator itr = player.begin(); itr != player.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (this != itr->getSource()->GetTransport())
|
if (this != itr->getSource()->GetTransport())
|
||||||
{
|
{
|
||||||
@@ -609,7 +609,7 @@ void Transport::UpdateForMap(Map const* targetMap)
|
|||||||
WorldPacket out_packet;
|
WorldPacket out_packet;
|
||||||
transData.BuildPacket(&out_packet);
|
transData.BuildPacket(&out_packet);
|
||||||
|
|
||||||
for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
|
for (Map::PlayerList::const_iterator itr = player.begin(); itr != player.end(); ++itr)
|
||||||
if (this != itr->getSource()->GetTransport())
|
if (this != itr->getSource()->GetTransport())
|
||||||
itr->getSource()->SendDirectMessage(&out_packet);
|
itr->getSource()->SendDirectMessage(&out_packet);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5369,11 +5369,11 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|||||||
m->checked = fields[7].GetUInt32();
|
m->checked = fields[7].GetUInt32();
|
||||||
m->mailTemplateId = fields[8].GetInt16();
|
m->mailTemplateId = fields[8].GetInt16();
|
||||||
|
|
||||||
Player* pl = NULL;
|
Player* player = NULL;
|
||||||
if (serverUp)
|
if (serverUp)
|
||||||
pl = ObjectAccessor::FindPlayer((uint64)m->receiver);
|
player = ObjectAccessor::FindPlayer((uint64)m->receiver);
|
||||||
|
|
||||||
if (pl && pl->m_mailsLoaded)
|
if (player && player->m_mailsLoaded)
|
||||||
{ // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
|
{ // this code will run very improbably (the time is between 4 and 5 am, in game is online a player, who has old mail
|
||||||
// his in mailbox and he has already listed his mails)
|
// his in mailbox and he has already listed his mails)
|
||||||
delete m;
|
delete m;
|
||||||
@@ -8490,13 +8490,13 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, bool savetodb)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* pl, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
|
bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* player, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
|
||||||
{
|
{
|
||||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
|
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
|
||||||
if (!cInfo)
|
if (!cInfo)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
|
sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not existed creature template (Entry: %u), ignore", vendor_entry);
|
||||||
return false;
|
return false;
|
||||||
@@ -8506,8 +8506,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
|||||||
{
|
{
|
||||||
if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
|
if (!skip_vendors || skip_vendors->count(vendor_entry) == 0)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
ChatHandler(player).SendSysMessage(LANG_COMMAND_VENDORSELECTION);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
|
sLog->outErrorDb("Table `(game_event_)npc_vendor` have data for not creature template (Entry: %u) without vendor flag, ignore", vendor_entry);
|
||||||
|
|
||||||
@@ -8519,8 +8519,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
|||||||
|
|
||||||
if (!sObjectMgr->GetItemTemplate(item_id))
|
if (!sObjectMgr->GetItemTemplate(item_id))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
|
ChatHandler(player).PSendSysMessage(LANG_ITEM_NOT_FOUND, item_id);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id);
|
sLog->outErrorDb("Table `(game_event_)npc_vendor` for Vendor (Entry: %u) have in item list non-existed item (%u), ignore", vendor_entry, item_id);
|
||||||
return false;
|
return false;
|
||||||
@@ -8528,8 +8528,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
|||||||
|
|
||||||
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
|
if (ExtendedCost && !sItemExtendedCostStore.LookupEntry(ExtendedCost))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
ChatHandler(player).PSendSysMessage(LANG_EXTENDED_COST_NOT_EXIST, ExtendedCost);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
|
sLog->outErrorDb("Table `(game_event_)npc_vendor` have Item (Entry: %u) with wrong ExtendedCost (%u) for vendor (%u), ignore", item_id, ExtendedCost, vendor_entry);
|
||||||
return false;
|
return false;
|
||||||
@@ -8537,16 +8537,16 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
|||||||
|
|
||||||
if (maxcount > 0 && incrtime == 0)
|
if (maxcount > 0 && incrtime == 0)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
|
ChatHandler(player).PSendSysMessage("MaxCount != 0 (%u) but IncrTime == 0", maxcount);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
|
sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount` (%u) for item %u of vendor (Entry: %u) but `incrtime`=0, ignore", maxcount, item_id, vendor_entry);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (maxcount == 0 && incrtime > 0)
|
else if (maxcount == 0 && incrtime > 0)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
|
ChatHandler(player).PSendSysMessage("MaxCount == 0 but IncrTime<>= 0");
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
|
sLog->outErrorDb("Table `(game_event_)npc_vendor` has `maxcount`=0 for item %u of vendor (Entry: %u) but `incrtime`<>0, ignore", item_id, vendor_entry);
|
||||||
return false;
|
return false;
|
||||||
@@ -8558,8 +8558,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
|||||||
|
|
||||||
if (vItems->FindItemCostPair(item_id, ExtendedCost))
|
if (vItems->FindItemCostPair(item_id, ExtendedCost))
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
|
ChatHandler(player).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry);
|
sLog->outErrorDb("Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry);
|
||||||
return false;
|
return false;
|
||||||
@@ -8567,8 +8567,8 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
|||||||
|
|
||||||
if (vItems->GetItemCount() >= MAX_VENDOR_ITEMS)
|
if (vItems->GetItemCount() >= MAX_VENDOR_ITEMS)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
|
ChatHandler(player).SendSysMessage(LANG_COMMAND_ADDVENDORITEMITEMS);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
|
sLog->outErrorDb("Table `npc_vendor` has too many items (%u >= %i) for vendor (Entry: %u), ignore", vItems->GetItemCount(), MAX_VENDOR_ITEMS, vendor_entry);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1140,7 +1140,7 @@ class ObjectMgr
|
|||||||
}
|
}
|
||||||
void AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event
|
void AddVendorItem(uint32 entry, uint32 item, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, bool savetodb = true); // for event
|
||||||
bool RemoveVendorItem(uint32 entry, uint32 item, bool savetodb = true); // for event
|
bool RemoveVendorItem(uint32 entry, uint32 item, bool savetodb = true); // for event
|
||||||
bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
|
bool IsVendorItemValid(uint32 vendor_entry, uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* player = NULL, std::set<uint32>* skip_vendors = NULL, uint32 ORnpcflag = 0) const;
|
||||||
|
|
||||||
void LoadScriptNames();
|
void LoadScriptNames();
|
||||||
ScriptNameMap &GetScriptNames() { return m_scriptNames; }
|
ScriptNameMap &GetScriptNames() { return m_scriptNames; }
|
||||||
|
|||||||
@@ -156,12 +156,12 @@ void CreatureRelocationNotifier::Visit(PlayerMapType &m)
|
|||||||
{
|
{
|
||||||
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
for (PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter)
|
||||||
{
|
{
|
||||||
Player* pl = iter->getSource();
|
Player* player = iter->getSource();
|
||||||
|
|
||||||
if (!pl->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
if (!player->m_seer->isNeedNotify(NOTIFY_VISIBILITY_CHANGED))
|
||||||
pl->UpdateVisibilityOf(&i_creature);
|
player->UpdateVisibilityOf(&i_creature);
|
||||||
|
|
||||||
CreatureUnitRelocationWorker(&i_creature, pl);
|
CreatureUnitRelocationWorker(&i_creature, player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Trinity
|
|||||||
|
|
||||||
struct PlayerRelocationNotifier : public VisibleNotifier
|
struct PlayerRelocationNotifier : public VisibleNotifier
|
||||||
{
|
{
|
||||||
PlayerRelocationNotifier(Player &pl) : VisibleNotifier(pl) {}
|
PlayerRelocationNotifier(Player &player) : VisibleNotifier(player) {}
|
||||||
|
|
||||||
template<class T> void Visit(GridRefManager<T> &m) { VisibleNotifier::Visit(m); }
|
template<class T> void Visit(GridRefManager<T> &m) { VisibleNotifier::Visit(m); }
|
||||||
void Visit(CreatureMapType &);
|
void Visit(CreatureMapType &);
|
||||||
|
|||||||
@@ -1425,10 +1425,10 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
|
|||||||
Player* pNewLooter = NULL;
|
Player* pNewLooter = NULL;
|
||||||
for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
|
for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr)
|
||||||
{
|
{
|
||||||
if (Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
|
||||||
if (pl->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
if (player->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||||
{
|
{
|
||||||
pNewLooter = pl;
|
pNewLooter = player;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1438,10 +1438,10 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed)
|
|||||||
// search from start
|
// search from start
|
||||||
for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
|
for (member_citerator itr = m_memberSlots.begin(); itr != guid_itr; ++itr)
|
||||||
{
|
{
|
||||||
if (Player* pl = ObjectAccessor::FindPlayer(itr->guid))
|
if (Player* player = ObjectAccessor::FindPlayer(itr->guid))
|
||||||
if (pl->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
if (player->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false))
|
||||||
{
|
{
|
||||||
pNewLooter = pl;
|
pNewLooter = player;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -436,8 +436,8 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
|
|||||||
roundRobinPlayer = lootOwner->GetGUID();
|
roundRobinPlayer = lootOwner->GetGUID();
|
||||||
|
|
||||||
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
if (Player* pl = itr->getSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
|
if (Player* player = itr->getSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter
|
||||||
FillNotNormalLootFor(pl, pl->IsAtGroupRewardDistance(lootOwner));
|
FillNotNormalLootFor(player, player->IsAtGroupRewardDistance(lootOwner));
|
||||||
|
|
||||||
for (uint8 i = 0; i < items.size(); ++i)
|
for (uint8 i = 0; i < items.size(); ++i)
|
||||||
{
|
{
|
||||||
@@ -453,28 +453,28 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Loot::FillNotNormalLootFor(Player* pl, bool presentAtLooting)
|
void Loot::FillNotNormalLootFor(Player* player, bool presentAtLooting)
|
||||||
{
|
{
|
||||||
uint32 plguid = pl->GetGUIDLow();
|
uint32 plguid = player->GetGUIDLow();
|
||||||
|
|
||||||
QuestItemMap::const_iterator qmapitr = PlayerQuestItems.find(plguid);
|
QuestItemMap::const_iterator qmapitr = PlayerQuestItems.find(plguid);
|
||||||
if (qmapitr == PlayerQuestItems.end())
|
if (qmapitr == PlayerQuestItems.end())
|
||||||
FillQuestLoot(pl);
|
FillQuestLoot(player);
|
||||||
|
|
||||||
qmapitr = PlayerFFAItems.find(plguid);
|
qmapitr = PlayerFFAItems.find(plguid);
|
||||||
if (qmapitr == PlayerFFAItems.end())
|
if (qmapitr == PlayerFFAItems.end())
|
||||||
FillFFALoot(pl);
|
FillFFALoot(player);
|
||||||
|
|
||||||
qmapitr = PlayerNonQuestNonFFAConditionalItems.find(plguid);
|
qmapitr = PlayerNonQuestNonFFAConditionalItems.find(plguid);
|
||||||
if (qmapitr == PlayerNonQuestNonFFAConditionalItems.end())
|
if (qmapitr == PlayerNonQuestNonFFAConditionalItems.end())
|
||||||
FillNonQuestNonFFAConditionalLoot(pl, presentAtLooting);
|
FillNonQuestNonFFAConditionalLoot(player, presentAtLooting);
|
||||||
|
|
||||||
// if not auto-processed player will have to come and pick it up manually
|
// if not auto-processed player will have to come and pick it up manually
|
||||||
if (!presentAtLooting)
|
if (!presentAtLooting)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Process currency items
|
// Process currency items
|
||||||
uint32 max_slot = GetMaxSlotInLootFor(pl);
|
uint32 max_slot = GetMaxSlotInLootFor(player);
|
||||||
LootItem const* item = NULL;
|
LootItem const* item = NULL;
|
||||||
uint32 itemsSize = uint32(items.size());
|
uint32 itemsSize = uint32(items.size());
|
||||||
for (uint32 i = 0; i < max_slot; ++i)
|
for (uint32 i = 0; i < max_slot; ++i)
|
||||||
@@ -484,10 +484,10 @@ void Loot::FillNotNormalLootFor(Player* pl, bool presentAtLooting)
|
|||||||
else
|
else
|
||||||
item = &quest_items[i-itemsSize];
|
item = &quest_items[i-itemsSize];
|
||||||
|
|
||||||
if (!item->is_looted && item->freeforall && item->AllowedForPlayer(pl))
|
if (!item->is_looted && item->freeforall && item->AllowedForPlayer(player))
|
||||||
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
|
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item->itemid))
|
||||||
if (proto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
if (proto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||||
pl->StoreLootItem(i, this);
|
player->StoreLootItem(i, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,8 +592,8 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
|
|||||||
{
|
{
|
||||||
i_next = i;
|
i_next = i;
|
||||||
++i_next;
|
++i_next;
|
||||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
if (Player* player = ObjectAccessor::FindPlayer(*i))
|
||||||
pl->SendNotifyLootItemRemoved(lootIndex);
|
player->SendNotifyLootItemRemoved(lootIndex);
|
||||||
else
|
else
|
||||||
PlayersLooting.erase(i);
|
PlayersLooting.erase(i);
|
||||||
}
|
}
|
||||||
@@ -607,8 +607,8 @@ void Loot::NotifyMoneyRemoved()
|
|||||||
{
|
{
|
||||||
i_next = i;
|
i_next = i;
|
||||||
++i_next;
|
++i_next;
|
||||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
if (Player* player = ObjectAccessor::FindPlayer(*i))
|
||||||
pl->SendNotifyLootMoneyRemoved();
|
player->SendNotifyLootMoneyRemoved();
|
||||||
else
|
else
|
||||||
PlayersLooting.erase(i);
|
PlayersLooting.erase(i);
|
||||||
}
|
}
|
||||||
@@ -626,9 +626,9 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
|
|||||||
{
|
{
|
||||||
i_next = i;
|
i_next = i;
|
||||||
++i_next;
|
++i_next;
|
||||||
if (Player* pl = ObjectAccessor::FindPlayer(*i))
|
if (Player* player = ObjectAccessor::FindPlayer(*i))
|
||||||
{
|
{
|
||||||
QuestItemMap::const_iterator pq = PlayerQuestItems.find(pl->GetGUIDLow());
|
QuestItemMap::const_iterator pq = PlayerQuestItems.find(player->GetGUIDLow());
|
||||||
if (pq != PlayerQuestItems.end() && pq->second)
|
if (pq != PlayerQuestItems.end() && pq->second)
|
||||||
{
|
{
|
||||||
// find where/if the player has the given item in it's vector
|
// find where/if the player has the given item in it's vector
|
||||||
@@ -640,7 +640,7 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (j < pql.size())
|
if (j < pql.size())
|
||||||
pl->SendNotifyLootItemRemoved(items.size()+j);
|
player->SendNotifyLootItemRemoved(items.size()+j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -309,11 +309,11 @@ void Map::DeleteFromWorld(T* obj)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void Map::DeleteFromWorld(Player* pl)
|
void Map::DeleteFromWorld(Player* player)
|
||||||
{
|
{
|
||||||
sObjectAccessor->RemoveObject(pl);
|
sObjectAccessor->RemoveObject(player);
|
||||||
sObjectAccessor->RemoveUpdateObject(pl); //TODO: I do not know why we need this, it should be removed in ~Object anyway
|
sObjectAccessor->RemoveUpdateObject(player); //TODO: I do not know why we need this, it should be removed in ~Object anyway
|
||||||
delete pl;
|
delete player;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create NGrid so the object can be added to it
|
//Create NGrid so the object can be added to it
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ namespace Trinity
|
|||||||
return baseGain;
|
return baseGain;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32 Gain(Player* pl, Unit* u)
|
inline uint32 Gain(Player* player, Unit* u)
|
||||||
{
|
{
|
||||||
uint32 gain;
|
uint32 gain;
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ namespace Trinity
|
|||||||
gain = 0;
|
gain = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gain = BaseGain(pl->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
|
gain = BaseGain(player->getLevel(), u->getLevel(), GetContentLevelsForMapAndZone(u->GetMapId(), u->GetZoneId()));
|
||||||
|
|
||||||
if (gain != 0 && u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite())
|
if (gain != 0 && u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isElite())
|
||||||
{
|
{
|
||||||
@@ -181,7 +181,7 @@ namespace Trinity
|
|||||||
gain = uint32(gain * sWorld->getRate(RATE_XP_KILL));
|
gain = uint32(gain * sWorld->getRate(RATE_XP_KILL));
|
||||||
}
|
}
|
||||||
|
|
||||||
sScriptMgr->OnGainCalculation(gain, pl, u);
|
sScriptMgr->OnGainCalculation(gain, player, u);
|
||||||
return gain;
|
return gain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||||||
recv_data >> buyout;
|
recv_data >> buyout;
|
||||||
recv_data >> etime;
|
recv_data >> etime;
|
||||||
|
|
||||||
Player* pl = GetPlayer();
|
Player* player = GetPlayer();
|
||||||
|
|
||||||
if (!item || !bid || !etime)
|
if (!item || !bid || !etime)
|
||||||
return; //check for cheaters
|
return; //check for cheaters
|
||||||
@@ -162,11 +162,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||||||
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
|
if (GetPlayer()->HasUnitState(UNIT_STAT_DIED))
|
||||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
||||||
Item* it = pl->GetItemByGuid(item);
|
Item* it = player->GetItemByGuid(item);
|
||||||
//do not allow to sell already auctioned items
|
//do not allow to sell already auctioned items
|
||||||
if (sAuctionMgr->GetAItem(GUID_LOPART(item)))
|
if (sAuctionMgr->GetAItem(GUID_LOPART(item)))
|
||||||
{
|
{
|
||||||
sLog->outError("AuctionError, player %s is sending item id: %u, but item is already in another auction", pl->GetName(), GUID_LOPART(item));
|
sLog->outError("AuctionError, player %s is sending item id: %u, but item is already in another auction", player->GetName(), GUID_LOPART(item));
|
||||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
|
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||||||
|
|
||||||
//we have to take deposit :
|
//we have to take deposit :
|
||||||
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, it, count);
|
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, it, count);
|
||||||
if (!pl->HasEnoughMoney(deposit))
|
if (!player->HasEnoughMoney(deposit))
|
||||||
{
|
{
|
||||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
|
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
|
||||||
return;
|
return;
|
||||||
@@ -211,7 +211,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||||||
GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), count);
|
GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), count);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl->ModifyMoney(-int32(deposit));
|
player->ModifyMoney(-int32(deposit));
|
||||||
|
|
||||||
uint32 auction_time = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME));
|
uint32 auction_time = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME));
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||||||
AH->auctioneer = GUID_LOPART(auctioneer);
|
AH->auctioneer = GUID_LOPART(auctioneer);
|
||||||
AH->item_guidlow = GUID_LOPART(item);
|
AH->item_guidlow = GUID_LOPART(item);
|
||||||
AH->item_template = it->GetEntry();
|
AH->item_template = it->GetEntry();
|
||||||
AH->owner = pl->GetGUIDLow();
|
AH->owner = player->GetGUIDLow();
|
||||||
AH->startbid = bid;
|
AH->startbid = bid;
|
||||||
AH->bidder = 0;
|
AH->bidder = 0;
|
||||||
AH->bid = 0;
|
AH->bid = 0;
|
||||||
@@ -236,13 +236,13 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
|
|||||||
sAuctionMgr->AddAItem(it);
|
sAuctionMgr->AddAItem(it);
|
||||||
auctionHouse->AddAuction(AH);
|
auctionHouse->AddAuction(AH);
|
||||||
|
|
||||||
pl->MoveItemFromInventory(it->GetBagSlot(), it->GetSlot(), true);
|
player->MoveItemFromInventory(it->GetBagSlot(), it->GetSlot(), true);
|
||||||
|
|
||||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||||
it->DeleteFromInventoryDB(trans);
|
it->DeleteFromInventoryDB(trans);
|
||||||
it->SaveToDB(trans); // recursive and not have transaction guard into self, not in inventiory and can be save standalone
|
it->SaveToDB(trans); // recursive and not have transaction guard into self, not in inventiory and can be save standalone
|
||||||
AH->SaveToDB(trans);
|
AH->SaveToDB(trans);
|
||||||
pl->SaveInventoryAndGoldToDB(trans);
|
player->SaveInventoryAndGoldToDB(trans);
|
||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
|
|
||||||
SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
|
SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
|
||||||
@@ -276,9 +276,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
|||||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||||
|
|
||||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||||
Player* pl = GetPlayer();
|
Player* player = GetPlayer();
|
||||||
|
|
||||||
if (!auction || auction->owner == pl->GetGUIDLow())
|
if (!auction || auction->owner == player->GetGUIDLow())
|
||||||
{
|
{
|
||||||
//you cannot bid your own auction:
|
//you cannot bid your own auction:
|
||||||
SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
|
SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
|
||||||
@@ -287,7 +287,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
|||||||
|
|
||||||
// impossible have online own another character (use this for speedup check in case online owner)
|
// impossible have online own another character (use this for speedup check in case online owner)
|
||||||
Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
|
Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
|
||||||
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == pl->GetSession()->GetAccountId())
|
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId())
|
||||||
{
|
{
|
||||||
//you cannot bid your another character auction:
|
//you cannot bid your another character auction:
|
||||||
SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
|
SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
|
||||||
@@ -306,7 +306,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pl->HasEnoughMoney(price))
|
if (!player->HasEnoughMoney(price))
|
||||||
{
|
{
|
||||||
//you don't have enought money!, client tests!
|
//you don't have enought money!, client tests!
|
||||||
//SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
|
//SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
|
||||||
@@ -319,19 +319,19 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
|||||||
{
|
{
|
||||||
if (auction->bidder > 0)
|
if (auction->bidder > 0)
|
||||||
{
|
{
|
||||||
if (auction->bidder == pl->GetGUIDLow())
|
if (auction->bidder == player->GetGUIDLow())
|
||||||
pl->ModifyMoney(-int32(price - auction->bid));
|
player->ModifyMoney(-int32(price - auction->bid));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// mail to last bidder and return money
|
// mail to last bidder and return money
|
||||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, price, GetPlayer(), trans);
|
sAuctionMgr->SendAuctionOutbiddedMail(auction, price, GetPlayer(), trans);
|
||||||
pl->ModifyMoney(-int32(price));
|
player->ModifyMoney(-int32(price));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pl->ModifyMoney(-int32(price));
|
player->ModifyMoney(-int32(price));
|
||||||
|
|
||||||
auction->bidder = pl->GetGUIDLow();
|
auction->bidder = player->GetGUIDLow();
|
||||||
auction->bid = price;
|
auction->bid = price;
|
||||||
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
|
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
|
||||||
|
|
||||||
@@ -342,15 +342,15 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//buyout:
|
//buyout:
|
||||||
if (pl->GetGUIDLow() == auction->bidder)
|
if (player->GetGUIDLow() == auction->bidder)
|
||||||
pl->ModifyMoney(-int32(auction->buyout - auction->bid));
|
player->ModifyMoney(-int32(auction->buyout - auction->bid));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pl->ModifyMoney(-int32(auction->buyout));
|
player->ModifyMoney(-int32(auction->buyout));
|
||||||
if (auction->bidder) //buyout for bidded auction ..
|
if (auction->bidder) //buyout for bidded auction ..
|
||||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, GetPlayer(), trans);
|
sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, GetPlayer(), trans);
|
||||||
}
|
}
|
||||||
auction->bidder = pl->GetGUIDLow();
|
auction->bidder = player->GetGUIDLow();
|
||||||
auction->bid = auction->buyout;
|
auction->bid = auction->buyout;
|
||||||
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
|
GetPlayer()->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data)
|
|||||||
sAuctionMgr->RemoveAItem(auction->item_guidlow);
|
sAuctionMgr->RemoveAItem(auction->item_guidlow);
|
||||||
auctionHouse->RemoveAuction(auction, item_template);
|
auctionHouse->RemoveAuction(auction, item_template);
|
||||||
}
|
}
|
||||||
pl->SaveInventoryAndGoldToDB(trans);
|
player->SaveInventoryAndGoldToDB(trans);
|
||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,10 +394,10 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
|||||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||||
|
|
||||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||||
Player* pl = GetPlayer();
|
Player* player = GetPlayer();
|
||||||
|
|
||||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||||
if (auction && auction->owner == pl->GetGUIDLow())
|
if (auction && auction->owner == player->GetGUIDLow())
|
||||||
{
|
{
|
||||||
Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
|
Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
|
||||||
if (pItem)
|
if (pItem)
|
||||||
@@ -405,11 +405,11 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
|||||||
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
|
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
|
||||||
{
|
{
|
||||||
uint32 auctionCut = auction->GetAuctionCut();
|
uint32 auctionCut = auction->GetAuctionCut();
|
||||||
if (!pl->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
if (!player->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
||||||
return;
|
return;
|
||||||
//some auctionBidderNotification would be needed, but don't know that parts..
|
//some auctionBidderNotification would be needed, but don't know that parts..
|
||||||
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
|
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
|
||||||
pl->ModifyMoney(-int32(auctionCut));
|
player->ModifyMoney(-int32(auctionCut));
|
||||||
}
|
}
|
||||||
// Return the item by mail
|
// Return the item by mail
|
||||||
std::ostringstream msgAuctionCanceledOwner;
|
std::ostringstream msgAuctionCanceledOwner;
|
||||||
@@ -418,7 +418,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
|||||||
// item will deleted or added to received mail list
|
// item will deleted or added to received mail list
|
||||||
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
MailDraft(msgAuctionCanceledOwner.str(), "") // TODO: fix body
|
||||||
.AddItem(pItem)
|
.AddItem(pItem)
|
||||||
.SendMailTo(trans, pl, auction, MAIL_CHECK_MASK_COPIED);
|
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -431,7 +431,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
|||||||
{
|
{
|
||||||
SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
|
SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
|
||||||
//this code isn't possible ... maybe there should be assert
|
//this code isn't possible ... maybe there should be assert
|
||||||
sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", pl->GetGUIDLow(), auctionId);
|
sLog->outError("CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is NULL", player->GetGUIDLow(), auctionId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +440,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data)
|
|||||||
|
|
||||||
// Now remove the auction
|
// Now remove the auction
|
||||||
|
|
||||||
pl->SaveInventoryAndGoldToDB(trans);
|
player->SaveInventoryAndGoldToDB(trans);
|
||||||
auction->DeleteFromDB(trans);
|
auction->DeleteFromDB(trans);
|
||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
|||||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||||
|
|
||||||
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
|
WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4));
|
||||||
Player* pl = GetPlayer();
|
Player* player = GetPlayer();
|
||||||
data << (uint32) 0; //add 0 as count
|
data << (uint32) 0; //add 0 as count
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
uint32 totalcount = 0;
|
uint32 totalcount = 0;
|
||||||
@@ -496,7 +496,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auctionHouse->BuildListBidderItems(data, pl, count, totalcount);
|
auctionHouse->BuildListBidderItems(data, player, count, totalcount);
|
||||||
data.put<uint32>(0, count); // add count to placeholder
|
data.put<uint32>(0, count); // add count to placeholder
|
||||||
data << totalcount;
|
data << totalcount;
|
||||||
data << (uint32)300; //unk 2.3.0
|
data << (uint32)300; //unk 2.3.0
|
||||||
|
|||||||
@@ -495,8 +495,8 @@ namespace Trinity
|
|||||||
class EmoteChatBuilder
|
class EmoteChatBuilder
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EmoteChatBuilder(Player const& pl, uint32 text_emote, uint32 emote_num, Unit const* target)
|
EmoteChatBuilder(Player const& player, uint32 text_emote, uint32 emote_num, Unit const* target)
|
||||||
: i_player(pl), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {}
|
: i_player(player), i_text_emote(text_emote), i_emote_num(emote_num), i_target(target) {}
|
||||||
|
|
||||||
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
void operator()(WorldPacket& data, LocaleConstant loc_idx)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||||
{
|
{
|
||||||
uint64 guid;
|
uint64 guid;
|
||||||
Player* pl;
|
Player* player;
|
||||||
Player* plTarget;
|
Player* plTarget;
|
||||||
|
|
||||||
recvPacket >> guid;
|
recvPacket >> guid;
|
||||||
@@ -35,21 +35,21 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
|||||||
if (!GetPlayer()->duel) // ignore accept from duel-sender
|
if (!GetPlayer()->duel) // ignore accept from duel-sender
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pl = GetPlayer();
|
player = GetPlayer();
|
||||||
plTarget = pl->duel->opponent;
|
plTarget = player->duel->opponent;
|
||||||
|
|
||||||
if (pl == pl->duel->initiator || !plTarget || pl == plTarget || pl->duel->startTime != 0 || plTarget->duel->startTime != 0)
|
if (player == player->duel->initiator || !plTarget || player == plTarget || player->duel->startTime != 0 || plTarget->duel->startTime != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED");
|
//sLog->outDebug(LOG_FILTER_PACKETIO, "WORLD: Received CMSG_DUEL_ACCEPTED");
|
||||||
sLog->outStaticDebug("Player 1 is: %u (%s)", pl->GetGUIDLow(), pl->GetName());
|
sLog->outStaticDebug("Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName());
|
||||||
sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());
|
sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName());
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
pl->duel->startTimer = now;
|
player->duel->startTimer = now;
|
||||||
plTarget->duel->startTimer = now;
|
plTarget->duel->startTimer = now;
|
||||||
|
|
||||||
pl->SendDuelCountdown(3000);
|
player->SendDuelCountdown(3000);
|
||||||
plTarget->SendDuelCountdown(3000);
|
plTarget->SendDuelCountdown(3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
if (receiver.empty())
|
if (receiver.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* player = _player;
|
||||||
|
|
||||||
if (pl->getLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
|
if (player->getLevel() < sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ))
|
||||||
{
|
{
|
||||||
SendNotification(GetTrinityString(LANG_MAIL_SENDER_REQ), sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ));
|
SendNotification(GetTrinityString(LANG_MAIL_SENDER_REQ), sWorld->getIntConfig(CONFIG_MAIL_LEVEL_REQ));
|
||||||
return;
|
return;
|
||||||
@@ -90,16 +90,16 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
if (!rc)
|
if (!rc)
|
||||||
{
|
{
|
||||||
sLog->outDetail("Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
|
sLog->outDetail("Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
|
||||||
pl->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sLog->outDetail("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", pl->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
sLog->outDetail("Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||||
|
|
||||||
if (pl->GetGUID() == rc)
|
if (player->GetGUID() == rc)
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANNOT_SEND_TO_SELF);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANNOT_SEND_TO_SELF);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,9 +107,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
|
|
||||||
uint32 reqmoney = cost + money;
|
uint32 reqmoney = cost + money;
|
||||||
|
|
||||||
if (!pl->HasEnoughMoney(reqmoney))
|
if (!player->HasEnoughMoney(reqmoney))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,14 +142,14 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
|
//do not allow to have more than 100 mails in mailbox.. mails count is in opcode uint8!!! - so max can be 255..
|
||||||
if (mails_count > 100)
|
if (mails_count > 100)
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_CAP_REACHED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// test the receiver's Faction... or all items are account bound
|
// test the receiver's Faction... or all items are account bound
|
||||||
bool accountBound = items_count ? true : false;
|
bool accountBound = items_count ? true : false;
|
||||||
for (uint8 i = 0; i < items_count; ++i)
|
for (uint8 i = 0; i < items_count; ++i)
|
||||||
{
|
{
|
||||||
Item* item = pl->GetItemByGuid(itemGUIDs[i]);
|
Item* item = player->GetItemByGuid(itemGUIDs[i]);
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
ItemTemplate const* itemProto = item->GetTemplate();
|
ItemTemplate const* itemProto = item->GetTemplate();
|
||||||
@@ -161,9 +161,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity()))
|
if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,56 +183,56 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
{
|
{
|
||||||
if (!itemGUIDs[i])
|
if (!itemGUIDs[i])
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* item = pl->GetItemByGuid(itemGUIDs[i]);
|
Item* item = player->GetItemByGuid(itemGUIDs[i]);
|
||||||
|
|
||||||
// prevent sending bag with items (cheat: can be placed in bag after adding equipped empty bag to mail)
|
// prevent sending bag with items (cheat: can be placed in bag after adding equipped empty bag to mail)
|
||||||
if (!item)
|
if (!item)
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_MAIL_ATTACHMENT_INVALID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!item->CanBeTraded(true))
|
if (!item->CanBeTraded(true))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->IsBoundAccountWide() && item->IsSoulBound() && pl->GetSession()->GetAccountId() != rc_account)
|
if (item->IsBoundAccountWide() && item->IsSoulBound() && player->GetSession()->GetAccountId() != rc_account)
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_ARTEFACTS_ONLY_FOR_OWN_CHARACTERS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION))
|
if (item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_MAIL_BOUND_ITEM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (COD && item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
if (COD && item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_WRAPPED))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANT_SEND_WRAPPED_COD);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_CANT_SEND_WRAPPED_COD);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->IsNotEmptyBag())
|
if (item->IsNotEmptyBag())
|
||||||
{
|
{
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_EQUIP_ERROR, EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
items[i] = item;
|
items[i] = item;
|
||||||
}
|
}
|
||||||
|
|
||||||
pl->SendMailResult(0, MAIL_SEND, MAIL_OK);
|
player->SendMailResult(0, MAIL_SEND, MAIL_OK);
|
||||||
|
|
||||||
pl->ModifyMoney(-int32(reqmoney));
|
player->ModifyMoney(-int32(reqmoney));
|
||||||
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
|
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
|
||||||
|
|
||||||
bool needItemDelay = false;
|
bool needItemDelay = false;
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
|
item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable
|
||||||
pl->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true);
|
player->MoveItemFromInventory(items[i]->GetBagSlot(), item->GetSlot(), true);
|
||||||
|
|
||||||
item->DeleteFromInventoryDB(trans); // deletes item from character's inventory
|
item->DeleteFromInventoryDB(trans); // deletes item from character's inventory
|
||||||
item->SetOwnerGUID(rc);
|
item->SetOwnerGUID(rc);
|
||||||
@@ -264,7 +264,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if item send to character at another account, then apply item delivery delay
|
// if item send to character at another account, then apply item delivery delay
|
||||||
needItemDelay = pl->GetSession()->GetAccountId() != rc_account;
|
needItemDelay = player->GetSession()->GetAccountId() != rc_account;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE))
|
||||||
@@ -281,9 +281,9 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data)
|
|||||||
draft
|
draft
|
||||||
.AddMoney(money)
|
.AddMoney(money)
|
||||||
.AddCOD(COD)
|
.AddCOD(COD)
|
||||||
.SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(pl), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
.SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||||
|
|
||||||
pl->SaveInventoryAndGoldToDB(trans);
|
player->SaveInventoryAndGoldToDB(trans);
|
||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,14 +298,14 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data)
|
|||||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* player = _player;
|
||||||
Mail* m = pl->GetMail(mailId);
|
Mail* m = player->GetMail(mailId);
|
||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
if (pl->unReadMails)
|
if (player->unReadMails)
|
||||||
--pl->unReadMails;
|
--player->unReadMails;
|
||||||
m->checked = m->checked | MAIL_CHECK_MASK_READ;
|
m->checked = m->checked | MAIL_CHECK_MASK_READ;
|
||||||
pl->m_mailsUpdated = true;
|
player->m_mailsUpdated = true;
|
||||||
m->state = MAIL_STATE_CHANGED;
|
m->state = MAIL_STATE_CHANGED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,20 +323,20 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Mail* m = _player->GetMail(mailId);
|
Mail* m = _player->GetMail(mailId);
|
||||||
Player* pl = _player;
|
Player* player = _player;
|
||||||
pl->m_mailsUpdated = true;
|
player->m_mailsUpdated = true;
|
||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
// delete shouldn't show up for COD mails
|
// delete shouldn't show up for COD mails
|
||||||
if (m->COD)
|
if (m->COD)
|
||||||
{
|
{
|
||||||
pl->SendMailResult(mailId, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR);
|
player->SendMailResult(mailId, MAIL_DELETED, MAIL_ERR_INTERNAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m->state = MAIL_STATE_DELETED;
|
m->state = MAIL_STATE_DELETED;
|
||||||
}
|
}
|
||||||
pl->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
|
player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
||||||
@@ -350,11 +350,11 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
|||||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* player = _player;
|
||||||
Mail* m = pl->GetMail(mailId);
|
Mail* m = player->GetMail(mailId);
|
||||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//we can return mail now
|
//we can return mail now
|
||||||
@@ -362,7 +362,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
|||||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||||
trans->PAppend("DELETE FROM mail WHERE id = '%u'", mailId); // needed?
|
trans->PAppend("DELETE FROM mail WHERE id = '%u'", mailId); // needed?
|
||||||
trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mailId);
|
trans->PAppend("DELETE FROM mail_items WHERE mail_id = '%u'", mailId);
|
||||||
pl->RemoveMail(mailId);
|
player->RemoveMail(mailId);
|
||||||
|
|
||||||
// only return mail if the player exists (and delete if not existing)
|
// only return mail if the player exists (and delete if not existing)
|
||||||
if (m->messageType == MAIL_NORMAL && m->sender)
|
if (m->messageType == MAIL_NORMAL && m->sender)
|
||||||
@@ -375,7 +375,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
|||||||
{
|
{
|
||||||
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||||
{
|
{
|
||||||
Item* item = pl->GetMItem(itr2->item_guid);
|
Item* item = player->GetMItem(itr2->item_guid);
|
||||||
if (item)
|
if (item)
|
||||||
draft.AddItem(item);
|
draft.AddItem(item);
|
||||||
else
|
else
|
||||||
@@ -383,7 +383,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
|||||||
//WTF?
|
//WTF?
|
||||||
}
|
}
|
||||||
|
|
||||||
pl->RemoveMItem(itr2->item_guid);
|
player->RemoveMItem(itr2->item_guid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
draft.AddMoney(m->money).SendReturnToSender(GetAccountId(), m->receiver, m->sender, trans);
|
draft.AddMoney(m->money).SendReturnToSender(GetAccountId(), m->receiver, m->sender, trans);
|
||||||
@@ -392,7 +392,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data)
|
|||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
|
|
||||||
delete m; //we can deallocate old mail
|
delete m; //we can deallocate old mail
|
||||||
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK);
|
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
//called when player takes item attached in mail
|
//called when player takes item attached in mail
|
||||||
@@ -408,23 +408,23 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
|
|||||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* player = _player;
|
||||||
|
|
||||||
Mail* m = pl->GetMail(mailId);
|
Mail* m = player->GetMail(mailId);
|
||||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent cheating with skip client money check
|
// prevent cheating with skip client money check
|
||||||
if (!pl->HasEnoughMoney(m->COD))
|
if (!player->HasEnoughMoney(m->COD))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* it = pl->GetMItem(itemId);
|
Item* it = player->GetMItem(itemId);
|
||||||
|
|
||||||
ItemPosCountVec dest;
|
ItemPosCountVec dest;
|
||||||
uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false);
|
uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false);
|
||||||
@@ -471,24 +471,24 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data)
|
|||||||
.SendMailTo(trans, MailReceiver(receive, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
|
.SendMailTo(trans, MailReceiver(receive, m->sender), MailSender(MAIL_NORMAL, m->receiver), MAIL_CHECK_MASK_COD_PAYMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl->ModifyMoney(-int32(m->COD));
|
player->ModifyMoney(-int32(m->COD));
|
||||||
}
|
}
|
||||||
m->COD = 0;
|
m->COD = 0;
|
||||||
m->state = MAIL_STATE_CHANGED;
|
m->state = MAIL_STATE_CHANGED;
|
||||||
pl->m_mailsUpdated = true;
|
player->m_mailsUpdated = true;
|
||||||
pl->RemoveMItem(it->GetGUIDLow());
|
player->RemoveMItem(it->GetGUIDLow());
|
||||||
|
|
||||||
uint32 count = it->GetCount(); // save counts before store and possible merge with deleting
|
uint32 count = it->GetCount(); // save counts before store and possible merge with deleting
|
||||||
pl->MoveItemToInventory(dest, it, true);
|
player->MoveItemToInventory(dest, it, true);
|
||||||
|
|
||||||
pl->SaveInventoryAndGoldToDB(trans);
|
player->SaveInventoryAndGoldToDB(trans);
|
||||||
pl->_SaveMail(trans);
|
player->_SaveMail(trans);
|
||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
|
|
||||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_OK, 0, itemId, count);
|
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_OK, 0, itemId, count);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
|
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
|
void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
|
||||||
@@ -501,26 +501,26 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data)
|
|||||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* player = _player;
|
||||||
|
|
||||||
Mail* m = pl->GetMail(mailId);
|
Mail* m = player->GetMail(mailId);
|
||||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pl->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
|
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_OK);
|
||||||
|
|
||||||
pl->ModifyMoney(m->money);
|
player->ModifyMoney(m->money);
|
||||||
m->money = 0;
|
m->money = 0;
|
||||||
m->state = MAIL_STATE_CHANGED;
|
m->state = MAIL_STATE_CHANGED;
|
||||||
pl->m_mailsUpdated = true;
|
player->m_mailsUpdated = true;
|
||||||
|
|
||||||
// save money and mail to prevent cheating
|
// save money and mail to prevent cheating
|
||||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||||
pl->SaveGoldToDB(trans);
|
player->SaveGoldToDB(trans);
|
||||||
pl->_SaveMail(trans);
|
player->_SaveMail(trans);
|
||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -533,11 +533,11 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
|
|||||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* player = _player;
|
||||||
|
|
||||||
//load players mails, and mailed items
|
//load players mails, and mailed items
|
||||||
if (!pl->m_mailsLoaded)
|
if (!player->m_mailsLoaded)
|
||||||
pl ->_LoadMail();
|
player ->_LoadMail();
|
||||||
|
|
||||||
// client can't work with packets > max int16 value
|
// client can't work with packets > max int16 value
|
||||||
const uint32 maxPacketSize = 32767;
|
const uint32 maxPacketSize = 32767;
|
||||||
@@ -550,7 +550,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
|
|||||||
data << uint8(0); // mail's count
|
data << uint8(0); // mail's count
|
||||||
time_t cur_time = time(NULL);
|
time_t cur_time = time(NULL);
|
||||||
|
|
||||||
for (PlayerMails::iterator itr = pl->GetMailBegin(); itr != pl->GetMailEnd(); ++itr)
|
for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr)
|
||||||
{
|
{
|
||||||
// packet send mail count as uint8, prevent overflow
|
// packet send mail count as uint8, prevent overflow
|
||||||
if (mailsCount >= 254)
|
if (mailsCount >= 254)
|
||||||
@@ -605,7 +605,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data)
|
|||||||
|
|
||||||
for (uint8 i = 0; i < item_count; ++i)
|
for (uint8 i = 0; i < item_count; ++i)
|
||||||
{
|
{
|
||||||
Item* item = pl->GetMItem((*itr)->items[i].item_guid);
|
Item* item = player->GetMItem((*itr)->items[i].item_guid);
|
||||||
// item index (0-6?)
|
// item index (0-6?)
|
||||||
data << uint8(i);
|
data << uint8(i);
|
||||||
// item guid low?
|
// item guid low?
|
||||||
@@ -658,17 +658,17 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
|
|||||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* player = _player;
|
||||||
|
|
||||||
Mail* m = pl->GetMail(mailId);
|
Mail* m = player->GetMail(mailId);
|
||||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||||
{
|
{
|
||||||
pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* bodyItem = new Item; // This is not bag and then can be used new Item.
|
Item* bodyItem = new Item; // This is not bag and then can be used new Item.
|
||||||
if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, pl))
|
if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, player))
|
||||||
{
|
{
|
||||||
delete bodyItem;
|
delete bodyItem;
|
||||||
return;
|
return;
|
||||||
@@ -680,7 +680,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
|
|||||||
MailTemplateEntry const* mailTemplateEntry = sMailTemplateStore.LookupEntry(m->mailTemplateId);
|
MailTemplateEntry const* mailTemplateEntry = sMailTemplateStore.LookupEntry(m->mailTemplateId);
|
||||||
if (!mailTemplateEntry)
|
if (!mailTemplateEntry)
|
||||||
{
|
{
|
||||||
pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -700,14 +700,14 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data)
|
|||||||
{
|
{
|
||||||
m->checked = m->checked | MAIL_CHECK_MASK_COPIED;
|
m->checked = m->checked | MAIL_CHECK_MASK_COPIED;
|
||||||
m->state = MAIL_STATE_CHANGED;
|
m->state = MAIL_STATE_CHANGED;
|
||||||
pl->m_mailsUpdated = true;
|
player->m_mailsUpdated = true;
|
||||||
|
|
||||||
pl->StoreItem(dest, bodyItem, true);
|
player->StoreItem(dest, bodyItem, true);
|
||||||
pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_OK);
|
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_OK);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pl->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
|
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_EQUIP_ERROR, msg);
|
||||||
delete bodyItem;
|
delete bodyItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data)
|
|||||||
if (plMover->isAlive())
|
if (plMover->isAlive())
|
||||||
{
|
{
|
||||||
plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
|
plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth());
|
||||||
// pl can be alive if GM/etc
|
// player can be alive if GM/etc
|
||||||
// change the death state to CORPSE to prevent the death timer from
|
// change the death state to CORPSE to prevent the death timer from
|
||||||
// starting in the next player update
|
// starting in the next player update
|
||||||
if (!plMover->isAlive())
|
if (!plMover->isAlive())
|
||||||
|
|||||||
@@ -379,8 +379,8 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data)
|
|||||||
|
|
||||||
int loc_idx = GetSessionDbLocaleIndex();
|
int loc_idx = GetSessionDbLocaleIndex();
|
||||||
if (loc_idx >= 0)
|
if (loc_idx >= 0)
|
||||||
if (PageTextLocale const* pl = sObjectMgr->GetPageTextLocale(pageID))
|
if (PageTextLocale const* player = sObjectMgr->GetPageTextLocale(pageID))
|
||||||
ObjectMgr::GetLocaleString(pl->Text, loc_idx, Text);
|
ObjectMgr::GetLocaleString(player->Text, loc_idx, Text);
|
||||||
|
|
||||||
data << Text;
|
data << Text;
|
||||||
data << uint32(pageText->NextPage);
|
data << uint32(pageText->NextPage);
|
||||||
|
|||||||
@@ -129,16 +129,16 @@ void WorldSession::HandleEnterPlayerVehicle(WorldPacket &data)
|
|||||||
uint64 guid;
|
uint64 guid;
|
||||||
data >> guid;
|
data >> guid;
|
||||||
|
|
||||||
if (Player* pl = ObjectAccessor::FindPlayer(guid))
|
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||||
{
|
{
|
||||||
if (!pl->GetVehicleKit())
|
if (!player->GetVehicleKit())
|
||||||
return;
|
return;
|
||||||
if (!pl->IsInRaidWith(_player))
|
if (!player->IsInRaidWith(_player))
|
||||||
return;
|
return;
|
||||||
if (!pl->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
|
if (!player->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_player->EnterVehicle(pl);
|
_player->EnterVehicle(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1569,9 +1569,9 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
|
|||||||
target->RemoveAurasDueToSpell(spellId2);
|
target->RemoveAurasDueToSpell(spellId2);
|
||||||
|
|
||||||
// Improved Barkskin - apply/remove armor bonus due to shapeshift
|
// Improved Barkskin - apply/remove armor bonus due to shapeshift
|
||||||
if (Player* pl=target->ToPlayer())
|
if (Player* player=target->ToPlayer())
|
||||||
{
|
{
|
||||||
if (pl->HasSpell(63410) || pl->HasSpell(63411))
|
if (player->HasSpell(63410) || player->HasSpell(63411))
|
||||||
{
|
{
|
||||||
target->RemoveAurasDueToSpell(66530);
|
target->RemoveAurasDueToSpell(66530);
|
||||||
target->CastSpell(target, 66530, true);
|
target->CastSpell(target, 66530, true);
|
||||||
|
|||||||
@@ -4398,8 +4398,8 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
|||||||
|
|
||||||
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
|
if (pGameObj->GetGoType() == GAMEOBJECT_TYPE_FLAGDROP && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
Player* pl = m_caster->ToPlayer();
|
Player* player = m_caster->ToPlayer();
|
||||||
Battleground* bg = pl->GetBattleground();
|
Battleground* bg = player->GetBattleground();
|
||||||
|
|
||||||
switch (pGameObj->GetMapId())
|
switch (pGameObj->GetMapId())
|
||||||
{
|
{
|
||||||
@@ -4409,7 +4409,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex)
|
|||||||
{
|
{
|
||||||
uint32 team = ALLIANCE;
|
uint32 team = ALLIANCE;
|
||||||
|
|
||||||
if (pl->GetTeam() == team)
|
if (player->GetTeam() == team)
|
||||||
team = HORDE;
|
team = HORDE;
|
||||||
|
|
||||||
((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team);
|
((BattlegroundWS*)bg)->SetDroppedFlagGUID(pGameObj->GetGUID(), team);
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ SpellMgr::~SpellMgr()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
|
/// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc
|
||||||
bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* player, bool msg)
|
||||||
{
|
{
|
||||||
// not exist
|
// not exist
|
||||||
if (!spellInfo)
|
if (!spellInfo)
|
||||||
@@ -378,8 +378,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
|||||||
{
|
{
|
||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
|
ChatHandler(player).PSendSysMessage("Craft spell %u not have create item entry.", spellInfo->Id);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id);
|
sLog->outErrorDb("Craft spell %u not have create item entry.", spellInfo->Id);
|
||||||
}
|
}
|
||||||
@@ -392,8 +392,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
|||||||
{
|
{
|
||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
|
ChatHandler(player).PSendSysMessage("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
|
sLog->outErrorDb("Craft spell %u create not-exist in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Effects[i].ItemType);
|
||||||
}
|
}
|
||||||
@@ -406,12 +406,12 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
|||||||
case SPELL_EFFECT_LEARN_SPELL:
|
case SPELL_EFFECT_LEARN_SPELL:
|
||||||
{
|
{
|
||||||
SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell);
|
SpellInfo const* spellInfo2 = sSpellMgr->GetSpellInfo(spellInfo->Effects[i].TriggerSpell);
|
||||||
if (!IsSpellValid(spellInfo2, pl, msg))
|
if (!IsSpellValid(spellInfo2, player, msg))
|
||||||
{
|
{
|
||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
|
ChatHandler(player).PSendSysMessage("Spell %u learn to broken spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
|
sLog->outErrorDb("Spell %u learn to invalid spell %u, and then...", spellInfo->Id, spellInfo->Effects[i].TriggerSpell);
|
||||||
}
|
}
|
||||||
@@ -430,8 +430,8 @@ bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg)
|
|||||||
{
|
{
|
||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
if (pl)
|
if (player)
|
||||||
ChatHandler(pl).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
|
ChatHandler(player).PSendSysMessage("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
|
||||||
else
|
else
|
||||||
sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
|
sLog->outErrorDb("Craft spell %u have not-exist reagent in DB item (Entry: %u) and then...", spellInfo->Id, spellInfo->Reagent[j]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ class SpellMgr
|
|||||||
// Accessors (const or static functions)
|
// Accessors (const or static functions)
|
||||||
public:
|
public:
|
||||||
// Spell correctess for client using
|
// Spell correctess for client using
|
||||||
static bool IsSpellValid(SpellInfo const* spellInfo, Player* pl = NULL, bool msg = true);
|
static bool IsSpellValid(SpellInfo const* spellInfo, Player* player = NULL, bool msg = true);
|
||||||
|
|
||||||
// Spell difficulty
|
// Spell difficulty
|
||||||
uint32 GetSpellDifficultyId(uint32 spellId) const;
|
uint32 GetSpellDifficultyId(uint32 spellId) const;
|
||||||
|
|||||||
@@ -228,38 +228,38 @@ public:
|
|||||||
|
|
||||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
{
|
{
|
||||||
Player* pl = itr->getSource();
|
Player* player = itr->getSource();
|
||||||
|
|
||||||
if (!pl || !pl->GetSession())
|
if (!player || !player->GetSession())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(pl, 0))
|
if (handler->HasLowerSecurity(player, 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string plNameLink = handler->GetNameLink(pl);
|
std::string plNameLink = handler->GetNameLink(player);
|
||||||
|
|
||||||
if (pl->IsBeingTeleported())
|
if (player->IsBeingTeleported())
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str());
|
handler->PSendSysMessage(LANG_TELEPORTING_TO, plNameLink.c_str(), "", tele->name.c_str());
|
||||||
if (handler->needReportToTarget(pl))
|
if (handler->needReportToTarget(player))
|
||||||
(ChatHandler(pl)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
(ChatHandler(player)).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
||||||
|
|
||||||
// stop flight if need
|
// stop flight if need
|
||||||
if (pl->isInFlight())
|
if (player->isInFlight())
|
||||||
{
|
{
|
||||||
pl->GetMotionMaster()->MovementExpired();
|
player->GetMotionMaster()->MovementExpired();
|
||||||
pl->CleanupAfterTaxiFlight();
|
player->CleanupAfterTaxiFlight();
|
||||||
}
|
}
|
||||||
// save only in non-flight case
|
// save only in non-flight case
|
||||||
else
|
else
|
||||||
pl->SaveRecallPosition();
|
player->SaveRecallPosition();
|
||||||
|
|
||||||
pl->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
player->TeleportTo(tele->mapId, tele->position_x, tele->position_y, tele->position_z, tele->orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ public:
|
|||||||
|
|
||||||
void EnterCombat(Unit* /*who*/) {}
|
void EnterCombat(Unit* /*who*/) {}
|
||||||
|
|
||||||
void BeginEvent(Player* pl)
|
void BeginEvent(Player* player)
|
||||||
{
|
{
|
||||||
if (!instance)
|
if (!instance)
|
||||||
return;
|
return;
|
||||||
@@ -662,7 +662,7 @@ public:
|
|||||||
me->CombatStart(Shade);
|
me->CombatStart(Shade);
|
||||||
Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
|
Shade->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
|
||||||
Shade->SetTarget(me->GetGUID());
|
Shade->SetTarget(me->GetGUID());
|
||||||
if (pl) Shade->AddThreat(pl, 1.0f);
|
if (player) Shade->AddThreat(player, 1.0f);
|
||||||
DoZoneInCombat(Shade);
|
DoZoneInCombat(Shade);
|
||||||
EventBegun = true;
|
EventBegun = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user