Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::General Support

Support::General Support Post all topics here having to do with errors while trying to connect to an EQEMu server but not about the setup/running of the Server itself.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-14-2018, 10:52 AM
caravellex
Sarnak
 
Join Date: Sep 2010
Posts: 63
Default 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.
Reply With Quote
  #2  
Old 02-14-2018, 07:39 PM
Darkscis
Sarnak
 
Join Date: Mar 2015
Posts: 62
Default

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
Reply With Quote
  #3  
Old 02-14-2018, 08:12 PM
image
Demi-God
 
Join Date: Jan 2002
Posts: 1,289
Default

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
__________________
www.eq2emu.com
EQ2Emu Developer
Former EQEMu Developer / GuildWars / Zek Seasons Servers
Member of the "I hate devn00b" club.
Reply With Quote
  #4  
Old 02-14-2018, 08:23 PM
caravellex
Sarnak
 
Join Date: Sep 2010
Posts: 63
Default

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?
Reply With Quote
  #5  
Old 02-14-2018, 08:40 PM
image
Demi-God
 
Join Date: Jan 2002
Posts: 1,289
Default

Quote:
Originally Posted by caravellex View Post
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.
__________________
www.eq2emu.com
EQ2Emu Developer
Former EQEMu Developer / GuildWars / Zek Seasons Servers
Member of the "I hate devn00b" club.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:49 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3