aboutsummaryrefslogtreecommitdiff
path: root/src/game/LFGHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/LFGHandler.cpp')
-rw-r--r--src/game/LFGHandler.cpp212
1 files changed, 155 insertions, 57 deletions
diff --git a/src/game/LFGHandler.cpp b/src/game/LFGHandler.cpp
index 667b65327d5..51735c01e02 100644
--- a/src/game/LFGHandler.cpp
+++ b/src/game/LFGHandler.cpp
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
+ * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
- * Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
+ * Copyright (C) 2008-2009 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -142,9 +142,9 @@ static void AttemptAddMore(Player* _player)
}
}
-void WorldSession::HandleLfgAutoJoinOpcode( WorldPacket & /*recv_data*/ )
+void WorldSession::HandleLfgSetAutoJoinOpcode( WorldPacket & /*recv_data*/ )
{
- sLog.outDebug("CMSG_SET_LFG_AUTO_JOIN");
+ sLog.outDebug("CMSG_LFG_SET_AUTOJOIN");
LookingForGroup_auto_join = true;
if(!_player) // needed because STATUS_AUTHED
@@ -153,15 +153,15 @@ void WorldSession::HandleLfgAutoJoinOpcode( WorldPacket & /*recv_data*/ )
AttemptJoin(_player);
}
-void WorldSession::HandleLfgCancelAutoJoinOpcode( WorldPacket & /*recv_data*/ )
+void WorldSession::HandleLfgClearAutoJoinOpcode( WorldPacket & /*recv_data*/ )
{
- sLog.outDebug("CMSG_UNSET_LFG_AUTO_JOIN");
+ sLog.outDebug("CMSG_LFG_CLEAR_AUTOJOIN");
LookingForGroup_auto_join = false;
}
-void WorldSession::HandleLfmAutoAddMembersOpcode( WorldPacket & /*recv_data*/ )
+void WorldSession::HandleLfmSetAutoFillOpcode( WorldPacket & /*recv_data*/ )
{
- sLog.outDebug("CMSG_SET_LFM_AUTOADD");
+ sLog.outDebug("CMSG_LFM_SET_AUTOFILL");
LookingForGroup_auto_add = true;
if(!_player) // needed because STATUS_AUTHED
@@ -170,42 +170,48 @@ void WorldSession::HandleLfmAutoAddMembersOpcode( WorldPacket & /*recv_data*/ )
AttemptAddMore(_player);
}
-void WorldSession::HandleLfmCancelAutoAddmembersOpcode( WorldPacket & /*recv_data*/ )
+void WorldSession::HandleLfmClearAutoFillOpcode( WorldPacket & /*recv_data*/ )
{
- sLog.outDebug("CMSG_UNSET_LFM_AUTOADD");
+ sLog.outDebug("CMSG_LFM_CLEAR_AUTOFILL");
LookingForGroup_auto_add = false;
}
void WorldSession::HandleLfgClearOpcode( WorldPacket & /*recv_data */ )
{
- sLog.outDebug("CMSG_LOOKING_FOR_GROUP_CLEAR");
+ // empty packet
+ sLog.outDebug("CMSG_CLEAR_LOOKING_FOR_GROUP");
for(int i = 0; i < MAX_LOOKING_FOR_GROUP_SLOT; ++i)
_player->m_lookingForGroup.slots[i].Clear();
if( sWorld.getConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && _player->GetSession()->GetSecurity() == SEC_PLAYER )
_player->LeaveLFGChannel();
+
+ SendLfgUpdate(0, 0, 0);
}
-void WorldSession::HandleLfmSetNoneOpcode( WorldPacket & /*recv_data */)
+void WorldSession::HandleLfmClearOpcode( WorldPacket & /*recv_data */)
{
- sLog.outDebug("CMSG_SET_LOOKING_FOR_NONE");
+ // empty packet
+ sLog.outDebug("CMSG_CLEAR_LOOKING_FOR_MORE");
_player->m_lookingForGroup.more.Clear();
}
-void WorldSession::HandleLfmSetOpcode( WorldPacket & recv_data )
+void WorldSession::HandleSetLfmOpcode( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data,4);
+ CHECK_PACKET_SIZE(recv_data, 4+1+1+1+1);
sLog.outDebug("CMSG_SET_LOOKING_FOR_MORE");
//recv_data.hexlike();
uint32 temp, entry, type;
+ uint8 unk1;
+ uint8 unk2[3];
- recv_data >> temp;
+ recv_data >> temp >> unk1 >> unk2[0] >> unk2[1] >> unk2[2];
- entry = ( temp & 0xFFFF);
- type = ( (temp >> 24) & 0xFFFF);
+ entry = ( temp & 0x00FFFFFF);
+ type = ( (temp >> 24) & 0x000000FF);
_player->m_lookingForGroup.more.Set(entry,type);
sLog.outDebug("LFM set: temp %u, zone %u, type %u", temp, entry, type);
@@ -216,11 +222,11 @@ void WorldSession::HandleLfmSetOpcode( WorldPacket & recv_data )
SendLfgResult(type, entry, 1);
}
-void WorldSession::HandleLfgSetCommentOpcode( WorldPacket & recv_data )
+void WorldSession::HandleSetLfgCommentOpcode( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data,1);
+ CHECK_PACKET_SIZE(recv_data, 1);
- sLog.outDebug("CMSG_SET_COMMENTARY");
+ sLog.outDebug("CMSG_SET_LFG_COMMENT");
//recv_data.hexlike();
std::string comment;
@@ -232,7 +238,7 @@ void WorldSession::HandleLfgSetCommentOpcode( WorldPacket & recv_data )
void WorldSession::HandleLookingForGroup(WorldPacket& recv_data)
{
- CHECK_PACKET_SIZE(recv_data,4+4+4);
+ CHECK_PACKET_SIZE(recv_data, 4+4+4);
sLog.outDebug("MSG_LOOKING_FOR_GROUP");
//recv_data.hexlike();
@@ -248,18 +254,53 @@ void WorldSession::HandleLookingForGroup(WorldPacket& recv_data)
AttemptJoin(_player);
SendLfgResult(type, entry, 0);
+ SendLfgUpdate(0, 1, 0);
}
void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
{
uint32 number = 0;
- // start prepare packet;
WorldPacket data(MSG_LOOKING_FOR_GROUP);
data << uint32(type); // type
data << uint32(entry); // entry from LFGDungeons.dbc
- data << uint32(0); // count, placeholder
- data << uint32(0); // count again, strange, placeholder
+
+ data << uint8(0);
+ /*if(uint8)
+ {
+ uint32 count1;
+ for(count1)
+ {
+ uint64; // player guid
+ }
+ }*/
+
+ data << uint32(0); // count2
+ data << uint32(0);
+ /*for(count2)
+ {
+ uint64 // not player guid
+ uint32 flags;
+ if(flags & 0x2)
+ {
+ string
+ }
+ if(flags & 0x10)
+ {
+ uint8
+ }
+ if(flags & 0x20)
+ {
+ for(3)
+ {
+ uint8
+ }
+ }
+ }*/
+
+ size_t count3_pos = data.wpos();
+ data << uint32(0); // count3
+ data << uint32(0); // unk
//TODO: Guard Player map
HashMapHolder<Player>::MapType const& players = ObjectAccessor::Instance().GetPlayers();
@@ -270,71 +311,128 @@ void WorldSession::SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type)
if(!plr || plr->GetTeam() != _player->GetTeam())
continue;
- if(!plr->m_lookingForGroup.HaveInSlot(entry,type))
+ if(!plr->m_lookingForGroup.HaveInSlot(entry, type))
continue;
++number;
- data.append(plr->GetPackGUID()); // packed guid
- data << plr->getLevel(); // level
- data << plr->GetZoneId(); // current zone
- data << lfg_type; // 0x00 - LFG, 0x01 - LFM
+ data << uint64(plr->GetGUID()); // guid
+
+ uint32 flags = 0x1FF;
+ data << uint32(flags); // flags
- for(uint8 j = 0; j < MAX_LOOKING_FOR_GROUP_SLOT; ++j)
+ if(flags & 0x1)
{
- data << uint32( plr->m_lookingForGroup.slots[j].entry | (plr->m_lookingForGroup.slots[j].type << 24) );
+ data << uint8(plr->getLevel());
+ data << uint8(plr->getClass());
+ data << uint8(plr->getRace());
+
+ for(int i = 0; i < 3; ++i)
+ data << uint8(0); // spent talents count in specific tab
+
+ data << uint32(0); // resistances1
+ data << uint32(0); // spd/heal
+ data << uint32(0); // spd/heal
+ data << uint32(0); // combat_rating9
+ data << uint32(0); // combat_rating10
+ data << uint32(0); // combat_rating11
+ data << float(0); // mp5
+ data << float(0); // unk
+ data << uint32(0); // attack power
+ data << uint32(0); // stat1
+ data << uint32(0); // maxhealth
+ data << uint32(0); // maxpower1
+ data << uint32(0); // unk
+ data << float(0); // unk
+ data << uint32(0); // unk
+ data << uint32(0); // unk
+ data << uint32(0); // unk
+ data << uint32(0); // unk
+ data << uint32(0); // combat_rating20
+ data << uint32(0); // unk
}
- data << plr->m_lookingForGroup.comment;
- Group *group = plr->GetGroup();
- if(group)
+ if(flags & 0x2)
+ data << plr->m_lookingForGroup.comment; // comment
+
+ if(flags & 0x4)
+ data << uint8(0); // unk
+
+ if(flags & 0x8)
+ data << uint64(0); // guid from count2 block, not player guid
+
+ if(flags & 0x10)
+ data << uint8(0); // unk
+
+ if(flags & 0x20)
+ data << uint8(plr->m_lookingForGroup.roles); // roles
+
+ if(flags & 0x40)
+ data << uint32(plr->GetZoneId()); // areaid
+
+ if(flags & 0x100)
+ data << uint8(0); // LFG/LFM flag?
+
+ if(flags & 0x80)
{
- data << group->GetMembersCount()-1; // count of group members without group leader
- for(GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
+ for(uint8 j = 0; j < MAX_LOOKING_FOR_GROUP_SLOT; ++j)
{
- Player *member = itr->getSource();
- if(member && member->GetGUID() != plr->GetGUID())
- {
- data.append(member->GetPackGUID()); // packed guid
- data << member->getLevel(); // player level
- }
+ data << uint32(plr->m_lookingForGroup.slots[j].entry | (plr->m_lookingForGroup.slots[j].type << 24));
}
}
- else
- {
- data << uint32(0x00);
- }
}
- // fill count placeholders
- data.put<uint32>(4+4, number);
- data.put<uint32>(4+4+4,number);
+ data.put<uint32>(count3_pos, number); // fill count placeholder
SendPacket(&data);
}
void WorldSession::HandleSetLfgOpcode( WorldPacket & recv_data )
{
- CHECK_PACKET_SIZE(recv_data,4+4);
+ CHECK_PACKET_SIZE(recv_data, 4+4+1+1);
sLog.outDebug("CMSG_SET_LOOKING_FOR_GROUP");
- //recv_data.hexlike();
+ recv_data.hexlike();
uint32 slot, temp, entry, type;
+ uint8 roles, unk1;
- recv_data >> slot >> temp;
+ recv_data >> slot >> temp >> roles >> unk1;
- entry = ( temp & 0xFFFF);
- type = ( (temp >> 24) & 0xFFFF);
+ entry = ( temp & 0x00FFFFFF);
+ type = ( (temp >> 24) & 0x000000FF);
if(slot >= MAX_LOOKING_FOR_GROUP_SLOT)
return;
- _player->m_lookingForGroup.slots[slot].Set(entry,type);
+ _player->m_lookingForGroup.slots[slot].Set(entry, type);
+ _player->m_lookingForGroup.roles = roles;
sLog.outDebug("LFG set: looknumber %u, temp %X, type %u, entry %u", slot, temp, type, entry);
if(LookingForGroup_auto_join)
AttemptJoin(_player);
- SendLfgResult(type, entry, 0);
+ //SendLfgResult(type, entry, 0);
+ SendLfgUpdate(0, 1, 0);
+}
+
+void WorldSession::HandleLfgSetRoles(WorldPacket &recv_data)
+{
+ CHECK_PACKET_SIZE(recv_data, 1);
+
+ sLog.outDebug("CMSG_LFG_SET_ROLES");
+
+ uint8 roles;
+ recv_data >> roles;
+
+ _player->m_lookingForGroup.roles = roles;
+}
+
+void WorldSession::SendLfgUpdate(uint8 unk1, uint8 unk2, uint8 unk3)
+{
+ WorldPacket data(SMSG_LFG_UPDATE, 3);
+ data << uint8(unk1);
+ data << uint8(unk2);
+ data << uint8(unk3);
+ SendPacket(&data);
}