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.