Skip to content

Commit 8756379

Browse files
committed
xp multiplicator with smooth exponential curve
1 parent c38a62b commit 8756379

2 files changed

Lines changed: 40 additions & 24 deletions

File tree

conf/mod-profession-experience.conf.dist

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,28 @@ ProfessionExperience.MultOrange = 1.25
3333
# ProfessionExperience.MultGrandMaster 376-450
3434
# Description: Multiplicator to experience when using a skill in this skill range
3535
# Default: 1.0 - (ProfessionExperience.MultApprentice)
36-
# 2.0 - (ProfessionExperience.MultJourneyman)
37-
# 3.0 - (ProfessionExperience.MultExpert)
38-
# 4.0 - (ProfessionExperience.MultArtisan)
39-
# 5.0 - (ProfessionExperience.MultMaster)
40-
# 6.0 - (ProfessionExperience.MultGrandMaster)
36+
# 1.0 - (ProfessionExperience.MultJourneyman)
37+
# 1.0 - (ProfessionExperience.MultExpert)
38+
# 1.0 - (ProfessionExperience.MultArtisan)
39+
# 1.0 - (ProfessionExperience.MultMaster)
40+
# 1.0 - (ProfessionExperience.MultGrandMaster)
4141

4242
ProfessionExperience.MultApprentice = 1.0
43-
ProfessionExperience.MultJourneyman = 2.0
44-
ProfessionExperience.MultExpert = 3.0
45-
ProfessionExperience.MultArtisan = 4.0
46-
ProfessionExperience.MultMaster = 5.0
47-
ProfessionExperience.MultGrandMaster = 6.0
43+
ProfessionExperience.MultJourneyman = 1.0
44+
ProfessionExperience.MultExpert = 1.0
45+
ProfessionExperience.MultArtisan = 1.0
46+
ProfessionExperience.MultMaster = 1.0
47+
ProfessionExperience.MultGrandMaster = 1.0
48+
49+
50+
#
51+
# ProfessionExperience.MultCurve
52+
# Description: Multiplicator to Experience applied as an exponential curve. Formula is "xp x mult ^ (minSkill/450).
53+
# Close to 1 at skill 1. Square root at skill 225. Values below 1.0 apply a penalty at higher level instead.
54+
# Default: 5.0
55+
# Disabled: 0.0
56+
57+
ProfessionExperience.MultCurve = 5.0
4858

4959

5060
#

src/ProfessionExp.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ enum class PEConfig
3737
MULT_ARTISAN,
3838
MULT_MASTER,
3939
MULT_GRANDMASTER,
40+
MULT_CURVE,
4041

