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

Development::Feature Requests Post suggestions/feature requests here.

Reply
 
Thread Tools Display Modes
  #1  
Old 11-27-2008, 01:06 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default Moving Horses to a Table

Instead of letting the source hard code everything about handling horses, I think it is about time to move them into their own table. I have looked into this a little bit, but don't have anything solid yet. I just wanted to get the idea out there.

I will look into what needs to change to get them to load from tables. I think a format like this should work for a table:

Code:
Table Name: horse_types

Fields:
id, filename, race, gender, texture, mountspeed, gnome_size, halfling_size, dwarf_size, froglok_size, halfelf_size, darkelf_size, woodelf_size, highelf_size, erudite_size, human_size, iksar_size, vahshir_size, barbarian_size, ogre_size, troll_size, notes
That should let you set the filename to match the filename text in the spell file. Then, you can set race, gender, and texture of how you want the mount to look (including the mechboar and maybe other custom models). Then, mountspeed can be set to any run value.

I am not sure how mount size is set currently yet, so I think a field for each race to set the mount size on a per race basis should work unless there is a better way.

Last, I think that a notes field might be useful so you can put "Spell: 2866 Tan Ornate Chain" or whatever you want in there. That would just make things easier to keep track of.

I will try to start figuring out the code for this soon, but any help/input is appreciated
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 11-27-2008, 02:08 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Probably should set the size based the size of the client summoning it.

Good idea though.
Reply With Quote
  #3  
Old 11-28-2008, 04:48 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ya, I know the idea has been tossed around for a while, but no real effort put into doing it that I have seen. Doesn't seem like it would be too hard. I am not exactly sure what to do yet, but I figure looking at pets might give us a good start.

I think the idea to have it set size based on the client is a good one. But, I figured it would be good to allow them to be set manually per race as well. Just incase someone wanted to use a global model as a custom mount (if any actually fit closely). Maybe setting the table size settings to 0 would let the server use the race size to automatically set a size for the mount, but anything over 0 would be used to set the size manually. It would be similar to using a rule, if that is possible. The only thing I am unsure about for setting size manually is what happens if the character shrinks/grows? Would the mount be able to scale properly with that? Maybe some extra code would be needed for shrink/grow and other #size changes.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 11-28-2008 at 01:08 PM..
Reply With Quote
  #4  
