|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
05-09-2009, 08:49 AM
|
Fire Beetle
|
|
Join Date: Jul 2004
Posts: 8
|
|
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);
}
|
|
|
|
|
|
|
05-13-2009, 11:12 AM
|
Fire Beetle
|
|
Join Date: Jul 2004
Posts: 8
|
|
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)) {
|
|
|
|
05-23-2009, 04:55 PM
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
I haven't had a chance to revisit this yet but I'm marking it so I'll remember.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 05:07 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|