Jump to content

Loot recipient set between creatures


Guest BThallid

Recommended Posts

•What bug does the patch fix? What features does the patch add?

This patch is for ticket #12 on lighthouse. I've noticed on my server that there had been players exploiting the attacks between creatures. This is my attempt to fix it and had noticed there was a ticket for it on Lighthouse. It rearranges some of the code in the deal damage method and uses a damage total list to keep track of who took off the most damage so that the loot recipient is only set and xp rewarded if the player did enough damage. There is a more complete description of the patch on Lighthouse as well as the diff file for the patch.

•For which repository revision was the patch created?

9278

•Is there a thread in the bug report section or at lighthouse? If yes, please add a link to the thread.

Ticket 12 on Lighthouse

•Who has been writing this patch? Please include either forum user names or email addresses.

BThallid and whoever wrote the original ThreatManager code that I've adapted

I submitted this here to the forum to possibly get more criticism brought to it. I mostly used existing code from the threatmanager, so I believe it should be pretty clean. However, it being my first work in C++, I would like to get more comments.

Link to comment
Share on other sites

I just realized that I probably should have posted this in the core forum according to the description for it. I didn't not mean post patch to incorrect forum first. If the patches that are only up for review are supposed to be posted here, please forgive my mispost and move if possible/necessary.

Link to comment
Share on other sites

IFAIK loot recipient is set by first damage, the same with XP. When npc pull another creature and player assist him in killing victim && npc is not pet nor charmed unit all credits are going to npc. Thats hows working for example siege events. Netherstorm: nether beasts with ~1.5k HP and 70lvl are giving full xp because right after respawn they are marked and attacked by Archers that makes them giving no XP to players that try to grind on them. The same for infernals around horde camp in Shadowmoon Valley.

If you now any place on offi when such a event is happening on around 30lvl I can checkout how it works :D

Link to comment
Share on other sites

The area on my server that abusing players were using to grind on was south of Vengeance Landing (Bleeding Vale) where lvl 69 NPCs of both side were at using UDB 386. The Horde players that were lvl 35 or so would attempt to land one hit on the opposing NPC and they would get the xp and loot from the enemy NPC after it was killed by the friendly NPC if they landed one hit.

It would be nice to know how offi responds to loot and xp when

A. One npc kills another npc without the player hitting. Is the NPC lootable?

B. One npc kills another npc with the player hitting. Is the NPC lootable and did the player get XP?

Link to comment
Share on other sites

It would be nice to know how offi responds to loot and xp when

A. One npc kills another npc without the player hitting. Is the NPC lootable?

B. One npc kills another npc with the player hitting. Is the NPC lootable and did the player get XP?

Depends on pvp flags (and maybe faction?) npc. Some can be looted (and give xp), others can not.

Link to comment
Share on other sites

Depends on pvp flags (and maybe faction?) npc. Some can be looted (and give xp), others can not.

On offi. in a non pvp realm where the NPCs are not PvP, would a player (non-PvP), where the NPC is well above the player's level by at least 15, receive the XP and/or loot from the enemy NPC after it was killed by the friendly NPC in situations A and B described previously?

How does the PvP flag change the outcome in those two cases?

I realize it may not be necessary to confirm how it is working on offi. if we are not wanting the exact results as offi. I am mainly just concerned as to how players can exploit the current existing functionality of the loot and XP to boost their levels faster and get a huge amount of loot from creatures well above them while other players are doing quests and various things to get their money and XP. This was my attempt to prevent that from happening, but still unaffect the non exploiting players.

On a side note (using this patch):

If the players were to actually take down a high level creature by damaging over half the NPC's max health, the player that dealt the most damage would actually still be able to receive the loot and xp (which was tested by using the .die command from a lower level GM to a much higher level NPC).

Again, any pointers to improve the code are appreciated.

Link to comment
Share on other sites

I had a glimpse on your patch and might have found a flaw:

