关灯
开启左侧

变态服务端设置:各种等级阶段的经验值的参考代码

  [复制链接]
admin实名认证 发表于 2016-4-18 22:48:53 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 
diff --git a/dep/ACE_wrappers/ace/os_include/os_intrin.h b/dep/ACE_wrappers/ace/os_include/os_intrin.hindex 37b6695..66568a4 100644

diff --git a/src/game/Formulas.h b/src/game/Formulas.h
index 5ba6ffd..aa5147c 100644
--- a/src/game/Formulas.h
+++ b/src/game/Formulas.h
@@ -112,8 +112,17 @@ namespace MaNGOS

             if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->isElite())
                 xp_gain *= 2;
-
-            return (uint32)(xp_gain*sWorld.getRate(RATE_XP_KILL));
+                       
+                        // Check player's level
+                        uint32 lvl=pl->getLevel();
+                        if(1<=lvl && lvl<=39)
+                                return (uint32)(xp_gain*sWorld.getRate(RATE_XP_KILL)*sWorld.getRate(RATE_XP_KILL_1));
+            if(40<=lvl && lvl<=59)
+                                return (uint32)(xp_gain*sWorld.getRate(RATE_XP_KILL)*sWorld.getRate(RATE_XP_KILL_2));
+                        if(60<=lvl && lvl<=69)
+                                return (uint32)(xp_gain*sWorld.getRate(RATE_XP_KILL)*sWorld.getRate(RATE_XP_KILL_3));
+                        // If, in some way, player's level is greater than 70, or at level 70, player will recieve standart experience
+                        return (uint32)(xp_gain*sWorld.getRate(RATE_XP_KILL));
         }

         inline uint32 xp_Diff(uint32 lvl)
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index a89b113..9a4b673 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -2045,15 +2045,28 @@ void Player::GiveXP(uint32 xp, Unit* victim)
     uint32 nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
     uint32 newXP = curXP + xp + rested_bonus_xp;

+        uint32 average1Rate=(sWorld.getConfig(RATE_XP_QUEST_1)+sWorld.getConfig(RATE_XP_KILL_1)+sWorld.getConfig(RATE_XP_EXPLORE_1))/3;
+        uint32 average2Rate=(sWorld.getConfig(RATE_XP_QUEST_2)+sWorld.getConfig(RATE_XP_KILL_2)+sWorld.getConfig(RATE_XP_EXPLORE_2))/3;
+        uint32 average3Rate=(sWorld.getConfig(RATE_XP_QUEST_3)+sWorld.getConfig(RATE_XP_KILL_3)+sWorld.getConfig(RATE_XP_EXPLORE_3))/3;
+
     while( newXP >= nextLvlXP && level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) )
     {
         newXP -= nextLvlXP;
+               
+                uint32 oldlevel = level;

         if ( level < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) )
             GiveLevel(level + 1);

         level = getLevel();
-        nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
+        if (level>=40 && oldlevel <40){
+                        newXP = newXP / average1Rate * average2Rate;
+                }
+                if (level>=60 && oldlevel <60){
+                        newXP = newXP / average2Rate * average3Rate;
+                }
+
+                nextLvlXP = GetUInt32Value(PLAYER_NEXT_LEVEL_XP);
     }

     SetUInt32Value(PLAYER_XP, newXP);
@@ -5253,7 +5266,16 @@ void Player::CheckExploreSystem()
                 {
                     XP = uint32(objmgr.GetBaseXP(p->area_level)*sWorld.getRate(RATE_XP_EXPLORE));
                 }
-
+                                // Check player's level
+                                uint32 lvl=this->getLevel();
+                                if(1<=lvl && lvl<=39)
+                                        XP*=sWorld.getRate(RATE_XP_EXPLORE_1);
+                                if(40<=lvl && lvl<=59)
+                                        XP*=sWorld.getRate(RATE_XP_EXPLORE_2);
+                                if(60<=lvl && lvl<=69)
+                                        XP*=sWorld.getRate(RATE_XP_EXPLORE_3);
+                                // If, in some way, player's level is greater than 70, or at level 70, player will recieve standart experience
+                 
                 GiveXP( XP, NULL );
                 SendExplorationExperience(area,XP);
             }
@@ -12022,6 +12044,16 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
     // Not give XP in case already completed once repeatable quest
     uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue( this )*sWorld.getRate(RATE_XP_QUEST));

+        // Check player's level
+         uint32 lvl=this->getLevel();
+         if(1<=lvl && lvl<=39)
+                 XP*=sWorld.getRate(RATE_XP_QUEST_1);
+         if(40<=lvl && lvl<=59)
+                 XP*=sWorld.getRate(RATE_XP_QUEST_2);
+         if(60<=lvl && lvl<=69)
+                 XP*=sWorld.getRate(RATE_XP_QUEST_3);
+         // If, in some way, player's level is greater than 70, or at level 70, player will recieve standart experience
+
     if ( getLevel() < sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL) )
         GiveXP( XP , NULL );
     else
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 11b95cf..ab44562 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -433,8 +433,17 @@ void World::LoadConfigSettings(bool reload)
     rate_values[RATE_DROP_ITEM_REFERENCED] = sConfig.GetFloatDefault("Rate.Drop.Item.Referenced", 1.0f);
     rate_values[RATE_DROP_MONEY]  = sConfig.GetFloatDefault("Rate.Drop.Money", 1.0f);
     rate_values[RATE_XP_KILL]     = sConfig.GetFloatDefault("Rate.XP.Kill", 1.0f);
