EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::General Support (https://www.eqemulator.org/forums/forumdisplay.php?f=598)
-   -   PvP loot code is there, but variable is missing? (https://www.eqemulator.org/forums/showthread.php?t=41765)

caravellex 02-14-2018 10:52 AM

PvP loot code is there, but variable is missing?
 
hey, Ive been looking into how to allow PvP item loot for awhile. Most of what I found were discussions of old PvP variables included in older builds. It seems at some point PvPReward and PvPitemloot were removed from the sql database as variables.

In corpse.cpp there appears to be code that supports PvP loot.

Code:

else if (IsPlayerCorpse() && char_id == client->CharacterID()) {
                Loot_Request_Type = 2;
        }
        else if ((IsNPCCorpse() || become_npc) && CanPlayerLoot(client->CharacterID())) {
                Loot_Request_Type = 2;
        }
        else if (GetPlayerKillItem() == -1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot all items, variable cash */
                Loot_Request_Type = 3;
        }
        else if (GetPlayerKillItem() == 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 item, variable cash */
                Loot_Request_Type = 4;
        }
        else if (GetPlayerKillItem() > 1 && CanPlayerLoot(client->CharacterID())) { /* PVP loot 1 set item, variable cash */
                Loot_Request_Type = 5;
        }

In the corpse.h file it seems to link to pk_item_id
Code:

        void        SetPlayerKillItemID(int32 pk_item_id) { player_kill_item = pk_item_id; }
        int32        GetPlayerKillItem() { return player_kill_item; }

my question is would adding a database variable for pk_item_id allow for pvp loot options? or what would I need to do to enable it.

Darkscis 02-14-2018 07:39 PM

I've never done a PvP server before but is it not just as simple as turning on PvP in the rules table? As you have seen, all the source seems to already incorporate PvP stuff....

https://github.com/EQEmu/Server/blob...letypes.h#L235

image 02-14-2018 08:12 PM

No it won't necessarily work out of the box. If a client kills another client and the person whom killed the other is grouped (killer is grouped) -- then yea it will work.

Code:

Client::Death
needs to be fixed cause the killerMob pointer can be a npc, like a pet. So you need the owner to be sure. At that point you need to allow the player to loot also which is not done if you are solo (only grouped).

similar to what they do here, but its done wrong cause this could be the pet and only works for groups:

https://github.com/EQEmu/Server/blob...tack.cpp#L1756

https://github.com/EQEmu/Server/blob...tack.cpp#L1771

Code:

                                if (killerMob->CastToClient()->isgrouped) {
                                        Group* group = entity_list.GetGroupByClient(killerMob->CastToClient());
                                        if (group != 0)
                                        {
                                                for (int i = 0; i<6; i++)
                                                {
                                                        if (group->members[i] != nullptr)
                                                        {
                                                                new_corpse->AllowPlayerLoot(group->members[i], i);
                                                        }
                                                }

new_corpse->AllowPlayerLoot(killerMob, 0); is what you need out of it for solo players... but need to also allow the killerMob (or the appropriate owner being a client)


db variables (ServerType, PvPreward, PvPitem)

ServerType = 1 (must be enabled to enable the below variables)


PvPreward = 3 (ITEM DROP of db variable PvPitem)
PvPitem = item id (only in PVPreward 3)
*this creates an item, not taken from the corpse

PVPreward = 1
one item on corpse

PVPreward = -1
all items on corpse

caravellex 02-14-2018 08:23 PM

Ty Image.
at some point, the EqEmu source switched the corpse mechanics out of atack.cpp into corpse.cpp, and disabled the variables.

Given that line of code, would it simply work if you excluded the group provision lines? It seems like the first lines of code are signifying the client and not the group.
Also, because the database is lacking PvPreward, is it as simple as adding a new table?

image 02-14-2018 08:40 PM

Quote:

Originally Posted by caravellex (Post 257627)
Ty Image.
at some point, the EqEmu source switched the corpse mechanics out of atack.cpp into corpse.cpp, and disabled the variables.

Given that line of code, would it simply work if you excluded the group provision lines? It seems like the first lines of code are signifying the client and not the group.
Also, because the database is lacking PvPreward, is it as simple as adding a new table?

The code still seems there so it should pull the variables for this. The problem is you still need to allow the clients you want to loot the mob (AllowPlayerLoot). Right now it only adds people who are in a group, if you are not grouped and kill someone, then you will not be added to the list.

The variables may not exist in the DB but you can add them back it would be a new row.. name being the db variable name and the value being whatever it needs to be.


All times are GMT -4. The time now is 04:50 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.