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

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-10-2002, 01:22 AM
Wiz
Dragon
 
Join Date: Feb 2002
Posts: 583
Default Need some help...

I'm going insane about this code :/

The value I'm having problems with is the int old. It's a value set to store the critter's Y plus the critter's X. However, it's escalating to all hell, for every buff "tic" here, it raises, ending up something like 2958252291411414.

Code:
void Mob: :DoBuffTic(int16 spell_id, int32 ticsremaining, int8 caster_level, Mob* caster) {
	int tx = GetX();
	int ty = GetY();
	int old = GetOldCoords();
	if (!spells_loaded)
		return;
	if (spell_id != 0xFFFF) {
		for (int i=0; i < 12; i++) {
			switch (spells[spell_id].effectid[i]) {
				case SE_CurrentHP: 
					{
					if (caster != 0)
					{
						adverrorinfo = 41;
						int val = CalcSpellValue(spells[spell_id].formula[i], spells[spell_id].base[i], spells[spell_id].max[i], caster_level);
						if (val < 0 && this->IsNPC())
						{
							this->CastToNPC()->AddToHateList(caster,val*-1,val*-1);
						}
						if (old != 0 && old != tx + ty && this->IsNPC())
							val = val/4;
						if (this->GetHP() + val < 1)
							this->SetHP(1);
						else
							this->SetHP(GetHP()+val);
						if (this->IsNPC())
						{
							this->CastToNPC()->SendHPUpdate();
						}
						if (this->IsClient())
							this->CastToClient()->SendHPUpdate();
						SetOldCoords(tx,ty);
						cout<<old<<endl;
						break;
					}
				}
				case SE_HealOverTime: {
					if (this->IsClient() || caster != 0){
						adverrorinfo = 42;
						this->ChangeHP(caster, CalcSpellValue(spells[spell_id].formula[i], spells[spell_id].base[i], spells[spell_id].max[i], caster_level), spell_id);
						adverrorinfo = 4;
					}
					break;
				}
				case SE_CurrentMana: {
					this->SetMana(GetMana() + CalcSpellValue(spells[spell_id].formula[i], spells[spell_id].base[i], spells[spell_id].max[i], caster_level));
					break;
				}
				default: {
					// do we need to do anyting here?
				}
			}
		}
	}
}
Here's the values/functions declared.

Code:
int		oldcoords;
void	SetOldCoords(int tx,int ty);
int     GetOldCoords() {return oldcoords; SetOldCoords(0,0);}
oldcoords = 0;
void Mob::SetOldCoords(int tx,int ty) 
{
	oldcoords = tx+ty;
}
Reply With Quote
 


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 06: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