Wise
14-08-18, 08:09 AM
I want to share this simple and dirty coded script that made for AshamaneCore. It's using the included "personalxprate" code in AshamaneCore, so it's not working with other cores like TrinityCore.
This script requested by LeRutY from my Discord server.
You can setup the personal XP rate for different level ranges.
spp_dynamic_xp_rate.cpp
/*Single Player Project
*/
#include "Config.h"
#include "ScriptMgr.h"
class spp_dynamic_xp_rate : public PlayerScript
{
public:
spp_dynamic_xp_rate() : PlayerScript("spp_dynamic_xp_rate") { };
void OnLogin(Player* player, bool /*firstLogin*/)
{
if (sConfigMgr->GetBoolDefault("Dynamic.XP.Rate", true))
{
if (player->getLevel() >= 1)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.1-9", 1));
if (player->getLevel() >= 10)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.10-19", 2));
if (player->getLevel() >= 20)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.20-29", 3));
if (player->getLevel() >= 30)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.30-39", 4));
if (player->getLevel() >= 40)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.40-49", 5));
if (player->getLevel() >= 50)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.50-59", 6));
if (player->getLevel() >= 60)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.60-69", 7));
if (player->getLevel() >= 70)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.70-79", 8));
if (player->getLevel() >= 80)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.80-89", 9));
if (player->getLevel() >= 90)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.90-99", 10));
if (player->getLevel() >= 100)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.100-109", 11));
if (player->getLevel() >= 110)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.110", 1));
}
}
void OnLevelChanged(Player * player, uint8 oldLevel)
{
if (sConfigMgr->GetBoolDefault("Dynamic.XP.Rate", true))
{
if (player->getLevel() >= 1)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.1-9", 1));
if (player->getLevel() >= 10)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.10-19", 2));
if (player->getLevel() >= 20)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.20-29", 3));
if (player->getLevel() >= 30)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.30-39", 4));
if (player->getLevel() >= 40)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.40-49", 5));
if (player->getLevel() >= 50)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.50-59", 6));
if (player->getLevel() >= 60)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.60-69", 7));
if (player->getLevel() >= 70)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.70-79", 8));
if (player->getLevel() >= 80)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.80-89", 9));
if (player->getLevel() >= 90)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.90-99", 10));
if (player->getLevel() >= 100)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.100-109", 11));
if (player->getLevel() >= 110)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.110", 1));
}
}
};
void AddSC_dynamic_xp_rate()
{
new spp_dynamic_xp_rate(); }
add this to
worldserver.conf
################################################## ################################################## Dynamic XP Rate #
###################
#
# Dynamic.XP.Rate
# Description: You can setup the personal XP rate for different level ranges.
#
# Dynamic.XP.Rate: 1 (Enable)
# 0 (Disable)
#
# Dynamic.XP.Rate.X-X: 1+ (Set a custom XP rate on that level range)
# 0 (Reset custom XP rate to default on that level range)
#
Dynamic.XP.Rate = 0
Dynamic.XP.Rate.1-9 = 1
Dynamic.XP.Rate.10-19 = 2
Dynamic.XP.Rate.20-29 = 3
Dynamic.XP.Rate.30-39 = 4
Dynamic.XP.Rate.40-49 = 5
Dynamic.XP.Rate.50-59 = 6
Dynamic.XP.Rate.60-69 = 7
Dynamic.XP.Rate.70-79 = 8
Dynamic.XP.Rate.80-89 = 9
Dynamic.XP.Rate.90-99 = 10
Dynamic.XP.Rate.100-109 = 11
Dynamic.XP.Rate.110 = 1
# ################################################## #################################################
This script requested by LeRutY from my Discord server.
You can setup the personal XP rate for different level ranges.
spp_dynamic_xp_rate.cpp
/*Single Player Project
*/
#include "Config.h"
#include "ScriptMgr.h"
class spp_dynamic_xp_rate : public PlayerScript
{
public:
spp_dynamic_xp_rate() : PlayerScript("spp_dynamic_xp_rate") { };
void OnLogin(Player* player, bool /*firstLogin*/)
{
if (sConfigMgr->GetBoolDefault("Dynamic.XP.Rate", true))
{
if (player->getLevel() >= 1)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.1-9", 1));
if (player->getLevel() >= 10)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.10-19", 2));
if (player->getLevel() >= 20)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.20-29", 3));
if (player->getLevel() >= 30)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.30-39", 4));
if (player->getLevel() >= 40)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.40-49", 5));
if (player->getLevel() >= 50)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.50-59", 6));
if (player->getLevel() >= 60)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.60-69", 7));
if (player->getLevel() >= 70)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.70-79", 8));
if (player->getLevel() >= 80)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.80-89", 9));
if (player->getLevel() >= 90)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.90-99", 10));
if (player->getLevel() >= 100)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.100-109", 11));
if (player->getLevel() >= 110)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.110", 1));
}
}
void OnLevelChanged(Player * player, uint8 oldLevel)
{
if (sConfigMgr->GetBoolDefault("Dynamic.XP.Rate", true))
{
if (player->getLevel() >= 1)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.1-9", 1));
if (player->getLevel() >= 10)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.10-19", 2));
if (player->getLevel() >= 20)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.20-29", 3));
if (player->getLevel() >= 30)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.30-39", 4));
if (player->getLevel() >= 40)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.40-49", 5));
if (player->getLevel() >= 50)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.50-59", 6));
if (player->getLevel() >= 60)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.60-69", 7));
if (player->getLevel() >= 70)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.70-79", 8));
if (player->getLevel() >= 80)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.80-89", 9));
if (player->getLevel() >= 90)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.90-99", 10));
if (player->getLevel() >= 100)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.100-109", 11));
if (player->getLevel() >= 110)
player->SetPersonnalXpRate(sConfigMgr->GetIntDefault("Dynamic.XP.Rate.110", 1));
}
}
};
void AddSC_dynamic_xp_rate()
{
new spp_dynamic_xp_rate(); }
add this to
worldserver.conf
################################################## ################################################## Dynamic XP Rate #
###################
#
# Dynamic.XP.Rate
# Description: You can setup the personal XP rate for different level ranges.
#
# Dynamic.XP.Rate: 1 (Enable)
# 0 (Disable)
#
# Dynamic.XP.Rate.X-X: 1+ (Set a custom XP rate on that level range)
# 0 (Reset custom XP rate to default on that level range)
#
Dynamic.XP.Rate = 0
Dynamic.XP.Rate.1-9 = 1
Dynamic.XP.Rate.10-19 = 2
Dynamic.XP.Rate.20-29 = 3
Dynamic.XP.Rate.30-39 = 4
Dynamic.XP.Rate.40-49 = 5
Dynamic.XP.Rate.50-59 = 6
Dynamic.XP.Rate.60-69 = 7
Dynamic.XP.Rate.70-79 = 8
Dynamic.XP.Rate.80-89 = 9
Dynamic.XP.Rate.90-99 = 10
Dynamic.XP.Rate.100-109 = 11
Dynamic.XP.Rate.110 = 1
# ################################################## #################################################