From 2c4c3021158779136a433c46eba639d4c90c5699 Mon Sep 17 00:00:00 2001 From: cdkr <775481991@qq.com> Date: Fri, 22 Mar 2024 22:19:26 +0800 Subject: [PATCH 01/18] fix ProcSystemArguments constructor arg mismatch --- src/game/Entities/Unit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 398a7a15f83..71b27afeb1e 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -2735,7 +2735,7 @@ void Unit::AttackerStateUpdate(Unit* pVictim, WeaponAttackType attType, bool ext SendAttackStateUpdate(&meleeDamageInfo); DealMeleeDamage(&meleeDamageInfo, true); - ProcDamageAndSpell(ProcSystemArguments(this, meleeDamageInfo.target, meleeDamageInfo.procAttacker, meleeDamageInfo.procVictim, meleeDamageInfo.procEx, meleeDamageInfo.totalDamage, meleeDamageInfo.attackType)); + ProcDamageAndSpell(ProcSystemArguments(this, meleeDamageInfo.target, meleeDamageInfo.procAttacker, meleeDamageInfo.procVictim, meleeDamageInfo.procEx, meleeDamageInfo.totalDamage, meleeDamageInfo.absorb, meleeDamageInfo.attackType)); uint32 totalAbsorb = 0; uint32 totalResist = 0; From e9035253a0316a0eab451dfb780633194dcb5aa5 Mon Sep 17 00:00:00 2001 From: _daanieL Date: Sat, 23 Mar 2024 19:02:09 +0100 Subject: [PATCH 02/18] [Quest] rework Missing in Action quest using new systems (#660) * [Quest] rework Missing in Action quest using new systems * add changes requested in comments --- sql/scriptdev2/scriptdev2.sql | 60 ------------ .../eastern_kingdoms/redridge_mountains.cpp | 91 +++++-------------- 2 files changed, 23 insertions(+), 128 deletions(-) diff --git a/sql/scriptdev2/scriptdev2.sql b/sql/scriptdev2/scriptdev2.sql index 2b5b617b56e..8cc3ea7b012 100644 --- a/sql/scriptdev2/scriptdev2.sql +++ b/sql/scriptdev2/scriptdev2.sql @@ -1981,12 +1981,6 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,broadc ('-1000553','Be ready, $n. I hear the council returning. Prepare to ambush!','0','0','0','0','542','deathstalker_faerleia SAY_START'), ('-1000554','Well done. A blow to Arugal no doubt!','0','0','0','0','545','deathstalker_faerleia SAY_END'), -('-1000561','$n, my wounds are grave. Forgive my slow pace but my injuries won''t allow me to walk any faster.','0','0','0','0','25','SAY_CORPORAL_KEESHAN_1'), -('-1000562','Ah, fresh air at last! I need a moment to rest, $N.','0','0','0','0','26','SAY_CORPORAL_KEESHAN_2'), -('-1000563','The Blackrock infestation is thick in these parts. I will do my best to keep the pace, $N. Let''s go!','0','0','0','0','27','SAY_CORPORAL_KEESHAN_3'), -('-1000564','Marshal Marris, sir. Corporal Keeshan of the 12th Sabre Regiment returned from battle and reporting for duty!','0','0','0','0','29','SAY_CORPORAL_KEESHAN_4'), -('-1000565','Brave $c, thank you for rescuing me! I am sure Marshal Marris will reward your kind deed, $N.','0','0','0','0','30','SAY_CORPORAL_KEESHAN_5'), - ('-1000566','Stand back! Stand clear! The infernal will need to be given a wide berth!','0','0','0','0','9634','SAY_NIBY_1'), ('-1000567','BOW DOWN TO THE ALMIGHTY! BOW DOWN BEFORE MY INFERNAL DESTRO... chicken?','0','0','0','0','9635','SAY_NIBY_2'), ('-1000568','%s rolls on the floor laughing.','0','2','0','0','9636','EMOTE_IMPSY_1'), @@ -4768,60 +4762,6 @@ INSERT INTO gossip_texts (entry,content_default,comment) VALUES TRUNCATE script_waypoint; INSERT INTO script_waypoint (Entry, PathId, Point, PositionX, PositionY, PositionZ, Orientation, WaitTime, ScriptId, Comment) VALUES -(349,0,1,-8769.59,-2185.73,141.975,0,0,0,''), -(349,0,2,-8776.54,-2193.78,140.96,0,0,0,''), -(349,0,3,-8783.29,-2194.82,140.462,0,0,0,''), -(349,0,4,-8792.52,-2188.8,142.078,0,0,0,''), -(349,0,5,-8807.55,-2186.1,141.504,0,0,0,''), -(349,0,6,-8818,-2184.8,139.153,0,0,0,''), -(349,0,7,-8825.81,-2188.84,138.459,0,0,0,''), -(349,0,8,-8827.52,-2199.81,139.622,0,0,0,''), -(349,0,9,-8821.14,-2212.64,143.126,0,0,0,''), -(349,0,10,-8809.18,-2230.46,143.438,0,0,0,''), -(349,0,11,-8797.04,-2240.72,146.548,0,0,0,''), -(349,0,12,-8795.24,-2251.81,146.808,0,0,0,''), -(349,0,13,-8780.16,-2258.62,148.554,0,0,0,''), -(349,0,14,-8762.65,-2259.56,151.144,0,0,0,''), -(349,0,15,-8754.36,-2253.74,152.243,0,0,0,''), -(349,0,16,-8741.87,-2251,154.486,0,0,0,''), -(349,0,17,-8733.22,-2251.01,154.36,0,0,0,''), -(349,0,18,-8717.47,-2245.04,154.686,0,0,0,''), -(349,0,19,-8712.24,-2246.83,154.709,0,0,0,''), -(349,0,20,-8693.84,-2240.41,152.91,0,0,0,''), -(349,0,21,-8681.82,-2245.33,155.518,0,0,0,''), -(349,0,22,-8669.86,-2252.77,154.854,0,0,0,''), -(349,0,23,-8670.56,-2264.69,156.978,0,0,0,''), -(349,0,24,-8676.56,-2269.2,155.411,0,0,0,''), -(349,0,25,-8673.34,-2288.65,157.054,0,0,0,''), -(349,0,26,-8677.76,-2302.56,155.917,0,16000,0,'Corp. Keeshan - Short Break Outside'), -(349,0,27,-8682.46,-2321.69,155.917,0,0,0,''), -(349,0,28,-8690.4,-2331.78,155.971,0,0,0,''), -(349,0,29,-8715.1,-2353.95,156.188,0,0,0,''), -(349,0,30,-8748.04,-2370.7,157.988,0,0,0,''), -(349,0,31,-8780.9,-2421.37,156.109,0,0,0,''), -(349,0,32,-8792.01,-2453.38,142.746,0,0,0,''), -(349,0,33,-8804.78,-2472.43,134.192,0,0,0,''), -(349,0,34,-8841.35,-2503.63,132.276,0,0,0,''), -(349,0,35,-8867.57,-2529.89,134.739,0,0,0,''), -(349,0,36,-8870.67,-2542.08,131.044,0,0,0,''), -(349,0,37,-8922.05,-2585.31,132.446,0,0,0,''), -(349,0,38,-8949.08,-2596.87,132.537,0,0,0,''), -(349,0,39,-8993.46,-2604.04,130.756,0,0,0,''), -(349,0,40,-9006.71,-2598.47,127.966,0,0,0,''), -(349,0,41,-9038.96,-2572.71,124.748,0,0,0,''), -(349,0,42,-9046.92,-2560.64,124.447,0,0,0,''), -(349,0,43,-9066.69,-2546.63,123.11,0,0,0,''), -(349,0,44,-9077.54,-2541.67,121.17,0,0,0,''), -(349,0,45,-9125.32,-2490.06,116.057,0,0,0,''), -(349,0,46,-9145.06,-2442.24,108.232,0,0,0,''), -(349,0,47,-9158.2,-2425.36,105.5,0,0,0,''), -(349,0,48,-9151.92,-2393.67,100.856,0,0,0,''), -(349,0,49,-9165.19,-2376.03,94.8215,0,0,0,''), -(349,0,50,-9187.1,-2360.52,89.9231,0,0,0,''), -(349,0,51,-9235.44,-2305.24,77.9253,0,0,0,''), -(349,0,52,-9264.73,-2292.92,70.0089,0,0,0,''), -(349,0,53,-9277.47,-2296.19,68.0896,0,2500,0,'Corp. Keeshan - quest-finish'), -(349,0,54,-9277.47,-2296.19,68.0896,0,0,0,'Corp. Keeshan - Say Goodbye'), (467,0,1,-10508.4,1068,55.21,0,0,0,''), (467,0,2,-10518.3,1074.84,53.96,0,0,0,''), (467,0,3,-10534.8,1081.92,49.88,0,0,0,''), diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/redridge_mountains.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/redridge_mountains.cpp index 3ea1c01c3fa..cdcf64c8c38 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/redridge_mountains.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/redridge_mountains.cpp @@ -28,57 +28,32 @@ npc_corporal_keeshan */ #include "AI/ScriptDevAI/base/escort_ai.h" /*###### -## npc_corporal_leehsan +## npc_corporal_keehsan ######*/ enum { QUEST_MISSING_IN_ACTION = 219, - SPELL_MOCKING_BLOW = 21008, - SPELL_SHIELD_BASH = 11972, - - SAY_CORPORAL_KEESHAN_1 = -1000561, - SAY_CORPORAL_KEESHAN_2 = -1000562, - SAY_CORPORAL_KEESHAN_3 = -1000563, - SAY_CORPORAL_KEESHAN_4 = -1000564, - SAY_CORPORAL_KEESHAN_5 = -1000565, + KEESHAN_PATH_ID = 349, + SAY_CORPORAL_KEESHAN_1 = 25, + SAY_CORPORAL_KEESHAN_2 = 26, + SAY_CORPORAL_KEESHAN_3 = 27, + SAY_CORPORAL_KEESHAN_4 = 30, }; struct npc_corporal_keeshan_escortAI : public npc_escortAI { npc_corporal_keeshan_escortAI(Creature* pCreature) : npc_escortAI(pCreature) { Reset(); } - uint32 m_uiMockingBlowTimer; - uint32 m_uiShieldBashTimer; - - void Reset() override - { - m_uiMockingBlowTimer = 5000; - m_uiShieldBashTimer = 8000; - } void ReceiveAIEvent(AIEventType eventType, Unit* /*pSender*/, Unit* pInvoker, uint32 uiMiscValue) override { if (eventType == AI_EVENT_START_ESCORT && pInvoker->GetTypeId() == TYPEID_PLAYER) { - DoScriptText(SAY_CORPORAL_KEESHAN_1, m_creature); + DoBroadcastText(SAY_CORPORAL_KEESHAN_1, m_creature, pInvoker); m_creature->SetFactionTemporary(FACTION_ESCORT_A_NEUTRAL_ACTIVE, TEMPFACTION_RESTORE_RESPAWN); - Start(false, (Player*)pInvoker, GetQuestTemplateStore(uiMiscValue)); - } - } - - void WaypointStart(uint32 uiWP) override - { - switch (uiWP) - { - case 27: // break outside - DoScriptText(SAY_CORPORAL_KEESHAN_3, m_creature); - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - break; - case 54: // say goodbye - DoScriptText(SAY_CORPORAL_KEESHAN_5, m_creature); - break; + Start(false, (Player*)pInvoker, GetQuestTemplateStore(uiMiscValue), true, false, KEESHAN_PATH_ID); } } @@ -86,45 +61,25 @@ struct npc_corporal_keeshan_escortAI : public npc_escortAI { switch (uiWP) { - case 26: // break outside + case 25: m_creature->SetStandState(UNIT_STAND_STATE_SIT); - DoScriptText(SAY_CORPORAL_KEESHAN_2, m_creature); + if (Player* player = GetPlayerForEscort()) + DoBroadcastText(SAY_CORPORAL_KEESHAN_2, m_creature, player); break; - case 37: - SetRun(true); // run now until the destination + case 26: + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + if (Player* player = GetPlayerForEscort()) + DoBroadcastText(SAY_CORPORAL_KEESHAN_3, m_creature, player); break; - case 53: // quest_complete - DoScriptText(SAY_CORPORAL_KEESHAN_4, m_creature); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->RewardPlayerAndGroupAtEventExplored(QUEST_MISSING_IN_ACTION, m_creature); + case 69: // quest_complete + if (Player* player = GetPlayerForEscort()) + { + player->RewardPlayerAndGroupAtEventExplored(QUEST_MISSING_IN_ACTION, m_creature); + DoBroadcastText(SAY_CORPORAL_KEESHAN_4, m_creature, player); + } break; } } - - void UpdateEscortAI(const uint32 uiDiff) override - { - // Combat check - if (!m_creature->SelectHostileTarget() || !m_creature->GetVictim()) - return; - - if (m_uiMockingBlowTimer < uiDiff) - { - DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MOCKING_BLOW); - m_uiMockingBlowTimer = 5000; - } - else - m_uiMockingBlowTimer -= uiDiff; - - if (m_uiShieldBashTimer < uiDiff) - { - DoCastSpellIfCan(m_creature->GetVictim(), SPELL_SHIELD_BASH); - m_uiShieldBashTimer = 8000; - } - else - m_uiShieldBashTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } }; UnitAI* GetAI_npc_corporal_keeshan(Creature* pCreature) @@ -132,10 +87,10 @@ UnitAI* GetAI_npc_corporal_keeshan(Creature* pCreature) return new npc_corporal_keeshan_escortAI(pCreature); } -bool QuestAccept_npc_corporal_keeshan(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +bool QuestAccept_npc_corporal_keeshan(Player* player, Creature* pCreature, const Quest* pQuest) { if (pQuest->GetQuestId() == QUEST_MISSING_IN_ACTION) - pCreature->AI()->SendAIEvent(AI_EVENT_START_ESCORT, pPlayer, pCreature, pQuest->GetQuestId()); + pCreature->AI()->SendAIEvent(AI_EVENT_START_ESCORT, player, pCreature, pQuest->GetQuestId()); return true; } From c08181155ed0d4b9f966279c3f977f862ec945e9 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sun, 25 Feb 2024 12:44:49 +0100 Subject: [PATCH 03/18] SpawnGroup: Implement CREATURE_GROUP_FORMATION_MIRRORING --- src/game/Maps/SpawnGroup.cpp | 13 +++++++------ src/game/Maps/SpawnGroupDefines.h | 7 +++---- .../MotionGenerators/WaypointMovementGenerator.cpp | 6 +----- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/game/Maps/SpawnGroup.cpp b/src/game/Maps/SpawnGroup.cpp index a8730dbaeac..957be73e829 100644 --- a/src/game/Maps/SpawnGroup.cpp +++ b/src/game/Maps/SpawnGroup.cpp @@ -1743,13 +1743,14 @@ bool FormationSlotData::IsFormationMaster() float FormationSlotData::GetAngle() { -#ifdef ENABLE_SPAWNGROUP_FORMATION_MIRRORING - if (!GetFormationData()->GetMirrorState()) - return m_angleVariation; - return (2 * M_PI_F) - m_angleVariation; -#else + if (GetCreatureGroup()->GetGroupEntry().IsMirroring()) + { + if (!GetFormationData()->GetMirrorState()) + return m_angleVariation; + return (2 * M_PI_F) - m_angleVariation; + } + return m_angleVariation; -#endif // ENABLE_SPAWNGROUP_FORMATION_MIRRORING } float FormationSlotData::GetDistance() const diff --git a/src/game/Maps/SpawnGroupDefines.h b/src/game/Maps/SpawnGroupDefines.h index 49247c08699..4d11e733f54 100644 --- a/src/game/Maps/SpawnGroupDefines.h +++ b/src/game/Maps/SpawnGroupDefines.h @@ -25,10 +25,6 @@ #include #include - - // uncomment this if you want mirroring at start and end of the LINEAR_WP_MOTION_TYPE movement - //#define ENABLE_SPAWNGROUP_FORMATION_MIRRORING - struct FormationEntry; class FormationData; class FormationSlotData; @@ -74,6 +70,7 @@ enum CreatureGroupFlags CREATURE_GROUP_RESPAWN_TOGETHER = 0x02, CREATURE_GROUP_EVADE_TOGETHER = 0x04, // SPAWN_GROUP_DESPAWN_ON_COND_FAIL + CREATURE_GROUP_FORMATION_MIRRORING = 0x10, // mirrors position during linear path movement }; enum CreatureGroupEvent : uint32 @@ -112,6 +109,8 @@ struct SpawnGroupEntry auto const& itr = std::find_if(DbGuids.begin(), DbGuids.end(), [dbGuid](SpawnGroupDbGuids const& x) { return x.DbGuid == dbGuid; }); return itr != DbGuids.end() ? (*itr).SlotId : -1; } + + bool IsMirroring() const { return Flags & CREATURE_GROUP_FORMATION_MIRRORING; } }; // Formation defines diff --git a/src/game/MotionGenerators/WaypointMovementGenerator.cpp b/src/game/MotionGenerators/WaypointMovementGenerator.cpp index 1456f3fbe3e..4c96bb7eb28 100644 --- a/src/game/MotionGenerators/WaypointMovementGenerator.cpp +++ b/src/game/MotionGenerators/WaypointMovementGenerator.cpp @@ -614,7 +614,7 @@ bool WaypointMovementGenerator::SetNextWaypoint(uint32 pointId) return true; } -void LinearWPMovementGenerator::SwitchToNextNode(Creature& /*creature*/, WaypointPath::const_iterator& nodeItr) +void LinearWPMovementGenerator::SwitchToNextNode(Creature& creature, WaypointPath::const_iterator& nodeItr) { // switch to next node if (!m_driveWayBack) @@ -624,11 +624,9 @@ void LinearWPMovementGenerator::SwitchToNextNode(Creature& /*creature* --nodeItr; m_driveWayBack = true; -#ifdef ENABLE_SPAWNGROUP_FORMATION_MIRRORING // call end of path hook if (creature.GetFormationSlot()) creature.GetFormationSlot()->GetFormationData()->OnWPEndNode(); -#endif } else ++nodeItr; @@ -639,11 +637,9 @@ void LinearWPMovementGenerator::SwitchToNextNode(Creature& /*creature* { m_driveWayBack = false; ++nodeItr; -#ifdef ENABLE_SPAWNGROUP_FORMATION_MIRRORING // call start of path hook if (creature.GetFormationSlot()) creature.GetFormationSlot()->GetFormationData()->OnWPStartNode(); -#endif } else --nodeItr; From 669c7fbc12ed72f6869311c703a2e701393a9f2e Mon Sep 17 00:00:00 2001 From: Anton Popovichenko Date: Fri, 8 Mar 2024 09:50:09 +0100 Subject: [PATCH 04/18] Config: Implement config override with env vars (#502) * Config: Implement config override with env vars Implement overriding of configuration from the .conf file with environment variables. Environment variables keys are autogenerated based on the keys defined in .conf file. Usage example: $ export CM_DATA_DIR=/usr $ CM_WORLD_SERVER_PORT=8080 ./mangosd * Update env var key format and encapsulated env loading logic. The new env key format: Mangosd_Rate_Health Mangosd_DataDir * Add suggestions from code review. * Add missing includes. --- .../Anticheat/module/anticheat.conf.dist.in | 10 +++++ src/game/Anticheat/module/libanticheat.cpp | 2 +- src/game/AuctionHouseBot/AuctionHouseBot.cpp | 2 +- src/mangosd/Main.cpp | 2 +- src/mangosd/mangosd.conf.dist.in | 12 ++++- src/realmd/Main.cpp | 2 +- src/realmd/realmd.conf.dist.in | 12 ++++- src/shared/Config/Config.cpp | 44 +++++++++++++++++-- src/shared/Config/Config.h | 3 +- 9 files changed, 78 insertions(+), 11 deletions(-) diff --git a/src/game/Anticheat/module/anticheat.conf.dist.in b/src/game/Anticheat/module/anticheat.conf.dist.in index f6c533cf2bf..ac65a2fd3c9 100644 --- a/src/game/Anticheat/module/anticheat.conf.dist.in +++ b/src/game/Anticheat/module/anticheat.conf.dist.in @@ -3,6 +3,16 @@ # This file is intended to be used in a setting where the anticheat should run # purely in a read-only mode. It will do all of its tasks, but take no action, # aside from sending out notifications. It is intended for testing purposes. +# +# To overwrite configuration fields with environment variables +# use the following pattern to generate environment variable names: +# +# For Enable: +# export Anticheat_Enable=0 +# +# For IPBanDelay.Max: +# export Anticheat_IPBanDelay_Max=120 +# [AnticheatConf] ConfVersion=2017102301 diff --git a/src/game/Anticheat/module/libanticheat.cpp b/src/game/Anticheat/module/libanticheat.cpp index d53d97d31f9..191c78cb527 100644 --- a/src/game/Anticheat/module/libanticheat.cpp +++ b/src/game/Anticheat/module/libanticheat.cpp @@ -215,7 +215,7 @@ namespace NamreebAnticheat { void AnticheatLib::Reload() { - if (!sAnticheatConfig.SetSource(_LIB_ANTICHEAT_CONFIG)) + if (!sAnticheatConfig.SetSource(_LIB_ANTICHEAT_CONFIG, "Anticheat_")) sLog.outError("[Anticheat] Could not find configuration file %s.", _LIB_ANTICHEAT_CONFIG); // the configuration setting must be loaded before the database data because the current config settings diff --git a/src/game/AuctionHouseBot/AuctionHouseBot.cpp b/src/game/AuctionHouseBot/AuctionHouseBot.cpp index 060313e0910..c47e7f732b1 100644 --- a/src/game/AuctionHouseBot/AuctionHouseBot.cpp +++ b/src/game/AuctionHouseBot/AuctionHouseBot.cpp @@ -40,7 +40,7 @@ AuctionHouseBot::~AuctionHouseBot() void AuctionHouseBot::Initialize() { - if (!m_ahBotCfg.SetSource(m_configFileName)) + if (!m_ahBotCfg.SetSource(m_configFileName, "Mangosd_")) { // set buy/sell chance to 0, this prevents Update() from accessing uninitialized variables m_chanceBuy = 0; diff --git a/src/mangosd/Main.cpp b/src/mangosd/Main.cpp index 3d74e06ff46..836feabfb18 100644 --- a/src/mangosd/Main.cpp +++ b/src/mangosd/Main.cpp @@ -141,7 +141,7 @@ int main(int argc, char* argv[]) } #endif - if (!sConfig.SetSource(configFile)) + if (!sConfig.SetSource(configFile, "Mangosd_")) { sLog.outError("Could not find configuration file %s.", configFile.c_str()); Log::WaitBeforeContinueIfNeed(); diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index 45012d2defe..6422ced59cc 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -1,5 +1,15 @@ ##################################### -# MaNGOS Configuration file # +# MaNGOS Configuration file +# +# To overwrite configuration fields with environment variables +# use the following pattern to generate environment variable names: +# +# For Rate.Health: +# export Mangosd_Rate_Health=1.2 +# +# For DataDir: +# export Mangosd_DataDir=/tmp +# ##################################### [MangosdConf] diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index f997aabe365..9e3e52d32cf 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -125,7 +125,7 @@ int main(int argc, char* argv[]) } #endif - if (!sConfig.SetSource(configFile)) + if (!sConfig.SetSource(configFile, "Realmd_")) { sLog.outError("Could not find configuration file %s.", configFile.c_str()); Log::WaitBeforeContinueIfNeed(); diff --git a/src/realmd/realmd.conf.dist.in b/src/realmd/realmd.conf.dist.in index 3cd7f8e55d8..0bb81e1f65e 100644 --- a/src/realmd/realmd.conf.dist.in +++ b/src/realmd/realmd.conf.dist.in @@ -1,5 +1,15 @@ ############################################ -# MaNGOS realmd configuration file # +# MaNGOS realmd configuration file +# +# To overwrite configuration fields with environment variables +# use the following pattern to generate environment variable names: +# +# For WrongPass.MaxCount: +# export Realmd_WrongPass_MaxCount=10 +# +# For RealmServerPort: +# export Realmd_RealmServerPort=3333 +# ############################################ [RealmdConf] diff --git a/src/shared/Config/Config.cpp b/src/shared/Config/Config.cpp index c5172fc52e1..dfcd7aa8e4e 100644 --- a/src/shared/Config/Config.cpp +++ b/src/shared/Config/Config.cpp @@ -18,6 +18,7 @@ #include "Config.h" #include "Policies/Singleton.h" +#include "Util/Util.h" #include #include @@ -25,12 +26,18 @@ #include #include #include +#include +#include +#include INSTANTIATE_SINGLETON_1(Config); -bool Config::SetSource(const std::string& file) +std::optional EnvVarForIniKey(std::string const&, std::string const&); + +bool Config::SetSource(const std::string& file, const std::string& envVarPrefix) { m_filename = file; + m_envVarPrefix = envVarPrefix; return Reload(); } @@ -62,9 +69,14 @@ bool Config::Reload() if (equals == std::string::npos) return false; - auto const entry = boost::algorithm::trim_copy(boost::algorithm::to_lower_copy(line.substr(0, equals))); - auto const value = boost::algorithm::trim_copy_if(boost::algorithm::trim_copy(line.substr(equals + 1)), boost::algorithm::is_any_of("\"")); + auto const trimmedEntry = boost::algorithm::trim_copy(line.substr(0, equals)); + auto const entry = boost::algorithm::to_lower_copy(trimmedEntry); + auto value = boost::algorithm::trim_copy_if(boost::algorithm::trim_copy(line.substr(equals + 1)), boost::algorithm::is_any_of("\"")); + std::optional envValue = EnvVarForIniKey(m_envVarPrefix, trimmedEntry); + if (envValue) + value = *envValue; + newEntries[entry] = value; } while (in.good()); @@ -85,8 +97,21 @@ const std::string Config::GetStringDefault(const std::string& name, const std::s auto const nameLower = boost::algorithm::to_lower_copy(name); auto const entry = m_entries.find(nameLower); + + if (entry == m_entries.cend()) + { + std::optional envVar = EnvVarForIniKey(m_envVarPrefix, name); + if (envVar) + { + sLog.outString("Missing key '%s' in config file '%s', recovered with environment '%s' value.", name.c_str(), m_filename.c_str(), envVar->c_str()); - return entry == m_entries.cend() ? def : entry->second; + return *envVar; + } + + return def; + } + + return entry->second; } bool Config::GetBoolDefault(const std::string& name, bool def) const @@ -113,3 +138,14 @@ float Config::GetFloatDefault(const std::string& name, float def) const return std::stof(value); } +std::optional EnvVarForIniKey(std::string const& prefix, std::string const& key) +{ + std::string escapedKey = key; + std::replace(escapedKey.begin(), escapedKey.end(), '.', '_'); + std::string envKey = prefix + escapedKey; + char* val = std::getenv(envKey.c_str()); + if (!val) + return {}; + + return std::string(val); +} diff --git a/src/shared/Config/Config.h b/src/shared/Config/Config.h index 66f9f5b18ae..f9b439af01a 100644 --- a/src/shared/Config/Config.h +++ b/src/shared/Config/Config.h @@ -31,10 +31,11 @@ class Config { private: std::string m_filename; + std::string m_envVarPrefix; std::unordered_map m_entries; // keys are converted to lower case. values cannot be. public: - bool SetSource(const std::string& file); + bool SetSource(const std::string& file, const std::string& envVarPrefix); bool Reload(); bool IsSet(const std::string& name) const; From 9d90a346871b7efc4359f6dc2e5534bd421f6f9f Mon Sep 17 00:00:00 2001 From: killerwife Date: Fri, 15 Mar 2024 00:14:48 +0100 Subject: [PATCH 05/18] Pet: Tryfix double unsummon crash due to visibility Close https://github.com/cmangos/mangos-wotlk/pull/508 Credit @insunaa for the general idea --- src/game/Entities/Pet.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/game/Entities/Pet.cpp b/src/game/Entities/Pet.cpp index 5f7b30b48d7..995af3332d4 100644 --- a/src/game/Entities/Pet.cpp +++ b/src/game/Entities/Pet.cpp @@ -2401,7 +2401,17 @@ void Pet::ForcedDespawn(uint32 timeMSToDespawn, bool onlyAlive) if (IsAlive()) SetDeathState(JUST_DIED); - RemoveCorpse(true); // force corpse removal in the same grid + if (GetDeathState() == CORPSE) // rest of despawn cleanup meant to be done by Unsummon + { + if (AI()) + { + uint32 respawnDelay = 0; + AI()->CorpseRemoved(respawnDelay); + } + + if (InstanceData* mapInstance = GetInstanceData()) + mapInstance->OnCreatureDespawn(this); + } Unsummon(PET_SAVE_NOT_IN_SLOT, owner); } From 6d2e80db8e52ad20e62cde53931a8b294bac3f28 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sat, 23 Mar 2024 19:04:11 +0100 Subject: [PATCH 06/18] [Quest] modernize defias brotherhood escort quest Closes https://github.com/cmangos/mangos-tbc/pull/662 --- sql/scriptdev2/scriptdev2.sql | 51 ------------------- .../scripts/eastern_kingdoms/westfall.cpp | 48 ++++++++--------- 2 files changed, 25 insertions(+), 74 deletions(-) diff --git a/sql/scriptdev2/scriptdev2.sql b/sql/scriptdev2/scriptdev2.sql index 8cc3ea7b012..542ac76e99c 100644 --- a/sql/scriptdev2/scriptdev2.sql +++ b/sql/scriptdev2/scriptdev2.sql @@ -1483,12 +1483,6 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,broadc INSERT INTO script_texts (entry,content_default,sound,type,language,emote,broadcast_text_id,comment) VALUES ('-1000100','Come, little ones. Face me!','0','1','0','0','9071','azuregos SAY_TELEPORT'), -('-1000101','Follow me, $N. I''ll take you to the Defias hideout. But you better protect me or I am as good as dead.','0','0','7','0','9','defias traitor SAY_START'), -('-1000102','The entrance is hidden here in Moonbrook. Keep your eyes peeled for thieves. They want me dead.','0','0','7','0','10','defias traitor SAY_PROGRESS'), -('-1000103','You can go tell Stoutmantle this is where the Defias Gang is holed up, $N.','0','0','7','0','11','defias traitor SAY_END'), -('-1000104','$N coming in fast! Prepare to fight!','0','0','7','0','489','defias traitor SAY_AGGRO_1'), -('-1000105','Help!','0','0','7','0','485','defias traitor SAY_AGGRO_2'), - ('-1000106','Everyone ready?','0','0','1','0','8284','torek SAY_READY'), ('-1000107','Ok, let''s move out!','0','0','1','0','8278','torek SAY_MOVE'), ('-1000108','Prepare yourselves. Silverwing is just around the bend.','0','0','1','0','8282','torek SAY_PREPARE'), @@ -4762,51 +4756,6 @@ INSERT INTO gossip_texts (entry,content_default,comment) VALUES TRUNCATE script_waypoint; INSERT INTO script_waypoint (Entry, PathId, Point, PositionX, PositionY, PositionZ, Orientation, WaitTime, ScriptId, Comment) VALUES -(467,0,1,-10508.4,1068,55.21,0,0,0,''), -(467,0,2,-10518.3,1074.84,53.96,0,0,0,''), -(467,0,3,-10534.8,1081.92,49.88,0,0,0,''), -(467,0,4,-10546.5,1084.88,50.13,0,0,0,''), -(467,0,5,-10555.3,1084.45,45.75,0,0,0,''), -(467,0,6,-10566.6,1083.53,42.1,0,0,0,''), -(467,0,7,-10575.8,1082.34,39.46,0,0,0,''), -(467,0,8,-10585.7,1081.08,37.77,0,0,0,''), -(467,0,9,-10600.1,1078.19,36.23,0,0,0,''), -(467,0,10,-10608.7,1076.08,35.88,0,0,0,''), -(467,0,11,-10621.3,1073,35.4,0,0,0,''), -(467,0,12,-10638.1,1060.18,33.61,0,0,0,''), -(467,0,13,-10655.9,1038.99,33.48,0,0,0,''), -(467,0,14,-10664.7,1030.54,32.7,0,0,0,''), -(467,0,15,-10708.7,1033.86,33.32,0,0,0,''), -(467,0,16,-10754.4,1017.93,32.79,0,0,0,''), -(467,0,17,-10802.3,1018.01,32.16,0,0,0,''), -(467,0,18,-10832.6,1009.04,32.71,0,0,0,''), -(467,0,19,-10866.6,1006.51,31.71,0,0,0,''), -(467,0,20,-10880,1005.1,32.84,0,0,0,''), -(467,0,21,-10892.5,1001.32,34.46,0,0,0,''), -(467,0,22,-10906.1,997.11,36.15,0,0,0,''), -(467,0,23,-10922.3,1002.23,35.74,0,0,0,''), -(467,0,24,-10936.3,1023.38,36.52,0,0,0,''), -(467,0,25,-10933.3,1052.61,35.85,0,0,0,''), -(467,0,26,-10940.2,1077.66,36.49,0,0,0,''), -(467,0,27,-10957.1,1099.33,36.83,0,0,0,''), -(467,0,28,-10956.5,1119.9,36.73,0,0,0,''), -(467,0,29,-10939.3,1150.75,37.42,0,0,0,''), -(467,0,30,-10915.1,1202.09,36.55,0,0,0,''), -(467,0,31,-10892.6,1257.03,33.37,0,0,0,''), -(467,0,32,-10891.9,1306.66,35.45,0,0,0,''), -(467,0,33,-10896.2,1327.86,37.77,0,0,0,''), -(467,0,34,-10906,1368.05,40.91,0,0,0,''), -(467,0,35,-10910.2,1389.33,42.62,0,0,0,''), -(467,0,36,-10915.4,1417.72,42.93,0,0,0,''), -(467,0,37,-10926.4,1421.18,43.04,0,0,0,'walk here and say'), -(467,0,38,-10952.3,1421.74,43.4,0,0,0,''), -(467,0,39,-10980,1411.38,42.79,0,0,0,''), -(467,0,40,-11006.1,1420.47,43.26,0,0,0,''), -(467,0,41,-11022,1450.59,43.09,0,0,0,''), -(467,0,42,-11025.4,1491.59,43.15,0,0,0,''), -(467,0,43,-11036.1,1508.32,43.28,0,0,0,''), -(467,0,44,-11060.7,1526.72,43.19,0,0,0,''), -(467,0,45,-11072.8,1527.77,43.2,3.22,5000,0,'say and quest credit'), (1379,0,1,-5751.12,-3441.01,301.743,0,0,0,''), (1379,0,2,-5738.58,-3485.14,302.41,0,0,0,''), (1379,0,3,-5721.62,-3507.85,304.011,0,0,0,''), diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/westfall.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/westfall.cpp index 60b13a9f49c..5f214244c27 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/westfall.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/westfall.cpp @@ -336,12 +336,15 @@ UnitAI* GetAI_npc_daphne_stilwell(Creature* creature) enum { - SAY_START = -1000101, - SAY_PROGRESS = -1000102, - SAY_END = -1000103, - SAY_AGGRO_1 = -1000104, - SAY_AGGRO_2 = -1000105, + SAY_START = 9, + SAY_PROGRESS = 10, + SAY_END = 11, + SAY_AGGRO_1 = 487, + SAY_AGGRO_2 = 485, + SAY_AGGRO_3 = 489, + + DEFIAS_TRAITOR_PATH = 467, QUEST_DEFIAS_BROTHERHOOD = 155 }; @@ -357,26 +360,30 @@ struct npc_defias_traitorAI : public npc_escortAI { switch (pointId) { - case 36: + case 65: SetRun(false); + if (Player* player = GetPlayerForEscort()) + DoBroadcastText(SAY_PROGRESS, m_creature, player); break; - case 37: - if (Player* pPlayer = GetPlayerForEscort()) - DoScriptText(SAY_PROGRESS, m_creature, pPlayer); - break; - case 45: - if (Player* pPlayer = GetPlayerForEscort()) + case 94: + if (Player* player = GetPlayerForEscort()) { - DoScriptText(SAY_END, m_creature, pPlayer); - pPlayer->RewardPlayerAndGroupAtEventExplored(QUEST_DEFIAS_BROTHERHOOD, m_creature); + DoBroadcastText(SAY_END, m_creature, player); + player->RewardPlayerAndGroupAtEventExplored(QUEST_DEFIAS_BROTHERHOOD, m_creature); } + m_creature->ForcedDespawn(3000, true); break; } } void Aggro(Unit* who) override { - DoScriptText(urand(0, 1) ? SAY_AGGRO_1 : SAY_AGGRO_2, m_creature, who); + switch (urand(0, 3)) + { + case 0: DoBroadcastText(SAY_AGGRO_1, m_creature, who); break; + case 1: DoBroadcastText(SAY_AGGRO_2, m_creature, who); break; + case 2: DoBroadcastText(SAY_AGGRO_3, m_creature, who); break; + } } void Reset() override { } @@ -386,20 +393,15 @@ bool QuestAccept_npc_defias_traitor(Player* player, Creature* creature, const Qu { if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD) { - DoScriptText(SAY_START, creature, player); + DoBroadcastText(SAY_START, creature, player); if (npc_defias_traitorAI* escortAI = dynamic_cast(creature->AI())) - escortAI->Start(true, player, quest); + escortAI->Start(true, player, quest, true, false, DEFIAS_TRAITOR_PATH); // instant respawn } return true; } -UnitAI* GetAI_npc_defias_traitor(Creature* creature) -{ - return new npc_defias_traitorAI(creature); -} - /*###### ## npc_foreman_klaven_mortwake ######*/ @@ -434,7 +436,7 @@ void AddSC_westfall() pNewScript = new Script; pNewScript->Name = "npc_defias_traitor"; - pNewScript->GetAI = &GetAI_npc_defias_traitor; + pNewScript->GetAI = &GetNewAIInstance; pNewScript->pQuestAcceptNPC = &QuestAccept_npc_defias_traitor; pNewScript->RegisterSelf(); From 271276f390d82c653bd07f5322354dfc98020ba9 Mon Sep 17 00:00:00 2001 From: Miraco Date: Thu, 15 Feb 2024 14:14:27 +0100 Subject: [PATCH 07/18] [Quest] modernize 'Protect the Shipment' escort quest Closes https://github.com/cmangos/mangos-tbc/pull/663 --- sql/scriptdev2/scriptdev2.sql | 29 -------- .../scripts/eastern_kingdoms/loch_modan.cpp | 70 ++++++++++--------- 2 files changed, 38 insertions(+), 61 deletions(-) diff --git a/sql/scriptdev2/scriptdev2.sql b/sql/scriptdev2/scriptdev2.sql index 542ac76e99c..0342eb2f1fe 100644 --- a/sql/scriptdev2/scriptdev2.sql +++ b/sql/scriptdev2/scriptdev2.sql @@ -1981,11 +1981,6 @@ INSERT INTO script_texts (entry,content_default,sound,type,language,emote,broadc ('-1000569','Niby, you''re an idiot.','0','0','0','0','9637','SAY_IMPSY_1'), ('-1000570','Silence, servant! Vengeance will be mine! Death to Stormwind! Death by chicken!','0','0','0','0','9638','SAY_NIBY_3'), -('-1000571','Help! I''ve only one hand to defend myself with.','0','0','0','0','510','SAY_MIRAN_1'), -('-1000572','Feel the power of the Dark Iron Dwarves!','0','0','0','0','1936','SAY_DARK_IRON_DWARF'), -('-1000573','Send them on! I''m not afraid of some scrawny beasts!','0','0','0','0','511','SAY_MIRAN_2'), -('-1000574','Ah, here at last! It''s going to feel so good to get rid of these barrels.','0','0','0','0','498','SAY_MIRAN_3'), - ('-1000579','There! Destroy him! The Cipher must be recovered!','0','0','0','25','19012','spirit hunter - SAY_VENERATUS_SPAWN'), ('-1000582','Help! Please, you must help me!','0','0','0','0','7124','Galen - periodic say'), @@ -4756,30 +4751,6 @@ INSERT INTO gossip_texts (entry,content_default,comment) VALUES TRUNCATE script_waypoint; INSERT INTO script_waypoint (Entry, PathId, Point, PositionX, PositionY, PositionZ, Orientation, WaitTime, ScriptId, Comment) VALUES -(1379,0,1,-5751.12,-3441.01,301.743,0,0,0,''), -(1379,0,2,-5738.58,-3485.14,302.41,0,0,0,''), -(1379,0,3,-5721.62,-3507.85,304.011,0,0,0,''), -(1379,0,4,-5710.21,-3527.97,304.708,0,0,0,''), -(1379,0,5,-5706.92,-3542.89,304.871,0,0,0,''), -(1379,0,6,-5701.53,-3551.24,305.962,0,0,0,''), -(1379,0,7,-5699.53,-3555.69,306.505,0,0,0,''), -(1379,0,8,-5690.56,-3571.98,309.035,0,0,0,''), -(1379,0,9,-5678.61,-3587.17,310.607,0,0,0,''), -(1379,0,10,-5677.05,-3594.35,311.527,0,0,0,''), -(1379,0,11,-5674.39,-3605.19,312.239,0,0,0,''), -(1379,0,12,-5674.45,-3614.39,312.337,0,0,0,''), -(1379,0,13,-5673.05,-3630.56,311.105,0,0,0,''), -(1379,0,14,-5680.34,-3645.44,315.185,0,0,0,''), -(1379,0,15,-5684.46,-3650.05,314.687,0,0,0,''), -(1379,0,16,-5693.9,-3674.14,313.03,0,0,0,''), -(1379,0,17,-5701.43,-3712.54,313.959,0,0,0,''), -(1379,0,18,-5698.79,-3720.88,316.943,0,0,0,''), -(1379,0,19,-5699.95,-3733.63,318.597,0,0,0,'Protecting the Shipment - Ambush'), -(1379,0,20,-5698.61,-3754.74,322.047,0,0,0,''), -(1379,0,21,-5688.68,-3769,323.957,0,0,0,''), -(1379,0,22,-5688.14,-3782.65,322.667,0,0,0,''), -(1379,0,23,-5699.23,-3792.65,322.448,0,30000,0,'Protecting the Shipment - End'), -(1379,0,24,-5700.8,-3792.78,322.588,0,0,5000,''), (1840,0,1,2689.68,-1937.47,72.14,0,0,0,''), (1840,0,2,2683.11,-1926.82,72.14,0,0,0,''), (1840,0,3,2678.73,-1919.42,68.86,2.11887,1000,0,'escort paused'), diff --git a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/loch_modan.cpp b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/loch_modan.cpp index 1920dead44e..0a674c50458 100644 --- a/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/loch_modan.cpp +++ b/src/game/AI/ScriptDevAI/scripts/eastern_kingdoms/loch_modan.cpp @@ -36,12 +36,14 @@ enum { QUEST_PROTECTING_THE_SHIPMENT = 309, - SAY_MIRAN_1 = -1000571, - SAY_DARK_IRON_DWARF = -1000572, - SAY_MIRAN_2 = -1000573, - SAY_MIRAN_3 = -1000574, + SAY_MIRAN_1 = 510, + SAY_MIRAN_2 = 511, + SAY_MIRAN_3 = 498, - NPC_DARK_IRON_DWARF = 2149 + SAY_DARK_IRON_RAIDER = 512, + NPC_DARK_IRON_RAIDER = 2149, + + MIRAN_ESCORT_PATH = 1379 }; struct Location @@ -51,13 +53,13 @@ struct Location static const Location m_afAmbushSpawn[] = { - { -5691.93f, -3745.91f, 319.159f, 2.21f}, - { -5706.98f, -3745.39f, 318.728f, 1.04f} + { -5705.012f, -3736.6575f, 318.56738f, 0.57595f}, + { -5696.1943f, -3736.78f, 318.58145f, 2.40855f} }; struct npc_miranAI: public npc_escortAI { - npc_miranAI(Creature* pCreature): npc_escortAI(pCreature) + npc_miranAI(Creature* creature): npc_escortAI(creature) { Reset(); } @@ -74,57 +76,61 @@ struct npc_miranAI: public npc_escortAI { switch (uiPointId) { - case 19: - DoScriptText(SAY_MIRAN_1, m_creature); - m_creature->SummonCreature(NPC_DARK_IRON_DWARF, m_afAmbushSpawn[0].m_fX, m_afAmbushSpawn[0].m_fY, m_afAmbushSpawn[0].m_fZ, m_afAmbushSpawn[0].m_fO, TEMPSPAWN_CORPSE_TIMED_DESPAWN, 25000); - m_creature->SummonCreature(NPC_DARK_IRON_DWARF, m_afAmbushSpawn[1].m_fX, m_afAmbushSpawn[1].m_fY, m_afAmbushSpawn[1].m_fZ, m_afAmbushSpawn[1].m_fO, TEMPSPAWN_CORPSE_TIMED_DESPAWN, 25000); + case 16: + DoBroadcastText(SAY_MIRAN_1, m_creature); break; - case 23: - DoScriptText(SAY_MIRAN_3, m_creature); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->RewardPlayerAndGroupAtEventExplored(QUEST_PROTECTING_THE_SHIPMENT, m_creature); + case 17: + SetEscortPaused(true); + m_creature->SummonCreature(NPC_DARK_IRON_RAIDER, m_afAmbushSpawn[0].m_fX, m_afAmbushSpawn[0].m_fY, m_afAmbushSpawn[0].m_fZ, m_afAmbushSpawn[0].m_fO, TEMPSPAWN_CORPSE_TIMED_DESPAWN, 25000); + m_creature->SummonCreature(NPC_DARK_IRON_RAIDER, m_afAmbushSpawn[1].m_fX, m_afAmbushSpawn[1].m_fY, m_afAmbushSpawn[1].m_fZ, m_afAmbushSpawn[1].m_fO, TEMPSPAWN_CORPSE_TIMED_DESPAWN, 25000); break; - case 24: - m_creature->ForcedDespawn(5000); + case 21: + DoBroadcastText(SAY_MIRAN_3, m_creature); + if (Player* player = GetPlayerForEscort()) + player->RewardPlayerAndGroupAtEventExplored(QUEST_PROTECTING_THE_SHIPMENT, m_creature); + SetEscortPaused(true); + m_creature->ForcedDespawn(15000); break; } } - void SummonedCreatureJustDied(Creature* pSummoned) override + void SummonedCreatureJustDied(Creature* summoned) override { - if (pSummoned->GetEntry() == NPC_DARK_IRON_DWARF) + if (summoned->GetEntry() == NPC_DARK_IRON_RAIDER) { --m_uiDwarves; if (!m_uiDwarves) - DoScriptText(SAY_MIRAN_2, m_creature); + { + DoBroadcastText(SAY_MIRAN_2, m_creature); + SetEscortPaused(false); + } } } - void JustSummoned(Creature* pSummoned) override + void JustSummoned(Creature* summoned) override { - if (pSummoned->GetEntry() == NPC_DARK_IRON_DWARF) + if (summoned->GetEntry() == NPC_DARK_IRON_RAIDER) { - if (!m_uiDwarves) - DoScriptText(SAY_DARK_IRON_DWARF, pSummoned); ++m_uiDwarves; - pSummoned->AI()->AttackStart(m_creature); + summoned->AI()->AttackStart(m_creature); + DoBroadcastText(SAY_DARK_IRON_RAIDER, summoned); } } }; -bool QuestAccept_npc_miran(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +bool QuestAccept_npc_miran(Player* player, Creature* creature, const Quest* quest) { - if (pQuest->GetQuestId() == QUEST_PROTECTING_THE_SHIPMENT) + if (quest->GetQuestId() == QUEST_PROTECTING_THE_SHIPMENT) { - if (npc_miranAI* pEscortAI = dynamic_cast(pCreature->AI())) - pEscortAI->Start(false, pPlayer, pQuest); + if (npc_miranAI* pEscortAI = dynamic_cast(creature->AI())) + pEscortAI->Start(false, player, quest, false, false, MIRAN_ESCORT_PATH); } return true; } -UnitAI* GetAI_npc_miran(Creature* pCreature) +UnitAI* GetAI_npc_miran(Creature* creature) { - return new npc_miranAI(pCreature); + return new npc_miranAI(creature); } void AddSC_loch_modan() From 981dc7a84d05a8b2685afc7cf0414712d0697690 Mon Sep 17 00:00:00 2001 From: Flekz Date: Sat, 23 Mar 2024 20:42:56 +0000 Subject: [PATCH 08/18] Remove gameobject los temp fix for playerbots --- src/game/vmap/GameObjectModel.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/game/vmap/GameObjectModel.cpp b/src/game/vmap/GameObjectModel.cpp index 6899f8e7c5b..9821c7f6021 100644 --- a/src/game/vmap/GameObjectModel.cpp +++ b/src/game/vmap/GameObjectModel.cpp @@ -93,12 +93,6 @@ bool GameObjectModel::initialize(const GameObject* const pGo, const GameObjectDi if (!iModel) return false; -#ifdef ENABLE_PLAYERBOTS - // Bots need this to see the game objects - if (it->second.name.find(".m2") != std::string::npos) - iModel->setModelFlags(VMAP::MOD_M2); -#endif - name = it->second.name; iPos = Vector3(pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); collision_enabled = true; From cbdb5dfeb30e7d7e8501fb17492ee445014a55b2 Mon Sep 17 00:00:00 2001 From: insunaa Date: Thu, 22 Feb 2024 09:30:14 +0100 Subject: [PATCH 09/18] G3D: Extend Support for new MacOS Versions (+Apple Silicon) --- dep/g3dlite/System.cpp | 45 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/dep/g3dlite/System.cpp b/dep/g3dlite/System.cpp index 7630aef9b47..fbb3ff2ee85 100644 --- a/dep/g3dlite/System.cpp +++ b/dep/g3dlite/System.cpp @@ -276,49 +276,22 @@ void System::init() { # elif defined(G3D_OSX) // Operating System: - SInt32 macVersion; - Gestalt(gestaltSystemVersion, &macVersion); - int major = (macVersion >> 8) & 0xFF; - int minor = (macVersion >> 4) & 0xF; - int revision = macVersion & 0xF; + char osVersion[256]; + size_t size = sizeof(osVersion); + sysctlbyname("kern.osrelease", &osVersion, &size, NULL, 0); - { - char c[1000]; - sprintf(c, "OS X %x.%x.%x", major, minor, revision); - m_operatingSystem = c; - } + m_operatingSystem = "macOS "; + m_operatingSystem += osVersion; // Clock Cycle Timing Information: - Gestalt('pclk', &m_OSXCPUSpeed); - m_cpuSpeed = iRound((double)m_OSXCPUSpeed / (1024 * 1024)); m_secondsPerNS = 1.0 / 1.0e9; // System Architecture: - const NXArchInfo* pInfo = NXGetLocalArchInfo(); - - if (pInfo) { - m_cpuArch = pInfo->description; - - switch (pInfo->cputype) { - case CPU_TYPE_POWERPC: - switch(pInfo->cpusubtype){ - case CPU_SUBTYPE_POWERPC_750: - case CPU_SUBTYPE_POWERPC_7400: - case CPU_SUBTYPE_POWERPC_7450: - m_cpuVendor = "Motorola"; - break; - case CPU_SUBTYPE_POWERPC_970: - m_cpuVendor = "IBM"; - break; - } - break; - - case CPU_TYPE_I386: - m_cpuVendor = "Intel"; - break; - } - } +# ifdef (__aarch64__) + m_cpuArch = "ARM64"; + m_cpuVendor = "Apple"; +# endif # endif initTime(); From 2d8a2f4bd64359f1ad1bff96086ce7a8e42994a4 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sun, 24 Mar 2024 16:14:19 +0100 Subject: [PATCH 10/18] Pet: Fix compilation for pch on linux --- src/game/Entities/Pet.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/game/Entities/Pet.h b/src/game/Entities/Pet.h index 65e69e808ca..010bb00f8aa 100644 --- a/src/game/Entities/Pet.h +++ b/src/game/Entities/Pet.h @@ -23,6 +23,7 @@ #include "Entities/ObjectGuid.h" #include "Entities/Creature.h" #include "Entities/Unit.h" +#include "Maps/InstanceData.h" enum PetType { From 13603a7ebe9841d063c2b2c63e3e9beaa8e32449 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sun, 24 Mar 2024 20:06:32 +0100 Subject: [PATCH 11/18] Network: Minor rework of code to make it same as wotlk --- src/game/Server/WorldSocket.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/Server/WorldSocket.cpp b/src/game/Server/WorldSocket.cpp index aae67d2a2c8..8ff149ff02b 100644 --- a/src/game/Server/WorldSocket.cpp +++ b/src/game/Server/WorldSocket.cpp @@ -131,9 +131,9 @@ void WorldSocket::SendPacket(const WorldPacket& pct, bool immediate) if (pct.size() > 0) { // allocate array for full message - std::shared_ptr> fullMessage = std::make_shared>(sizeof(header) + pct.size()); - std::memcpy(fullMessage->data(), reinterpret_cast(&header), sizeof(header)); // copy header - std::memcpy((fullMessage->data() + sizeof(header)), reinterpret_cast(pct.contents()), pct.size()); // copy packet + std::shared_ptr> fullMessage = std::make_shared>(header.headerSize() + pct.size()); + std::memcpy(fullMessage->data(), header.data(), header.headerSize()); // copy header + std::memcpy((fullMessage->data() + header.headerSize()), reinterpret_cast(pct.contents()), pct.size()); // copy packet auto self(shared_from_this()); Write(fullMessage->data(), fullMessage->size(), [self, fullMessage](const boost::system::error_code& error, std::size_t read) {}); } From 661fba1aa0ebecfe097e8a2cc1dfe4aa81f8f0dd Mon Sep 17 00:00:00 2001 From: killerwife Date: Mon, 25 Mar 2024 09:56:31 +0100 Subject: [PATCH 12/18] Move spell to proper section --- sql/base/dbc/cmangos_fixes/Spell.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sql/base/dbc/cmangos_fixes/Spell.sql b/sql/base/dbc/cmangos_fixes/Spell.sql index 94066ea2a7b..dcdd75e54c6 100644 --- a/sql/base/dbc/cmangos_fixes/Spell.sql +++ b/sql/base/dbc/cmangos_fixes/Spell.sql @@ -2502,6 +2502,10 @@ INSERT INTO spell_template(Id, SchoolMask, Category, Dispel, Mechanic, Attribute INSERT INTO spell_template(Id, SchoolMask, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, procFlags, procChance, procCharges, maxLevel, baseLevel, spellLevel, DurationIndex, powerType, manaCost, manaCostPerLevel, manaPerSecond, manaPerSecondPerLevel, rangeIndex, speed, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, activeIconID, spellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, TotemCategory1, TotemCategory2, AreaId) VALUES ('22755', '1', '0', '0', '0', '327824', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '101', '0', '0', '0', '0', '21', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '2', '42483', '0', '6', '0', '0', '1', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '27', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '189', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '256', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '127', '0', '0', 'Critical Weapon +28', '', '', '', '', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '0', '0', '0'); +-- Pet Bomb Passive used by Pet Bomb (item Goblin Bomb Dispenser) +INSERT INTO spell_template (Id, Category, CastUI, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, ProcFlags, ProcChance, ProcCharges, MaxLevel, BaseLevel, SpellLevel, DurationIndex, PowerType, ManaCost, ManaCostPerlevel, ManaPerSecond, ManaPerSecondPerLevel, RangeIndex, Speed, ModalNextSpell, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, ActiveIconID, SpellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, Rank1, Rank2, Rank3, Rank4, Rank5, Rank6, Rank7, Rank8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, StanceBarOrder, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, MinFactionId, MinReputation, RequiredAuraVision, SchoolMask, IsServerSide, AttributesServerside) VALUES +('13260', '0', '0', '0', '0', '262608', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '4', '100', '1', '0', '30', '30', '21', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '0', '6', '0', '0', '1', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '42', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '13259', '0', '0', '0', '0', '0', '0', '11', '0', '0', 'Pet Bomb Passive', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '1', '1', '1', '0', '0', '0', '1', '0', '0'); + -- ============================================================ -- TBC section -- ============================================================ @@ -3172,10 +3176,6 @@ INSERT INTO spell_template(Id, SchoolMask, Category, Dispel, Mechanic, Attribute INSERT INTO spell_template(Id, SchoolMask, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, procFlags, procChance, procCharges, maxLevel, baseLevel, spellLevel, DurationIndex, powerType, manaCost, manaCostPerLevel, manaPerSecond, manaPerSecondPerLevel, rangeIndex, speed, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, activeIconID, spellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, TotemCategory1, TotemCategory2, AreaId, IsServerSide) VALUES ('44288', '8', '0', '4', '11', '786880', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '20', '20', '0', '0', '70', '70', '21', '0', '0', '0', '0', '0', '2', '30', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '0', '6', '0', '0', '1', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '42', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '44289', '0', '0', '0', '0', '0', '0', '163', '0', '0', 'Crippling Poison', '', '', '', '', '', '', '', '0', '0', '0', '0', '8', '0', '0', '1', '0', '1', '1', '1', '0', '0', '0', 2); --- Pet Bomb Passive used by Pet Bomb (item Goblin Bomb Dispenser) -INSERT INTO spell_template (Id, Category, CastUI, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, ProcFlags, ProcChance, ProcCharges, MaxLevel, BaseLevel, SpellLevel, DurationIndex, PowerType, ManaCost, ManaCostPerlevel, ManaPerSecond, ManaPerSecondPerLevel, RangeIndex, Speed, ModalNextSpell, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, ActiveIconID, SpellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, Rank1, Rank2, Rank3, Rank4, Rank5, Rank6, Rank7, Rank8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, StanceBarOrder, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, MinFactionId, MinReputation, RequiredAuraVision, SchoolMask, IsServerSide, AttributesServerside) VALUES -('13260', '0', '0', '0', '0', '262608', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '4', '100', '1', '0', '30', '30', '21', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '-1', '0', '6', '0', '0', '1', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '42', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '13259', '0', '0', '0', '0', '0', '0', '11', '0', '0', 'Pet Bomb Passive', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '1', '1', '1', '0', '0', '0', '1', '0', '0'); - -- serverside used by Sally Whitemane in OHF INSERT INTO spell_template (Id, SchoolMask, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, procFlags, procChance, procCharges, maxLevel, baseLevel, spellLevel, DurationIndex, powerType, manaCost, manaCostPerLevel, manaPerSecond, manaPerSecondPerLevel, rangeIndex, speed, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, activeIconID, spellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, TotemCategory1, TotemCategory2, AreaId) VALUES ('35136', '1', '0', '0', '0', '384', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '101', '0', '0', '0', '0', '26', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '28', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '32', '0', '0', '0', '0', '0', '15', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '20396', '0', '0', '64', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', 'Summon Captured Critter', '', '', '', '', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0'); From cc39299f4fc2dc97476c068c985f0cca580d4bce Mon Sep 17 00:00:00 2001 From: insunaa Date: Mon, 25 Mar 2024 10:33:18 +0100 Subject: [PATCH 13/18] G3D: Fix MacOS/Apple Silicon compile --- dep/g3dlite/System.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dep/g3dlite/System.cpp b/dep/g3dlite/System.cpp index fbb3ff2ee85..4ce7f76f1fc 100644 --- a/dep/g3dlite/System.cpp +++ b/dep/g3dlite/System.cpp @@ -288,7 +288,7 @@ void System::init() { m_secondsPerNS = 1.0 / 1.0e9; // System Architecture: -# ifdef (__aarch64__) +# if defined(__aarch64__) m_cpuArch = "ARM64"; m_cpuVendor = "Apple"; # endif From f2798ea538c9e5157a3f478d5d4590f804bcb1a0 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sat, 30 Mar 2024 11:07:58 +0100 Subject: [PATCH 14/18] Spell/Unit: Remove now redundant default coeff calculation I am expecting trouble, but we need to threat 0 as 0 Closes https://github.com/cmangos/issues/issues/3685 --- src/game/Entities/Unit.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index 71b27afeb1e..e32d9463e94 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -7329,9 +7329,6 @@ int32 Unit::SpellBonusWithCoeffs(SpellEntry const* spellInfo, SpellEffectIndex e total += int32(ap_bonus * (GetTotalAttackPowerValue(IsSpellRequiresRangedAP(spellInfo) ? RANGED_ATTACK : BASE_ATTACK) + ap_benefit)); } } - // Default calculation - else if (benefit) - coeff = CalculateDefaultCoefficient(spellInfo, damagetype); if (benefit) { From b9d855eeb089688ad2dc15585375ed1d08187cc2 Mon Sep 17 00:00:00 2001 From: killerwife Date: Sun, 31 Mar 2024 20:33:25 +0200 Subject: [PATCH 15/18] AC: Add ignore los to shirrak inhibit magic aoe --- sql/base/dbc/cmangos_fixes/Spell.sql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/base/dbc/cmangos_fixes/Spell.sql b/sql/base/dbc/cmangos_fixes/Spell.sql index dcdd75e54c6..228509ef403 100644 --- a/sql/base/dbc/cmangos_fixes/Spell.sql +++ b/sql/base/dbc/cmangos_fixes/Spell.sql @@ -3180,6 +3180,9 @@ INSERT INTO spell_template(Id, SchoolMask, Category, Dispel, Mechanic, Attribute INSERT INTO spell_template (Id, SchoolMask, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, procFlags, procChance, procCharges, maxLevel, baseLevel, spellLevel, DurationIndex, powerType, manaCost, manaCostPerLevel, manaPerSecond, manaPerSecondPerLevel, rangeIndex, speed, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, activeIconID, spellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, TotemCategory1, TotemCategory2, AreaId) VALUES ('35136', '1', '0', '0', '0', '384', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '101', '0', '0', '0', '0', '26', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '28', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '32', '0', '0', '0', '0', '0', '15', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '20396', '0', '0', '64', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', 'Summon Captured Critter', '', '', '', '', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0'); +-- Shirrak - Inhibit magic - confirmed to ignore los +UPDATE `spell_template` SET `AttributesEx2`=AttributesEx2|4 WHERE `id` IN(32264); + -- ============================================================ -- WOTLK section -- ============================================================ From 3bf443a39217fc33af958f3d66dd9b2e162ad895 Mon Sep 17 00:00:00 2001 From: Flekz Date: Sun, 31 Mar 2024 22:07:49 +0100 Subject: [PATCH 16/18] Playerbots: Fix grid loading issue (#536) - Exxenoz --- src/game/Entities/Camera.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/game/Entities/Camera.cpp b/src/game/Entities/Camera.cpp index 7bb04215a5d..703f66d1b31 100644 --- a/src/game/Entities/Camera.cpp +++ b/src/game/Entities/Camera.cpp @@ -145,11 +145,6 @@ template void Camera::UpdateVisibilityOf(DynamicObject*, UpdateData&, WorldObjec void Camera::UpdateVisibilityForOwner(bool addToWorld) { -#ifdef ENABLE_PLAYERBOTS - if (!m_owner.isRealPlayer()) - return; -#endif - MaNGOS::VisibleNotifier notifier(*this); Cell::VisitAllObjects(m_source, notifier, addToWorld ? MAX_VISIBILITY_DISTANCE : m_source->GetVisibilityData().GetVisibilityDistance(), false); notifier.Notify(); From 161d94b04179a148b5fbd607be9016a6d44a3a3b Mon Sep 17 00:00:00 2001 From: killerwife Date: Tue, 2 Apr 2024 08:33:24 +0200 Subject: [PATCH 17/18] Spell/Unit: Fix default for coefficient being 0 and fix coeff for npc pets Closes https://github.com/cmangos/issues/issues/3685 again --- src/game/Entities/Unit.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/game/Entities/Unit.cpp b/src/game/Entities/Unit.cpp index e32d9463e94..2f89c9fe82e 100644 --- a/src/game/Entities/Unit.cpp +++ b/src/game/Entities/Unit.cpp @@ -7312,11 +7312,9 @@ void Unit::EnergizeBySpell(Unit* victim, SpellEntry const* spellInfo, uint32 dam */ int32 Unit::SpellBonusWithCoeffs(SpellEntry const* spellInfo, SpellEffectIndex effectIndex, int32 total, int32 benefit, int32 ap_benefit, DamageEffectType damagetype, bool donePart) { - // Distribute Damage over multiple effects, reduce by AoE - float coeff = 1.0f; - - // Not apply this to creature casted spells - if (GetTypeId() == TYPEID_UNIT && !((Creature*)this)->IsPet()) + float coeff = 0.f; // no coefficient by default + // does not apply to creatures + if (IsCreature() && !IsPlayerControlled()) coeff = 1.0f; // Check for table values if (spellInfo->effectBonusCoefficient[effectIndex] > 0 || spellInfo->effectBonusCoefficientFromAP[effectIndex] > 0) From fc48782065341d29bc9bc9e4867bf2cbbac61959 Mon Sep 17 00:00:00 2001 From: Flekz Date: Wed, 3 Apr 2024 19:38:16 +0100 Subject: [PATCH 18/18] Playerbots: Handle spell item requirements by the bot system --- src/game/Spells/Spell.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/game/Spells/Spell.cpp b/src/game/Spells/Spell.cpp index 042bd3f1b21..e572df00390 100644 --- a/src/game/Spells/Spell.cpp +++ b/src/game/Spells/Spell.cpp @@ -6745,6 +6745,17 @@ bool Spell::IgnoreItemRequirements() const if (m_channelOnly || m_ignoreCosts) return true; +#ifdef ENABLE_PLAYERBOTS + if (m_caster->IsPlayer()) + { + PlayerbotAI* bot = ((Player*)m_caster)->GetPlayerbotAI(); + if (bot && bot->HasSpellItems(m_spellInfo->Id, m_CastItem)) + { + return true; + } + } +#endif + // Workaround for double shard problem if (m_IsTriggeredSpell || this->m_spellInfo->Id == 46546) {