View Single Post
  #1  
Old 06-07-2010, 11:07 PM
Allizia
Fire Beetle
 
Join Date: Nov 2009
Posts: 5
Default Corpse rez timer

I'm going to a 2-3 hour limit for rezzing corpses, is it possible to enter an if statement in void Corpse::CastRezz similar to:

Code:
if corpse_decay_timer<292800   (300000 - 7200 seconds? I can figure out the times if it will work)
      if(Caster && Caster->IsClient())
			Caster->Message(13,"This corpse is too old to be resurrected.");

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(300000);
		}
		mysql_free_result(result);
	}
	else
		safe_delete_array(query);
}

/*
void Corpse::CastRezz(int16 spellid, Mob* Caster){
	if(Rezzed()){
		if(Caster && Caster->IsClient())
			Caster->Message(13,"This character has already been resurrected.");
		return;
	}

	APPLAYER* outapp = new APPLAYER(OP_RezzRequest, sizeof(Resurrect_Struct));
	Resurrect_Struct* rezz = (Resurrect_Struct*) outapp->pBuffer;
	memcpy(rezz->your_name,this->orgname,30);
	memcpy(rezz->corpse_name,this->name,30);
	memcpy(rezz->rezzer_name,Caster->GetName(),30);
	memcpy(rezz->zone,zone->GetShortName(),15);
	rezz->spellid = spellid;
	rezz->x = this->x_pos;
	rezz->y = this->y_pos;
	rezz->z = (float)this->z_pos;
	worldserver.RezzPlayer(outapp, rezzexp, OP_RezzRequest);
	//DumpPacket(outapp);
	safe_delete(outapp);
}
*/
I'm still learning, don't be too harsh
Reply With Quote