Core/Dungeon Finder: Use scripts to interact between groups and LFG

--HG--
branch : trunk
This commit is contained in:
Spp
2010-10-25 07:29:53 +02:00
parent 4cd2431cd7
commit 3fc2d414b1
6 changed files with 167 additions and 50 deletions
-24
View File
@@ -32,7 +32,6 @@
#include "InstanceSaveMgr.h"
#include "MapInstanced.h"
#include "Util.h"
#include "LFGMgr.h"
Group::Group()
{
@@ -307,9 +306,6 @@ Player* Group::GetInvited(const std::string& name) const
bool Group::AddMember(const uint64 &guid, const char* name)
{
if (isLfgQueued())
sLFGMgr.Leave(NULL, this);
if (!_addMember(guid, name))
return false;
@@ -319,8 +315,6 @@ bool Group::AddMember(const uint64 &guid, const char* name)
Player *player = sObjectMgr.GetPlayer(guid);
if (player)
{
if (player->isUsingLfg())
sLFGMgr.Leave(player);
if (!IsLeader(player->GetGUID()) && !isBGGroup())
{
// reset the new member's instances, unless he is currently in one of them
@@ -360,11 +354,6 @@ uint32 Group::RemoveMember(const uint64 &guid, const RemoveMethod &method)
{
BroadcastGroupUpdate();
if (isLfgQueued())
sLFGMgr.Leave(NULL, this);
else if (isLFGGroup() && !isLfgDungeonComplete())
sLFGMgr.OfferContinue(this);
sScriptMgr.OnGroupRemoveMember(this, guid, method);
// remove member and change leader (if need) only if strong more 2 members _before_ member remove
@@ -387,15 +376,9 @@ uint32 Group::RemoveMember(const uint64 &guid, const RemoveMethod &method)
player->GetSession()->SendPacket(&data);
}
player->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER);
if (isLFGGroup() && player->GetMap()->IsDungeon())
player->TeleportToBGEntryPoint();
//we already removed player from group and in player->GetGroup() is his original group!
if (Group* group = player->GetGroup())
{
group->SendUpdate();
}
else
{
data.Initialize(SMSG_GROUP_LIST, 1+1+1+1+8+4+4+8);
@@ -461,11 +444,6 @@ void Group::Disband(bool hideDestroy /* = false */)
player->SetOriginalGroup(NULL);
else
player->SetGroup(NULL);
if (isLFGGroup() && player->GetMap()->IsDungeon())
player->TeleportToBGEntryPoint();
player->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_GROUP_DISBAND);
player->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER);
}
// quest related GO state dependent from raid membership
@@ -1298,8 +1276,6 @@ bool Group::_removeMember(const uint64 &guid)
player->SetOriginalGroup(NULL);
else
player->SetGroup(NULL);
player->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER);
}
}
@@ -56,6 +56,7 @@ void AddSC_npc_innkeeper();
void AddSC_npcs_special();
void AddSC_npc_taxi();
void AddSC_achievement_scripts();
void AddSC_dungeon_finder();
//eastern kingdoms
void AddSC_alterac_valley(); //Alterac Valley
@@ -619,6 +620,7 @@ void AddWorldScripts()
AddSC_npc_taxi();
AddSC_achievement_scripts();
AddSC_chat_log();
AddSC_dungeon_finder();
#endif
}
@@ -186,8 +186,6 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket & recv_data)
data << uint32(0); // unk
player->GetSession()->SendPacket(&data);
SendLfgUpdatePlayer(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
SendLfgUpdateParty(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK);
}
@@ -230,14 +228,6 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket & /*recv_data*/)
if (!group->AddMember(GetPlayer()->GetGUID(), GetPlayer()->GetName()))
return;
SendLfgUpdatePlayer(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
if (Player *plrg = itr->getSource())
{
plrg->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_CLEAR_LOCK_LIST);
plrg->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_CLEAR_LOCK_LIST);
}
group->BroadcastGroupUpdate();
}
-6
View File
@@ -40,7 +40,6 @@
#include "SocialMgr.h"
#include "zlib.h"
#include "ScriptMgr.h"
#include "LFGMgr.h"
#include "Transport.h"
/// WorldSession constructor
@@ -324,11 +323,6 @@ void WorldSession::LogoutPlayer(bool Save)
if (_player)
{
sLFGMgr.Leave(_player);
GetPlayer()->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
GetPlayer()->GetSession()->SendLfgUpdatePlayer(LFG_UPDATETYPE_REMOVED_FROM_QUEUE);
GetPlayer()->GetSession()->SendLfgUpdateSearch(false);
if (uint64 lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid);