diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 5d47f5f7e..fea7809b4 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1665,7 +1665,7 @@ bool Group::InCombatToInstance(uint32 instanceId) return false; } -void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) +void Group::ResetInstances(InstanceResetMethod method, bool isRaid, Player* SendMsgTo) { if(isBGGroup()) return; diff --git a/src/game/Group.h b/src/game/Group.h index 45a949ad6..be8fb3d4f 100644 --- a/src/game/Group.h +++ b/src/game/Group.h @@ -26,6 +26,7 @@ #include "BattleGround.h" #include "LootMgr.h" #include "DBCEnums.h" +#include "SharedDefines.h" #include #include @@ -325,7 +326,7 @@ class MANGOS_DLL_SPEC Group void SetRaidDifficulty(Difficulty difficulty); uint16 InInstance(); bool InCombatToInstance(uint32 instanceId); - void ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo); + void ResetInstances(InstanceResetMethod method, bool isRaid, Player* SendMsgTo); void SendTargetIconList(WorldSession *session); void SendUpdate(); diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 11868180c..74fb80f59 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -553,8 +553,16 @@ bool ChatHandler::HandleGonameCommand(char* args) InstanceGroupBind *gBind = group ? group->GetBoundInstance(target->GetMapId(), target) : NULL; // if no bind exists, create a solo bind if (!gBind) + { if (InstanceSave *save = target->GetMap()->GetInstanceSave()) - _player->BindToInstance(save, !save->CanReset()); + { + // if player is group leader then we need add group bind + if (group && group->IsLeader(_player->GetObjectGuid())) + group->BindToInstance(save, !save->CanReset()); + else + _player->BindToInstance(save, !save->CanReset()); + } + } } if(cMap->IsRaid()) diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 28dc44657..24ae1c181 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1740,7 +1740,7 @@ bool InstanceMap::Add(Player *player) if (IsDungeon()) { // check for existing instance binds - InstancePlayerBind *playerBind = player->GetBoundInstance(GetId(), Difficulty(GetSpawnMode())); + InstancePlayerBind *playerBind = player->GetBoundInstance(GetId(), GetDifficulty()); if (playerBind && playerBind->perm) { // cannot enter other instances if bound permanently @@ -1778,8 +1778,11 @@ bool InstanceMap::Add(Player *player) pGroup->GetId(), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); - MANGOS_ASSERT(false); + + // no reason crash if we can fix state + player->UnbindInstance(GetId(), GetDifficulty()); } + // bind to the group or keep using the group save if (!groupBind) pGroup->BindToInstance(GetInstanceSave(), false); @@ -1922,7 +1925,7 @@ void InstanceMap::CreateInstanceData(bool load) /* Returns true if there are no players in the instance */ -bool InstanceMap::Reset(uint8 method) +bool InstanceMap::Reset(InstanceResetMethod method) { // note: since the map may not be loaded when the instance needs to be reset // the instance must be deleted from the DB by InstanceSaveManager diff --git a/src/game/Map.h b/src/game/Map.h index 0033c2c9f..adae8e189 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -369,16 +369,6 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj void DeleteFromWorld(T*); }; -enum InstanceResetMethod -{ - INSTANCE_RESET_ALL, - INSTANCE_RESET_CHANGE_DIFFICULTY, - INSTANCE_RESET_GLOBAL, - INSTANCE_RESET_GROUP_DISBAND, - INSTANCE_RESET_GROUP_JOIN, - INSTANCE_RESET_RESPAWN_DELAY -}; - class MANGOS_DLL_SPEC InstanceMap : public Map { public: @@ -388,7 +378,7 @@ class MANGOS_DLL_SPEC InstanceMap : public Map void Remove(Player *, bool); void Update(uint32 time_, uint32 diff); void CreateInstanceData(bool load); - bool Reset(uint8 method); + bool Reset(InstanceResetMethod method); uint32 GetScriptId() { return i_script_id; } InstanceData* GetInstanceData() { return i_data; } void PermBindAllPlayers(Player *player); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 134c12223..04d35c083 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17661,7 +17661,7 @@ void Player::SendResetFailedNotify(uint32 mapid) } /// Reset all solo instances and optionally send a message on success for each -void Player::ResetInstances(uint8 method, bool isRaid) +void Player::ResetInstances(InstanceResetMethod method, bool isRaid) { // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_JOIN diff --git a/src/game/Player.h b/src/game/Player.h index 61e47f5c5..79a64f0c8 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -37,6 +37,7 @@ #include "ReputationMgr.h" #include "BattleGround.h" #include "DBCEnums.h" +#include "SharedDefines.h" #include #include @@ -1919,7 +1920,7 @@ class MANGOS_DLL_SPEC Player : public Unit void SendDungeonDifficulty(bool IsInGroup); void SendRaidDifficulty(bool IsInGroup); - void ResetInstances(uint8 method, bool isRaid); + void ResetInstances(InstanceResetMethod method, bool isRaid); void SendResetInstanceSuccess(uint32 MapId); void SendResetInstanceFailed(uint32 reason, uint32 MapId); void SendResetFailedNotify(uint32 mapid); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 13abe2ff0..b803c0804 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2472,6 +2472,16 @@ enum DiminishingGroup DIMINISHING_LIMITONLY }; +enum InstanceResetMethod +{ + INSTANCE_RESET_ALL, + INSTANCE_RESET_CHANGE_DIFFICULTY, + INSTANCE_RESET_GLOBAL, + INSTANCE_RESET_GROUP_DISBAND, + INSTANCE_RESET_GROUP_JOIN, + INSTANCE_RESET_RESPAWN_DELAY +}; + enum ResponseCodes { RESPONSE_SUCCESS = 0x00, diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 71968ffd5..9ed6df747 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10712" + #define REVISION_NR "10713" #endif // __REVISION_NR_H__