+        // AddDamage total dealt from players to creatures
+        if (pVictim->GetTypeId() == TYPEID_UNIT && !((Creature*)pVictim)->isPet() && !((Creature*)pVictim)->hasLootRecipient() && this->GetTypeId() == TYPEID_PLAYER)
+        {
+            ((Creature*)pVictim)->AddDamage(this,damage);
+            sLog.outDetail("DealDamage: total dmg done:%d to maxhealth:%d by %u", pVictim->m_DamageManager.totalDamage(), pVictim->GetMaxHealth(), this->GetGUID());
+        }

What about pets, which are owned by a player, dealing damage? It would sadden warlocks and hunters for sure if they'd have to deal at least 50% of the damage themself. I suggest to use Unit::isCharmedOwnedByPlayerOrPlayer() instead :)

Link to comment
Share on other sites

Well, actually it's a bit more complicated than this. Pets and NPCs are indeed handled differently.

If a Pet kills a NPC exclusively, you won't get any kill credit, meaning you can't loot the NPC and you won't get any XP.

This means that pet owners have to tap the npc themselves, at least with 1 dmg. I guess they use this mechanics to ensure that pets won't be exploited as some kind of bot. :)

Something worth mentioning is that Totems count as Pets too!

Regarding NPC vs. NPC fights, its a bit different here.

You CAN get kill credit if you do enough damage to the NPC. Meaning: If two NPCs are already fighting, you can still get credit if health isn't below a certain value. I don't know the exact percentage, but it should be somewhere close to 50%(-10% ?). So if the NPC is untapped(meaning no other player has attacked it yet) and you deal at least 50% of the damage, the kill counts for you.

NPCs should NOT be lootable whatsoever if this condition isn't true.

I played a 70 hunter in BC and 80 mage in wotlk and I can confirm that these mechanics are still valid.

Would be nice if someone could confirm the percentage on NPC vs NPC fights.

Link to comment
Share on other sites

Regarding NPC vs. NPC fights, its a bit different here.

You CAN get kill credit if you do enough damage to the NPC. Meaning: If two NPCs are already fighting, you can still get credit if health isn't below a certain value. I don't know the exact percentage, but it should be somewhere close to 50%(-10% ?). So if the NPC is untapped(meaning no other player has attacked it yet) and you deal at least 50% of the damage, the kill counts for you.

NPCs should NOT be lootable whatsoever if this condition isn't true.

I played a 70 hunter in BC and 80 mage in wotlk and I can confirm that these mechanics are still valid.

Would be nice if someone could confirm the percentage on NPC vs NPC fights.

I repeat, everything depends on pvp flags mob and possibly his faction. I know mobs are ample to hit 1 damage and you are guaranteed to get the loot from him, even if the rest of his life he will carry the other mob. I also know the mobs that are just acting on the mechanics you described.

Link to comment
Share on other sites

What about pets, which are owned by a player, dealing damage? It would sadden warlocks and hunters for sure if they'd have to deal at least 50% of the damage themself. I suggest to use Unit::isCharmedOwnedByPlayerOrPlayer() instead

The section for getting the loot under Player::SendLoot helps with those situations where a creature was not attacked by a player, but is still within a certain level range (under the assumption that if the NPC is near the player's level, then they could have killed the NPC on their own if the other NPC wasn't there). However, if the NPC was attacked and killed by a pet, without the player hitting it, then another player could still take the loot. I used the value from the config of Quests.HighLevelHideDiff which has a default value of 7. Originally, I had hard coded this to 10.

If a Pet kills a NPC exclusively, you won't get any kill credit, meaning you can't loot the NPC and you won't get any XP.

So, the part of the code that allows a similiar level player to loot if a player did no or less than 50% damage (possibly just 40% if we can get verification or agreed amount), should be taken out of this patch based on how it works on offi?

I repeat, everything depends on pvp flags mob and possibly his faction. I know mobs are ample to hit 1 damage and you are guaranteed to get the loot from him, even if the rest of his life he will carry the other mob. I also know the mobs that are just acting on the mechanics you described.

So, if the NPC is PvP, it should work as it is already with first player to hit the NPC gets loot until death of the NPC?

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use