From b7c19e4034bc4523726d9f385a94e54b68cfac46 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 28 Nov 2014 02:19:45 -0500 Subject: [PATCH 1/3] Fix model_name in RoF Arrow_Struct --- common/patches/rof_structs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/patches/rof_structs.h b/common/patches/rof_structs.h index 0a62a90bf..075e6633b 100644 --- a/common/patches/rof_structs.h +++ b/common/patches/rof_structs.h @@ -4169,7 +4169,8 @@ struct Arrow_Struct { /*070*/ uint8 unknown070; /*071*/ uint8 item_type; /*072*/ uint8 skill; -/*073*/ char model_name[43]; +/*073*/ uint8 unknown073[16]; +/*089*/ char model_name[27]; /*116*/ }; From 84fa042c75a0dd0231d70f98e6bc90782b953e17 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 28 Nov 2014 20:23:42 -0600 Subject: [PATCH 2/3] Fixed a zone crash related to numhits for spells. Fixed a query related to group leaders logging in. Fixed a world crash related to attempting to join an adventure with Mercenaries. --- changelog.txt | 7 ++++++- common/database.cpp | 7 +++++-- world/adventure.cpp | 17 +++++++++++------ zone/mob.h | 2 +- zone/spell_effects.cpp | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/changelog.txt b/changelog.txt index b05fc26ee..cf7d51346 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,11 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- -== 11/24/2014 == +== 11/28/2014 == +Trevius: Fixed a zone crash related to numhits for spells. +Trevius: Fixed a query related to group leaders logging in. +Trevius (Natedog): Fixed a world crash related to attempting to join an adventure with Mercenaries. + +== 11/25/2014 == Trevius: Spells that modify model size are now limited to 2 size adjustments from the base size. Trevius: Fix to prevent Mercenaries from being set as Group Leader. diff --git a/common/database.cpp b/common/database.cpp index 558f1d5c0..e950d8bd4 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -768,7 +768,10 @@ uint32 Database::GetCharacterID(const char *name) { std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name); auto results = QueryDatabase(query); auto row = results.begin(); - if (row[0]){ return atoi(row[0]); } + if (results.RowCount() == 1) + { + return atoi(row[0]); + } return 0; } @@ -3277,7 +3280,7 @@ char* Database::GetGroupLeaderForLogin(const char* name, char* leaderbuf) { if (group_id == 0) return leaderbuf; - query = StringFormat("SELECT `leadername` FROM `group_leader` WHERE `gid` = '%u' AND `groupid` = %u LIMIT 1", group_id); + query = StringFormat("SELECT `leadername` FROM `group_leaders` WHERE `gid` = '%u' LIMIT 1", group_id); results = QueryDatabase(query); for (auto row = results.begin(); row != results.end(); ++row) diff --git a/world/adventure.cpp b/world/adventure.cpp index ffb64779c..979347409 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -54,10 +54,10 @@ void Adventure::AddPlayer(std::string character_name, bool add_client_to_instanc { if(!PlayerExists(character_name)) { - int client_id = database.GetCharacterID(character_name.c_str()); - if(add_client_to_instance) + int32 character_id = database.GetCharacterID(character_name.c_str()); + if(character_id && add_client_to_instance) { - database.AddClientToInstance(instance_id, client_id); + database.AddClientToInstance(instance_id, character_id); } players.push_back(character_name); } @@ -68,11 +68,16 @@ void Adventure::RemovePlayer(std::string character_name) std::list::iterator iter = players.begin(); while(iter != players.end()) { + if((*iter).compare(character_name) == 0) { - database.RemoveClientFromInstance(instance_id, database.GetCharacterID(character_name.c_str())); - players.erase(iter); - return; + int32 character_id = database.GetCharacterID(character_name.c_str()); + if (character_id) + { + database.RemoveClientFromInstance(instance_id, character_id); + players.erase(iter); + return; + } } ++iter; } diff --git a/zone/mob.h b/zone/mob.h index 525cbb2e8..944dfc515 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -275,7 +275,7 @@ public: int16 GetBuffSlotFromType(uint16 type); uint16 GetSpellIDFromSlot(uint8 slot); int CountDispellableBuffs(); - void CheckNumHitsRemaining(uint8 type, uint32 buff_slot=-1, uint16 spell_id=SPELL_UNKNOWN); + void CheckNumHitsRemaining(uint8 type, int32 buff_slot=-1, uint16 spell_id=SPELL_UNKNOWN); bool HasNumhits() const { return has_numhits; } inline void Numhits(bool val) { has_numhits = val; } bool HasMGB() const { return has_MGB; } diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 4a73926c3..b55102072 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -5558,7 +5558,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) { return realTotal + realTotal2 + realTotal3; } -void Mob::CheckNumHitsRemaining(uint8 type, uint32 buff_slot, uint16 spell_id) +void Mob::CheckNumHitsRemaining(uint8 type, int32 buff_slot, uint16 spell_id) { /* Field 175 = numhits type From 8cd19670abef46d5bb0887d16f906a9c32f96f04 Mon Sep 17 00:00:00 2001 From: Trevius Date: Fri, 28 Nov 2014 20:30:35 -0600 Subject: [PATCH 3/3] Minor improvement to last commit. --- world/adventure.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/world/adventure.cpp b/world/adventure.cpp index 979347409..80b1dcaca 100644 --- a/world/adventure.cpp +++ b/world/adventure.cpp @@ -68,7 +68,6 @@ void Adventure::RemovePlayer(std::string character_name) std::list::iterator iter = players.begin(); while(iter != players.end()) { - if((*iter).compare(character_name) == 0) { int32 character_id = database.GetCharacterID(character_name.c_str()); @@ -76,8 +75,8 @@ void Adventure::RemovePlayer(std::string character_name) { database.RemoveClientFromInstance(instance_id, character_id); players.erase(iter); - return; } + return; } ++iter; }