Old 11-28-2008, 05:23 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Here is what I have so far for SQL for a table. Haven't made a table myself yet, so lemme know if something looks wrong. I also included 1 example line for a fast white horse. Once this code is done, I will try to go through and create a full table for it to match what the current source code already does for all mounts.
Code:
DROP TABLE IF EXISTS `horses`;
CREATE TABLE `horses` (
  `id` int(11) NOT NULL auto_increment,
  `filename` varchar(32) NOT NULL,
  `race` smallint(3) NOT NULL default '216',
  `gender` tinyint(1) NOT NULL default '0',
  `texture` tinyint(2) NOT NULL default '0',
  `mountspeed` float(4,2) NOT NULL default '1.00',
  `gnome_size` smallint(5) NOT NULL default '0',
  `halfling_size` smallint(5) NOT NULL default '0',
  `dwarf_size` smallint(5) NOT NULL default '0',
  `froglok_size` smallint(5) NOT NULL default '0',
  `halfelf_size` smallint(5) NOT NULL default '0',
  `darkelf_size` smallint(5) NOT NULL default '0',
  `woodelf_size` smallint(5) NOT NULL default '0',
  `highelf_size` smallint(5) NOT NULL default '0',
  `erudite_size` smallint(5) NOT NULL default '0',
  `human_size` smallint(5) NOT NULL default '0',
  `iksar_size` smallint(5) NOT NULL default '0',
  `vahshir_size` smallint(5) NOT NULL default '0',
  `barbarian_size` smallint(5) NOT NULL default '0',
  `ogre_size` smallint(5) NOT NULL default '0',
  `troll_size` smallint(5) NOT NULL default '0',
  `notes` varchar(64) default 'Notes',
  PRIMARY KEY  (`id`,`filename`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `horses` VALUES ('1', 'SumHorseWhFast', '216', '0', '1', '175', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2871 - Summon Horse');
Instead of using floats for all char sizes to allow decimals, I just set them to 5 and we can divide by 100 in the code. So, gnomesize 225 would make a horse that is 2.25 in size.

I also just made a struct for this, but am not exactly sure if this is completely right or not yet.

zonedb.h
Code:
struct Horses_Struct {
	int id[11];
	char filename[32];
	int16 race[3];
	int8 gender[1];
	int8 texture[2];
	float mountspeed[4];
	int16 gnome_size[5];
	int16 halfling_size[5];
	int16 dwarf_size[5];
	int16 froglok_size[5];
	int16 halfelf_size[5];
	int16 darkelf_size[5];
	int16 woodelf_size[5];
	int16 highelf_size[5];
	int16 erudite_size[5];
	int16 human_size[5];
	int16 iksar_size[5];
	int16 vahshir_size[5];
	int16 barbarian_size[5];
	int16 ogre_size[5];
	int16 troll_size[5];
};
And, if I understand correctly, all that is left to do is to change the following to pull from the info from the new table:

horse.cpp
Code:
const NPCType *Horse::BuildHorseType(int16 spell_id) {


	// Spell: 2862 Tan Rope
	// Spell: 2863 Tan Leather
	// Spell: 2864 Tan Silken
	// Spell: 2865 Brown Chain
	// Spell: 2866 Tan Ornate Chain
	// Spell: 2867 White Rope
	// Spell: 2868 White Leather
	// Spell: 2869 White Silken
	// Spell: 2870 White Chain
	// Spell: 2871 White Ornate Chain
	// Spell: 2872 Black Rope
	// Spell: 2919 Tan Rope
	// Spell: 2918 Guide
	// Spell: 2917 Black Chain,		
	
	char mount_color=0;
	
	NPCType* npc_type = new NPCType;
	memset(npc_type, 0, sizeof(NPCType));
	strcpy(npc_type->name,"Unclaimed_Mount");	//this should never get used
      strcpy(npc_type->npc_attacks,"ABH");
	npc_type->cur_hp = 1; 
	npc_type->max_hp = 1; 
	npc_type->race = 216;
	npc_type->gender = (spell_id >= 3813 && spell_id <= 3832) ? 1 : 0; // Drogmor's are female horses. Yuck.
	npc_type->class_ = 1; 
	npc_type->deity= 1;
	npc_type->level = 1;
	npc_type->npc_id = 0;
	npc_type->loottable_id = 0;

	switch(spell_id) {
		case 2862:
			mount_color=0;  // Brown horse
			npc_type->runspeed=MOUNT_SLOW1_RUN;
			break;
		case 2863:
			mount_color=0;  // Brown horse
			npc_type->runspeed=MOUNT_SLOW2_RUN;
			break;
		case 2864:
			mount_color=0;  // Brown horse
			npc_type->runspeed=MOUNT_RUN1_RUN;
			break;
		case 2865:
			mount_color=0;  // Brown horse
			npc_type->runspeed=MOUNT_RUN2_RUN;
			break;
		case 2866:
			mount_color=0;  // Brown horse
			npc_type->runspeed=MOUNT_FAST_RUN;
			break;
		case 2867:
			mount_color=1;  // White horse
			npc_type->runspeed=MOUNT_SLOW1_RUN;
			break;
		case 2868:
			mount_color=1;  // White horse
			npc_type->runspeed=MOUNT_SLOW2_RUN;
			break;
		case 2869:
			mount_color=1;  // White horse
			npc_type->runspeed=MOUNT_RUN1_RUN;
			break;
		case 2870:
			mount_color=1;  // White horse
			npc_type->runspeed=MOUNT_RUN2_RUN;
			break;
		case 2871:
			mount_color=1;  // White horse
			npc_type->runspeed=MOUNT_FAST_RUN;
			break;
		case 2872:
			mount_color=2;  // Black horse
			npc_type->runspeed=MOUNT_SLOW1_RUN;
			break;
		case 2873:
			mount_color=2;  // Black horse
			npc_type->runspeed=MOUNT_SLOW2_RUN;
			break;
		case 2916:
			mount_color=2;  // Black horse
			npc_type->runspeed=MOUNT_RUN1_RUN;
			break;
		case 2917:
			mount_color=2;  // Black horse
			npc_type->runspeed=MOUNT_RUN2_RUN;
			break;
		case 2918:
			mount_color=2;  // Black horse
			npc_type->runspeed=MOUNT_FAST_RUN;
			break;
		case 2919:
			mount_color=3;  // Tan horse
			npc_type->runspeed=MOUNT_SLOW1_RUN;
			break;
		case 2920:
			mount_color=3;  // Tan horse
			npc_type->runspeed=MOUNT_SLOW2_RUN;
			break;
		case 2921:
			mount_color=3;  // Tan horse
			npc_type->runspeed=MOUNT_RUN1_RUN;
			break;
		case 2922:
			mount_color=3;  // Tan horse
			npc_type->runspeed=MOUNT_RUN2_RUN;
			break;
		case 2923:
			mount_color=3;  // Tan horse
			npc_type->runspeed=MOUNT_FAST_RUN;
			break;
		case 3813:
			mount_color=0;  // White drogmor
			npc_type->runspeed=MOUNT_SLOW1_RUN;
			break;
		case 3814:
			mount_color=0;  // White drogmor
			npc_type->runspeed=MOUNT_SLOW2_RUN;
			break;
		case 3815:
			mount_color=0;  // White drogmor
			npc_type->runspeed=MOUNT_RUN1_RUN;
			break;
		case 3816:
			mount_color=0;  // White drogmor
			npc_type->runspeed=MOUNT_RUN2_RUN;
			break;
		case 3817:
			mount_color=0;  // White drogmor
			npc_type->runspeed=MOUNT_FAST_RUN;
			break;
		case 3818:
			mount_color=1;  // Black drogmor
			npc_type->runspeed=MOUNT_SLOW1_RUN;
			break;
		case 3819:
			mount_color=1;  // Black drogmor
			npc_type->runspeed=MOUNT_SLOW2_RUN;
			break;
		case 3820:
			mount_color=1;  // Black drogmor
			npc_type->runspeed=MOUNT_RUN1_RUN;
			break;
		case 3821:
			mount_color=1;  // Black drogmor
			npc_type->runspeed=MOUNT_RUN2_RUN;
			break;
		case 3822:
			mount_color=1;  // Black drogmor
			npc_type->runspeed=MOUNT_FAST_RUN;
			break;
		case 3823:
			mount_color=2;  // Green drogmor
			npc_type->runspeed=MOUNT_SLOW1_RUN;
			break;
		case 3824:
			mount_color=2;  // Green drogmor
			npc_type->runspeed=MOUNT_SLOW2_RUN;
			break;
		case 3825:
			mount_color=2;  // Green drogmor
			npc_type->runspeed=MOUNT_RUN1_RUN;
			break;
		case 3826:
			mount_color=2;  // Green drogmor
			npc_type->runspeed=MOUNT_RUN2_RUN;
			break;
		case 3827:
			mount_color=2;  // Green drogmor
			npc_type->runspeed=MOUNT_FAST_RUN;
			break;
		case 3828:
			mount_color=3;  // Red drogmor
			npc_type->runspeed=MOUNT_SLOW1_RUN;
			break;
		case 3829:
			mount_color=3;  // Red drogmor
			npc_type->runspeed=MOUNT_SLOW2_RUN;
			break;
		case 3830:
			mount_color=3;  // Red drogmor
			npc_type->runspeed=MOUNT_RUN1_RUN;
			break;
		case 3831:
			mount_color=3;  // Red drogmor
			npc_type->runspeed=MOUNT_RUN2_RUN;
			break;
		case 3832:
			mount_color=3;  // Red drogmor
			npc_type->runspeed=MOUNT_FAST_RUN;
			break;
		case 2874:
			npc_type->runspeed=MOUNT_FAST_RUN;
			mount_color=1;
			break;
		case 2875:
			npc_type->runspeed=MOUNT_FAST_RUN;
			mount_color=2;
			break;			
		default:
/*			Message(13,"I dont know what mount spell this is! (%i)", spell_id);
			mount_color= 0;  // Brown horse
			npc_type->walkspeed=MOUNT_SLOW1_WALK;
			npc_type->runspeed=MOUNT_SLOW1_RUN;*/
			LogFile->write(EQEMuLog::Error, "Unknown mount spell id %d", spell_id);
			safe_delete(npc_type);
			return(NULL);
			break;
	}
	npc_type->texture = mount_color;

	npc_type->light = 0;
	npc_type->STR = 75;
	npc_type->STA = 75;
	npc_type->DEX = 75;
	npc_type->AGI = 75;
	npc_type->INT = 75;
	npc_type->WIS = 75;
	npc_type->CHA = 75;
	
	horses_auto_delete.Insert(npc_type);
	
	return(npc_type);
}
I am not quite sure what the best way is to pull info from the DB. I am also not yet sure on how to pull the filename from the spell to associate it with the matching filename field in the table when creating the horse.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 11-28-2008 at 02:36 PM..
Reply With Quote
  #5  
Old 11-28-2008, 07:34 AM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Yeah still not liking the sizes part, we know how to grab the current size even after shrunk or grown. I doubt people would really make much use of the sizes part too.

I'll look at the code and comment more when I've had more sleep though.
Reply With Quote
  #6  
Old 11-28-2008, 06:28 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ya, I don't think sizes would be required for any of the normal Horse/Drogmar/Mechboar mounts, but what if someone wanted to use a Tiger, Chokidai, Basilisk, or Alligator as a mount? Or, maybe even a boat as a mount for water or something. I am sure they would need a way to size them to players, since they aren't scaled that way by design.

It isn't required that we have the option to use other races as mounts, but I don't think it would be a bad option to have. I was mostly wanting to make it a table to allow custom speeds and the use of the mechboar mount model. I wouldn't mind seeing how well a Tiger (or whatever) might look as a mount though.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply


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 02:21 PM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3