吾爱尚玩资源基地
标题:
变态服务端设置:各种等级阶段的经验值的参考代码
[打印本页]
作者:
admin
时间:
2016-4-18 22:48
标题:
变态服务端设置:各种等级阶段的经验值的参考代码
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
欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/)
Powered by Discuz! X3.4