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.
This commit is contained in:
Trevius 2014-11-28 20:23:42 -06:00
parent b7c19e4034
commit 84fa042c75
5 changed files with 24 additions and 11 deletions

View File

@ -1,6 +1,11 @@
EQEMu Changelog (Started on Sept 24, 2003 15:50) 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: 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. Trevius: Fix to prevent Mercenaries from being set as Group Leader.

View File

@ -768,7 +768,10 @@ uint32 Database::GetCharacterID(const char *name) {
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name); std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name);
auto results = QueryDatabase(query); auto results = QueryDatabase(query);
auto row = results.begin(); auto row = results.begin();
if (row[0]){ return atoi(row[0]); } if (results.RowCount() == 1)
{
return atoi(row[0]);
}
return 0; return 0;
} }
@ -3277,7 +3280,7 @@ char* Database::GetGroupLeaderForLogin(const char* name, char* leaderbuf) {
if (group_id == 0) if (group_id == 0)
return leaderbuf; 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); results = QueryDatabase(query);
for (auto row = results.begin(); row != results.end(); ++row) for (auto row = results.begin(); row != results.end(); ++row)

View File

@ -54,10 +54,10 @@ void Adventure::AddPlayer(std::string character_name, bool add_client_to_instanc
{ {
if(!PlayerExists(character_name)) if(!PlayerExists(character_name))
{ {
int client_id = database.GetCharacterID(character_name.c_str()); int32 character_id = database.GetCharacterID(character_name.c_str());
if(add_client_to_instance) if(character_id && add_client_to_instance)
{ {
database.AddClientToInstance(instance_id, client_id); database.AddClientToInstance(instance_id, character_id);
} }
players.push_back(character_name); players.push_back(character_name);
} }
@ -68,11 +68,16 @@ void Adventure::RemovePlayer(std::string character_name)
std::list<std::string>::iterator iter = players.begin(); std::list<std::string>::iterator iter = players.begin();
while(iter != players.end()) while(iter != players.end())
{ {
if((*iter).compare(character_name) == 0) if((*iter).compare(character_name) == 0)
{ {
database.RemoveClientFromInstance(instance_id, database.GetCharacterID(character_name.c_str())); int32 character_id = database.GetCharacterID(character_name.c_str());
players.erase(iter); if (character_id)
return; {
database.RemoveClientFromInstance(instance_id, character_id);
players.erase(iter);
return;
}
} }
++iter; ++iter;
} }

View File

@ -275,7 +275,7 @@ public:
int16 GetBuffSlotFromType(uint16 type); int16 GetBuffSlotFromType(uint16 type);
uint16 GetSpellIDFromSlot(uint8 slot); uint16 GetSpellIDFromSlot(uint8 slot);
int CountDispellableBuffs(); 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; } bool HasNumhits() const { return has_numhits; }
inline void Numhits(bool val) { has_numhits = val; } inline void Numhits(bool val) { has_numhits = val; }
bool HasMGB() const { return has_MGB; } bool HasMGB() const { return has_MGB; }

View File

@ -5558,7 +5558,7 @@ int16 Client::GetFocusEffect(focusType type, uint16 spell_id) {
return realTotal + realTotal2 + realTotal3; 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 Field 175 = numhits type