diff --git a/common/database.cpp b/common/database.cpp index 8ff79a44c..0af9169e5 100644 --- a/common/database.cpp +++ b/common/database.cpp @@ -1408,25 +1408,39 @@ uint8 Database::GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 return base_cap; } -uint32 Database::GetCharacterInfo(const char* iName, uint32* oAccID, uint32* oZoneID, uint32* oInstanceID, float* oX, float* oY, float* oZ) { - std::string query = StringFormat("SELECT `id`, `account_id`, `zone_id`, `zone_instance`, `x`, `y`, `z` FROM `character_data` WHERE `name` = '%s'", iName); +uint32 Database::GetCharacterInfo( + const char *iName, + uint32 *oAccID, + uint32 *oZoneID, + uint32 *oInstanceID, + float *oX, + float *oY, + float *oZ +) +{ + std::string query = StringFormat( + "SELECT `id`, `account_id`, `zone_id`, `zone_instance`, `x`, `y`, `z` FROM `character_data` WHERE `name` = '%s'", + EscapeString(iName).c_str() + ); + auto results = QueryDatabase(query); if (!results.Success()) { return 0; } - if (results.RowCount() != 1) + if (results.RowCount() != 1) { return 0; + } - auto row = results.begin(); + auto row = results.begin(); uint32 charid = atoi(row[0]); - if (oAccID){ *oAccID = atoi(row[1]); } - if (oZoneID){ *oZoneID = atoi(row[2]); } - if (oInstanceID){ *oInstanceID = atoi(row[3]); } - if (oX){ *oX = atof(row[4]); } - if (oY){ *oY = atof(row[5]); } - if (oZ){ *oZ = atof(row[6]); } + if (oAccID) { *oAccID = atoi(row[1]); } + if (oZoneID) { *oZoneID = atoi(row[2]); } + if (oInstanceID) { *oInstanceID = atoi(row[3]); } + if (oX) { *oX = atof(row[4]); } + if (oY) { *oY = atof(row[5]); } + if (oZ) { *oZ = atof(row[6]); } return charid; } diff --git a/zone/zone.cpp b/zone/zone.cpp index c6f5c8ac5..3fa3e5370 100755 --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -54,6 +54,7 @@ #include "zone.h" #include "zone_config.h" #include "mob_movement_manager.h" +#include "npc_scale_manager.h" #include #include @@ -65,8 +66,6 @@ #define strcasecmp _stricmp #endif - - extern bool staticzone; extern NetConnection net; extern PetitionList petition_list; @@ -74,6 +73,7 @@ extern QuestParserCollection* parse; extern uint32 numclients; extern WorldServer worldserver; extern Zone* zone; +extern NpcScaleManager* npc_scale_manager; Mutex MZoneShutdown; @@ -1509,18 +1509,22 @@ void Zone::RepopClose(const glm::vec4& client_position, uint32 repop_distance) mod_repop(); } -void Zone::Repop(uint32 delay) { +void Zone::Repop(uint32 delay) +{ - if(!Depop()) + if (!Depop()) { return; + } - LinkedListIterator iterator(spawn2_list); + LinkedListIterator iterator(spawn2_list); iterator.Reset(); while (iterator.MoreElements()) { iterator.RemoveCurrent(); } + npc_scale_manager->LoadScaleData(); + entity_list.ClearTrapPointers(); quest_manager.ClearAllTimers();