Core/Instances: Implemented confirmation dialog for players upon entering instance which would permanently bind the player to it, players can now choose to get saved or leave the instance

Also fixes broken build
This commit is contained in:
Shauren
2011-01-24 11:38:59 +01:00
parent e7dbc783cf
commit 820f87f365
8 changed files with 66 additions and 1 deletions
@@ -616,6 +616,8 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_ConditionErrorMsgId = 0;
isDebugAreaTriggers = false;
SetPendingBind(NULL, 0);
}
Player::~Player ()
@@ -1498,6 +1500,17 @@ void Player::Update(uint32 p_time)
HandleSobering();
}
if (HasPendingBind())
{
if (_pendingBindTimer <= p_time)
{
BindToInstance();
SetPendingBind(NULL, 0);
}
else
_pendingBindTimer -= p_time;
}
// not auto-free ghost from body in instances
if (m_deathTimer > 0 && !GetBaseMap()->Instanceable())
{
@@ -17688,6 +17701,14 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, b
return NULL;
}
void Player::BindToInstance()
{
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
data << uint32(0);
GetSession()->SendPacket(&data);
BindToInstance(_pendingBind, true);
}
void Player::SendRaidInfo()
{
uint32 counter = 0;
+5
View File
@@ -2302,6 +2302,9 @@ class Player : public Unit, public GridObject<Player>
void UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload = false);
void UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficulty, bool unload = false);
InstancePlayerBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false);
void BindToInstance();
void SetPendingBind(InstanceSave* save, uint32 bindTimer) { _pendingBind = save; _pendingBindTimer = bindTimer; }
bool HasPendingBind() const { return _pendingBind != NULL; }
void SendRaidInfo();
void SendSavedInstances();
static void ConvertInstancesToGroup(Player *player, Group *group = NULL, uint64 player_guid = 0);
@@ -2720,6 +2723,8 @@ class Player : public Unit, public GridObject<Player>
uint32 m_timeSyncServer;
InstanceTimeMap _instanceResetTimes;
InstanceSave* _pendingBind;
uint32 _pendingBindTimer;
};
void AddItemsSetItem(Player*player,Item *item);