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
  #7  
Old 11-29-2008, 09:31 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I think I have everything working now. I tried messing with custom mounts and they won't work. I think the client blocks them from being used. But, the mechboars do work

In horse.cpp add these lines:
Code:
#include "../common/packet_functions.h"
#include "../common/packet_dump.h"
#include "worldserver.h"
These were needed to get the MakeAnyLenString to compile properly. I don't know if we need all 3 of those lines, but it worked that way.

Also, replace the whole Horse::BuildHorseType section with this:
Code:
const NPCType *Horse::BuildHorseType(int16 spell_id) {

	const char* FileName = spells[spell_id].teleport_zone;

	char mount_color = 0;

	char errbuf[MYSQL_ERRMSG_SIZE];
	char *query = 0;
	MYSQL_RES *result;
	MYSQL_ROW row;

	if (database.RunQuery(query,MakeAnyLenString(&query, "SELECT race,gender,texture,mountspeed FROM horses WHERE filename='%s'", FileName), errbuf, &result)) {

		safe_delete_array(query);
		if (mysql_num_rows(result) == 1) {

			row = mysql_fetch_row(result);

			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 = atoi(row[0]);
			npc_type->gender = atoi(row[1]); // 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;
			npc_type->texture = atoi(row[2]);
			npc_type->runspeed = atof(row[3]);

			mount_color = atoi(row[2]);

			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);
			mysql_free_result(result);
		}
		else {
			LogFile->write(EQEMuLog::Error, "No Database entry for mount: %s, check the horses table", FileName);
			Message(13, "Unable to find data for mount %s", FileName);
			safe_delete_array(query);
		}
		mysql_free_result(result);
	}
	else {
		LogFile->write(EQEMuLog::Error, "Error in Mount query '%s': %s", query,  errbuf);
		safe_delete_array(query);
	}
		
}
I will do some more testing with it. I did notice a couple cases where the wrong texture or speed was used. I am not sure why just yet. It may have just been because I was messing with the table.

