吾爱尚玩资源基地

标题: 另外一种WOW_WOTLK单机中配置是否取消疲劳度的代码 [打印本页]

作者: admin    时间: 2016-4-24 17:34
标题: 另外一种WOW_WOTLK单机中配置是否取消疲劳度的代码
这个是一套可以再Trinity端中配置是否取消角色疲劳度的一个C++代码。

直接加到Trinity中,。然后你可以通过worldserver.conf配置文件来设置是否开启疲劳设置。。
另外一个代码可以参考这里:http://www.523play.com/forum.php?mod=viewthread&tid=254&fromuid=1



下面是代码


diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entiti
index e12e5ee..b9e7b6d 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -78,6 +78,7 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
+#include "Config.h"

#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)

@@ -1312,9 +1313,12 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
{
     switch (timer)
     {
-        case FATIGUE_TIMER:
-            return MINUTE * IN_MILLISECONDS;
-        case BREATH_TIMER:
+       if(ConfigMgr::GetBoolDefault("fatigue.enabled", true)) // If "fatigue.en
+               {
+                       case FATIGUE_TIMER:
+                               return MINUTE * IN_MILLISECONDS;
+               }
+            case BREATH_TIMER:
         {
             if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || GetSes
                 return DISABLED_MIRROR_TIMER;
@@ -1396,6 +1400,9 @@ void Player::HandleDrowning(uint32 time_diff)
     }

     // In dark water
+       if(ConfigMgr::GetBoolDefault("fatigue.enabled", true)) // If "fatigue.en
+       {
+
     if (m_MirrorTimerFlags & UNDERWARER_INDARKWATER)
     {
         // Fatigue timer not activated - activate it
@@ -1432,7 +1439,7 @@ void Player::HandleDrowning(uint32 time_diff)
         else if (m_MirrorTimerFlagsLast & UNDERWARER_INDARKWATER)
             SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE
     }
-
+       }
     if (m_MirrorTimerFlags & (UNDERWATER_INLAVA /*| UNDERWATER_INSLIME*/) && !(
     {
         // Breath timer not activated - activate it
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserv
index bf19240..b81fcbd 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -825,6 +825,13 @@ RecruitAFriend.MaxDifference = 4
DisableWaterBreath = 4

#
+#    Enable or Disable "Fatigue" timer
+#           default = 1 (enabled)
+#                   = 0 (disabled)
+
+fatigue.enabled = 1
+
+#
#    AllFlightPaths
#        Description: Character knows all flight paths (of both factions) after
#        Default:     0 - (Disabled)
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entiti
index e12e5ee..b9e7b6d 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -78,6 +78,7 @@
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
+#include "Config.h"

#define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS)

@@ -1312,9 +1313,12 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
{
     switch (timer)
     {
-        case FATIGUE_TIMER:
-            return MINUTE * IN_MILLISECONDS;
-        case BREATH_TIMER:
+       if(ConfigMgr::GetBoolDefault("fatigue.enabled", true)) // If "fatigue.en
+               {
+                       case FATIGUE_TIMER:
+                               return MINUTE * IN_MILLISECONDS;
+               }
+            case BREATH_TIMER:
         {
             if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || GetSes
                 return DISABLED_MIRROR_TIMER;
@@ -1396,6 +1400,9 @@ void Player::HandleDrowning(uint32 time_diff)
     }

     // In dark water
+       if(ConfigMgr::GetBoolDefault("fatigue.enabled", true)) // If "fatigue.en
+       {
+
     if (m_MirrorTimerFlags & UNDERWARER_INDARKWATER)
     {
         // Fatigue timer not activated - activate it
@@ -1432,7 +1439,7 @@ void Player::HandleDrowning(uint32 time_diff)
         else if (m_MirrorTimerFlagsLast & UNDERWARER_INDARKWATER)
             SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE
     }
-
+       }
     if (m_MirrorTimerFlags & (UNDERWATER_INLAVA /*| UNDERWATER_INSLIME*/) && !(
     {
         // Breath timer not activated - activate it
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserv
index bf19240..b81fcbd 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -825,6 +825,13 @@ RecruitAFriend.MaxDifference = 4
DisableWaterBreath = 4

#
+#    Enable or Disable "Fatigue" timer
+#           default = 1 (enabled)
+#                   = 0 (disabled)
+
+fatigue.enabled = 1
+
+#
#    AllFlightPaths
#        Description: Character knows all flight paths (of both factions) after
#        Default:     0 - (Disabled)



Fatigue Disable禁止疲劳代码下载








欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/) Powered by Discuz! X3.4