Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 08-13-2008, 09:27 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

LOL, I figured it would be something simple like that! I will test it out on my server tonight. My only question is if this takes coin loot into consideration, or only items?

I think you guys are right. This really doesn't have much reason to be set as a rule. I guess I just like to have as many options as possible :P

Thanks Theeper!
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 08-13-2008, 09:40 PM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

I didn't think about coin, good catch Trev. Use this instead.
Code:
	if (itemlist.size() < 1 && in_npc->GetCopper() == 0 && in_npc->GetSilver()== 0 && in_npc->GetGold()== 0 && in_npc->GetPlatinum() == 0)
		corpse_decay_timer.SetTimer(5000);
Reply With Quote
  #3  
Old 08-13-2008, 09:41 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

It doesn't have to be set as a rule but it is; there will be a rule in tonight's build along with some other stuff that's probably not as exciting for some people.

btw there's already a function to tell if the corpse is empty: Corpse::IsEmpty() =p
Reply With Quote
  #4  
Old 08-13-2008, 09:43 PM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

Every little bit helps, and all progress is exciting. Thanks as always =)
Reply With Quote
  #5  
Old 08-13-2008, 10:06 PM
Theeper
Discordant
 
Join Date: May 2004
Posts: 290
Default

Quote:
Originally Posted by KLS View Post
btw there's already a function to tell if the corpse is empty: Corpse::IsEmpty() =p
LOL, that's what I get for not looking through the function list very carefully. It seems as though IsEmpty() is only used for the PERL interface right now.

Ignore the above and use this until KLS tells us how it's actually supposed to be done in one line probably :p~

Code:

	if (IsEmpty())
		corpse_decay_timer.SetTimer(5000);
Reply With Quote
  #6  
Old 08-13-2008, 10:28 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Well that's actually basically it.
Reply With Quote
  #7  
Old 08-13-2008, 10:33 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Doesn't it need the brackets around it like this?

Code:
	if (IsEmpty()) {
		corpse_decay_timer.SetTimer(5000); }
Or am I still too much of a coding newbie? :P

The only reason I ask is because I will probably just add this in manually on my server until more of the features I have to add in manually each time get added into the Official Source(Lore Aug, Chaotic Potential and new MQ Detection are the most important ones, and they all seem to be working perfectly). Or, at least until there are some significant changes in the source that I want to have on my server.

Currently, I also add these each time I update:

Lore Aug Fix:
http://www.eqemulator.net/forums/showthread.php?t=24572

CotH limiting per zone (I think live is per zone)
http://www.eqemulator.net/forums/showthread.php?t=25643

MQ Illegal Item Equip Detection
http://www.eqemulator.net/forums/showthread.php?t=25783

Chaotic Potential Fix
http://www.eqemulator.net/forums/showthread.php?t=25717

Spell And Skill Rule for Above MaxLevel Players
http://www.eqemulator.net/forums/showthread.php?t=25937

Minor NPC Spells Recast Delay Adjustment
http://www.eqemulator.net/forums/showthread.php?t=25877

Removing Non-Titanium Version Checks - Mostly to change Titanium to be checked first
http://www.eqemulator.net/forums/showthread.php?t=25569
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #8  
Old 08-13-2008, 10:39 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Oh, and the main reason I think it would be nice to have as a rule would be to have the option to make corpses poof immediately without even starting a timer. This would probably reduce some of the load on servers after a large AE pull is killed. I know when I have 30ish mobs all die at once, it almost always crashes the zone.

One thing I was thinking is that instead of a rule, it might be nice to have the decay timer be an actual setting in the Zones table similar to canbind, accept the number would be the time in seconds of how long the corpse would last. In most zones, I would like the 5 second timer to be set, because I think it would just be a little weird for corpses to disapear immediately. But there are definitely a couple of zones where I would prefer to have them vanish immediately, mostly because there are often AE groups in those zones and the server needs any help it can get to reduce performance issues from AEing.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #9  
Old 08-14-2008, 12:39 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Quote:
Originally Posted by trevius View Post
Doesn't it need the brackets around it like this?

Code:
	if (IsEmpty()) {
		corpse_decay_timer.SetTimer(5000); }
Or am I still too much of a coding newbie? :P
If you have only 1 thing to process in an if, else, etc, statement, you don't need brackets. I know this is true for C++ & Perl, pretty sure it's the same for other languages including PHP.

I know there's another weird function using : and ? for a very simple if/else statement, but I never really paid attention to the syntax.

Quote:
Originally Posted by trevius View Post
Oh, and the main reason I think it would be nice to have as a rule would be to have the option to make corpses poof immediately without even starting a timer. This would probably reduce some of the load on servers after a large AE pull is killed. I know when I have 30ish mobs all die at once, it almost always crashes the zone.

One thing I was thinking is that instead of a rule, it might be nice to have the decay timer be an actual setting in the Zones table similar to canbind, accept the number would be the time in seconds of how long the corpse would last. In most zones, I would like the 5 second timer to be set, because I think it would just be a little weird for corpses to disapear immediately. But there are definitely a couple of zones where I would prefer to have them vanish immediately, mostly because there are often AE groups in those zones and the server needs any help it can get to reduce performance issues from AEing.
You could set it up one of many different ways. Unfortunately, I don't know if there's really one "best" way to do it. You could do it on a per-mob basis, per zone basis, per server basis, or a combination of the above. If you really want to add flexibility, I would say all of the above, using mob, zone, then server as the priority using an if, else if, else statement. I'm not sure of the exact code needed, but the idea would be something like this:
Code:
if (mob.empty_corpse_timer != NULL) corpse_decay_timer.SetTimer(mob.empty_corpse_timer)
else if (zone.empty_corpse_timer != NULL) corpse_decay_timer.SetTimer(zone.empty_corpse_timer)
else corpse_decay_timer.SetTimer(RuleI(NPC,EmptyNPCCorpseDecayTimeMS)+1000)
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
Reply With Quote
  #10  
