summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee <littlelee_1991@live.co.uk>2017-03-20 07:52:12 +0000
committerGitHub <noreply@github.com>2017-03-20 07:52:12 +0000
commit0a7416d86af8492c574a285366a4a244a1fd898c (patch)
tree1191c189880dfe03516502c43a1d4e373ea9e7d2
parenta67ceca682a813303de21d8f5a362134004315b6 (diff)
parent4a88315b07477d7cddfe1580c7d1aad8f14ee6b0 (diff)
Merge pull request #434 from Viste/pvptoken
Fix config option PVP_TOKEN_ENABLE close issue #183
-rw-r--r--src/game/Entities/Player/Player.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/game/Entities/Player/Player.cpp b/src/game/Entities/Player/Player.cpp
index 8d05886047..702ff7834a 100644
--- a/src/game/Entities/Player/Player.cpp
+++ b/src/game/Entities/Player/Player.cpp
@@ -7308,6 +7308,28 @@ bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool awar
GiveXP(uint32(honor*(3+getLevel()*0.30f)), NULL);
}
+ if (sWorld->getBoolConfig(CONFIG_PVP_TOKEN_ENABLE))
+ {
+ if (!uVictim || uVictim == this || uVictim->HasAuraType(SPELL_AURA_NO_PVP_CREDIT))
+ return true;
+
+ if (uVictim->GetTypeId() == TYPEID_PLAYER)
+ {
+ // Check if allowed to receive it in current map
+ uint8 MapType = sWorld->getIntConfig(CONFIG_PVP_TOKEN_MAP_TYPE);
+ if ((MapType == 1 && !InBattleground() && !IsFFAPvP())
+ || (MapType == 2 && !IsFFAPvP())
+ || (MapType == 3 && !InBattleground()))
+ return true;
+
+ uint32 itemID = sWorld->getIntConfig(CONFIG_PVP_TOKEN_ID);
+ int32 count = sWorld->getIntConfig(CONFIG_PVP_TOKEN_COUNT);
+
+ if (AddItem(itemID, count))
+ ChatHandler(GetSession()).PSendSysMessage("You have been awarded a token for slaying another player.");
+ }
+ }
+
return true;
}