PDA

View Full Version : Naked Corpses


Pyrate
09-24-2006, 04:11 PM
I haven't seen this anywhere... Admittedly, maybe I'm blind and missed it, but I searched for it and looked through the Wiki and didn't see it.

Is it possible to configure the server to cause players to leave naked corpses, that can be resurrected for XP and to return the player to the zone they died in, without leaving all of their items on it?

If it's not, how hard would it be to add it to the server so that setting the leavecorpses variable in the database to a 2 (or some other value) to do this?

soulshot
09-25-2006, 05:27 AM
Darktides would also like to see this happen if possible =)

John Adams
09-30-2006, 06:42 PM
You guys ever look into this? My system is not in a state to compile atm... kinda blew stuff up again. Sigh. Working on a linux server to get this out of Winblows XP.

Anyway, I was poking around the source one day and saw in attack.cpp, where the player dies it calls to make a new Corpse. In that class (forgive if that's not the right term), there is a routine MoveItemsToCorpse or something. Above that, I believe it's checking that entry in variables table. With this info, is it possible to add another check that if the var = 2, kill the player, leave his corpse, but don't strip him? If that's what you're after...

Check it out. If you don't get to it, I'll have a look if I ever get a dev env setup again.

John Adams
10-12-2006, 06:21 AM
I've been bouncing back to this concept between server explosions, and wanted to pose a quick concept to get feedback from devs or others on a possible way to make this work. In attack.cpp, there is a section of code regarding client death that checks the value of variables "leavecorpses". If it's set to any positive value, a corpse is generated and items are moved to the corpse, etc.

I was thinking of changing this to a switch (leavecorpses) which will check for a default case, then 1 or 2 for values which cause the corpse generation to behave differently. 1 = normal, drop corpse, move items to corpse. 2 = drop corpse, leave items on player, allow corpse rez to recover xp like normal.

Current code:

// check db variable 'leavecorpses'
char tmp[20] = {0};
database.GetVariable("leavecorpses", tmp, 20);
int leavecorpses = atoi(tmp);
if(leavecorpses)
{
// creating the corpse takes the cash/items off the player too
Corpse *new_corpse = new Corpse(this, exploss);


Concept code:

// check db variable 'leavecorpses'
char tmp[20] = {0};
database.GetVariable("leavecorpses", tmp, 20);
int leavecorpses = atoi(tmp);
switch (leavecorpses)
{
case 1:
// creating the corpse takes the cash/items off the player too
Corpse *new_corpse = new Corpse(this, exploss);
break;
case 2:
// creating the corpse leaving the cash/items on the player
Corpse *new_naked_corpse = new Corpse(this, exploss); // or whatever
break;
default:
// just to normal, no corpse death routine
}

(I haven't verified the syntax of the switch/case yet, so forgive if it's wrong)

Does this make sense? And, are there any long-term issues you might see with adding this functionality? I've grep'd the code for where the database lookup occurs, and it only seems to be in attack.cpp. I realize a new routine would probably also need to be added like Corpse *new_naked_corpse = new Corpse(this, exploss); or something that will generate the new corpse, naked, and leave you with your gear like leavecorpses = 0 does.

Any advice would be welcome. I am working out the code now and will test it before posting here.

TIA,
J

LostZaphod
10-12-2006, 08:45 AM
In side of PlayerCorpse.cpp there are 5 locations that I found that delete corpses. The other night I changed the "IsEmpty()" function to always return false and then made a new subroutine that told the truth and changed the "Corpse::EndLoot" subroutine to use that one. It appears to work, but a lot more testing needs to be done. Changing the IsEmpty() function could cause problems in other code locations.

Here is one example of a corpse being deleted.

bool Corpse::Save() {
if (IsEmpty()) {
Delete();
return true;
}

Dralanna
10-12-2006, 12:29 PM
Just throwing an idea out there... but how about having the server spawn some sort of norent item to leave on a corpse, so it's not empty?

John Adams
10-12-2006, 01:46 PM
As far as I can tell, there is currently no provision to drop an empty corpse, regardless of items on it or not. So the plan is to find some way to do that. I am pretty sure even if the body is empty, it'll stay until it decays - or you click to loot it, then -poof-.

I keep thinking back to the early days of the Progression Servers, where you would die, leave an empty corpse, yet spawn fully geared, get rezzed, and loot (nothing) and get rid of the corpse that way.

bufferofnewbies
10-12-2006, 05:10 PM
I'm not too good with code myself, but perhaps a check for:
1. if the corpse is left by a player, and/or
2. if the corpse is res'able for xp gain
before it continues with the delete commands in each of those places?

I'm not sure what kind of impact that would make on the server load, although.

John Adams
10-13-2006, 01:28 AM
I awoke this morning from a nightmare about this feature request. I was suddenly thinking, what about systems with PvP Loot 1 Item enabled? If corpses have no gear left on them, this would be impossible. So it'll likely be either one way or the other. I doubt PVP servers want their players spawning with gear loaded anyway, so it may not be a problem at all.

I am having compile issues already by just simple replacing the if(leavecorpses) with the switch(leavecorpses), and not sure why. Keep the ideas coming. I'm hoping this is as cut & dry as it appears, but you're right - something deeper may be effected by adding this functionality.

LostZaphod
10-14-2006, 07:30 AM
In PVP no experence is lost from a PVP kill, Here is a Unified Diff file of PlayerCorpse.cpp. (EQEmu-0.7.0-857) The bottom line is all sections that delete corpses need to be removed except for the finished loot section.

Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32
Tk is available, Tk-macros are enabled
TCL is available, shell is enabled : help (select and press enter)
cvs diff -u -- PlayerCorpse.cpp (in directory C:\cvs\EQEmuCVS\Source\zone\)
Index: PlayerCorpse.cpp
================================================== =================
RCS file: /cvsroot/eqemulator/EQEmuCVS/Source/zone/PlayerCorpse.cpp,v
retrieving revision 1.15.2.12
diff -u -r1.15.2.12 PlayerCorpse.cpp
--- PlayerCorpse.cpp 9 Jul 2006 20:02:37 -0000 1.15.2.12
+++ PlayerCorpse.cpp 14 Oct 2006 19:17:32 -0000
@@ -98,13 +98,13 @@
pc->beard = dbpc->beard;
pc->Rezzed(rezzed);
pc->become_npc = false;
- if (pc->IsEmpty()) {
- safe_delete(pc);
- return 0;
- }
- else {
+ //if (pc->IsEmpty()) {
+ // safe_delete(pc);
+ // return 0;
+ //}
+ //else {
return pc;
- }
+ //}
}

// To be used on NPC death and ZoneStateLoad
@@ -336,9 +336,10 @@

Corpse::~Corpse() {
if (p_PlayerCorpse) {
- if (IsEmpty() && dbid != 0)
- database.DeletePlayerCorpse(dbid);
- else if (!IsEmpty() && !(p_depop && dbid == 0))
+ //if (IsEmpty() && dbid != 0)
+ // database.DeletePlayerCorpse(dbid);
+ //else if (!IsEmpty() && !(p_depop && dbid == 0))
+ if (!IsEmpty() && !(p_depop && dbid == 0))
Save();
}
// safe_delete(NPCTypedata);
@@ -366,10 +367,10 @@
}

bool Corpse::Save() {
- if (IsEmpty()) {
- Delete();
- return true;
- }
+ //if (IsEmpty()) {
+ // Delete();
+ // return true;
+ //}
if (!p_PlayerCorpse)
return true;
if (!pIsChanged)

***** CVS exited normally with code 1 *****