mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
Various Cleanups (game L-M)
This commit is contained in:
parent
2bd41afb3e
commit
8d0c106aa4
29 changed files with 2201 additions and 2163 deletions
|
|
@ -23,7 +23,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
|
||||
void WorldSession::HandleLfgJoinOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_LFG_JOIN");
|
||||
|
||||
|
|
@ -53,14 +53,14 @@ void WorldSession::HandleLfgJoinOpcode( WorldPacket & recv_data )
|
|||
//SendLfgUpdate(false, LFG_UPDATE_JOIN, dungeons[0]);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgLeaveOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
DEBUG_LOG("CMSG_LFG_LEAVE");
|
||||
|
||||
//SendLfgUpdate(false, LFG_UPDATE_LEAVE, 0);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSearchLfgJoinOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleSearchLfgJoinOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_LFG_SEARCH_JOIN");
|
||||
|
||||
|
|
@ -73,14 +73,14 @@ void WorldSession::HandleSearchLfgJoinOpcode( WorldPacket & recv_data )
|
|||
//SendLfgSearchResults(type, entry);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSearchLfgLeaveOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleSearchLfgLeaveOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_LFG_SEARCH_LEAVE");
|
||||
|
||||
recv_data >> Unused<uint32>(); // join id?
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetLfgCommentOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleSetLfgCommentOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_SET_LFG_COMMENT");
|
||||
|
||||
|
|
@ -97,11 +97,11 @@ void WorldSession::SendLfgSearchResults(LfgType type, uint32 entry)
|
|||
|
||||
uint8 isGuidsPresent = 0;
|
||||
data << uint8(isGuidsPresent);
|
||||
if(isGuidsPresent)
|
||||
if (isGuidsPresent)
|
||||
{
|
||||
uint32 guids_count = 0;
|
||||
data << uint32(guids_count);
|
||||
for(uint32 i = 0; i < guids_count; ++i)
|
||||
for (uint32 i = 0; i < guids_count; ++i)
|
||||
{
|
||||
data << uint64(0); // player/group guid
|
||||
}
|
||||
|
|
@ -111,25 +111,25 @@ void WorldSession::SendLfgSearchResults(LfgType type, uint32 entry)
|
|||
data << uint32(groups_count); // groups count
|
||||
data << uint32(groups_count); // groups count (total?)
|
||||
|
||||
for(uint32 i = 0; i < groups_count; ++i)
|
||||
for (uint32 i = 0; i < groups_count; ++i)
|
||||
{
|
||||
data << uint64(1); // group guid
|
||||
|
||||
uint32 flags = 0x92;
|
||||
data << uint32(flags); // flags
|
||||
|
||||
if(flags & 0x2)
|
||||
if (flags & 0x2)
|
||||
{
|
||||
data << uint8(0); // comment string, max len 256
|
||||
}
|
||||
|
||||
if(flags & 0x10)
|
||||
if (flags & 0x10)
|
||||
{
|
||||
for(uint32 j = 0; j < 3; ++j)
|
||||
for (uint32 j = 0; j < 3; ++j)
|
||||
data << uint8(0); // roles
|
||||
}
|
||||
|
||||
if(flags & 0x80)
|
||||
if (flags & 0x80)
|
||||
{
|
||||
data << uint64(0); // instance guid
|
||||
data << uint32(0); // completed encounters
|
||||
|
|
@ -144,7 +144,7 @@ void WorldSession::SendLfgSearchResults(LfgType type, uint32 entry)
|
|||
|
||||
for (HashMapHolder<Player>::MapType::const_iterator iter = players.begin(); iter != players.end(); ++iter)
|
||||
{
|
||||
Player *plr = iter->second;
|
||||
Player* plr = iter->second;
|
||||
|
||||
if (!plr || plr->GetTeam() != _player->GetTeam())
|
||||
continue;
|
||||
|
|
@ -163,7 +163,7 @@ void WorldSession::SendLfgSearchResults(LfgType type, uint32 entry)
|
|||
data << uint8(plr->getClass());
|
||||
data << uint8(plr->getRace());
|
||||
|
||||
for(uint32 i = 0; i < 3; ++i)
|
||||
for (uint32 i = 0; i < 3; ++i)
|
||||
data << uint8(0); // talent spec x/x/x
|
||||
|
||||
data << uint32(0); // armor
|
||||
|
|
@ -222,15 +222,15 @@ void WorldSession::SendLfgJoinResult(LfgJoinResult result)
|
|||
data << uint32(result);
|
||||
data << uint32(0); // ERR_LFG_ROLE_CHECK_FAILED_TIMEOUT = 3, ERR_LFG_ROLE_CHECK_FAILED_NOT_VIABLE = (value - 3 == result)
|
||||
|
||||
if(result == ERR_LFG_NO_SLOTS_PARTY)
|
||||
if (result == ERR_LFG_NO_SLOTS_PARTY)
|
||||
{
|
||||
uint8 count1 = 0;
|
||||
data << uint8(count1); // players count?
|
||||
for(uint32 i = 0; i < count1; ++i)
|
||||
for (uint32 i = 0; i < count1; ++i)
|
||||
{
|
||||
data << uint64(0); // player guid?
|
||||
uint32 count2 = 0;
|
||||
for(uint32 j = 0; j < count2; ++j)
|
||||
for (uint32 j = 0; j < count2; ++j)
|
||||
{
|
||||
data << uint32(0); // dungeon id/type
|
||||
data << uint32(0); // lock status?
|
||||
|
|
@ -249,22 +249,22 @@ void WorldSession::SendLfgUpdate(bool isGroup, LfgUpdateType updateType, uint32
|
|||
uint8 extra = updateType == LFG_UPDATE_JOIN ? 1 : 0;
|
||||
data << uint8(extra);
|
||||
|
||||
if(extra)
|
||||
if (extra)
|
||||
{
|
||||
data << uint8(0);
|
||||
data << uint8(0);
|
||||
data << uint8(0);
|
||||
|
||||
if(isGroup)
|
||||
if (isGroup)
|
||||
{
|
||||
data << uint8(0);
|
||||
for(uint32 i = 0; i < 3; ++i)
|
||||
for (uint32 i = 0; i < 3; ++i)
|
||||
data << uint8(0);
|
||||
}
|
||||
|
||||
uint8 count = 1;
|
||||
data << uint8(count);
|
||||
for(uint32 i = 0; i < count; ++i)
|
||||
for (uint32 i = 0; i < count; ++i)
|
||||
data << uint32(id);
|
||||
data << "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
bool ChatHandler::HandleHelpCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
{
|
||||
ShowHelpForCommand(getCommandTable(), "help");
|
||||
ShowHelpForCommand(getCommandTable(), "");
|
||||
|
|
@ -66,16 +66,16 @@ bool ChatHandler::HandleAccountCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleStartCommand(char* /*args*/)
|
||||
{
|
||||
Player *chr = m_session->GetPlayer();
|
||||
Player* chr = m_session->GetPlayer();
|
||||
|
||||
if(chr->IsTaxiFlying())
|
||||
if (chr->IsTaxiFlying())
|
||||
{
|
||||
SendSysMessage(LANG_YOU_IN_FLIGHT);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(chr->isInCombat())
|
||||
if (chr->isInCombat())
|
||||
{
|
||||
SendSysMessage(LANG_YOU_IN_COMBAT);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -96,7 +96,7 @@ bool ChatHandler::HandleServerInfoCommand(char* /*args*/)
|
|||
std::string str = secsToTimeString(sWorld.GetUptime());
|
||||
|
||||
char const* full;
|
||||
if(m_session)
|
||||
if (m_session)
|
||||
full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r");
|
||||
else
|
||||
full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID);
|
||||
|
|
@ -124,14 +124,14 @@ bool ChatHandler::HandleServerInfoCommand(char* /*args*/)
|
|||
bool ChatHandler::HandleDismountCommand(char* /*args*/)
|
||||
{
|
||||
//If player is not mounted, so go out :)
|
||||
if (!m_session->GetPlayer( )->IsMounted())
|
||||
if (!m_session->GetPlayer()->IsMounted())
|
||||
{
|
||||
SendSysMessage(LANG_CHAR_NON_MOUNTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(m_session->GetPlayer( )->IsTaxiFlying())
|
||||
if (m_session->GetPlayer()->IsTaxiFlying())
|
||||
{
|
||||
SendSysMessage(LANG_YOU_IN_FLIGHT);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -145,10 +145,10 @@ bool ChatHandler::HandleDismountCommand(char* /*args*/)
|
|||
|
||||
bool ChatHandler::HandleSaveCommand(char* /*args*/)
|
||||
{
|
||||
Player *player=m_session->GetPlayer();
|
||||
Player* player=m_session->GetPlayer();
|
||||
|
||||
// save GM account without delay and output message (testing, etc)
|
||||
if(GetAccessLevel() > SEC_PLAYER)
|
||||
if (GetAccessLevel() > SEC_PLAYER)
|
||||
{
|
||||
player->SaveToDB();
|
||||
SendSysMessage(LANG_PLAYER_SAVED);
|
||||
|
|
@ -169,7 +169,7 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
|
|||
|
||||
{
|
||||
HashMapHolder<Player>::ReadGuard g(HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType &m = sObjectAccessor.GetPlayers();
|
||||
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
AccountTypes itr_sec = itr->second->GetSession()->GetSecurity();
|
||||
|
|
@ -185,7 +185,7 @@ bool ChatHandler::HandleGMListIngameCommand(char* /*args*/)
|
|||
|
||||
char const* accepts = GetMangosString(LANG_GM_ACCEPTS_WHISPER);
|
||||
char const* not_accept = GetMangosString(LANG_GM_NO_WHISPER);
|
||||
for(std::list<std::pair< std::string, bool> >::const_iterator iter = names.begin(); iter != names.end(); ++iter)
|
||||
for (std::list<std::pair< std::string, bool> >::const_iterator iter = names.begin(); iter != names.end(); ++iter)
|
||||
PSendSysMessage("%s - %s", iter->first.c_str(), iter->second ? accepts : not_accept);
|
||||
}
|
||||
else
|
||||
|
|
@ -199,15 +199,15 @@ bool ChatHandler::HandleAccountPasswordCommand(char* args)
|
|||
// allow use from RA, but not from console (not have associated account id)
|
||||
if (!GetAccountId())
|
||||
{
|
||||
SendSysMessage (LANG_RA_ONLY_COMMAND);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_RA_ONLY_COMMAND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
// allow or quoted string with possible spaces or literal without spaces
|
||||
char *old_pass = ExtractQuotedOrLiteralArg(&args);
|
||||
char *new_pass = ExtractQuotedOrLiteralArg(&args);
|
||||
char *new_pass_c = ExtractQuotedOrLiteralArg(&args);
|
||||
char* old_pass = ExtractQuotedOrLiteralArg(&args);
|
||||
char* new_pass = ExtractQuotedOrLiteralArg(&args);
|
||||
char* new_pass_c = ExtractQuotedOrLiteralArg(&args);
|
||||
|
||||
if (!old_pass || !new_pass || !new_pass_c)
|
||||
return false;
|
||||
|
|
@ -218,21 +218,21 @@ bool ChatHandler::HandleAccountPasswordCommand(char* args)
|
|||
|
||||
if (password_new != password_new_c)
|
||||
{
|
||||
SendSysMessage (LANG_NEW_PASSWORDS_NOT_MATCH);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!sAccountMgr.CheckPassword (GetAccountId(), password_old))
|
||||
if (!sAccountMgr.CheckPassword(GetAccountId(), password_old))
|
||||
{
|
||||
SendSysMessage (LANG_COMMAND_WRONGOLDPASSWORD);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
AccountOpResult result = sAccountMgr.ChangePassword(GetAccountId(), password_new);
|
||||
|
||||
switch(result)
|
||||
switch (result)
|
||||
{
|
||||
case AOR_OK:
|
||||
SendSysMessage(LANG_COMMAND_PASSWORD);
|
||||
|
|
@ -259,8 +259,8 @@ bool ChatHandler::HandleAccountLockCommand(char* args)
|
|||
// allow use from RA, but not from console (not have associated account id)
|
||||
if (!GetAccountId())
|
||||
{
|
||||
SendSysMessage (LANG_RA_ONLY_COMMAND);
|
||||
SetSentErrorMessage (true);
|
||||
SendSysMessage(LANG_RA_ONLY_COMMAND);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -274,12 +274,12 @@ bool ChatHandler::HandleAccountLockCommand(char* args)
|
|||
|
||||
if (value)
|
||||
{
|
||||
LoginDatabase.PExecute( "UPDATE account SET locked = '1' WHERE id = '%u'", GetAccountId());
|
||||
LoginDatabase.PExecute("UPDATE account SET locked = '1' WHERE id = '%u'", GetAccountId());
|
||||
PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
LoginDatabase.PExecute( "UPDATE account SET locked = '0' WHERE id = '%u'", GetAccountId());
|
||||
LoginDatabase.PExecute("UPDATE account SET locked = '0' WHERE id = '%u'", GetAccountId());
|
||||
PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@
|
|||
//-----------------------Npc Commands-----------------------
|
||||
bool ChatHandler::HandleNpcSayCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Creature* pCreature = getSelectedCreature();
|
||||
if(!pCreature)
|
||||
if (!pCreature)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -59,11 +59,11 @@ bool ChatHandler::HandleNpcSayCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleNpcYellCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Creature* pCreature = getSelectedCreature();
|
||||
if(!pCreature)
|
||||
if (!pCreature)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -78,12 +78,12 @@ bool ChatHandler::HandleNpcYellCommand(char* args)
|
|||
//show text emote by creature in chat
|
||||
bool ChatHandler::HandleNpcTextEmoteCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Creature* pCreature = getSelectedCreature();
|
||||
|
||||
if(!pCreature)
|
||||
if (!pCreature)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -108,7 +108,7 @@ bool ChatHandler::HandleNpcWhisperCommand(char* args)
|
|||
|
||||
Creature* pCreature = m_session->GetPlayer()->GetMap()->GetCreature(guid);
|
||||
|
||||
if(!pCreature || !target || !*args)
|
||||
if (!pCreature || !target || !*args)
|
||||
return false;
|
||||
|
||||
// check online security
|
||||
|
|
@ -124,7 +124,7 @@ bool ChatHandler::HandleNpcWhisperCommand(char* args)
|
|||
// global announce
|
||||
bool ChatHandler::HandleAnnounceCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
sWorld.SendWorldText(LANG_SYSTEMMESSAGE,args);
|
||||
|
|
@ -134,7 +134,7 @@ bool ChatHandler::HandleAnnounceCommand(char* args)
|
|||
//notification player at the screen
|
||||
bool ChatHandler::HandleNotifyCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
std::string str = GetMangosString(LANG_GLOBAL_NOTIFY);
|
||||
|
|
@ -150,9 +150,9 @@ bool ChatHandler::HandleNotifyCommand(char* args)
|
|||
//Enable\Dissable GM Mode
|
||||
bool ChatHandler::HandleGMCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
{
|
||||
if(m_session->GetPlayer()->isGameMaster())
|
||||
if (m_session->GetPlayer()->isGameMaster())
|
||||
m_session->SendNotification(LANG_GM_ON);
|
||||
else
|
||||
m_session->SendNotification(LANG_GM_OFF);
|
||||
|
|
@ -184,9 +184,9 @@ bool ChatHandler::HandleGMCommand(char* args)
|
|||
// Enables or disables hiding of the staff badge
|
||||
bool ChatHandler::HandleGMChatCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
{
|
||||
if(m_session->GetPlayer()->isGMChat())
|
||||
if (m_session->GetPlayer()->isGMChat())
|
||||
m_session->SendNotification(LANG_GM_CHAT_ON);
|
||||
else
|
||||
m_session->SendNotification(LANG_GM_CHAT_OFF);
|
||||
|
|
@ -257,13 +257,13 @@ bool ChatHandler::HandleGMVisibleCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleGPSCommand(char* args)
|
||||
{
|
||||
WorldObject *obj = NULL;
|
||||
WorldObject* obj = NULL;
|
||||
if (*args)
|
||||
{
|
||||
if (ObjectGuid guid = ExtractGuidFromLink(&args))
|
||||
obj = (WorldObject*)m_session->GetPlayer()->GetObjectByTypeMask(guid, TYPEMASK_CREATURE_OR_GAMEOBJECT);
|
||||
|
||||
if(!obj)
|
||||
if (!obj)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -274,7 +274,7 @@ bool ChatHandler::HandleGPSCommand(char* args)
|
|||
{
|
||||
obj = getSelectedUnit();
|
||||
|
||||
if(!obj)
|
||||
if (!obj)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -300,7 +300,7 @@ bool ChatHandler::HandleGPSCommand(char* args)
|
|||
zone_y = 0;
|
||||
}
|
||||
|
||||
TerrainInfo const *map = obj->GetTerrain();
|
||||
TerrainInfo const* map = obj->GetTerrain();
|
||||
float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT);
|
||||
float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ());
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ bool ChatHandler::HandleGPSCommand(char* args)
|
|||
|
||||
if (have_vmap)
|
||||
{
|
||||
if(map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()))
|
||||
if (map->IsOutdoors(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()))
|
||||
PSendSysMessage("You are OUTdoor");
|
||||
else
|
||||
PSendSysMessage("You are INdoor");
|
||||
|
|
@ -322,27 +322,27 @@ bool ChatHandler::HandleGPSCommand(char* args)
|
|||
else PSendSysMessage("no VMAP available for area info");
|
||||
|
||||
PSendSysMessage(LANG_MAP_POSITION,
|
||||
obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>" ),
|
||||
zone_id, (zoneEntry ? zoneEntry->area_name[GetSessionDbcLocale()] : "<unknown>" ),
|
||||
area_id, (areaEntry ? areaEntry->area_name[GetSessionDbcLocale()] : "<unknown>" ),
|
||||
obj->GetMapId(), (mapEntry ? mapEntry->name[GetSessionDbcLocale()] : "<unknown>"),
|
||||
zone_id, (zoneEntry ? zoneEntry->area_name[GetSessionDbcLocale()] : "<unknown>"),
|
||||
area_id, (areaEntry ? areaEntry->area_name[GetSessionDbcLocale()] : "<unknown>"),
|
||||
obj->GetPhaseMask(),
|
||||
obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),
|
||||
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),
|
||||
zone_x, zone_y, ground_z, floor_z, have_map, have_vmap );
|
||||
zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);
|
||||
|
||||
DEBUG_LOG("Player %s GPS call for %s '%s' (%s: %u):",
|
||||
m_session ? GetNameLink().c_str() : GetMangosString(LANG_CONSOLE_COMMAND),
|
||||
(obj->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), obj->GetName(),
|
||||
(obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow(): obj->GetEntry()) );
|
||||
(obj->GetTypeId() == TYPEID_PLAYER ? "GUID" : "Entry"), (obj->GetTypeId() == TYPEID_PLAYER ? obj->GetGUIDLow(): obj->GetEntry()));
|
||||
|
||||
DEBUG_LOG(GetMangosString(LANG_MAP_POSITION),
|
||||
obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ),
|
||||
zone_id, (zoneEntry ? zoneEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ),
|
||||
area_id, (areaEntry ? areaEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>" ),
|
||||
obj->GetMapId(), (mapEntry ? mapEntry->name[sWorld.GetDefaultDbcLocale()] : "<unknown>"),
|
||||
zone_id, (zoneEntry ? zoneEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>"),
|
||||
area_id, (areaEntry ? areaEntry->area_name[sWorld.GetDefaultDbcLocale()] : "<unknown>"),
|
||||
obj->GetPhaseMask(),
|
||||
obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation(),
|
||||
cell.GridX(), cell.GridY(), cell.CellX(), cell.CellY(), obj->GetInstanceId(),
|
||||
zone_x, zone_y, ground_z, floor_z, have_map, have_vmap );
|
||||
zone_x, zone_y, ground_z, floor_z, have_map, have_vmap);
|
||||
|
||||
GridMapLiquidData liquid_status;
|
||||
GridMapLiquidStatus res = map->getLiquidStatus(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), MAP_ALL_LIQUIDS, &liquid_status);
|
||||
|
|
@ -523,7 +523,7 @@ bool ChatHandler::HandleGonameCommand(char* args)
|
|||
if (!_player->GetMap()->IsBattleGroundOrArena())
|
||||
_player->SetBattleGroundEntryPoint();
|
||||
}
|
||||
else if(cMap->IsDungeon())
|
||||
else if (cMap->IsDungeon())
|
||||
{
|
||||
// we have to go to instance, and can go to player only if:
|
||||
// 1) we are in his group (either as leader or as member)
|
||||
|
|
@ -551,16 +551,16 @@ bool ChatHandler::HandleGonameCommand(char* args)
|
|||
|
||||
// if the player or the player's group is bound to another instance
|
||||
// the player will not be bound to another one
|
||||
InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid()));
|
||||
InstancePlayerBind* pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid()));
|
||||
if (!pBind)
|
||||
{
|
||||
Group *group = _player->GetGroup();
|
||||
Group* group = _player->GetGroup();
|
||||
// if no bind exists, create a solo bind
|
||||
InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId(), target) : NULL;
|
||||
InstanceGroupBind* gBind = group ? group->GetBoundInstance(target->GetMapId(), target) : NULL;
|
||||
// if no bind exists, create a solo bind
|
||||
if (!gBind)
|
||||
{
|
||||
DungeonPersistentState *save = ((DungeonMap*)target->GetMap())->GetPersistanceState();
|
||||
DungeonPersistentState* save = ((DungeonMap*)target->GetMap())->GetPersistanceState();
|
||||
|
||||
// if player is group leader then we need add group bind
|
||||
if (group && group->IsLeader(_player->GetObjectGuid()))
|
||||
|
|
@ -570,7 +570,7 @@ bool ChatHandler::HandleGonameCommand(char* args)
|
|||
}
|
||||
}
|
||||
|
||||
if(cMap->IsRaid())
|
||||
if (cMap->IsRaid())
|
||||
_player->SetRaidDifficulty(target->GetRaidDifficulty());
|
||||
else
|
||||
_player->SetDungeonDifficulty(target->GetDungeonDifficulty());
|
||||
|
|
@ -643,7 +643,7 @@ bool ChatHandler::HandleRecallCommand(char* args)
|
|||
//Edit Player HP
|
||||
bool ChatHandler::HandleModifyHPCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
int32 hp = atoi(args);
|
||||
|
|
@ -656,7 +656,7 @@ bool ChatHandler::HandleModifyHPCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -672,8 +672,8 @@ bool ChatHandler::HandleModifyHPCommand(char* args)
|
|||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_HP_CHANGED, GetNameLink().c_str(), hp, hpm);
|
||||
|
||||
chr->SetMaxHealth( hpm );
|
||||
chr->SetHealth( hp );
|
||||
chr->SetMaxHealth(hpm);
|
||||
chr->SetHealth(hp);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -681,7 +681,7 @@ bool ChatHandler::HandleModifyHPCommand(char* args)
|
|||
//Edit Player Mana
|
||||
bool ChatHandler::HandleModifyManaCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
int32 mana = atoi(args);
|
||||
|
|
@ -694,7 +694,7 @@ bool ChatHandler::HandleModifyManaCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -710,8 +710,8 @@ bool ChatHandler::HandleModifyManaCommand(char* args)
|
|||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MANA_CHANGED, GetNameLink().c_str(), mana, manam);
|
||||
|
||||
chr->SetMaxPower(POWER_MANA,manam );
|
||||
chr->SetPower(POWER_MANA, mana );
|
||||
chr->SetMaxPower(POWER_MANA,manam);
|
||||
chr->SetPower(POWER_MANA, mana);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -719,7 +719,7 @@ bool ChatHandler::HandleModifyManaCommand(char* args)
|
|||
//Edit Player Energy
|
||||
bool ChatHandler::HandleModifyEnergyCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
int32 energy = atoi(args)*10;
|
||||
|
|
@ -732,7 +732,7 @@ bool ChatHandler::HandleModifyEnergyCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (!chr)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -748,8 +748,8 @@ bool ChatHandler::HandleModifyEnergyCommand(char* args)
|
|||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_ENERGY_CHANGED, GetNameLink().c_str(), energy/10, energym/10);
|
||||
|
||||
chr->SetMaxPower(POWER_ENERGY,energym );
|
||||
chr->SetPower(POWER_ENERGY, energy );
|
||||
chr->SetMaxPower(POWER_ENERGY,energym);
|
||||
chr->SetPower(POWER_ENERGY, energy);
|
||||
|
||||
DETAIL_LOG(GetMangosString(LANG_CURRENT_ENERGY),chr->GetMaxPower(POWER_ENERGY));
|
||||
|
||||
|
|
@ -759,7 +759,7 @@ bool ChatHandler::HandleModifyEnergyCommand(char* args)
|
|||
//Edit Player Rage
|
||||
bool ChatHandler::HandleModifyRageCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
int32 rage = atoi(args)*10;
|
||||
|
|
@ -772,7 +772,7 @@ bool ChatHandler::HandleModifyRageCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -788,8 +788,8 @@ bool ChatHandler::HandleModifyRageCommand(char* args)
|
|||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_RAGE_CHANGED, GetNameLink().c_str(), rage/10, ragem/10);
|
||||
|
||||
chr->SetMaxPower(POWER_RAGE,ragem );
|
||||
chr->SetPower(POWER_RAGE, rage );
|
||||
chr->SetMaxPower(POWER_RAGE,ragem);
|
||||
chr->SetPower(POWER_RAGE, rage);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -797,7 +797,7 @@ bool ChatHandler::HandleModifyRageCommand(char* args)
|
|||
// Edit Player Runic Power
|
||||
bool ChatHandler::HandleModifyRunicPowerCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
int32 rune = atoi(args)*10;
|
||||
|
|
@ -810,7 +810,7 @@ bool ChatHandler::HandleModifyRunicPowerCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -822,8 +822,8 @@ bool ChatHandler::HandleModifyRunicPowerCommand(char* args)
|
|||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_RUNIC_POWER_CHANGED, GetNameLink().c_str(), rune/10, runem/10);
|
||||
|
||||
chr->SetMaxPower(POWER_RUNIC_POWER,runem );
|
||||
chr->SetPower(POWER_RUNIC_POWER, rune );
|
||||
chr->SetMaxPower(POWER_RUNIC_POWER,runem);
|
||||
chr->SetPower(POWER_RUNIC_POWER, rune);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -832,7 +832,7 @@ bool ChatHandler::HandleModifyRunicPowerCommand(char* args)
|
|||
bool ChatHandler::HandleModifyFactionCommand(char* args)
|
||||
{
|
||||
Creature* chr = getSelectedCreature();
|
||||
if(!chr)
|
||||
if (!chr)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CREATURE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -841,7 +841,7 @@ bool ChatHandler::HandleModifyFactionCommand(char* args)
|
|||
|
||||
if (!*args)
|
||||
{
|
||||
if(chr)
|
||||
if (chr)
|
||||
{
|
||||
uint32 factionid = chr->getFaction();
|
||||
uint32 flag = chr->GetUInt32Value(UNIT_FIELD_FLAGS);
|
||||
|
|
@ -852,7 +852,7 @@ bool ChatHandler::HandleModifyFactionCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
if( !chr )
|
||||
if (!chr)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -863,7 +863,7 @@ bool ChatHandler::HandleModifyFactionCommand(char* args)
|
|||
if (!ExtractUint32KeyFromLink(&args, "Hfaction", factionid))
|
||||
return false;
|
||||
|
||||
if(!sFactionTemplateStore.LookupEntry(factionid))
|
||||
if (!sFactionTemplateStore.LookupEntry(factionid))
|
||||
{
|
||||
PSendSysMessage(LANG_WRONG_FACTION, factionid);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -893,7 +893,7 @@ bool ChatHandler::HandleModifyFactionCommand(char* args)
|
|||
}
|
||||
|
||||
//Edit Player TP
|
||||
bool ChatHandler::HandleModifyTalentCommand (char* args)
|
||||
bool ChatHandler::HandleModifyTalentCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -903,14 +903,14 @@ bool ChatHandler::HandleModifyTalentCommand (char* args)
|
|||
return false;
|
||||
|
||||
Unit* target = getSelectedUnit();
|
||||
if(!target)
|
||||
if (!target)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(target->GetTypeId()==TYPEID_PLAYER)
|
||||
if (target->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// check online security
|
||||
if (HasLowerSecurity((Player*)target))
|
||||
|
|
@ -920,16 +920,16 @@ bool ChatHandler::HandleModifyTalentCommand (char* args)
|
|||
((Player*)target)->SendTalentsInfoData(false);
|
||||
return true;
|
||||
}
|
||||
else if(((Creature*)target)->IsPet())
|
||||
else if (((Creature*)target)->IsPet())
|
||||
{
|
||||
Unit *owner = target->GetOwner();
|
||||
if(owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor((Player*)owner))
|
||||
Unit* owner = target->GetOwner();
|
||||
if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet*)target)->IsPermanentPetFor((Player*)owner))
|
||||
{
|
||||
// check online security
|
||||
if (HasLowerSecurity((Player*)owner))
|
||||
return false;
|
||||
|
||||
((Pet *)target)->SetFreeTalentPoints(tp);
|
||||
((Pet*)target)->SetFreeTalentPoints(tp);
|
||||
((Player*)owner)->SendTalentsInfoData(true);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -951,7 +951,7 @@ bool ChatHandler::HandleTaxiCheatCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (!chr)
|
||||
chr=m_session->GetPlayer();
|
||||
// check online security
|
||||
|
|
@ -991,7 +991,7 @@ bool ChatHandler::HandleModifyASpeedCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -1005,7 +1005,7 @@ bool ChatHandler::HandleModifyASpeedCommand(char* args)
|
|||
|
||||
std::string chrNameLink = GetNameLink(chr);
|
||||
|
||||
if(chr->IsTaxiFlying())
|
||||
if (chr->IsTaxiFlying())
|
||||
{
|
||||
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1039,7 +1039,7 @@ bool ChatHandler::HandleModifySpeedCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -1053,7 +1053,7 @@ bool ChatHandler::HandleModifySpeedCommand(char* args)
|
|||
|
||||
std::string chrNameLink = GetNameLink(chr);
|
||||
|
||||
if(chr->IsTaxiFlying())
|
||||
if (chr->IsTaxiFlying())
|
||||
{
|
||||
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1084,7 +1084,7 @@ bool ChatHandler::HandleModifySwimCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -1098,7 +1098,7 @@ bool ChatHandler::HandleModifySwimCommand(char* args)
|
|||
|
||||
std::string chrNameLink = GetNameLink(chr);
|
||||
|
||||
if(chr->IsTaxiFlying())
|
||||
if (chr->IsTaxiFlying())
|
||||
{
|
||||
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1129,7 +1129,7 @@ bool ChatHandler::HandleModifyBWalkCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -1143,7 +1143,7 @@ bool ChatHandler::HandleModifyBWalkCommand(char* args)
|
|||
|
||||
std::string chrNameLink = GetNameLink(chr);
|
||||
|
||||
if(chr->IsTaxiFlying())
|
||||
if (chr->IsTaxiFlying())
|
||||
{
|
||||
PSendSysMessage(LANG_CHAR_IN_FLIGHT,chrNameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1174,7 +1174,7 @@ bool ChatHandler::HandleModifyFlyCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -1209,7 +1209,7 @@ bool ChatHandler::HandleModifyScaleCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Unit *target = getSelectedUnit();
|
||||
Unit* target = getSelectedUnit();
|
||||
if (target == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE);
|
||||
|
|
@ -1237,13 +1237,13 @@ bool ChatHandler::HandleModifyScaleCommand(char* args)
|
|||
//Enable Player mount
|
||||
bool ChatHandler::HandleModifyMountCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint16 mId = 1147;
|
||||
float speed = (float)15;
|
||||
uint32 num = atoi(args);
|
||||
switch(num)
|
||||
switch (num)
|
||||
{
|
||||
case 1:
|
||||
mId=14340;
|
||||
|
|
@ -1458,7 +1458,7 @@ bool ChatHandler::HandleModifyMountCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (!chr)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -1477,18 +1477,18 @@ bool ChatHandler::HandleModifyMountCommand(char* args)
|
|||
chr->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP);
|
||||
chr->Mount(mId);
|
||||
|
||||
WorldPacket data( SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4) );
|
||||
WorldPacket data(SMSG_FORCE_RUN_SPEED_CHANGE, (8+4+1+4));
|
||||
data << chr->GetPackGUID();
|
||||
data << (uint32)0;
|
||||
data << (uint8)0; //new 2.1.0
|
||||
data << float(speed);
|
||||
chr->SendMessageToSet( &data, true );
|
||||
chr->SendMessageToSet(&data, true);
|
||||
|
||||
data.Initialize( SMSG_FORCE_SWIM_SPEED_CHANGE, (8+4+4) );
|
||||
data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, (8+4+4));
|
||||
data << chr->GetPackGUID();
|
||||
data << (uint32)0;
|
||||
data << float(speed);
|
||||
chr->SendMessageToSet( &data, true );
|
||||
chr->SendMessageToSet(&data, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1499,7 +1499,7 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
|||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player *chr = getSelectedPlayer();
|
||||
Player* chr = getSelectedPlayer();
|
||||
if (chr == NULL)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -1520,7 +1520,7 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
|||
int32 newmoney = int32(moneyuser) + addmoney;
|
||||
|
||||
DETAIL_LOG(GetMangosString(LANG_CURRENT_MONEY), moneyuser, addmoney, newmoney);
|
||||
if (newmoney <= 0 )
|
||||
if (newmoney <= 0)
|
||||
{
|
||||
PSendSysMessage(LANG_YOU_TAKE_ALL_MONEY, GetNameLink(chr).c_str());
|
||||
if (needReportToTarget(chr))
|
||||
|
|
@ -1536,7 +1536,7 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
|||
PSendSysMessage(LANG_YOU_TAKE_MONEY, abs(addmoney), GetNameLink(chr).c_str());
|
||||
if (needReportToTarget(chr))
|
||||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_MONEY_TAKEN, GetNameLink().c_str(), abs(addmoney));
|
||||
chr->SetMoney( newmoney );
|
||||
chr->SetMoney(newmoney);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1548,21 +1548,21 @@ bool ChatHandler::HandleModifyMoneyCommand(char* args)
|
|||
if (addmoney >=MAX_MONEY_AMOUNT)
|
||||
chr->SetMoney(MAX_MONEY_AMOUNT);
|
||||
else
|
||||
chr->ModifyMoney( addmoney );
|
||||
chr->ModifyMoney(addmoney);
|
||||
}
|
||||
|
||||
DETAIL_LOG(GetMangosString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney() );
|
||||
DETAIL_LOG(GetMangosString(LANG_NEW_MONEY), moneyuser, addmoney, chr->GetMoney());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleModifyHonorCommand (char* args)
|
||||
bool ChatHandler::HandleModifyHonorCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player *target = getSelectedPlayer();
|
||||
if(!target)
|
||||
Player* target = getSelectedPlayer();
|
||||
if (!target)
|
||||
{
|
||||
SendSysMessage(LANG_PLAYER_NOT_FOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1584,7 +1584,7 @@ bool ChatHandler::HandleModifyHonorCommand (char* args)
|
|||
|
||||
bool ChatHandler::HandleTeleCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
|
@ -1610,38 +1610,38 @@ bool ChatHandler::HandleLookupAreaCommand(char* args)
|
|||
std::string namepart = args;
|
||||
std::wstring wnamepart;
|
||||
|
||||
if (!Utf8toWStr (namepart,wnamepart))
|
||||
if (!Utf8toWStr(namepart,wnamepart))
|
||||
return false;
|
||||
|
||||
uint32 counter = 0; // Counter for figure out that we found smth.
|
||||
|
||||
// converting string that we try to find to lower case
|
||||
wstrToLower (wnamepart);
|
||||
wstrToLower(wnamepart);
|
||||
|
||||
// Search in AreaTable.dbc
|
||||
for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag)
|
||||
for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows(); ++areaflag)
|
||||
{
|
||||
AreaTableEntry const *areaEntry = sAreaStore.LookupEntry (areaflag);
|
||||
AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(areaflag);
|
||||
if (areaEntry)
|
||||
{
|
||||
int loc = GetSessionDbcLocale ();
|
||||
int loc = GetSessionDbcLocale();
|
||||
std::string name = areaEntry->area_name[loc];
|
||||
if (name.empty())
|
||||
continue;
|
||||
|
||||
if (!Utf8FitTo (name, wnamepart))
|
||||
if (!Utf8FitTo(name, wnamepart))
|
||||
{
|
||||
loc = 0;
|
||||
for(; loc < MAX_LOCALE; ++loc)
|
||||
for (; loc < MAX_LOCALE; ++loc)
|
||||
{
|
||||
if (loc==GetSessionDbcLocale ())
|
||||
if (loc==GetSessionDbcLocale())
|
||||
continue;
|
||||
|
||||
name = areaEntry->area_name[loc];
|
||||
if (name.empty ())
|
||||
if (name.empty())
|
||||
continue;
|
||||
|
||||
if (Utf8FitTo (name, wnamepart))
|
||||
if (Utf8FitTo(name, wnamepart))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1655,7 +1655,7 @@ bool ChatHandler::HandleLookupAreaCommand(char* args)
|
|||
else
|
||||
ss << areaEntry->ID << " - " << name << " " << localeNames[loc];
|
||||
|
||||
SendSysMessage (ss.str ().c_str());
|
||||
SendSysMessage(ss.str().c_str());
|
||||
|
||||
++counter;
|
||||
}
|
||||
|
|
@ -1663,15 +1663,15 @@ bool ChatHandler::HandleLookupAreaCommand(char* args)
|
|||
}
|
||||
|
||||
if (counter == 0) // if counter == 0 then we found nth
|
||||
SendSysMessage (LANG_COMMAND_NOAREAFOUND);
|
||||
SendSysMessage(LANG_COMMAND_NOAREAFOUND);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Find tele in game_tele order by name
|
||||
bool ChatHandler::HandleLookupTeleCommand(char * args)
|
||||
bool ChatHandler::HandleLookupTeleCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_TELE_PARAMETER);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1681,20 +1681,20 @@ bool ChatHandler::HandleLookupTeleCommand(char * args)
|
|||
std::string namepart = args;
|
||||
std::wstring wnamepart;
|
||||
|
||||
if(!Utf8toWStr(namepart,wnamepart))
|
||||
if (!Utf8toWStr(namepart,wnamepart))
|
||||
return false;
|
||||
|
||||
// converting string that we try to find to lower case
|
||||
wstrToLower( wnamepart );
|
||||
wstrToLower(wnamepart);
|
||||
|
||||
std::ostringstream reply;
|
||||
|
||||
GameTeleMap const & teleMap = sObjectMgr.GetGameTeleMap();
|
||||
for(GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
|
||||
GameTeleMap const& teleMap = sObjectMgr.GetGameTeleMap();
|
||||
for (GameTeleMap::const_iterator itr = teleMap.begin(); itr != teleMap.end(); ++itr)
|
||||
{
|
||||
GameTele const* tele = &itr->second;
|
||||
|
||||
if(tele->wnameLow.find(wnamepart) == std::wstring::npos)
|
||||
if (tele->wnameLow.find(wnamepart) == std::wstring::npos)
|
||||
continue;
|
||||
|
||||
if (m_session)
|
||||
|
|
@ -1703,7 +1703,7 @@ bool ChatHandler::HandleLookupTeleCommand(char * args)
|
|||
reply << " " << itr->first << " " << tele->name << "\n";
|
||||
}
|
||||
|
||||
if(reply.str().empty())
|
||||
if (reply.str().empty())
|
||||
SendSysMessage(LANG_COMMAND_TELE_NOLOCATION);
|
||||
else
|
||||
PSendSysMessage(LANG_COMMAND_TELE_LOCATION,reply.str().c_str());
|
||||
|
|
@ -1714,7 +1714,7 @@ bool ChatHandler::HandleLookupTeleCommand(char * args)
|
|||
//Enable\Dissable accept whispers (for GM)
|
||||
bool ChatHandler::HandleWhispersCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_WHISPERACCEPTING, GetOnOffStr(m_session->GetPlayer()->isAcceptWhispers()));
|
||||
return true;
|
||||
|
|
@ -1806,7 +1806,7 @@ bool ChatHandler::HandleTeleNameCommand(char* args)
|
|||
|
||||
std::string chrNameLink = playerLink(target_name);
|
||||
|
||||
if(target->IsBeingTeleported()==true)
|
||||
if (target->IsBeingTeleported()==true)
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, chrNameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1837,12 +1837,12 @@ bool ChatHandler::HandleTeleNameCommand(char* args)
|
|||
}
|
||||
|
||||
//Teleport group to given game_tele.entry
|
||||
bool ChatHandler::HandleTeleGroupCommand(char * args)
|
||||
bool ChatHandler::HandleTeleGroupCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player *player = getSelectedPlayer();
|
||||
Player* player = getSelectedPlayer();
|
||||
if (!player)
|
||||
{
|
||||
SendSysMessage(LANG_NO_CHAR_SELECTED);
|
||||
|
|
@ -1856,7 +1856,7 @@ bool ChatHandler::HandleTeleGroupCommand(char * args)
|
|||
|
||||
// id, or string, or [name] Shift-click form |color|Htele:id|h[name]|h|r
|
||||
GameTele const* tele = ExtractGameTeleFromLink(&args);
|
||||
if(!tele)
|
||||
if (!tele)
|
||||
{
|
||||
SendSysMessage(LANG_COMMAND_TELE_NOTFOUND);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1865,19 +1865,19 @@ bool ChatHandler::HandleTeleGroupCommand(char * args)
|
|||
|
||||
std::string nameLink = GetNameLink(player);
|
||||
|
||||
Group *grp = player->GetGroup();
|
||||
if(!grp)
|
||||
Group* grp = player->GetGroup();
|
||||
if (!grp)
|
||||
{
|
||||
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
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* pl = itr->getSource();
|
||||
|
||||
if(!pl || !pl->GetSession() )
|
||||
if (!pl || !pl->GetSession())
|
||||
continue;
|
||||
|
||||
// check online security
|
||||
|
|
@ -1886,7 +1886,7 @@ bool ChatHandler::HandleTeleGroupCommand(char * args)
|
|||
|
||||
std::string plNameLink = GetNameLink(pl);
|
||||
|
||||
if(pl->IsBeingTeleported())
|
||||
if (pl->IsBeingTeleported())
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||
continue;
|
||||
|
|
@ -1897,7 +1897,7 @@ bool ChatHandler::HandleTeleGroupCommand(char * args)
|
|||
ChatHandler(pl).PSendSysMessage(LANG_TELEPORTED_TO_BY, nameLink.c_str());
|
||||
|
||||
// stop flight if need
|
||||
if(pl->IsTaxiFlying())
|
||||
if (pl->IsTaxiFlying())
|
||||
{
|
||||
pl->GetMotionMaster()->MovementExpired();
|
||||
pl->m_taxi.ClearTaxiDestinations();
|
||||
|
|
@ -1923,11 +1923,11 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
|||
if (HasLowerSecurity(target))
|
||||
return false;
|
||||
|
||||
Group *grp = target->GetGroup();
|
||||
Group* grp = target->GetGroup();
|
||||
|
||||
std::string nameLink = GetNameLink(target);
|
||||
|
||||
if(!grp)
|
||||
if (!grp)
|
||||
{
|
||||
PSendSysMessage(LANG_NOT_IN_GROUP,nameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1938,9 +1938,9 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
|||
bool to_instance = gmMap->Instanceable();
|
||||
|
||||
// we are in instance, and can summon only player in our group with us as lead
|
||||
if ( to_instance && (
|
||||
if (to_instance && (
|
||||
!m_session->GetPlayer()->GetGroup() || (grp->GetLeaderGuid() != m_session->GetPlayer()->GetObjectGuid()) ||
|
||||
(m_session->GetPlayer()->GetGroup()->GetLeaderGuid() != m_session->GetPlayer()->GetObjectGuid()) ) )
|
||||
(m_session->GetPlayer()->GetGroup()->GetLeaderGuid() != m_session->GetPlayer()->GetObjectGuid())))
|
||||
// the last check is a bit excessive, but let it be, just in case
|
||||
{
|
||||
SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
|
||||
|
|
@ -1948,11 +1948,11 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
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* pl = itr->getSource();
|
||||
|
||||
if(!pl || pl==m_session->GetPlayer() || !pl->GetSession() )
|
||||
if (!pl || pl==m_session->GetPlayer() || !pl->GetSession())
|
||||
continue;
|
||||
|
||||
// check online security
|
||||
|
|
@ -1961,7 +1961,7 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
|||
|
||||
std::string plNameLink = GetNameLink(pl);
|
||||
|
||||
if(pl->IsBeingTeleported()==true)
|
||||
if (pl->IsBeingTeleported()==true)
|
||||
{
|
||||
PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -1972,7 +1972,7 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
|||
{
|
||||
Map* plMap = pl->GetMap();
|
||||
|
||||
if ( plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId() )
|
||||
if (plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId())
|
||||
{
|
||||
// cannot summon from instance to instance
|
||||
PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST,plNameLink.c_str());
|
||||
|
|
@ -1986,7 +1986,7 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
|||
ChatHandler(pl).PSendSysMessage(LANG_SUMMONED_BY, nameLink.c_str());
|
||||
|
||||
// stop flight if need
|
||||
if(pl->IsTaxiFlying())
|
||||
if (pl->IsTaxiFlying())
|
||||
{
|
||||
pl->GetMotionMaster()->MovementExpired();
|
||||
pl->m_taxi.ClearTaxiDestinations();
|
||||
|
|
@ -2004,7 +2004,7 @@ bool ChatHandler::HandleGroupgoCommand(char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleGoHelper( Player* player, uint32 mapid, float x, float y, float const* zPtr, float const* ortPtr)
|
||||
bool ChatHandler::HandleGoHelper(Player* player, uint32 mapid, float x, float y, float const* zPtr, float const* ortPtr)
|
||||
{
|
||||
float z;
|
||||
float ort = player->GetOrientation();
|
||||
|
|
@ -2017,7 +2017,7 @@ bool ChatHandler::HandleGoHelper( Player* player, uint32 mapid, float x, float y
|
|||
ort = *ortPtr;
|
||||
|
||||
// check full provided coordinates
|
||||
if(!MapManager::IsValidMapCoord(mapid,x,y,z,ort))
|
||||
if (!MapManager::IsValidMapCoord(mapid,x,y,z,ort))
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -2027,19 +2027,19 @@ bool ChatHandler::HandleGoHelper( Player* player, uint32 mapid, float x, float y
|
|||
else
|
||||
{
|
||||
// we need check x,y before ask Z or can crash at invalide coordinates
|
||||
if(!MapManager::IsValidMapCoord(mapid,x,y))
|
||||
if (!MapManager::IsValidMapCoord(mapid,x,y))
|
||||
{
|
||||
PSendSysMessage(LANG_INVALID_TARGET_COORD,x,y,mapid);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
TerrainInfo const *map = sTerrainMgr.LoadTerrain(mapid);
|
||||
TerrainInfo const* map = sTerrainMgr.LoadTerrain(mapid);
|
||||
z = map->GetWaterOrGroundLevel(x, y, MAX_HEIGHT);
|
||||
}
|
||||
|
||||
// stop flight if need
|
||||
if(player->IsTaxiFlying())
|
||||
if (player->IsTaxiFlying())
|
||||
{
|
||||
player->GetMotionMaster()->MovementExpired();
|
||||
player->m_taxi.ClearTaxiDestinations();
|
||||
|
|
@ -2081,7 +2081,7 @@ bool ChatHandler::HandleGoTaxinodeCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleGoCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
Player* _player = m_session->GetPlayer();
|
||||
|
|
@ -2188,7 +2188,7 @@ bool ChatHandler::HandleGoZoneXYCommand(char* args)
|
|||
// update to parent zone if exist (client map show only zones without parents)
|
||||
AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry;
|
||||
|
||||
MapEntry const *mapEntry = sMapStore.LookupEntry(zoneEntry->mapid);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(zoneEntry->mapid);
|
||||
|
||||
if (mapEntry->Instanceable())
|
||||
{
|
||||
|
|
@ -2235,10 +2235,10 @@ bool ChatHandler::HandleGoGridCommand(char* args)
|
|||
|
||||
bool ChatHandler::HandleModifyDrunkCommand(char* args)
|
||||
{
|
||||
if(!*args) return false;
|
||||
if (!*args) return false;
|
||||
|
||||
uint32 drunklevel = (uint32)atoi(args);
|
||||
if(drunklevel > 100)
|
||||
if (drunklevel > 100)
|
||||
drunklevel = 100;
|
||||
|
||||
uint16 drunkMod = drunklevel * 0xFFFF / 100;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -32,22 +32,22 @@
|
|||
#include "Util.h"
|
||||
#include "DBCStores.h"
|
||||
|
||||
void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
|
||||
Player *player = GetPlayer();
|
||||
Player* player = GetPlayer();
|
||||
ObjectGuid lguid = player->GetLootGuid();
|
||||
Loot *loot;
|
||||
Loot* loot;
|
||||
uint8 lootSlot;
|
||||
Item* pItem = NULL;
|
||||
|
||||
recv_data >> lootSlot;
|
||||
|
||||
switch( lguid.GetHigh())
|
||||
switch (lguid.GetHigh())
|
||||
{
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
{
|
||||
GameObject *go = player->GetMap()->GetGameObject(lguid);
|
||||
GameObject* go = player->GetMap()->GetGameObject(lguid);
|
||||
|
||||
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
|
||||
if (!go || ((go->GetOwnerGuid() != _player->GetObjectGuid() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)))
|
||||
|
|
@ -61,7 +61,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
case HIGHGUID_ITEM:
|
||||
{
|
||||
pItem = player->GetItemByGuid( lguid );
|
||||
pItem = player->GetItemByGuid(lguid);
|
||||
|
||||
if (!pItem || !pItem->HasGeneratedLoot())
|
||||
{
|
||||
|
|
@ -74,7 +74,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
case HIGHGUID_CORPSE:
|
||||
{
|
||||
Corpse *bones = player->GetMap()->GetCorpse(lguid);
|
||||
Corpse* bones = player->GetMap()->GetCorpse(lguid);
|
||||
if (!bones)
|
||||
{
|
||||
player->SendLootRelease(lguid);
|
||||
|
|
@ -90,7 +90,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
|||
|
||||
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
|
||||
|
||||
if( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
||||
if (!ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
||||
{
|
||||
player->SendLootRelease(lguid);
|
||||
return;
|
||||
|
|
@ -106,15 +106,15 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
|||
}
|
||||
}
|
||||
|
||||
QuestItem *qitem = NULL;
|
||||
QuestItem *ffaitem = NULL;
|
||||
QuestItem *conditem = NULL;
|
||||
QuestItem* qitem = NULL;
|
||||
QuestItem* ffaitem = NULL;
|
||||
QuestItem* conditem = NULL;
|
||||
|
||||
LootItem *item = loot->LootItemInSlot(lootSlot,player,&qitem,&ffaitem,&conditem);
|
||||
LootItem* item = loot->LootItemInSlot(lootSlot,player,&qitem,&ffaitem,&conditem);
|
||||
|
||||
if(!item)
|
||||
if (!item)
|
||||
{
|
||||
player->SendEquipError( EQUIP_ERR_ALREADY_LOOTED, NULL, NULL );
|
||||
player->SendEquipError(EQUIP_ERR_ALREADY_LOOTED, NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -129,10 +129,10 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
|||
pItem->SetLootState(ITEM_LOOT_CHANGED);
|
||||
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = player->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item->itemid, item->count );
|
||||
if ( msg == EQUIP_ERR_OK )
|
||||
InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
Item * newitem = player->StoreNewItem( dest, item->itemid, true, item->randomPropertyId);
|
||||
Item* newitem = player->StoreNewItem(dest, item->itemid, true, item->randomPropertyId);
|
||||
|
||||
if (qitem)
|
||||
{
|
||||
|
|
@ -154,7 +154,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
|||
else
|
||||
{
|
||||
//not freeforall, notify everyone
|
||||
if(conditem)
|
||||
if (conditem)
|
||||
conditem->is_looted=true;
|
||||
loot->NotifyItemRemoved(lootSlot);
|
||||
}
|
||||
|
|
@ -172,38 +172,38 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
|
|||
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item->itemid, item->count);
|
||||
}
|
||||
else
|
||||
player->SendEquipError( msg, NULL, NULL, item->itemid );
|
||||
player->SendEquipError(msg, NULL, NULL, item->itemid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_LOOT_MONEY");
|
||||
|
||||
Player *player = GetPlayer();
|
||||
Player* player = GetPlayer();
|
||||
ObjectGuid guid = player->GetLootGuid();
|
||||
if (!guid)
|
||||
return;
|
||||
|
||||
Loot *pLoot = NULL;
|
||||
Loot* pLoot = NULL;
|
||||
Item* pItem = NULL;
|
||||
|
||||
switch(guid.GetHigh())
|
||||
switch (guid.GetHigh())
|
||||
{
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
{
|
||||
GameObject *pGameObject = GetPlayer()->GetMap()->GetGameObject(guid);
|
||||
GameObject* pGameObject = GetPlayer()->GetMap()->GetGameObject(guid);
|
||||
|
||||
// not check distance for GO in case owned GO (fishing bobber case, for example)
|
||||
if( pGameObject && (pGameObject->GetOwnerGuid() == _player->GetObjectGuid() || pGameObject->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) )
|
||||
if (pGameObject && (pGameObject->GetOwnerGuid() == _player->GetObjectGuid() || pGameObject->IsWithinDistInMap(_player,INTERACTION_DISTANCE)))
|
||||
pLoot = &pGameObject->loot;
|
||||
|
||||
break;
|
||||
}
|
||||
case HIGHGUID_CORPSE: // remove insignia ONLY in BG
|
||||
{
|
||||
Corpse *bones = _player->GetMap()->GetCorpse(guid);
|
||||
Corpse* bones = _player->GetMap()->GetCorpse(guid);
|
||||
|
||||
if (bones && bones->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
||||
if (bones && bones->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
||||
pLoot = &bones->loot;
|
||||
|
||||
break;
|
||||
|
|
@ -224,7 +224,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
|||
|
||||
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
|
||||
|
||||
if ( ok_loot && pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
||||
if (ok_loot && pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
||||
pLoot = &pCreature->loot ;
|
||||
|
||||
break;
|
||||
|
|
@ -239,13 +239,13 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
|||
|
||||
if (!guid.IsItem() && player->GetGroup()) //item can be looted only single player
|
||||
{
|
||||
Group *group = player->GetGroup();
|
||||
Group* group = player->GetGroup();
|
||||
|
||||
std::vector<Player*> playersNear;
|
||||
for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
Player* playerGroup = itr->getSource();
|
||||
if(!playerGroup)
|
||||
if (!playerGroup)
|
||||
continue;
|
||||
if (player->IsWithinDistInMap(playerGroup,sWorld.getConfig(CONFIG_FLOAT_GROUP_XP_DISTANCE),false))
|
||||
playersNear.push_back(playerGroup);
|
||||
|
|
@ -255,7 +255,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
|||
|
||||
for (std::vector<Player*>::const_iterator i = playersNear.begin(); i != playersNear.end(); ++i)
|
||||
{
|
||||
(*i)->ModifyMoney( money_per_player );
|
||||
(*i)->ModifyMoney(money_per_player);
|
||||
(*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, money_per_player);
|
||||
|
||||
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4+1);
|
||||
|
|
@ -267,7 +267,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
|||
}
|
||||
else
|
||||
{
|
||||
player->ModifyMoney( pLoot->gold );
|
||||
player->ModifyMoney(pLoot->gold);
|
||||
player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, pLoot->gold);
|
||||
|
||||
WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4+1);
|
||||
|
|
@ -283,7 +283,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleLootOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleLootOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_LOOT");
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ void WorldSession::HandleLootOpcode( WorldPacket & recv_data )
|
|||
GetPlayer()->SendLoot(guid, LOOT_CORPSE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleLootReleaseOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: CMSG_LOOT_RELEASE");
|
||||
|
||||
|
|
@ -311,22 +311,22 @@ void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::DoLootRelease(ObjectGuid lguid)
|
||||
{
|
||||
Player *player = GetPlayer();
|
||||
Loot *loot;
|
||||
Player* player = GetPlayer();
|
||||
Loot* loot;
|
||||
|
||||
player->SetLootGuid(ObjectGuid());
|
||||
player->SendLootRelease(lguid);
|
||||
|
||||
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
|
||||
|
||||
if(!player->IsInWorld())
|
||||
if (!player->IsInWorld())
|
||||
return;
|
||||
|
||||
switch(lguid.GetHigh())
|
||||
switch (lguid.GetHigh())
|
||||
{
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
{
|
||||
GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid);
|
||||
GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
|
||||
|
||||
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
|
||||
if (!go || ((go->GetOwnerGuid() != _player->GetObjectGuid() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE)))
|
||||
|
|
@ -342,13 +342,13 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
else if (loot->isLooted() || go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE)
|
||||
{
|
||||
// GO is mineral vein? so it is not removed after its looted
|
||||
if(go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
|
||||
if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST)
|
||||
{
|
||||
uint32 go_min = go->GetGOInfo()->chest.minSuccessOpens;
|
||||
uint32 go_max = go->GetGOInfo()->chest.maxSuccessOpens;
|
||||
|
||||
// only vein pass this check
|
||||
if(go_min != 0 && go_max > go_min)
|
||||
if (go_min != 0 && go_max > go_min)
|
||||
{
|
||||
float amount_rate = sWorld.getConfig(CONFIG_FLOAT_RATE_MINING_AMOUNT);
|
||||
float min_amount = go_min*amount_rate;
|
||||
|
|
@ -357,19 +357,19 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
go->AddUse();
|
||||
float uses = float(go->GetUseCount());
|
||||
|
||||
if(uses < max_amount)
|
||||
if (uses < max_amount)
|
||||
{
|
||||
if(uses >= min_amount)
|
||||
if (uses >= min_amount)
|
||||
{
|
||||
float chance_rate = sWorld.getConfig(CONFIG_FLOAT_RATE_MINING_NEXT);
|
||||
|
||||
int32 ReqValue = 175;
|
||||
LockEntry const *lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId);
|
||||
if(lockInfo)
|
||||
LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId);
|
||||
if (lockInfo)
|
||||
ReqValue = lockInfo->Skill[0];
|
||||
float skill = float(player->GetSkillValue(SKILL_MINING))/(ReqValue+25);
|
||||
double chance = pow(0.8*chance_rate,4*(1/double(max_amount))*double(uses));
|
||||
if(roll_chance_f(float(100.0f*chance+skill)))
|
||||
if (roll_chance_f(float(100.0f*chance+skill)))
|
||||
{
|
||||
go->SetLootState(GO_READY);
|
||||
}
|
||||
|
|
@ -386,7 +386,8 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
go->SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
|
||||
{ // The fishing hole used once more
|
||||
{
|
||||
// The fishing hole used once more
|
||||
go->AddUse(); // if the max usage is reached, will be despawned at next tick
|
||||
if (go->GetUseCount() >= urand(go->GetGOInfo()->fishinghole.minSuccessOpens,go->GetGOInfo()->fishinghole.maxSuccessOpens))
|
||||
{
|
||||
|
|
@ -407,8 +408,8 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
}
|
||||
case HIGHGUID_CORPSE: // ONLY remove insignia at BG
|
||||
{
|
||||
Corpse *corpse = _player->GetMap()->GetCorpse(lguid);
|
||||
if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
||||
Corpse* corpse = _player->GetMap()->GetCorpse(lguid);
|
||||
if (!corpse || !corpse->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
||||
return;
|
||||
|
||||
loot = &corpse->loot;
|
||||
|
|
@ -422,7 +423,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
}
|
||||
case HIGHGUID_ITEM:
|
||||
{
|
||||
Item *pItem = player->GetItemByGuid(lguid );
|
||||
Item* pItem = player->GetItemByGuid(lguid);
|
||||
if (!pItem)
|
||||
return;
|
||||
|
||||
|
|
@ -435,7 +436,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
uint32 count = pItem->GetCount();
|
||||
|
||||
// >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
|
||||
if(count > 5)
|
||||
if (count > 5)
|
||||
count = 5;
|
||||
|
||||
// reset loot for allow repeat looting if stack > 5
|
||||
|
|
@ -452,7 +453,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
player->AutoStoreLoot(pItem->loot); // can be lost if no space
|
||||
pItem->loot.clear();
|
||||
pItem->SetLootState(ITEM_LOOT_REMOVED);
|
||||
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
|
||||
player->DestroyItem(pItem->GetBagSlot(),pItem->GetSlot(), true);
|
||||
break;
|
||||
}
|
||||
// normal persistence loot
|
||||
|
|
@ -462,7 +463,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
if (pItem->loot.isLooted())
|
||||
{
|
||||
pItem->SetLootState(ITEM_LOOT_REMOVED);
|
||||
player->DestroyItem( pItem->GetBagSlot(),pItem->GetSlot(), true);
|
||||
player->DestroyItem(pItem->GetBagSlot(),pItem->GetSlot(), true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -475,13 +476,13 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
|
||||
|
||||
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
|
||||
if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
|
||||
if (!ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
|
||||
return;
|
||||
|
||||
loot = &pCreature->loot;
|
||||
|
||||
// update next looter
|
||||
if(Group* group = pCreature->GetGroupLootRecipient())
|
||||
if (Group* group = pCreature->GetGroupLootRecipient())
|
||||
if (group->GetLooterGuid() == player->GetObjectGuid())
|
||||
group->UpdateLooterGuid(pCreature);
|
||||
|
||||
|
|
@ -490,7 +491,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
// for example skinning after normal loot
|
||||
pCreature->PrepareBodyLootState();
|
||||
|
||||
if(!pCreature->isAlive())
|
||||
if (!pCreature->isAlive())
|
||||
pCreature->AllLootRemovedFromCorpse();
|
||||
}
|
||||
break;
|
||||
|
|
@ -506,7 +507,7 @@ void WorldSession::DoLootRelease(ObjectGuid lguid)
|
|||
loot->RemoveLooter(player->GetObjectGuid());
|
||||
}
|
||||
|
||||
void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
||||
void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint8 slotid;
|
||||
ObjectGuid lootguid;
|
||||
|
|
@ -520,7 +521,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
Player *target = ObjectAccessor::FindPlayer(target_playerguid);
|
||||
Player* target = ObjectAccessor::FindPlayer(target_playerguid);
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
|
|
@ -529,20 +530,20 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
|||
if (_player->GetLootGuid() != lootguid)
|
||||
return;
|
||||
|
||||
Loot *pLoot = NULL;
|
||||
Loot* pLoot = NULL;
|
||||
|
||||
if (lootguid.IsCreatureOrVehicle())
|
||||
{
|
||||
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
|
||||
if(!pCreature)
|
||||
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
|
||||
if (!pCreature)
|
||||
return;
|
||||
|
||||
pLoot = &pCreature->loot;
|
||||
}
|
||||
else if(lootguid.IsGameObject())
|
||||
else if (lootguid.IsGameObject())
|
||||
{
|
||||
GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
|
||||
if(!pGO)
|
||||
GameObject* pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
|
||||
if (!pGO)
|
||||
return;
|
||||
|
||||
pLoot = &pGO->loot;
|
||||
|
|
@ -559,19 +560,19 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
|
|||
LootItem& item = pLoot->items[slotid];
|
||||
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = target->CanStoreNewItem( NULL_BAG, NULL_SLOT, dest, item.itemid, item.count );
|
||||
if ( msg != EQUIP_ERR_OK )
|
||||
InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count);
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
target->SendEquipError( msg, NULL, NULL, item.itemid );
|
||||
target->SendEquipError(msg, NULL, NULL, item.itemid);
|
||||
|
||||
// send duplicate of error massage to master looter
|
||||
_player->SendEquipError( msg, NULL, NULL, item.itemid );
|
||||
_player->SendEquipError(msg, NULL, NULL, item.itemid);
|
||||
return;
|
||||
}
|
||||
|
||||
// now move item from loot to target inventory
|
||||
Item * newitem = target->StoreNewItem( dest, item.itemid, true, item.randomPropertyId );
|
||||
target->SendNewItem(newitem, uint32(item.count), false, false, true );
|
||||
Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId);
|
||||
target->SendNewItem(newitem, uint32(item.count), false, false, true);
|
||||
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
|
||||
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count);
|
||||
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@
|
|||
#include "DBCStores.h"
|
||||
#include "SQLStorages.h"
|
||||
|
||||
static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] = {
|
||||
static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] =
|
||||
{
|
||||
CONFIG_FLOAT_RATE_DROP_ITEM_POOR, // ITEM_QUALITY_POOR
|
||||
CONFIG_FLOAT_RATE_DROP_ITEM_NORMAL, // ITEM_QUALITY_NORMAL
|
||||
CONFIG_FLOAT_RATE_DROP_ITEM_UNCOMMON, // ITEM_QUALITY_UNCOMMON
|
||||
|
|
@ -37,25 +38,25 @@ static eConfigFloatValues const qualityToRate[MAX_ITEM_QUALITY] = {
|
|||
CONFIG_FLOAT_RATE_DROP_ITEM_ARTIFACT, // ITEM_QUALITY_ARTIFACT
|
||||
};
|
||||
|
||||
LootStore LootTemplates_Creature( "creature_loot_template", "creature entry", true);
|
||||
LootStore LootTemplates_Disenchant( "disenchant_loot_template", "item disenchant id", true);
|
||||
LootStore LootTemplates_Fishing( "fishing_loot_template", "area id", true);
|
||||
LootStore LootTemplates_Gameobject( "gameobject_loot_template", "gameobject lootid", true);
|
||||
LootStore LootTemplates_Item( "item_loot_template", "item entry with ITEM_FLAG_LOOTABLE", true);
|
||||
LootStore LootTemplates_Mail( "mail_loot_template", "mail template id", false);
|
||||
LootStore LootTemplates_Milling( "milling_loot_template", "item entry (herb)", true);
|
||||
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true);
|
||||
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true);
|
||||
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true);
|
||||
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject lootid", true);
|
||||
LootStore LootTemplates_Item("item_loot_template", "item entry with ITEM_FLAG_LOOTABLE", true);
|
||||
LootStore LootTemplates_Mail("mail_loot_template", "mail template id", false);
|
||||
LootStore LootTemplates_Milling("milling_loot_template", "item entry (herb)", true);
|
||||
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid", true);
|
||||
LootStore LootTemplates_Prospecting( "prospecting_loot_template", "item entry (ore)", true);
|
||||
LootStore LootTemplates_Reference( "reference_loot_template", "reference id", false);
|
||||
LootStore LootTemplates_Skinning( "skinning_loot_template", "creature skinning id", true);
|
||||
LootStore LootTemplates_Spell( "spell_loot_template", "spell id (random item creating)",false);
|
||||
LootStore LootTemplates_Prospecting("prospecting_loot_template", "item entry (ore)", true);
|
||||
LootStore LootTemplates_Reference("reference_loot_template", "reference id", false);
|
||||
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true);
|
||||
LootStore LootTemplates_Spell("spell_loot_template", "spell id (random item creating)",false);
|
||||
|
||||
class LootTemplate::LootGroup // A set of loot definitions for items (refs are not allowed)
|
||||
{
|
||||
public:
|
||||
void AddEntry(LootStoreItem& item); // Adds an entry to the group (at loading stage)
|
||||
bool HasQuestDrop() const; // True if group includes at least 1 quest drop entry
|
||||
bool HasQuestDropForPlayer(Player const * player) const;
|
||||
bool HasQuestDropForPlayer(Player const* player) const;
|
||||
// The same for active quests of the player
|
||||
void Process(Loot& loot) const; // Rolls an item from the group (if any) and adds the item to the loot
|
||||
float RawTotalChance() const; // Overall chance for the group (without equal chanced items)
|
||||
|
|
@ -68,7 +69,7 @@ class LootTemplate::LootGroup // A set of loot def
|
|||
LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB
|
||||
LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance
|
||||
|
||||
LootStoreItem const * Roll() const; // Rolls an item from the group, returns NULL if all miss their chances
|
||||
LootStoreItem const* Roll() const; // Rolls an item from the group, returns NULL if all miss their chances
|
||||
};
|
||||
|
||||
//Remove all data and free all memory
|
||||
|
|
@ -83,7 +84,7 @@ void LootStore::Clear()
|
|||
// Actual checks are done within LootTemplate::Verify() which is called for every template
|
||||
void LootStore::Verify() const
|
||||
{
|
||||
for (LootTemplateMap::const_iterator i = m_LootTemplates.begin(); i != m_LootTemplates.end(); ++i )
|
||||
for (LootTemplateMap::const_iterator i = m_LootTemplates.begin(); i != m_LootTemplates.end(); ++i)
|
||||
i->second->Verify(*this, i->first);
|
||||
}
|
||||
|
||||
|
|
@ -97,10 +98,10 @@ void LootStore::LoadLootTable()
|
|||
// Clearing store (for reloading case)
|
||||
Clear();
|
||||
|
||||
sLog.outString( "%s :", GetName());
|
||||
sLog.outString("%s :", GetName());
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, groupid, mincountOrRef, maxcount, condition_id FROM %s",GetName());
|
||||
QueryResult* result = WorldDatabase.PQuery("SELECT entry, item, ChanceOrQuestChance, groupid, mincountOrRef, maxcount, condition_id FROM %s",GetName());
|
||||
|
||||
if (result)
|
||||
{
|
||||
|
|
@ -108,7 +109,7 @@ void LootStore::LoadLootTable()
|
|||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
|
@ -152,7 +153,7 @@ void LootStore::LoadLootTable()
|
|||
{
|
||||
// Searching the template (in case template Id changed)
|
||||
tab = m_LootTemplates.find(entry);
|
||||
if ( tab == m_LootTemplates.end() )
|
||||
if (tab == m_LootTemplates.end())
|
||||
{
|
||||
std::pair< LootTemplateMap::iterator, bool > pr = m_LootTemplates.insert(LootTemplateMap::value_type(entry, new LootTemplate));
|
||||
tab = pr.first;
|
||||
|
|
@ -165,26 +166,27 @@ void LootStore::LoadLootTable()
|
|||
tab->second->AddEntry(storeitem);
|
||||
++count;
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
Verify(); // Checks validity of the loot store
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %u loot definitions (%lu templates)", count, (unsigned long)m_LootTemplates.size());
|
||||
sLog.outString(">> Loaded %u loot definitions (%lu templates)", count, (unsigned long)m_LootTemplates.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outString();
|
||||
sLog.outErrorDb( ">> Loaded 0 loot definitions. DB table `%s` is empty.",GetName() );
|
||||
sLog.outErrorDb(">> Loaded 0 loot definitions. DB table `%s` is empty.",GetName());
|
||||
}
|
||||
}
|
||||
|
||||
bool LootStore::HaveQuestLootFor(uint32 loot_id) const
|
||||
{
|
||||
LootTemplateMap::const_iterator itr = m_LootTemplates.find(loot_id);
|
||||
if(itr == m_LootTemplates.end())
|
||||
if (itr == m_LootTemplates.end())
|
||||
return false;
|
||||
|
||||
// scan loot for quest items
|
||||
|
|
@ -215,20 +217,20 @@ void LootStore::LoadAndCollectLootIds(LootIdSet& ids_set)
|
|||
{
|
||||
LoadLootTable();
|
||||
|
||||
for(LootTemplateMap::const_iterator tab = m_LootTemplates.begin(); tab != m_LootTemplates.end(); ++tab)
|
||||
for (LootTemplateMap::const_iterator tab = m_LootTemplates.begin(); tab != m_LootTemplates.end(); ++tab)
|
||||
ids_set.insert(tab->first);
|
||||
}
|
||||
|
||||
void LootStore::CheckLootRefs(LootIdSet* ref_set) const
|
||||
{
|
||||
for(LootTemplateMap::const_iterator ltItr = m_LootTemplates.begin(); ltItr != m_LootTemplates.end(); ++ltItr)
|
||||
for (LootTemplateMap::const_iterator ltItr = m_LootTemplates.begin(); ltItr != m_LootTemplates.end(); ++ltItr)
|
||||
ltItr->second->CheckLootRefs(ref_set);
|
||||
}
|
||||
|
||||
void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
|
||||
{
|
||||
// all still listed ids isn't referenced
|
||||
for(LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr)
|
||||
for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr)
|
||||
sLog.outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr,GetEntryName());
|
||||
}
|
||||
|
||||
|
|
@ -245,13 +247,13 @@ void LootStore::ReportNotExistedId(uint32 id) const
|
|||
// RATE_DROP_ITEMS is no longer used for all types of entries
|
||||
bool LootStoreItem::Roll(bool rate) const
|
||||
{
|
||||
if(chance>=100.0f)
|
||||
if (chance>=100.0f)
|
||||
return true;
|
||||
|
||||
if(mincountOrRef < 0) // reference case
|
||||
if (mincountOrRef < 0) // reference case
|
||||
return roll_chance_f(chance* (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_REFERENCED) : 1.0f));
|
||||
|
||||
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid);
|
||||
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
|
||||
|
||||
float qualityModifier = pProto && rate ? sWorld.getConfig(qualityToRate[pProto->Quality]) : 1.0f;
|
||||
|
||||
|
|
@ -275,8 +277,8 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
|
|||
|
||||
if (mincountOrRef > 0) // item (quest or non-quest) entry, maybe grouped
|
||||
{
|
||||
ItemPrototype const *proto = ObjectMgr::GetItemPrototype(itemid);
|
||||
if(!proto)
|
||||
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemid);
|
||||
if (!proto)
|
||||
{
|
||||
sLog.outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid);
|
||||
return false;
|
||||
|
|
@ -361,13 +363,13 @@ LootItem::LootItem(uint32 itemid_, uint32 count_, uint32 randomSuffix_, int32 ra
|
|||
}
|
||||
|
||||
// Basic checks for player/item compatibility - if false no chance to see the item in the loot
|
||||
bool LootItem::AllowedForPlayer(Player const * player) const
|
||||
bool LootItem::AllowedForPlayer(Player const* player) const
|
||||
{
|
||||
// DB conditions check
|
||||
if (conditionId && !sObjectMgr.IsPlayerMeetToNEWCondition(player, conditionId))
|
||||
return false;
|
||||
|
||||
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid);
|
||||
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
|
||||
if (!pProto)
|
||||
return false;
|
||||
|
||||
|
|
@ -378,10 +380,10 @@ bool LootItem::AllowedForPlayer(Player const * player) const
|
|||
if ((pProto->Flags2 & ITEM_FLAG2_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
|
||||
return false;
|
||||
|
||||
if ( needs_quest )
|
||||
if (needs_quest)
|
||||
{
|
||||
// Checking quests for quest-only drop (check only quests requirements in this case)
|
||||
if( !player->HasQuestForItem(itemid) )
|
||||
if (!player->HasQuestForItem(itemid))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
|
|
@ -420,7 +422,7 @@ LootSlotType LootItem::GetSlotTypeForSharedLoot(PermissionTypes permission, Play
|
|||
//
|
||||
|
||||
// Inserts the item into the loot (called by LootTemplate processors)
|
||||
void Loot::AddItem(LootStoreItem const & item)
|
||||
void Loot::AddItem(LootStoreItem const& item)
|
||||
{
|
||||
if (item.needs_quest) // Quest drop
|
||||
{
|
||||
|
|
@ -447,7 +449,7 @@ void Loot::AddItem(LootStoreItem const & item)
|
|||
bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError)
|
||||
{
|
||||
// Must be provided
|
||||
if(!loot_owner)
|
||||
if (!loot_owner)
|
||||
return false;
|
||||
|
||||
LootTemplate const* tab = store.GetLootFor(loot_id);
|
||||
|
|
@ -462,14 +464,14 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
|
|||
items.reserve(MAX_NR_LOOT_ITEMS);
|
||||
m_questItems.reserve(MAX_NR_QUEST_ITEMS);
|
||||
|
||||
tab->Process(*this, store,store.IsRatesAllowed ()); // Processing is done there, callback via Loot::AddItem()
|
||||
tab->Process(*this, store,store.IsRatesAllowed()); // Processing is done there, callback via Loot::AddItem()
|
||||
|
||||
// Setting access rights for group loot case
|
||||
Group * pGroup=loot_owner->GetGroup();
|
||||
if(!personal && pGroup)
|
||||
Group* pGroup=loot_owner->GetGroup();
|
||||
if (!personal && pGroup)
|
||||
{
|
||||
for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
if(Player* pl = itr->getSource())
|
||||
for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
if (Player* pl = itr->getSource())
|
||||
FillNotNormalLootFor(pl);
|
||||
}
|
||||
// ... for personal loot
|
||||
|
|
@ -498,12 +500,12 @@ void Loot::FillNotNormalLootFor(Player* pl)
|
|||
|
||||
QuestItemList* Loot::FillFFALoot(Player* player)
|
||||
{
|
||||
QuestItemList *ql = new QuestItemList();
|
||||
QuestItemList* ql = new QuestItemList();
|
||||
|
||||
for(uint8 i = 0; i < items.size(); ++i)
|
||||
for (uint8 i = 0; i < items.size(); ++i)
|
||||
{
|
||||
LootItem &item = items[i];
|
||||
if(!item.is_looted && item.freeforall && item.AllowedForPlayer(player) )
|
||||
LootItem& item = items[i];
|
||||
if (!item.is_looted && item.freeforall && item.AllowedForPlayer(player))
|
||||
{
|
||||
ql->push_back(QuestItem(i));
|
||||
++unlootedCount;
|
||||
|
|
@ -522,12 +524,12 @@ QuestItemList* Loot::FillFFALoot(Player* player)
|
|||
QuestItemList* Loot::FillQuestLoot(Player* player)
|
||||
{
|
||||
if (items.size() == MAX_NR_LOOT_ITEMS) return NULL;
|
||||
QuestItemList *ql = new QuestItemList();
|
||||
QuestItemList* ql = new QuestItemList();
|
||||
|
||||
for(uint8 i = 0; i < m_questItems.size(); ++i)
|
||||
for (uint8 i = 0; i < m_questItems.size(); ++i)
|
||||
{
|
||||
LootItem &item = m_questItems[i];
|
||||
if(!item.is_looted && item.AllowedForPlayer(player) )
|
||||
LootItem& item = m_questItems[i];
|
||||
if (!item.is_looted && item.AllowedForPlayer(player))
|
||||
{
|
||||
ql->push_back(QuestItem(i));
|
||||
|
||||
|
|
@ -556,15 +558,15 @@ QuestItemList* Loot::FillQuestLoot(Player* player)
|
|||
|
||||
QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player)
|
||||
{
|
||||
QuestItemList *ql = new QuestItemList();
|
||||
QuestItemList* ql = new QuestItemList();
|
||||
|
||||
for(uint8 i = 0; i < items.size(); ++i)
|
||||
for (uint8 i = 0; i < items.size(); ++i)
|
||||
{
|
||||
LootItem &item = items[i];
|
||||
if(!item.is_looted && !item.freeforall && item.conditionId && item.AllowedForPlayer(player))
|
||||
LootItem& item = items[i];
|
||||
if (!item.is_looted && !item.freeforall && item.conditionId && item.AllowedForPlayer(player))
|
||||
{
|
||||
ql->push_back(QuestItem(i));
|
||||
if(!item.is_counted)
|
||||
if (!item.is_counted)
|
||||
{
|
||||
++unlootedCount;
|
||||
item.is_counted=true;
|
||||
|
|
@ -648,7 +650,7 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
|
|||
}
|
||||
}
|
||||
|
||||
void Loot::generateMoneyLoot( uint32 minAmount, uint32 maxAmount )
|
||||
void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
|
||||
{
|
||||
if (maxAmount > 0)
|
||||
{
|
||||
|
|
@ -661,7 +663,7 @@ void Loot::generateMoneyLoot( uint32 minAmount, uint32 maxAmount )
|
|||
}
|
||||
}
|
||||
|
||||
LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qitem, QuestItem **ffaitem, QuestItem **conditem)
|
||||
LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem** qitem, QuestItem** ffaitem, QuestItem** conditem)
|
||||
{
|
||||
LootItem* item = NULL;
|
||||
bool is_looted = true;
|
||||
|
|
@ -671,8 +673,8 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
|
|||
QuestItemMap::const_iterator itr = m_playerQuestItems.find(player->GetGUIDLow());
|
||||
if (itr != m_playerQuestItems.end() && questSlot < itr->second->size())
|
||||
{
|
||||
QuestItem *qitem2 = &itr->second->at(questSlot);
|
||||
if(qitem)
|
||||
QuestItem* qitem2 = &itr->second->at(questSlot);
|
||||
if (qitem)
|
||||
*qitem = qitem2;
|
||||
item = &m_questItems[qitem2->index];
|
||||
is_looted = qitem2->is_looted;
|
||||
|
|
@ -682,16 +684,16 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
|
|||
{
|
||||
item = &items[lootSlot];
|
||||
is_looted = item->is_looted;
|
||||
if(item->freeforall)
|
||||
if (item->freeforall)
|
||||
{
|
||||
QuestItemMap::const_iterator itr = m_playerFFAItems.find(player->GetGUIDLow());
|
||||
if (itr != m_playerFFAItems.end())
|
||||
{
|
||||
for(QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
|
||||
if(iter->index==lootSlot)
|
||||
for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
|
||||
if (iter->index==lootSlot)
|
||||
{
|
||||
QuestItem *ffaitem2 = (QuestItem*)&(*iter);
|
||||
if(ffaitem)
|
||||
QuestItem* ffaitem2 = (QuestItem*)&(*iter);
|
||||
if (ffaitem)
|
||||
*ffaitem = ffaitem2;
|
||||
is_looted = ffaitem2->is_looted;
|
||||
break;
|
||||
|
|
@ -703,12 +705,12 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
|
|||
QuestItemMap::const_iterator itr = m_playerNonQuestNonFFAConditionalItems.find(player->GetGUIDLow());
|
||||
if (itr != m_playerNonQuestNonFFAConditionalItems.end())
|
||||
{
|
||||
for(QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
|
||||
for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter)
|
||||
{
|
||||
if(iter->index==lootSlot)
|
||||
if (iter->index==lootSlot)
|
||||
{
|
||||
QuestItem *conditem2 = (QuestItem*)&(*iter);
|
||||
if(conditem)
|
||||
QuestItem* conditem2 = (QuestItem*)&(*iter);
|
||||
if (conditem)
|
||||
*conditem = conditem2;
|
||||
is_looted = conditem2->is_looted;
|
||||
break;
|
||||
|
|
@ -718,7 +720,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite
|
|||
}
|
||||
}
|
||||
|
||||
if(is_looted)
|
||||
if (is_looted)
|
||||
return NULL;
|
||||
|
||||
return item;
|
||||
|
|
@ -750,7 +752,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||
return b; // nothing output more
|
||||
}
|
||||
|
||||
Loot &l = lv.loot;
|
||||
Loot& l = lv.loot;
|
||||
|
||||
uint8 itemsShown = 0;
|
||||
|
||||
|
|
@ -779,10 +781,10 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||
QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow());
|
||||
if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
|
||||
{
|
||||
QuestItemList *conditional_list = nn_itr->second;
|
||||
QuestItemList* conditional_list = nn_itr->second;
|
||||
for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci)
|
||||
{
|
||||
LootItem &item = l.items[ci->index];
|
||||
LootItem& item = l.items[ci->index];
|
||||
|
||||
LootSlotType slot_type = item.GetSlotTypeForSharedLoot(lv.permission, lv.viewer, !ci->is_looted);
|
||||
if (slot_type >= MAX_LOOT_SLOT_TYPE)
|
||||
|
|
@ -801,10 +803,10 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||
QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow());
|
||||
if (q_itr != lootPlayerQuestItems.end())
|
||||
{
|
||||
QuestItemList *q_list = q_itr->second;
|
||||
QuestItemList* q_list = q_itr->second;
|
||||
for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi)
|
||||
{
|
||||
LootItem &item = l.m_questItems[qi->index];
|
||||
LootItem& item = l.m_questItems[qi->index];
|
||||
if (!qi->is_looted && !item.is_looted)
|
||||
{
|
||||
b << uint8(l.items.size() + (qi - q_list->begin()));
|
||||
|
|
@ -819,10 +821,10 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
|
|||
QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(lv.viewer->GetGUIDLow());
|
||||
if (ffa_itr != lootPlayerFFAItems.end())
|
||||
{
|
||||
QuestItemList *ffa_list = ffa_itr->second;
|
||||
QuestItemList* ffa_list = ffa_itr->second;
|
||||
for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi)
|
||||
{
|
||||
LootItem &item = l.items[fi->index];
|
||||
LootItem& item = l.items[fi->index];
|
||||
if (!fi->is_looted && !item.is_looted)
|
||||
{
|
||||
b << uint8(fi->index) << item;
|
||||
|
|
@ -852,7 +854,7 @@ void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
|
|||
}
|
||||
|
||||
// Rolls an item from the group, returns NULL if all miss their chances
|
||||
LootStoreItem const * LootTemplate::LootGroup::Roll() const
|
||||
LootStoreItem const* LootTemplate::LootGroup::Roll() const
|
||||
{
|
||||
if (!ExplicitlyChanced.empty()) // First explicitly chanced entries are checked
|
||||
{
|
||||
|
|
@ -860,7 +862,7 @@ LootStoreItem const * LootTemplate::LootGroup::Roll() const
|
|||
|
||||
for (uint32 i=0; i<ExplicitlyChanced.size(); ++i) //check each explicitly chanced entry in the template and modify its chance based on quality.
|
||||
{
|
||||
if(ExplicitlyChanced[i].chance>=100.0f)
|
||||
if (ExplicitlyChanced[i].chance>=100.0f)
|
||||
return &ExplicitlyChanced[i];
|
||||
|
||||
Roll -= ExplicitlyChanced[i].chance;
|
||||
|
|
@ -887,7 +889,7 @@ bool LootTemplate::LootGroup::HasQuestDrop() const
|
|||
}
|
||||
|
||||
// True if group includes at least 1 quest drop entry for active quests of the player
|
||||
bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const * player) const
|
||||
bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const* player) const
|
||||
{
|
||||
for (LootStoreItemList::const_iterator i=ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
|
||||
if (player->HasQuestForItem(i->itemid))
|
||||
|
|
@ -901,7 +903,7 @@ bool LootTemplate::LootGroup::HasQuestDropForPlayer(Player const * player) const
|
|||
// Rolls an item from the group (if any takes its chance) and adds the item to the loot
|
||||
void LootTemplate::LootGroup::Process(Loot& loot) const
|
||||
{
|
||||
LootStoreItem const * item = Roll();
|
||||
LootStoreItem const* item = Roll();
|
||||
if (item != NULL)
|
||||
loot.AddItem(*item);
|
||||
}
|
||||
|
|
@ -912,7 +914,7 @@ float LootTemplate::LootGroup::RawTotalChance() const
|
|||
float result = 0;
|
||||
|
||||
for (LootStoreItemList::const_iterator i=ExplicitlyChanced.begin(); i != ExplicitlyChanced.end(); ++i)
|
||||
if ( !i->needs_quest )
|
||||
if (!i->needs_quest)
|
||||
result += i->chance;
|
||||
|
||||
return result;
|
||||
|
|
@ -937,7 +939,7 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint
|
|||
sLog.outErrorDb("Table '%s' entry %u group %d has total chance > 100%% (%f)", lootstore.GetName(), id, group_id, chance);
|
||||
}
|
||||
|
||||
if(chance >= 100.0f && !EqualChanced.empty())
|
||||
if (chance >= 100.0f && !EqualChanced.empty())
|
||||
{
|
||||
sLog.outErrorDb("Table '%s' entry %u group %d has items with chance=0%% but group total chance >= 100%% (%f)", lootstore.GetName(), id, group_id, chance);
|
||||
}
|
||||
|
|
@ -947,22 +949,22 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
|
|||
{
|
||||
for (LootStoreItemList::const_iterator ieItr=ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr)
|
||||
{
|
||||
if(ieItr->mincountOrRef < 0)
|
||||
if (ieItr->mincountOrRef < 0)
|
||||
{
|
||||
if(!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||
else if(ref_set)
|
||||
else if (ref_set)
|
||||
ref_set->erase(-ieItr->mincountOrRef);
|
||||
}
|
||||
}
|
||||
|
||||
for (LootStoreItemList::const_iterator ieItr=EqualChanced.begin(); ieItr != EqualChanced.end(); ++ieItr)
|
||||
{
|
||||
if(ieItr->mincountOrRef < 0)
|
||||
if (ieItr->mincountOrRef < 0)
|
||||
{
|
||||
if(!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||
else if(ref_set)
|
||||
else if (ref_set)
|
||||
ref_set->erase(-ieItr->mincountOrRef);
|
||||
}
|
||||
}
|
||||
|
|
@ -998,7 +1000,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||
}
|
||||
|
||||
// Rolling non-grouped items
|
||||
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i )
|
||||
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i)
|
||||
{
|
||||
if (!i->Roll(rate))
|
||||
continue; // Bad luck for the entry
|
||||
|
|
@ -1007,10 +1009,10 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||
{
|
||||
LootTemplate const* Referenced = LootTemplates_Reference.GetLootFor(-i->mincountOrRef);
|
||||
|
||||
if(!Referenced)
|
||||
if (!Referenced)
|
||||
continue; // Error message already printed at loading stage
|
||||
|
||||
for (uint32 loop=0; loop < i->maxcount; ++loop )// Ref multiplicator
|
||||
for (uint32 loop=0; loop < i->maxcount; ++loop) // Ref multiplicator
|
||||
Referenced->Process(loot, store, rate, i->group);
|
||||
}
|
||||
else // Plain entries (not a reference, not grouped)
|
||||
|
|
@ -1018,7 +1020,7 @@ void LootTemplate::Process(Loot& loot, LootStore const& store, bool rate, uint8
|
|||
}
|
||||
|
||||
// Now processing groups
|
||||
for (LootGroups::const_iterator i = Groups.begin( ) ; i != Groups.end( ) ; ++i )
|
||||
for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i)
|
||||
i->Process(loot);
|
||||
}
|
||||
|
||||
|
|
@ -1032,22 +1034,22 @@ bool LootTemplate::HasQuestDrop(LootTemplateMap const& store, uint8 groupId) con
|
|||
return Groups[groupId-1].HasQuestDrop();
|
||||
}
|
||||
|
||||
for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i )
|
||||
for (LootStoreItemList::const_iterator i = Entries.begin(); i != Entries.end(); ++i)
|
||||
{
|
||||
if (i->mincountOrRef < 0) // References
|
||||
{
|
||||
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
||||
if( Referenced ==store.end() )
|
||||
if (Referenced ==store.end())
|
||||
continue; // Error message [should be] already printed at loading stage
|
||||
if (Referenced->second->HasQuestDrop(store, i->group) )
|
||||
if (Referenced->second->HasQuestDrop(store, i->group))
|
||||
return true;
|
||||
}
|
||||
else if ( i->needs_quest )
|
||||
else if (i->needs_quest)
|
||||
return true; // quest drop found
|
||||
}
|
||||
|
||||
// Now processing groups
|
||||
for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i )
|
||||
for (LootGroups::const_iterator i = Groups.begin() ; i != Groups.end() ; ++i)
|
||||
if (i->HasQuestDrop())
|
||||
return true;
|
||||
|
||||
|
|
@ -1065,22 +1067,22 @@ bool LootTemplate::HasQuestDropForPlayer(LootTemplateMap const& store, Player co
|
|||
}
|
||||
|
||||
// Checking non-grouped entries
|
||||
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i )
|
||||
for (LootStoreItemList::const_iterator i = Entries.begin() ; i != Entries.end() ; ++i)
|
||||
{
|
||||
if (i->mincountOrRef < 0) // References processing
|
||||
{
|
||||
LootTemplateMap::const_iterator Referenced = store.find(-i->mincountOrRef);
|
||||
if (Referenced == store.end() )
|
||||
if (Referenced == store.end())
|
||||
continue; // Error message already printed at loading stage
|
||||
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group) )
|
||||
if (Referenced->second->HasQuestDropForPlayer(store, player, i->group))
|
||||
return true;
|
||||
}
|
||||
else if ( player->HasQuestForItem(i->itemid) )
|
||||
else if (player->HasQuestForItem(i->itemid))
|
||||
return true; // active quest drop found
|
||||
}
|
||||
|
||||
// Now checking groups
|
||||
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i )
|
||||
for (LootGroups::const_iterator i = Groups.begin(); i != Groups.end(); ++i)
|
||||
if (i->HasQuestDropForPlayer(player))
|
||||
return true;
|
||||
|
||||
|
|
@ -1099,18 +1101,18 @@ void LootTemplate::Verify(LootStore const& lootstore, uint32 id) const
|
|||
|
||||
void LootTemplate::CheckLootRefs(LootIdSet* ref_set) const
|
||||
{
|
||||
for(LootStoreItemList::const_iterator ieItr = Entries.begin(); ieItr != Entries.end(); ++ieItr)
|
||||
for (LootStoreItemList::const_iterator ieItr = Entries.begin(); ieItr != Entries.end(); ++ieItr)
|
||||
{
|
||||
if(ieItr->mincountOrRef < 0)
|
||||
if (ieItr->mincountOrRef < 0)
|
||||
{
|
||||
if(!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
if (!LootTemplates_Reference.GetLootFor(-ieItr->mincountOrRef))
|
||||
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
|
||||
else if(ref_set)
|
||||
else if (ref_set)
|
||||
ref_set->erase(-ieItr->mincountOrRef);
|
||||
}
|
||||
}
|
||||
|
||||
for(LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr)
|
||||
for (LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr)
|
||||
grItr->CheckLootRefs(ref_set);
|
||||
}
|
||||
|
||||
|
|
@ -1120,11 +1122,11 @@ void LoadLootTemplates_Creature()
|
|||
LootTemplates_Creature.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i )
|
||||
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
|
||||
{
|
||||
if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||
{
|
||||
if(uint32 lootid = cInfo->lootid)
|
||||
if (uint32 lootid = cInfo->lootid)
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Creature.ReportNotExistedId(lootid);
|
||||
|
|
@ -1133,7 +1135,7 @@ void LoadLootTemplates_Creature()
|
|||
}
|
||||
}
|
||||
}
|
||||
for(LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
|
||||
// for alterac valley we've defined Player-loot inside creature_loot_template id=0
|
||||
|
|
@ -1150,11 +1152,11 @@ void LoadLootTemplates_Disenchant()
|
|||
LootTemplates_Disenchant.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sItemStorage.MaxEntry; ++i )
|
||||
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
|
||||
{
|
||||
if(ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
||||
if (ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
||||
{
|
||||
if(uint32 lootid = proto->DisenchantID)
|
||||
if (uint32 lootid = proto->DisenchantID)
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Disenchant.ReportNotExistedId(lootid);
|
||||
|
|
@ -1163,7 +1165,7 @@ void LoadLootTemplates_Disenchant()
|
|||
}
|
||||
}
|
||||
}
|
||||
for(LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
LootTemplates_Disenchant.ReportUnusedIds(ids_set);
|
||||
|
|
@ -1175,9 +1177,9 @@ void LoadLootTemplates_Fishing()
|
|||
LootTemplates_Fishing.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sAreaStore.GetNumRows(); ++i )
|
||||
for (uint32 i = 1; i < sAreaStore.GetNumRows(); ++i)
|
||||
{
|
||||
if(AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
|
||||
if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
|
||||
if (ids_set.find(areaEntry->ID) != ids_set.end())
|
||||
ids_set.erase(areaEntry->ID);
|
||||
}
|
||||
|
|
@ -1195,11 +1197,11 @@ void LoadLootTemplates_Gameobject()
|
|||
LootTemplates_Gameobject.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sGOStorage.MaxEntry; ++i )
|
||||
for (uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
|
||||
{
|
||||
if(GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
|
||||
if (GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
|
||||
{
|
||||
if(uint32 lootid = gInfo->GetLootId())
|
||||
if (uint32 lootid = gInfo->GetLootId())
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Gameobject.ReportNotExistedId(lootid);
|
||||
|
|
@ -1208,7 +1210,7 @@ void LoadLootTemplates_Gameobject()
|
|||
}
|
||||
}
|
||||
}
|
||||
for(LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
|
|
@ -1221,9 +1223,9 @@ void LoadLootTemplates_Item()
|
|||
LootTemplates_Item.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sItemStorage.MaxEntry; ++i )
|
||||
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
|
||||
{
|
||||
if(ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
||||
if (ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
||||
{
|
||||
if (!(proto->Flags & ITEM_FLAG_LOOTABLE))
|
||||
continue;
|
||||
|
|
@ -1246,10 +1248,10 @@ void LoadLootTemplates_Milling()
|
|||
LootTemplates_Milling.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sItemStorage.MaxEntry; ++i )
|
||||
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
|
||||
{
|
||||
ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i);
|
||||
if(!proto)
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
if (!(proto->Flags & ITEM_FLAG_MILLABLE))
|
||||
|
|
@ -1271,11 +1273,11 @@ void LoadLootTemplates_Pickpocketing()
|
|||
LootTemplates_Pickpocketing.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i )
|
||||
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
|
||||
{
|
||||
if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||
{
|
||||
if(uint32 lootid = cInfo->pickpocketLootId)
|
||||
if (uint32 lootid = cInfo->pickpocketLootId)
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
|
||||
|
|
@ -1284,7 +1286,7 @@ void LoadLootTemplates_Pickpocketing()
|
|||
}
|
||||
}
|
||||
}
|
||||
for(LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
|
|
@ -1297,7 +1299,7 @@ void LoadLootTemplates_Prospecting()
|
|||
LootTemplates_Prospecting.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sItemStorage.MaxEntry; ++i )
|
||||
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
|
||||
{
|
||||
ItemPrototype const* proto = sItemStorage.LookupEntry<ItemPrototype>(i);
|
||||
if (!proto)
|
||||
|
|
@ -1322,8 +1324,8 @@ void LoadLootTemplates_Mail()
|
|||
LootTemplates_Mail.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i )
|
||||
if(sMailTemplateStore.LookupEntry(i))
|
||||
for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
|
||||
if (sMailTemplateStore.LookupEntry(i))
|
||||
if (ids_set.find(i) != ids_set.end())
|
||||
ids_set.erase(i);
|
||||
|
||||
|
|
@ -1337,11 +1339,11 @@ void LoadLootTemplates_Skinning()
|
|||
LootTemplates_Skinning.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i )
|
||||
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
|
||||
{
|
||||
if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
|
||||
{
|
||||
if(uint32 lootid = cInfo->SkinLootId)
|
||||
if (uint32 lootid = cInfo->SkinLootId)
|
||||
{
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Skinning.ReportNotExistedId(lootid);
|
||||
|
|
@ -1350,7 +1352,7 @@ void LoadLootTemplates_Skinning()
|
|||
}
|
||||
}
|
||||
}
|
||||
for(LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
|
||||
ids_set.erase(*itr);
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
|
|
@ -1363,14 +1365,14 @@ void LoadLootTemplates_Spell()
|
|||
LootTemplates_Spell.LoadAndCollectLootIds(ids_set);
|
||||
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
|
||||
for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
|
||||
{
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry (spell_id);
|
||||
if(!spellInfo)
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell_id);
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
// possible cases
|
||||
if( !IsLootCraftingSpell(spellInfo))
|
||||
if (!IsLootCraftingSpell(spellInfo))
|
||||
continue;
|
||||
|
||||
if (ids_set.find(spell_id) == ids_set.end())
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ struct LootItem
|
|||
LootItem(uint32 itemid_, uint32 count_, uint32 randomSuffix_ = 0, int32 randomPropertyId_ = 0);
|
||||
|
||||
// Basic checks for player/item compatibility - if false no chance to see the item in the loot
|
||||
bool AllowedForPlayer(Player const * player) const;
|
||||
bool AllowedForPlayer(Player const* player) const;
|
||||
LootSlotType GetSlotTypeForSharedLoot(PermissionTypes permission, Player* viewer, bool condition_ok = false) const;
|
||||
};
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ struct Loot;
|
|||
class LootTemplate;
|
||||
|
||||
typedef std::vector<QuestItem> QuestItemList;
|
||||
typedef std::map<uint32, QuestItemList *> QuestItemMap;
|
||||
typedef std::map<uint32, QuestItemList*> QuestItemMap;
|
||||
typedef std::vector<LootStoreItem> LootStoreItemList;
|
||||
typedef UNORDERED_MAP<uint32, LootTemplate*> LootTemplateMap;
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ class LootTemplate
|
|||
// True if template includes at least 1 quest drop entry
|
||||
bool HasQuestDrop(LootTemplateMap const& store, uint8 GroupId = 0) const;
|
||||
// True if template includes at least 1 quest drop for an active quest of the player
|
||||
bool HasQuestDropForPlayer(LootTemplateMap const& store, Player const * player, uint8 GroupId = 0) const;
|
||||
bool HasQuestDropForPlayer(LootTemplateMap const& store, Player const* player, uint8 GroupId = 0) const;
|
||||
|
||||
// Checks integrity of the template
|
||||
void Verify(LootStore const& store, uint32 Id) const;
|
||||
|
|
@ -290,7 +290,7 @@ struct Loot
|
|||
bool FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner, bool personal, bool noEmptyError = false);
|
||||
|
||||
// Inserts the item into the loot (called by LootTemplate processors)
|
||||
void AddItem(LootStoreItem const & item);
|
||||
void AddItem(LootStoreItem const& item);
|
||||
|
||||
LootItem* LootItemInSlot(uint32 lootslot, Player* player, QuestItem** qitem = NULL, QuestItem** ffaitem = NULL, QuestItem** conditem = NULL);
|
||||
uint32 GetMaxSlotInLootFor(Player* player) const;
|
||||
|
|
@ -315,10 +315,10 @@ struct Loot
|
|||
|
||||
struct LootView
|
||||
{
|
||||
Loot &loot;
|
||||
Player *viewer;
|
||||
Loot& loot;
|
||||
Player* viewer;
|
||||
PermissionTypes permission;
|
||||
LootView(Loot &_loot, Player *_viewer,PermissionTypes _permission = ALL_PERMISSION)
|
||||
LootView(Loot& _loot, Player* _viewer,PermissionTypes _permission = ALL_PERMISSION)
|
||||
: loot(_loot), viewer(_viewer), permission(_permission) {}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@
|
|||
* @param sender The object/player sending this mail.
|
||||
* @param stationery The stationary associated with this sender.
|
||||
*/
|
||||
MailSender::MailSender( Object* sender, MailStationery stationery ) : m_stationery(stationery)
|
||||
MailSender::MailSender(Object* sender, MailStationery stationery) : m_stationery(stationery)
|
||||
{
|
||||
switch(sender->GetTypeId())
|
||||
switch (sender->GetTypeId())
|
||||
{
|
||||
case TYPEID_UNIT:
|
||||
m_messageType = MAIL_CREATURE;
|
||||
|
|
@ -63,7 +63,7 @@ MailSender::MailSender( Object* sender, MailStationery stationery ) : m_statione
|
|||
default:
|
||||
m_messageType = MAIL_NORMAL;
|
||||
m_senderId = 0; // will show mail from nonexistent player
|
||||
sLog.outError( "MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId());
|
||||
sLog.outError("MailSender::MailSender - Mail have unexpected sender typeid (%u)", sender->GetTypeId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +72,7 @@ MailSender::MailSender( Object* sender, MailStationery stationery ) : m_statione
|
|||
*
|
||||
* @param sender the AuctionEntry from which this mail is generated.
|
||||
*/
|
||||
MailSender::MailSender( AuctionEntry* sender )
|
||||
MailSender::MailSender(AuctionEntry* sender)
|
||||
: m_messageType(MAIL_AUCTION), m_senderId(sender->GetHouseId()), m_stationery(MAIL_STATIONERY_AUCTION)
|
||||
{
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ MailReceiver::MailReceiver(Player* receiver, ObjectGuid receiver_guid) : m_recei
|
|||
* @param item The item to be added to the MailDraft.
|
||||
* @returns the MailDraft the item was added to.
|
||||
*/
|
||||
MailDraft& MailDraft::AddItem( Item* item )
|
||||
MailDraft& MailDraft::AddItem(Item* item)
|
||||
{
|
||||
m_items[item->GetGUIDLow()] = item;
|
||||
return *this;
|
||||
|
|
@ -123,7 +123,7 @@ bool MailDraft::prepareItems(Player* receiver)
|
|||
mailLoot.FillLoot(m_mailTemplateId, LootTemplates_Mail, receiver, true, true);
|
||||
|
||||
uint32 max_slot = mailLoot.GetMaxSlotInLootFor(receiver);
|
||||
for(uint32 i = 0; m_items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
||||
for (uint32 i = 0; m_items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
||||
{
|
||||
if (LootItem* lootitem = mailLoot.LootItemInSlot(i, receiver))
|
||||
{
|
||||
|
|
@ -142,13 +142,13 @@ bool MailDraft::prepareItems(Player* receiver)
|
|||
*
|
||||
* @param inDB A boolean specifying whether the change should be saved to the database or not.
|
||||
*/
|
||||
void MailDraft::deleteIncludedItems( bool inDB /**= false*/ )
|
||||
void MailDraft::deleteIncludedItems(bool inDB /**= false*/)
|
||||
{
|
||||
for(MailItemMap::iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
for (MailItemMap::iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
{
|
||||
Item* item = mailItemIter->second;
|
||||
|
||||
if(inDB)
|
||||
if (inDB)
|
||||
CharacterDatabase.PExecute("DELETE FROM item_instance WHERE guid='%u'", item->GetGUIDLow());
|
||||
|
||||
delete item;
|
||||
|
|
@ -171,11 +171,11 @@ void MailDraft::CloneFrom(MailDraft const& draft)
|
|||
m_money = draft.GetMoney();
|
||||
m_COD = draft.GetCOD();
|
||||
|
||||
for(MailItemMap::const_iterator mailItemIter = draft.m_items.begin(); mailItemIter != draft.m_items.end(); ++mailItemIter)
|
||||
for (MailItemMap::const_iterator mailItemIter = draft.m_items.begin(); mailItemIter != draft.m_items.end(); ++mailItemIter)
|
||||
{
|
||||
Item* item = mailItemIter->second;
|
||||
|
||||
if(Item* newitem = item->CloneItem(item->GetCount()))
|
||||
if (Item* newitem = item->CloneItem(item->GetCount()))
|
||||
{
|
||||
newitem->SaveToDB();
|
||||
AddItem(newitem);
|
||||
|
|
@ -191,7 +191,7 @@ void MailDraft::CloneFrom(MailDraft const& draft)
|
|||
*/
|
||||
void MailDraft::SendReturnToSender(uint32 sender_acc, ObjectGuid sender_guid, ObjectGuid receiver_guid)
|
||||
{
|
||||
Player *receiver = sObjectMgr.GetPlayer(receiver_guid);
|
||||
Player* receiver = sObjectMgr.GetPlayer(receiver_guid);
|
||||
|
||||
uint32 rc_account = 0;
|
||||
if (!receiver)
|
||||
|
|
@ -286,7 +286,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
|||
"VALUES ('%u', '%u', '%u', '%u', '%u', '%u', '%s', '%s', '%u', '" UI64FMTD "','" UI64FMTD "', '%u', '%u', '%u')",
|
||||
mailId, sender.GetMailMessageType(), sender.GetStationery(), GetMailTemplateId(), sender.GetSenderId(), receiver.GetPlayerGuid().GetCounter(), safe_subject.c_str(), safe_body.c_str(), (has_items ? 1 : 0), (uint64)expire_time, (uint64)deliver_time, m_money, m_COD, checked);
|
||||
|
||||
for(MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
for (MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
{
|
||||
Item* item = mailItemIter->second;
|
||||
CharacterDatabase.PExecute("INSERT INTO mail_items (mail_id,item_guid,item_template,receiver) VALUES ('%u', '%u', '%u','%u')",
|
||||
|
|
@ -299,7 +299,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
|||
{
|
||||
pReceiver->AddNewMailDeliverTime(deliver_time);
|
||||
|
||||
Mail *m = new Mail;
|
||||
Mail* m = new Mail;
|
||||
m->messageID = mailId;
|
||||
m->mailTemplateId = GetMailTemplateId();
|
||||
m->subject = GetSubject();
|
||||
|
|
@ -307,7 +307,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
|||
m->money = GetMoney();
|
||||
m->COD = GetCOD();
|
||||
|
||||
for(MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
for (MailItemMap::const_iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
{
|
||||
Item* item = mailItemIter->second;
|
||||
m->AddItem(item->GetGUIDLow(), item->GetEntry());
|
||||
|
|
@ -326,7 +326,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
|||
|
||||
if (!m_items.empty())
|
||||
{
|
||||
for(MailItemMap::iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
for (MailItemMap::iterator mailItemIter = m_items.begin(); mailItemIter != m_items.end(); ++mailItemIter)
|
||||
pReceiver->AddMItem(mailItemIter->second);
|
||||
}
|
||||
}
|
||||
|
|
@ -340,7 +340,7 @@ void MailDraft::SendMailTo(MailReceiver const& receiver, MailSender const& sende
|
|||
* @param receiver reciver of mail
|
||||
*/
|
||||
|
||||
void Mail::prepareTemplateItems( Player* receiver )
|
||||
void Mail::prepareTemplateItems(Player* receiver)
|
||||
{
|
||||
if (!mailTemplateId || !items.empty())
|
||||
return;
|
||||
|
|
@ -356,7 +356,7 @@ void Mail::prepareTemplateItems( Player* receiver )
|
|||
CharacterDatabase.PExecute("UPDATE mail SET has_items = 1 WHERE id = %u", messageID);
|
||||
|
||||
uint32 max_slot = mailLoot.GetMaxSlotInLootFor(receiver);
|
||||
for(uint32 i = 0; items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
||||
for (uint32 i = 0; items.size() < MAX_MAIL_ITEMS && i < max_slot; ++i)
|
||||
{
|
||||
if (LootItem* lootitem = mailLoot.LootItemInSlot(i, receiver))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -348,9 +348,9 @@ struct Mail
|
|||
*/
|
||||
bool RemoveItem(uint32 item_guid)
|
||||
{
|
||||
for(MailItemInfoVec::iterator itr = items.begin(); itr != items.end(); ++itr)
|
||||
for (MailItemInfoVec::iterator itr = items.begin(); itr != items.end(); ++itr)
|
||||
{
|
||||
if(itr->item_guid == item_guid)
|
||||
if (itr->item_guid == item_guid)
|
||||
{
|
||||
items.erase(itr);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ bool WorldSession::CheckMailBox(ObjectGuid guid)
|
|||
*
|
||||
* @param recv_data the WorldPacket containing the data sent by the client.
|
||||
*/
|
||||
void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
||||
void WorldSession::HandleSendMail(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid mailboxGuid;
|
||||
uint64 unk3;
|
||||
|
|
@ -133,7 +133,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
|
||||
ObjectGuid itemGuids[MAX_MAIL_ITEMS];
|
||||
|
||||
for(uint8 i = 0; i < items_count; ++i)
|
||||
for (uint8 i = 0; i < items_count; ++i)
|
||||
{
|
||||
recv_data.read_skip<uint8>(); // item slot in mail, not used
|
||||
recv_data >> itemGuids[i];
|
||||
|
|
@ -184,7 +184,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
Player *receive = sObjectMgr.GetPlayer(rc);
|
||||
Player* receive = sObjectMgr.GetPlayer(rc);
|
||||
|
||||
Team rc_team;
|
||||
uint8 mails_count = 0; // do not allow to send to one player more than 100 mails
|
||||
|
|
@ -199,7 +199,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
rc_team = sObjectMgr.GetPlayerTeamByGUID(rc);
|
||||
if (QueryResult* result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", rc.GetCounter()))
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
mails_count = fields[0].GetUInt32();
|
||||
delete result;
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
|
||||
Item* items[MAX_MAIL_ITEMS];
|
||||
|
||||
for(uint8 i = 0; i < items_count; ++i)
|
||||
for (uint8 i = 0; i < items_count; ++i)
|
||||
{
|
||||
if (!itemGuids[i].IsItem())
|
||||
{
|
||||
|
|
@ -236,7 +236,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
Item* item = pl->GetItemByGuid(itemGuids[i]);
|
||||
|
||||
// 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);
|
||||
return;
|
||||
|
|
@ -271,7 +271,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
|
||||
pl->SendMailResult(0, MAIL_SEND, MAIL_OK);
|
||||
|
||||
pl->ModifyMoney( -int32(reqmoney) );
|
||||
pl->ModifyMoney(-int32(reqmoney));
|
||||
pl->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_MAIL, cost);
|
||||
|
||||
bool needItemDelay = false;
|
||||
|
|
@ -282,7 +282,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
{
|
||||
if (items_count > 0)
|
||||
{
|
||||
for(uint8 i = 0; i < items_count; ++i)
|
||||
for (uint8 i = 0; i < items_count; ++i)
|
||||
{
|
||||
Item* item = items[i];
|
||||
if (GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE))
|
||||
|
|
@ -338,7 +338,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||
* @param recv_data the packet containing information about the mail the player read.
|
||||
*
|
||||
*/
|
||||
void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data )
|
||||
void WorldSession::HandleMailMarkAsRead(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid mailboxGuid;
|
||||
uint32 mailId;
|
||||
|
|
@ -348,9 +348,9 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data )
|
|||
if (!CheckMailBox(mailboxGuid))
|
||||
return;
|
||||
|
||||
Player *pl = _player;
|
||||
Player* pl = _player;
|
||||
|
||||
if (Mail *m = pl->GetMail(mailId))
|
||||
if (Mail* m = pl->GetMail(mailId))
|
||||
{
|
||||
if (pl->unReadMails)
|
||||
--pl->unReadMails;
|
||||
|
|
@ -368,7 +368,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data )
|
|||
* @param recv_data The packet containing information about the mail being deleted.
|
||||
*
|
||||
*/
|
||||
void WorldSession::HandleMailDelete(WorldPacket & recv_data )
|
||||
void WorldSession::HandleMailDelete(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid mailboxGuid;
|
||||
uint32 mailId;
|
||||
|
|
@ -382,7 +382,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data )
|
|||
Player* pl = _player;
|
||||
pl->m_mailsUpdated = true;
|
||||
|
||||
if(Mail *m = pl->GetMail(mailId))
|
||||
if (Mail* m = pl->GetMail(mailId))
|
||||
{
|
||||
// delete shouldn't show up for COD mails
|
||||
if (m->COD)
|
||||
|
|
@ -404,7 +404,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data )
|
|||
* @param recv_data The packet containing information about the mail being returned.
|
||||
*
|
||||
*/
|
||||
void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
|
||||
void WorldSession::HandleMailReturnToSender(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid mailboxGuid;
|
||||
uint32 mailId;
|
||||
|
|
@ -415,9 +415,9 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
|
|||
if (!CheckMailBox(mailboxGuid))
|
||||
return;
|
||||
|
||||
Player *pl = _player;
|
||||
Mail *m = pl->GetMail(mailId);
|
||||
if(!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
Player* pl = _player;
|
||||
Mail* m = pl->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
|
|
@ -441,11 +441,11 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
|
|||
else
|
||||
draft.SetSubjectAndBody(m->subject, m->body);
|
||||
|
||||
if(m->HasItems())
|
||||
if (m->HasItems())
|
||||
{
|
||||
for(MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||
for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2)
|
||||
{
|
||||
if(Item *item = pl->GetMItem(itr2->item_guid))
|
||||
if (Item* item = pl->GetMItem(itr2->item_guid))
|
||||
draft.AddItem(item);
|
||||
|
||||
pl->RemoveMItem(itr2->item_guid);
|
||||
|
|
@ -462,7 +462,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data )
|
|||
/**
|
||||
* Handles the packet sent by the client when taking an item from the mail.
|
||||
*/
|
||||
void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
|
||||
void WorldSession::HandleMailTakeItem(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid mailboxGuid;
|
||||
uint32 mailId;
|
||||
|
|
@ -477,23 +477,23 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
|
|||
Player* pl = _player;
|
||||
|
||||
Mail* m = pl->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);
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent cheating with skip client money check
|
||||
if(pl->GetMoney() < m->COD)
|
||||
if (pl->GetMoney() < m->COD)
|
||||
{
|
||||
pl->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
}
|
||||
|
||||
Item *it = pl->GetMItem(itemId);
|
||||
Item* it = pl->GetMItem(itemId);
|
||||
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, it, false );
|
||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
m->RemoveItem(itemId);
|
||||
|
|
@ -502,14 +502,14 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
|
|||
if (m->COD > 0) // if there is COD, take COD money from player and send them to sender by mail
|
||||
{
|
||||
ObjectGuid sender_guid = ObjectGuid(HIGHGUID_PLAYER, m->sender);
|
||||
Player *sender = sObjectMgr.GetPlayer(sender_guid);
|
||||
Player* sender = sObjectMgr.GetPlayer(sender_guid);
|
||||
|
||||
uint32 sender_accId = 0;
|
||||
|
||||
if( GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE) )
|
||||
if (GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_BOOL_GM_LOG_TRADE))
|
||||
{
|
||||
std::string sender_name;
|
||||
if(sender)
|
||||
if (sender)
|
||||
{
|
||||
sender_accId = sender->GetSession()->GetAccountId();
|
||||
sender_name = sender->GetName();
|
||||
|
|
@ -519,7 +519,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
|
|||
// can be calculated early
|
||||
sender_accId = sObjectMgr.GetPlayerAccountIdByGUID(sender_guid);
|
||||
|
||||
if(!sObjectMgr.GetPlayerNameByGUID(sender_guid, sender_name))
|
||||
if (!sObjectMgr.GetPlayerNameByGUID(sender_guid, sender_name))
|
||||
sender_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
|
||||
}
|
||||
sLog.outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)",
|
||||
|
|
@ -529,14 +529,14 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
|
|||
sender_accId = sObjectMgr.GetPlayerAccountIdByGUID(sender_guid);
|
||||
|
||||
// check player existence
|
||||
if(sender || sender_accId)
|
||||
if (sender || sender_accId)
|
||||
{
|
||||
MailDraft(m->subject, "")
|
||||
.SetMoney(m->COD)
|
||||
.SendMailTo(MailReceiver(sender, sender_guid), _player, MAIL_CHECK_MASK_COD_PAYMENT);
|
||||
}
|
||||
|
||||
pl->ModifyMoney( -int32(m->COD) );
|
||||
pl->ModifyMoney(-int32(m->COD));
|
||||
}
|
||||
m->COD = 0;
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
|
|
@ -560,7 +560,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data )
|
|||
/**
|
||||
* Handles the packet sent by the client when taking money from the mail.
|
||||
*/
|
||||
void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data )
|
||||
void WorldSession::HandleMailTakeMoney(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid mailboxGuid;
|
||||
uint32 mailId;
|
||||
|
|
@ -570,10 +570,10 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data )
|
|||
if (!CheckMailBox(mailboxGuid))
|
||||
return;
|
||||
|
||||
Player *pl = _player;
|
||||
Player* pl = _player;
|
||||
|
||||
Mail* m = pl->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);
|
||||
return;
|
||||
|
|
@ -597,7 +597,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data )
|
|||
* Handles the packet sent by the client when requesting the current mail list.
|
||||
* It will send a list of all available mails in the players mailbox to the client.
|
||||
*/
|
||||
void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
||||
void WorldSession::HandleGetMailList(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid mailboxGuid;
|
||||
recv_data >> mailboxGuid;
|
||||
|
|
@ -616,10 +616,10 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
|||
data << uint8(0); // mail's count
|
||||
time_t cur_time = time(NULL);
|
||||
|
||||
for(PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
|
||||
for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
|
||||
{
|
||||
// packet send mail count as uint8, prevent overflow
|
||||
if(mailsCount >= 254)
|
||||
if (mailsCount >= 254)
|
||||
{
|
||||
realCount += 1;
|
||||
continue;
|
||||
|
|
@ -633,7 +633,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
|||
|
||||
size_t next_mail_size = 2+4+1+((*itr)->messageType == MAIL_NORMAL ? 8 : 4)+4*8+((*itr)->subject.size()+1)+((*itr)->body.size()+1)+1+item_count*(1+4+4+7*3*4+4+4+4+4+4+4+1);
|
||||
|
||||
if(data.wpos()+next_mail_size > maxPacketSize)
|
||||
if (data.wpos()+next_mail_size > maxPacketSize)
|
||||
{
|
||||
realCount += 1;
|
||||
continue;
|
||||
|
|
@ -643,7 +643,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
|||
data << uint32((*itr)->messageID); // Message ID
|
||||
data << uint8((*itr)->messageType); // Message Type
|
||||
|
||||
switch((*itr)->messageType)
|
||||
switch ((*itr)->messageType)
|
||||
{
|
||||
case MAIL_NORMAL: // sender guid
|
||||
data << ObjectGuid(HIGHGUID_PLAYER, (*itr)->sender);
|
||||
|
|
@ -670,16 +670,16 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
|||
|
||||
data << uint8(item_count); // client limit is 0x10
|
||||
|
||||
for(uint8 i = 0; i < item_count; ++i)
|
||||
for (uint8 i = 0; i < item_count; ++i)
|
||||
{
|
||||
Item *item = _player->GetMItem((*itr)->items[i].item_guid);
|
||||
Item* item = _player->GetMItem((*itr)->items[i].item_guid);
|
||||
// item index (0-6?)
|
||||
data << uint8(i);
|
||||
// item guid low?
|
||||
data << uint32(item ? item->GetGUIDLow() : 0);
|
||||
// entry
|
||||
data << uint32(item ? item->GetEntry() : 0);
|
||||
for(uint8 j = 0; j < MAX_INSPECTED_ENCHANTMENT_SLOT; ++j)
|
||||
for (uint8 j = 0; j < MAX_INSPECTED_ENCHANTMENT_SLOT; ++j)
|
||||
{
|
||||
// unsure
|
||||
data << uint32(item ? item->GetEnchantmentCharges((EnchantmentSlot)j) : 0);
|
||||
|
|
@ -723,7 +723,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data )
|
|||
* a new item with the text of the mail and store it in the players inventory (if possible).
|
||||
*
|
||||
*/
|
||||
void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
|
||||
void WorldSession::HandleMailCreateTextItem(WorldPacket& recv_data)
|
||||
{
|
||||
ObjectGuid mailboxGuid;
|
||||
uint32 mailId;
|
||||
|
|
@ -734,7 +734,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
|
|||
if (!CheckMailBox(mailboxGuid))
|
||||
return;
|
||||
|
||||
Player *pl = _player;
|
||||
Player* pl = _player;
|
||||
|
||||
Mail* m = pl->GetMail(mailId);
|
||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
|
|
@ -743,7 +743,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
|
|||
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.GenerateItemLowGuid(), MAIL_BODY_ITEM_TEMPLATE, pl))
|
||||
{
|
||||
delete bodyItem;
|
||||
|
|
@ -772,7 +772,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
|
|||
DETAIL_LOG("HandleMailCreateTextItem mailid=%u", mailId);
|
||||
|
||||
ItemPosCountVec dest;
|
||||
InventoryResult msg = _player->CanStoreItem( NULL_BAG, NULL_SLOT, dest, bodyItem, false );
|
||||
InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, bodyItem, false);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
m->checked = m->checked | MAIL_CHECK_MASK_COPIED;
|
||||
|
|
@ -792,31 +792,31 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
|
|||
/**
|
||||
* No idea when this is called.
|
||||
*/
|
||||
void WorldSession::HandleQueryNextMailTime(WorldPacket & /**recv_data*/ )
|
||||
void WorldSession::HandleQueryNextMailTime(WorldPacket& /**recv_data*/)
|
||||
{
|
||||
WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8);
|
||||
|
||||
if( _player->unReadMails > 0 )
|
||||
if (_player->unReadMails > 0)
|
||||
{
|
||||
data << uint32(0); // float
|
||||
data << uint32(0); // count
|
||||
|
||||
uint32 count = 0;
|
||||
time_t now = time(NULL);
|
||||
for(PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
|
||||
for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
|
||||
{
|
||||
Mail *m = (*itr);
|
||||
Mail* m = (*itr);
|
||||
// must be not checked yet
|
||||
if(m->checked & MAIL_CHECK_MASK_READ)
|
||||
if (m->checked & MAIL_CHECK_MASK_READ)
|
||||
continue;
|
||||
|
||||
// and already delivered
|
||||
if(now < m->deliver_time)
|
||||
if (now < m->deliver_time)
|
||||
continue;
|
||||
|
||||
data << ObjectGuid(HIGHGUID_PLAYER, m->sender); // sender guid
|
||||
|
||||
switch(m->messageType)
|
||||
switch (m->messageType)
|
||||
{
|
||||
case MAIL_AUCTION:
|
||||
data << uint32(m->sender); // auction house id
|
||||
|
|
@ -832,7 +832,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /**recv_data*/ )
|
|||
data << uint32(0xC6000000); // float unk, time or something
|
||||
|
||||
++count;
|
||||
if(count == 2) // do not display more than 2 mails
|
||||
if (count == 2) // do not display more than 2 mails
|
||||
break;
|
||||
}
|
||||
data.put<uint32>(4, count);
|
||||
|
|
|
|||
375
src/game/Map.cpp
375
src/game/Map.cpp
File diff suppressed because it is too large
Load diff
|
|
@ -106,39 +106,39 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
// currently unused for normal maps
|
||||
bool CanUnload(uint32 diff)
|
||||
{
|
||||
if(!m_unloadTimer) return false;
|
||||
if(m_unloadTimer <= diff) return true;
|
||||
if (!m_unloadTimer) return false;
|
||||
if (m_unloadTimer <= diff) return true;
|
||||
m_unloadTimer -= diff;
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool Add(Player *);
|
||||
virtual void Remove(Player *, bool);
|
||||
template<class T> void Add(T *);
|
||||
template<class T> void Remove(T *, bool);
|
||||
virtual bool Add(Player*);
|
||||
virtual void Remove(Player*, bool);
|
||||
template<class T> void Add(T*);
|
||||
template<class T> void Remove(T*, bool);
|
||||
|
||||
static void DeleteFromWorld(Player* player); // player object will deleted at call
|
||||
|
||||
virtual void Update(const uint32&);
|
||||
|
||||
void MessageBroadcast(Player *, WorldPacket *, bool to_self);
|
||||
void MessageBroadcast(WorldObject *, WorldPacket *);
|
||||
void MessageDistBroadcast(Player *, WorldPacket *, float dist, bool to_self, bool own_team_only = false);
|
||||
void MessageDistBroadcast(WorldObject *, WorldPacket *, float dist);
|
||||
void MessageBroadcast(Player*, WorldPacket*, bool to_self);
|
||||
void MessageBroadcast(WorldObject*, WorldPacket*);
|
||||
void MessageDistBroadcast(Player*, WorldPacket*, float dist, bool to_self, bool own_team_only = false);
|
||||
void MessageDistBroadcast(WorldObject*, WorldPacket*, float dist);
|
||||
|
||||
float GetVisibilityDistance() const { return m_VisibleDistance; }
|
||||
//function for setting up visibility distance for maps on per-type/per-Id basis
|
||||
virtual void InitVisibilityDistance();
|
||||
|
||||
void PlayerRelocation(Player *, float x, float y, float z, float angl);
|
||||
void CreatureRelocation(Creature *creature, float x, float y, float z, float orientation);
|
||||
void PlayerRelocation(Player*, float x, float y, float z, float angl);
|
||||
void CreatureRelocation(Creature* creature, float x, float y, float z, float orientation);
|
||||
|
||||
template<class T, class CONTAINER> void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor);
|
||||
template<class T, class CONTAINER> void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER>& visitor);
|
||||
|
||||
bool IsRemovalGrid(float x, float y) const
|
||||
{
|
||||
GridPair p = MaNGOS::ComputeGridPair(x, y);
|
||||
return( !getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL );
|
||||
return(!getNGrid(p.x_coord, p.y_coord) || getNGrid(p.x_coord, p.y_coord)->GetGridState() == GRID_STATE_REMOVAL);
|
||||
}
|
||||
|
||||
bool IsLoaded(float x, float y) const
|
||||
|
|
@ -147,13 +147,13 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
return loaded(p);
|
||||
}
|
||||
|
||||
bool GetUnloadLock(const GridPair &p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); }
|
||||
void SetUnloadLock(const GridPair &p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); }
|
||||
bool GetUnloadLock(const GridPair& p) const { return getNGrid(p.x_coord, p.y_coord)->getUnloadLock(); }
|
||||
void SetUnloadLock(const GridPair& p, bool on) { getNGrid(p.x_coord, p.y_coord)->setUnloadExplicitLock(on); }
|
||||
void LoadGrid(const Cell& cell, bool no_unload = false);
|
||||
bool UnloadGrid(const uint32 &x, const uint32 &y, bool pForce);
|
||||
bool UnloadGrid(const uint32& x, const uint32& y, bool pForce);
|
||||
virtual void UnloadAll(bool pForce);
|
||||
|
||||
void ResetGridExpiry(NGridType &grid, float factor = 1) const
|
||||
void ResetGridExpiry(NGridType& grid, float factor = 1) const
|
||||
{
|
||||
grid.ResetTimeTracker((time_t)((float)i_gridExpiry*factor));
|
||||
}
|
||||
|
|
@ -166,7 +166,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
|
||||
virtual void RemoveAllObjectsInRemoveList();
|
||||
|
||||
bool CreatureRespawnRelocation(Creature *c); // used only in CreatureRelocation and ObjectGridUnloader
|
||||
bool CreatureRespawnRelocation(Creature* c); // used only in CreatureRelocation and ObjectGridUnloader
|
||||
|
||||
bool CheckGridIntegrity(Creature* c, bool moved) const;
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
// can't be NULL for loaded map
|
||||
MapPersistentState* GetPersistentState() const { return m_persistentState; }
|
||||
|
||||
void AddObjectToRemoveList(WorldObject *obj);
|
||||
void AddObjectToRemoveList(WorldObject* obj);
|
||||
|
||||
void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair);
|
||||
|
||||
|
|
@ -236,21 +236,21 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
typedef TypeUnorderedMapContainer<AllMapStoredObjectTypes, ObjectGuid> MapStoredObjectTypesContainer;
|
||||
MapStoredObjectTypesContainer& GetObjectsStore() { return m_objectsStore; }
|
||||
|
||||
void AddUpdateObject(Object *obj)
|
||||
void AddUpdateObject(Object* obj)
|
||||
{
|
||||
i_objectsToClientUpdate.insert(obj);
|
||||
}
|
||||
|
||||
void RemoveUpdateObject(Object *obj)
|
||||
void RemoveUpdateObject(Object* obj)
|
||||
{
|
||||
i_objectsToClientUpdate.erase( obj );
|
||||
i_objectsToClientUpdate.erase(obj);
|
||||
}
|
||||
|
||||
// DynObjects currently
|
||||
uint32 GenerateLocalLowGuid(HighGuid guidhigh);
|
||||
|
||||
//get corresponding TerrainData object for this particular map
|
||||
const TerrainInfo * GetTerrain() const { return m_TerrainData; }
|
||||
const TerrainInfo* GetTerrain() const { return m_TerrainData; }
|
||||
|
||||
void CreateInstanceData(bool load);
|
||||
InstanceData* GetInstanceData() { return i_data; }
|
||||
|
|
@ -262,7 +262,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
|
||||
// VMap System
|
||||
bool IsInLineOfSight(float srcX, float srcY, float srcZ, float destX, float destY, float destZ);
|
||||
bool GetObjectHitPos(float srcX, float srcY, float srcZ, float destX, float destY, float destZ, float& resX, float &resY, float& resZ, float pModifyDist);
|
||||
bool GetObjectHitPos(float srcX, float srcY, float srcZ, float destX, float destY, float destZ, float& resX, float& resY, float& resZ, float pModifyDist);
|
||||
|
||||
// Get Holder for Creature Linking
|
||||
CreatureLinkingHolder* GetCreatureLinkingHolder() { return &m_creatureLinkingHolder; }
|
||||
|
|
@ -272,22 +272,22 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
|
||||
void SetTimer(uint32 t) { i_gridExpiry = t < MIN_GRID_DELAY ? MIN_GRID_DELAY : t; }
|
||||
|
||||
void SendInitSelf( Player * player );
|
||||
void SendInitSelf(Player* player);
|
||||
|
||||
void SendInitTransports( Player * player );
|
||||
void SendRemoveTransports( Player * player );
|
||||
void SendInitTransports(Player* player);
|
||||
void SendRemoveTransports(Player* player);
|
||||
|
||||
bool CreatureCellRelocation(Creature *creature, Cell new_cell);
|
||||
bool CreatureCellRelocation(Creature* creature, Cell new_cell);
|
||||
|
||||
bool loaded(const GridPair &) const;
|
||||
void EnsureGridCreated(const GridPair &);
|
||||
bool loaded(const GridPair&) const;
|
||||
void EnsureGridCreated(const GridPair&);
|
||||
bool EnsureGridLoaded(Cell const&);
|
||||
void EnsureGridLoadedAtEnter(Cell const&, Player* player = NULL);
|
||||
|
||||
void buildNGridLinkage(NGridType* pNGridType) { pNGridType->link(this); }
|
||||
|
||||
template<class T> void AddType(T *obj);
|
||||
template<class T> void RemoveType(T *obj, bool);
|
||||
template<class T> void AddType(T* obj);
|
||||
template<class T> void RemoveType(T* obj, bool);
|
||||
|
||||
NGridType* getNGrid(uint32 x, uint32 y) const
|
||||
{
|
||||
|
|
@ -303,7 +303,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
void ScriptsProcess();
|
||||
|
||||
void SendObjectUpdates();
|
||||
std::set<Object *> i_objectsToClientUpdate;
|
||||
std::set<Object*> i_objectsToClientUpdate;
|
||||
|
||||
protected:
|
||||
MapEntry const* i_mapEntry;
|
||||
|
|
@ -328,12 +328,12 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
NGridType* i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
|
||||
//Shared geodata object with map coord info...
|
||||
TerrainInfo * const m_TerrainData;
|
||||
TerrainInfo* const m_TerrainData;
|
||||
bool m_bLoadedGrids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||
|
||||
std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
|
||||
std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP* TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
|
||||
|
||||
std::set<WorldObject *> i_objectsToRemove;
|
||||
std::set<WorldObject*> i_objectsToRemove;
|
||||
|
||||
typedef std::multimap<time_t, ScriptAction> ScriptScheduleMap;
|
||||
ScriptScheduleMap m_scriptSchedule;
|
||||
|
|
@ -350,10 +350,10 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>
|
|||
|
||||
// Type specific code for add/remove to/from grid
|
||||
template<class T>
|
||||
void AddToGrid(T*, NGridType *, Cell const&);
|
||||
void AddToGrid(T*, NGridType*, Cell const&);
|
||||
|
||||
template<class T>
|
||||
void RemoveFromGrid(T*, NGridType *, Cell const&);
|
||||
void RemoveFromGrid(T*, NGridType*, Cell const&);
|
||||
|
||||
// Holder for information about linked mobs
|
||||
CreatureLinkingHolder m_creatureLinkingHolder;
|
||||
|
|
@ -378,11 +378,11 @@ class MANGOS_DLL_SPEC DungeonMap : public Map
|
|||
public:
|
||||
DungeonMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode);
|
||||
~DungeonMap();
|
||||
bool Add(Player *);
|
||||
void Remove(Player *, bool);
|
||||
bool Add(Player*);
|
||||
void Remove(Player*, bool);
|
||||
void Update(const uint32&);
|
||||
bool Reset(InstanceResetMethod method);
|
||||
void PermBindAllPlayers(Player *player);
|
||||
void PermBindAllPlayers(Player* player);
|
||||
void UnloadAll(bool pForce);
|
||||
bool CanEnter(Player* player);
|
||||
void SendResetWarnings(uint32 timeLeft) const;
|
||||
|
|
@ -406,8 +406,8 @@ class MANGOS_DLL_SPEC BattleGroundMap : public Map
|
|||
~BattleGroundMap();
|
||||
|
||||
void Update(const uint32&);
|
||||
bool Add(Player *);
|
||||
void Remove(Player *, bool);
|
||||
bool Add(Player*);
|
||||
void Remove(Player*, bool);
|
||||
bool CanEnter(Player* player);
|
||||
void SetUnload();
|
||||
void UnloadAll(bool pForce);
|
||||
|
|
@ -425,14 +425,14 @@ class MANGOS_DLL_SPEC BattleGroundMap : public Map
|
|||
|
||||
template<class T, class CONTAINER>
|
||||
inline void
|
||||
Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor)
|
||||
Map::Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER>& visitor)
|
||||
{
|
||||
const uint32 x = cell.GridX();
|
||||
const uint32 y = cell.GridY();
|
||||
const uint32 cell_x = cell.CellX();
|
||||
const uint32 cell_y = cell.CellY();
|
||||
|
||||
if( !cell.NoCreate() || loaded(GridPair(x,y)) )
|
||||
if (!cell.NoCreate() || loaded(GridPair(x,y)))
|
||||
{
|
||||
EnsureGridLoaded(cell);
|
||||
getNGrid(x, y)->Visit(cell_x, cell_y, visitor);
|
||||
|
|
|
|||
|
|
@ -40,10 +40,10 @@ MapManager::MapManager()
|
|||
|
||||
MapManager::~MapManager()
|
||||
{
|
||||
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
for (MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
delete iter->second;
|
||||
|
||||
for(TransportSet::iterator i = m_Transports.begin(); i != m_Transports.end(); ++i)
|
||||
for (TransportSet::iterator i = m_Transports.begin(); i != m_Transports.end(); ++i)
|
||||
delete *i;
|
||||
|
||||
DeleteStateMachine();
|
||||
|
|
@ -71,7 +71,7 @@ void MapManager::DeleteStateMachine()
|
|||
delete si_GridStates[GRID_STATE_REMOVAL];
|
||||
}
|
||||
|
||||
void MapManager::UpdateGridState(grid_state_t state, Map& map, NGridType& ngrid, GridInfo& ginfo, const uint32 &x, const uint32 &y, const uint32 &t_diff)
|
||||
void MapManager::UpdateGridState(grid_state_t state, Map& map, NGridType& ngrid, GridInfo& ginfo, const uint32& x, const uint32& y, const uint32& t_diff)
|
||||
{
|
||||
// TODO: The grid state array itself is static and therefore 100% safe, however, the data
|
||||
// the state classes in it accesses is not, since grids are shared across maps (for example
|
||||
|
|
@ -82,7 +82,7 @@ void MapManager::UpdateGridState(grid_state_t state, Map& map, NGridType& ngrid,
|
|||
|
||||
void MapManager::InitializeVisibilityDistanceInfo()
|
||||
{
|
||||
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
for (MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
(*iter).second->InitVisibilityDistance();
|
||||
}
|
||||
|
||||
|
|
@ -92,24 +92,24 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj)
|
|||
//if(!obj->IsInWorld()) sLog.outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId());
|
||||
Guard _guard(*this);
|
||||
|
||||
Map * m = NULL;
|
||||
Map* m = NULL;
|
||||
|
||||
const MapEntry* entry = sMapStore.LookupEntry(id);
|
||||
if(!entry)
|
||||
if (!entry)
|
||||
return NULL;
|
||||
|
||||
if(entry->Instanceable())
|
||||
if (entry->Instanceable())
|
||||
{
|
||||
MANGOS_ASSERT(obj->GetTypeId() == TYPEID_PLAYER);
|
||||
//create DungeonMap object
|
||||
if(obj->GetTypeId() == TYPEID_PLAYER)
|
||||
if (obj->GetTypeId() == TYPEID_PLAYER)
|
||||
m = CreateInstance(id, (Player*)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
//create regular non-instanceable map
|
||||
m = FindMap(id);
|
||||
if( m == NULL )
|
||||
if (m == NULL)
|
||||
{
|
||||
m = new WorldMap(id, i_gridCleanUpDelay);
|
||||
//add map into container
|
||||
|
|
@ -136,11 +136,11 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
|||
Guard guard(*this);
|
||||
|
||||
MapMapType::const_iterator iter = i_maps.find(MapID(mapid, instanceId));
|
||||
if(iter == i_maps.end())
|
||||
if (iter == i_maps.end())
|
||||
return NULL;
|
||||
|
||||
//this is a small workaround for transports
|
||||
if(instanceId == 0 && iter->second->Instanceable())
|
||||
if (instanceId == 0 && iter->second->Instanceable())
|
||||
{
|
||||
assert(false);
|
||||
return NULL;
|
||||
|
|
@ -155,18 +155,18 @@ Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const
|
|||
*/
|
||||
bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
|
||||
{
|
||||
const MapEntry *entry = sMapStore.LookupEntry(mapid);
|
||||
if(!entry)
|
||||
const MapEntry* entry = sMapStore.LookupEntry(mapid);
|
||||
if (!entry)
|
||||
return false;
|
||||
|
||||
const char *mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
|
||||
const char* mapName = entry->name[player->GetSession()->GetSessionDbcLocale()];
|
||||
|
||||
if(entry->IsDungeon())
|
||||
if (entry->IsDungeon())
|
||||
{
|
||||
if (entry->IsRaid())
|
||||
{
|
||||
// GMs can avoid raid limitations
|
||||
if(!player->isGameMaster() && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_RAID))
|
||||
if (!player->isGameMaster() && !sWorld.getConfig(CONFIG_BOOL_INSTANCE_IGNORE_RAID))
|
||||
{
|
||||
// can only enter in a raid group
|
||||
Group* group = player->GetGroup();
|
||||
|
|
@ -210,9 +210,9 @@ void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId)
|
|||
Guard _guard(*this);
|
||||
|
||||
MapMapType::iterator iter = i_maps.find(MapID(mapid, instanceId));
|
||||
if(iter != i_maps.end())
|
||||
if (iter != i_maps.end())
|
||||
{
|
||||
Map * pMap = iter->second;
|
||||
Map* pMap = iter->second;
|
||||
if (pMap->Instanceable())
|
||||
{
|
||||
i_maps.erase(iter);
|
||||
|
|
@ -227,10 +227,10 @@ void
|
|||
MapManager::Update(uint32 diff)
|
||||
{
|
||||
i_timer.Update(diff);
|
||||
if( !i_timer.Passed() )
|
||||
if (!i_timer.Passed())
|
||||
return;
|
||||
|
||||
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
for (MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
iter->second->Update((uint32)i_timer.GetCurrent());
|
||||
|
||||
for (TransportSet::iterator iter = m_Transports.begin(); iter != m_Transports.end(); ++iter)
|
||||
|
|
@ -241,11 +241,11 @@ MapManager::Update(uint32 diff)
|
|||
|
||||
//remove all maps which can be unloaded
|
||||
MapMapType::iterator iter = i_maps.begin();
|
||||
while(iter != i_maps.end())
|
||||
while (iter != i_maps.end())
|
||||
{
|
||||
Map * pMap = iter->second;
|
||||
Map* pMap = iter->second;
|
||||
//check if map can be unloaded
|
||||
if(pMap->CanUnload((uint32)i_timer.GetCurrent()))
|
||||
if (pMap->CanUnload((uint32)i_timer.GetCurrent()))
|
||||
{
|
||||
pMap->UnloadAll(true);
|
||||
delete pMap;
|
||||
|
|
@ -261,7 +261,7 @@ MapManager::Update(uint32 diff)
|
|||
|
||||
void MapManager::RemoveAllObjectsInRemoveList()
|
||||
{
|
||||
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
for (MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
iter->second->RemoveAllObjectsInRemoveList();
|
||||
}
|
||||
|
||||
|
|
@ -284,10 +284,10 @@ bool MapManager::IsValidMAP(uint32 mapid)
|
|||
|
||||
void MapManager::UnloadAll()
|
||||
{
|
||||
for(MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
for (MapMapType::iterator iter=i_maps.begin(); iter != i_maps.end(); ++iter)
|
||||
iter->second->UnloadAll(true);
|
||||
|
||||
while(!i_maps.empty())
|
||||
while (!i_maps.empty())
|
||||
{
|
||||
delete i_maps.begin()->second;
|
||||
i_maps.erase(i_maps.begin());
|
||||
|
|
@ -299,10 +299,10 @@ void MapManager::UnloadAll()
|
|||
uint32 MapManager::GetNumInstances()
|
||||
{
|
||||
uint32 ret = 0;
|
||||
for(MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||
{
|
||||
Map *map = itr->second;
|
||||
if(!map->IsDungeon()) continue;
|
||||
Map* map = itr->second;
|
||||
if (!map->IsDungeon()) continue;
|
||||
ret += 1;
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -311,10 +311,10 @@ uint32 MapManager::GetNumInstances()
|
|||
uint32 MapManager::GetNumPlayersInInstances()
|
||||
{
|
||||
uint32 ret = 0;
|
||||
for(MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||
for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr)
|
||||
{
|
||||
Map *map = itr->second;
|
||||
if(!map->IsDungeon()) continue;
|
||||
Map* map = itr->second;
|
||||
if (!map->IsDungeon()) continue;
|
||||
ret += map->GetPlayers().getSize();
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -322,14 +322,14 @@ uint32 MapManager::GetNumPlayersInInstances()
|
|||
|
||||
///// returns a new or existing Instance
|
||||
///// in case of battlegrounds it will only return an existing map, those maps are created by bg-system
|
||||
Map* MapManager::CreateInstance(uint32 id, Player * player)
|
||||
Map* MapManager::CreateInstance(uint32 id, Player* player)
|
||||
{
|
||||
Map* map = NULL;
|
||||
Map * pNewMap = NULL;
|
||||
Map* pNewMap = NULL;
|
||||
uint32 NewInstanceId = 0; // instanceId of the resulting map
|
||||
const MapEntry* entry = sMapStore.LookupEntry(id);
|
||||
|
||||
if(entry->IsBattleGroundOrArena())
|
||||
if (entry->IsBattleGroundOrArena())
|
||||
{
|
||||
// find existing bg map for player
|
||||
NewInstanceId = player->GetBattleGroundId();
|
||||
|
|
@ -357,7 +357,7 @@ Map* MapManager::CreateInstance(uint32 id, Player * player)
|
|||
}
|
||||
|
||||
//add a new map object into the registry
|
||||
if(pNewMap)
|
||||
if (pNewMap)
|
||||
{
|
||||
i_maps[MapID(id, NewInstanceId)] = pNewMap;
|
||||
map = pNewMap;
|
||||
|
|
@ -366,7 +366,7 @@ Map* MapManager::CreateInstance(uint32 id, Player * player)
|
|||
return map;
|
||||
}
|
||||
|
||||
DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState *save)
|
||||
DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState* save)
|
||||
{
|
||||
// make sure we have a valid map id
|
||||
if (!sMapStore.LookupEntry(id))
|
||||
|
|
@ -386,7 +386,7 @@ DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, Difficult
|
|||
|
||||
DEBUG_LOG("MapInstanced::CreateDungeonMap: %s map instance %d for %d created with difficulty %d", save?"":"new ", InstanceId, id, difficulty);
|
||||
|
||||
DungeonMap *map = new DungeonMap(id, i_gridCleanUpDelay, InstanceId, difficulty);
|
||||
DungeonMap* map = new DungeonMap(id, i_gridCleanUpDelay, InstanceId, difficulty);
|
||||
|
||||
// Dungeons can have saved instance data
|
||||
bool load_data = save != NULL;
|
||||
|
|
@ -403,7 +403,7 @@ BattleGroundMap* MapManager::CreateBattleGroundMap(uint32 id, uint32 InstanceId,
|
|||
|
||||
uint8 spawnMode = bracketEntry ? bracketEntry->difficulty : REGULAR_DIFFICULTY;
|
||||
|
||||
BattleGroundMap *map = new BattleGroundMap(id, i_gridCleanUpDelay, InstanceId, spawnMode);
|
||||
BattleGroundMap* map = new BattleGroundMap(id, i_gridCleanUpDelay, InstanceId, spawnMode);
|
||||
MANGOS_ASSERT(map->IsBattleGroundOrArena());
|
||||
map->SetBG(bg);
|
||||
bg->SetBgMap(map);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ struct MANGOS_DLL_DECL MapID
|
|||
|
||||
bool operator<(const MapID& val) const
|
||||
{
|
||||
if(nMapId == val.nMapId)
|
||||
if (nMapId == val.nMapId)
|
||||
return nInstanceId < val.nInstanceId;
|
||||
|
||||
return nMapId < val.nMapId;
|
||||
|
|
@ -63,7 +63,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||
Map* CreateBgMap(uint32 mapid, BattleGround* bg);
|
||||
Map* FindMap(uint32 mapid, uint32 instanceId = 0) const;
|
||||
|
||||
void UpdateGridState(grid_state_t state, Map& map, NGridType& ngrid, GridInfo& ginfo, const uint32 &x, const uint32 &y, const uint32 &t_diff);
|
||||
void UpdateGridState(grid_state_t state, Map& map, NGridType& ngrid, GridInfo& ginfo, const uint32& x, const uint32& y, const uint32& t_diff);
|
||||
|
||||
// only const version for outer users
|
||||
void DeleteInstance(uint32 mapid, uint32 instanceId);
|
||||
|
|
@ -73,7 +73,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||
|
||||
void SetGridCleanUpDelay(uint32 t)
|
||||
{
|
||||
if( t < MIN_GRID_DELAY )
|
||||
if (t < MIN_GRID_DELAY)
|
||||
i_gridCleanUpDelay = MIN_GRID_DELAY;
|
||||
else
|
||||
i_gridCleanUpDelay = t;
|
||||
|
|
@ -81,7 +81,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||
|
||||
void SetMapUpdateInterval(uint32 t)
|
||||
{
|
||||
if( t > MIN_MAP_UPDATE_DELAY )
|
||||
if (t > MIN_MAP_UPDATE_DELAY)
|
||||
t = MIN_MAP_UPDATE_DELAY;
|
||||
|
||||
i_timer.SetInterval(t);
|
||||
|
|
@ -133,7 +133,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||
|
||||
void LoadTransports();
|
||||
|
||||
typedef std::set<Transport *> TransportSet;
|
||||
typedef std::set<Transport*> TransportSet;
|
||||
TransportSet m_Transports;
|
||||
|
||||
typedef std::map<uint32, TransportSet> TransportMap;
|
||||
|
|
@ -164,14 +164,14 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
|
|||
MapManager();
|
||||
~MapManager();
|
||||
|
||||
MapManager(const MapManager &);
|
||||
MapManager& operator=(const MapManager &);
|
||||
MapManager(const MapManager&);
|
||||
MapManager& operator=(const MapManager&);
|
||||
|
||||
void InitStateMachine();
|
||||
void DeleteStateMachine();
|
||||
|
||||
Map* CreateInstance(uint32 id, Player * player);
|
||||
DungeonMap* CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState *save = NULL);
|
||||
Map* CreateInstance(uint32 id, Player* player);
|
||||
DungeonMap* CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState* save = NULL);
|
||||
BattleGroundMap* CreateBattleGroundMap(uint32 id, uint32 InstanceId, BattleGround* bg);
|
||||
|
||||
uint32 i_gridCleanUpDelay;
|
||||
|
|
@ -184,7 +184,7 @@ inline void MapManager::DoForAllMapsWithMapId(uint32 mapId, Do& _do)
|
|||
{
|
||||
MapMapType::const_iterator start = i_maps.lower_bound(MapID(mapId,0));
|
||||
MapMapType::const_iterator end = i_maps.lower_bound(MapID(mapId+1,0));
|
||||
for(MapMapType::const_iterator itr = start; itr != end; ++itr)
|
||||
for (MapMapType::const_iterator itr = start; itr != end; ++itr)
|
||||
_do(itr->second);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,13 +36,13 @@
|
|||
#include "InstanceData.h"
|
||||
#include "ProgressBar.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1( MapPersistentStateManager );
|
||||
INSTANTIATE_SINGLETON_1(MapPersistentStateManager);
|
||||
|
||||
static uint32 resetEventTypeDelay[MAX_RESET_EVENT_TYPE] = { 0, 3600, 900, 300, 60 };
|
||||
|
||||
//== MapPersistentState functions ==========================
|
||||
MapPersistentState::MapPersistentState(uint16 MapId, uint32 InstanceId, Difficulty difficulty)
|
||||
: m_instanceid(InstanceId), m_mapid(MapId),
|
||||
: m_instanceid(InstanceId), m_mapid(MapId),
|
||||
m_difficulty(difficulty), m_usedByMap(NULL)
|
||||
{
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ void MapPersistentState::SaveCreatureRespawnTime(uint32 loguid, time_t t)
|
|||
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpawnTime, "DELETE FROM creature_respawn WHERE guid = ? AND instance = ?");
|
||||
stmt.PExecute(loguid, m_instanceid);
|
||||
|
||||
if(t > sWorld.GetGameTime())
|
||||
if (t > sWorld.GetGameTime())
|
||||
{
|
||||
stmt = CharacterDatabase.CreateStatement(insSpawnTime, "INSERT INTO creature_respawn VALUES ( ?, ?, ? )");
|
||||
stmt.PExecute(loguid, uint64(t), m_instanceid);
|
||||
|
|
@ -109,7 +109,7 @@ void MapPersistentState::SaveGORespawnTime(uint32 loguid, time_t t)
|
|||
SqlStatement stmt = CharacterDatabase.CreateStatement(delSpawnTime, "DELETE FROM gameobject_respawn WHERE guid = ? AND instance = ?");
|
||||
stmt.PExecute(loguid, m_instanceid);
|
||||
|
||||
if(t > sWorld.GetGameTime())
|
||||
if (t > sWorld.GetGameTime())
|
||||
{
|
||||
stmt = CharacterDatabase.CreateStatement(insSpawnTime, "INSERT INTO gameobject_respawn VALUES ( ?, ?, ? )");
|
||||
stmt.PExecute(loguid, uint64(t), m_instanceid);
|
||||
|
|
@ -118,7 +118,7 @@ void MapPersistentState::SaveGORespawnTime(uint32 loguid, time_t t)
|
|||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
|
||||
void MapPersistentState::SetCreatureRespawnTime( uint32 loguid, time_t t )
|
||||
void MapPersistentState::SetCreatureRespawnTime(uint32 loguid, time_t t)
|
||||
{
|
||||
if (t > sWorld.GetGameTime())
|
||||
m_creatureRespawnTimes[loguid] = t;
|
||||
|
|
@ -129,7 +129,7 @@ void MapPersistentState::SetCreatureRespawnTime( uint32 loguid, time_t t )
|
|||
}
|
||||
}
|
||||
|
||||
void MapPersistentState::SetGORespawnTime( uint32 loguid, time_t t )
|
||||
void MapPersistentState::SetGORespawnTime(uint32 loguid, time_t t)
|
||||
{
|
||||
if (t > sWorld.GetGameTime())
|
||||
m_goRespawnTimes[loguid] = t;
|
||||
|
|
@ -148,7 +148,7 @@ void MapPersistentState::ClearRespawnTimes()
|
|||
UnloadIfEmpty();
|
||||
}
|
||||
|
||||
void MapPersistentState::AddCreatureToGrid( uint32 guid, CreatureData const* data )
|
||||
void MapPersistentState::AddCreatureToGrid(uint32 guid, CreatureData const* data)
|
||||
{
|
||||
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
|
||||
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
|
||||
|
|
@ -156,7 +156,7 @@ void MapPersistentState::AddCreatureToGrid( uint32 guid, CreatureData const* dat
|
|||
m_gridObjectGuids[cell_id].creatures.insert(guid);
|
||||
}
|
||||
|
||||
void MapPersistentState::RemoveCreatureFromGrid( uint32 guid, CreatureData const* data )
|
||||
void MapPersistentState::RemoveCreatureFromGrid(uint32 guid, CreatureData const* data)
|
||||
{
|
||||
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
|
||||
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
|
||||
|
|
@ -164,7 +164,7 @@ void MapPersistentState::RemoveCreatureFromGrid( uint32 guid, CreatureData const
|
|||
m_gridObjectGuids[cell_id].creatures.erase(guid);
|
||||
}
|
||||
|
||||
void MapPersistentState::AddGameobjectToGrid( uint32 guid, GameObjectData const* data )
|
||||
void MapPersistentState::AddGameobjectToGrid(uint32 guid, GameObjectData const* data)
|
||||
{
|
||||
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
|
||||
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
|
||||
|
|
@ -172,7 +172,7 @@ void MapPersistentState::AddGameobjectToGrid( uint32 guid, GameObjectData const*
|
|||
m_gridObjectGuids[cell_id].gameobjects.insert(guid);
|
||||
}
|
||||
|
||||
void MapPersistentState::RemoveGameobjectFromGrid( uint32 guid, GameObjectData const* data )
|
||||
void MapPersistentState::RemoveGameobjectFromGrid(uint32 guid, GameObjectData const* data)
|
||||
{
|
||||
CellPair cell_pair = MaNGOS::ComputeCellPair(data->posX, data->posY);
|
||||
uint32 cell_id = (cell_pair.y_coord*TOTAL_NUMBER_OF_CELLS_PER_MAP) + cell_pair.x_coord;
|
||||
|
|
@ -206,21 +206,21 @@ bool WorldPersistentState::CanBeUnload() const
|
|||
|
||||
//== DungeonPersistentState functions =====================
|
||||
|
||||
DungeonPersistentState::DungeonPersistentState( uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset, uint32 completedEncountersMask)
|
||||
: MapPersistentState(MapId, InstanceId, difficulty), m_resetTime(resetTime), m_canReset(canReset), m_completedEncountersMask(completedEncountersMask)
|
||||
DungeonPersistentState::DungeonPersistentState(uint16 MapId, uint32 InstanceId, Difficulty difficulty, time_t resetTime, bool canReset, uint32 completedEncountersMask)
|
||||
: MapPersistentState(MapId, InstanceId, difficulty), m_resetTime(resetTime), m_canReset(canReset), m_completedEncountersMask(completedEncountersMask)
|
||||
{
|
||||
}
|
||||
|
||||
DungeonPersistentState::~DungeonPersistentState()
|
||||
{
|
||||
while(!m_playerList.empty())
|
||||
while (!m_playerList.empty())
|
||||
{
|
||||
Player *player = *(m_playerList.begin());
|
||||
Player* player = *(m_playerList.begin());
|
||||
player->UnbindInstance(GetMapId(), GetDifficulty(), true);
|
||||
}
|
||||
while(!m_groupList.empty())
|
||||
while (!m_groupList.empty())
|
||||
{
|
||||
Group *group = *(m_groupList.begin());
|
||||
Group* group = *(m_groupList.begin());
|
||||
group->UnbindInstance(GetMapId(), GetDifficulty(), true);
|
||||
}
|
||||
}
|
||||
|
|
@ -239,10 +239,10 @@ void DungeonPersistentState::SaveToDB()
|
|||
// state instance data too
|
||||
std::string data;
|
||||
|
||||
if (Map *map = GetMap())
|
||||
if (Map* map = GetMap())
|
||||
{
|
||||
InstanceData *iData = map->GetInstanceData();
|
||||
if(iData && iData->Save())
|
||||
InstanceData* iData = map->GetInstanceData();
|
||||
if (iData && iData->Save())
|
||||
{
|
||||
data = iData->Save();
|
||||
CharacterDatabase.escape_string(data);
|
||||
|
|
@ -276,8 +276,8 @@ InstanceTemplate const* DungeonPersistentState::GetTemplate() const
|
|||
time_t DungeonPersistentState::GetResetTimeForDB() const
|
||||
{
|
||||
// only state the reset time for normal instances
|
||||
const MapEntry *entry = sMapStore.LookupEntry(GetMapId());
|
||||
if(!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
|
||||
const MapEntry* entry = sMapStore.LookupEntry(GetMapId());
|
||||
if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC)
|
||||
return 0;
|
||||
else
|
||||
return GetResetTime();
|
||||
|
|
@ -353,8 +353,8 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
typedef std::map<uint32, ResetTimeMapDiffType> InstResetTimeMapDiffType;
|
||||
InstResetTimeMapDiffType instResetTime;
|
||||
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
|
||||
if( result )
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance WHERE resettime > 0");
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
|
@ -380,7 +380,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
|
||||
// update reset time for normal instances with the max creature respawn time + X hours
|
||||
result = CharacterDatabase.Query("SELECT MAX(respawntime), instance FROM creature_respawn WHERE instance > 0 GROUP BY instance");
|
||||
if( result )
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
|
@ -390,7 +390,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
uint32 instance = fields[1].GetUInt32();
|
||||
|
||||
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
|
||||
if(itr != instResetTime.end() && itr->second.second != resettime)
|
||||
if (itr != instResetTime.end() && itr->second.second != resettime)
|
||||
{
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '"UI64FMTD"' WHERE id = '%u'", uint64(resettime), instance);
|
||||
itr->second.second = resettime;
|
||||
|
|
@ -401,15 +401,15 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
}
|
||||
|
||||
// schedule the reset times
|
||||
for(InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
|
||||
if(itr->second.second > now)
|
||||
for (InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
|
||||
if (itr->second.second > now)
|
||||
ScheduleReset(true, itr->second.second, DungeonResetEvent(RESET_EVENT_NORMAL_DUNGEON, PAIR32_LOPART(itr->second.first),Difficulty(PAIR32_HIPART(itr->second.first)),itr->first));
|
||||
}
|
||||
|
||||
// load the global respawn times for raid/heroic instances
|
||||
uint32 diff = sWorld.getConfig(CONFIG_UINT32_INSTANCE_RESET_TIME_HOUR) * HOUR;
|
||||
result = CharacterDatabase.Query("SELECT mapid, difficulty, resettime FROM instance_reset");
|
||||
if(result)
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
|
@ -430,11 +430,12 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
|
||||
// update the reset time if the hour in the configs changes
|
||||
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
|
||||
if(oldresettime != newresettime)
|
||||
if (oldresettime != newresettime)
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '"UI64FMTD"' WHERE mapid = '%u' AND difficulty = '%u'", newresettime, mapid, difficulty);
|
||||
|
||||
SetResetTimeFor(mapid,difficulty,newresettime);
|
||||
} while(result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
|
||||
|
|
@ -444,7 +445,7 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
|
||||
// calculate new global reset times for expired instances and those that have never been reset yet
|
||||
// add the global reset times to the priority queue
|
||||
for(MapDifficultyMap::const_iterator itr = sMapDifficultyMap.begin(); itr != sMapDifficultyMap.end(); ++itr)
|
||||
for (MapDifficultyMap::const_iterator itr = sMapDifficultyMap.begin(); itr != sMapDifficultyMap.end(); ++itr)
|
||||
{
|
||||
uint32 map_diff_pair = itr->first;
|
||||
uint32 mapid = PAIR32_LOPART(map_diff_pair);
|
||||
|
|
@ -461,14 +462,14 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
|
||||
uint32 period = GetMaxResetTimeFor(mapDiff);
|
||||
time_t t = GetResetTimeFor(mapid,difficulty);
|
||||
if(!t)
|
||||
if (!t)
|
||||
{
|
||||
// initialize the reset time
|
||||
t = today + period + diff;
|
||||
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u','%u','"UI64FMTD"')", mapid, difficulty, (uint64)t);
|
||||
}
|
||||
|
||||
if(t < now)
|
||||
if (t < now)
|
||||
{
|
||||
// assume that expired instances have already been cleaned
|
||||
// calculate the next reset time
|
||||
|
|
@ -481,8 +482,8 @@ void DungeonResetScheduler::LoadResetTimes()
|
|||
|
||||
// schedule the global reset/warning
|
||||
ResetEventType type = RESET_EVENT_INFORM_1;
|
||||
for(; type < RESET_EVENT_INFORM_LAST; type = ResetEventType(type+1))
|
||||
if(t - resetEventTypeDelay[type] > now)
|
||||
for (; type < RESET_EVENT_INFORM_LAST; type = ResetEventType(type+1))
|
||||
if (t - resetEventTypeDelay[type] > now)
|
||||
break;
|
||||
|
||||
ScheduleReset(true, t - resetEventTypeDelay[type], DungeonResetEvent(type, mapid, difficulty, 0));
|
||||
|
|
@ -499,7 +500,7 @@ void DungeonResetScheduler::ScheduleReset(bool add, time_t time, DungeonResetEve
|
|||
ResetTimeQueue::iterator itr;
|
||||
std::pair<ResetTimeQueue::iterator, ResetTimeQueue::iterator> range;
|
||||
range = m_resetTimeQueue.equal_range(time);
|
||||
for(itr = range.first; itr != range.second; ++itr)
|
||||
for (itr = range.first; itr != range.second; ++itr)
|
||||
{
|
||||
if (itr->second == event)
|
||||
{
|
||||
|
|
@ -508,18 +509,18 @@ void DungeonResetScheduler::ScheduleReset(bool add, time_t time, DungeonResetEve
|
|||
}
|
||||
}
|
||||
// in case the reset time changed (should happen very rarely), we search the whole queue
|
||||
if(itr == range.second)
|
||||
if (itr == range.second)
|
||||
{
|
||||
for(itr = m_resetTimeQueue.begin(); itr != m_resetTimeQueue.end(); ++itr)
|
||||
for (itr = m_resetTimeQueue.begin(); itr != m_resetTimeQueue.end(); ++itr)
|
||||
{
|
||||
if(itr->second == event)
|
||||
if (itr->second == event)
|
||||
{
|
||||
m_resetTimeQueue.erase(itr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(itr == m_resetTimeQueue.end())
|
||||
if (itr == m_resetTimeQueue.end())
|
||||
sLog.outError("DungeonResetScheduler::ScheduleReset: cannot cancel the reset, the event(%d,%d,%d) was not found!", event.type, event.mapid, event.instanceId);
|
||||
}
|
||||
}
|
||||
|
|
@ -528,9 +529,9 @@ void DungeonResetScheduler::ScheduleReset(bool add, time_t time, DungeonResetEve
|
|||
void DungeonResetScheduler::Update()
|
||||
{
|
||||
time_t now = time(NULL), t;
|
||||
while(!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now)
|
||||
while (!m_resetTimeQueue.empty() && (t = m_resetTimeQueue.begin()->first) < now)
|
||||
{
|
||||
DungeonResetEvent &event = m_resetTimeQueue.begin()->second;
|
||||
DungeonResetEvent& event = m_resetTimeQueue.begin()->second;
|
||||
if (event.type == RESET_EVENT_NORMAL_DUNGEON)
|
||||
{
|
||||
// for individual normal instances, max creature respawn + X hours
|
||||
|
|
@ -597,7 +598,7 @@ MapPersistentStateManager::~MapPersistentStateManager()
|
|||
*/
|
||||
MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const* mapEntry, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load /*=false*/, bool initPools /*= true*/, uint32 completedEncountersMask /*= 0*/)
|
||||
{
|
||||
if (MapPersistentState *old_save = GetPersistentState(mapEntry->MapID, instanceId))
|
||||
if (MapPersistentState* old_save = GetPersistentState(mapEntry->MapID, instanceId))
|
||||
return old_save;
|
||||
|
||||
if (mapEntry->IsDungeon())
|
||||
|
|
@ -619,7 +620,7 @@ MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const
|
|||
|
||||
DEBUG_LOG("MapPersistentStateManager::AddPersistentState: mapid = %d, instanceid = %d, reset time = %u, canRset = %u", mapEntry->MapID, instanceId, resetTime, canReset ? 1 : 0);
|
||||
|
||||
MapPersistentState *state;
|
||||
MapPersistentState* state;
|
||||
if (mapEntry->IsDungeon())
|
||||
{
|
||||
DungeonPersistentState* dungeonState = new DungeonPersistentState(mapEntry->MapID, instanceId, difficulty, resetTime, canReset, completedEncountersMask);
|
||||
|
|
@ -644,7 +645,7 @@ MapPersistentState* MapPersistentStateManager::AddPersistentState(MapEntry const
|
|||
return state;
|
||||
}
|
||||
|
||||
MapPersistentState *MapPersistentStateManager::GetPersistentState(uint32 mapId, uint32 instanceId)
|
||||
MapPersistentState* MapPersistentStateManager::GetPersistentState(uint32 mapId, uint32 instanceId)
|
||||
{
|
||||
if (instanceId)
|
||||
{
|
||||
|
|
@ -698,7 +699,7 @@ void MapPersistentStateManager::RemovePersistentState(uint32 mapId, uint32 insta
|
|||
}
|
||||
}
|
||||
|
||||
void MapPersistentStateManager::_DelHelper(DatabaseType &db, const char *fields, const char *table, const char *queryTail,...)
|
||||
void MapPersistentStateManager::_DelHelper(DatabaseType& db, const char* fields, const char* table, const char* queryTail,...)
|
||||
{
|
||||
Tokens fieldTokens = StrSplit(fields, ", ");
|
||||
MANGOS_ASSERT(fieldTokens.size() != 0);
|
||||
|
|
@ -706,24 +707,25 @@ void MapPersistentStateManager::_DelHelper(DatabaseType &db, const char *fields,
|
|||
va_list ap;
|
||||
char szQueryTail [MAX_QUERY_LEN];
|
||||
va_start(ap, queryTail);
|
||||
vsnprintf( szQueryTail, MAX_QUERY_LEN, queryTail, ap );
|
||||
vsnprintf(szQueryTail, MAX_QUERY_LEN, queryTail, ap);
|
||||
va_end(ap);
|
||||
|
||||
QueryResult *result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
|
||||
if(result)
|
||||
QueryResult* result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
std::ostringstream ss;
|
||||
for(size_t i = 0; i < fieldTokens.size(); i++)
|
||||
for (size_t i = 0; i < fieldTokens.size(); i++)
|
||||
{
|
||||
std::string fieldValue = fields[i].GetCppString();
|
||||
db.escape_string(fieldValue);
|
||||
ss << (i != 0 ? " AND " : "") << fieldTokens[i] << " = '" << fieldValue << "'";
|
||||
}
|
||||
db.PExecute("DELETE FROM %s WHERE %s", table, ss.str().c_str());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
|
|
@ -756,7 +758,7 @@ void MapPersistentStateManager::CleanupInstances()
|
|||
|
||||
bar.step();
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Instances cleaned up");
|
||||
sLog.outString(">> Instances cleaned up");
|
||||
}
|
||||
|
||||
void MapPersistentStateManager::PackInstances()
|
||||
|
|
@ -770,12 +772,12 @@ void MapPersistentStateManager::PackInstances()
|
|||
// all valid ids are in the instance table
|
||||
// any associations to ids not in this table are assumed to be
|
||||
// cleaned already in CleanupInstances
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT id FROM instance");
|
||||
if( result )
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT id FROM instance");
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
InstanceSet.insert(fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
|
@ -807,11 +809,11 @@ void MapPersistentStateManager::PackInstances()
|
|||
bar.step();
|
||||
}
|
||||
|
||||
sLog.outString( ">> Instance numbers remapped, next instance id is %u", InstanceNumber );
|
||||
sLog.outString(">> Instance numbers remapped, next instance id is %u", InstanceNumber);
|
||||
sLog.outString();
|
||||
}
|
||||
|
||||
void MapPersistentStateManager::_ResetSave(PersistentStateMap& holder, PersistentStateMap::iterator &itr)
|
||||
void MapPersistentStateManager::_ResetSave(PersistentStateMap& holder, PersistentStateMap::iterator& itr)
|
||||
{
|
||||
// unbind all players bound to the instance
|
||||
// do not allow UnbindInstance to automatically unload the InstanceSaves
|
||||
|
|
@ -829,7 +831,7 @@ void MapPersistentStateManager::_ResetInstance(uint32 mapid, uint32 instanceId)
|
|||
if (itr != m_instanceSaveByInstanceId.end())
|
||||
{
|
||||
// delay reset until map unload for loaded map
|
||||
if (Map * iMap = itr->second->GetMap())
|
||||
if (Map* iMap = itr->second->GetMap())
|
||||
{
|
||||
MANGOS_ASSERT(iMap->IsDungeon());
|
||||
|
||||
|
|
@ -847,7 +849,7 @@ void MapPersistentStateManager::_ResetInstance(uint32 mapid, uint32 instanceId)
|
|||
void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, uint32 timeLeft)
|
||||
{
|
||||
// global reset for all instances of the given map
|
||||
MapEntry const *mapEntry = sMapStore.LookupEntry(mapid);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapid);
|
||||
if (!mapEntry->Instanceable())
|
||||
return;
|
||||
|
||||
|
|
@ -863,7 +865,7 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu
|
|||
}
|
||||
|
||||
// remove all binds to instances of the given map
|
||||
for(PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end();)
|
||||
for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end();)
|
||||
{
|
||||
if (itr->second->GetMapId() == mapid && itr->second->GetDifficulty() == difficulty)
|
||||
_ResetSave(m_instanceSaveByInstanceId, itr);
|
||||
|
|
@ -888,10 +890,10 @@ void MapPersistentStateManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficu
|
|||
const MapManager::MapMapType& maps = sMapMgr.Maps();
|
||||
|
||||
MapManager::MapMapType::const_iterator iter_last = maps.lower_bound(MapID(mapid + 1));
|
||||
for(MapManager::MapMapType::const_iterator mitr = maps.lower_bound(MapID(mapid)); mitr != iter_last; ++mitr)
|
||||
for (MapManager::MapMapType::const_iterator mitr = maps.lower_bound(MapID(mapid)); mitr != iter_last; ++mitr)
|
||||
{
|
||||
Map *map2 = mitr->second;
|
||||
if(map2->GetId() != mapid)
|
||||
Map* map2 = mitr->second;
|
||||
if (map2->GetId() != mapid)
|
||||
break;
|
||||
|
||||
if (warn)
|
||||
|
|
@ -908,7 +910,7 @@ void MapPersistentStateManager::GetStatistics(uint32& numStates, uint32& numBoun
|
|||
numBoundGroups = 0;
|
||||
|
||||
// only instanceable maps have bounds
|
||||
for(PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr)
|
||||
for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end(); ++itr)
|
||||
{
|
||||
if (!itr->second->GetMapEntry()->IsDungeon())
|
||||
continue;
|
||||
|
|
@ -919,7 +921,7 @@ void MapPersistentStateManager::GetStatistics(uint32& numStates, uint32& numBoun
|
|||
}
|
||||
}
|
||||
|
||||
void MapPersistentStateManager::_CleanupExpiredInstancesAtTime( time_t t )
|
||||
void MapPersistentStateManager::_CleanupExpiredInstancesAtTime(time_t t)
|
||||
{
|
||||
_DelHelper(CharacterDatabase, "id, map, instance.difficulty", "instance", "LEFT JOIN instance_reset ON mapid = map AND instance.difficulty = instance_reset.difficulty WHERE (instance.resettime < '"UI64FMTD"' AND instance.resettime > '0') OR (NOT instance_reset.resettime IS NULL AND instance_reset.resettime < '"UI64FMTD"')", (uint64)t, (uint64)t);
|
||||
}
|
||||
|
|
@ -928,7 +930,7 @@ void MapPersistentStateManager::_CleanupExpiredInstancesAtTime( time_t t )
|
|||
void MapPersistentStateManager::InitWorldMaps()
|
||||
{
|
||||
MapPersistentState* state = NULL; // need any from created for shared pool state
|
||||
for(uint32 mapid = 0; mapid < sMapStore.GetNumRows(); ++mapid)
|
||||
for (uint32 mapid = 0; mapid < sMapStore.GetNumRows(); ++mapid)
|
||||
if (MapEntry const* entry = sMapStore.LookupEntry(mapid))
|
||||
if (!entry->Instanceable())
|
||||
state = AddPersistentState(entry, 0, REGULAR_DIFFICULTY, 0, false, true, false);
|
||||
|
|
@ -945,7 +947,7 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
|
|||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM creature_respawn LEFT JOIN instance ON instance = id");
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM creature_respawn LEFT JOIN instance ON instance = id");
|
||||
if (!result)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
|
|
@ -994,7 +996,8 @@ void MapPersistentStateManager::LoadCreatureRespawnTimes()
|
|||
|
||||
++count;
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
|
|
@ -1010,7 +1013,7 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
|
|||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM gameobject_respawn LEFT JOIN instance ON instance = id");
|
||||
QueryResult* result = CharacterDatabase.Query("SELECT guid, respawntime, map, instance, difficulty, resettime, encountersMask FROM gameobject_respawn LEFT JOIN instance ON instance = id");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
|
@ -1060,7 +1063,8 @@ void MapPersistentStateManager::LoadGameobjectRespawnTimes()
|
|||
|
||||
++count;
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
|
|
|
|||
|
|
@ -193,11 +193,11 @@ class DungeonPersistentState : public MapPersistentState
|
|||
|
||||
/* online players bound to the instance (perm/solo)
|
||||
does not include the members of the group unless they have permanent saves */
|
||||
void AddPlayer(Player *player) { m_playerList.push_back(player); }
|
||||
bool RemovePlayer(Player *player) { m_playerList.remove(player); return UnloadIfEmpty(); }
|
||||
void AddPlayer(Player* player) { m_playerList.push_back(player); }
|
||||
bool RemovePlayer(Player* player) { m_playerList.remove(player); return UnloadIfEmpty(); }
|
||||
/* all groups bound to the instance */
|
||||
void AddGroup(Group *group) { m_groupList.push_back(group); }
|
||||
bool RemoveGroup(Group *group) { m_groupList.remove(group); return UnloadIfEmpty(); }
|
||||
void AddGroup(Group* group) { m_groupList.push_back(group); }
|
||||
bool RemoveGroup(Group* group) { m_groupList.remove(group); return UnloadIfEmpty(); }
|
||||
|
||||
/* for normal instances this corresponds to max(creature respawn time) + X hours
|
||||
for raid/heroic instances this caches the global respawn time for the map */
|
||||
|
|
@ -346,7 +346,7 @@ class MANGOS_DLL_DECL MapPersistentStateManager : public MaNGOS::Singleton<MapPe
|
|||
MapPersistentState* AddPersistentState(MapEntry const* mapEntry, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load = false, bool initPools = true, uint32 completedEncountersMask = 0);
|
||||
|
||||
// search stored state, can be NULL in result
|
||||
MapPersistentState *GetPersistentState(uint32 mapId, uint32 InstanceId);
|
||||
MapPersistentState* GetPersistentState(uint32 mapId, uint32 InstanceId);
|
||||
|
||||
void RemovePersistentState(uint32 mapId, uint32 instanceId);
|
||||
|
||||
|
|
@ -372,8 +372,8 @@ class MANGOS_DLL_DECL MapPersistentStateManager : public MaNGOS::Singleton<MapPe
|
|||
void _ResetInstance(uint32 mapid, uint32 instanceId);
|
||||
void _CleanupExpiredInstancesAtTime(time_t t);
|
||||
|
||||
void _ResetSave(PersistentStateMap& holder, PersistentStateMap::iterator &itr);
|
||||
void _DelHelper(DatabaseType &db, const char *fields, const char *table, const char *queryTail,...);
|
||||
void _ResetSave(PersistentStateMap& holder, PersistentStateMap::iterator& itr);
|
||||
void _DelHelper(DatabaseType& db, const char* fields, const char* table, const char* queryTail,...);
|
||||
|
||||
// used during global instance resets
|
||||
bool lock_instLists;
|
||||
|
|
@ -394,7 +394,7 @@ inline void MapPersistentStateManager::DoForAllStatesWithMapId(uint32 mapId, Do&
|
|||
|
||||
if (mapEntry->Instanceable())
|
||||
{
|
||||
for(PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end();)
|
||||
for (PersistentStateMap::iterator itr = m_instanceSaveByInstanceId.begin(); itr != m_instanceSaveByInstanceId.end();)
|
||||
{
|
||||
if (itr->second->GetMapId() == mapId)
|
||||
_do((itr++)->second);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class MANGOS_DLL_SPEC MapReference : public Reference<Map, Player>
|
|||
void targetObjectDestroyLink()
|
||||
{
|
||||
// called from unlink()
|
||||
if(isValid()) getTarget()->m_mapRefManager.decSize();
|
||||
if (isValid()) getTarget()->m_mapRefManager.decSize();
|
||||
}
|
||||
void sourceObjectDestroyLink()
|
||||
{
|
||||
|
|
@ -44,9 +44,9 @@ class MANGOS_DLL_SPEC MapReference : public Reference<Map, Player>
|
|||
public:
|
||||
MapReference() : Reference<Map, Player>() {}
|
||||
~MapReference() { unlink(); }
|
||||
MapReference *next() { return (MapReference*)Reference<Map, Player>::next(); }
|
||||
MapReference const *next() const { return (MapReference const*)Reference<Map, Player>::next(); }
|
||||
MapReference *nockeck_prev() { return (MapReference*)Reference<Map, Player>::nocheck_prev(); }
|
||||
MapReference const *nocheck_prev() const { return (MapReference const*)Reference<Map, Player>::nocheck_prev(); }
|
||||
MapReference* next() { return (MapReference*)Reference<Map, Player>::next(); }
|
||||
MapReference const* next() const { return (MapReference const*)Reference<Map, Player>::next(); }
|
||||
MapReference* nockeck_prev() { return (MapReference*)Reference<Map, Player>::nocheck_prev(); }
|
||||
MapReference const* nocheck_prev() const { return (MapReference const*)Reference<Map, Player>::nocheck_prev(); }
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ void MassMailMgr::AddMassMailTask(MailDraft* mailProto, MailSender sender, uint3
|
|||
|
||||
struct MassMailerQueryHandler
|
||||
{
|
||||
void HandleQueryCallback(QueryResult * result, MailDraft* mailProto, MailSender sender)
|
||||
void HandleQueryCallback(QueryResult* result, MailDraft* mailProto, MailSender sender)
|
||||
{
|
||||
if (!result)
|
||||
return;
|
||||
|
|
@ -58,10 +58,11 @@ struct MassMailerQueryHandler
|
|||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
Field* fields = result->Fetch();
|
||||
recievers.insert(fields[0].GetUInt32());
|
||||
|
||||
} while (result->NextRow());
|
||||
}
|
||||
while (result->NextRow());
|
||||
delete result;
|
||||
}
|
||||
} massMailerQueryHandler;
|
||||
|
|
@ -88,7 +89,7 @@ void MassMailMgr::Update(bool sendall /*= false*/)
|
|||
task.m_receivers.erase(task.m_receivers.begin());
|
||||
|
||||
ObjectGuid receiver_guid = ObjectGuid(HIGHGUID_PLAYER, receiver_lowguid);
|
||||
Player *receiver = sObjectMgr.GetPlayer(receiver_guid);
|
||||
Player* receiver = sObjectMgr.GetPlayer(receiver_guid);
|
||||
|
||||
// last case. can be just send
|
||||
if (task.m_receivers.empty())
|
||||
|
|
@ -115,7 +116,7 @@ void MassMailMgr::Update(bool sendall /*= false*/)
|
|||
if (task.m_receivers.empty())
|
||||
m_massMails.pop_front();
|
||||
}
|
||||
while(!m_massMails.empty() && (sendall || maxcount > 0));
|
||||
while (!m_massMails.empty() && (sendall || maxcount > 0));
|
||||
}
|
||||
|
||||
void MassMailMgr::GetStatistic(uint32& tasks, uint32& mails, uint32& needTime) const
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include <cassert>
|
||||
|
||||
inline bool isStatic(MovementGenerator *mv)
|
||||
inline bool isStatic(MovementGenerator* mv)
|
||||
{
|
||||
return (mv == &si_idleMovement);
|
||||
}
|
||||
|
|
@ -62,9 +62,9 @@ void MotionMaster::Initialize()
|
|||
MotionMaster::~MotionMaster()
|
||||
{
|
||||
// just deallocate movement generator, but do not Finalize since it may access to already deallocated owner's memory
|
||||
while(!empty())
|
||||
while (!empty())
|
||||
{
|
||||
MovementGenerator * m = top();
|
||||
MovementGenerator* m = top();
|
||||
pop();
|
||||
if (!isStatic(m))
|
||||
delete m;
|
||||
|
|
@ -76,7 +76,7 @@ void MotionMaster::UpdateMotion(uint32 diff)
|
|||
if (m_owner->hasUnitState(UNIT_STAT_CAN_NOT_MOVE))
|
||||
return;
|
||||
|
||||
MANGOS_ASSERT( !empty() );
|
||||
MANGOS_ASSERT(!empty());
|
||||
m_cleanFlag |= MMCF_UPDATE;
|
||||
|
||||
if (!top()->Update(*m_owner, diff))
|
||||
|
|
@ -112,9 +112,9 @@ void MotionMaster::UpdateMotion(uint32 diff)
|
|||
|
||||
void MotionMaster::DirectClean(bool reset, bool all)
|
||||
{
|
||||
while( all ? !empty() : size() > 1 )
|
||||
while (all ? !empty() : size() > 1)
|
||||
{
|
||||
MovementGenerator *curr = top();
|
||||
MovementGenerator* curr = top();
|
||||
pop();
|
||||
curr->Finalize(*m_owner);
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ void MotionMaster::DirectClean(bool reset, bool all)
|
|||
|
||||
if (!all && reset)
|
||||
{
|
||||
MANGOS_ASSERT( !empty() );
|
||||
MANGOS_ASSERT(!empty());
|
||||
top()->Reset(*m_owner);
|
||||
}
|
||||
}
|
||||
|
|
@ -142,9 +142,9 @@ void MotionMaster::DelayedClean(bool reset, bool all)
|
|||
if (!m_expList)
|
||||
m_expList = new ExpireList();
|
||||
|
||||
while( all ? !empty() : size() > 1 )
|
||||
while (all ? !empty() : size() > 1)
|
||||
{
|
||||
MovementGenerator *curr = top();
|
||||
MovementGenerator* curr = top();
|
||||
pop();
|
||||
curr->Finalize(*m_owner);
|
||||
|
||||
|
|
@ -158,13 +158,13 @@ void MotionMaster::DirectExpire(bool reset)
|
|||
if (empty() || size() == 1)
|
||||
return;
|
||||
|
||||
MovementGenerator *curr = top();
|
||||
MovementGenerator* curr = top();
|
||||
pop();
|
||||
|
||||
// also drop stored under top() targeted motions
|
||||
while (!empty() && (top()->GetMovementGeneratorType() == CHASE_MOTION_TYPE || top()->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE))
|
||||
{
|
||||
MovementGenerator *temp = top();
|
||||
MovementGenerator* temp = top();
|
||||
pop();
|
||||
temp->Finalize(*m_owner);
|
||||
delete temp;
|
||||
|
|
@ -196,7 +196,7 @@ void MotionMaster::DelayedExpire(bool reset)
|
|||
if (empty() || size() == 1)
|
||||
return;
|
||||
|
||||
MovementGenerator *curr = top();
|
||||
MovementGenerator* curr = top();
|
||||
pop();
|
||||
|
||||
if (!m_expList)
|
||||
|
|
@ -205,10 +205,10 @@ void MotionMaster::DelayedExpire(bool reset)
|
|||
// also drop stored under top() targeted motions
|
||||
while (!empty() && (top()->GetMovementGeneratorType() == CHASE_MOTION_TYPE || top()->GetMovementGeneratorType() == FOLLOW_MOTION_TYPE))
|
||||
{
|
||||
MovementGenerator *temp = top();
|
||||
MovementGenerator* temp = top();
|
||||
pop();
|
||||
temp ->Finalize(*m_owner);
|
||||
m_expList->push_back(temp );
|
||||
m_expList->push_back(temp);
|
||||
}
|
||||
|
||||
curr->Finalize(*m_owner);
|
||||
|
|
@ -234,7 +234,7 @@ void MotionMaster::MoveRandomAroundPoint(float x, float y, float z, float radius
|
|||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s move random.", m_owner->GetGuidStr().c_str());
|
||||
Mutate(new RandomMovementGenerator<Creature>(x, y, z, radius, verticalZ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MotionMaster::MoveTargetedHome()
|
||||
{
|
||||
|
|
@ -256,7 +256,7 @@ void MotionMaster::MoveTargetedHome()
|
|||
}
|
||||
else if (m_owner->GetTypeId() == TYPEID_UNIT && ((Creature*)m_owner)->GetCharmerOrOwnerGuid())
|
||||
{
|
||||
if (Unit *target = ((Creature*)m_owner)->GetCharmerOrOwner())
|
||||
if (Unit* target = ((Creature*)m_owner)->GetCharmerOrOwner())
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s follow to %s", m_owner->GetGuidStr().c_str(), target->GetGuidStr().c_str());
|
||||
Mutate(new FollowMovementGenerator<Creature>(*target,PET_FOLLOW_DIST,PET_FOLLOW_ANGLE));
|
||||
|
|
@ -315,7 +315,7 @@ void MotionMaster::MoveFollow(Unit* target, float dist, float angle)
|
|||
|
||||
void MotionMaster::MovePoint(uint32 id, float x, float y, float z, bool generatePath)
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted point (Id: %u X: %f Y: %f Z: %f)", m_owner->GetGuidStr().c_str(), id, x, y, z );
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s targeted point (Id: %u X: %f Y: %f Z: %f)", m_owner->GetGuidStr().c_str(), id, x, y, z);
|
||||
|
||||
if (m_owner->GetTypeId() == TYPEID_PLAYER)
|
||||
Mutate(new PointMovementGenerator<Player>(id,x,y,z,generatePath));
|
||||
|
|
@ -332,7 +332,7 @@ void MotionMaster::MoveSeekAssistance(float x, float y, float z)
|
|||
else
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s seek assistance (X: %f Y: %f Z: %f)",
|
||||
m_owner->GetGuidStr().c_str(), x, y, z );
|
||||
m_owner->GetGuidStr().c_str(), x, y, z);
|
||||
Mutate(new AssistanceMovementGenerator(x,y,z));
|
||||
}
|
||||
}
|
||||
|
|
@ -346,7 +346,7 @@ void MotionMaster::MoveSeekAssistanceDistract(uint32 time)
|
|||
else
|
||||
{
|
||||
DEBUG_FILTER_LOG(LOG_FILTER_AI_AND_MOVEGENSS, "%s is distracted after assistance call (Time: %u)",
|
||||
m_owner->GetGuidStr().c_str(), time );
|
||||
m_owner->GetGuidStr().c_str(), time);
|
||||
Mutate(new AssistanceDistractMovementGenerator(time));
|
||||
}
|
||||
}
|
||||
|
|
@ -420,11 +420,11 @@ void MotionMaster::MoveDistract(uint32 timer)
|
|||
Mutate(mgen);
|
||||
}
|
||||
|
||||
void MotionMaster::Mutate(MovementGenerator *m)
|
||||
void MotionMaster::Mutate(MovementGenerator* m)
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
switch(top()->GetMovementGeneratorType())
|
||||
switch (top()->GetMovementGeneratorType())
|
||||
{
|
||||
// HomeMovement is not that important, delete it if meanwhile a new comes
|
||||
case HOME_MOTION_TYPE:
|
||||
|
|
@ -447,7 +447,7 @@ void MotionMaster::Mutate(MovementGenerator *m)
|
|||
void MotionMaster::propagateSpeedChange()
|
||||
{
|
||||
Impl::container_type::iterator it = Impl::c.begin();
|
||||
for ( ;it != end(); ++it)
|
||||
for (; it != end(); ++it)
|
||||
{
|
||||
(*it)->unitSpeedChanged();
|
||||
}
|
||||
|
|
@ -461,7 +461,7 @@ MovementGeneratorType MotionMaster::GetCurrentMovementGeneratorType() const
|
|||
return top()->GetMovementGeneratorType();
|
||||
}
|
||||
|
||||
bool MotionMaster::GetDestination(float &x, float &y, float &z)
|
||||
bool MotionMaster::GetDestination(float& x, float& y, float& z)
|
||||
{
|
||||
if (m_owner->movespline->Finalized())
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@ enum MMCleanFlag
|
|||
MMCF_RESET = 2 // Flag if need top()->Reset()
|
||||
};
|
||||
|
||||
class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
|
||||
class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator*>
|
||||
{
|
||||
private:
|
||||
typedef std::stack<MovementGenerator *> Impl;
|
||||
typedef std::vector<MovementGenerator *> ExpireList;
|
||||
typedef std::stack<MovementGenerator*> Impl;
|
||||
typedef std::vector<MovementGenerator*> ExpireList;
|
||||
public:
|
||||
|
||||
explicit MotionMaster(Unit *unit) : m_owner(unit), m_expList(NULL), m_cleanFlag(MMCF_NONE) {}
|
||||
explicit MotionMaster(Unit* unit) : m_owner(unit), m_expList(NULL), m_cleanFlag(MMCF_NONE) {}
|
||||
~MotionMaster();
|
||||
|
||||
void Initialize();
|
||||
|
|
@ -118,9 +118,9 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
|
|||
// will only work in MMgens where we have a target (TARGETED_MOTION_TYPE)
|
||||
void UpdateFinalDistanceToTarget(float fDistance);
|
||||
|
||||
bool GetDestination(float &x, float &y, float &z);
|
||||
bool GetDestination(float& x, float& y, float& z);
|
||||
private:
|
||||
void Mutate(MovementGenerator *m); // use Move* functions instead
|
||||
void Mutate(MovementGenerator* m); // use Move* functions instead
|
||||
|
||||
void DirectClean(bool reset, bool all);
|
||||
void DelayedClean(bool reset, bool all);
|
||||
|
|
@ -128,8 +128,8 @@ class MANGOS_DLL_SPEC MotionMaster : private std::stack<MovementGenerator *>
|
|||
void DirectExpire(bool reset);
|
||||
void DelayedExpire(bool reset);
|
||||
|
||||
Unit *m_owner;
|
||||
ExpireList *m_expList;
|
||||
Unit* m_owner;
|
||||
ExpireList* m_expList;
|
||||
uint8 m_cleanFlag;
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ namespace MMAP
|
|||
{
|
||||
// ######################## MMapFactory ########################
|
||||
// our global singelton copy
|
||||
MMapManager *g_MMapManager = NULL;
|
||||
MMapManager* g_MMapManager = NULL;
|
||||
|
||||
// stores list of mapids which do not use pathfinding
|
||||
std::set<uint32>* g_mmapDisabledIds = NULL;
|
||||
|
||||
MMapManager* MMapFactory::createOrGetMMapManager()
|
||||
{
|
||||
if(g_MMapManager == NULL)
|
||||
if (g_MMapManager == NULL)
|
||||
g_MMapManager = new MMapManager();
|
||||
|
||||
return g_MMapManager;
|
||||
|
|
@ -42,7 +42,7 @@ namespace MMAP
|
|||
|
||||
void MMapFactory::preventPathfindingOnMaps(const char* ignoreMapIds)
|
||||
{
|
||||
if(!g_mmapDisabledIds)
|
||||
if (!g_mmapDisabledIds)
|
||||
g_mmapDisabledIds = new std::set<uint32>();
|
||||
|
||||
uint32 strLenght = strlen(ignoreMapIds)+1;
|
||||
|
|
@ -67,13 +67,13 @@ namespace MMAP
|
|||
|
||||
void MMapFactory::clear()
|
||||
{
|
||||
if(g_mmapDisabledIds)
|
||||
if (g_mmapDisabledIds)
|
||||
{
|
||||
delete g_mmapDisabledIds;
|
||||
g_mmapDisabledIds = NULL;
|
||||
}
|
||||
|
||||
if(g_MMapManager)
|
||||
if (g_MMapManager)
|
||||
{
|
||||
delete g_MMapManager;
|
||||
g_MMapManager = NULL;
|
||||
|
|
@ -98,7 +98,7 @@ namespace MMAP
|
|||
|
||||
// load and init dtNavMesh - read parameters from file
|
||||
uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%03i.mmap")+1;
|
||||
char *fileName = new char[pathLen];
|
||||
char* fileName = new char[pathLen];
|
||||
snprintf(fileName, pathLen, (sWorld.GetDataPath()+"mmaps/%03i.mmap").c_str(), mapId);
|
||||
|
||||
FILE* file = fopen(fileName, "rb");
|
||||
|
|
@ -143,7 +143,7 @@ namespace MMAP
|
|||
bool MMapManager::loadMap(uint32 mapId, int32 x, int32 y)
|
||||
{
|
||||
// make sure the mmap is loaded and ready to load tiles
|
||||
if(!loadMapData(mapId))
|
||||
if (!loadMapData(mapId))
|
||||
return false;
|
||||
|
||||
// get this mmap data
|
||||
|
|
@ -160,10 +160,10 @@ namespace MMAP
|
|||
|
||||
// load this tile :: mmaps/MMMXXYY.mmtile
|
||||
uint32 pathLen = sWorld.GetDataPath().length() + strlen("mmaps/%03i%02i%02i.mmtile")+1;
|
||||
char *fileName = new char[pathLen];
|
||||
char* fileName = new char[pathLen];
|
||||
snprintf(fileName, pathLen, (sWorld.GetDataPath()+"mmaps/%03i%02i%02i.mmtile").c_str(), mapId, x, y);
|
||||
|
||||
FILE *file = fopen(fileName, "rb");
|
||||
FILE* file = fopen(fileName, "rb");
|
||||
if (!file)
|
||||
{
|
||||
sLog.outDebug("MMAP:loadMap: Could not open mmtile file '%s'", fileName);
|
||||
|
|
@ -193,7 +193,7 @@ namespace MMAP
|
|||
MANGOS_ASSERT(data);
|
||||
|
||||
size_t result = fread(data, fileHeader.size, 1, file);
|
||||
if(!result)
|
||||
if (!result)
|
||||
{
|
||||
sLog.outError("MMAP:loadMap: Bad header or data in mmap %03u%02i%02i.mmtile", mapId, x, y);
|
||||
fclose(file);
|
||||
|
|
@ -243,7 +243,7 @@ namespace MMAP
|
|||
dtTileRef tileRef = mmap->mmapLoadedTiles[packedGridPos];
|
||||
|
||||
// unload, and mark as non loaded
|
||||
if(DT_SUCCESS != mmap->navMesh->removeTile(tileRef, NULL, NULL))
|
||||
if (DT_SUCCESS != mmap->navMesh->removeTile(tileRef, NULL, NULL))
|
||||
{
|
||||
// this is technically a memory leak
|
||||
// if the grid is later reloaded, dtNavMesh::addTile will return error but no extra memory is used
|
||||
|
|
@ -277,7 +277,7 @@ namespace MMAP
|
|||
{
|
||||
uint32 x = (i->first >> 16);
|
||||
uint32 y = (i->first & 0x0000FFFF);
|
||||
if(DT_SUCCESS != mmap->navMesh->removeTile(i->second, NULL, NULL))
|
||||
if (DT_SUCCESS != mmap->navMesh->removeTile(i->second, NULL, NULL))
|
||||
sLog.outError("MMAP:unloadMap: Could not unload %03u%02i%02i.mmtile from navmesh", mapId, x, y);
|
||||
else
|
||||
{
|
||||
|
|
@ -338,7 +338,7 @@ namespace MMAP
|
|||
// allocate mesh query
|
||||
dtNavMeshQuery* query = dtAllocNavMeshQuery();
|
||||
MANGOS_ASSERT(query);
|
||||
if(DT_SUCCESS != query->init(mmap->navMesh, 1024))
|
||||
if (DT_SUCCESS != query->init(mmap->navMesh, 1024))
|
||||
{
|
||||
dtFreeNavMeshQuery(query);
|
||||
sLog.outError("MMAP:GetNavMeshQuery: Failed to initialize dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ inline void* dtCustomAlloc(int size, dtAllocHint /*hint*/)
|
|||
|
||||
inline void dtCustomFree(void* ptr)
|
||||
{
|
||||
delete [] (unsigned char*)ptr;
|
||||
delete [](unsigned char*)ptr;
|
||||
}
|
||||
|
||||
// move map related classes
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ MovementGenerator::~MovementGenerator()
|
|||
{
|
||||
}
|
||||
|
||||
bool MovementGenerator::IsActive( Unit& u )
|
||||
bool MovementGenerator::IsActive(Unit& u)
|
||||
{
|
||||
// When movement generator list modified from Update movegen object erase delayed,
|
||||
// so pointer still valid and be used for check
|
||||
|
|
|
|||
|
|
@ -34,16 +34,16 @@ class MANGOS_DLL_SPEC MovementGenerator
|
|||
virtual ~MovementGenerator();
|
||||
|
||||
// called before adding movement generator to motion stack
|
||||
virtual void Initialize(Unit &) = 0;
|
||||
virtual void Initialize(Unit&) = 0;
|
||||
// called aftre remove movement generator from motion stack
|
||||
virtual void Finalize(Unit &) = 0;
|
||||
virtual void Finalize(Unit&) = 0;
|
||||
|
||||
// called before lost top position (before push new movement generator above)
|
||||
virtual void Interrupt(Unit &) = 0;
|
||||
virtual void Interrupt(Unit&) = 0;
|
||||
// called after return movement generator to top position (after remove above movement generator)
|
||||
virtual void Reset(Unit &) = 0;
|
||||
virtual void Reset(Unit&) = 0;
|
||||
|
||||
virtual bool Update(Unit &, const uint32 &time_diff) = 0;
|
||||
virtual bool Update(Unit&, const uint32& time_diff) = 0;
|
||||
|
||||
virtual MovementGeneratorType GetMovementGeneratorType() const = 0;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ class MANGOS_DLL_SPEC MovementGenerator
|
|||
virtual void UpdateFinalDistance(float /*fDistance*/) { }
|
||||
|
||||
// used by Evade code for select point to evade with expected restart default movement
|
||||
virtual bool GetResetPosition(Unit &, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
|
||||
virtual bool GetResetPosition(Unit&, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
|
||||
|
||||
// given destination unreachable? due to pathfinsing or other
|
||||
virtual bool IsReachable() const { return true; }
|
||||
|
|
@ -66,27 +66,27 @@ template<class T, class D>
|
|||
class MANGOS_DLL_SPEC MovementGeneratorMedium : public MovementGenerator
|
||||
{
|
||||
public:
|
||||
void Initialize(Unit &u)
|
||||
void Initialize(Unit& u)
|
||||
{
|
||||
//u->AssertIsType<T>();
|
||||
(static_cast<D*>(this))->Initialize(*((T*)&u));
|
||||
}
|
||||
void Finalize(Unit &u)
|
||||
void Finalize(Unit& u)
|
||||
{
|
||||
//u->AssertIsType<T>();
|
||||
(static_cast<D*>(this))->Finalize(*((T*)&u));
|
||||
}
|
||||
void Interrupt(Unit &u)
|
||||
void Interrupt(Unit& u)
|
||||
{
|
||||
//u->AssertIsType<T>();
|
||||
(static_cast<D*>(this))->Interrupt(*((T*)&u));
|
||||
}
|
||||
void Reset(Unit &u)
|
||||
void Reset(Unit& u)
|
||||
{
|
||||
//u->AssertIsType<T>();
|
||||
(static_cast<D*>(this))->Reset(*((T*)&u));
|
||||
}
|
||||
bool Update(Unit &u, const uint32 &time_diff)
|
||||
bool Update(Unit& u, const uint32& time_diff)
|
||||
{
|
||||
//u->AssertIsType<T>();
|
||||
return (static_cast<D*>(this))->Update(*((T*)&u), time_diff);
|
||||
|
|
@ -98,11 +98,11 @@ class MANGOS_DLL_SPEC MovementGeneratorMedium : public MovementGenerator
|
|||
}
|
||||
public:
|
||||
// will not link if not overridden in the generators
|
||||
void Initialize(T &u);
|
||||
void Finalize(T &u);
|
||||
void Interrupt(T &u);
|
||||
void Reset(T &u);
|
||||
bool Update(T &u, const uint32 &time_diff);
|
||||
void Initialize(T& u);
|
||||
void Finalize(T& u);
|
||||
void Interrupt(T& u);
|
||||
void Reset(T& u);
|
||||
bool Update(T& u, const uint32& time_diff);
|
||||
|
||||
// not need always overwrites
|
||||
bool GetResetPosition(T& /*u*/, float& /*x*/, float& /*y*/, float& /*z*/) { return false; }
|
||||
|
|
@ -118,7 +118,7 @@ struct MovementGeneratorFactory : public SelectableMovement
|
|||
{
|
||||
MovementGeneratorFactory(MovementGeneratorType mgt) : SelectableMovement(mgt) {}
|
||||
|
||||
MovementGenerator* Create(void *) const;
|
||||
MovementGenerator* Create(void*) const;
|
||||
};
|
||||
|
||||
typedef FactoryHolder<MovementGenerator,MovementGeneratorType> MovementGeneratorCreator;
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@
|
|||
|
||||
template<class MOVEMENT_GEN>
|
||||
inline MovementGenerator*
|
||||
MovementGeneratorFactory<MOVEMENT_GEN>::Create(void *data) const
|
||||
MovementGeneratorFactory<MOVEMENT_GEN>::Create(void* data) const
|
||||
{
|
||||
Creature* creature = reinterpret_cast<Creature *>(data);
|
||||
Creature* creature = reinterpret_cast<Creature*>(data);
|
||||
return (new MOVEMENT_GEN(*creature));
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -32,16 +32,16 @@
|
|||
#include "MapPersistentStateMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ )
|
||||
void WorldSession::HandleMoveWorldportAckOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
DEBUG_LOG( "WORLD: got MSG_MOVE_WORLDPORT_ACK." );
|
||||
DEBUG_LOG("WORLD: got MSG_MOVE_WORLDPORT_ACK.");
|
||||
HandleMoveWorldportAckOpcode();
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
{
|
||||
// ignore unexpected far teleports
|
||||
if(!GetPlayer()->IsBeingTeleportedFar())
|
||||
if (!GetPlayer()->IsBeingTeleportedFar())
|
||||
return;
|
||||
|
||||
// get start teleport coordinates (will used later in fail case)
|
||||
|
|
@ -49,7 +49,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
GetPlayer()->GetPosition(old_loc);
|
||||
|
||||
// get the teleport destination
|
||||
WorldLocation &loc = GetPlayer()->GetTeleportDest();
|
||||
WorldLocation& loc = GetPlayer()->GetTeleportDest();
|
||||
|
||||
// possible errors in the coordinate validity check (only cheating case possible)
|
||||
if (!MapManager::IsValidMapCoord(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation))
|
||||
|
|
@ -70,7 +70,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
Map* map = NULL;
|
||||
|
||||
// prevent crash at attempt landing to not existed battleground instance
|
||||
if(mEntry->IsBattleGroundOrArena())
|
||||
if (mEntry->IsBattleGroundOrArena())
|
||||
{
|
||||
if (GetPlayer()->GetBattleGroundId())
|
||||
map = sMapMgr.FindMap(loc.mapid, GetPlayer()->GetBattleGroundId());
|
||||
|
|
@ -133,10 +133,10 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
|
||||
// battleground state prepare (in case join to BG), at relogin/tele player not invited
|
||||
// only add to bg group and object, if the player was invited (else he entered through command)
|
||||
if(_player->InBattleGround())
|
||||
if (_player->InBattleGround())
|
||||
{
|
||||
// cleanup setting if outdated
|
||||
if(!mEntry->IsBattleGroundOrArena())
|
||||
if (!mEntry->IsBattleGroundOrArena())
|
||||
{
|
||||
// We're not in BG
|
||||
_player->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE);
|
||||
|
|
@ -144,9 +144,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
_player->SetBGTeam(TEAM_NONE);
|
||||
}
|
||||
// join to bg case
|
||||
else if(BattleGround *bg = _player->GetBattleGround())
|
||||
else if (BattleGround* bg = _player->GetBattleGround())
|
||||
{
|
||||
if(_player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
|
||||
if (_player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
|
||||
bg->AddPlayer(_player);
|
||||
}
|
||||
}
|
||||
|
|
@ -154,9 +154,9 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
GetPlayer()->SendInitialPacketsAfterAddToMap();
|
||||
|
||||
// flight fast teleport case
|
||||
if(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
|
||||
if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
|
||||
{
|
||||
if(!_player->InBattleGround())
|
||||
if (!_player->InBattleGround())
|
||||
{
|
||||
// short preparations to continue flight
|
||||
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
|
||||
|
|
@ -172,7 +172,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
if (mInstance)
|
||||
{
|
||||
Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
|
||||
if(MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,diff))
|
||||
if (MapDifficulty const* mapDiff = GetMapDifficultyData(mEntry->MapID,diff))
|
||||
{
|
||||
if (mapDiff->resetTime)
|
||||
{
|
||||
|
|
@ -186,11 +186,11 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
}
|
||||
|
||||
// mount allow check
|
||||
if(!mEntry->IsMountAllowed())
|
||||
if (!mEntry->IsMountAllowed())
|
||||
_player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
|
||||
|
||||
// honorless target
|
||||
if(GetPlayer()->pvpInfo.inHostileArea)
|
||||
if (GetPlayer()->pvpInfo.inHostileArea)
|
||||
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
|
||||
|
||||
// resummon pet
|
||||
|
|
@ -213,13 +213,13 @@ void WorldSession::HandleMoveTeleportAckOpcode(WorldPacket& recv_data)
|
|||
DEBUG_LOG("Guid: %s", guid.GetString().c_str());
|
||||
DEBUG_LOG("Counter %u, time %u", counter, time/IN_MILLISECONDS);
|
||||
|
||||
Unit *mover = _player->GetMover();
|
||||
Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
Unit* mover = _player->GetMover();
|
||||
Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
|
||||
if(!plMover || !plMover->IsBeingTeleportedNear())
|
||||
if (!plMover || !plMover->IsBeingTeleportedNear())
|
||||
return;
|
||||
|
||||
if(guid != plMover->GetObjectGuid())
|
||||
if (guid != plMover->GetObjectGuid())
|
||||
return;
|
||||
|
||||
plMover->SetSemaphoreTeleportNear(false);
|
||||
|
|
@ -235,10 +235,10 @@ void WorldSession::HandleMoveTeleportAckOpcode(WorldPacket& recv_data)
|
|||
plMover->UpdateZone(newzone, newarea);
|
||||
|
||||
// new zone
|
||||
if(old_zone != newzone)
|
||||
if (old_zone != newzone)
|
||||
{
|
||||
// honorless target
|
||||
if(plMover->pvpInfo.inHostileArea)
|
||||
if (plMover->pvpInfo.inHostileArea)
|
||||
plMover->CastSpell(plMover, 2479, true);
|
||||
}
|
||||
|
||||
|
|
@ -249,17 +249,17 @@ void WorldSession::HandleMoveTeleportAckOpcode(WorldPacket& recv_data)
|
|||
GetPlayer()->ProcessDelayedOperations();
|
||||
}
|
||||
|
||||
void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
||||
void WorldSession::HandleMovementOpcodes(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 opcode = recv_data.GetOpcode();
|
||||
DEBUG_LOG("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
|
||||
recv_data.hexlike();
|
||||
|
||||
Unit *mover = _player->GetMover();
|
||||
Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
Unit* mover = _player->GetMover();
|
||||
Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
|
||||
// ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
|
||||
if(plMover && plMover->IsBeingTeleported())
|
||||
if (plMover && plMover->IsBeingTeleported())
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
return;
|
||||
|
|
@ -292,7 +292,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||
mover->SendMessageToSetExcept(&data, _player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket &recv_data)
|
||||
void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 opcode = recv_data.GetOpcode();
|
||||
DEBUG_LOG("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
|
||||
|
|
@ -308,7 +308,7 @@ void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket &recv_data)
|
|||
recv_data >> newspeed;
|
||||
|
||||
// now can skip not our packet
|
||||
if(_player->GetObjectGuid() != guid)
|
||||
if (_player->GetObjectGuid() != guid)
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
return;
|
||||
|
|
@ -322,7 +322,7 @@ void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket &recv_data)
|
|||
|
||||
static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack", "PitchRate" };
|
||||
|
||||
switch(opcode)
|
||||
switch (opcode)
|
||||
{
|
||||
case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break;
|
||||
case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break;
|
||||
|
|
@ -340,16 +340,16 @@ void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket &recv_data)
|
|||
|
||||
// skip all forced speed changes except last and unexpected
|
||||
// in run/mounted case used one ACK and it must be skipped.m_forced_speed_changes[MOVE_RUN} store both.
|
||||
if(_player->m_forced_speed_changes[force_move_type] > 0)
|
||||
if (_player->m_forced_speed_changes[force_move_type] > 0)
|
||||
{
|
||||
--_player->m_forced_speed_changes[force_move_type];
|
||||
if(_player->m_forced_speed_changes[force_move_type] > 0)
|
||||
if (_player->m_forced_speed_changes[force_move_type] > 0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player->GetTransport() && fabs(_player->GetSpeed(move_type) - newspeed) > 0.01f)
|
||||
{
|
||||
if(_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
|
||||
if (_player->GetSpeed(move_type) > newspeed) // must be greater - just correct
|
||||
{
|
||||
sLog.outError("%sSpeedChange player %s is NOT correct (must be %f instead %f), force set to correct value",
|
||||
move_type_name[move_type], _player->GetName(), _player->GetSpeed(move_type), newspeed);
|
||||
|
|
@ -364,7 +364,7 @@ void WorldSession::HandleForceSpeedChangeAckOpcodes(WorldPacket &recv_data)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
|
||||
recv_data.hexlike();
|
||||
|
|
@ -372,7 +372,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
|
|||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
if(_player->GetMover()->GetObjectGuid() != guid)
|
||||
if (_player->GetMover()->GetObjectGuid() != guid)
|
||||
{
|
||||
sLog.outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is %s and should be %s",
|
||||
_player->GetMover()->GetGuidStr().c_str(), guid.GetString().c_str());
|
||||
|
|
@ -380,7 +380,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
|
|||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
|
||||
recv_data.hexlike();
|
||||
|
|
@ -391,7 +391,7 @@ void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data)
|
|||
recv_data >> old_mover_guid.ReadAsPacked();
|
||||
recv_data >> mi;
|
||||
|
||||
if(_player->GetMover()->GetObjectGuid() == old_mover_guid)
|
||||
if (_player->GetMover()->GetObjectGuid() == old_mover_guid)
|
||||
{
|
||||
sLog.outError("HandleMoveNotActiveMover: incorrect mover guid: mover is %s and should be %s instead of %s",
|
||||
_player->GetMover()->GetGuidStr().c_str(),
|
||||
|
|
@ -404,7 +404,7 @@ void WorldSession::HandleMoveNotActiveMoverOpcode(WorldPacket &recv_data)
|
|||
_player->m_movementInfo = mi;
|
||||
}
|
||||
|
||||
void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
|
||||
void WorldSession::HandleDismissControlledVehicle(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
|
||||
recv_data.hexlike();
|
||||
|
|
@ -432,15 +432,15 @@ void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvdata*/)
|
|||
GetPlayer()->SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
|
||||
void WorldSession::HandleMoveKnockBackAck(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_MOVE_KNOCK_BACK_ACK");
|
||||
|
||||
Unit *mover = _player->GetMover();
|
||||
Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
Unit* mover = _player->GetMover();
|
||||
Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL;
|
||||
|
||||
// ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck
|
||||
if(plMover && plMover->IsBeingTeleported())
|
||||
if (plMover && plMover->IsBeingTeleported())
|
||||
{
|
||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||
return;
|
||||
|
|
@ -468,7 +468,7 @@ void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
|
|||
mover->SendMessageToSetExcept(&data, _player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMoveHoverAck( WorldPacket& recv_data )
|
||||
void WorldSession::HandleMoveHoverAck(WorldPacket& recv_data)
|
||||
{
|
||||
DEBUG_LOG("CMSG_MOVE_HOVER_ACK");
|
||||
|
||||
|
|
@ -520,11 +520,11 @@ bool WorldSession::VerifyMovementInfo(MovementInfo const& movementInfo, ObjectGu
|
|||
{
|
||||
// transports size limited
|
||||
// (also received at zeppelin/lift leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
|
||||
if( movementInfo.GetTransportPos()->x > 50 || movementInfo.GetTransportPos()->y > 50 || movementInfo.GetTransportPos()->z > 100 )
|
||||
if (movementInfo.GetTransportPos()->x > 50 || movementInfo.GetTransportPos()->y > 50 || movementInfo.GetTransportPos()->z > 100)
|
||||
return false;
|
||||
|
||||
if( !MaNGOS::IsValidMapCoord(movementInfo.GetPos()->x + movementInfo.GetTransportPos()->x, movementInfo.GetPos()->y + movementInfo.GetTransportPos()->y,
|
||||
movementInfo.GetPos()->z + movementInfo.GetTransportPos()->z, movementInfo.GetPos()->o + movementInfo.GetTransportPos()->o) )
|
||||
if (!MaNGOS::IsValidMapCoord(movementInfo.GetPos()->x + movementInfo.GetTransportPos()->x, movementInfo.GetPos()->y + movementInfo.GetTransportPos()->y,
|
||||
movementInfo.GetPos()->z + movementInfo.GetTransportPos()->z, movementInfo.GetPos()->o + movementInfo.GetTransportPos()->o))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -537,9 +537,9 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
|
|||
{
|
||||
movementInfo.UpdateTime(WorldTimer::getMSTime());
|
||||
|
||||
Unit *mover = _player->GetMover();
|
||||
Unit* mover = _player->GetMover();
|
||||
|
||||
if (Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL)
|
||||
if (Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL)
|
||||
{
|
||||
if (movementInfo.HasMovementFlag(MOVEFLAG_ONTRANSPORT))
|
||||
{
|
||||
|
|
@ -567,15 +567,15 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
|
|||
if (movementInfo.HasMovementFlag(MOVEFLAG_SWIMMING) != plMover->IsInWater())
|
||||
{
|
||||
// now client not include swimming flag in case jumping under water
|
||||
plMover->SetInWater( !plMover->IsInWater() || plMover->GetTerrain()->IsUnderWater(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z) );
|
||||
plMover->SetInWater(!plMover->IsInWater() || plMover->GetTerrain()->IsUnderWater(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z));
|
||||
}
|
||||
|
||||
plMover->SetPosition(movementInfo.GetPos()->x, movementInfo.GetPos()->y, movementInfo.GetPos()->z, movementInfo.GetPos()->o);
|
||||
plMover->m_movementInfo = movementInfo;
|
||||
|
||||
if(movementInfo.GetPos()->z < -500.0f)
|
||||
if (movementInfo.GetPos()->z < -500.0f)
|
||||
{
|
||||
if(plMover->InBattleGround()
|
||||
if (plMover->InBattleGround()
|
||||
&& plMover->GetBattleGround()
|
||||
&& plMover->GetBattleGround()->HandlePlayerUnderMap(_player))
|
||||
{
|
||||
|
|
@ -586,11 +586,11 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
|
|||
// NOTE: this is actually called many times while falling
|
||||
// even after the player has been teleported away
|
||||
// TODO: discard movement packets after the player is rooted
|
||||
if(plMover->isAlive())
|
||||
if (plMover->isAlive())
|
||||
{
|
||||
plMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, plMover->GetMaxHealth());
|
||||
// pl can be alive if GM/etc
|
||||
if(!plMover->isAlive())
|
||||
if (!plMover->isAlive())
|
||||
{
|
||||
// change the death state to CORPSE to prevent the death timer from
|
||||
// starting in the next player update
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue