Fix merc attack delay

This commit is contained in:
Michael Cook (mackal) 2015-01-30 01:33:55 -05:00
parent 0aba2d578a
commit 8ec1cb949a
5 changed files with 116 additions and 111 deletions

View File

@ -30,7 +30,7 @@
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/ */
#define CURRENT_BINARY_DATABASE_VERSION 9071 #define CURRENT_BINARY_DATABASE_VERSION 9072
#define COMPILE_DATE __DATE__ #define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__ #define COMPILE_TIME __TIME__
#ifndef WIN32 #ifndef WIN32

View File

@ -325,6 +325,7 @@
9069|2015_01_25_logsys_Mercenaries_category.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Mercenaries'|empty| 9069|2015_01_25_logsys_Mercenaries_category.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Mercenaries'|empty|
9070|2015_01_28_quest_debug_log_category.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Quest Debug'|empty| 9070|2015_01_28_quest_debug_log_category.sql|SELECT * FROM `logsys_categories` WHERE `log_category_description` LIKE 'Quest Debug'|empty|
9071|2015_01_29_merc_stats_table_update.sql|SHOW COLUMNS FROM `merc_stats` LIKE 'statscale'|empty| 9071|2015_01_29_merc_stats_table_update.sql|SHOW COLUMNS FROM `merc_stats` LIKE 'statscale'|empty|
9072|2015_01_30_attack_delay.sql|SHOW COLUMNS FROM `merc_stats` LIKE 'attack_delay'|empty|
# Upgrade conditions: # Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not # This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1,3 @@
ALTER TABLE `merc_stats` ADD `attack_delay` TINYINT(3) UNSIGNED DEFAULT '30' NOT NULL AFTER `attack_speed`;
UPDATE `merc_stats` SET `attack_delay` = 36 + 36 * (`attack_speed` / 100);
UPDATE `merc_stats` SET `attack_delay` = 30 WHERE `attack_speed` = 0;

View File

@ -4837,13 +4837,14 @@ void Merc::UpdateMercInfo(Client *c) {
c->GetMercInfo().drakkinDetails = drakkin_details; c->GetMercInfo().drakkinDetails = drakkin_details;
} }
void Merc::UpdateMercStats(Client *c, bool setmax) { void Merc::UpdateMercStats(Client *c, bool setmax)
if(c->GetMercInfo().MercTemplateID > 0)
{
Log.Out(Logs::General, Logs::Mercenaries, "Updating Mercenary Stats for %s (%s).", GetName(), c->GetName());
const NPCType* npc_type = database.GetMercType( zone->GetMercTemplate(c->GetMercInfo().MercTemplateID)->MercNPCID, GetRace(), c->GetLevel());
if (npc_type)
{ {
if (c->GetMercInfo().MercTemplateID > 0) {
Log.Out(Logs::General, Logs::Mercenaries, "Updating Mercenary Stats for %s (%s).", GetName(),
c->GetName());
const NPCType *npc_type = database.GetMercType(
zone->GetMercTemplate(c->GetMercInfo().MercTemplateID)->MercNPCID, GetRace(), c->GetLevel());
if (npc_type) {
max_hp = npc_type->max_hp; max_hp = npc_type->max_hp;
base_hp = npc_type->max_hp; base_hp = npc_type->max_hp;
max_mana = npc_type->Mana; max_mana = npc_type->Mana;
@ -4878,7 +4879,7 @@ void Merc::UpdateMercStats(Client *c, bool setmax) {
level = npc_type->level; level = npc_type->level;
attack_count = npc_type->attack_count; attack_count = npc_type->attack_count;
attack_speed = npc_type->attack_speed; attack_delay = npc_type->attack_delay;
spellscale = npc_type->spellscale; spellscale = npc_type->spellscale;
healscale = npc_type->healscale; healscale = npc_type->healscale;

View File

@ -1937,8 +1937,8 @@ const NPCType* ZoneDatabase::GetNPCType (uint32 id) {
return npc; return npc;
} }
const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 clientlevel) { const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 clientlevel)
{
//need to save based on merc_npc_type & client level //need to save based on merc_npc_type & client level
uint32 merc_type_id = id * 100 + clientlevel; uint32 merc_type_id = id * 100 + clientlevel;
@ -1963,7 +1963,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
"0 AS gender, " "0 AS gender, "
"m_armorinfo.texture, " "m_armorinfo.texture, "
"m_armorinfo.helmtexture, " "m_armorinfo.helmtexture, "
"m_stats.attack_speed, " "m_stats.attack_delay, "
"m_stats.STR, " "m_stats.STR, "
"m_stats.STA, " "m_stats.STA, "
"m_stats.DEX, " "m_stats.DEX, "
@ -2041,7 +2041,7 @@ const NPCType* ZoneDatabase::GetMercType(uint32 id, uint16 raceid, uint32 client
tmpNPCType->gender = atoi(row[7]); tmpNPCType->gender = atoi(row[7]);
tmpNPCType->texture = atoi(row[8]); tmpNPCType->texture = atoi(row[8]);
tmpNPCType->helmtexture = atoi(row[9]); tmpNPCType->helmtexture = atoi(row[9]);
tmpNPCType->attack_speed = atof(row[10]); tmpNPCType->attack_delay = atoi(row[10]);
tmpNPCType->STR = atoi(row[11]); tmpNPCType->STR = atoi(row[11]);
tmpNPCType->STA = atoi(row[12]); tmpNPCType->STA = atoi(row[12]);
tmpNPCType->DEX = atoi(row[13]); tmpNPCType->DEX = atoi(row[13]);