diff --git a/data-otservbr-global/monster/humans/nomad_blue.lua b/data-otservbr-global/monster/humans/nomad_blue.lua index 07ba7aff29a..e59e9511ad9 100644 --- a/data-otservbr-global/monster/humans/nomad_blue.lua +++ b/data-otservbr-global/monster/humans/nomad_blue.lua @@ -18,7 +18,7 @@ monster.events = { "NomadDeath", } -monster.raceId = 777 +monster.raceId = 776 monster.Bestiary = { class = "Human", race = BESTY_RACE_HUMAN, diff --git a/data-otservbr-global/monster/humans/nomad_female.lua b/data-otservbr-global/monster/humans/nomad_female.lua index 9460aab59cf..de49e1f6cc4 100644 --- a/data-otservbr-global/monster/humans/nomad_female.lua +++ b/data-otservbr-global/monster/humans/nomad_female.lua @@ -18,7 +18,7 @@ monster.events = { "NomadDeath", } -monster.raceId = 776 +monster.raceId = 777 monster.Bestiary = { class = "Human", race = BESTY_RACE_HUMAN, diff --git a/src/creatures/creature.cpp b/src/creatures/creature.cpp index e3b6d539ca4..381677ca611 100644 --- a/src/creatures/creature.cpp +++ b/src/creatures/creature.cpp @@ -632,7 +632,7 @@ void Creature::onDeath() { bool mostDamageUnjustified = false; std::shared_ptr lastHitCreature = g_game().getCreatureByID(lastHitCreatureId); std::shared_ptr lastHitCreatureMaster; - if (lastHitCreature) { + if (lastHitCreature && !getMonster()) { lastHitUnjustified = lastHitCreature->onKilledCreature(static_self_cast(), true); lastHitCreatureMaster = lastHitCreature->getMaster(); } else { @@ -679,7 +679,7 @@ void Creature::onDeath() { it.first->onGainExperience(it.second, getCreature()); } - if (mostDamageCreature && mostDamageCreature != lastHitCreature && mostDamageCreature != lastHitCreatureMaster) { + if (mostDamageCreature && (mostDamageCreature != lastHitCreature || getMonster()) && mostDamageCreature != lastHitCreatureMaster) { auto mostDamageCreatureMaster = mostDamageCreature->getMaster(); if (lastHitCreature != mostDamageCreatureMaster && (lastHitCreatureMaster == nullptr || mostDamageCreatureMaster != lastHitCreatureMaster)) { mostDamageUnjustified = mostDamageCreature->onKilledCreature(static_self_cast(), false); diff --git a/src/io/iologindata.cpp b/src/io/iologindata.cpp index d454cd32bdb..f2d42ad5459 100644 --- a/src/io/iologindata.cpp +++ b/src/io/iologindata.cpp @@ -83,22 +83,22 @@ void IOLoginData::updateOnlineStatus(uint32_t guid, bool login) { Database::getInstance().executeQuery(query.str()); } -// The boolean "disable" will desactivate the loading of information that is not relevant to the preload, for example, forge, bosstiary, etc. None of this we need to access if the player is offline -bool IOLoginData::loadPlayerById(std::shared_ptr player, uint32_t id, bool disable /* = true*/) { +// The boolean "disableIrrelevantInfo" will desactivate the loading of information that is not relevant to the preload, for example, forge, bosstiary, etc. None of this we need to access if the player is offline +bool IOLoginData::loadPlayerById(std::shared_ptr player, uint32_t id, bool disableIrrelevantInfo /* = true*/) { Database &db = Database::getInstance(); std::ostringstream query; query << "SELECT * FROM `players` WHERE `id` = " << id; - return loadPlayer(player, db.storeQuery(query.str()), disable); + return loadPlayer(player, db.storeQuery(query.str()), disableIrrelevantInfo); } -bool IOLoginData::loadPlayerByName(std::shared_ptr player, const std::string &name, bool disable /* = true*/) { +bool IOLoginData::loadPlayerByName(std::shared_ptr player, const std::string &name, bool disableIrrelevantInfo /* = true*/) { Database &db = Database::getInstance(); std::ostringstream query; query << "SELECT * FROM `players` WHERE `name` = " << db.escapeString(name); - return loadPlayer(player, db.storeQuery(query.str()), disable); + return loadPlayer(player, db.storeQuery(query.str()), disableIrrelevantInfo); } -bool IOLoginData::loadPlayer(std::shared_ptr player, DBResult_ptr result, bool disable /* = false*/) { +bool IOLoginData::loadPlayer(std::shared_ptr player, DBResult_ptr result, bool disableIrrelevantInfo /* = false*/) { if (!result || !player) { std::string nullptrType = !result ? "Result" : "Player"; g_logger().warn("[{}] - {} is nullptr", __FUNCTION__, nullptrType); @@ -166,6 +166,10 @@ bool IOLoginData::loadPlayer(std::shared_ptr player, DBResult_ptr result // Load task hunting class IOLoginDataLoad::loadPlayerTaskHuntingClass(player, result); + if (disableIrrelevantInfo) { + return true; + } + // load forge history IOLoginDataLoad::loadPlayerForgeHistory(player, result); diff --git a/src/io/iologindata.hpp b/src/io/iologindata.hpp index 724967d2877..804584cd9d3 100644 --- a/src/io/iologindata.hpp +++ b/src/io/iologindata.hpp @@ -20,9 +20,9 @@ class IOLoginData { static bool gameWorldAuthentication(const std::string &accountDescriptor, const std::string &sessionOrPassword, std::string &characterName, uint32_t &accountId, bool oldProcotol); static account::AccountType getAccountType(uint32_t accountId); static void updateOnlineStatus(uint32_t guid, bool login); - static bool loadPlayerById(std::shared_ptr player, uint32_t id, bool disable = true); - static bool loadPlayerByName(std::shared_ptr player, const std::string &name, bool disable = true); - static bool loadPlayer(std::shared_ptr player, DBResult_ptr result, bool disable = true); + static bool loadPlayerById(std::shared_ptr player, uint32_t id, bool disableIrrelevantInfo = true); + static bool loadPlayerByName(std::shared_ptr player, const std::string &name, bool disableIrrelevantInfo = true); + static bool loadPlayer(std::shared_ptr player, DBResult_ptr result, bool disableIrrelevantInfo = false); static bool savePlayer(std::shared_ptr player); static uint32_t getGuidByName(const std::string &name); static bool getGuidByNameEx(uint32_t &guid, bool &specialVip, std::string &name);