这个是一个脚本代码。需要加到你的脚本代码库中
通常获得升级经验只能在杀怪的时候,这里增加一个脚本,那么你在PVP后也可以获得升级经验
#include "StdAfx.h"#include "Setup.h"
void KillPlayer(Player *pPlayer, Player *pVictim)
{
uint32 plr_level = pPlayer->getLevel();
uint32 vic_level = pVictim->getLevel();
if( vic_level <= ( plr_level - 10 ) || vic_level >= ( 10 + plr_level) )
return;
CalculateXP(pPlayer);
}
void CalculateXP( Player * pPlayer )
{
uint32 plr_level = pPlayer->getLevel();
uint32 xp1;
if( plr_level <= 10 )
{
xp1 = 200;
}else if( plr_level <= 20 )
{
xp1 = 500;
}else if( plr_level <= 30 )
{
xp1 = 1000;
}else if( plr_level <= 40 )
{
xp1 = 1500;
}else if( plr_level <= 50 )
{
xp1 = 2000;
}else if( plr_level <= 60 )
{
xp1 = 2500;
}else if( plr_level <= 69 )
{
xp1 = 3000;
}
pPlayer->GiveXP(xp1,0,false);
}
void SetupPlayerXP(ScriptMgr * mgr)
{
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, &KillPlayer);
---------------------------------------------------------------------------
(Some other dude helped us to make it into this: but it still didn′t work)
#include "ScriptPCH.h"
#define BASIC_XP 200
class GiveXP_OnKill : public PlayerScript
{
public:
GiveXP_OnKill() : PlayerScript ("XP_OnKill") {}
void OnPVPKill(Player * Killer, Player * Victim)
{
uint32 K_Level = Killer->getLevel();
uint32 V_Level = Killer->getLevel();
uint32 XP = 0;
if(Killer->GetGUID() == Victim->GetGUID())
return;
if( V_Level <= ( K_Level - 10 ) || V_Level >= ( 10 + K_Level) )
return;
if(K_Level <= 10)
XP = BASIC_XP;
else if(K_Level <= 20 )
XP = BASIC_XP*2.5;
else if(K_Level <= 30)
XP = BASIC_XP*5;
else if (K_Level <= 40)
XP = BASIC_XP*7.5;
else if ( K_Level <= 50)
XP = BASIC_XP*10;
else if (K_Level <=60 )
XP = BASIC_XP*12.5;
else if (K_Level <= 69)
XP = BASIC_XP*15;
Killer->GiveXP(XP, Killer);
}
};
void AddSC_XP_Onkill()
{
new GiveXP_OnKill();
}[/spoiler]
回复下载获得完整代码
|