Here is the dump of my semi-completed table (should match everthing that was previously in the code, and also include all mount filenames up to live):

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 '0.75',
  `notes` varchar(64) default 'Notes',
  PRIMARY KEY  (`id`,`filename`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


INSERT INTO `horses` VALUES ('1', 'SumChimeraFast', '216', '0', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('2', 'SumCragslither1Fast', '436', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('3', 'SumCragslither2Fast', '436', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('4', 'SumCragslither3Fast', '436', '2', '1', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('5', 'SumHorseBlFast', '216', '0', '2', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('6', 'SumHorseBlRun1', '216', '0', '2', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('7', 'SumHorseBlRun2', '216', '0', '2', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('8', 'SumHorseBlSlow1', '216', '0', '2', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('9', 'SumHorseBlSlow2', '216', '0', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('10', 'SumHorseBrFast', '216', '0', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('11', 'SumHorseBrRun1', '216', '0', '0', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('12', 'SumHorseBrRun2', '216', '0', '0', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('13', 'SumHorseBrSlow1', '216', '0', '0', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('14', 'SumHorseBrSlow2', '216', '0', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('15', 'SumHorseTaFast', '216', '0', '3', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('16', 'SumHorseTaRun1', '216', '0', '3', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('17', 'SumHorseTaRun2', '216', '0', '3', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('18', 'SumHorseTaSlow1', '216', '0', '3', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('19', 'SumHorseTaSlow2', '216', '0', '3', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('20', 'SumHorseWhFast', '216', '0', '1', '1.75', '2871 - Summon Horse SumHorseWhFast');
INSERT INTO `horses` VALUES ('21', 'SumHorseWhRun1', '216', '0', '1', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('22', 'SumHorseWhRun2', '216', '0', '1', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('23', 'SumHorseWhSlow1', '216', '0', '1', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('24', 'SumHorseWhSlow2', '216', '0', '1', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('25', 'SumKirin0Fast', '356', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('26', 'SumKirin2Fast', '356', '2', '1', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('27', 'SumLizardBlkFast', '216', '1', '1', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('28', 'SumLizardBlkRun1', '216', '1', '1', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('29', 'SumLizardBlkRun2', '216', '1', '1', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('30', 'SumLizardBlkSlow1', '216', '1', '1', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('31', 'SumLizardBlkSlow2', '216', '1', '1', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('32', 'SumLizardGrnFast', '216', '1', '2', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('33', 'SumLizardGrnRun1', '216', '1', '2', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('34', 'SumLizardGrnRun2', '216', '1', '2', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('35', 'SumLizardGrnSlow1', '216', '1', '2', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('36', 'SumLizardGrnSlow2', '216', '1', '2', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('37', 'SumLizardRedFast', '216', '1', '3', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('38', 'SumLizardRedRun1', '216', '1', '3', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('39', 'SumLizardRedRun2', '216', '1', '3', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('40', 'SumLizardRedSlow1', '216', '1', '3', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('41', 'SumLizardRedSlow2', '216', '1', '3', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('42', 'SumLizardWhtFast', '216', '1', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('43', 'SumLizardWhtRun1', '216', '1', '0', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('44', 'SumLizardWhtRun2', '216', '1', '0', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('45', 'SumLizardWhtSlow1', '216', '1', '0', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('46', 'SumLizardWhtSlow2', '216', '1', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('47', 'SumNightmareFast', '42', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('48', 'SumPuma1Fast', '63', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('49', 'SumPuma3Fast', '63', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('50', 'SumRoboboar', '472', '2', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('51', 'SumRoboboarFast', '472', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('52', 'SumRoboboarRun1', '472', '2', '0', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('53', 'SumRoboboarRun2', '472', '2', '0', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('54', 'SumRoboboarSlow2', '472', '2', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('55', 'SumUnicornFast', '216', '0', '1', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('56', 'SumWarHorseBlFast', '216', '0', '2', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('57', 'SumWarHorseBlRun1', '216', '0', '2', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('58', 'SumWarHorseBlRun2', '216', '0', '2', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('59', 'SumWarHorseBlSlow1', '216', '0', '2', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('60', 'SumWarHorseBlSlow2', '216', '0', '2', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('61', 'SumWarHorseBrFast', '216', '0', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('62', 'SumWarHorseBrRun1', '216', '0', '0', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('63', 'SumWarHorseBrRun2', '216', '0', '0', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('64', 'SumWarHorseBrSlow1', '216', '0', '0', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('65', 'SumWarHorseBrSlow2', '216', '0', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('66', 'SumWarHorseTaFast', '216', '0', '3', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('67', 'SumWarHorseTaRun1', '216', '0', '3', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('68', 'SumWarHorseTaRun2', '216', '0', '3', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('69', 'SumWarHorseTaSlow1', '216', '0', '3', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('70', 'SumWarHorseTaSlow2', '216', '0', '3', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('71', 'SumWarHorseWhFast', '216', '0', '1', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('72', 'SumWarHorseWhRun1', '216', '0', '1', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('73', 'SumWarHorseWhRun2', '216', '0', '1', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('74', 'SumWarHorseWhSlow1', '216', '0', '1', '0.75', 'Notes');
INSERT INTO `horses` VALUES ('75', 'SumWarHorseWhSlow2', '216', '0', '1', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('76', 'SumWorgFastClaimDigital', '42', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('77', 'SumWorgFastClaimRetailBox', '42', '2', '0', '1.75', 'Notes');
INSERT INTO `horses` VALUES ('78', 'SumWorgRun1ClaimDigital', '42', '2', '0', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('79', 'SumWorgRun1ClaimRetailBox', '42', '2', '0', '1.25', 'Notes');
INSERT INTO `horses` VALUES ('80', 'SumWorgRun2ClaimDigital', '42', '2', '0', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('81', 'SumWorgRun2ClaimRetailBox', '42', '2', '0', '1.50', 'Notes');
INSERT INTO `horses` VALUES ('82', 'SumWorgSlow2ClaimDigital', '42', '2', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('83', 'SumWorgSlow2ClaimRetailBox', '42', '2', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('84', 'TestHorseA', '216', '0', '0', '1.00', 'Notes');
INSERT INTO `horses` VALUES ('85', 'TestWarHorseA\r\nTestHorseA\r\nTestH', '216', '0', '0', '1.00', 'Notes');
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 12-01-2008 at 08:45 AM..
Reply With Quote
  #8  
Old 11-29-2008, 10:09 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

It looks like we will need to change this as well:

effects.cpp
Code:
void EntityList::AEAttack(Mob *attacker, float dist, int Hand, int count) {
//Dook- Will need tweaking, currently no pets or players or horses 
	LinkedListIterator<Mob*> iterator(mob_list); 
	Mob *curmob; 
	
	float dist2 = dist * dist;
	
	int hit = 0;
	
	for(iterator.Reset(); iterator.MoreElements(); iterator.Advance()) { 
		curmob = iterator.GetData(); 
		if(curmob->IsNPC()
			&& curmob != attacker //this is not needed unless NPCs can use this
			&&(attacker->IsAttackAllowed(curmob))
			&& curmob->GetRace() != 216 /* dont attack horses */
			&& (curmob->DistNoRoot(*attacker) <= dist2)
		) {
			attacker->Attack(curmob, Hand); 
			hit++;
			if(count != 0 && hit >= count)
				return;
		}
	}    
}
I think we can just change that line to this:
Code:
&& curmob->GetRace() != 216 && curmob->GetRace() != 472 /* dont attack horses */
This is to keep AEs from hitting mounts. I will look through for more possible issues. After further testing, all seems well accept for the slowest mounts aren't moving. They are set to 0.75 speed, so maybe that has something to do with it.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #9  
Old 11-30-2008, 08:17 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

There are still 2 issues holding me back from being able to get this added to SVN. The first issue is that the 0.75 speed mounts don't move at all. It almost seems like it is setting the speed to 0 for some reason. It worked fine for the old way horses were done, but doesn't seem to work in the new way.

The second issue is that if you #cast the spell, the mount summons almost instantly, but if you try to use the actual bridles, it delays the spell for a while. The mount does still cast, but it takes probably 5 or 10 seconds after the spell finishes casting before the mount actually gets summoned. I am not sure what is causing this extra cast time yet. It almost seems like the displayed cast time and actual cast time settings for the bridles are not the same times. But, checking the items show that they are.

If anyone wants to check this out and/or maybe give a little help, it would be appreciated. I think this is mostly done. Other than those 2 issues, the rest seems to work great.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #10  
Old 11-30-2008, 04:25 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Why did you not just store mountspeed as a float? Why do this extra work when you could just do:

Code:
npc_type->runspeed = atof(row[3])
Here's an explanation of what's going wrong with your runspeed by doing it this way:
Code:
npc_type->runspeed = mountspeed / 100;

if it's 125:
npc_type->runspeed = 125 / 100;
npc_type->runspeed = 1

if it's 100:
npc_type->runspeed = 100 / 100; 
npc_type->runspeed = 1

if it's 75:
npc_type->runspeed = 75 / 100;
npc_type->runspeed = 0
None of them are floats and ints will not do any rounding for you if it comes up with a partial during a divide it is dropped. Unless you cast the variables to float first you're not going to get anywhere.

Also there's no reason to assign temp variables to hold the information from db as you don't do anything else with it, you're plugging it straight into the NPCType. Waste of time and memory however small it may be.

Last edited by KLS; 12-01-2008 at 12:33 AM..
Reply With Quote
  #11  
Old 11-30-2008, 07:13 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Thanks KLS. I originally had it set as a float and it was still having the same problem for some reason, which is why I tried changing it to just be an int16. I will set it all back as a float again and rewrite the code like you suggested since it doesn't need variables. Maybe I was just missing something when I set it as a float before.

That should resolve that issue hopefully. Then, I will just need to figure out why clickie items for horses seem to have some long extra delay.

Editing the code in the post above, but I will need to test it later tonight before I know if it helped or not.

EDIT: LMAO, I just figured out why the float I set before wasn't working. It is because I was using atoi and not atof. I didn't really know what they meant until I looked at your suggestion again and noticed you had atof. I thought about it a sec and realized that the last letter must mean float, as apposed to int from the last letter of atoi. LOL, I really should start reading up on how to code in C++ instead of just learning from examples like that :P

Any clue why the bridles would have such a delayed casting? Maybe it is just an issue with my test server. I will have to try some other item clickies and see what happens.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by trevius; 12-01-2008 at 04:09 AM..
Reply With Quote
  #12  
Old 11-30-2008, 09:25 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

Nothing I see there should cause delayed casting. Maybe if the mysql server was so lagged that it took a long time per query but odds are you'd notice other things too in that case. Like startup or looting lag.
Reply With Quote
  #13  
Old 11-30-2008, 10:45 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Since I am trying it on my test server, it may be some other custom code I am have been trying on it that is causing the extra cast time for mounts from clickies. When I use #cast, it works instantly, so it shouldn't be database delay.

If I get this tested and confirm that it all works perfectly, does anyone have any issues with me adding this to the SVN? I will add the required SQL as well, which will include the full mount table. The only mounts that work in Titanium are Horses, Drogmors and Mechboars, so all of the other ones in the table are mostly just placeholders for later expansions. I put in some global races other than horses for the mounts that can't be used in Titanium. They don't work as mounts, but they don't have models anyway, so I don't think it will be an issue.

Also, I seem to remember certain mounts being slightly faster than the fastest purchasable ones. I thought the knights' AA mount was one of the fastest, but maybe it is the same speed as the ornate ones. At least these will be really easy to change and tweak with the new table

Thanks again for the insight, KLS. One more thing done on the list
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #14  
Old 11-30-2008, 11:33 PM
KLS
Administrator
 
Join Date: Sep 2006
Posts: 1,348
Default

I have no problem with it being added assuming you fix what I told ya!
Reply With Quote
  #15  
Old 11-30-2008, 11:47 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I already edited the changes you suggested into the code post above. I will test it out later and verify that it all works as intended. Lemme know if you see anything wrong still with the code above.
__________________
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 12:47 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3