Improve XP rate config (#1035)

This commit is contained in:
Yunfan Li
2025-02-28 08:05:08 +08:00
committed by GitHub
parent 67d805f700
commit a3e305fbed
5 changed files with 39 additions and 24 deletions

View File

@@ -18,21 +18,21 @@ bool XpGainAction::Execute(Event event)
WorldPacket p(event.getPacket()); // (8+4+1+4+8)
ObjectGuid guid;
uint32 xpgain;
uint8 type = 0; // 00-kill_xp type, 01-non_kill_xp type
uint32 givenXp = 0;
float groupBonus = 0;
// uint32 xpgain;
// uint8 type = 0; // 00-kill_xp type, 01-non_kill_xp type
// uint32 givenXp = 0;
// float groupBonus = 0;
p.rpos(0);
p >> guid; // 8 victim
p >> xpgain; // 1 given experience
p >> type; // 1 00-kill_xp type, 01-non_kill_xp type
// p >> xpgain; // 1 given experience
// p >> type; // 1 00-kill_xp type, 01-non_kill_xp type
if (!type)
{
p >> givenXp; // 4 experience without rested bonus
p >> groupBonus; // 8 group bonus
}
// if (!type)
// {
// p >> givenXp; // 4 experience without rested bonus
// p >> groupBonus; // 8 group bonus
// }
Creature* creature = botAI->GetCreature(guid);
if (creature && !creature->GetMap()->IsDungeon())
@@ -40,15 +40,16 @@ bool XpGainAction::Execute(Event event)
BroadcastHelper::BroadcastKill(botAI, bot, creature);
}
if (!sRandomPlayerbotMgr->IsRandomBot(bot) || sPlayerbotAIConfig->playerbotsXPrate == 1)
return true;
// playerbotsXPrate is now implemented in OnPlayerGiveXP script
// if (!sRandomPlayerbotMgr->IsRandomBot(bot) || sPlayerbotAIConfig->playerbotsXPrate == 1)
// return true;
Unit* victim = nullptr;
if (guid)
victim = botAI->GetUnit(guid);
// Unit* victim = nullptr;
// if (guid)
// victim = botAI->GetUnit(guid);
xpgain = xpgain * (sPlayerbotAIConfig->playerbotsXPrate - 1);
GiveXP(xpgain, victim);
// xpgain = xpgain * (sPlayerbotAIConfig->playerbotsXPrate - 1);
// GiveXP(xpgain, victim);
return true;
}