Xp en pvp
Bonjour a tous , je vous présente un .diff faisant en sorte que vos joueurs gagnent de l'xp a chaque kill

[code=cpp]src/server/game/Entities/Player/Player.cpp | 47 ++++++++++++++++------------
1 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index a9639d3..fb27614 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -2670,7 +2670,7 @@ void Player::GiveXP(uint32 xp, Unit *victim, float group_rate)
if (!isAlive())
return;

- if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN))
+ if (HasFlag(PLAYER_FLAGS , PLAYER_FLAGS_NO_XP_GAIN))
return;

if (victim && victim->GetTypeId() == TYPEID_UNIT && !victim->ToCreature()->hasLootRecipient())
@@ -21940,7 +21940,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
{
// PvP kills doesn't yield experience
// also no XP gained if there is no member below gray level
- xp = (PvP || !not_gray_member_with_max_level || GetVehicle()) ? 0 : Trinity::XP::Gain(not_gray_member_with_max_level, pVictim);
+ xp = (!not_gray_member_with_max_level || GetVehicle()) ? 0 : Trinity::XP::Gain(not_gray_member_with_max_level, pVictim);

/// skip in check PvP case (for speed, not used)
bool is_raid = PvP ? false : sMapStore.LookupEntry(GetMapId())->IsRaid() && pGroup->isRaidGroup();
@@ -21956,18 +21956,12 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
if (!pGroupGuy->IsAtGroupRewardDistance(pVictim))
continue; // member (alive or dead) or his corpse at req. distance

- // honor can be in PvP and !PvP (racial leader) cases (for alive)
- if (pGroupGuy->isAlive() && pGroupGuy->RewardHonor(pVictim, count, -1, true) && pGroupGuy == this)
+ // honor and xp can be in PvP and !PvP (racial leader) cases (for alive)
+ if (pGroupGuy->isAlive() && pGroupGuy == this)
+ {
honored_kill = true;

- // xp and reputation only in !PvP case
- if (!PvP)
- {
- float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level;
-
- // if is in dungeon then all receive full reputation at kill
- // rewarded any alive/dead/near_corpse group member
- pGroupGuy->RewardReputation(pVictim,is_dungeon ? 1.0f : rate);
+ float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level;

// XP updated only for alive group member
if (pGroupGuy->isAlive() && not_gray_member_with_max_level &&
@@ -21983,7 +21977,19 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
pGroupGuy->GiveXP(itr_xp, pVictim, group_rate);
if (Pet* pet = pGroupGuy->GetPet())
pet->GivePetXP(itr_xp / 2);
+
}
+ }
+ // xp and reputation only in !PvP case
+ if (!PvP)
+ {
+ float rate = group_rate * float(pGroupGuy->getLevel()) / sum_level;
+
+ // if is in dungeon then all receive full reputation at kill
+ // rewarded any alive/dead/near_corpse group member
+ pGroupGuy->RewardReputation(pVictim,is_dungeon ? 1.0f : rate);
+
+

// quest objectives updated only for alive group member or dead but with not released body
if (pGroupGuy->isAlive()|| !pGroupGuy->GetCorpse())
@@ -21998,13 +22004,18 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
}
else // if (!pGroup)
{
- xp = (PvP || GetVehicle()) ? 0 : Trinity::XP::Gain(this, pVictim);
+ xp = (GetVehicle()) ? 0 : Trinity::XP::Gain(this, pVictim);

- // honor can be in PvP and !PvP (racial leader) cases
+ // honor and pvp can be in PvP and !PvP (racial leader) cases
if (RewardHonor(pVictim, 1, -1, true))
+ {
honored_kill = true;
+ GiveXP(xp, pVictim);
+ if (Pet* pet = GetPet())
+ pet->GivePetXP(xp);
+ }

- // xp and reputation only in !PvP case
+ //reputation only in !PvP case
if (!PvP)
{
RewardReputation(pVictim,1);
@@ -22014,17 +22025,13 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
AddPctN(xp, (*i)->GetAmount());

- GiveXP(xp, pVictim);
-
- if (Pet* pet = GetPet())
- pet->GivePetXP(xp);

// normal creature (not pet/etc) can be only in !PvP case
if (pVictim->GetTypeId() == TYPEID_UNIT)
KilledMonster(pVictim->ToCreature()->GetCreatureInfo(), pVictim->GetGUID());
}
}
- return xp || honored_kill;
+ return xp && honored_kill;
}

void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource)
[/code]

Un petit +1 fait toujours plaisir Clin
Génial.
A quand pur MaNGOS ?!!! Triste
http://www.zone-emu.fr/thread-12095.html

Voilà Clin

Retourner en haut Accueil