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

11-28-2008, 07:34 AM
|
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
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.
|

11-28-2008, 06:28 PM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
|
 |
|
 |

11-29-2008, 09:31 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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');
Last edited by trevius; 12-01-2008 at 08:45 AM..
|
 |
|
 |
 |
|
 |

11-29-2008, 10:09 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
|
 |
|
 |
 |
|
 |

11-30-2008, 08:17 AM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
|
 |
|
 |
 |
|
 |

11-30-2008, 04:25 PM
|
|
Administrator
|
|
Join Date: Sep 2006
Posts: 1,348
|
|
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..
|
 |
|
 |
 |
|
 |

11-30-2008, 07:13 PM
|
 |
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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.
Last edited by trevius; 12-01-2008 at 04:09 AM..
|
 |
|
 |
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 08:33 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |