actualy what i need is a script wich give gold to healars/helpers after someone killed an player in BG all will be rewarded with gold even healars and the others who attacked the victim .. i tried to convert this mangoos script to work for trinity but i get toons of errors and actually this is what i need
Code:
void Player::HandlePvPKill()
{
if (!IsInWorld())
return;
const uint32 RewardGold = sWorld.getConfig(CONFIG_UINT32_PVPGOLD_BASE);
const uint32 MaxReward = sWorld.getConfig(CONFIG_UINT32_MAX_PVPGOLD) * RewardGold;
uint32 InCombatPlayers = 0;
Player* MaxD = 0;
uint32 MaxDmg = 0;
Team HellFireOwner = sWorld.GetHellFireOwner();
float TotalHealth = 0;
DHMap::const_iterator aitr;
DHMap::const_iterator dbitr = m_Damagers.begin();
DHMap::const_iterator deitr = m_Damagers.end();
for (aitr = dbitr; aitr != deitr; ++aitr)
TotalHealth += aitr->second; // Sums up the total damage made to the victim.
for (aitr = dbitr; aitr != deitr; ++aitr)
{
++InCombatPlayers;
Player* pAttacker = sObjectMgr.GetPlayer(aitr->first);
float Damage = aitr->second;
if (!pAttacker || !pAttacker->IsInWorld() || pAttacker == this)
continue;
if (Damage > MaxDmg)
{
MaxD = pAttacker;
MaxDmg = Damage;
}
if (!pAttacker->IsPvPFarm(this))
{
uint32 Reward = RewardGold * (Damage / TotalHealth)*((pAttacker->GetKillStreak() / 10) + 1.0f);
if (GetTeam() != pAttacker->GetTeam() && pAttacker->GetTeam() == HellFireOwner)
Reward *= 2;
if (Reward > MaxReward)
Reward = MaxReward;
uint32 NewMoney = pAttacker->GetMoney() + (Reward * pAttacker->GetBoosterMod(DONATION_BOOST_GOLD));
if (NewMoney < MAX_MONEY_AMOUNT)
pAttacker->SetMoney(NewMoney);
pAttacker->IncreaseKillStreak();
pAttacker->SendChatMessage("%s[PvP System]%s You got awarded %.2f gold for damaging %s", MSG_COLOR_MAGENTA, MSG_COLOR_WHITE, Reward/10000.f, GetNameLink().c_str());
float TotalHealing = 0;
DHMap::const_iterator hitr;
DHMap::const_iterator hbitr = pAttacker->m_Healers.begin();
DHMap::const_iterator heitr = pAttacker->m_Healers.begin();
for (hitr = hbitr; hitr != heitr; ++hitr)
TotalHealing += hitr->second; // Sums up the total healing made to the attacker.
for (hitr = hbitr; hitr != heitr; ++hitr)
{
++InCombatPlayers;
Player* pHealer = sObjectMgr.GetPlayer(hitr->first);
float Healing = hitr->second;
float MaxHealth = pAttacker->GetMaxHealth();
if (!pHealer || !pHealer->IsInWorld())
continue;
float maxhealingPct = (Healing / MaxHealth);
if (maxhealingPct > 1)
maxhealingPct = 1.0f;
Reward *= (Healing / TotalHealing)*((pHealer->GetKillStreak() / 10) + 1.0f) * maxhealingPct;
if (Reward > MaxReward)
Reward = MaxReward;
uint32 NewMoney = pHealer->GetMoney() + (Reward * pHealer->GetBoosterMod(DONATION_BOOST_GOLD));
if (NewMoney < MAX_MONEY_AMOUNT)
pHealer->SetMoney(NewMoney);
pHealer->IncreaseKillStreak();
pHealer->SendChatMessage("%s[PvP System]%s You got awarded %.2f gold for healing %s who damaged %s", MSG_COLOR_MAGENTA, MSG_COLOR_WHITE, Reward/10000.f, pAttacker->GetNameLink().c_str(), GetNameLink().c_str());
}
}
else
pAttacker->SendChatMessage("%s[Anti-farming System]%s You triggered the anti-farming system.", MSG_COLOR_MAGENTA, MSG_COLOR_WHITE);
}
if (MaxD && !MaxD->IsPvPFarm(this, false))
{
MaxD->SendChatMessage("%s[PvP System]%s You did most damage to %s%s (%u)", MSG_COLOR_MAGENTA,MSG_COLOR_WHITE, GetNameLink().c_str(), MSG_COLOR_WHITE, MaxDmg);
SendChatMessage("%s[PvP System]%s Your main attacker was %s%s who did %u damage to you.", MSG_COLOR_MAGENTA, MSG_COLOR_WHITE, MaxD->GetNameLink().c_str(), MSG_COLOR_WHITE, MaxDmg);
}
ClearKillStreak();
ClearDamageHeal();
if (InCombatPlayers > 1)
SendChatMessage("%s[PvP System]%s There were %u players involved in the combat to your death.", MSG_COLOR_MAGENTA, MSG_COLOR_WHITE, InCombatPlayers);
}
please if anny of you can converti it to work for trinity or give me a solution i need it fast
Thx Darksoke !..