Code:
#include "PvPMgr.h"
#define REWARD_GOLD 5
const int Rank1 = 0;
const int Rank2 = 5;
const int Rank3 = 50;
const int Rank4 = 100;
const int Rank5 = 500;
const int Rank6 = 1000;
const int Rank7 = 1500;
const int Rank8 = 4000;
const int Rank9 = 7000;
const int Rank10 = 10000;
const int Rank11 = 15000;
const int Rank12 = 22000;
const int Rank13 = 30000;
const int Rank14 = 39000;
const int Rank15 = 50000;
PvPStorage *Storage;
void OnKillPlayer(Player * attacker, Player * victim)
{
PvPMgr *aMgr = Storage->GetMgr(attacker->GetLowGUID(), true);
PvPMgr *vMgr = Storage->GetMgr(victim->GetLowGUID(), true);
if(aMgr == NULL || vMgr == NULL)
return;
if(aMgr->ChecksPassed(attacker, victim) == false)
{
vMgr->CurrentKills = 0;
vMgr->PlayersHealed = 0;
vMgr->TotalDeaths++;
return;
}
if ( attacker->GetTeam() == victim->GetTeam() )
return;
if( attacker->m_bg || (attacker->m_bg && attacker->m_bg->IsArena()) )
{
aMgr->CurrentKills++;
switch ( aMgr->CurrentKills )
{
case 5 :
{
attacker->CastSpell(attacker, 49411, true);
}
break;
case 10 :
{
char msg[100];
sprintf(msg, "|cffff0000 10 Kills - %s Killed %s For a 10 Kill Streak!|r", attacker->GetName(), victim->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 10 Kills - %s Killed %s For a 10 Kill Streak!|r", attacker->GetName(), victim->GetName());
sWorld.SendWorldText(msg);
attacker->CastSpell(attacker, 24378, true);
}
break;
case 20 :
{
char msg[100];
sprintf(msg, "|cffff0000 20 Kills - %s Killed %s For a 20 Kill Streak!|r", attacker->GetName(), victim->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 20 Kills - %s Killed %s For a 20 Kill Streak!|r", attacker->GetName(), victim->GetName());
sWorld.SendWorldText(msg);
attacker->CastSpell(attacker, 35076, true);
attacker->PlaySoundToSet(11466);
}
break;
case 30:
{
attacker->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11559);
char msg[100];
sprintf(msg, "|cffff0000 30 Kills - %s Is On a Rampage!|r", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 30 Kills - %s Is On a Rampage|r", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 40:
{
char msg[100];
sprintf(msg, "|cffff0000 40 Kills - %s Is Destroying The Opposition!|r", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 40 Kills - %s Is Destroying The Opposition!|r", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 50:
{
attacker->SetUInt32Value(UNIT_FIELD_DISPLAYID, 22642);
char msg[100];
sprintf(msg, "|cffff0000 50 Kills - %s Is Unbelievable!|r", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 50 Kills - %s Is Unbelievable!|r", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 60:
{
char msg[100];
sprintf(msg, "|cffff0000 60 Kills - %s Is Unstoppable!|r", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 60 Kills - %s Is Unstoppable!|r", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 70:
{
attacker->SetUInt32Value(UNIT_FIELD_DISPLAYID, 21262);
char msg[100];
sprintf(msg, "|cffff0000 70 Kills - OMG! Somebody Just Kill %s Already!", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 70 Kills - OMG! Somebody Just Kill %s Already!", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 80:
{
char msg[100];
sprintf(msg, "|cffff0000 80 Kills - %s Is Godlike!", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 80 Kills - %s Is Godlike!", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 90:
{
char msg[100];
sprintf(msg, "|cffff0000 90 Kills - %s Is Beyond Godlike", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 90 Kills - %s Is Beyond Godlike!", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 100:
{
attacker->SetUInt32Value(UNIT_FIELD_DISPLAYID, 28089);
char msg[100];
sprintf(msg, "|cffff0000 100 Kills - %s Is UNFREAKING Believable!", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 100 Kills - %s Is UNFREAKING Believable!", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
}
if ( !(attacker->GetGroup()) )
{
attacker->BroadcastMessage("Nice job! You received %u gold for slaying %s%s|r", REWARD_GOLD, MSG_COLOR_WHITE, victim->GetName());
vMgr->CurrentKills = 0;
vMgr->PlayersHealed = 0;
vMgr->TotalDeaths++;
victim->BroadcastMessage("Your kills have been reset since you died!");
attacker->BroadcastMessage("%sCurrent Kills: %u", MSG_COLOR_RED, aMgr->CurrentKills);
return;
}
std::vector<Player> GroupMembers;
std::set<Player> PotentialHealers;
attacker->GetGroup()->Lock();
for(uint8 i = 0; i < attacker->GetGroup()->GetSubGroupCount(); i++)
{
SubGroup * pSubGroup = attacker->GetGroup()->GetSubGroup(i);
if(!pSubGroup) continue;
GroupMembersSet::iterator itr = pSubGroup->GetGroupMembersBegin();
for(; itr != pSubGroup->GetGroupMembersEnd(); itr++)
{
PlayerInfo * pi = *itr;
if(!pi) continue;
Player * Plr = pi->m_loggedInPlayer;
if(!Plr)
continue;
// Ineligible due to distance.
if(Plr->GetDistance2dSq(attacker) > 80.0f && Plr != attacker)
continue;
GroupMembers.push_back(pi->m_loggedInPlayer);
}
}
for(std::set<Player*>::iterator itr2 = PotentialHealers.begin(); itr2 != PotentialHealers.end(); itr2++)
{
Player * pHealer = (*itr2);
if(!pHealer) continue;
/* for(std::vector<Player>::iterator itr3 = GroupMembers.begin(); itr3 != GroupMembers.end(); itr3++)
{
Player * pGroupMember = (*itr3);
if(pHealer->CombatStatus.DidHeal(pGroupMember->GetLowGUID()))
{
GroupMembers.push_back(pHealer);
break;
}
}
}
if(GroupMembers.size() > 0)
{*/
//uint32 reward = RandomUInt(GroupMembers.size() - 1);
/*[reward]*/
//GroupMembers
attacker->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (REWARD_GOLD * 10000));
//GroupMembers
attacker->BroadcastMessage("You've been awarded 1 gold for slaying %s%s.|r", victim->GetName(), MSG_COLOR_WHITE);
}
attacker->GetGroup()->Unlock();
attacker->BroadcastMessage("%sCurrent Kills: %u", MSG_COLOR_RED, aMgr->CurrentKills);
victim->BroadcastMessage("Your kills have been reset since you died!");
vMgr->CurrentKills = 0;
vMgr->PlayersHealed = 0;
vMgr->TotalDeaths++;
}
else
{
aMgr->CurrentKills++;
if ( aMgr->CurrentKills <= 4 )
{
if ( !(victim->GetUInt32Value(PLAYER_FIELD_COINAGE) >= 1) )
attacker->BroadcastMessage("%sSorry,|r %s%s|r doesn't have any gold for you to get!", MSG_COLOR_GOLD, victim->GetName(), MSG_COLOR_WHITE);
else
{
attacker->BroadcastMessage("Nice job! You received %u gold for slaying %s%s.|r", REWARD_GOLD, MSG_COLOR_GREEN, victim->GetName());
attacker->ModUnsigned32Value(PLAYER_FIELD_COINAGE, REWARD_GOLD * 50000);
victim->BroadcastMessage("%sYou have lost one gold for getting killed outside a BG!", MSG_COLOR_LIGHTRED);
victim->ModUnsigned32Value(PLAYER_FIELD_COINAGE, PLAYER_FIELD_COINAGE - (REWARD_GOLD * 50000));
}
aMgr->killingSpree = false;
aMgr->killingSpree2 = true;
}
else
aMgr->killingSpree = true;
if ( aMgr->killingSpree && aMgr->killingSpree2 )
{
if ( !(victim->GetUInt32Value(PLAYER_FIELD_COINAGE) >= (2 * 10000)) )
{
attacker->BroadcastMessage("You have started a killing spree! You will now receive double the gold."); // Still announce it
attacker->CastSpell(attacker, 40735, true);
attacker->BroadcastMessage("%sSorry,|r %s%s|r doesn't have any gold for you to get!", MSG_COLOR_GOLD, MSG_COLOR_WHITE, victim->GetName());
}
else
{
attacker->BroadcastMessage("You have started a killing spree! You will now receive double the gold.", REWARD_GOLD * 2);
attacker->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (REWARD_GOLD * 10000) * .25f * vMgr->CurrentKills * 2);
victim->BroadcastMessage("%sYou have lost one gold for getting killed outside a BG!", MSG_COLOR_LIGHTRED);
victim->ModUnsigned32Value(PLAYER_FIELD_COINAGE, PLAYER_FIELD_COINAGE - (REWARD_GOLD * 10000));
}
aMgr->killingSpree = false;
aMgr->killingSpree2 = false;
}
if ( aMgr->CurrentKills > 4 )
{
if ( !(victim->GetUInt32Value(PLAYER_FIELD_COINAGE) >= 1) )
attacker->BroadcastMessage("%sSorry,|r %s%s|r doesn't have any gold for you to get!", MSG_COLOR_GOLD, MSG_COLOR_WHITE, victim->GetName());
else
{
attacker->BroadcastMessage("Nice job! You received %u gold for slaying %s%s.|r", REWARD_GOLD * 2, MSG_COLOR_GREEN, victim->GetName());
attacker->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (REWARD_GOLD * 50000) * 2);
victim->BroadcastMessage("%sYou have lost one gold for getting killed outside a BG!", MSG_COLOR_LIGHTRED);
victim->ModUnsigned32Value(PLAYER_FIELD_COINAGE, PLAYER_FIELD_COINAGE - (REWARD_GOLD * 50000));
}
}
switch ( aMgr->CurrentKills )
{
case 10 :
{
char msg[100];
sprintf(msg, "|cffff0000 10 Kills - %s Killed %s For a 10 Kill Streak!|r", attacker->GetName(), victim->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 10 Kills - %s Killed %s For a 10 Kill Streak!|r", attacker->GetName(), victim->GetName());
sWorld.SendWorldText(msg);
attacker->CastSpell(attacker, 24378, true);
}
break;
case 20 :
{
char msg[100];
sprintf(msg, "|cffff0000 20 Kills - %s Killed %s For a 10 Kill Streak!|r", attacker->GetName(), victim->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 20 Kills - %s Killed %s For a 10 Kill Streak!|r", attacker->GetName(), victim->GetName());
sWorld.SendWorldText(msg);
attacker->CastSpell(attacker, 35076, true);
attacker->PlaySoundToSet(11466);
}
break;
case 30:
{
attacker->SetUInt32Value(UNIT_FIELD_DISPLAYID, 11559);
char msg[100];
sprintf(msg, "|cffff0000 30 Kills - %s Is On a Rampage!|r", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 30 Kills - %s Is On a Rampage!|r", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 40:
{
char msg[100];
sprintf(msg, "|cffff0000 40 Kills - %s Is Destroying The Opposition!|r", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 40 Kills - %s Is Destroying The Opposition!|r", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 50:
{
attacker->SetUInt32Value(UNIT_FIELD_DISPLAYID, 22642);
char msg[100];
sprintf(msg, "|cffff0000 50 Kills - %s Is Unbelievable!|r", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 50 Kills - %s Is Unbelievable!|r", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 60:
{
char msg[100];
sprintf(msg, "|cffff0000 60 Kills - %s Is Unstoppable!|r", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 60 Kills - %s Is Unstoppable!|r", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 70:
{
attacker->SetUInt32Value(UNIT_FIELD_DISPLAYID, 21262);
char msg[100];
sprintf(msg, "|cffff0000 70 Kills - OMG! Somebody Just Kill %s Already!", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 70 Kills - OMG! Somebody Just Kill %s Already!", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 80:
{
char msg[100];
sprintf(msg, "|cffff0000 80 Kills - %s Is Godlike!", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 80 Kills - %s Is Godlike!", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 90:
{
char msg[100];
sprintf(msg, "|cffff0000 90 Kills - %s Is Beyond Godlike", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 90 Kills - %s Is Beyond Godlike!", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
case 100:
{
attacker->SetUInt32Value(UNIT_FIELD_DISPLAYID, 28089);
char msg[100];
sprintf(msg, "|cffff0000 100 Kills - %s Is UNFREAKING Believable!", attacker->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 100 Kills - %s Is UNFREAKING Believable!", attacker->GetName());
sWorld.SendWorldText(msg);
}
break;
}
if ( vMgr->CurrentKills > 4 )
{
if ( !(victim->GetUInt32Value(PLAYER_FIELD_COINAGE) >= 1) )
{
attacker->BroadcastMessage("%sSorry,|r %s%s|r doesn't have any gold for you to get!", MSG_COLOR_GOLD, MSG_COLOR_WHITE, victim->GetName());
}
else
{
attacker->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (REWARD_GOLD * 10000) * .25f * vMgr->CurrentKills * 2);
attacker->BroadcastMessage("%sNice!! You received %u gold for ending %s%s|r killing spree!",MSG_COLOR_LIGHTBLUE, REWARD_GOLD * 2, MSG_COLOR_WHITE, victim->GetName());
victim->BroadcastMessage("%sYou have lost one gold for getting killed outside a BG!", MSG_COLOR_LIGHTRED);
victim->ModUnsigned32Value(PLAYER_FIELD_COINAGE, PLAYER_FIELD_COINAGE - (REWARD_GOLD * 10000));
}
}
else
victim->BroadcastMessage("Your kills have been reset since you died!");
vMgr->CurrentKills = 0;
vMgr->PlayersHealed = 0;
vMgr->TotalDeaths++;
attacker->BroadcastMessage("%sCurrent Kills: %u", MSG_COLOR_RED, aMgr->CurrentKills);
}
}
void OnHealPlayer(Player * pPlayer, SpellEntry * pSpell, Unit * pTarget);
{
if(!pTarget) return;
if(pSpell->c_is_flags & SPELL_FLAG_IS_HEALING)
{
if( !(pPlayer->m_bg) || !(pPlayer->m_bg && pPlayer->m_bg->IsArena()) )
return;
uint32 Chance = 3;
SpellCastTime *sd = dbcSpellCastTime.LookupEntry(pSpell->CastingTimeIndex);
if(sd && sd->CastTime == 0)
{
Chance = 2;
}
if(pPlayer == TO_PLAYER(pTarget) || pTarget->GetHealthPct() >= 95)
return;
if(Rand(Chance))
{
pPlayer->BroadcastMessage("Nice job! You received %u gold for healing %s%s.", REWARD_GOLD, MSG_COLOR_WHITE, TO_PLAYER(pTarget)->GetName());
pPlayer->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (REWARD_GOLD * 10000));
}
return;
}
}
bool OnDesertedBattleground(Player * pPlayer, SpellEntry * pSpell, Unit * pTarget)
{
if(pSpell->Id == 26013)
{
PvPMgr*mgr = Storage->GetMgr(pPlayer->GetLowGUID(),true);
mgr->CurrentKills = 0;
mgr->killingSpree = false;
mgr->killingSpree2 = false;
return false;
}
return true;
}
void ShowCredits(Player * pPlayer)
{
pPlayer->BroadcastMessage("%s[PvP] System Locked and Loaded", MSG_COLOR_RED);
}
void PvPTitles(Player * pPlayer, Player * pVictim);
{
int32 Honorablekills = pPlayer->m_killsLifetime;
if ( Honorablekills >= Rank1 && Honorablekills < Rank2 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 15 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 15 );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles > ( 1 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 1 );
}
}
else if ( Honorablekills >= Rank2 && Honorablekills < Rank3 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 16 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 16 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 15 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 2 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 2 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 1 ) );
}
}
else if ( Honorablekills >= Rank3 && Honorablekills < Rank4 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 17 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 17 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 16 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 3 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 3 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 2 ) );
}
}
else if ( Honorablekills >= Rank4 && Honorablekills < Rank5 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 18 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 18 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 17 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 4 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 4 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 3 ) );
}
}
else if ( Honorablekills >= Rank5 && Honorablekills < Rank6 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 19 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 19 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 18 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 5 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 5 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 4 ) );
}
}
else if ( Honorablekills >= Rank6 && Honorablekills < Rank7 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 20 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 20 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 19 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 6 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 6 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 5 ) );
}
}
else if ( Honorablekills >= Rank7 && Honorablekills < Rank8 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 21 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 21 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 20 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 7 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 7 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 6 ) );
}
}
else if ( Honorablekills >= Rank8 && Honorablekills < Rank9 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 22 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 22 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 21 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 8 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 8 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 7 ) );
}
}
else if ( Honorablekills >= Rank9 && Honorablekills < Rank10 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 23 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 23 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 22 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 9 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 9 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 8 ) );
}
}
else if ( Honorablekills >= Rank10 && Honorablekills < Rank11 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 24 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 24 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 23 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 10 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 10 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 9 ) );
}
}
else if ( Honorablekills >= Rank11 && Honorablekills < Rank12 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 25 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 25 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 24 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 11 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 11 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 10 ) );
}
}
else if ( Honorablekills >= Rank12 && Honorablekills < Rank13 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 26 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 26 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 25 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 12 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 12 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 11 ) );
}
}
else if ( Honorablekills >= Rank13 && Honorablekills < Rank14 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 27 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 27 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 26 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 13 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 13 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 12 ) );
}
}
else if ( Honorablekills >= Rank14 && Honorablekills < Rank15 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 28 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 28 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 27 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 14 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 14 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 13 ) );
}
}
else if ( Honorablekills >= Rank15 )
{
if ( pPlayer->GetTeam() )
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 95 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 95 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 28 ) );
}
else
{
pPlayer->SetKnownTitle( static_cast< RankTitles >( 94 ), true );
pPlayer->SetUInt32Value( PLAYER_CHOSEN_TITLE, 94 );
pPlayer->SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, pPlayer->GetUInt64Value(PLAYER__FIELD_KNOWN_TITLES) & ~uint64(1) << uint8( 14 ) );
}
}
if ( Honorablekills == Rank14 )
{
if ( pPlayer->GetTeam() )
{
char msg[100];
sprintf(msg, "|cffff0000 %s has achieved High Warlord|r", pPlayer->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 %s has achieved High Warlord|r", pPlayer->GetName());
sWorld.SendWorldText(msg);
}
else
{
char msg[100];
sprintf(msg, "|cffff0000 %s has achieved Grand Marshall|r", pPlayer->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 %s has achieved Grand Marshall|r", pPlayer->GetName());
sWorld.SendWorldText(msg);
}
}
else if ( Honorablekills == Rank15 )
{
if ( pPlayer->GetTeam() )
{
char msg[100];
sprintf(msg, "|cffff0000 Through persistence and dedication, %s is now %s Of the Horde|r", pPlayer->GetName(), pPlayer->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 Through persistence and dedication, %s is now %s Of the Horde|r", pPlayer->GetName(), pPlayer->GetName());
sWorld.SendWorldText(msg);
}
else
{
char msg[100];
sprintf(msg, "|cffff0000 Through persistence and dedication, %s is now %s Of the Alliance|r", pPlayer->GetName(), pPlayer->GetName());
sWorld.SendWorldWideScreenText(msg);
char msg2[100];
sprintf(msg2, "|cffff0000 Through persistence and dedication, %s is now %s Of the Alliance|r", pPlayer->GetName(), pPlayer->GetName());
sWorld.SendWorldText(msg);
}
}
}
void OnLogOut(Player * pPlayer);
{
PvPMgr*mgr = Storage->GetMgr(pPlayer->GetLowGUID(),true);
if (mgr == NULL)
return;
mgr->CurrentKills = 0;
mgr->killingSpree = false;
mgr->killingSpree2 = false;
mgr->TotalDeaths = 0;
}
void SetupPvPSystem(ScriptMgr *mgr)
{
Storage = PvPStorage::GetInstance();
mgr->register_hook(SERVER_HOOK_EVENT_ON_KILL_PLAYER, (void*)OnKillPlayer);
mgr->register_hook(SERVER_HOOK_EVENT_ON_POST_SPELL_CAST, (void*)OnHealPlayer);
mgr->register_hook(SERVER_HOOK_EVENT_ON_POST_SPELL_CAST, (bool*)OnDesertedBattleground);
mgr->register_hook(SERVER_HOOK_EVENT_ON_FIRST_ENTER_WORLD, (void*)ShowCredits);
mgr->register_hook(SERVER_HOOK_EVENT_ON_HONORABLE_KILL, (void*)PvPTitles);
mgr->register_hook(SERVER_HOOK_EVENT_ON_LOGOUT, (void*)OnLogOut);
}
PvPMgr.cpp