rendered paste body void OnKillPlayer(Player * pPlayer, Player * pVictim)
{
if( static_cast<Player*>(pVictim)->GetName() != static_cast<Player*>(plr)->GetName() ) // To fix the damn emo warlock money exploit (can't kill self)
{
// Killing Spree stuff
uint32 my_killingspree = static_cast<Player*>(plr)->m_KillingSpree + 1;
uint32 vict_killingspree = static_cast<Player*>(pVictim)->m_KillingSpree;
uint32 vict_deathspree = static_cast<Player*>(pVictim)->m_DeathSpree + 1;
static_cast<Player*>(plr)->m_KillingSpree ++;
static_cast<Player*>(plr)->m_DeathSpree = 0;
static_cast<Player*>(pVictim)->m_DeathSpree ++;
static_cast<Player*>(pVictim)->m_KillingSpree = 0;
// Add/Reduce Money
if( pVictim->GetUInt32Value( PLAYER_FIELD_COINAGE ) > 5000 )
pVictim->ModUInt32Value( PLAYER_FIELD_COINAGE , -5000 ); // Remove 50 silver from victim
else
pVictim->SetUInt32Value( PLAYER_FIELD_COINAGE , 0 ); // Reset to 0 if < 5000 to avoid negative numbers
plr->ModUInt32Value( PLAYER_FIELD_COINAGE , 10000 ); // Add 1 gold to killer ;o
// :O killing spree
char buffer[255] = {}; // For messages.
if( my_killingspree > 3 )
{
for( uint32 k = 3 ; k <= my_killingspree ; k ++ )
plr->ModUInt32Value( PLAYER_FIELD_COINAGE , k * 1000 );
sprintf( buffer , "Recieved %u bonus gold for your killing spree! (%u kills without dying!)" , my_killingspree , my_killingspree );
static_cast<Player*>(plr)->BroadcastMessage( buffer );
// You've done something special if you have a 10+ killing spree!
// Set a global broadcast
if( my_killingspree >= 10 )
{
// What message do we send to all players?
switch( my_killingspree )
{
case 10:
sprintf( buffer , "%s is unstoppable with 10 kills in a row!" , static_cast<Player*>(plr)->GetName() );
break;
case 15:
sprintf( buffer , "Can anyone defeat %s? 15 kills!" , static_cast<Player*>(plr)->GetName() );
break;
// I don't think anyone will get past this point LOL
case 20:
sprintf( buffer , "M-m-m-monster kill! %s has just achieved 20 kills in a row!" , static_cast<Player*>(plr)->GetName() );
break;
case 22:
sprintf( buffer , "Everyone gang up on %s! 22 kills..." , static_cast<Player*>(plr)->GetName() );
break;
case 24:
sprintf( buffer , "Maybe %s is a hacker, because they've just hit 24 straight kills!" , static_cast<Player*>(plr)->GetName() );
break;
case 26:
sprintf( buffer , ".kick %s Abusing bugs to get 26 kills in a row!" , static_cast<Player*>(plr)->GetName() );
break;
case 28:
sprintf( buffer , ".banchar %s KILLING SPREE: 28!!!" , static_cast<Player*>(plr)->GetName() );
break;
case 30:
sprintf( buffer , "All hail the great %s for achieving 30 kills without dying. Screenshot this?" , static_cast<Player*>(plr)->GetName() );
break;
default:
if( my_killingspree >= 35 )
sprintf( buffer , "%s is at it again: %u straight kills!" , static_cast<Player*>(plr)->GetName() , my_killingspree );
}
sWorld.SendWorldText( buffer , NULL ); // Send it to all players
}
}
// Killing spree ended LOL
if( vict_killingspree > 3 )
{
sprintf( buffer , "%s's killing spree of %u was ended by %s!" , static_cast<Player*>(pVictim)->GetName() , vict_killingspree , static_cast<Player*>(plr)->GetName() );
sWorld.SendWorldText( buffer , NULL );
}
// Output Messages
sprintf( buffer , "You have gained 1 Gold for killing %s!" , static_cast<Player*>(pVictim)->GetName() );
static_cast<Player*>(plr)->BroadcastMessage( buffer );
sprintf( buffer , "You have lost 50 Silver for being killed by %s!" , static_cast<Player*>(plr)->GetName() );
static_cast<Player*>(pVictim)->BroadcastMessage( buffer );
// Send to all players of the same faction
objmgr._playerslock.AcquireReadLock();
HM_NAMESPACE::hash_map<uint32, Player*>::const_iterator itr;
Player * thisPlr;
for (itr = objmgr._players.begin(); itr != objmgr._players.end(); itr++)
{
thisPlr = itr->second;
if(itr->second->GetSession() && itr->second->IsInWorld())
{
if( thisPlr->GetTeam() == static_cast<Player*>(plr)->GetTeam() && thisPlr->GetGUID() != static_cast<Player*>(plr)->GetGUID() ) //same team, not self
{
// Same Faction
sprintf( buffer , "%s has killed %s." , static_cast<Player*>(plr)->GetName() , static_cast<Player*>(pVictim)->GetName() );
thisPlr->BroadcastMessage( buffer );
}
}
}
objmgr._playerslock.ReleaseReadLock();
}
}