Old 09-06-2008, 07:12 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I don't know why, but I am running 1129 which should have this code in it (and I see it in the source), but even after I set the rule, it doesn't seem to actually work. Corpses still wait 20 minutes to decay.

Maybe the code for the IsEmpty check needs to go after the normal decay timer checks? I know it was working that way when I tried the code that Theeper posted.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #11  
Old 09-07-2008, 06:52 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Unless the new corpse decay timer is working for people and I just have something set incorrectly (let me know if so), then I am going to try moving it the next time I do a build. I am planning to move it from here (noted in RED):

Code:
Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, int32 in_npctypeid, const NPCType** in_npctypedata, int32 in_decaytime)
// vesuvias - appearence fix
 : Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid//bodytype added
       ,in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0,
	 in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
	 in_npc->GetTexture(),in_npc->GetHelmTexture(),
	 0,0,0,0,0,0,0,0,0,
	 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0,0,0,0,0,0,0),
	 corpse_decay_timer(in_decaytime),
	corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
	corpse_graveyard_timer(0)
{
	corpse_graveyard_timer.Disable();
	memset(item_tint, 0, sizeof(item_tint));
	pIsChanged = false;
	p_PlayerCorpse = false;
	pLocked = false;
	BeingLootedBy = 0xFFFFFFFF;
	if (in_itemlist) {
		itemlist = *in_itemlist;
		in_itemlist->clear();
	}
	
	SetCash(in_npc->GetCopper(), in_npc->GetSilver(), in_npc->GetGold(), in_npc->GetPlatinum());
	
	if(IsEmpty())
	{
corpse_decay_timer.SetTimer(RuleI(NPC,EmptyNPCCorpseDecayTimeMS)+1000);
	}

	npctype_id = in_npctypeid;
	SetPKItem(0);
	charid = 0;
	dbid = 0;
	p_depop = false;
	strcpy(orgname, in_npc->GetName());
	strcpy(name, in_npc->GetName());
	// Added By Hogie 
	for(int count = 0; count < 100; count++) {
		if ((level >= npcCorpseDecayTimes[count].minlvl) && (level <= npcCorpseDecayTimes[count].maxlvl)) {
			corpse_decay_timer.SetTimer(npcCorpseDecayTimes[count].seconds*1000);
			break;
		}
	}
	// Added By Hogie -- End
	for (int i=0; i<MAX_LOOTERS; i++)
		looters[i] = 0;
	this->rezzexp = 0;
}
To here:
Code:
Corpse::Corpse(NPC* in_npc, ItemList* in_itemlist, int32 in_npctypeid, const NPCType** in_npctypedata, int32 in_decaytime)
// vesuvias - appearence fix
 : Mob("Unnamed_Corpse","",0,0,in_npc->GetGender(),in_npc->GetRace(),in_npc->GetClass(),BT_Humanoid//bodytype added
       ,in_npc->GetDeity(),in_npc->GetLevel(),in_npc->GetNPCTypeID(),in_npc->GetSize(),0,
	 in_npc->GetHeading(),in_npc->GetX(),in_npc->GetY(),in_npc->GetZ(),0,
	 in_npc->GetTexture(),in_npc->GetHelmTexture(),
	 0,0,0,0,0,0,0,0,0,
	 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0,0,0,0,0,0,0),
	 corpse_decay_timer(in_decaytime),
	corpse_delay_timer(RuleI(NPC, CorpseUnlockTimer)),
	corpse_graveyard_timer(0)
{
	corpse_graveyard_timer.Disable();
	memset(item_tint, 0, sizeof(item_tint));
	pIsChanged = false;
	p_PlayerCorpse = false;
	pLocked = false;
	BeingLootedBy = 0xFFFFFFFF;
	if (in_itemlist) {
		itemlist = *in_itemlist;
		in_itemlist->clear();
	}
	
	SetCash(in_npc->GetCopper(), in_npc->GetSilver(), in_npc->GetGold(), in_npc->GetPlatinum());

	npctype_id = in_npctypeid;
	SetPKItem(0);
	charid = 0;
	dbid = 0;
	p_depop = false;
	strcpy(orgname, in_npc->GetName());
	strcpy(name, in_npc->GetName());
	// Added By Hogie 
	for(int count = 0; count < 100; count++) {
		if ((level >= npcCorpseDecayTimes[count].minlvl) && (level <= npcCorpseDecayTimes[count].maxlvl)) {
			corpse_decay_timer.SetTimer(npcCorpseDecayTimes[count].seconds*1000);
			break;
		}
	}
	// Added By Hogie -- End

	if(IsEmpty())
	{
corpse_decay_timer.SetTimer(RuleI(NPC,EmptyNPCCorpseDecayTimeMS)+1000);
	}

	for (int i=0; i<MAX_LOOTERS; i++)
		looters[i] = 0;
	this->rezzexp = 0;
}
This is my only guess as to why the new decay timer code isn't currently working for me. Especially since it was working perfectly when I added Theeper's code in manually before this was added into the official source. My guess is that the following code that currently comes after the IsEmpty check is still being used even if the corpse is empty and the decay timer is being overwritten to follow these rules instead of using the new IsEmpty rule:

Code:
	for(int count = 0; count < 100; count++) {
		if ((level >= npcCorpseDecayTimes[count].minlvl) && (level <= npcCorpseDecayTimes[count].maxlvl)) {
			corpse_decay_timer.SetTimer(npcCorpseDecayTimes[count].seconds*1000);
			break;
		}
	}
I will try out the move of the IsEmpty check code and see if that resolves the problem.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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 11:55 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3