+    rate_values[RATE_XP_KILL_1]     = sConfig.GetFloatDefault("Rate.XP.Kill.1", 1);
+    rate_values[RATE_XP_KILL_2]     = sConfig.GetFloatDefault("Rate.XP.Kill.2", 1);
+    rate_values[RATE_XP_KILL_3]     = sConfig.GetFloatDefault("Rate.XP.Kill.3", 1);
     rate_values[RATE_XP_QUEST]    = sConfig.GetFloatDefault("Rate.XP.Quest", 1.0f);
+    rate_values[RATE_XP_QUEST_1]    = sConfig.GetFloatDefault("Rate.XP.Quest.1", 1);
+    rate_values[RATE_XP_QUEST_2]    = sConfig.GetFloatDefault("Rate.XP.Quest.2", 1);
+    rate_values[RATE_XP_QUEST_3]    = sConfig.GetFloatDefault("Rate.XP.Quest.3", 1);
     rate_values[RATE_XP_EXPLORE]  = sConfig.GetFloatDefault("Rate.XP.Explore", 1.0f);
+    rate_values[RATE_XP_EXPLORE_1]  = sConfig.GetFloatDefault("Rate.XP.Explore.1", 1);
+    rate_values[RATE_XP_EXPLORE_2]  = sConfig.GetFloatDefault("Rate.XP.Explore.2", 1);
+    rate_values[RATE_XP_EXPLORE_3]  = sConfig.GetFloatDefault("Rate.XP.Explore.3", 1);
     rate_values[RATE_XP_PAST_70]  = sConfig.GetFloatDefault("Rate.XP.PastLevel70", 1.0f);
     rate_values[RATE_REPUTATION_GAIN]  = sConfig.GetFloatDefault("Rate.Reputation.Gain", 1.0f);
     rate_values[RATE_CREATURE_NORMAL_DAMAGE]          = sConfig.GetFloatDefault("Rate.Creature.Normal.Damage", 1.0f);
diff --git a/src/game/World.h b/src/game/World.h
index 108b1bb..f7115d9 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -182,9 +182,18 @@ enum Rates
     RATE_DROP_ITEM_REFERENCED,
     RATE_DROP_MONEY,
     RATE_XP_KILL,
-    RATE_XP_QUEST,
-    RATE_XP_EXPLORE,
-    RATE_XP_PAST_70,
+    RATE_XP_KILL_1,
+        RATE_XP_KILL_2,
+        RATE_XP_KILL_3,
+        RATE_XP_QUEST,
+    RATE_XP_QUEST_1,
+        RATE_XP_QUEST_2,
+        RATE_XP_QUEST_3,
+        RATE_XP_EXPLORE,
+    RATE_XP_EXPLORE_1,
+        RATE_XP_EXPLORE_2,
+        RATE_XP_EXPLORE_3,
+        RATE_XP_PAST_70,
     RATE_REPUTATION_GAIN,
     RATE_CREATURE_NORMAL_HP,
     RATE_CREATURE_ELITE_ELITE_HP,
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index 4c69f2d..17dcd3a 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -880,6 +880,22 @@ Visibility.Distance.Grey.Object = 10
#        XP rates
#        Default: 1
#
+#    Rate.XP.Kill.1
+#    Rate.XP.Quest.1
+#    Rate.XP.Explore.1
+#        XP rates for 1-39 levels
+#        Default: 1
+#    Rate.XP.Kill.2
+#    Rate.XP.Quest.2
+#    Rate.XP.Explore.2
+#        XP rates for 40-59 levels
+#        Default: 1
+#    Rate.XP.Kill.3
+#    Rate.XP.Quest.3
+#    Rate.XP.Explore.3
+#        XP rates for 60-69 levels
+#        Default: 1
+#
#    Rate.XP.PastLevel70
#        XP needed per level past 70 (Rates below 1 not recommended)
#        Default: 1
@@ -986,6 +1002,15 @@ Rate.Drop.Money = 1
Rate.XP.Kill    = 1
Rate.XP.Quest   = 1
Rate.XP.Explore = 1
+Rate.XP.Kill.1    = 1
+Rate.XP.Quest.1   = 1
+Rate.XP.Explore.1 = 1
+Rate.XP.Kill.2    = 1
+Rate.XP.Quest.2   = 1
+Rate.XP.Explore.2 = 1
+Rate.XP.Kill.3    = 1
+Rate.XP.Quest.3   = 1
+Rate.XP.Explore.3 = 1
Rate.XP.PastLevel70 = 1
Rate.Rest.InGame = 1
Rate.Rest.Offline.InTavernOrCity = 1

 
VIP介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 最佳新人

    注册账号后积极发帖的会员
  • 活跃会员

    经常参与各类话题的讨论,发帖内容较有主见
  • 热心会员

    经常帮助其他会员答疑
  • 推广达人

    积极宣传本站,为本站带来更多注册会员
  • 宣传达人

    积极宣传本站,为本站带来更多的用户访问量
  • 灌水之王

    经常在论坛发帖,且发帖量较大
  • 突出贡献

    长期对论坛的繁荣而不断努力,或多次提出建设性意见
  • 优秀版主

    活跃且尽责职守的版主
  • 荣誉管理

    曾经为论坛做出突出贡献目前已离职的版主
  • 论坛元老

    为论坛做出突出贡献的会员

0关注

5粉丝

3421帖子

排行榜
作者专栏

QQ交流群&&微信订阅号

QQ交流群

微信订阅号

吾爱尚玩资源基地永久域名:

Www.523Play.Com

在线管理员QQ:1589479632

邮箱:Email@523play.com

QQ交流群:558936238

Copyright   ©2015-2116  吾爱尚玩资源基地|523play.comPowered by©523Pplay.Com技术支持:吾爱尚玩资源基地