Jump to content

Duel reset and server info


Recommended Posts

This patch contains two patches: The first adds an option in the configuration file, you can use to enable or disable a showing (.server info) core,db and sd2 versions, the second patch adds an option in the configuration file, you can use to enable the restoration of full healt, mana and reset cooldowns less than 15 minutes after duel begin.

The first patch is written by me, the second taken from the TC and added the possibility to enable / disable it in the configuration file.

9399+

This patch for 9357 rev.

diff --git a/src/game/DuelHandler.cpp b/src/game/DuelHandler.cpp
index a73be6f..9538780 100644
--- a/src/game/DuelHandler.cpp
+++ b/src/game/DuelHandler.cpp
@@ -49,6 +49,14 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
    pl->duel->startTimer = now;
    plTarget->duel->startTimer = now;

+    ///reset hp, mana and cooldown
+    pl->SetHealth(pl->GetMaxHealth());
+    plTarget->SetHealth(plTarget->GetMaxHealth());
+    if (pl->getPowerType() == POWER_MANA) pl->SetPower(POWER_MANA, pl->GetMaxPower(POWER_MANA));
+    if (plTarget->getPowerType() == POWER_MANA) plTarget->SetPower(POWER_MANA, plTarget->GetMaxPower(POWER_MANA));
+    if (!pl->GetMap()->IsDungeon())
+    { pl->RemoveArenaSpellCooldowns(); plTarget->RemoveArenaSpellCooldowns(); } ///reset cooldowns with < 15min
+
    pl->SendDuelCountdown(3000);
    plTarget->SendDuelCountdown(3000);
}
diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp
index d498960..3c47ff6 100644
--- a/src/game/Level0.cpp
+++ b/src/game/Level0.cpp
@@ -91,6 +91,8 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
    uint32 maxQueuedClientsNum = sWorld.GetMaxQueuedSessionCount();
    std::string str = secsToTimeString(sWorld.GetUptime());

+    if(sWorld.Getserver_version_enable() == 1)
+    {
    char const* full;
    if(m_session)
        full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r");
@@ -101,6 +103,8 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
    PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion());
    PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
    PSendSysMessage(LANG_USING_EVENT_AI,sWorld.GetCreatureEventAIVersion());
+    }
+
    PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
    PSendSysMessage(LANG_UPTIME, str.c_str());

diff --git a/src/game/World.cpp b/src/game/World.cpp
index 0134ad5..e3ae13d 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -548,6 +548,13 @@ void World::LoadConfigSettings(bool reload)

    ///- Read other configuration items from the config file

