Reload scaling data on repop

This commit is contained in:
Akkadius 2019-01-02 02:36:12 -06:00
parent df68ad6358
commit 4ba5ef9170
2 changed files with 33 additions and 15 deletions

View File

@ -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;
}

View File

@ -54,6 +54,7 @@
#include "zone.h"
#include "zone_config.h"
#include "mob_movement_manager.h"
#include "npc_scale_manager.h"
#include <time.h>
#include <ctime>
@ -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<Spawn2*> iterator(spawn2_list);
LinkedListIterator<Spawn2 *> iterator(spawn2_list);
iterator.Reset();
while (iterator.MoreElements()) {
iterator.RemoveCurrent();
}
npc_scale_manager->LoadScaleData();
entity_list.ClearTrapPointers();
quest_manager.ClearAllTimers();