azerothcore / mod-money-for-kills

GNU Affero General Public License v3.0
8 stars 17 forks source link

Add config option and more cleanup #3

Closed Sdyess closed 5 years ago

Sdyess commented 6 years ago

https://github.com/azerothcore/mod-moneyforkills/issues/2

BarbzYHOOL commented 6 years ago

Thank you, again.

Would you mind adding the other parts to the conf (or separate conf option) ?

I was going to do it but I felt like I'd be spending 30 min while you'd do it in 3 minutes, so I ask :-P

When you suicide

                // No reward for killing yourself
                if (killer->GetGUID() == victim->GetGUID())
                {
                    // Inform the world
                    std::string message = "|cff676767[ |cffFFFF00World |cff676767]|r:|cff4CFF00 ";
                    message.append(killer->GetName());
                    message.append(" met an untimely demise!");

                    sWorld->SendServerMessage(SERVER_MSG_STRING, message.c_str());
                    return;
}

and when you kill someone

            case KILLTYPE_PVP:
                rewardMsg.append("|cff676767[ |cffFFFF00World |cff676767]|r:|cff4CFF00 ").append(killer->GetName()).append(" |cffFF0000has slain ");
                rewardMsg.append(victim->GetName()).append(" earning a bounty of").append(rewardVal).append(".");
                sWorld->Send Server Message(SERVER_MSG_STRING, rewardMsg.c_str());
break;
BarbzYHOOL commented 6 years ago

Ok tested it.

The config file work fine but I found two issues, I don't know if it's related.

When I kill another player in PVP with these configs MFK.PVP.CorpseLootPercent = 5 MFK.PVP.Multiplier = 200

I get a double message saying "You loot X from the corpse. You receive a bounty of X for the kill" (same X)

And if I suicide, it prints a message that I stole gold from myself which sounds dumb :P

Sdyess commented 6 years ago

I'll fix it when I get home in a few hours, thanks for testing :+1:

okcanien commented 6 years ago

we count on you Sdyess, keep up the good work

BarbzYHOOL commented 6 years ago

:'(

milestorme commented 5 years ago

tested and it all seems to work for me

I get a double message saying "You loot X from the corpse. You receive a bounty of X for the kill" (same X) And if I suicide, it prints a message that I stole gold from myself which sounds dumb :P

not getting these errors -->( https://ibb.co/vsrw6m9)

this pr seems good to me

BarbzYHOOL commented 5 years ago

@milestorme in PVP

When I kill another player in PVP with these configs MFK.PVP.CorpseLootPercent = 5 MFK.PVP.Multiplier = 200

Sdyess commented 5 years ago

@BarbzYHOOL So I don't have this branch anymore. The double message is an easy fix, it just needs an or operator placed in the last if after the switch cases for notify type to exclude killtype_mob as well. I can't immediately see how the suicide message is breaking from the code though and i dont have a version of azerothcore running atm or anything.

If you'll merge this in, I can edit from github and then make another PR to fix the double message, or we wait until I decide to maybe setup azerothcore again.

milestorme commented 5 years ago

im using this pr on my live server now its working perfectly from what i can see @BarbzYHOOL

BarbzYHOOL commented 5 years ago

that's funny, we can view the file but not edit it

i can't even compile it now, don't know why

/home/server/source_code/yhool/dev_realm_1/modules/mod-moneyforkills/src/mod_moneyforkills.cpp:85:30: error: expected class name
class MoneyForKills : public PlayerScript
                             ^
/home/server/source_code/yhool/dev_realm_1/modules/mod-moneyforkills/src/mod_moneyforkills.cpp:88:23: error: member initializer 'PlayerScript' does 
not name a non-static data member or base class
    MoneyForKills() : PlayerScript("MoneyForKills") { }
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/server/source_code/yhool/dev_realm_1/modules/mod-moneyforkills/src/mod_moneyforkills.cpp:96:35: error: member access into incomplete type 'Pla
yer'
                ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00MoneyForKills |rmodule.");
                                  ^
/home/server/source_code/yhool/dev_realm_1/src/server/game/Groups/GroupRefManager.h:13:7: note: forward declaration of 'Player'
class Player;
      ^
/home/server/source_code/yhool/dev_realm_1/modules/mod-moneyforkills/src/mod_moneyforkills.cpp:113:27: error: member access into incomplete type 'Pl
ayer'
                if (killer->GetGUID() == victim->GetGUID() && sConfigMgr->GetBoolDefault("MFK.SuicideAnnounce", true))

and more errors

BarbzYHOOL commented 5 years ago

Ok I retested -_-

I confirm my own report + found another bug.

When you have 2 client side addons together, you kill a player and it doesn't say the message, yet you hear the money sound and you get the money. It also doesn't display tons of other things, so it's a general issue.

And for the suicide kill, to test select yourself, and type .die

Screenshots: https://www.noelshack.com/2019-24-1-1560182083-bug.jpg suicide https://www.noelshack.com/2019-24-1-1560182083-bug2.jpg kill

BarbzYHOOL commented 5 years ago

What is killtype_loot??? i don't get it

And no, your change doesn't work Sdyess, I also tried with killtype_loot

But since I had to disable PCH to make it compile, my compilation time is very huge so can't do many tests.

Sdyess commented 5 years ago

This is a year old at this point. In the original it looks like killtype_loot is triggered when the victim has >= 10000 money and then tells the player they looted their corpse, and then a little after it then notifies the player of the bounty amount for it being a PVP kill. So I was wrong, since the original version of this did the double message in the first place and it wasn't something I fixed while working in it.

I'm curious how you would prefer it work instead, since that definitely shouldn't be a double message. We either remove bounty notifications or disable them if the loot notification gets sent instead.

I'm looking for a 335 download currently that isn't a torrent so I can fix this.

Edit: Have a 335 client and AC setup, let me know how you'd like this to work @BarbzYHOOL

BarbzYHOOL commented 5 years ago

a client http://gloyah.net/rweasy/-1RNKO/358487/http://dl.wowdl.fr/wow/us/clients/client_3.3.5.zip?rndad=1300262668-1560204147

killtype_loot is triggered when the victim has >= 10000 money and then tells the player they looted their corpse, and then a little after it then notifies the player of the bounty amount for it being a PVP kill

Seems like the same thing to me

disable them if the loot notification gets sent instead.

yes, that looks quite good

Btw for suicide, I haven't tested what happens when you jump from high and die. it probably says you killed yourself and looted yourself though

EDIT: for PCH issue I opened a new issue

Sdyess commented 5 years ago

Moved to another PR due to the branch no longer existing. https://github.com/azerothcore/mod-money-for-kills/pull/5