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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-14-2011, 04:14 PM
Sikkun
Sarnak
 
Join Date: Apr 2011
Posts: 30
Default Mounted Out of Combat Regeneration

Hello,
I was unable to find a fix for this (sorry if there is a known one) so here is the code I added to enable Mounted OOC Like on live.

Orginal:
horse.cpp

Code:
void Client::SummonHorse(int16 spell_id) {
	if (GetHorseId() != 0) {
		Message(13,"You already have a Horse.  Get off, Fatbutt!");
		return;
	}
	if(!Horse::IsHorseSpell(spell_id)) {
		LogFile->write(EQEMuLog::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id);
		return;
	}
	
	// No Horse, lets get them one.
	
	Horse* horse = new Horse(this, spell_id, GetX(), GetY(), GetZ(), GetHeading());
	
	//we want to manage the spawn packet ourself.
	//another reason is we dont want quests executing on it.
	entity_list.AddNPC(horse, false);
	
	// Okay, lets say they have a horse now.
	
	
	EQApplicationPacket outapp;
	horse->CreateHorseSpawnPacket(&outapp, GetName(), GetID());
/*	// Doodman: Kludged in here instead of adding a field to PCType. FIXME!
	NewSpawn_Struct* ns=(NewSpawn_Struct*)outapp->pBuffer;
	ns->spawn.texture=mount_color;
	ns->spawn.pet_owner_id=0;
	ns->spawn.walkspeed=npc_type->walkspeed;
	ns->spawn.runspeed=npc_type->runspeed;
*/
	entity_list.QueueClients(horse, &outapp);
	
	
	int16 tmpID = horse->GetID();
	SetHorseId(tID);
}
New: (one line at the end)

Code:
void Client::SummonHorse(int16 spell_id) {
	if (GetHorseId() != 0) {
		Message(13,"You already have a Horse.  Get off, Fatbutt!");
		return;
	}
	if(!Horse::IsHorseSpell(spell_id)) {
		LogFile->write(EQEMuLog::Error, "%s tried to summon an unknown horse, spell id %d", GetName(), spell_id);
		return;
	}
	
	// No Horse, lets get them one.
	
	Horse* horse = new Horse(this, spell_id, GetX(), GetY(), GetZ(), GetHeading());
	
	//we want to manage the spawn packet ourself.
	//another reason is we dont want quests executing on it.
	entity_list.AddNPC(horse, false);
	
	// Okay, lets say they have a horse now.
	
	
	EQApplicationPacket outapp;
	horse->CreateHorseSpawnPacket(&outapp, GetName(), GetID());
/*	// Doodman: Kludged in here instead of adding a field to PCType. FIXME!
	NewSpawn_Struct* ns=(NewSpawn_Struct*)outapp->pBuffer;
	ns->spawn.texture=mount_color;
	ns->spawn.pet_owner_id=0;
	ns->spawn.walkspeed=npc_type->walkspeed;
	ns->spawn.runspeed=npc_type->runspeed;
*/
	entity_list.QueueClients(horse, &outapp);
	
	
	int16 tmpID = horse->GetID();
	SetHorseId(tmpID);

	//Sets Player action to Sit
	playeraction = 1;

}
And to make the OOC stop when not mounted

Orginal:
Code:
void Client::SetHorseId(int16 horseid_in) {
	//if its the same, do nothing
	if(horseId == horseid_in)
		return;
	
	//otherwise it changed.
	//if we have a horse, get rid of it no matter what.
	if(horseId) {
		Mob *horse = entity_list.GetMob(horseId);
		if(horse != NULL)
		horse->Depop();
	}
	
	//now we take whatever they gave us.
	horseId = horseid_in;
}
New (just one line again)

Code:
void Client::SetHorseId(int16 horseid_in) {
	//if its the same, do nothing
	if(horseId == horseid_in)
		return;
	
	//otherwise it changed.
	//if we have a horse, get rid of it no matter what.
	if(horseId) {
		Mob *horse = entity_list.GetMob(horseId);
		if(horse != NULL)
		{
			horse->Depop();
                                         //Sets player action to stand
			playeraction = 0;
		}
	}
	
	//now we take whatever they gave us.
	horseId = horseid_in;
}
Sikkun
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 12:38 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