Merge branch 'master' into ScheduleCreatureRespawn

This commit is contained in:
天鹭 2025-10-11 09:13:48 +08:00 committed by GitHub
commit f3fc1b6e49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 85 additions and 64 deletions

View File

@ -0,0 +1,4 @@
-- DB update 2025_10_09_04 -> 2025_10_10_00
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 13082) AND (`source_type` = 0) AND (`id` = 2);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(13082, 0, 2, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 3, 0, 4016, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Milton Beats - On Respawn - Morph To Model 4016');

View File

@ -0,0 +1,5 @@
-- DB update 2025_10_10_00 -> 2025_10_10_01
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 23723;
DELETE FROM `smart_scripts` WHERE (`entryorguid` = 23723) AND (`source_type` = 0) AND (`id` = 0);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(23723, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 0, 0, 3, 0, 2981, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Sergeant Lukas - On Respawn - Morph To Model 2981');

View File

@ -342,6 +342,7 @@ foreach(ModuleName ${MODULE_LIST__})
foreach(configFileName ${MODULE_CONFIG_LIST})
CopyModuleConfig("${MODULE_CONFIG_PATH}/${configFileName}")
string(REGEX REPLACE "\.dist$" "" configFileName ${configFileName})
set(CONFIG_LIST ${CONFIG_LIST}${configFileName},)
message(STATUS " | * ${configFileName}")
endforeach()

View File

@ -412,8 +412,14 @@ T ConfigMgr::GetValueDefault(std::string const& name, T const& def, bool showLog
LOG_FATAL("server.loading", "> Config:\n\nFATAL ERROR: Missing property {} in config file {}, add \"{} = {}\" to this file or define '{}' as an environment variable\n\nYour server cannot start without this option!",
name, _filename, name, Acore::ToString(def), envVarName);
else
{
std::string configs = _filename;
if (!_moduleConfigFiles.empty())
configs += " or module config";
LOG_WARN("server.loading", "> Config: Missing property {} in config file {}, add \"{} = {}\" to this file or define '{}' as an environment variable.",
name, _filename, name, Acore::ToString(def), envVarName);
name, configs, name, def, envVarName);
}
}
return def;
}
@ -471,8 +477,14 @@ std::string ConfigMgr::GetValueDefault<std::string>(std::string const& name, std
LOG_FATAL("server.loading", "> Config:\n\nFATAL ERROR: Missing property {} in config file {}, add \"{} = {}\" to this file or define '{}' as an environment variable.\n\nYour server cannot start without this option!",
name, _filename, name, def, envVarName);
else
{
std::string configs = _filename;
if (!_moduleConfigFiles.empty())
configs += " or module config";
LOG_WARN("server.loading", "> Config: Missing property {} in config file {}, add \"{} = {}\" to this file or define '{}' as an environment variable.",
name, _filename, name, def, envVarName);
name, configs, name, def, envVarName);
}
}
return def;
@ -588,38 +600,13 @@ bool ConfigMgr::LoadModulesConfigs(bool isReload /*= false*/, bool isNeedPrintIn
// Start loading module configs
std::string const& moduleConfigPath = GetConfigPath() + "modules/";
bool isExistDefaultConfig = true;
bool isExistDistConfig = true;
for (auto const& distFileName : _additonalFiles)
for (auto const& fileName : _additonalFiles)
{
std::string defaultFileName = distFileName;
bool isExistConfig = LoadAdditionalFile(moduleConfigPath + fileName, false, isReload);
if (!defaultFileName.empty())
{
defaultFileName.erase(defaultFileName.end() - 5, defaultFileName.end());
}
// Load .conf.dist config
isExistDistConfig = LoadAdditionalFile(moduleConfigPath + distFileName, false, isReload);
if (!isReload && !isExistDistConfig)
{
LOG_FATAL("server.loading", "> ConfigMgr::LoadModulesConfigs: Not found original config '{}'. Stop loading", distFileName);
ABORT();
}
// Load .conf config
isExistDefaultConfig = LoadAdditionalFile(moduleConfigPath + defaultFileName, true, isReload);
if (isExistDefaultConfig && isExistDistConfig)
{
_moduleConfigFiles.emplace_back(defaultFileName);
}
else if (!isExistDefaultConfig && isExistDistConfig)
{
_moduleConfigFiles.emplace_back(distFileName);
}
if (isExistConfig)
_moduleConfigFiles.emplace_back(fileName);
}
if (isNeedPrintInfo)

View File

@ -1731,34 +1731,40 @@ void GameObject::Use(Unit* user)
uint32 zone, subzone;
GetZoneAndAreaId(zone, subzone);
int32 zone_skill = sObjectMgr->GetFishingBaseSkillLevel(subzone);
if (!zone_skill)
zone_skill = sObjectMgr->GetFishingBaseSkillLevel(zone);
int32 zoneSkill = sObjectMgr->GetFishingBaseSkillLevel(subzone);
if (!zoneSkill)
zoneSkill = sObjectMgr->GetFishingBaseSkillLevel(zone);
//provide error, no fishable zone or area should be 0
if (!zone_skill)
if (!zoneSkill)
LOG_ERROR("sql.sql", "Fishable areaId {} are not properly defined in `skill_fishing_base_level`.", subzone);
int32 skill = player->GetSkillValue(SKILL_FISHING);
// no miss skill is zone skill + 95 since at least patch 2.1
int32 const noMissSkill = zoneSkill + 95;
int32 const skill = player->GetSkillValue(SKILL_FISHING);
int32 chance;
if (skill < zone_skill)
// fishing pool catches are 100%
//TODO: find reasonable value for fishing hole search
GameObject* fishingHole = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE);
if (fishingHole)
chance = 100;
else if (skill < noMissSkill)
{
chance = int32(pow((double)skill / zone_skill, 2) * 100);
chance = int32(pow((double)skill / noMissSkill, 2) * 100);
if (chance < 1)
chance = 1;
}
else
chance = 100;
int32 roll = irand(1, 100);
int32 const roll = irand(1, 100);
LOG_DEBUG("entities.gameobject", "Fishing check (skill: {} zone min skill: {} chance {} roll: {}", skill, zone_skill, chance, roll);
LOG_DEBUG("entities.gameobject", "Fishing check (skill: {} zone min skill: {} no-miss skill: {} chance {} roll: {})", skill, zoneSkill, noMissSkill, chance, roll);
if (sScriptMgr->OnPlayerUpdateFishingSkill(player, skill, zone_skill, chance, roll))
{
if (sScriptMgr->OnPlayerUpdateFishingSkill(player, skill, zoneSkill, chance, roll))
player->UpdateFishingSkill();
}
// but you will likely cause junk in areas that require a high fishing skill (not yet implemented)
if (chance >= roll)
{
@ -1768,11 +1774,10 @@ void GameObject::Use(Unit* user)
SetOwnerGUID(player->GetGUID());
SetSpellId(0); // prevent removing unintended auras at Unit::RemoveGameObject
//TODO: find reasonable value for fishing hole search
GameObject* ok = LookupFishingHoleAround(20.0f + CONTACT_DISTANCE);
if (ok)
// fishing pool catch
if (fishingHole)
{
ok->Use(player);
fishingHole->Use(player);
SetLootState(GO_JUST_DEACTIVATED);
}
else

View File

@ -740,9 +740,9 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
if (log_slot < MAX_QUEST_LOG_SIZE)
SetQuestSlot(log_slot, 0);
bool rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest();
bool const rewarded = IsQuestRewarded(quest_id) && !quest->IsDFQuest() && !(quest->IsDaily() || quest->IsWeekly() || quest->IsMonthly());
// Not give XP in case already completed once repeatable quest
// Repeatable quests (not time-based reset ones) should not give XP on subsequent completions
uint32 XP = rewarded ? 0 : CalculateQuestRewardXP(quest);
sScriptMgr->OnPlayerQuestComputeXP(this, quest, XP);

View File

@ -6833,7 +6833,7 @@ bool Player::Satisfy(DungeonProgressionRequirements const* ar, uint32 target_map
|| missingPlayerItems.size() || missingPlayerQuests.size() || missingPlayerAchievements.size()
|| missingLeaderItems.size() || missingLeaderQuests.size() || missingLeaderAchievements.size())
{
if (!sScriptMgr->OnPlayerNotAvoidSatisfy(partyLeader, ar, target_map, report))
if (!sScriptMgr->OnPlayerNotAvoidSatisfy(this, ar, target_map, report))
return true;
if (report)

View File

@ -448,31 +448,45 @@ void TransportMgr::SpawnContinentTransports()
LOG_INFO("server.loading", ">> Spawned {} continent motion transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
}
// Preloads Deeprun Tram to fix issues with Subway carts syncronization
/// @todo: This is a temporary workaround. Consider removing TransportMgr::PreloadGridsFromQuery() as part of fix.
/**
Takenbacon: "In the long run the most likely ideal fix would be to always spawn all transport types (and thus loading their grid) on map creation"
See https://github.com/azerothcore/azerothcore-wotlk/pull/23009 for more details.
*/
PreloadGridsFromQuery("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11 AND g.map = 369", count);
if (sWorld->getBoolConfig(CONFIG_ENABLE_CONTINENT_TRANSPORT_PRELOADING))
{
// pussywizard: preload grids for continent static transports
QueryResult result2 = WorldDatabase.Query("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11");
PreloadGridsFromQuery("SELECT map, position_x, position_y FROM gameobject g JOIN gameobject_template t ON g.id = t.entry WHERE t.type = 11 AND g.map != 369", count);
LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
if (result2)
void TransportMgr::PreloadGridsFromQuery(std::string const& query, uint32& count)
{
if (QueryResult result = WorldDatabase.Query(query))
{
do
{
do
{
Field* fields = result2->Fetch();
uint16 mapId = fields[0].Get<uint16>();
float x = fields[1].Get<float>();
float y = fields[2].Get<float>();
Field* fields = result->Fetch();
uint16 mapId = fields[0].Get<uint16>();
float x = fields[1].Get<float>();
float y = fields[2].Get<float>();
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
if (mapEntry && !mapEntry->Instanceable())
if (MapEntry const* mapEntry = sMapStore.LookupEntry(mapId))
{
if (!mapEntry->Instanceable())
{
if (Map* map = sMapMgr->CreateBaseMap(mapId))
{
map->LoadGrid(x, y);
++count;
}
} while (result2->NextRow());
}
LOG_INFO("server.loading", ">> Preloaded grids for {} continent static transports in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
}
}
} while (result->NextRow());
}
}

View File

@ -158,6 +158,8 @@ private:
TransportInstanceMap _instanceTransports;
TransportAnimationContainer _transportAnimations;
void PreloadGridsFromQuery(std::string const& query, uint32& count);
};
#define sTransportMgr TransportMgr::instance()

View File

@ -1364,6 +1364,9 @@ class spell_q12937_relief_for_the_fallen : public AuraScript
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (!GetCaster() || !GetCaster()->IsPlayer())
return;
Player* caster = GetCaster()->ToPlayer();
Unit* target = GetUnitOwner();
if (target && target->ToCreature())