+
+    /// server info
+    server_version_enable     = sConfig.GetBoolDefault("ServerInfo.Version.Enable",true);
+
+    /// hp, mana and reset cd duel
+    duel_reset_enable         = sConfig.GetBoolDefault("Duel.reset.Enable",false);
+
    m_configs[CONFIG_COMPRESSION] = sConfig.GetIntDefault("Compression", 1);
    if(m_configs[CONFIG_COMPRESSION] < 1 || m_configs[CONFIG_COMPRESSION] > 9)
    {
diff --git a/src/game/World.h b/src/game/World.h
index 170fc2a..f0be500 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -511,6 +511,12 @@ class World
        static float GetVisibleUnitGreyDistance()           { return m_VisibleUnitGreyDistance;       }
        static float GetVisibleObjectGreyDistance()         { return m_VisibleObjectGreyDistance;     }

+        //for server information
+        inline bool Getserver_version_enable()              { return server_version_enable; }
+        
+        //for duel reset
+        inline bool Getduel_reset_enable()                  { return duel_reset_enable; }
+        
        void ProcessCliCommands();
        void QueueCliCommand( CliCommandHolder::Print* zprintf, char const* input ) { cliCmdQueue.add(new CliCommandHolder(input, zprintf)); }

@@ -579,6 +585,12 @@ class World
        static float m_VisibleUnitGreyDistance;
        static float m_VisibleObjectGreyDistance;

+        // for server version show
+        bool server_version_enable;
+        
+        // for restore hp and mana and remove cooldown after duel begin
+        bool duel_reset_enable;
+        
        // CLI command holder to be thread safe
        ACE_Based::LockedQueue<CliCommandHolder*,ACE_Thread_Mutex> cliCmdQueue;
        SqlResultQueue *m_resultQueue;
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index 479a6ce..7ec9df0 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -1374,3 +1374,19 @@ Ra.IP = 0.0.0.0
Ra.Port = 3443
Ra.MinLevel = 3
Ra.Secure = 1
+
+##################################################################################################################
+# MODIFICATIONS
+#    ServerInfo.Version.Enable 
+#        Enable show server version (.server info)
+#        Default: 1 - on
+#                      0 - off (show current and max online and uptime only)
+#
+#    Duel.reset.Enable 
+#        Enable reset hp, mana and cooldown after duel begin
+#        Default: 0 - off
+#                      1 - on
+##################################################################################################################
+
+ServerInfo.Version.Enable = 1
+Duel.reset.Enable = 0
-- 

Link to comment
Share on other sites

  • 40 years later...

Updated for 9428 (after 8399) + some cosmetic changes.

diff --git a/src/game/DuelHandler.cpp b/src/game/DuelHandler.cpp
index a73be6f..0f8669a 100644
--- a/src/game/DuelHandler.cpp
+++ b/src/game/DuelHandler.cpp
@@ -23,6 +23,7 @@
#include "Opcodes.h"
#include "UpdateData.h"
#include "Player.h"
+#include "World.h"

void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
{
@@ -49,6 +50,16 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
    pl->duel->startTimer = now;
    plTarget->duel->startTimer = now;

+    ///reset hp, mana and cooldown
+    if(sWorld.getConfig(CONFIG_BOOL_DUEL_RESET))
+    {
+    pl->SetHealth(pl->GetMaxHealth());
+    plTarget->SetHealth(plTarget->GetMaxHealth());
+    if (pl->getPowerType() == POWER_MANA) pl->SetPower(POWER_MANA, pl->GetMaxPower(POWER_MANA));
+    if (plTarget->getPowerType() == POWER_MANA) plTarget->SetPower(POWER_MANA, plTarget->GetMaxPower(POWER_MANA));
+    if (!pl->GetMap()->IsDungeon())
+    { pl->RemoveArenaSpellCooldowns(); plTarget->RemoveArenaSpellCooldowns(); }
+    }
    pl->SendDuelCountdown(3000);
    plTarget->SendDuelCountdown(3000);
}
diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp
index a265405..f2c1b31 100644
--- a/src/game/Level0.cpp
+++ b/src/game/Level0.cpp
@@ -91,6 +91,8 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
    uint32 maxQueuedClientsNum = sWorld.GetMaxQueuedSessionCount();
    std::string str = secsToTimeString(sWorld.GetUptime());

+    if(sWorld.getConfig(CONFIG_BOOL_SERVER_INFO))
+    {
    char const* full;
    if(m_session)
        full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,"|cffffffff|Hurl:" REVISION_ID "|h" REVISION_ID "|h|r");
@@ -101,6 +103,7 @@ bool ChatHandler::HandleServerInfoCommand(const char* /*args*/)
    PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion());
    PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion());
    PSendSysMessage(LANG_USING_EVENT_AI,sWorld.GetCreatureEventAIVersion());
+    }
    PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum);
    PSendSysMessage(LANG_UPTIME, str.c_str());

diff --git a/src/game/World.cpp b/src/game/World.cpp
index 7516899..c4528fb 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -514,6 +514,10 @@ void World::LoadConfigSettings(bool reload)
    setConfigPos(CONFIG_FLOAT_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS, "CreatureFamilyFleeAssistanceRadius", 30.0f);

    ///- Read other configuration items from the config file
+    ///modifications_begin
+    setConfig(CONFIG_BOOL_SERVER_INFO, "ServerInfo", true);
+    setConfig(CONFIG_BOOL_DUEL_RESET, "DuelReset", false);
+    ///modifications_end
    setConfigMinMax(CONFIG_UINT32_COMPRESSION, "Compression", 1, 1, 9);
    setConfig(CONFIG_BOOL_ADDON_CHANNEL, "AddonChannel", true);
    setConfig(CONFIG_BOOL_GRID_UNLOAD, "GridUnload", true);
diff --git a/src/game/World.h b/src/game/World.h
index e6a8357..7d7a961 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -300,7 +300,10 @@ enum eConfigBoolValues
    CONFIG_BOOL_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY,
    CONFIG_BOOL_ARENA_AUTO_DISTRIBUTE_POINTS,
    CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_ENABLE,
-    CONFIG_BOOL_VALUE_COUNT
+    CONFIG_BOOL_VALUE_COUNT,
+    //modifications
+    CONFIG_BOOL_SERVER_INFO,
+    CONFIG_BOOL_DUEL_RESET
};

/// Type of server
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index 8cfc258..01d98f5 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -1381,3 +1381,21 @@ Ra.IP = 0.0.0.0
Ra.Port = 3443
Ra.MinLevel = 3
Ra.Secure = 1
+
+##################################################################################################################
+# MODIFICATIONS
+#
+#    ServerInfo 
+#        Enable show server version (.server info)
+#        Default: 1 - on
+#                 0 - off (show current and max online and uptime only)
+#
+#    DuelReset 
+#        Enable reset hp, mana and cooldown after duel begin
+#        Default: 0 - off
+#                 1 - on
+#
+###################################################################################################################
+
+ServerInfo = 1
+DuelReset = 0
\\ No newline at end of file
-- 

Link to comment
Share on other sites

  • 11 months later...
Guest
This topic is now closed to further replies.
×
×
  • 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