Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-09-2009, 08:49 AM
tsowl
Fire Beetle
 
Join Date: Jul 2004
Posts: 8
Default load player corpse decay time

zone/client_packet.cpp
Code:
			sec = (ttime/1000)%60; // Total seconds
			min = (ttime/60000)%60; // Total seconds
-			hour = (ttime/3600000)%60; // Total hours
-			day = (ttime/86400000)%24; // Total Days
+			hour = (ttime/3600000)%24; // Total hours
+			day = ttime/86400000; // Total Days
zone/playercorpse.cpp
Code:
	dbid = in_dbid;
	p_depop = false;
	charid = in_charid;
	itemlist = *in_itemlist;
	in_itemlist->clear();

	//we really should be loading the decay timer here...
+	LoadPlayerCorpseDecayTime(in_dbid);
	
	strcpy(orgname, in_charname);
	strcpy(name, in_charname);
add:
Code:
void Corpse::LoadPlayerCorpseDecayTime(int32 dbid){
	if(!dbid)
		return;
	char errbuf[MYSQL_ERRMSG_SIZE];
    char *query = 0;
    MYSQL_RES *result;
    MYSQL_ROW row;
	if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) FROM player_corpses WHERE id=%d and not timeofdeath=0", dbid), errbuf, &result)) {
		safe_delete_array(query);
		while (row = mysql_fetch_row(result)) {
			if(atoi(row[0]) > 0 && RuleI(Character, CorpseDecayTimeMS) > (atoi(row[0]) * 1000))
				corpse_decay_timer.SetTimer(RuleI(Character, CorpseDecayTimeMS) - (atoi(row[0]) * 1000));
			else
				corpse_decay_timer.SetTimer(5000);
		}
		mysql_free_result(result);
	}
	safe_delete_array(query);
}
zone/playercorpse.h
Code:
class Corpse : public Mob
{
public:
+	void LoadPlayerCorpseDecayTime(int32 dbid);
}
Reply With Quote
  #2  
Old 05-13-2009, 11:12 AM
tsowl
Fire Beetle
 
Join Date: Jul 2004
Posts: 8
Default

make shadow rest functionary again with previous change

zone/playercorpse.cpp
Code:
-	end += sprintf(end, "UPDATE player_corpses SET IsBurried=0, zoneid=%u, x=%f, y=%f, z=%f, heading=%f, WasAtGraveyard=0 WHERE id=%u", new_zoneid, new_x, new_y, new_z, new_heading, dbid);
+	end += sprintf(end, "UPDATE player_corpses SET IsBurried=0, zoneid=%u, x=%f, y=%f, z=%f, heading=%f, timeofdeath=Now(), WasAtGraveyard=0 WHERE id=%u", new_zoneid, new_x, new_y, new_z, new_heading, dbid);
and, to make DeleteStalePlayerCorpses working again
common/shareddb.cpp
Code:
-		if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", RuleI(Character, CorpseDecayTimeMS)), errbuf, 0, &affected_rows)) {
+		if (!RunQuery(query, MakeAnyLenString(&query, "UPDATE player_corpses SET IsBurried = 1 WHERE IsBurried=0 and (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", (RuleI(Character, CorpseDecayTimeMS) / 1000)), errbuf, 0, &affected_rows)) {
Code:
-		if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", RuleI(Character, CorpseDecayTimeMS)), errbuf, 0, &affected_rows)) {
+		if (!RunQuery(query, MakeAnyLenString(&query, "Delete from player_corpses where (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(timeofdeath)) > %d and not timeofdeath=0", (RuleI(Character, CorpseDecayTimeMS) / 1000)), errbuf, 0, &affected_rows)) {
Reply With Quote
  #3  
Old 05-23-2009, 04:55 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I haven't had a chance to revisit this yet but I'm marking it so I'll remember.
Reply With Quote
Reply


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 05:07 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