Fuck AI, trying it, myself
This commit is contained in:
parent
9b41773110
commit
c16d5ec8fc
@ -12,27 +12,27 @@ public:
|
|||||||
void OnDamage(Unit* attacker, Unit* victim, uint32& damage) override
|
void OnDamage(Unit* attacker, Unit* victim, uint32& damage) override
|
||||||
{
|
{
|
||||||
if (!sConfigMgr->GetOption<bool>("Leech.Enable", true) || !attacker)
|
if (!sConfigMgr->GetOption<bool>("Leech.Enable", true) || !attacker)
|
||||||
return;
|
|
||||||
|
|
||||||
bool isPet = attacker->GetOwner() && attacker->GetOwner()->GetTypeId() == TYPEID_PLAYER;
|
|
||||||
if (!isPet && attacker->GetTypeId() != TYPEID_PLAYER)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player *player = isPet ? attacker->GetOwner()->ToPlayer() : attacker->ToPlayer();
|
|
||||||
if (!player)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (sConfigMgr->GetOption<bool>("Leech.DungeonsOnly", true) && !player->GetMap()->IsDungeon())
|
|
||||||
return;
|
|
||||||
uint32 requiredItem = sConfigMgr->GetOption<uint32>("Leech.RequiredItemId", 0u);
|
|
||||||
if (requiredItem != 0)
|
|
||||||
{
|
{
|
||||||
if (!player->HasItemCount(requiredItem, 1, false))
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (damage == 0)
|
bool isPet = attacker->GetOwner() && attacker->GetOwner()->GetTypeId() == TYPEID_PLAYER;
|
||||||
|
if (!isPet && attacker->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
Player* player = isPet ? attacker->GetOwner()->ToPlayer() : attacker->ToPlayer();
|
||||||
|
|
||||||
|
if (sConfigMgr->GetOption<bool>("Leech.DungeonsOnly", true) && !(player->GetMap()->IsDungeon()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 requiredItem = sConfigMgr->GetOption<uint32>("Leech.RequiredItemId", 0u);
|
||||||
|
if (requiredItem != 0) && !(player->HasItemCount(requiredItem, 1, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto leechAmount = sConfigMgr->GetOption<float>("Leech.Amount", 0.05f);
|
auto leechAmount = sConfigMgr->GetOption<float>("Leech.Amount", 0.05f);
|
||||||
auto bp1 = static_cast<int32>(leechAmount * float(damage));
|
auto bp1 = static_cast<int32>(leechAmount * float(damage));
|
||||||
@ -40,6 +40,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Add all scripts in one
|
// Add all scripts in one
|
||||||
void AddSC_mod_leech()
|
void AddSC_mod_leech()
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user