Jump to content

[Patch] Add "Instance.Bind" to config file.


Guest Nahpalm

Recommended Posts

This patch allows you to configure whether or not players should bind to an instance on boss kills.

diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 669d9ad..aa9fe60 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -15299,29 +15299,32 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, uint8 difficulty,

InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, bool load)
{
-    if(save)
+    if (save)
    {
        InstancePlayerBind& bind = m_boundInstances[save->GetDifficulty()][save->GetMapId()];
-        if(bind.save)
+        if (bind.save)
        {
            // update the save when the group kills a boss
-            if(permanent != bind.perm || save != bind.save)
-                if(!load) CharacterDatabase.PExecute("UPDATE character_instance SET instance = '%u', permanent = '%u' WHERE guid = '%u' AND instance = '%u'", save->GetInstanceId(), permanent, GetGUIDLow(), bind.save->GetInstanceId());
+            if (permanent != bind.perm || save != bind.save)
+                if(!load) CharacterDatabase.PExecute("UPDATE character_instance SET instance = '%u', permanent = '%u' WHERE guid = '%u' AND instance = '%u'", save->GetInstanceId(), (!sWorld.getConfig(CONFIG_INSTANCE_BIND))?0:Permanent, GetGUIDLow(), bind.save->GetInstanceId());
        }
        else
-            if(!load) CharacterDatabase.PExecute("INSERT INTO character_instance (guid, instance, permanent) VALUES
('%u', '%u', '%u')", GetGUIDLow(), save->GetInstanceId(), permanent);
+            if (!load)
+                CharacterDatabase.PExecute("INSERT INTO character_instance (guid, instance, permanent) VALUES
('%u', '%u', '%u')", GetGUIDLow(), save->GetInstanceId(), (!sWorld.getConfig(CONFIG_INSTANCE_BIND))?0:Permanent);

-        if(bind.save != save)
+        if (bind.save != save)
        {
-            if(bind.save) bind.save->RemovePlayer(this);
+            if (bind.save)
+                bind.save->RemovePlayer(this);
            save->AddPlayer(this);
        }

-        if(permanent) save->SetCanReset(false);
+        if (permanent && !sWorld.getConfig(CONFIG_INSTANCE_BIND))
+            save->SetCanReset(false);

        bind.save = save;
-        bind.perm = permanent;
-        if(!load) sLog.outDebug("Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
+        bind.perm = (!sWorld.getConfig(CONFIG_INSTANCE_BIND))?0:Permanent;
+        if (!load) sLog.outDebug("Player::BindToInstance: %s(%d) is now bound to map %d, instance %d, difficulty %d", GetName(), GetGUIDLow(), save->GetMapId(), save->GetInstanceId(), save->GetDifficulty());
        return &bind;
    }
    else
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 328521e..ad0cc6b 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -755,6 +755,7 @@ void World::LoadConfigSettings(bool reload)

    m_configs[CONFIG_ALL_TAXI_PATHS] = sConfig.GetBoolDefault("AllFlightPaths", false);

+    m_configs[CONFIG_INSTANCE_BIND] = sConfig.GetBoolDefault("Instance.Bind", true);
    m_configs[CONFIG_INSTANCE_IGNORE_LEVEL] = sConfig.GetBoolDefault("Instance.IgnoreLevel", false);
    m_configs[CONFIG_INSTANCE_IGNORE_RAID]  = sConfig.GetBoolDefault("Instance.IgnoreRaid", false);

diff --git a/src/game/World.h b/src/game/World.h
index 400bed8..aea9cb3 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -121,6 +121,7 @@ enum WorldConfigs
    CONFIG_START_HONOR_POINTS,
    CONFIG_MAX_ARENA_POINTS,
    CONFIG_START_ARENA_POINTS,
+    CONFIG_INSTANCE_BIND,
    CONFIG_INSTANCE_IGNORE_LEVEL,
    CONFIG_INSTANCE_IGNORE_RAID,
    CONFIG_INSTANCE_RESET_TIME_HOUR,
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index c96c59c..a9a260d 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -1,4 +1,4 @@
-#####################################
+#####################################
# MaNGOS Configuration file         #
#####################################
ConfVersion=2008080101
@@ -499,6 +499,11 @@ LogColors = ""
#        Default: 1 (true)
#                 0 (false)
#
+#    Instance.Bind
+#        Do not bind players to instances on boss kill
+#        Default: 1 (true)
+#                 0 (false)
+#
#    Instance.IgnoreLevel
#        Ignore level requirement to enter instance
#        Default: 0 (false)
@@ -604,6 +609,7 @@ AllFlightPaths = 0
AlwaysMaxSkillForLevel = 0
ActivateWeather = 1
CastUnstuck = 1
+Instance.Bind = 1
Instance.IgnoreLevel = 0
Instance.IgnoreRaid = 0
Instance.ResetTimeHour = 4

Link to comment
Share on other sites

  • 2 months later...

why not add this check in:

Unit.cpp

((InstanceMap *)m)->PermBindAllPlayers(creditedPlayer);

?

also it looks like you're using tabs instead of 4 spaces

and

+# Do not bind players to instances on boss kill

+# Default: 1 (true)

seems wrong - default should be false or text must be: "Bind players to instances on boss kill"

cause default we want that every player gets an id

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use