aboutsummaryrefslogtreecommitdiff
path: root/src/game/MiscHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/MiscHandler.cpp')
-rw-r--r--src/game/MiscHandler.cpp86
1 files changed, 47 insertions, 39 deletions
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index f5a1013f085..48fdda872e9 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -231,7 +231,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
uint32 team = _player->GetTeam();
uint32 security = GetSecurity();
bool allowTwoSideWhoList = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
- bool gmInWhoList = sWorld.getConfig(CONFIG_GM_IN_WHO_LIST);
+ uint32 gmLevelInWhoList = sWorld.getConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
WorldPacket data( SMSG_WHO, 50 ); // guess size
data << clientcount; // clientcount place holder
@@ -248,10 +248,14 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
continue;
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
- if ((itr->second->GetSession()->GetSecurity() > SEC_PLAYER && !gmInWhoList))
+ if ((itr->second->GetSession()->GetSecurity() > gmLevelInWhoList))
continue;
}
+ //do not process players which are not in world
+ if(!(itr->second->IsInWorld()))
+ continue;
+
// check if target is globally visible for player
if (!(itr->second->IsVisibleGloballyFor(_player)))
continue;
@@ -1014,10 +1018,11 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
uint32 size = adata->Data.size();
+ uLongf destSize = compressBound(size);
+
ByteBuffer dest;
- dest.resize(size);
+ dest.resize(destSize);
- uLongf destSize = size;
if(size && compress(const_cast<uint8*>(dest.contents()), &destSize, (uint8*)adata->Data.c_str(), size) != Z_OK)
{
sLog.outDebug("RAD: Failed to compress account data");
@@ -1040,40 +1045,41 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
CHECK_PACKET_SIZE(recv_data,1+2+1+1);
sLog.outDebug( "WORLD: Received CMSG_SET_ACTION_BUTTON" );
- uint8 button, misc, type;
- uint16 action;
- recv_data >> button >> action >> misc >> type;
- sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u MISC: %u", button, action, type, misc );
- if(action==0)
+ uint8 button;
+ uint32 packetData;
+ recv_data >> button >> packetData;
+
+ uint32 action = ACTION_BUTTON_ACTION(packetData);
+ uint8 type = ACTION_BUTTON_TYPE(packetData);
+
+ sLog.outDetail( "BUTTON: %u ACTION: %u TYPE: %u", button, action, type );
+ if (!packetData)
{
sLog.outDetail( "MISC: Remove action from button %u", button );
-
GetPlayer()->removeActionButton(button);
}
else
{
- if(type==ACTION_BUTTON_MACRO || type==ACTION_BUTTON_CMACRO)
- {
- sLog.outDetail( "MISC: Added Macro %u into button %u", action, button );
- GetPlayer()->addActionButton(button,action,type,misc);
- }
- else if(type==ACTION_BUTTON_EQSET)
- {
- sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button );
- GetPlayer()->addActionButton(button,action,type,misc);
- }
- else if(type==ACTION_BUTTON_SPELL)
+ switch(type)
{
- sLog.outDetail( "MISC: Added Spell %u into button %u", action, button );
- GetPlayer()->addActionButton(button,action,type,misc);
- }
- else if(type==ACTION_BUTTON_ITEM)
- {
- sLog.outDetail( "MISC: Added Item %u into button %u", action, button );
- GetPlayer()->addActionButton(button,action,type,misc);
+ case ACTION_BUTTON_MACRO:
+ case ACTION_BUTTON_CMACRO:
+ sLog.outDetail( "MISC: Added Macro %u into button %u", action, button );
+ break;
+ case ACTION_BUTTON_EQSET:
+ sLog.outDetail( "MISC: Added EquipmentSet %u into button %u", action, button );
+ break;
+ case ACTION_BUTTON_SPELL:
+ sLog.outDetail( "MISC: Added Spell %u into button %u", action, button );
+ break;
+ case ACTION_BUTTON_ITEM:
+ sLog.outDetail( "MISC: Added Item %u into button %u", action, button );
+ break;
+ default:
+ sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button );
+ return;
}
- else
- sLog.outError( "MISC: Unknown action button type %u for action %u into button %u", type, action, button );
+ GetPlayer()->addActionButton(button,action,type);
}
}
@@ -1210,15 +1216,17 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& /*recv_data*/)
*/
}
-void WorldSession::HandlePlayedTime(WorldPacket& /*recv_data*/)
+void WorldSession::HandlePlayedTime(WorldPacket& recv_data)
{
- uint32 TotalTimePlayed = GetPlayer()->GetTotalPlayedTime();
- uint32 LevelPlayedTime = GetPlayer()->GetLevelPlayedTime();
+ CHECK_PACKET_SIZE(recv_data, 1);
- WorldPacket data(SMSG_PLAYED_TIME, 9);
- data << TotalTimePlayed;
- data << LevelPlayedTime;
- data << uint8(0);
+ uint8 unk1;
+ recv_data >> unk1; // 0 or 1 expected
+
+ WorldPacket data(SMSG_PLAYED_TIME, 4 + 4 + 1);
+ data << uint32(_player->GetTotalPlayedTime());
+ data << uint32(_player->GetLevelPlayedTime());
+ data << uint8(unk1); // 0 - will not show in chat frame
SendPacket(&data);
}
@@ -1350,7 +1358,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
uint32 accid = plr->GetSession()->GetAccountId();
- QueryResult *result = LoginDatabase.PQuery("SELECT username,email,last_ip FROM account WHERE id=%u", accid);
+ QueryResult *result = loginDatabase.PQuery("SELECT username,email,last_ip FROM account WHERE id=%u", accid);
if(!result)
{
SendNotification(LANG_ACCOUNT_FOR_PLAYER_NOT_FOUND, charname.c_str());
@@ -1488,7 +1496,7 @@ void WorldSession::HandleSetTitleOpcode( WorldPacket & recv_data )
recv_data >> title;
// -1 at none
- if(title > 0 && title < 192)
+ if(title > 0 && title < MAX_TITLE_INDEX)
{
if(!GetPlayer()->HasTitle(title))
return;