Core/Dungeon Finder: Move vote kick initialization from Group code to Scripts

--HG--
branch : trunk
This commit is contained in:
Spp
2010-11-23 20:49:57 +01:00
parent d3c9478153
commit fa97598594
3 changed files with 22 additions and 17 deletions
+4
View File
@@ -360,6 +360,10 @@ uint32 Group::RemoveMember(const uint64 &guid, const RemoveMethod &method /* = G
sScriptMgr.OnGroupRemoveMember(this, guid, method, kicker, reason); sScriptMgr.OnGroupRemoveMember(this, guid, method, kicker, reason);
// Lfg group vote kick handled in scripts
if (isLFGGroup() && method == GROUP_REMOVEMETHOD_KICK)
return m_memberSlots.size();
// remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group) // remove member and change leader (if need) only if strong more 2 members _before_ member remove (BG allow 1 member group)
if (GetMembersCount() > (isBGGroup() ? 1u : 2u)) if (GetMembersCount() > (isBGGroup() ? 1u : 2u))
{ {
@@ -30,7 +30,6 @@
#include "Util.h" #include "Util.h"
#include "SpellAuras.h" #include "SpellAuras.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "LFGMgr.h"
class Aura; class Aura;
@@ -278,10 +277,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
if (grp->IsMember(guid)) if (grp->IsMember(guid))
{ {
if (grp->isLFGGroup()) Player::RemoveFromGroup(grp, guid, GROUP_REMOVEMETHOD_KICK, GetPlayer()->GetGUID(), reason.c_str());
sLFGMgr.InitBoot(grp, GUID_LOPART(GetPlayer()->GetGUID()), GUID_LOPART(guid), reason);
else
Player::RemoveFromGroup(grp, guid, GROUP_REMOVEMETHOD_KICK, GetPlayer()->GetGUID(), reason.c_str());
return; return;
} }
@@ -323,10 +319,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket & recv_data)
if (uint64 guid = grp->GetMemberGUID(membername)) if (uint64 guid = grp->GetMemberGUID(membername))
{ {
if (grp->isLFGGroup()) Player::RemoveFromGroup(grp, guid, GROUP_REMOVEMETHOD_KICK, GetPlayer()->GetGUID());
sLFGMgr.InitBoot(grp, GUID_LOPART(GetPlayer()->GetGUID()), GUID_LOPART(guid), "");
else
Player::RemoveFromGroup(grp, guid, GROUP_REMOVEMETHOD_KICK, GetPlayer()->GetGUID());
return; return;
} }
+16 -8
View File
@@ -67,24 +67,32 @@ public:
if (!group->isLFGGroup()) if (!group->isLFGGroup())
return; return;
if (!group->isLfgDungeonComplete()) // Need more players to finish the dungeon
sLFGMgr.OfferContinue(group);
if (method == GROUP_REMOVEMETHOD_KICK) // Player have been kicked if (method == GROUP_REMOVEMETHOD_KICK) // Player have been kicked
{ {
// TODO - Update internal kick cooldown // TODO - Update internal kick cooldown of kicker
} std::string str_reason = "";
else if (reason)
{ str_reason = std::string(reason);
// Deserter flag sLFGMgr.InitBoot(group, GUID_LOPART(kicker), GUID_LOPART(guid), str_reason);
return;
} }
if (Player *plr = sObjectMgr.GetPlayer(guid)) if (Player *plr = sObjectMgr.GetPlayer(guid))
{ {
/*
if (method == GROUP_REMOVEMETHOD_LEAVE)
// Add deserter flag
else if (group->isLfgKickActive())
// Update internal kick cooldown of kicked
*/
plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER); plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_LEADER);
if (plr->GetMap()->IsDungeon()) // Teleport player out the dungeon if (plr->GetMap()->IsDungeon()) // Teleport player out the dungeon
sLFGMgr.TeleportPlayer(plr, true); sLFGMgr.TeleportPlayer(plr, true);
} }
if (!group->isLfgDungeonComplete()) // Need more players to finish the dungeon
sLFGMgr.OfferContinue(group);
} }
void OnDisband(Group* group) void OnDisband(Group* group)