Core/Guild: Code Refactor
- Send correct events when modifiying Ranks (Add, modify, delete) - Store money/slots withdraw, not remaining slots. This will update remaining slots/money properly. - Reset daily slots/money withdraw for all members at same time, configurable - Better debug messages
This commit is contained in:
1 parent
3ee840a9be
commit
58ec4e5319
38 files changed
+1893
-1709
No files matched your search
@@ -230,7 +230,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recvData*/)
|
||||
{
|
||||
// remove expired bans
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_EXPIRED_BANS);
|
||||
@@ -249,20 +249,20 @@ void WorldSession::HandleCharEnumOpcode(WorldPacket & /*recv_data*/)
|
||||
_charEnumCallback = CharacterDatabase.AsyncQuery(stmt);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleCharCreateOpcode(WorldPacket & recvData)
|
||||
{
|
||||
std::string name;
|
||||
uint8 race_, class_;
|
||||
|
||||
recv_data >> name;
|
||||
recvData >> name;
|
||||
|
||||
recv_data >> race_;
|
||||
recv_data >> class_;
|
||||
recvData >> race_;
|
||||
recvData >> class_;
|
||||
|
||||
// extract other data required for player creating
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId;
|
||||
recv_data >> gender >> skin >> face;
|
||||
recv_data >> hairStyle >> hairColor >> facialHair >> outfitId;
|
||||
recvData >> gender >> skin >> face;
|
||||
recvData >> hairStyle >> hairColor >> facialHair >> outfitId;
|
||||
|
||||
WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases
|
||||
|
||||
@@ -387,7 +387,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
|
||||
}
|
||||
|
||||
delete _charCreateCallback.GetParam(); // Delete existing if any, to make the callback chain reset to stage 0
|
||||
_charCreateCallback.SetParam(new CharacterCreateInfo(name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId, recv_data));
|
||||
_charCreateCallback.SetParam(new CharacterCreateInfo(name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId, recvData));
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_NAME);
|
||||
stmt->setString(0, name);
|
||||
_charCreateCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
|
||||
@@ -670,10 +670,10 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleCharDeleteOpcode(WorldPacket & recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
recv_data >> guid;
|
||||
recvData >> guid;
|
||||
|
||||
// can't delete loaded character
|
||||
if (ObjectAccessor::FindPlayer(guid))
|
||||
@@ -733,7 +733,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recvData)
|
||||
{
|
||||
if (PlayerLoading() || GetPlayer() != NULL)
|
||||
{
|
||||
@@ -746,7 +746,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket & recv_data)
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd Player Logon Message");
|
||||
|
||||
recv_data >> playerGuid;
|
||||
recvData >> playerGuid;
|
||||
|
||||
if (!CharCanLogin(GUID_LOPART(playerGuid)))
|
||||
{
|
||||
@@ -1002,30 +1002,30 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
|
||||
delete holder;
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetFactionAtWar(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetFactionAtWar(WorldPacket & recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_ATWAR");
|
||||
|
||||
uint32 repListID;
|
||||
uint8 flag;
|
||||
|
||||
recv_data >> repListID;
|
||||
recv_data >> flag;
|
||||
recvData >> repListID;
|
||||
recvData >> flag;
|
||||
|
||||
GetPlayer()->GetReputationMgr().SetAtWar(repListID, flag);
|
||||
}
|
||||
|
||||
//I think this function is never used :/ I dunno, but i guess this opcode not exists
|
||||
void WorldSession::HandleSetFactionCheat(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleSetFactionCheat(WorldPacket & /*recvData*/)
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "WORLD SESSION: HandleSetFactionCheat, not expected call, please report.");
|
||||
GetPlayer()->GetReputationMgr().SendStates();
|
||||
}
|
||||
|
||||
void WorldSession::HandleTutorialFlag(WorldPacket & recv_data)
|
||||
void WorldSession::HandleTutorialFlag(WorldPacket & recvData)
|
||||
{
|
||||
uint32 data;
|
||||
recv_data >> data;
|
||||
recvData >> data;
|
||||
|
||||
uint8 index = uint8(data / 32);
|
||||
if (index >= MAX_ACCOUNT_TUTORIAL_VALUES)
|
||||
@@ -1038,57 +1038,57 @@ void WorldSession::HandleTutorialFlag(WorldPacket & recv_data)
|
||||
SetTutorialInt(index, flag);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTutorialClear(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleTutorialClear(WorldPacket & /*recvData*/)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
|
||||
SetTutorialInt(i, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
void WorldSession::HandleTutorialReset(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleTutorialReset(WorldPacket & /*recvData*/)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ACCOUNT_TUTORIAL_VALUES; ++i)
|
||||
SetTutorialInt(i, 0x00000000);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetWatchedFactionOpcode(WorldPacket & recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_WATCHED_FACTION");
|
||||
uint32 fact;
|
||||
recv_data >> fact;
|
||||
recvData >> fact;
|
||||
GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, fact);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleSetFactionInactiveOpcode(WorldPacket & recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_SET_FACTION_INACTIVE");
|
||||
uint32 replistid;
|
||||
uint8 inactive;
|
||||
recv_data >> replistid >> inactive;
|
||||
recvData >> replistid >> inactive;
|
||||
|
||||
_player->GetReputationMgr().SetInactive(replistid, inactive);
|
||||
}
|
||||
|
||||
void WorldSession::HandleShowingHelmOpcode(WorldPacket& recv_data)
|
||||
void WorldSession::HandleShowingHelmOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_HELM for %s", _player->GetName().c_str());
|
||||
recv_data.read_skip<uint8>(); // unknown, bool?
|
||||
recvData.read_skip<uint8>(); // unknown, bool?
|
||||
_player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM);
|
||||
}
|
||||
|
||||
void WorldSession::HandleShowingCloakOpcode(WorldPacket& recv_data)
|
||||
void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SHOWING_CLOAK for %s", _player->GetName().c_str());
|
||||
recv_data.read_skip<uint8>(); // unknown, bool?
|
||||
recvData.read_skip<uint8>(); // unknown, bool?
|
||||
_player->ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
|
||||
void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
std::string newName;
|
||||
|
||||
recv_data >> guid;
|
||||
recv_data >> newName;
|
||||
recvData >> guid;
|
||||
recvData >> newName;
|
||||
|
||||
// prevent character rename to invalid name
|
||||
if (!normalizePlayerName(newName))
|
||||
@@ -1178,11 +1178,11 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
|
||||
sWorld->UpdateCharacterNameData(guidLow, newName);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
|
||||
void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
|
||||
recv_data >> guid;
|
||||
recvData >> guid;
|
||||
|
||||
// not accept declined names for unsupported languages
|
||||
std::string name;
|
||||
@@ -1217,7 +1217,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
|
||||
std::string name2;
|
||||
DeclinedName declinedname;
|
||||
|
||||
recv_data >> name2;
|
||||
recvData >> name2;
|
||||
|
||||
if (name2 != name) // character have different name
|
||||
{
|
||||
@@ -1230,7 +1230,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
|
||||
|
||||
for (int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
|
||||
{
|
||||
recv_data >> declinedname.name[i];
|
||||
recvData >> declinedname.name[i];
|
||||
if (!normalizePlayerName(declinedname.name[i]))
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4+8);
|
||||
@@ -1275,12 +1275,12 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recv_data)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
|
||||
void WorldSession::HandleAlterAppearance(WorldPacket & recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_ALTER_APPEARANCE");
|
||||
|
||||
uint32 Hair, Color, FacialHair, SkinColor;
|
||||
recv_data >> Hair >> Color >> FacialHair >> SkinColor;
|
||||
recvData >> Hair >> Color >> FacialHair >> SkinColor;
|
||||
|
||||
BarberShopStyleEntry const* bs_hair = sBarberShopStyleStore.LookupEntry(Hair);
|
||||
|
||||
@@ -1347,10 +1347,10 @@ void WorldSession::HandleAlterAppearance(WorldPacket & recv_data)
|
||||
_player->SetStandState(0); // stand up
|
||||
}
|
||||
|
||||
void WorldSession::HandleRemoveGlyph(WorldPacket & recv_data)
|
||||
void WorldSession::HandleRemoveGlyph(WorldPacket & recvData)
|
||||
{
|
||||
uint32 slot;
|
||||
recv_data >> slot;
|
||||
recvData >> slot;
|
||||
|
||||
if (slot >= MAX_GLYPH_SLOT_INDEX)
|
||||
{
|
||||
@@ -1369,16 +1369,16 @@ void WorldSession::HandleRemoveGlyph(WorldPacket & recv_data)
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
|
||||
void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
std::string newName;
|
||||
|
||||
recv_data >> guid;
|
||||
recv_data >> newName;
|
||||
recvData >> guid;
|
||||
recvData >> newName;
|
||||
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair;
|
||||
recv_data >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face;
|
||||
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN);
|
||||
|
||||
@@ -1485,23 +1485,23 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
|
||||
void WorldSession::HandleEquipmentSetSave(WorldPacket &recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_SAVE");
|
||||
|
||||
uint64 setGuid;
|
||||
recv_data.readPackGUID(setGuid);
|
||||
recvData.readPackGUID(setGuid);
|
||||
|
||||
uint32 index;
|
||||
recv_data >> index;
|
||||
recvData >> index;
|
||||
if (index >= MAX_EQUIPMENT_SET_INDEX) // client set slots amount
|
||||
return;
|
||||
|
||||
std::string name;
|
||||
recv_data >> name;
|
||||
recvData >> name;
|
||||
|
||||
std::string iconName;
|
||||
recv_data >> iconName;
|
||||
recvData >> iconName;
|
||||
|
||||
EquipmentSet eqSet;
|
||||
|
||||
@@ -1513,7 +1513,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
uint64 itemGuid;
|
||||
recv_data.readPackGUID(itemGuid);
|
||||
recvData.readPackGUID(itemGuid);
|
||||
|
||||
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
|
||||
if (itemGuid == 1)
|
||||
@@ -1537,17 +1537,17 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data)
|
||||
_player->SetEquipmentSet(index, eqSet);
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetDelete(WorldPacket &recv_data)
|
||||
void WorldSession::HandleEquipmentSetDelete(WorldPacket &recvData)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_DELETE");
|
||||
|
||||
uint64 setGuid;
|
||||
recv_data.readPackGUID(setGuid);
|
||||
recvData.readPackGUID(setGuid);
|
||||
|
||||
_player->DeleteEquipmentSet(setGuid);
|
||||
}
|
||||
|
||||
void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
||||
void WorldSession::HandleEquipmentSetUse(WorldPacket &recvData)
|
||||
{
|
||||
if (_player->isInCombat())
|
||||
return;
|
||||
@@ -1557,10 +1557,10 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
uint64 itemGuid;
|
||||
recv_data.readPackGUID(itemGuid);
|
||||
recvData.readPackGUID(itemGuid);
|
||||
|
||||
uint8 srcbag, srcslot;
|
||||
recv_data >> srcbag >> srcslot;
|
||||
recvData >> srcbag >> srcslot;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
|
||||
|
||||
@@ -1602,14 +1602,14 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
std::string newname;
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
|
||||
recv_data >> guid;
|
||||
recv_data >> newname;
|
||||
recv_data >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
|
||||
recvData >> guid;
|
||||
recvData >> newname;
|
||||
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
|
||||
|
||||
uint32 lowGuid = GUID_LOPART(guid);
|
||||
|
||||
@@ -1634,7 +1634,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
Field* fields = result->Fetch();
|
||||
uint32 at_loginFlags = fields[0].GetUInt16();
|
||||
char const* knownTitlesStr = fields[1].GetCString();
|
||||
uint32 used_loginFlag = ((recv_data.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION);
|
||||
uint32 used_loginFlag = ((recvData.GetOpcode() == CMSG_CHAR_RACE_CHANGE) ? AT_LOGIN_CHANGE_RACE : AT_LOGIN_CHANGE_FACTION);
|
||||
|
||||
if (!sObjectMgr->GetPlayerInfo(race, playerClass))
|
||||
{
|
||||
@@ -1793,7 +1793,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
if (recv_data.GetOpcode() == CMSG_CHAR_FACTION_CHANGE)
|
||||
if (recvData.GetOpcode() == CMSG_CHAR_FACTION_CHANGE)
|
||||
{
|
||||
// Delete all Flypaths
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_TAXI_PATH);
|
||||
|
||||
Reference in new issue
Block a user