4142
NUM_CONFIGS,
4243
};
@@ -72,11 +73,12 @@ class PEConfigData : public ConfigValueCache<PEConfig>
7273
SetConfigValue<float>(PEConfig::MULT_ORANGE, "ProfessionExperience.MultOrange", 1.25f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
7374

7475
SetConfigValue<float>(PEConfig::MULT_APPRENTICE, "ProfessionExperience.MultApprentice", 1.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
75-
SetConfigValue<float>(PEConfig::MULT_JOURNEYMAN, "ProfessionExperience.MultJourneyman", 2.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
76-
SetConfigValue<float>(PEConfig::MULT_EXPERT, "ProfessionExperience.MultExpert", 3.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
77-
SetConfigValue<float>(PEConfig::MULT_ARTISAN, "ProfessionExperience.MultArtisan", 4.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
78-
SetConfigValue<float>(PEConfig::MULT_MASTER, "ProfessionExperience.MultMaster", 5.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
79-
SetConfigValue<float>(PEConfig::MULT_GRANDMASTER,"ProfessionExperience.MultGrandMaster",6.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
76+
SetConfigValue<float>(PEConfig::MULT_JOURNEYMAN, "ProfessionExperience.MultJourneyman", 1.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
77+
SetConfigValue<float>(PEConfig::MULT_EXPERT, "ProfessionExperience.MultExpert", 1.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
78+
SetConfigValue<float>(PEConfig::MULT_ARTISAN, "ProfessionExperience.MultArtisan", 1.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
79+
SetConfigValue<float>(PEConfig::MULT_MASTER, "ProfessionExperience.MultMaster", 1.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
80+
SetConfigValue<float>(PEConfig::MULT_GRANDMASTER,"ProfessionExperience.MultGrandMaster",1.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
81+
SetConfigValue<float>(PEConfig::MULT_CURVE, "ProfessionExperience.MultCurve", 5.0f, ConfigValueCache::Reloadable::Yes, [](float const& value) { return value >= 0.0f; }, ">= 0");
8082

8183
}
8284
};
@@ -94,7 +96,7 @@ RewardExperienceScript() : PlayerScript("RewardExperienceScript", {
9496
bool OnPlayerUpdateFishingSkill(Player* player, int32 skill, int32 zone_skill, int32 /*chance*/, int32 /*roll*/) override
9597
{
9698
if (float xpFactor = peConfigData.GetConfigValue<float>(PEConfig::FISHING_EXPERIENCE))
97-
RewardXP(player, skill, zone_skill + 100, zone_skill + 50, zone_skill + 25, xpFactor);
99+
RewardXP(player, skill, zone_skill + 100, zone_skill + 50, zone_skill + 25, zone_skill, xpFactor);
98100

99101
return true;
100102
}
@@ -121,7 +123,7 @@ RewardExperienceScript() : PlayerScript("RewardExperienceScript", {
121123
}
122124

123125
if (float xpFactor = peConfigData.GetConfigValue<float>(experienceSetting))
124-
RewardXP(player, currentLevel, gray, green, yellow, xpFactor);
126+
RewardXP(player, currentLevel, gray, green, yellow, yellow -25, xpFactor);
125127
}
126128

127129
void OnPlayerUpdateCraftingSkill(Player *player, SkillLineAbilityEntry const* skill, uint32 currentLevel, uint32& /*gain*/) override
@@ -173,11 +175,12 @@ RewardExperienceScript() : PlayerScript("RewardExperienceScript", {
173175
uint32 gray = skill->TrivialSkillLineRankHigh;
174176
uint32 green = (skill->TrivialSkillLineRankHigh + skill->TrivialSkillLineRankLow) / 2;
175177
uint32 yellow = skill->TrivialSkillLineRankLow;
176-
RewardXP(player, currentLevel, gray, green, yellow, xpFactor);
178+
uint32 min = skill->MinSkillLineRank;
179+
RewardXP(player, currentLevel, gray, green, yellow, min, xpFactor);
177180
}
178181
}
179182

180-
void RewardXP(Player* player, uint32 currentLevel, uint32 gray, uint32 green, uint32 yellow, float xpFraction)
183+
void RewardXP(Player* player, uint32 currentLevel, uint32 gray, uint32 green, uint32 yellow, uint32 minSkill, float xpFraction)
181184
{
182185
uint32 xp = player->GetUInt32Value(PLAYER_NEXT_LEVEL_XP) * xpFraction;
183186
if (currentLevel >= gray)
@@ -189,19 +192,22 @@ RewardExperienceScript() : PlayerScript("RewardExperienceScript", {
189192
else
190193
xp = xp * peConfigData.GetConfigValue<float>(PEConfig::MULT_ORANGE);
191194

192-
if (gray > 375)
195+
if (minSkill > 375)
193196
xp = xp * peConfigData.GetConfigValue<float>(PEConfig::MULT_GRANDMASTER);
194-
else if (gray > 300)
197+
else if (minSkill > 300)
195198
xp = xp * peConfigData.GetConfigValue<float>(PEConfig::MULT_MASTER);
196-
else if (gray > 225)
199+
else if (minSkill > 225)
197200
xp = xp * peConfigData.GetConfigValue<float>(PEConfig::MULT_ARTISAN);
198-
else if (gray > 150)
201+
else if (minSkill > 150)
199202
xp = xp * peConfigData.GetConfigValue<float>(PEConfig::MULT_EXPERT);
200-
else if (gray > 75)
203+
else if (minSkill > 75)
201204
xp = xp * peConfigData.GetConfigValue<float>(PEConfig::MULT_JOURNEYMAN);
202205
else
203206
xp = xp * peConfigData.GetConfigValue<float>(PEConfig::MULT_APPRENTICE);
204207

208+
if (float curve = peConfigData.GetConfigValue<float>(PEConfig::MULT_CURVE))
209+
xp = xp * pow(curve,(minSkill/450));
210+
205211
player->GiveXP(xp, nullptr);
206212
}
207213
};

0 commit comments

Comments
 (0)