From 1e79b10b79de341fc8da767d05b93ec13102e05a Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 30 May 2022 09:18:02 +0200 Subject: [PATCH 01/13] fix(Scripts/ZulGurub): Massive Geyser should not attack players. (#11909) Fixes #11563 --- .../sql/updates/pending_db_world/rev_1653824974575032300.sql | 5 +++++ .../scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 data/sql/updates/pending_db_world/rev_1653824974575032300.sql diff --git a/data/sql/updates/pending_db_world/rev_1653824974575032300.sql b/data/sql/updates/pending_db_world/rev_1653824974575032300.sql new file mode 100644 index 000000000..9fbeaf613 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1653824974575032300.sql @@ -0,0 +1,5 @@ +-- +UPDATE `smart_scripts` SET `event_type`=60 WHERE `entryorguid`=14122 AND `source_type`=0 AND `id`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=14122 AND `source_type`=0 AND `id`=1; +INSERT INTO `smart_scripts` VALUES +(14122,0,1,0,54,0,100,0,0,0,0,0,0,8,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,'Hydrospawn - on summon - set passive react'); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp index 33deb0f06..83e25a6c7 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_gahzranka.cpp @@ -29,7 +29,7 @@ EndScriptData */ enum Spells { SPELL_FROSTBREATH = 16099, - SPELL_MASSIVEGEYSER = 22421, // Not working. (summon) + SPELL_MASSIVEGEYSER = 22421, SPELL_SLAM = 24326 }; From a0da7417a096ec9cb9a8c4b2d09bf8b58ef3c106 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 30 May 2022 09:19:53 +0200 Subject: [PATCH 02/13] fix(Core/Units): Clear any movement on charm - vol. 2. (#11897) * fix(Core/Units): Clear any movement on charm - vol. 2. Fixes #11880 * Update. --- src/server/game/Entities/Unit/Unit.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 1595ddcb4..1b0ec51ab 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -17930,7 +17930,9 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au if (GetTypeId() == TYPEID_UNIT) { + GetMotionMaster()->Clear(false); GetMotionMaster()->MoveIdle(); + StopMoving(); if (charmer->GetTypeId() == TYPEID_PLAYER && charmer->getClass() == CLASS_WARLOCK) From be877a4e5d2c70a04ed8ca29670456e58bc99e95 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 30 May 2022 09:20:29 +0200 Subject: [PATCH 03/13] fix(Scripts/ZulGurub): Re-implemented Hakkar's Insanity. (#11840) fix(Scripts/ZulGurub): Fixed Jindo's Brain Wash Totem. Fixes #11760 --- .../scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 563e80ece..a4c181b99 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -39,7 +39,7 @@ enum Spells { SPELL_BLOOD_SIPHON = 24322, // Buggy ? SPELL_CORRUPTED_BLOOD = 24328, - SPELL_CAUSE_INSANITY = 24327, // Spell needs scripting. + SPELL_CAUSE_INSANITY = 24327, SPELL_WILL_OF_HAKKAR = 24178, SPELL_ENRAGE = 24318, // The Aspects of all High Priests spells @@ -54,7 +54,7 @@ enum Events { EVENT_BLOOD_SIPHON = 1, EVENT_CORRUPTED_BLOOD = 2, - EVENT_CAUSE_INSANITY = 3, // Spell needs scripting. Event disabled + EVENT_CAUSE_INSANITY = 3, EVENT_WILL_OF_HAKKAR = 4, EVENT_ENRAGE = 5, // The Aspects of all High Priests events @@ -128,8 +128,11 @@ public: events.ScheduleEvent(EVENT_CORRUPTED_BLOOD, urand(30000, 45000)); break; case EVENT_CAUSE_INSANITY: - // DoCast(SelectTarget(SelectTargetMethod::Random, 0, 100, true), SPELL_CAUSE_INSANITY); - // events.ScheduleEvent(EVENT_CAUSE_INSANITY, urand(35000, 45000)); + if (Unit* victim = SelectTarget(SelectTargetMethod::MaxThreat, 0)) + { + DoCast(victim, SPELL_CAUSE_INSANITY, true); + } + events.ScheduleEvent(EVENT_CAUSE_INSANITY, urand(35000, 45000)); break; case EVENT_WILL_OF_HAKKAR: // Xinef: Skip Tank From 0ed66168b4d5a40d48e7bcbc480a5dbc28778f40 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Mon, 30 May 2022 07:22:26 +0000 Subject: [PATCH 04/13] chore(DB): import pending files Referenced commit(s): be877a4e5d2c70a04ed8ca29670456e58bc99e95 --- .../rev_1653824974575032300.sql => db_world/2022_05_30_00.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1653824974575032300.sql => db_world/2022_05_30_00.sql} (88%) diff --git a/data/sql/updates/pending_db_world/rev_1653824974575032300.sql b/data/sql/updates/db_world/2022_05_30_00.sql similarity index 88% rename from data/sql/updates/pending_db_world/rev_1653824974575032300.sql rename to data/sql/updates/db_world/2022_05_30_00.sql index 9fbeaf613..c2ccb07c8 100644 --- a/data/sql/updates/pending_db_world/rev_1653824974575032300.sql +++ b/data/sql/updates/db_world/2022_05_30_00.sql @@ -1,3 +1,4 @@ +-- DB update 2022_05_29_01 -> 2022_05_30_00 -- UPDATE `smart_scripts` SET `event_type`=60 WHERE `entryorguid`=14122 AND `source_type`=0 AND `id`=0; DELETE FROM `smart_scripts` WHERE `entryorguid`=14122 AND `source_type`=0 AND `id`=1; From 86ea1998672c8a5da6fb01cd2a204ea5b7b5a6bc Mon Sep 17 00:00:00 2001 From: avarishd <46330494+avarishd@users.noreply.github.com> Date: Mon, 30 May 2022 10:23:29 +0300 Subject: [PATCH 05/13] fix(Script/Core): Move hardcoded text to DB (#11829) * Remove hardcodes from zones And minor changes on (Q) The cleansing * cs * codestyle --- .../scripts/Northrend/zone_howling_fjord.cpp | 39 +++- .../scripts/Northrend/zone_sholazar_basin.cpp | 187 +++++++++--------- .../scripts/Northrend/zone_wintergrasp.cpp | 6 +- 3 files changed, 125 insertions(+), 107 deletions(-) diff --git a/src/server/scripts/Northrend/zone_howling_fjord.cpp b/src/server/scripts/Northrend/zone_howling_fjord.cpp index 8f34561b9..0ba807b4c 100644 --- a/src/server/scripts/Northrend/zone_howling_fjord.cpp +++ b/src/server/scripts/Northrend/zone_howling_fjord.cpp @@ -78,6 +78,15 @@ public: } }; +// The cleansing +enum TurmoilTexts +{ + SAY_TURMOIL_0 = 0, + SAY_TURMOIL_1 = 1, + SAY_TURMOIL_HALF_HP = 2, + SAY_TURMOIL_DEATH = 3, +}; + class npc_your_inner_turmoil : public CreatureScript { public: @@ -89,16 +98,18 @@ public: uint32 timer; short phase; + bool health50; void Reset() override { timer = 0; phase = 0; + health50 = false; } void UpdateAI(uint32 diff) override { - if (timer >= 6000 && phase < 4) + if (timer >= 6000 && phase < 2) { phase++; setphase(phase); @@ -110,6 +121,20 @@ public: DoMeleeAttackIfReady(); } + void DamageTaken(Unit*, uint32& /*damage*/, DamageEffectType /*damagetype*/, SpellSchoolMask /*damageSchoolMask*/) override + { + if (HealthBelowPct(50) && !health50) + { + Talk(SAY_TURMOIL_HALF_HP, me->ToTempSummon()->GetSummonerUnit()->ToPlayer()); + health50 = true; + } + } + + void JustDied(Unit* /*killer*/) override + { + Talk(SAY_TURMOIL_DEATH, me->ToTempSummon()->GetSummonerUnit()->ToPlayer()); + } + void setphase(short newPhase) { Unit* summoner = me->ToTempSummon() ? me->ToTempSummon()->GetSummonerUnit() : nullptr; @@ -119,16 +144,11 @@ public: switch (newPhase) { case 1: - me->Whisper("You think that you can get rid of me through meditation?", LANG_UNIVERSAL, summoner->ToPlayer()); + Talk(SAY_TURMOIL_0, summoner->ToPlayer()); return; case 2: - me->Whisper("Fool! I will destroy you and finally become that which has been building inside of you all these years!", LANG_UNIVERSAL, summoner->ToPlayer()); - return; - case 3: - me->Whisper("You cannot defeat me. I'm an inseparable part of you!", LANG_UNIVERSAL, summoner->ToPlayer()); - return; - case 4: - me->Whisper("NOOOOOOOoooooooooo!", LANG_UNIVERSAL, summoner->ToPlayer()); + { + Talk(SAY_TURMOIL_1, summoner->ToPlayer()); me->SetLevel(summoner->getLevel()); me->SetFaction(FACTION_MONSTER); if (me->GetExactDist(summoner) < 50.0f) @@ -137,6 +157,7 @@ public: summoner->CastSpell(me, 50218, true); // clone caster AttackStart(summoner); } + } } } }; diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp index 8d460bed6..3550ca5bc 100644 --- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp +++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp @@ -85,6 +85,7 @@ enum AHerosBurden NPC_JALOOT = 28667, NPC_ZEPIK = 28668, + NPC_ARTRUIS = 28659, EVENT_CAST_FROST_BOLT = 1, EVENT_CAST_FROST_NOVA = 2, @@ -99,6 +100,16 @@ enum AHerosBurden ACTION_MAKE_FRIENDLY = 2, GO_ARTRUIS_PHYLACTERY = 190777, + + // Texts + SAY_TURNED_FRIENDLY = 0, // Zepik and Jaloot + + SAY_ARTRUIS_AGGRO = 0, + SAY_ARTRUIS_TALK_1 = 1, + SAY_ARTRUIS_TALK_2 = 2, + SAY_ARTRUIS_TALK_3 = 3, + SAY_ARTRUIS_SHIELD = 4, // Boss emote + SAY_ARTRUIS_TALK_4 = 5, }; class npc_artruis_the_hearthless : public CreatureScript @@ -143,7 +154,7 @@ public: void EnterCombat(Unit* /*who*/) override { - me->Yell("Ah, the heroes. Your little friends said you would come. This certainly saves me the trouble of hunting you down myself.", LANG_UNIVERSAL); + Talk(SAY_ARTRUIS_AGGRO); me->CastSpell(me, SPELL_ARTRUIS_ICY_VEINS, true); events.RescheduleEvent(EVENT_CAST_FROST_BOLT, 4000); events.RescheduleEvent(EVENT_CAST_FROST_NOVA, 15000); @@ -187,7 +198,7 @@ public: } else if (action == ACTION_MAKE_FRIENDLY && me->GetVictim()) { - minion->Say("Now you not catch us with back turned! Now we hurt you bad undead. BAD!", LANG_UNIVERSAL); + minion->AI()->Talk(SAY_TURNED_FRIENDLY); minion->RemoveAurasDueToSpell(SPELL_ARTRUIS_BINDING); minion->SetFaction(me->GetVictim()->GetFaction()); minion->AddThreat(me, 100000.0f); @@ -215,21 +226,22 @@ public: if (me->GetHealthPct() <= 30) { me->SetControlled(true, UNIT_STATE_STUNNED); - me->TextEmote("Artruis is shielded. You must choose your side quickly to break his spell.", nullptr, true); + Talk(SAY_ARTRUIS_SHIELD); + Talk(SAY_ARTRUIS_TALK_3); SummonsAction(ACTION_BIND_MINIONS); break; } events.RepeatEvent(1000); break; case EVENT_ARTRUIS_TALK1: - me->Yell("I have weathered a hundred years of war and suffering. Do you truly think it wise to pit your mortal bodies against a being that cannot die? I'd venture you have more to lose.", LANG_UNIVERSAL); + Talk(SAY_ARTRUIS_TALK_1); events.RescheduleEvent(EVENT_ARTRUIS_TALK2, 10000); break; case EVENT_ARTRUIS_TALK2: - me->Yell("Even shattered into countless pieces, the crystals all around weaken me... perhaps i should not have underestimated the titans so...", LANG_UNIVERSAL); + Talk(SAY_ARTRUIS_TALK_2); break; case EVENT_ARTRUIS_TALK3: - me->Yell("Arthas once mustered strength... of the very same sort... perhaps he is the path that you will follow.", LANG_UNIVERSAL); + Talk(SAY_ARTRUIS_TALK_4); break; case EVENT_CAST_FROST_BOLT: me->CastSpell(me->GetVictim(), SPELL_ARTRUIS_FROSTBOLT, false); @@ -261,24 +273,24 @@ public: quest Still At It (12644) ******/ -#define MCM_TEXT_START "Beginning the distillation in 5 seconds." -#define MCM_TEXT_PRESSURE "Pressure's too high! Open the pressure valve!" -#define MCM_TEXT_HEAT "The still needs heat! Light the brazier!" -#define MCM_TEXT_BANANA "Add bananas!" -#define MCM_TEXT_ORANGE "Add another orange! Quickly!" -#define MCM_TEXT_PAPAYA "Put a papaya in the still!" -#define MCM_TEXT_CORRECT1 "Nicely handled! Stay on your toes!" -#define MCM_TEXT_CORRECT2 "That'll do. Never know what it'll need next..." -#define MCM_TEXT_CORRECT3 "Good job! Keep your eyes open, now." -#define MCM_TEXT_SUCCESS1 "Well done! Be ready for anything!" -#define MCM_TEXT_SUCCESS2 "We've done it! Come get the cask." -#define MCM_TEXT_FAILED "You have FAILED!!!" -#define ACTION_PRESSURE 1 -#define ACTION_HEAT 2 -//#define ACTION_BANANA 3 -//#define ACTION_ORANGE 4 -//#define ACTION_PAPAYA 5 -#define NPC_WANTS_BANANAS 28537 +enum StillAtIt +{ + NPC_MANUS = 28566, + NPC_WANTS_BANANAS = 28537, + + QUEST_STILL_AT_IT = 12644, + GOSSIP_MANUS_MENU = 9713, + + SAY_MANUS_START = 0, + SAY_MANUS_ORANGE = 1, + SAY_MANUS_PAPAYA = 2, + SAY_MANUS_BANANA = 3, + SAY_MANUS_PRESSUE = 4, + SAY_MANUS_HEAT = 5, + SAY_MANUS_WELL_DONE = 6, + SAY_MANUS_FAILED = 7, + SAY_MANUS_END = 8, +}; class npc_still_at_it_trigger : public CreatureScript { @@ -305,6 +317,8 @@ public: npc_still_at_it_triggerAI(Creature* pCreature) : NullCreatureAI(pCreature) {} + Creature* GetManus() {return ObjectAccessor::GetCreature(*me, thunderbrewGUID);} + void Reset() override { running = false; @@ -324,20 +338,12 @@ public: damage = 0; } - void Say(const char* text) - { - if (Creature* th = ObjectAccessor::GetCreature(*me, thunderbrewGUID)) - th->Say(text, LANG_UNIVERSAL); - else - Reset(); - } - void Start() { timer = 5000; running = true; stepcount = urand(5, 10); - Say(MCM_TEXT_START); + GetManus()->AI()->Talk(SAY_MANUS_START); } void CheckAction(uint8 a, ObjectGuid guid) @@ -348,27 +354,15 @@ public: if (a == expectedaction) { currentstep++; - uint8 s = urand(0, 2); if (Creature* th = ObjectAccessor::GetCreature(*me, thunderbrewGUID)) th->HandleEmoteCommand(EMOTE_ONESHOT_CHEER_NO_SHEATHE); - switch (s) - { - case 0: - Say(MCM_TEXT_CORRECT1); - break; - case 1: - Say(MCM_TEXT_CORRECT2); - break; - default: - Say(MCM_TEXT_CORRECT3); - break; - } + GetManus()->AI()->Talk(SAY_MANUS_WELL_DONE); if (currentstep >= stepcount) { - Say(MCM_TEXT_SUCCESS1); + GetManus()->AI()->Talk(SAY_MANUS_WELL_DONE); success = true; timer = 3000; } @@ -380,7 +374,7 @@ public: } else { - Say(MCM_TEXT_FAILED); + GetManus()->AI()->Talk(SAY_MANUS_FAILED); Reset(); } } @@ -417,15 +411,15 @@ public: if( timer < 0 ) timer = 0; } - else if ( success) + else if (success) { - Say(MCM_TEXT_SUCCESS2); - me->SummonGameObject(190643, 5546.55f, 5768.0f, -78.03f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 60000); + GetManus()->AI()->Talk(SAY_MANUS_END); + me->SummonGameObject(190643, 5546.55f, 5768.0f, -78.03f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0); Reset(); } else if (expectedaction != 0) // didn't make it in 10 seconds { - Say(MCM_TEXT_FAILED); + GetManus()->AI()->Talk(SAY_MANUS_FAILED); Reset(); } else // it's time to rand next move @@ -434,19 +428,19 @@ public: switch (expectedaction) { case 1: - Say(MCM_TEXT_PRESSURE); + GetManus()->AI()->Talk(SAY_MANUS_PRESSUE); break; case 2: - Say(MCM_TEXT_HEAT); + GetManus()->AI()->Talk(SAY_MANUS_HEAT); break; case 3: - Say(MCM_TEXT_BANANA); + GetManus()->AI()->Talk(SAY_MANUS_BANANA); break; case 4: - Say(MCM_TEXT_ORANGE); + GetManus()->AI()->Talk(SAY_MANUS_ORANGE); break; case 5: - Say(MCM_TEXT_PAPAYA); + GetManus()->AI()->Talk(SAY_MANUS_PAPAYA); break; } timer = 10000; @@ -469,8 +463,8 @@ public: if (creature->IsQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - if (player->GetQuestStatus(12644) == QUEST_STATUS_INCOMPLETE) - AddGossipItemFor(player, GOSSIP_ICON_CHAT, "I'm ready to start the distillation, uh, Tipsy.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (player->GetQuestStatus(QUEST_STILL_AT_IT) == QUEST_STATUS_INCOMPLETE) + AddGossipItemFor(player, GOSSIP_MANUS_MENU, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID()); return true; @@ -541,13 +535,13 @@ public: ## npc_vekjik ######*/ -#define GOSSIP_VEKJIK_ITEM1 "Shaman Vekjik, I have spoken with the big-tongues and they desire peace. I have brought this offering on their behalf." -#define GOSSIP_VEKJIK_ITEM2 "No no... I had no intentions of betraying your people. I was only defending myself. it was all a misunderstanding." - enum Vekjik { - GOSSIP_TEXTID_VEKJIK1 = 13137, - GOSSIP_TEXTID_VEKJIK2 = 13138, + GOSSIP_VEKJIK_MENU_1 = 9678, + GOSSIP_VEKJIK_MENU_2 = 9686, + + GOSSIP_TEXTID_VEKJIK_1 = 13137, + GOSSIP_TEXTID_VEKJIK_2 = 13138, SAY_TEXTID_VEKJIK1 = 0, @@ -568,8 +562,8 @@ public: if (player->GetQuestStatus(QUEST_MAKING_PEACE) == QUEST_STATUS_INCOMPLETE) { - AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_VEKJIK_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - SendGossipMenuFor(player, GOSSIP_TEXTID_VEKJIK1, creature->GetGUID()); + AddGossipItemFor(player, GOSSIP_VEKJIK_MENU_1, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + SendGossipMenuFor(player, GOSSIP_TEXTID_VEKJIK_1, creature->GetGUID()); return true; } @@ -583,8 +577,8 @@ public: switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_VEKJIK_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - SendGossipMenuFor(player, GOSSIP_TEXTID_VEKJIK2, creature->GetGUID()); + AddGossipItemFor(player, GOSSIP_VEKJIK_MENU_2, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + SendGossipMenuFor(player, GOSSIP_TEXTID_VEKJIK_2, creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF+2: CloseGossipMenuFor(player); @@ -603,19 +597,19 @@ public: ## avatar_of_freya ######*/ -#define GOSSIP_ITEM_AOF1 "I want to stop the Scourge as much as you do. How can I help?" -#define GOSSIP_ITEM_AOF2 "You can trust me. I am no friend of the Lich King." -#define GOSSIP_ITEM_AOF3 "I will not fail." - enum Freya { QUEST_FREYA_PACT = 12621, SPELL_FREYA_CONVERSATION = 52045, - GOSSIP_TEXTID_AVATAR1 = 13303, - GOSSIP_TEXTID_AVATAR2 = 13304, - GOSSIP_TEXTID_AVATAR3 = 13305 + GOSSIP_AVATAR_MENU_1 = 9720, + GOSSIP_AVATAR_MENU_2 = 9721, + GOSSIP_AVATAR_MENU_3 = 9722, + + GOSSIP_TEXTID_AVATAR_1 = 13303, + GOSSIP_TEXTID_AVATAR_2 = 13304, + GOSSIP_TEXTID_AVATAR_3 = 13305, }; class npc_avatar_of_freya : public CreatureScript @@ -629,9 +623,9 @@ public: player->PrepareQuestMenu(creature->GetGUID()); if (player->GetQuestStatus(QUEST_FREYA_PACT) == QUEST_STATUS_INCOMPLETE) - AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + AddGossipItemFor(player, GOSSIP_AVATAR_MENU_1, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - SendGossipMenuFor(player, GOSSIP_TEXTID_AVATAR1, creature); + SendGossipMenuFor(player, GOSSIP_TEXTID_AVATAR_1, creature); return true; } @@ -641,12 +635,12 @@ public: switch (action) { case GOSSIP_ACTION_INFO_DEF+1: - AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - SendGossipMenuFor(player, GOSSIP_TEXTID_AVATAR2, creature); + AddGossipItemFor(player, GOSSIP_AVATAR_MENU_2, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + SendGossipMenuFor(player, GOSSIP_TEXTID_AVATAR_2, creature); break; case GOSSIP_ACTION_INFO_DEF+2: - AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_ITEM_AOF3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - SendGossipMenuFor(player, GOSSIP_TEXTID_AVATAR3, creature); + AddGossipItemFor(player, GOSSIP_AVATAR_MENU_3, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + SendGossipMenuFor(player, GOSSIP_TEXTID_AVATAR_3, creature); break; case GOSSIP_ACTION_INFO_DEF+3: player->CastSpell(player, SPELL_FREYA_CONVERSATION, true); @@ -828,8 +822,6 @@ public: ## npc_jungle_punch_target #####*/ -constexpr auto SAY_OFFER = "Care to try Grimbooze Thunderbrew's new jungle punch?"; - enum JunglePunch { ITEM_TANKARD = 2705, @@ -846,7 +838,10 @@ enum JunglePunch SAY_HEMET_HADRIUS_TAMARA_3 = 2, SAY_HEMET_4 = 3, // unused - SAY_HEMET_5 = 4 // unused + SAY_HEMET_5 = 4, // unused + + // Player Say + SAY_OFFER = 28558, }; enum NesingwaryChildrensWeek @@ -1013,7 +1008,7 @@ public: continue; player->KilledMonsterCredit(me->GetEntry()); - player->Say(SAY_OFFER, LANG_UNIVERSAL); + player->Say(SAY_OFFER); sayStep = 1; break; } @@ -1038,10 +1033,6 @@ public: ## npc_adventurous_dwarf ######*/ -#define GOSSIP_OPTION_ORANGE "Can you spare an orange?" -#define GOSSIP_OPTION_BANANAS "Have a spare bunch of bananas?" -#define GOSSIP_OPTION_PAPAYA "I could really use a papaya." - enum AdventurousDwarf { QUEST_12634 = 12634, @@ -1054,10 +1045,14 @@ enum AdventurousDwarf SPELL_ADD_BANANAS = 52074, SPELL_ADD_PAPAYA = 52076, - GOSSIP_MENU_DWARF = 13307, - SAY_DWARF_OUCH = 0, - SAY_DWARF_HELP = 1 + SAY_DWARF_HELP = 1, + + // Gossips + GOSSIP_DWARF_MENU = 9724, + GOSSIP_DWARF_ORANGE = 0, + GOSSIP_DWARF_BANANA = 1, + GOSSIP_DWARF_PAPAYA = 2, }; class npc_adventurous_dwarf : public CreatureScript @@ -1084,15 +1079,15 @@ public: return false; if (player->GetItemCount(ITEM_ORANGE) < 1) - AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_OPTION_ORANGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + AddGossipItemFor(player, GOSSIP_DWARF_MENU, GOSSIP_DWARF_ORANGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); if (player->GetItemCount(ITEM_BANANAS) < 2) - AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_OPTION_BANANAS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + AddGossipItemFor(player, GOSSIP_DWARF_MENU, GOSSIP_DWARF_BANANA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); if (player->GetItemCount(ITEM_PAPAYA) < 1) - AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_OPTION_PAPAYA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + AddGossipItemFor(player, GOSSIP_DWARF_MENU, GOSSIP_DWARF_PAPAYA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - SendGossipMenuFor(player, GOSSIP_MENU_DWARF, creature); + SendGossipMenuFor(player, player->GetGossipTextId(creature), creature); return true; } diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index 123594b4a..3ba339792 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -41,6 +41,8 @@ enum eWGqueuenpctext WG_NPCQUEUE_TEXT_A_QUEUE = 14791, WG_NPCQUEUE_TEXT_A_WAR = 14781, WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507, + + WG_GOSSIP_MENU_QUEUE = 10662, }; enum Spells @@ -295,7 +297,7 @@ public: if (wintergrasp->IsWarTime()) { - AddGossipItemFor(player, GOSSIP_ICON_CHAT_19, "Queue for Wintergrasp.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + AddGossipItemFor(player, WG_GOSSIP_MENU_QUEUE, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); SendGossipMenuFor(player, wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_WAR : WG_NPCQUEUE_TEXT_A_WAR, creature->GetGUID()); } else @@ -304,7 +306,7 @@ public: player->SendUpdateWorldState(4354, GameTime::GetGameTime().count() + timer); if (timer < 15 * MINUTE) { - AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Queue for Wintergrasp.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + AddGossipItemFor(player, WG_GOSSIP_MENU_QUEUE, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); SendGossipMenuFor(player, wintergrasp->GetDefenderTeam() ? WG_NPCQUEUE_TEXT_H_QUEUE : WG_NPCQUEUE_TEXT_A_QUEUE, creature->GetGUID()); } else From 75a27c02ceed0d814b32b8c665e3555809f57e74 Mon Sep 17 00:00:00 2001 From: avarishd <46330494+avarishd@users.noreply.github.com> Date: Mon, 30 May 2022 10:24:49 +0300 Subject: [PATCH 06/13] fix(DB/Creature): Leviathan Mk II's Plasma Blast BroadcastTextId (#11874) Create rev_1653602942462997500.sql --- data/sql/updates/pending_db_world/rev_1653602942462997500.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1653602942462997500.sql diff --git a/data/sql/updates/pending_db_world/rev_1653602942462997500.sql b/data/sql/updates/pending_db_world/rev_1653602942462997500.sql new file mode 100644 index 000000000..8dbf2b6ef --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1653602942462997500.sql @@ -0,0 +1,2 @@ +-- BroadcastTextId for Leviathan Mk II's plasma blast +UPDATE `creature_text` SET `BroadcastTextId` = 34217 WHERE `CreatureID` = 33432 AND `GroupID` = 0; From 9c6bcf9e28fb41dd2ff37dfacf9580bef84efa7f Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Mon, 30 May 2022 07:26:55 +0000 Subject: [PATCH 07/13] chore(DB): import pending files Referenced commit(s): 75a27c02ceed0d814b32b8c665e3555809f57e74 --- .../rev_1653602942462997500.sql => db_world/2022_05_30_01.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1653602942462997500.sql => db_world/2022_05_30_01.sql} (77%) diff --git a/data/sql/updates/pending_db_world/rev_1653602942462997500.sql b/data/sql/updates/db_world/2022_05_30_01.sql similarity index 77% rename from data/sql/updates/pending_db_world/rev_1653602942462997500.sql rename to data/sql/updates/db_world/2022_05_30_01.sql index 8dbf2b6ef..d9e8fee81 100644 --- a/data/sql/updates/pending_db_world/rev_1653602942462997500.sql +++ b/data/sql/updates/db_world/2022_05_30_01.sql @@ -1,2 +1,3 @@ +-- DB update 2022_05_30_00 -> 2022_05_30_01 -- BroadcastTextId for Leviathan Mk II's plasma blast UPDATE `creature_text` SET `BroadcastTextId` = 34217 WHERE `CreatureID` = 33432 AND `GroupID` = 0; From f85b62a77f30bf89649e714ac2a407cc4dc6a6c3 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 30 May 2022 11:36:32 +0200 Subject: [PATCH 08/13] fix(Scripts/ZulGurub): Jindo cannot attack targets affected by Hex. (#11837) Fixed #11556 --- .../scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 19512ed78..41fec401c 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -110,12 +110,7 @@ public: events.ScheduleEvent(EVENT_POWERFULLHEALINGWARD, urand(14000, 20000)); break; case EVENT_HEX: - if (Unit* target = me->GetVictim()) - { - DoCast(target, SPELL_HEX, true); - if (DoGetThreat(target)) - DoModifyThreatPercent(target, -80); - } + DoCastVictim(SPELL_HEX, true); events.ScheduleEvent(EVENT_HEX, urand(12000, 20000)); break; case EVENT_DELUSIONSOFJINDO: // HACK @@ -174,6 +169,11 @@ public: DoMeleeAttackIfReady(); } + + bool CanAIAttack(Unit const* target) const override + { + return !target->HasAura(SPELL_HEX); + } }; CreatureAI* GetAI(Creature* creature) const override From 5b719bab05648800ad7ac42cf795a14f6d3f0045 Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Mon, 30 May 2022 11:36:58 +0200 Subject: [PATCH 09/13] fix(Core): Crashfix. (#11898) Fixes #11861 --- .../instance_blackrock_spire.cpp | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp index 25c48eff9..8bd9dadcd 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockSpire/instance_blackrock_spire.cpp @@ -78,7 +78,7 @@ public: { uint32 CurrentSolakarWave = 0; uint32 SolakarState = NOT_STARTED; // there should be a global instance encounter state, where is it? - std::vector SolakarSummons; + GuidVector SolakarSummons; instance_blackrock_spireMapScript(InstanceMap* map) : InstanceScript(map) { @@ -360,11 +360,11 @@ public: } break; case FAIL: - for (const auto& creature : SolakarSummons) + for (ObjectGuid const& guid : SolakarSummons) { - if (creature) + if (Creature* creature = instance->GetCreature(guid)) { - creature->RemoveFromWorld(); + creature->DespawnOrUnsummon(); } } SolakarSummons.clear(); @@ -429,11 +429,19 @@ public: { if (number < MAX_WAVE_COUNT) { - SolakarSummons.push_back(instance->SummonCreature(NPC_ROOKERY_GUARDIAN, SolakarPosLeft)); - SolakarSummons.push_back(instance->SummonCreature(NPC_ROOKERY_HATCHER, SolakarPosRight)); + if (Creature* summon = instance->SummonCreature(NPC_ROOKERY_GUARDIAN, SolakarPosLeft)) + { + SolakarSummons.push_back(summon->GetGUID()); + } + + if (Creature* summon = instance->SummonCreature(NPC_ROOKERY_HATCHER, SolakarPosRight)) + { + SolakarSummons.push_back(summon->GetGUID()); + } + if (number == 0) { - if (Creature* FirstHatcher = SolakarSummons.back()) // works because we spawned a hatcher second + if (Creature* FirstHatcher = instance->GetCreature(SolakarSummons.back())) // works because we spawned a hatcher second { FirstHatcher->AI()->Talk(SAY_SOLAKAR_FIRST_HATCHER); } @@ -441,7 +449,10 @@ public: } else if (number == MAX_WAVE_COUNT) { - SolakarSummons.push_back(instance->SummonCreature(NPC_SOLAKAR, SolakarPosBoss)); + if (Creature* summon = instance->SummonCreature(NPC_SOLAKAR, SolakarPosBoss)) + { + SolakarSummons.push_back(summon->GetGUID()); + } } } From a8eb0ef7b53680f532a5c106d6398ae64d87b073 Mon Sep 17 00:00:00 2001 From: temperrr Date: Mon, 30 May 2022 11:42:49 +0200 Subject: [PATCH 10/13] fix(DB/Loot): Zul'Gurub boss loot (#11844) * Fix(DB/Loot): Zul'Gurub boss loot * Update rev_1653289483708667578.sql --- .../rev_1653289483708667578.sql | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1653289483708667578.sql diff --git a/data/sql/updates/pending_db_world/rev_1653289483708667578.sql b/data/sql/updates/pending_db_world/rev_1653289483708667578.sql new file mode 100644 index 000000000..04430a738 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1653289483708667578.sql @@ -0,0 +1,50 @@ +DELETE FROM `creature_loot_template` WHERE (`Entry` IN (14507, 14509, 14510, 14515, 14517) AND `Item` IN (22711, 22712, 22713, 22714, 22715, 22716, 22718, 22720, 22721, 22722, 30546)) OR (`Entry` = 14834) AND (`Item` IN (34090, 30398)) OR (`Entry` IN (15084, 15082, 15085, 15083)); +INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES + +(14507, 30546, 30546, 100, 0, 1, 0, 1, 1, ''), +(14509, 30546, 30546, 100, 0, 1, 0, 1, 1, ''), +(14510, 30546, 30546, 100, 0, 1, 0, 1, 1, ''), +(14515, 30546, 30546, 100, 0, 1, 0, 1, 1, ''), +(14517, 30546, 30546, 100, 0, 1, 0, 1, 1, ''), +(14834, 34090, 34090, 100, 0, 1, 1, 1, 1, 'Hakkar - (ReferenceTable)'), +(14834, 30398, 30398, 100, 0, 1, 0, 1, 1, ''), +(15082, 19939, 0, 100, 0, 1, 2, 1, 1, 'Gri\'lek - Gri\'lek\'s Blood'), +(15082, 19939, 0, 20, 0, 1, 3, 1, 1, 'Gri\'lek - Gri\'lek\'s Blood'), +(15082, 19939, 0, 20, 0, 1, 4, 1, 1, 'Gri\'lek - Gri\'lek\'s Blood'), +(15082, 19961, 0, 0, 0, 1, 1, 1, 1, 'Gri\'lek - Gri\'lek\'s Grinder'), +(15082, 19962, 0, 0, 0, 1, 1, 1, 1, 'Gri\'lek - Gri\'lek\'s Carver'), +(15084, 19940, 0, 100, 0, 1, 2, 1, 1, 'Renataki - Renataki\'s Tooth'), +(15084, 19940, 0, 20, 0, 1, 3, 1, 1, 'Renataki - Renataki\'s Tooth'), +(15084, 19940, 0, 20, 0, 1, 4, 1, 1, 'Renataki - Renataki\'s Tooth'), +(15084, 19963, 0, 0, 0, 1, 1, 1, 1, 'Renataki - Pitchfork of Madness'), +(15084, 19964, 0, 0, 0, 1, 1, 1, 1, 'Renataki - Renataki\'s Soul Conduit'), +(15083, 19942, 0, 100, 0, 1, 2, 1, 1, 'Hazza\'rah - Hazza\'rah\'s Dream Thread'), +(15083, 19942, 0, 20, 0, 1, 3, 1, 1, 'Hazza\'rah - Hazza\'rah\'s Dream Thread'), +(15083, 19942, 0, 20, 0, 1, 4, 1, 1, 'Hazza\'rah - Hazza\'rah\'s Dream Thread'), +(15083, 19967, 0, 0, 0, 1, 1, 1, 1, 'Hazza\'rah - Thoughtblighter'), +(15083, 19968, 0, 0, 0, 1, 1, 1, 1, 'Hazza\'rah - Fiery Retributer'), +(15085, 19941, 0, 100, 0, 1, 2, 1, 1, 'Wushoolay - Wushoolay\'s Mane'), +(15085, 19941, 0, 20, 0, 1, 3, 1, 1, 'Wushoolay - Wushoolay\'s Mane'), +(15085, 19941, 0, 20, 0, 1, 4, 1, 1, 'Wushoolay - Wushoolay\'s Mane'), +(15085, 19965, 0, 0, 0, 1, 1, 1, 1, 'Wushoolay - Wushoolay\'s Poker'), +(15085, 19993, 0, 0, 0, 1, 1, 1, 1, 'Wushoolay - Hoodoo Hunting Bow'); + +DELETE FROM `reference_loot_template` WHERE (`Entry` = 30546) AND (`Item` IN (22711, 22712, 22713, 22714, 22715, 22716, 22718, 22720, 22721, 22722)) OR (`Entry` = 30398) AND (`Item` IN (19852, 19853, 19856, 19857, 19864, 20257, 20264)) OR (`Entry` = 34090) AND (`Item` IN (19852, 19853, 19856, 19857, 19864, 20257, 20264)); +INSERT INTO `reference_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES +(30546, 22711, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22712, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22713, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22714, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22715, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22716, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22718, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22720, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22721, 0, 0, 0, 1, 1, 1, 1, ''), +(30546, 22722, 0, 0, 0, 1, 1, 1, 1, ''), +(30398, 19852, 0, 0, 0, 1, 1, 1, 1, ''), +(30398, 19853, 0, 0, 0, 1, 1, 1, 1, ''), +(30398, 19856, 0, 0, 0, 1, 1, 1, 1, ''), +(30398, 19857, 0, 0, 0, 1, 1, 1, 1, ''), +(30398, 19864, 0, 0, 0, 1, 1, 1, 1, ''), +(30398, 20257, 0, 0, 0, 1, 1, 1, 1, ''), +(30398, 20264, 0, 0, 0, 1, 1, 1, 1, ''); From d44cea93e71445572fa35826adbf4de9035f35d0 Mon Sep 17 00:00:00 2001 From: AzerothCoreBot Date: Mon, 30 May 2022 09:44:50 +0000 Subject: [PATCH 11/13] chore(DB): import pending files Referenced commit(s): a8eb0ef7b53680f532a5c106d6398ae64d87b073 --- .../rev_1653289483708667578.sql => db_world/2022_05_30_02.sql} | 1 + 1 file changed, 1 insertion(+) rename data/sql/updates/{pending_db_world/rev_1653289483708667578.sql => db_world/2022_05_30_02.sql} (98%) diff --git a/data/sql/updates/pending_db_world/rev_1653289483708667578.sql b/data/sql/updates/db_world/2022_05_30_02.sql similarity index 98% rename from data/sql/updates/pending_db_world/rev_1653289483708667578.sql rename to data/sql/updates/db_world/2022_05_30_02.sql index 04430a738..0f108f32b 100644 --- a/data/sql/updates/pending_db_world/rev_1653289483708667578.sql +++ b/data/sql/updates/db_world/2022_05_30_02.sql @@ -1,3 +1,4 @@ +-- DB update 2022_05_30_01 -> 2022_05_30_02 DELETE FROM `creature_loot_template` WHERE (`Entry` IN (14507, 14509, 14510, 14515, 14517) AND `Item` IN (22711, 22712, 22713, 22714, 22715, 22716, 22718, 22720, 22721, 22722, 30546)) OR (`Entry` = 14834) AND (`Item` IN (34090, 30398)) OR (`Entry` IN (15084, 15082, 15085, 15083)); INSERT INTO `creature_loot_template` (`Entry`, `Item`, `Reference`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES From 40a5eef152addba3949016938519fa61d9776f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A9=E9=B9=BF?= Date: Tue, 31 May 2022 02:27:50 +0800 Subject: [PATCH 12/13] refactor(Core/Instances): Update CHAR_DELETE_INSTANCE_SAVED_DATA (#11866) * Update InstanceSaveMgr.cpp * Update Group.cpp * Update InstanceSaveMgr.cpp * Update InstanceSaveMgr.h * Update InstanceSaveMgr.cpp * Update InstanceSaveMgr.h * Update InstanceSaveMgr.cpp * Update InstanceSaveMgr.h * Update InstanceSaveMgr.cpp * Update Group.cpp * Update PlayerMisc.cpp * Update InstanceSaveMgr.h * Update Group.cpp * Update PlayerMisc.cpp * Update Group.cpp * Update Group.cpp * Update InstanceSaveMgr.cpp * Update InstanceSaveMgr.h * Update Group.h * Update InstanceSaveMgr.cpp * Update InstanceSaveMgr.cpp * Update InstanceSaveMgr.cpp --- .../game/Entities/Player/PlayerMisc.cpp | 16 +++----------- src/server/game/Groups/Group.cpp | 21 +++---------------- src/server/game/Groups/Group.h | 2 -- src/server/game/Instances/InstanceSaveMgr.cpp | 12 +++++++++++ src/server/game/Instances/InstanceSaveMgr.h | 1 + 5 files changed, 19 insertions(+), 33 deletions(-) diff --git a/src/server/game/Entities/Player/PlayerMisc.cpp b/src/server/game/Entities/Player/PlayerMisc.cpp index b7e2561b4..c8a91f0b9 100644 --- a/src/server/game/Entities/Player/PlayerMisc.cpp +++ b/src/server/game/Entities/Player/PlayerMisc.cpp @@ -181,16 +181,6 @@ void Player::SendResetFailedNotify(uint32 mapid) GetSession()->SendPacket(&data); } -void DeleteInstanceSavedData(uint32 instanceId) -{ - if (instanceId) - { - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DELETE_INSTANCE_SAVED_DATA); - stmt->SetData(0, instanceId); - CharacterDatabase.Execute(stmt); - } -} - /// Reset all solo instances and optionally send a message on success for each void Player::ResetInstances(ObjectGuid guid, uint8 method, bool isRaid) { @@ -223,7 +213,7 @@ void Player::ResetInstances(ObjectGuid guid, uint8 method, bool isRaid) p->SendResetInstanceFailed(0, instanceSave->GetMapId()); } - DeleteInstanceSavedData(instanceSave->GetInstanceId()); + sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId()); } for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) { @@ -258,7 +248,7 @@ void Player::ResetInstances(ObjectGuid guid, uint8 method, bool isRaid) p->SendResetInstanceFailed(0, instanceSave->GetMapId()); } - DeleteInstanceSavedData(instanceSave->GetInstanceId()); + sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId()); } for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) sInstanceSaveMgr->UnbindAllFor(*itr); @@ -287,7 +277,7 @@ void Player::ResetInstances(ObjectGuid guid, uint8 method, bool isRaid) //else // p->SendResetInstanceFailed(0, instanceSave->GetMapId()); - DeleteInstanceSavedData(instanceSave->GetInstanceId()); + sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId()); } for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) sInstanceSaveMgr->PlayerUnbindInstance(p->GetGUID(), (*itr)->GetMapId(), (*itr)->GetDifficulty(), true, p); diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 5b08d774e..6fa4ff077 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -829,12 +829,7 @@ void Group::Disband(bool hideDestroy /* = false */) } // Cleaning up instance saved data for gameobjects when a group is disbanded - if (instanceId) - { - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DELETE_INSTANCE_SAVED_DATA); - stmt->SetData(0, instanceId); - CharacterDatabase.Execute(stmt); - } + sInstanceSaveMgr->DeleteInstanceSavedData(instanceId); sGroupMgr->RemoveGroup(this); delete this; @@ -2037,16 +2032,6 @@ void Group::SetRaidDifficulty(Difficulty difficulty) } } -void Group::ResetInstanceSavedGameobjects(uint32 instanceId) -{ - if (instanceId) - { - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DELETE_INSTANCE_SAVED_DATA); - stmt->SetData(0, instanceId); - CharacterDatabase.Execute(stmt); - } -} - void Group::ResetInstances(uint8 method, bool isRaid, Player* leader) { if (isBGGroup() || isBFGroup() || isLFGGroup()) @@ -2078,7 +2063,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* leader) leader->SendResetInstanceFailed(0, instanceSave->GetMapId()); } - ResetInstanceSavedGameobjects(instanceSave->GetInstanceId()); + sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId()); } for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) sInstanceSaveMgr->UnbindAllFor(*itr); @@ -2106,7 +2091,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* leader) leader->SendResetInstanceFailed(0, instanceSave->GetMapId()); } - ResetInstanceSavedGameobjects(instanceSave->GetInstanceId()); + sInstanceSaveMgr->DeleteInstanceSavedData(instanceSave->GetInstanceId()); } for (std::vector::const_iterator itr = toUnbind.begin(); itr != toUnbind.end(); ++itr) sInstanceSaveMgr->UnbindAllFor(*itr); diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index a1041be31..8a03d6f38 100644 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -316,8 +316,6 @@ public: void SetDifficultyChangePrevention(DifficultyPreventionChangeType type); void DoForAllMembers(std::function const& worker); - // Reset Instance Gameobjects - void ResetInstanceSavedGameobjects(uint32 instanceId); protected: void _homebindIfInstance(Player* player); void _cancelHomebindIfInstance(Player* player); diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index 152cffd45..6058b300b 100644 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -132,6 +132,7 @@ bool InstanceSaveMgr::DeleteInstanceSaveIfNeeded(InstanceSave* save, bool skipMa CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_INSTANCE); stmt->SetData(0, save->GetInstanceId()); CharacterDatabase.Execute(stmt); + DeleteInstanceSavedData(save->GetInstanceId()); // clear respawn times (if map is loaded do it just to be sure, if already unloaded it won't do it by itself) Map::DeleteRespawnTimesInDB(save->GetMapId(), save->GetInstanceId()); @@ -244,6 +245,16 @@ void InstanceSaveMgr::SanitizeInstanceSavedData() CharacterDatabase.Execute(stmt); } +void InstanceSaveMgr::DeleteInstanceSavedData(uint32 instanceId) +{ + if (instanceId) + { + CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DELETE_INSTANCE_SAVED_DATA); + stmt->SetData(0, instanceId); + CharacterDatabase.Execute(stmt); + } +} + void InstanceSaveMgr::LoadInstances() { uint32 oldMSTime = getMSTime(); @@ -512,6 +523,7 @@ void InstanceSaveMgr::_ResetSave(InstanceSaveHashMap::iterator& itr) stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INSTANCE_BY_INSTANCE); stmt->SetData(0, itr->second->GetInstanceId()); CharacterDatabase.Execute(stmt); + DeleteInstanceSavedData(itr->second->GetInstanceId()); // clear respawn times if the map is already unloaded and won't do it by itself if (!sMapMgr->FindMap(itr->second->GetMapId(), itr->second->GetInstanceId())) diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index 945b4d79d..7c6f18371 100644 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.h @@ -183,6 +183,7 @@ public: void UnbindAllFor(InstanceSave* save); void SanitizeInstanceSavedData(); + void DeleteInstanceSavedData(uint32 instanceId); protected: static uint16 ResetTimeDelay[]; static PlayerBindStorage playerBindStorage; From 4fbec972a8fe55d73744205322298791ded0c204 Mon Sep 17 00:00:00 2001 From: Kargatum Date: Tue, 31 May 2022 17:05:39 +0700 Subject: [PATCH 13/13] refactor(Cmake): add support build selected applications and tools (#11836) --- .github/workflows/core_build.yml | 6 +- .github/workflows/core_matrix_build.yml | 6 +- .github/workflows/core_modules_build.yml | 6 +- .github/workflows/windows_build.yml | 10 +- CMakeLists.txt | 22 +- apps/ci/{ci-conf.sh => ci-conf-core.sh} | 7 +- apps/ci/ci-conf-tools.sh | 68 ++++++ apps/ci/ci-dry-run.sh | 28 +++ apps/ci/ci-worldserver-dry-run.sh | 11 - apps/compiler/includes/functions.sh | 22 +- apps/docker/Dockerfile | 12 +- conf/dist/config.cmake | 51 ++++- conf/dist/config.sh | 35 ++-- deps/CMakeLists.txt | 28 +-- src/CMakeLists.txt | 18 +- src/cmake/macros/ConfigInstall.cmake | 46 +++- src/cmake/macros/ConfigureApplications.cmake | 108 ++++++++++ src/cmake/macros/ConfigureTools.cmake | 110 ++++++++++ src/cmake/showoptions.cmake | 25 +-- src/common/CMakeLists.txt | 22 +- src/common/Logging/Log.h | 2 +- src/server/CMakeLists.txt | 29 ++- src/server/apps/CMakeLists.txt | 198 ++++++++++++++++++ .../authserver/Authentication/AuthCodes.cpp | 0 .../authserver/Authentication/AuthCodes.h | 0 src/server/{ => apps}/authserver/Main.cpp | 80 ++++--- .../PrecompiledHeaders/authserverPCH.h} | 0 .../authserver/Server/AuthSession.cpp | 0 .../authserver/Server/AuthSession.h | 0 .../authserver/Server/AuthSocketMgr.h | 0 .../authserver/authserver.conf.dist | 0 .../{ => apps}/authserver/authserver.ico | Bin .../{ => apps}/authserver/authserver.rc | 0 src/server/{ => apps}/authserver/resource.h | 0 .../{ => apps}/worldserver/ACSoap/ACSoap.cpp | 0 .../{ => apps}/worldserver/ACSoap/ACSoap.h | 0 .../worldserver/CommandLine/CliRunnable.cpp | 0 .../worldserver/CommandLine/CliRunnable.h | 0 src/server/{ => apps}/worldserver/Main.cpp | 137 ++++++------ .../PrecompiledHeaders/worldserverPCH.h} | 0 .../worldserver/RemoteAccess/RASession.cpp | 0 .../worldserver/RemoteAccess/RASession.h | 0 src/server/{ => apps}/worldserver/resource.h | 0 .../worldserver/worldserver.conf.dist | 0 .../{ => apps}/worldserver/worldserver.ico | Bin .../{ => apps}/worldserver/worldserver.rc | 0 src/server/authserver/CMakeLists.txt | 77 ------- .../database/Database/MySQLConnection.cpp | 4 +- src/server/scripts/CMakeLists.txt | 23 +- src/server/shared/SharedDefines.h | 1 - src/server/worldserver/CMakeLists.txt | 91 -------- src/tools/CMakeLists.txt | 156 +++++++++++++- src/tools/map_extractor/CMakeLists.txt | 55 ----- src/tools/mmaps_generator/CMakeLists.txt | 50 ----- src/tools/vmap4_assembler/CMakeLists.txt | 38 ---- src/tools/vmap4_extractor/CMakeLists.txt | 46 ---- 56 files changed, 1006 insertions(+), 622 deletions(-) rename apps/ci/{ci-conf.sh => ci-conf-core.sh} (95%) create mode 100644 apps/ci/ci-conf-tools.sh create mode 100644 apps/ci/ci-dry-run.sh delete mode 100755 apps/ci/ci-worldserver-dry-run.sh create mode 100644 src/cmake/macros/ConfigureApplications.cmake create mode 100644 src/cmake/macros/ConfigureTools.cmake create mode 100644 src/server/apps/CMakeLists.txt rename src/server/{ => apps}/authserver/Authentication/AuthCodes.cpp (100%) rename src/server/{ => apps}/authserver/Authentication/AuthCodes.h (100%) rename src/server/{ => apps}/authserver/Main.cpp (84%) rename src/server/{authserver/PrecompiledHeaders/authPCH.h => apps/authserver/PrecompiledHeaders/authserverPCH.h} (100%) rename src/server/{ => apps}/authserver/Server/AuthSession.cpp (100%) rename src/server/{ => apps}/authserver/Server/AuthSession.h (100%) rename src/server/{ => apps}/authserver/Server/AuthSocketMgr.h (100%) rename src/server/{ => apps}/authserver/authserver.conf.dist (100%) rename src/server/{ => apps}/authserver/authserver.ico (100%) rename src/server/{ => apps}/authserver/authserver.rc (100%) rename src/server/{ => apps}/authserver/resource.h (100%) rename src/server/{ => apps}/worldserver/ACSoap/ACSoap.cpp (100%) rename src/server/{ => apps}/worldserver/ACSoap/ACSoap.h (100%) rename src/server/{ => apps}/worldserver/CommandLine/CliRunnable.cpp (100%) rename src/server/{ => apps}/worldserver/CommandLine/CliRunnable.h (100%) rename src/server/{ => apps}/worldserver/Main.cpp (91%) rename src/server/{worldserver/PrecompiledHeaders/worldPCH.h => apps/worldserver/PrecompiledHeaders/worldserverPCH.h} (100%) rename src/server/{ => apps}/worldserver/RemoteAccess/RASession.cpp (100%) rename src/server/{ => apps}/worldserver/RemoteAccess/RASession.h (100%) rename src/server/{ => apps}/worldserver/resource.h (100%) rename src/server/{ => apps}/worldserver/worldserver.conf.dist (100%) rename src/server/{ => apps}/worldserver/worldserver.ico (100%) rename src/server/{ => apps}/worldserver/worldserver.rc (100%) delete mode 100644 src/server/authserver/CMakeLists.txt delete mode 100644 src/server/worldserver/CMakeLists.txt delete mode 100644 src/tools/map_extractor/CMakeLists.txt delete mode 100644 src/tools/mmaps_generator/CMakeLists.txt delete mode 100644 src/tools/vmap4_assembler/CMakeLists.txt delete mode 100644 src/tools/vmap4_extractor/CMakeLists.txt diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index 6fbd6e4e8..93cad079d 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -37,15 +37,13 @@ jobs: env: CONTINUOUS_INTEGRATION: true - name: Create conf/config.sh - run: source ./apps/ci/ci-conf.sh + run: source ./apps/ci/ci-conf-core.sh - name: Process pending sql run: bash bin/acore-db-pendings - - name: Import db - run: source ./apps/ci/ci-import-db.sh - name: Build run: source ./apps/ci/ci-compile.sh - name: Dry run - run: source ./apps/ci/ci-worldserver-dry-run.sh + run: source ./apps/ci/ci-dry-run.sh worldserver - name: Check startup errors run: source ./apps/ci/ci-error-check.sh - name: Run unit tests diff --git a/.github/workflows/core_matrix_build.yml b/.github/workflows/core_matrix_build.yml index 00b3c770d..5f7f9658f 100644 --- a/.github/workflows/core_matrix_build.yml +++ b/.github/workflows/core_matrix_build.yml @@ -49,13 +49,11 @@ jobs: env: CONTINUOUS_INTEGRATION: true - name: Create conf/config.sh - run: source ./apps/ci/ci-conf.sh - - name: Import db - run: source ./apps/ci/ci-import-db.sh + run: source ./apps/ci/ci-conf-core.sh - name: Build run: source ./apps/ci/ci-compile.sh - name: Dry run - run: source ./apps/ci/ci-worldserver-dry-run.sh + run: source ./apps/ci/ci-dry-run.sh worldserver - name: Check startup errors run: source ./apps/ci/ci-error-check.sh - name: Run unit tests diff --git a/.github/workflows/core_modules_build.yml b/.github/workflows/core_modules_build.yml index da71c68d3..4b932b04f 100644 --- a/.github/workflows/core_modules_build.yml +++ b/.github/workflows/core_modules_build.yml @@ -42,13 +42,11 @@ jobs: env: CONTINUOUS_INTEGRATION: true - name: Create conf/config.sh - run: source ./apps/ci/ci-conf.sh - - name: Import db - run: source ./apps/ci/ci-import-db.sh + run: source ./apps/ci/ci-conf-core.sh - name: Build run: source ./apps/ci/ci-compile.sh - name: Dry run - run: source ./apps/ci/ci-worldserver-dry-run.sh + run: source ./apps/ci/ci-dry-run.sh worldserver - name: Check startup errors run: source ./apps/ci/ci-error-check.sh - name: Run unit tests diff --git a/.github/workflows/windows_build.yml b/.github/workflows/windows_build.yml index 013ac8625..44fb89930 100644 --- a/.github/workflows/windows_build.yml +++ b/.github/workflows/windows_build.yml @@ -15,16 +15,16 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-2019] + os: [windows-latest] runs-on: ${{ matrix.os }} - name: ${{ matrix.os }}-MSVC16 + name: ${{ matrix.os }}-${{ matrix.compiler }} env: - BOOST_ROOT: C:\local\boost_1_74_0 + BOOST_ROOT: C:\local\boost_1_79_0 if: github.repository == 'azerothcore/azerothcore-wotlk' && (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build') steps: - uses: actions/checkout@v2 - name: Configure OS - run: choco install --no-progress openssl boost-msvc-14.2 + run: choco install --no-progress openssl boost-msvc-14.3 - name: Build shell: bash run: | @@ -39,5 +39,5 @@ jobs: cp "/c/Program Files/OpenSSL-Win64/bin/libssl-1_1-x64.dll" "build/bin/Release/" - uses: actions/upload-artifact@v2 with: - name: windows-2019-MSVC16-release + name: windows-2022-MSVC17-release path: build/bin/Release diff --git a/CMakeLists.txt b/CMakeLists.txt index f0b701bf6..ea6bdb971 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,8 @@ include(CheckCXXSourceRuns) include(CheckIncludeFiles) include(ConfigureScripts) include(ConfigureModules) +include(ConfigureApplications) +include(ConfigureTools) # some utils for cmake include(deps/acore/cmake-utils/utils.cmake) @@ -96,9 +98,6 @@ include(ConfigInstall) CU_RUN_HOOK("AFTER_LOAD_CMAKE_MODULES") -# basic packagesearching and setup (further support will be needed, this is a preliminary release!) -set(ACE_EXPECTED_VERSION 6.0.3) - find_package(PCHSupport) find_package(MySQL REQUIRED) @@ -121,14 +120,7 @@ include(src/cmake/showoptions.cmake) # add_subdirectory(deps) - -if (SERVERS OR TOOLS) - add_subdirectory(src/common) -endif() - -if (TOOLS) - add_subdirectory(src/tools) -endif() +add_subdirectory(src/common) # # Loading application sources @@ -139,12 +131,14 @@ CU_RUN_HOOK("BEFORE_SRC_LOAD") # add core sources add_subdirectory(src) -# add modules sources -add_subdirectory(modules) +if (BUILD_APPLICATION_WORLDSERVER) + # add modules sources + add_subdirectory(modules) +endif() CU_RUN_HOOK("AFTER_SRC_LOAD") -if( BUILD_TESTING ) +if (BUILD_TESTING AND BUILD_APPLICATION_WORLDSERVER) # we use these flags to get code coverage set(UNIT_TEST_CXX_FLAGS "-fprofile-arcs -ftest-coverage -fno-inline") diff --git a/apps/ci/ci-conf.sh b/apps/ci/ci-conf-core.sh similarity index 95% rename from apps/ci/ci-conf.sh rename to apps/ci/ci-conf-core.sh index 4f9ef6fda..31ed0a4ba 100644 --- a/apps/ci/ci-conf.sh +++ b/apps/ci/ci-conf-core.sh @@ -7,10 +7,9 @@ MTHREADS=$(($(grep -c ^processor /proc/cpuinfo) + 2)) CWARNINGS=ON CDEBUG=OFF CTYPE=Release +CTOOLS_BUILD=all CSCRIPTS=static CBUILD_TESTING=ON -CSERVERS=ON -CTOOLS=ON CSCRIPTPCH=OFF CCOREPCH=OFF CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"' @@ -19,10 +18,6 @@ DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='root'; MYSQL_HOST='localhost';" CONFIG_SH -if [[ $ENABLE_CPP_20 -eq 1 ]]; then - echo "CUSE_CPP_20=ON" >> ./conf/config.sh -fi - case $COMPILER in # this is in order to use the "default" gcc version of the OS, without forcing a specific version diff --git a/apps/ci/ci-conf-tools.sh b/apps/ci/ci-conf-tools.sh new file mode 100644 index 000000000..8ae787f04 --- /dev/null +++ b/apps/ci/ci-conf-tools.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +set -e + +cat >>conf/config.sh <> ./conf/config.sh + echo "CCOMPILERCXX=\"g++\"" >> ./conf/config.sh + ;; + + "gcc8" ) + time sudo apt-get install -y gcc-8 g++-8 + echo "CCOMPILERC=\"gcc-8\"" >> ./conf/config.sh + echo "CCOMPILERCXX=\"g++-8\"" >> ./conf/config.sh + ;; + + "gcc10" ) + time sudo apt-get install -y gcc-10 g++-10 + echo "CCOMPILERC=\"gcc-10\"" >> ./conf/config.sh + echo "CCOMPILERCXX=\"g++-10\"" >> ./conf/config.sh + ;; + + # this is in order to use the "default" clang version of the OS, without forcing a specific version + "clang" ) + time sudo apt-get install -y clang + echo "CCOMPILERC=\"clang\"" >> ./conf/config.sh + echo "CCOMPILERCXX=\"clang++\"" >> ./conf/config.sh + ;; + + "clang10" ) + time sudo apt-get install -y clang-10 + echo "CCOMPILERC=\"clang-10\"" >> ./conf/config.sh + echo "CCOMPILERCXX=\"clang++-10\"" >> ./conf/config.sh + ;; + + "clang11" ) + time sudo apt-get install -y clang-11 + echo "CCOMPILERC=\"clang-11\"" >> ./conf/config.sh + echo "CCOMPILERCXX=\"clang++-11\"" >> ./conf/config.sh + ;; + + "clang12" ) + time sudo apt-get install -y clang-12 + echo "CCOMPILERC=\"clang-12\"" >> ./conf/config.sh + echo "CCOMPILERCXX=\"clang++-12\"" >> ./conf/config.sh + ;; + + * ) + echo "Unknown compiler $COMPILER" + exit 1 + ;; +esac diff --git a/apps/ci/ci-dry-run.sh b/apps/ci/ci-dry-run.sh new file mode 100644 index 000000000..2d234ea9a --- /dev/null +++ b/apps/ci/ci-dry-run.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +# Start mysql +sudo systemctl start mysql + +APP_NAME=$1 + +echo "LoginDatabaseInfo = \"localhost;3306;root;root;acore_auth\"" >> ./env/dist/etc/$APP_NAME.conf + +if [[ $APP_NAME != "authserver" ]]; then + { + echo "WorldDatabaseInfo = \"localhost;3306;root;root;acore_world\"" + echo "CharacterDatabaseInfo = \"localhost;3306;root;root;acore_characters\"" + } >> ./env/dist/etc/$APP_NAME.conf +fi + +if [[ $APP_NAME == "worldserver" ]]; then + echo "DataDir = \"../data/\"" >> ./env/dist/etc/$APP_NAME.conf + + git clone --depth=1 --branch=master --single-branch https://github.com/ac-data/ac-data.git ./env/dist/data +fi + +(cd ./env/dist/bin/ && timeout 5m ./$APP_NAME -dry-run) + +# Stop mysql +sudo systemctl stop mysql diff --git a/apps/ci/ci-worldserver-dry-run.sh b/apps/ci/ci-worldserver-dry-run.sh deleted file mode 100755 index d58e20e24..000000000 --- a/apps/ci/ci-worldserver-dry-run.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -set -e - -echo "[worldserver]" >> ./env/dist/etc/worldserver.conf -echo "DataDir = \"../data/\"" >> ./env/dist/etc/worldserver.conf -echo "LoginDatabaseInfo = \"localhost;3306;root;root;acore_auth\"" >> ./env/dist/etc/worldserver.conf -echo "WorldDatabaseInfo = \"localhost;3306;root;root;acore_world\"" >> ./env/dist/etc/worldserver.conf -echo "CharacterDatabaseInfo = \"localhost;3306;root;root;acore_characters\"" >> ./env/dist/etc/worldserver.conf -git clone --depth=1 --branch=master --single-branch https://github.com/ac-data/ac-data.git ./env/dist/data -(cd ./env/dist/bin/ && timeout 5m ./worldserver --dry-run) diff --git a/apps/compiler/includes/functions.sh b/apps/compiler/includes/functions.sh index b29c58de3..ced1f488d 100644 --- a/apps/compiler/includes/functions.sh +++ b/apps/compiler/includes/functions.sh @@ -70,27 +70,25 @@ function comp_configure() { comp_ccacheEnable - cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH $DCONF -DSERVERS=$CSERVERS \ + cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH $DCONF \ + -DAPPS_BUILD=$CAPPS_BUILD \ + -DTOOLS_BUILD=$CTOOLS_BUILD \ -DSCRIPTS=$CSCRIPTS \ - -DUSE_CPP_20=$CUSE_CPP_20 \ + -DMODULES=$CMODULES \ -DBUILD_TESTING=$CBUILD_TESTING \ - -DTOOLS=$CTOOLS \ -DUSE_SCRIPTPCH=$CSCRIPTPCH \ -DUSE_COREPCH=$CCOREPCH \ - -DWITH_COREDEBUG=$CDEBUG \ -DCMAKE_BUILD_TYPE=$CTYPE \ -DWITH_WARNINGS=$CWARNINGS \ -DCMAKE_C_COMPILER=$CCOMPILERC \ -DCMAKE_CXX_COMPILER=$CCOMPILERCXX \ - "-DDISABLED_AC_MODULES=$CDISABLED_AC_MODULES" \ - $CCUSTOMOPTIONS + $CBUILD_APPS_LIST $CBUILD_TOOLS_LIST $CCUSTOMOPTIONS cd $CWD runHooks "ON_AFTER_CONFIG" } - function comp_compile() { [ $MTHREADS == 0 ] && MTHREADS=$(grep -c ^processor /proc/cpuinfo) && MTHREADS=$(($MTHREADS + 2)) @@ -117,9 +115,9 @@ function comp_compile() { runHooks "ON_AFTER_BUILD" - # set worldserver SUID bit - sudo chown root:root "$AC_BINPATH_FULL/worldserver" - sudo chmod u+s "$AC_BINPATH_FULL/worldserver" + # set all aplications SUID bit + sudo chown -R root:root "$AC_BINPATH_FULL" + sudo chmod -R u+s "$AC_BINPATH_FULL" } function comp_build() { @@ -128,6 +126,6 @@ function comp_build() { } function comp_all() { - comp_clean - comp_build + comp_clean + comp_build } diff --git a/apps/docker/Dockerfile b/apps/docker/Dockerfile index 465868fe5..1a53b7a80 100644 --- a/apps/docker/Dockerfile +++ b/apps/docker/Dockerfile @@ -189,7 +189,8 @@ ENV AC_CCACHE=true ENV CCACHE_CPP2=true ENV CSCRIPTPCH=OFF ENV CCOREPCH=OFF -ENV CTOOLS=ON +# ENV CTOOLS_BUILD=all +ENV CTOOLS_BUILD=maps-only ENV CSCRIPTS=static RUN bash apps/docker/docker-build-prod.sh @@ -303,8 +304,9 @@ RUN mkdir -p /azerothcore/env/client/maps RUN mkdir -p /azerothcore/env/client/mmaps RUN mkdir -p /azerothcore/env/client/vmaps -COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mapextractor /azerothcore/env/client/mapextractor -COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/client/mmaps_generator -COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4assembler /azerothcore/env/client/vmap4assembler -COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4extractor /azerothcore/env/client/vmap4extractor +# Need fix +# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mapextractor /azerothcore/env/client/mapextractor +# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/client/mmaps_generator +# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4assembler /azerothcore/env/client/vmap4assembler +# COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/vmap4extractor /azerothcore/env/client/vmap4extractor diff --git a/conf/dist/config.cmake b/conf/dist/config.cmake index 52d41a754..c010deb63 100644 --- a/conf/dist/config.cmake +++ b/conf/dist/config.cmake @@ -11,15 +11,21 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -option(SERVERS "Build worldserver and authserver" 1) - set(SCRIPTS_AVAILABLE_OPTIONS none static dynamic minimal-static minimal-dynamic) set(MODULES_AVAILABLE_OPTIONS none static dynamic) +set(BUILD_APPS_AVAILABLE_OPTIONS none all auth-only world-only) +# set(BUILD_TOOLS_AVAILABLE_OPTIONS none all db-only maps-only) # DB import PR +set(BUILD_TOOLS_AVAILABLE_OPTIONS none all maps-only) set(SCRIPTS "static" CACHE STRING "Build core with scripts") set(MODULES "static" CACHE STRING "Build core with modules") +set(APPS_BUILD "all" CACHE STRING "Build list for applications") +set(TOOLS_BUILD "none" CACHE STRING "Build list for tools") + set_property(CACHE SCRIPTS PROPERTY STRINGS ${SCRIPTS_AVAILABLE_OPTIONS}) set_property(CACHE MODULES PROPERTY STRINGS ${MODULES_AVAILABLE_OPTIONS}) +set_property(CACHE APPS_BUILD PROPERTY STRINGS ${BUILD_APPS_AVAILABLE_OPTIONS}) +set_property(CACHE TOOLS_BUILD PROPERTY STRINGS ${BUILD_TOOLS_AVAILABLE_OPTIONS}) # Log a error when the value of the SCRIPTS variable isn't a valid option. if(SCRIPTS) @@ -30,7 +36,7 @@ if(SCRIPTS) endif() endif() -# Log a error when the value of the SCRIPTS variable isn't a valid option. +# Log a error when the value of the MODULES variable isn't a valid option. if(MODULES) list(FIND MODULES_AVAILABLE_OPTIONS "${MODULES}" MODULES_INDEX) if(${MODULES_INDEX} EQUAL -1) @@ -39,6 +45,24 @@ if(MODULES) endif() endif() +# Log a fatal error when the value of the APPS_BUILD variable isn't a valid option. +if(APPS_BUILD) + list(FIND BUILD_APPS_AVAILABLE_OPTIONS "${APPS_BUILD}" BUILD_APPS_INDEX) + if(${BUILD_APPS_INDEX} EQUAL -1) + message(FATAL_ERROR "The value (${APPS_BUILD}) of your APPS_BUILD variable is invalid! " + "Allowed values are: ${BUILD_APPS_AVAILABLE_OPTIONS}. Set default") + endif() +endif() + +# Log a fatal error when the value of the TOOLS_BUILD variable isn't a valid option. +if(TOOLS_BUILD) + list(FIND BUILD_TOOLS_AVAILABLE_OPTIONS "${TOOLS_BUILD}" BUILD_TOOLS_INDEX) + if(${BUILD_TOOLS_INDEX} EQUAL -1) + message(FATAL_ERROR "The value (${TOOLS_BUILD}) of your TOOLS_BUILD variable is invalid! " + "Allowed values are: ${BUILD_TOOLS_AVAILABLE_OPTIONS}. Set default") + endif() +endif() + # Build a list of all script modules when -DSCRIPT="custom" is selected GetScriptModuleList(SCRIPT_MODULE_LIST) foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST}) @@ -47,7 +71,7 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST}) set_property(CACHE ${SCRIPT_MODULE_VARIABLE} PROPERTY STRINGS default disabled static dynamic) endforeach() -# Build a list of all modules script when -DSCRIPT="custom" is selected +# Build a list of all modules script when -DMODULE="custom" is selected GetModuleSourceList(SCRIPT_MODULE_LIST) foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST}) ModuleNameToVariable(${SCRIPT_MODULE} SCRIPT_MODULE_VARIABLE) @@ -55,8 +79,23 @@ foreach(SCRIPT_MODULE ${SCRIPT_MODULE_LIST}) set_property(CACHE ${SCRIPT_MODULE_VARIABLE} PROPERTY STRINGS default disabled static dynamic) endforeach() +# Build a list of all applications when -DBUILD_APPS="custom" is selected +GetApplicationsList(APPLICATIONS_BUILD_LIST) +foreach(APPLICATION_BUILD_NAME ${APPLICATIONS_BUILD_LIST}) + ApplicationNameToVariable(${APPLICATION_BUILD_NAME} APPLICATION_BUILD_VARIABLE) + set(${APPLICATION_BUILD_VARIABLE} "default" CACHE STRING "Enable build the ${APPLICATION_BUILD_NAME} application.") + set_property(CACHE ${APPLICATION_BUILD_VARIABLE} PROPERTY STRINGS default enabled disabled) +endforeach() + +# Build a list of all applications when -DBUILD_TOOLS="custom" is selected +GetToolsList(TOOLS_BUILD_LIST) +foreach(TOOL_BUILD_NAME ${TOOLS_BUILD_LIST}) + ToolNameToVariable(${TOOL_BUILD_NAME} TOOL_BUILD_VARIABLE) + set(${TOOL_BUILD_VARIABLE} "default" CACHE STRING "Enable build the ${TOOL_BUILD_NAME} tool.") + set_property(CACHE ${TOOL_BUILD_VARIABLE} PROPERTY STRINGS default enabled disabled) +endforeach() + option(BUILD_TESTING "Build unit tests" 0) -option(TOOLS "Build map/vmap/mmap extraction/assembler tools" 0) option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts" 1) option(USE_COREPCH "Use precompiled headers when compiling servers" 1) option(WITH_WARNINGS "Show all warnings during compile" 0) @@ -69,6 +108,8 @@ option(WITH_STRICT_DATABASE_TYPE_CHECKS "Enable strict checking of database fiel option(WITHOUT_METRICS "Disable metrics reporting (i.e. InfluxDB and Grafana)" 0) option(WITH_DETAILED_METRICS "Enable detailed metrics reporting (i.e. time each session takes to update)" 0) +CheckApplicationsBuildList() +CheckToolsBuildList() IsDynamicLinkingRequired(WITH_DYNAMIC_LINKING_FORCED) IsDynamicLinkingModulesRequired(WITH_DYNAMIC_LINKING_FORCED) diff --git a/conf/dist/config.sh b/conf/dist/config.sh index 31c3648fd..2b82e919e 100644 --- a/conf/dist/config.sh +++ b/conf/dist/config.sh @@ -30,12 +30,12 @@ BINPATH="$AC_PATH_ROOT/env/dist" # DATAPATH_ZIP="$DATAPATH/data.zip" # azerothcore's official remote source address to pull from -# by default git will fetch form the azrothcore remote +# by default git will fetch form the azrothcore remote # You can change it to "origin" if you want to fetch/pull from the set remote ORIGIN_REMOTE="https://github.com/azerothcore/azerothcore-wotlk.git" -# Branch configuration for the installer to pull from. -# By default git will select the current working branch +# Branch configuration for the installer to pull from. +# By default git will select the current working branch # You can set it to "master" if you want the latest updates INSTALLER_PULL_FROM= @@ -44,8 +44,6 @@ INSTALLER_PULL_FROM= # COMPILER_CONFIGURATIONS # ############################################## - - # Set preferred compilers. # To use gcc (not suggested) instead of clang change in: # CCOMPILERC="/usr/bin/gcc" @@ -54,7 +52,6 @@ INSTALLER_PULL_FROM= CCOMPILERC="/usr/bin/clang" CCOMPILERCXX="/usr/bin/clang++" - # how many thread must be used for compilation ( leave zero to use all available ) MTHREADS=${MTHREADS:-0} # enable/disable warnings during compilation @@ -69,23 +66,31 @@ CDEBUG=OFF # * RelWithDebInfo: optimized, *with* debug info, but no debug (output) code or asserts. # * MinSizeRel: same as Release but optimizing for size rather than speed. CTYPE=${CTYPE:-Release} + # compile scripts CSCRIPTS=${CSCRIPTS:-static} + +# compile scripts +CMODULES=${CMODULES:-none} + # compile unit tests CBUILD_TESTING=OFF -# compile server -CSERVERS=${CSERVERS:-ON} -# compile tools -CTOOLS=${CTOOLS:-OFF} + # use precompiled headers ( fatest compilation but not optimized if you change headers often ) CSCRIPTPCH=${CSCRIPTPCH:-ON} CCOREPCH=${CCOREPCH:-ON} -# compile with C++20 -CUSE_CPP_20=${CUSE_CPP_20:-OFF} -# Skip specific modules from compilation (cmake reconfigure needed) -# use semicolon ; to separate modules -CDISABLED_AC_MODULES="" +# build apps list variable +CAPPS_BUILD=${CAPPS_BUILD:-all} + +# build tools list variable +CTOOLS_BUILD=${CTOOLS_BUILD:-none} + +# build apps list +CBUILD_APPS_LIST=${CBUILD_APPS_LIST:-''} + +# build tools list +CBUILD_TOOLS_LIST=${CBUILD_TOOLS_LIST:-''} # you can add your custom definitions here ( -D ) # example: CCUSTOMOPTIONS=" -DWITH_PERFTOOLS=ON diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 80c149d75..2d5b43505 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -16,30 +16,34 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows") endif() endif() +add_subdirectory(SFMT) +add_subdirectory(argon2) +add_subdirectory(boost) +add_subdirectory(fmt) +add_subdirectory(jemalloc) +add_subdirectory(openssl) +add_subdirectory(stdfs) add_subdirectory(threads) +add_subdirectory(utf8cpp) -if(SERVERS OR TOOLS) - add_subdirectory(boost) +# if ((APPS_BUILD AND (NOT APPS_BUILD STREQUAL "none")) OR BUILD_TOOLS_DB_IMPORT) #DB import PR +if ((APPS_BUILD AND (NOT APPS_BUILD STREQUAL "none"))) + add_subdirectory(mysql) +endif() + +if (BUILD_APPLICATION_WORLDSERVER OR BUILD_TOOLS_MAPS) add_subdirectory(zlib) add_subdirectory(g3dlite) add_subdirectory(recastnavigation) - add_subdirectory(fmt) - add_subdirectory(SFMT) - add_subdirectory(utf8cpp) - add_subdirectory(openssl) - add_subdirectory(argon2) - add_subdirectory(jemalloc) - add_subdirectory(stdfs) endif() -if(SERVERS) - add_subdirectory(mysql) +if (BUILD_APPLICATION_WORLDSERVER) add_subdirectory(readline) add_subdirectory(gsoap) add_subdirectory(gperftools) endif() -if(TOOLS) +if (BUILD_TOOLS_MAPS) add_subdirectory(bzip2) add_subdirectory(libmpq) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8ad54557e..ecd828a1c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,12 +14,26 @@ # This to stop a few silly crashes that could have been avoided IF people # weren't doing some -O3 psychooptimizations etc. +# Specified files for Windows +if (WIN32) + # Crash logs + set(winDebugging + ${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.cpp + ${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.h) + + # Service + set(winService + ${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp + ${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.h) +endif() + if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW) add_definitions(-fno-delete-null-pointer-checks) endif() add_subdirectory(genrev) +add_subdirectory(server) -if( SERVERS ) - add_subdirectory(server) +if (TOOLS_BUILD AND NOT TOOLS_BUILD STREQUAL "none") + add_subdirectory(tools) endif() diff --git a/src/cmake/macros/ConfigInstall.cmake b/src/cmake/macros/ConfigInstall.cmake index 8dc97a8e6..836ec610c 100644 --- a/src/cmake/macros/ConfigInstall.cmake +++ b/src/cmake/macros/ConfigInstall.cmake @@ -12,32 +12,62 @@ # # Use it like: -# CopyDefaultConfig(worldserver) +# CopyApplicationConfig(${APP_PROJECT_NAME} ${APPLICATION_NAME}) # -function(CopyDefaultConfig servertype) +function(CopyApplicationConfig projectName appName) + GetPathToApplication(${appName} SOURCE_APP_PATH) + if(WIN32) if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild") - add_custom_command(TARGET ${servertype} + add_custom_command(TARGET ${projectName} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs") - add_custom_command(TARGET ${servertype} + add_custom_command(TARGET ${projectName} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${servertype}.conf.dist" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs") + COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs") elseif(MINGW) add_custom_command(TARGET ${servertype} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/configs") add_custom_command(TARGET ${servertype} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/${servertype}.conf.dist ${CMAKE_BINARY_DIR}/bin/configs") + COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist ${CMAKE_BINARY_DIR}/bin/configs") endif() endif() if(UNIX) - install(FILES "${servertype}.conf.dist" DESTINATION "${CONF_DIR}") + install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CONF_DIR}") elseif(WIN32) - install(FILES "${servertype}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs") + install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs") + endif() +endfunction() + +function(CopyToolConfig projectName appName) + GetPathToTool(${appName} SOURCE_APP_PATH) + + if(WIN32) + if("${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild") + add_custom_command(TARGET ${projectName} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs") + add_custom_command(TARGET ${projectName} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist" "${CMAKE_BINARY_DIR}/bin/$(ConfigurationName)/configs") + elseif(MINGW) + add_custom_command(TARGET ${servertype} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/bin/configs") + add_custom_command(TARGET ${servertype} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE_APP_PATH}/${appName}.conf.dist ${CMAKE_BINARY_DIR}/bin/configs") + endif() + endif() + + if(UNIX) + install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CONF_DIR}") + elseif(WIN32) + install(FILES "${SOURCE_APP_PATH}/${appName}.conf.dist" DESTINATION "${CMAKE_INSTALL_PREFIX}/configs") endif() endfunction() diff --git a/src/cmake/macros/ConfigureApplications.cmake b/src/cmake/macros/ConfigureApplications.cmake new file mode 100644 index 000000000..38009eb18 --- /dev/null +++ b/src/cmake/macros/ConfigureApplications.cmake @@ -0,0 +1,108 @@ +# +# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# + +set(BUILD_APPLICATION_AUTHSERVER 0) +set(BUILD_APPLICATION_WORLDSERVER 0) + +# Returns the base path to the apps directory in the source directory +function(GetApplicationsBasePath variable) + set(${variable} "${CMAKE_SOURCE_DIR}/src/server/apps" PARENT_SCOPE) +endfunction() + +# Stores the absolut path of the given app in the variable +function(GetPathToApplication app variable) + GetApplicationsBasePath(APPS_BASE_PATH) + set(${variable} "${APPS_BASE_PATH}/${app}" PARENT_SCOPE) +endfunction() + +# Stores the project name of the given app in the variable +function(GetProjectNameOfApplicationName app variable) + string(TOLOWER "${app}" GENERATED_NAME) + set(${variable} "${GENERATED_NAME}" PARENT_SCOPE) +endfunction() + +# Creates a list of all applications and stores it in the given variable. +function(GetApplicationsList variable) + GetApplicationsBasePath(BASE_PATH) + file(GLOB LOCALE_SOURCE_APP_LIST RELATIVE + ${BASE_PATH} + ${BASE_PATH}/*) + + set(${variable}) + + foreach(SOURCE_APP ${LOCALE_SOURCE_APP_LIST}) + GetPathToApplication(${SOURCE_APP} SOURCE_APP_PATH) + if(IS_DIRECTORY ${SOURCE_APP_PATH}) + list(APPEND ${variable} ${SOURCE_APP}) + endif() + endforeach() + + set(${variable} ${${variable}} PARENT_SCOPE) +endfunction() + +# Converts the given application name into it's +# variable name which holds the build type. +function(ApplicationNameToVariable application variable) + string(TOUPPER ${application} ${variable}) + set(${variable} "APP_${${variable}}") + set(${variable} ${${variable}} PARENT_SCOPE) +endfunction() + +function(CheckApplicationsBuildList) + GetApplicationsList(APPLICATIONS_BUILD_LIST) + + if (APPS_BUILD STREQUAL "none") + set(APPS_DEFAULT_BUILD "disabled") + else() + set(APPS_DEFAULT_BUILD "enabled") + endif() + + # Sets BUILD_APPS_USE_WHITELIST + # Sets BUILD_APPS_WHITELIST + if (APPS_BUILD MATCHES "-only") + set(BUILD_APPS_USE_WHITELIST ON) + + if (APPS_BUILD STREQUAL "servers-only") + list(APPEND BUILD_APPS_WHITELIST authserver worldserver) + endif() + + if (APPS_BUILD STREQUAL "dbimport-only") + list(APPEND BUILD_APPS_WHITELIST dbimport) + endif() + endif() + + foreach(APPLICATION_BUILD_NAME ${APPLICATIONS_BUILD_LIST}) + ApplicationNameToVariable(${APPLICATION_BUILD_NAME} APPLICATION_BUILD_VARIABLE) + + if(${APPLICATION_BUILD_VARIABLE} STREQUAL "default") + if(BUILD_APPS_USE_WHITELIST) + list(FIND BUILD_APPS_WHITELIST "${APPLICATION_BUILD_NAME}" INDEX) + if(${INDEX} GREATER -1) + set(${APPLICATION_BUILD_VARIABLE} ${APPS_DEFAULT_BUILD}) + else() + set(${APPLICATION_BUILD_VARIABLE} "disabled") + endif() + else() + set(${APPLICATION_BUILD_VARIABLE} ${APPS_DEFAULT_BUILD}) + endif() + endif() + + # Build the Graph values + if(${APPLICATION_BUILD_VARIABLE} MATCHES "enabled") + if (${APPLICATION_BUILD_NAME} MATCHES "authserver") + set (BUILD_APPLICATION_AUTHSERVER 1 PARENT_SCOPE) + elseif(${APPLICATION_BUILD_NAME} MATCHES "worldserver") + set (BUILD_APPLICATION_WORLDSERVER 1 PARENT_SCOPE) + endif() + endif() + endforeach() +endfunction() diff --git a/src/cmake/macros/ConfigureTools.cmake b/src/cmake/macros/ConfigureTools.cmake new file mode 100644 index 000000000..ece49ab48 --- /dev/null +++ b/src/cmake/macros/ConfigureTools.cmake @@ -0,0 +1,110 @@ +# +# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# + +set(BUILD_TOOLS_MAPS 0) +set(BUILD_TOOLS_DB_IMPORT 0) + +# Returns the base path to the tools directory in the source directory +function(GetToolsBasePath variable) + set(${variable} "${CMAKE_SOURCE_DIR}/src/tools" PARENT_SCOPE) +endfunction() + +# Stores the absolut path of the given tool in the variable +function(GetPathToTool tool variable) + GetToolsBasePath(TOOLS_BASE_PATH) + set(${variable} "${TOOLS_BASE_PATH}/${tool}" PARENT_SCOPE) +endfunction() + +# Stores the project name of the given tool in the variable +function(GetProjectNameOfToolName tool variable) + string(TOLOWER "${tool}" GENERATED_NAME) + set(${variable} "${GENERATED_NAME}" PARENT_SCOPE) +endfunction() + +# Creates a list of all applications and stores it in the given variable. +function(GetToolsList variable) + GetToolsBasePath(BASE_PATH) + file(GLOB LOCALE_SOURCE_TOOL_LIST RELATIVE + ${BASE_PATH} + ${BASE_PATH}/*) + + set(${variable}) + + foreach(SOURCE_TOOL ${LOCALE_SOURCE_TOOL_LIST}) + GetPathToTool(${SOURCE_TOOL} SOURCE_TOOL_PATH) + if(IS_DIRECTORY ${SOURCE_TOOL_PATH}) + list(APPEND ${variable} ${SOURCE_TOOL}) + endif() + endforeach() + + set(${variable} ${${variable}} PARENT_SCOPE) +endfunction() + +# Converts the given application name into it's +# variable name which holds the build type. +function(ToolNameToVariable application variable) + string(TOUPPER ${application} ${variable}) + set(${variable} "TOOL_${${variable}}") + set(${variable} ${${variable}} PARENT_SCOPE) +endfunction() + +function(CheckToolsBuildList) + GetToolsList(TOOLS_BUILD_LIST) + + if (TOOLS_BUILD STREQUAL "none") + set(TOOLS_DEFAULT_BUILD "disabled") + else() + set(TOOLS_DEFAULT_BUILD "enabled") + endif() + + # Sets BUILD_TOOLS_USE_WHITELIST + # Sets BUILD_TOOLS_WHITELIST + if (TOOLS_BUILD MATCHES "-only") + set(BUILD_TOOLS_USE_WHITELIST ON) + + if (TOOLS_BUILD STREQUAL "maps-only") + list(APPEND BUILD_TOOLS_WHITELIST map_extractor mmaps_generator vmap4_assembler vmap4_extractor) + endif() + + # if (TOOLS_BUILD STREQUAL "db-only") + # list(APPEND BUILD_TOOLS_WHITELIST dbimport) + # endif() + endif() + + # Set the TOOL_${TOOL_BUILD_NAME} variables from the + # variables set above + foreach(TOOL_BUILD_NAME ${TOOLS_BUILD_LIST}) + ToolNameToVariable(${TOOL_BUILD_NAME} TOOL_BUILD_VARIABLE) + + if (${TOOL_BUILD_VARIABLE} STREQUAL "default") + if (BUILD_TOOLS_USE_WHITELIST) + list(FIND BUILD_TOOLS_WHITELIST "${TOOL_BUILD_NAME}" INDEX) + if (${INDEX} GREATER -1) + set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD}) + else() + set(${TOOL_BUILD_VARIABLE} "disabled") + endif() + else() + set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD}) + endif() + endif() + + # Build the Graph values + if (${TOOL_BUILD_VARIABLE} MATCHES "enabled") + if (${TOOL_BUILD_NAME} MATCHES "dbimport") + set(BUILD_TOOLS_DB_IMPORT 1 PARENT_SCOPE) + else() + set(BUILD_TOOLS_MAPS 1 PARENT_SCOPE) + endif() + endif() + endforeach() +endfunction() diff --git a/src/cmake/showoptions.cmake b/src/cmake/showoptions.cmake index 08467d8df..7111990b6 100644 --- a/src/cmake/showoptions.cmake +++ b/src/cmake/showoptions.cmake @@ -32,31 +32,32 @@ message("") # Show infomation about the options selected during configuration -if( SERVERS ) - message("* Build world/auth : Yes (default)") +if (APPS_BUILD AND (NOT APPS_BUILD STREQUAL "none")) + message("* Build applications : Yes (${APPS_BUILD})") else() - message("* Build world/authserver : No") + message("* Build applications : No") endif() -if(SCRIPTS AND (NOT SCRIPTS STREQUAL "none")) +if (TOOLS_BUILD AND (NOT TOOLS_BUILD STREQUAL "none")) + message("* Build tools : Yes (${TOOLS_BUILD})") + add_definitions(-DNO_CORE_FUNCS) +else() + message("* Build tools : No") +endif() + +if (SCRIPTS AND (NOT SCRIPTS STREQUAL "none")) message("* Build with scripts : Yes (${SCRIPTS})") + else() message("* Build with scripts : No") endif() -if(MODULES AND (NOT MODULES STREQUAL "none")) +if (MODULES AND (NOT MODULES STREQUAL "none")) message("* Build with modules : Yes (${MODULES})") else() message("* Build with modules : No") endif() -if( TOOLS ) - message("* Build map/vmap tools : Yes") - add_definitions(-DNO_CORE_FUNCS) -else() - message("* Build map/vmap tools : No (default)") -endif() - if( BUILD_TESTING ) message("* Build unit tests : Yes") else() diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 328cc4faa..22c7d5fd7 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -16,8 +16,21 @@ CollectSourceFiles( # Exclude ${CMAKE_CURRENT_SOURCE_DIR}/Debugging ${CMAKE_CURRENT_SOURCE_DIR}/Platform + ${CMAKE_CURRENT_SOURCE_DIR}/Collision + ${CMAKE_CURRENT_SOURCE_DIR}/Navigation ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders) +if (BUILD_APPLICATION_WORLDSERVER OR BUILD_TOOLS_MAPS) + unset(PRIVATE_SOURCES) + CollectSourceFiles( + ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE_SOURCES + # Exclude + ${CMAKE_CURRENT_SOURCE_DIR}/Debugging + ${CMAKE_CURRENT_SOURCE_DIR}/Platform + ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders) +endif() + # Manually set sources for Debugging directory as we don't want to include WheatyExceptionReport in common project # It needs to be included both in authserver and worldserver for the static global variable to be properly initialized # and to handle crash logs on windows @@ -55,8 +68,6 @@ target_link_libraries(common PUBLIC boost argon2 - g3dlib - Detour sfmt utf8cpp openssl @@ -65,6 +76,13 @@ target_link_libraries(common stdfs fmt) +if (BUILD_APPLICATION_WORLDSERVER OR BUILD_TOOLS_MAPS) + target_link_libraries(common + PUBLIC + g3dlib + Detour) +endif() + set_target_properties(common PROPERTIES FOLDER diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index 32ace618c..bf349227b 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -60,7 +60,7 @@ private: public: static Log* instance(); - void Initialize(Acore::Asio::IoContext* ioContext); + void Initialize(Acore::Asio::IoContext* ioContext = nullptr); void SetSynchronous(); // Not threadsafe - should only be called from main() after all threads are joined void LoadFromConfig(); void Close(); diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index ffe9f9d21..559745d0a 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -10,22 +10,19 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # -# Specified files for Windows -if (WIN32) -# Crash logs -set(winDebugging - ${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.cpp - ${CMAKE_SOURCE_DIR}/src/common/Debugging/WheatyExceptionReport.h) +add_subdirectory(apps) -# Service -set(winService - ${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp - ${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.h) +# if ((APPS_BUILD AND NOT APPS_BUILD STREQUAL "none") OR BUILD_TOOLS_DB_IMPORT) # DB import PR +if ((APPS_BUILD AND NOT APPS_BUILD STREQUAL "none")) + add_subdirectory(database) +endif() + +if (BUILD_APPLICATION_AUTHSERVER OR BUILD_APPLICATION_WORLDSERVER) + add_subdirectory(shared) +endif() + +if (BUILD_APPLICATION_WORLDSERVER) + add_subdirectory(game) + add_subdirectory(scripts) endif() -add_subdirectory(authserver) -add_subdirectory(database) -add_subdirectory(game) -add_subdirectory(shared) -add_subdirectory(scripts) -add_subdirectory(worldserver) diff --git a/src/server/apps/CMakeLists.txt b/src/server/apps/CMakeLists.txt new file mode 100644 index 000000000..807c89efc --- /dev/null +++ b/src/server/apps/CMakeLists.txt @@ -0,0 +1,198 @@ +# +# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# Make the script module list available in the current scope +GetApplicationsList(APPLICATIONS_BUILD_LIST) + +if (APPS_BUILD STREQUAL "none") + set(APPS_DEFAULT_BUILD "disabled") +else() + set(APPS_DEFAULT_BUILD "enabled") +endif() + +# Sets BUILD_APPS_USE_WHITELIST +# Sets BUILD_APPS_WHITELIST +if (APPS_BUILD MATCHES "-only") + set(BUILD_APPS_USE_WHITELIST ON) + + if (APPS_BUILD STREQUAL "auth-only") + list(APPEND BUILD_APPS_WHITELIST authserver) + endif() + + if (APPS_BUILD STREQUAL "world-only") + list(APPEND BUILD_APPS_WHITELIST worldserver) + endif() +endif() + +# Set the SCRIPTS_${BUILD_APP} variables from the +# variables set above +foreach(BUILD_APP ${APPLICATIONS_BUILD_LIST}) + ApplicationNameToVariable(${BUILD_APP} BUILD_APP_VARIABLE) + + if(${BUILD_APP_VARIABLE} STREQUAL "default") + if(BUILD_APPS_USE_WHITELIST) + list(FIND BUILD_APPS_WHITELIST "${BUILD_APP}" INDEX) + if(${INDEX} GREATER -1) + set(${BUILD_APP_VARIABLE} ${APPS_DEFAULT_BUILD}) + else() + set(${BUILD_APP_VARIABLE} "disabled") + endif() + else() + set(${BUILD_APP_VARIABLE} ${APPS_DEFAULT_BUILD}) + endif() + endif() + + # Build the Graph values + if(${BUILD_APP_VARIABLE} MATCHES "enabled") + list(APPEND BUILD_APP_GRAPH_KEYS apps) + set(BUILD_APP_VALUE_DISPLAY_apps apps) + list(APPEND BUILD_APP_VALUE_CONTAINS_apps ${BUILD_APP}) + + if (${BUILD_APP} MATCHES "authserver") + set (BUILD_APPLICATION_AUTHSERVER 1) + elseif(${BUILD_APP} MATCHES "worldserver") + set (BUILD_APPLICATION_WORLDSERVER 1) + endif() + else() + list(APPEND BUILD_APP_GRAPH_KEYS disabled) + set(BUILD_APP_VALUE_DISPLAY_disabled disabled) + list(APPEND BUILD_APP_VALUE_CONTAINS_disabled ${BUILD_APP}) + endif() +endforeach() + +list(SORT BUILD_APP_GRAPH_KEYS) +list(REMOVE_DUPLICATES BUILD_APP_GRAPH_KEYS) + +# Display the graphs +message("") +message("* Apps build list (${APPS_BUILD}):") +message(" |") + +foreach(BUILD_APP_GRAPH_KEY ${BUILD_APP_GRAPH_KEYS}) + if(NOT BUILD_APP_GRAPH_KEY STREQUAL "disabled") + message(" +- ${BUILD_APP_VALUE_DISPLAY_${BUILD_APP_GRAPH_KEY}}") + else() + message(" | ${BUILD_APP_VALUE_DISPLAY_${BUILD_APP_GRAPH_KEY}}") + endif() + foreach(BUILD_APP_GRAPH_ENTRY ${BUILD_APP_VALUE_CONTAINS_${BUILD_APP_GRAPH_KEY}}) + message(" | +- ${BUILD_APP_GRAPH_ENTRY}") + endforeach() + message(" |") +endforeach() + +message("") + +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + +# Generates the actual apps projects +foreach(APPLICATION_NAME ${APPLICATIONS_BUILD_LIST}) + GetPathToApplication(${APPLICATION_NAME} SOURCE_APP_PATH) + ApplicationNameToVariable(${APPLICATION_NAME} BUILD_APP_VARIABLE) + + if (${BUILD_APP_VARIABLE} STREQUAL "disabled") + continue() + endif() + + unset(APP_PRIVATE_SOURCES) + CollectSourceFiles( + ${SOURCE_APP_PATH} + APP_PRIVATE_SOURCES + # Exclude + ${SOURCE_APP_PATH}/PrecompiledHeaders) + + if (WIN32) + list(APPEND APP_PRIVATE_SOURCES ${winDebugging}) + + if (${APPLICATION_NAME} MATCHES "worldserver") + list(APPEND APP_PRIVATE_SOURCES ${winService}) + endif() + + if (MSVC) + list(APPEND APP_PRIVATE_SOURCES ${SOURCE_APP_PATH}/${APPLICATION_NAME}.rc) + endif() + endif() + + GetProjectNameOfApplicationName(${APPLICATION_NAME} APP_PROJECT_NAME) + + # Create the application project + add_executable(${APP_PROJECT_NAME} + ${APP_PRIVATE_SOURCES}) + + add_dependencies(${APP_PROJECT_NAME} revision.h) + + target_link_libraries(${APP_PROJECT_NAME} + PRIVATE + acore-core-interface) + + if (${APP_PROJECT_NAME} MATCHES "authserver") + target_link_libraries(${APP_PROJECT_NAME} + PUBLIC + shared) + elseif(${APP_PROJECT_NAME} MATCHES "worldserver") + target_link_libraries(${APP_PROJECT_NAME} + PUBLIC + modules + scripts + game + gsoap + readline + gperftools) + + if (UNIX AND NOT NOJEM) + set(${APP_PROJECT_NAME}_LINK_FLAGS "-pthread -lncurses ${${APP_PROJECT_NAME}_LINK_FLAGS}") + endif() + + set_target_properties(${APP_PROJECT_NAME} PROPERTIES LINK_FLAGS "${${APP_PROJECT_NAME}_LINK_FLAGS}") + + # Add all dynamic projects as dependency to the worldserver + if (WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES) + add_dependencies(${APP_PROJECT_NAME} ${WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES}) + endif() + endif() + + unset(APP_PUBLIC_INCLUDES) + CollectIncludeDirectories( + ${SOURCE_APP_PATH} + APP_PUBLIC_INCLUDES + # Exclude + ${SOURCE_APP_PATH}/PrecompiledHeaders) + + target_include_directories(${APP_PROJECT_NAME} + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}) + + target_include_directories(${APP_PROJECT_NAME} + PUBLIC + ${APP_PUBLIC_INCLUDES} + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_NAME}) + + set_target_properties(${APP_PROJECT_NAME} + PROPERTIES + FOLDER + "server") + + # Install config + CopyApplicationConfig(${APP_PROJECT_NAME} ${APPLICATION_NAME}) + + if (UNIX) + install(TARGETS ${APP_PROJECT_NAME} DESTINATION bin) + elseif (WIN32) + install(TARGETS ${APP_PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}") + endif() + + set(PATH_TO_PCH ${SOURCE_APP_PATH}/PrecompiledHeaders/${APPLICATION_NAME}PCH.h) + + # Generate precompiled header + if (USE_COREPCH AND EXISTS ${PATH_TO_PCH}) + add_cxx_pch(${APP_PROJECT_NAME} ${PATH_TO_PCH}) + endif() +endforeach() \ No newline at end of file diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/apps/authserver/Authentication/AuthCodes.cpp similarity index 100% rename from src/server/authserver/Authentication/AuthCodes.cpp rename to src/server/apps/authserver/Authentication/AuthCodes.cpp diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/apps/authserver/Authentication/AuthCodes.h similarity index 100% rename from src/server/authserver/Authentication/AuthCodes.h rename to src/server/apps/authserver/Authentication/AuthCodes.h diff --git a/src/server/authserver/Main.cpp b/src/server/apps/authserver/Main.cpp similarity index 84% rename from src/server/authserver/Main.cpp rename to src/server/apps/authserver/Main.cpp index a38e58b64..b0105d658 100644 --- a/src/server/authserver/Main.cpp +++ b/src/server/apps/authserver/Main.cpp @@ -41,8 +41,11 @@ #include "SharedDefines.h" #include "Util.h" #include +#include #include #include +#include +#include #include #include @@ -51,19 +54,15 @@ #endif using boost::asio::ip::tcp; +using namespace boost::program_options; +namespace fs = std::filesystem; bool StartDB(); void StopDB(); void SignalHandler(std::weak_ptr ioContextRef, boost::system::error_code const& error, int signalNumber); void KeepDatabaseAliveHandler(std::weak_ptr dbPingTimerRef, int32 dbPingInterval, boost::system::error_code const& error); void BanExpiryHandler(std::weak_ptr banExpiryCheckTimerRef, int32 banExpiryCheckInterval, boost::system::error_code const& error); - -/// Print out the usage string for this program on the console. -void usage(const char* prog) -{ - LOG_INFO("server.authserver", "Usage: \n {} []\n" - " -c config_file use config_file as configuration file\n\r", prog); -} +variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile); /// Launch the auth server int main(int argc, char** argv) @@ -71,27 +70,16 @@ int main(int argc, char** argv) Acore::Impl::CurrentServerProcessHolder::_type = SERVER_PROCESS_AUTHSERVER; signal(SIGABRT, &Acore::AbortHandler); - // Command line parsing to get the configuration file name - std::string configFile = sConfigMgr->GetConfigPath() + std::string(_ACORE_REALM_CONFIG); - int count = 1; - while (count < argc) - { - if (strcmp(argv[count], "-c") == 0) - { - if (++count >= argc) - { - printf("Runtime-Error: -c option requires an input argument\n"); - usage(argv[0]); - return 1; - } - else - configFile = argv[count]; - } - ++count; - } + // Command line parsing + auto configFile = fs::path(sConfigMgr->GetConfigPath() + std::string(_ACORE_REALM_CONFIG)); + auto vm = GetConsoleArguments(argc, argv, configFile); + + // exit if help or version is enabled + if (vm.count("help")) + return 0; // Add file and args in config - sConfigMgr->Configure(configFile, std::vector(argv, argv + argc)); + sConfigMgr->Configure(configFile.generic_string(), std::vector(argv, argv + argc)); if (!sConfigMgr->LoadAppConfigs()) return 1; @@ -149,6 +137,13 @@ int main(int argc, char** argv) return 1; } + // Stop auth server if dry run + if (sConfigMgr->isDryRun()) + { + LOG_INFO("server.authserver", "Dry run completed, terminating."); + return 0; + } + // Start the listening port (acceptor) for auth connections int32 port = sConfigMgr->GetOption("RealmServerPort", 3724); if (port < 0 || port > 0xFFFF) @@ -268,3 +263,36 @@ void BanExpiryHandler(std::weak_ptr banExpiryCheckTi } } } + +variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile) +{ + options_description all("Allowed options"); + all.add_options() + ("help,h", "print usage message") + ("version,v", "print version build info") + ("dry-run,d", "Dry run") + ("config,c", value(&configFile)->default_value(fs::path(sConfigMgr->GetConfigPath() + std::string(_ACORE_REALM_CONFIG))), "use as configuration file"); + + variables_map variablesMap; + + try + { + store(command_line_parser(argc, argv).options(all).allow_unregistered().run(), variablesMap); + notify(variablesMap); + } + catch (std::exception const& e) + { + std::cerr << e.what() << "\n"; + } + + if (variablesMap.count("help")) + { + std::cout << all << "\n"; + } + else if (variablesMap.count("dry-run")) + { + sConfigMgr->setDryRun(true); + } + + return variablesMap; +} diff --git a/src/server/authserver/PrecompiledHeaders/authPCH.h b/src/server/apps/authserver/PrecompiledHeaders/authserverPCH.h similarity index 100% rename from src/server/authserver/PrecompiledHeaders/authPCH.h rename to src/server/apps/authserver/PrecompiledHeaders/authserverPCH.h diff --git a/src/server/authserver/Server/AuthSession.cpp b/src/server/apps/authserver/Server/AuthSession.cpp similarity index 100% rename from src/server/authserver/Server/AuthSession.cpp rename to src/server/apps/authserver/Server/AuthSession.cpp diff --git a/src/server/authserver/Server/AuthSession.h b/src/server/apps/authserver/Server/AuthSession.h similarity index 100% rename from src/server/authserver/Server/AuthSession.h rename to src/server/apps/authserver/Server/AuthSession.h diff --git a/src/server/authserver/Server/AuthSocketMgr.h b/src/server/apps/authserver/Server/AuthSocketMgr.h similarity index 100% rename from src/server/authserver/Server/AuthSocketMgr.h rename to src/server/apps/authserver/Server/AuthSocketMgr.h diff --git a/src/server/authserver/authserver.conf.dist b/src/server/apps/authserver/authserver.conf.dist similarity index 100% rename from src/server/authserver/authserver.conf.dist rename to src/server/apps/authserver/authserver.conf.dist diff --git a/src/server/authserver/authserver.ico b/src/server/apps/authserver/authserver.ico similarity index 100% rename from src/server/authserver/authserver.ico rename to src/server/apps/authserver/authserver.ico diff --git a/src/server/authserver/authserver.rc b/src/server/apps/authserver/authserver.rc similarity index 100% rename from src/server/authserver/authserver.rc rename to src/server/apps/authserver/authserver.rc diff --git a/src/server/authserver/resource.h b/src/server/apps/authserver/resource.h similarity index 100% rename from src/server/authserver/resource.h rename to src/server/apps/authserver/resource.h diff --git a/src/server/worldserver/ACSoap/ACSoap.cpp b/src/server/apps/worldserver/ACSoap/ACSoap.cpp similarity index 100% rename from src/server/worldserver/ACSoap/ACSoap.cpp rename to src/server/apps/worldserver/ACSoap/ACSoap.cpp diff --git a/src/server/worldserver/ACSoap/ACSoap.h b/src/server/apps/worldserver/ACSoap/ACSoap.h similarity index 100% rename from src/server/worldserver/ACSoap/ACSoap.h rename to src/server/apps/worldserver/ACSoap/ACSoap.h diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/apps/worldserver/CommandLine/CliRunnable.cpp similarity index 100% rename from src/server/worldserver/CommandLine/CliRunnable.cpp rename to src/server/apps/worldserver/CommandLine/CliRunnable.cpp diff --git a/src/server/worldserver/CommandLine/CliRunnable.h b/src/server/apps/worldserver/CommandLine/CliRunnable.h similarity index 100% rename from src/server/worldserver/CommandLine/CliRunnable.h rename to src/server/apps/worldserver/CommandLine/CliRunnable.h diff --git a/src/server/worldserver/Main.cpp b/src/server/apps/worldserver/Main.cpp similarity index 91% rename from src/server/worldserver/Main.cpp rename to src/server/apps/worldserver/Main.cpp index f49740a36..d8361c468 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/apps/worldserver/Main.cpp @@ -36,6 +36,7 @@ #include "IoContext.h" #include "MapMgr.h" #include "Metric.h" +#include "ModuleMgr.h" #include "ModulesScriptLoader.h" #include "MySQLThreading.h" #include "OpenSSLCrypto.h" @@ -54,12 +55,12 @@ #include #include #include +#include +#include #include #include -#include "ModuleMgr.h" - -#ifdef _WIN32 +#if AC_PLATFORM == AC_PLATFORM_WINDOWS #include "ServiceWin32.h" char serviceName[] = "worldserver"; char serviceLongName[] = "AzerothCore world service"; @@ -78,6 +79,8 @@ int m_ServiceStatus = -1; #endif #define WORLD_SLEEP_CONST 10 +using namespace boost::program_options; +namespace fs = std::filesystem; class FreezeDetector { @@ -110,20 +113,7 @@ void ShutdownCLIThread(std::thread* cliThread); void AuctionListingRunnable(); void ShutdownAuctionListingThread(std::thread* thread); void WorldUpdateLoop(); - -/// Print out the usage string for this program on the console. -void usage(const char* prog) -{ - printf("Usage:\n"); - printf(" %s []\n", prog); - printf(" -c config_file use config_file as configuration file\n"); -#ifdef _WIN32 - printf(" Running as service functions:\n"); - printf(" --service run as service\n"); - printf(" -s install install service\n"); - printf(" -s uninstall uninstall service\n"); -#endif -} +variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, [[maybe_unused]] std::string& cfg_service); /// Launch the Azeroth server int main(int argc, char** argv) @@ -131,66 +121,26 @@ int main(int argc, char** argv) Acore::Impl::CurrentServerProcessHolder::_type = SERVER_PROCESS_WORLDSERVER; signal(SIGABRT, &Acore::AbortHandler); - ///- Command line parsing to get the configuration file name - std::string configFile = sConfigMgr->GetConfigPath() + std::string(_ACORE_CORE_CONFIG); - int c = 1; - while (c < argc) - { - if (strcmp(argv[c], "--dry-run") == 0) - { - sConfigMgr->setDryRun(true); - } + // Command line parsing + auto configFile = fs::path(sConfigMgr->GetConfigPath() + std::string(_ACORE_CORE_CONFIG)); + std::string configService; + auto vm = GetConsoleArguments(argc, argv, configFile, configService); - if (!strcmp(argv[c], "-c")) - { - if (++c >= argc) - { - printf("Runtime-Error: -c option requires an input argument"); - usage(argv[0]); - return 1; - } - else - configFile = argv[c]; - } + // exit if help or version is enabled + if (vm.count("help")) + return 0; -#ifdef _WIN32 - if (strcmp(argv[c], "-s") == 0) // Services - { - if (++c >= argc) - { - printf("Runtime-Error: -s option requires an input argument"); - usage(argv[0]); - return 1; - } - - if (strcmp(argv[c], "install") == 0) - { - if (WinServiceInstall()) - printf("Installing service\n"); - return 1; - } - else if (strcmp(argv[c], "uninstall") == 0) - { - if (WinServiceUninstall()) - printf("Uninstalling service\n"); - return 1; - } - else - { - printf("Runtime-Error: unsupported option %s", argv[c]); - usage(argv[0]); - return 1; - } - } - - if (strcmp(argv[c], "--service") == 0) - WinServiceRun(); +#if AC_PLATFORM == AC_PLATFORM_WINDOWS + if (configService.compare("install") == 0) + return WinServiceInstall() == true ? 0 : 1; + else if (configService.compare("uninstall") == 0) + return WinServiceUninstall() == true ? 0 : 1; + else if (configService.compare("run") == 0) + WinServiceRun(); #endif - ++c; - } // Add file and args in config - sConfigMgr->Configure(configFile, { argv, argv + argc }, CONFIG_FILE_LIST); + sConfigMgr->Configure(configFile.generic_string(), {argv, argv + argc}, CONFIG_FILE_LIST); if (!sConfigMgr->LoadAppConfigs()) return 1; @@ -399,7 +349,7 @@ int main(int argc, char** argv) // Launch CliRunnable thread std::shared_ptr cliThread; -#ifdef _WIN32 +#if AC_PLATFORM == AC_PLATFORM_WINDOWS if (sConfigMgr->GetOption("Console.Enable", true) && (m_ServiceStatus == -1)/* need disable console in service mode*/) #else if (sConfigMgr->GetOption("Console.Enable", true)) @@ -768,3 +718,44 @@ void ShutdownAuctionListingThread(std::thread* thread) delete thread; } } + +variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile, [[maybe_unused]] std::string& configService) +{ + options_description all("Allowed options"); + all.add_options() + ("help,h", "print usage message") + ("version,v", "print version build info") + ("dry-run,d", "Dry run") + ("config,c", value(&configFile)->default_value(fs::path(sConfigMgr->GetConfigPath() + std::string(_ACORE_CORE_CONFIG))), "use as configuration file"); + +#if AC_PLATFORM == WARHEAD_PLATFORM_WINDOWS + options_description win("Windows platform specific options"); + win.add_options() + ("service,s", value(&configService)->default_value(""), "Windows service options: [install | uninstall]"); + + all.add(win); +#endif + + variables_map vm; + + try + { + store(command_line_parser(argc, argv).options(all).allow_unregistered().run(), vm); + notify(vm); + } + catch (std::exception const& e) + { + std::cerr << e.what() << "\n"; + } + + if (vm.count("help")) + { + std::cout << all << "\n"; + } + else if (vm.count("dry-run")) + { + sConfigMgr->setDryRun(true); + } + + return vm; +} diff --git a/src/server/worldserver/PrecompiledHeaders/worldPCH.h b/src/server/apps/worldserver/PrecompiledHeaders/worldserverPCH.h similarity index 100% rename from src/server/worldserver/PrecompiledHeaders/worldPCH.h rename to src/server/apps/worldserver/PrecompiledHeaders/worldserverPCH.h diff --git a/src/server/worldserver/RemoteAccess/RASession.cpp b/src/server/apps/worldserver/RemoteAccess/RASession.cpp similarity index 100% rename from src/server/worldserver/RemoteAccess/RASession.cpp rename to src/server/apps/worldserver/RemoteAccess/RASession.cpp diff --git a/src/server/worldserver/RemoteAccess/RASession.h b/src/server/apps/worldserver/RemoteAccess/RASession.h similarity index 100% rename from src/server/worldserver/RemoteAccess/RASession.h rename to src/server/apps/worldserver/RemoteAccess/RASession.h diff --git a/src/server/worldserver/resource.h b/src/server/apps/worldserver/resource.h similarity index 100% rename from src/server/worldserver/resource.h rename to src/server/apps/worldserver/resource.h diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/apps/worldserver/worldserver.conf.dist similarity index 100% rename from src/server/worldserver/worldserver.conf.dist rename to src/server/apps/worldserver/worldserver.conf.dist diff --git a/src/server/worldserver/worldserver.ico b/src/server/apps/worldserver/worldserver.ico similarity index 100% rename from src/server/worldserver/worldserver.ico rename to src/server/apps/worldserver/worldserver.ico diff --git a/src/server/worldserver/worldserver.rc b/src/server/apps/worldserver/worldserver.rc similarity index 100% rename from src/server/worldserver/worldserver.rc rename to src/server/apps/worldserver/worldserver.rc diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt deleted file mode 100644 index b70340ed2..000000000 --- a/src/server/authserver/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -# -# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# - -########### authserver ############### - -CollectSourceFiles( - ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE_SOURCES - # Exclude - ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders) - -if( WIN32 ) - list(APPEND PRIVATE_SOURCES ${winDebugging}) - if ( MSVC ) - list(APPEND PRIVATE_SOURCES authserver.rc) - endif() -endif() - -if (USE_COREPCH) - set(PRIVATE_PCH_HEADER PrecompiledHeaders/authPCH.h) -endif() - -# Group sources -GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) - -add_executable(authserver - ${PRIVATE_SOURCES}) - -add_dependencies(authserver revision.h) - -target_link_libraries(authserver - PRIVATE - acore-core-interface - PUBLIC - shared) - -CollectIncludeDirectories( - ${CMAKE_CURRENT_SOURCE_DIR} - PUBLIC_INCLUDES - # Exclude - ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders) - -target_include_directories(authserver - PUBLIC - ${PUBLIC_INCLUDES} - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}) - -set_target_properties(authserver - PROPERTIES - FOLDER - "server") - -# Install config -CopyDefaultConfig(authserver) - -if ( UNIX ) - install(TARGETS authserver DESTINATION bin) -elseif ( WIN32 ) - install(TARGETS authserver DESTINATION "${CMAKE_INSTALL_PREFIX}") -endif() - -# Generate precompiled header -if (USE_COREPCH) - add_cxx_pch(authserver ${PRIVATE_PCH_HEADER}) -endif() - -CU_RUN_HOOK("AFTER_AUTHSERVER_CMAKE") diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp index 632df7a45..b07f0d36c 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -90,7 +90,7 @@ uint32 MySQLConnection::Open() MYSQL* mysqlInit = mysql_init(nullptr); if (!mysqlInit) { - LOG_ERROR("sql.sql", "Could not initialize Mysql connection to database `{}`", m_connectionInfo.database); + LOG_ERROR("sql.driver", "Could not initialize Mysql connection to database `{}`", m_connectionInfo.database); return CR_UNKNOWN_ERROR; } @@ -170,7 +170,7 @@ uint32 MySQLConnection::Open() } else { - LOG_ERROR("sql.sql", "Could not connect to MySQL database at {}: {}", m_connectionInfo.host, mysql_error(mysqlInit)); + LOG_ERROR("sql.driver", "Could not connect to MySQL database at {}: {}", m_connectionInfo.host, mysql_error(mysqlInit)); uint32 errorCode = mysql_errno(mysqlInit); mysql_close(mysqlInit); return errorCode; diff --git a/src/server/scripts/CMakeLists.txt b/src/server/scripts/CMakeLists.txt index c363a367b..e2320d251 100644 --- a/src/server/scripts/CMakeLists.txt +++ b/src/server/scripts/CMakeLists.txt @@ -12,11 +12,8 @@ CU_RUN_HOOK(BEFORE_SCRIPTS_LIBRARY) -message("") - # Make the script module list available in the current scope GetScriptModuleList(SCRIPT_MODULE_LIST) -GetModuleSourceList(MODULES_MODULE_LIST) # Make the native install offset available in this scope GetInstallOffset(INSTALL_OFFSET) @@ -33,18 +30,6 @@ else() set(SCRIPTS_DEFAULT_LINKAGE "disabled") endif() -# Sets the MODULES_${SOURCE_MODULE} variables -# when using predefined templates for script building -# like dynamic, static -# Sets MODULES_DEFAULT_LINKAGE -if(MODULES MATCHES "dynamic") - set(MODULES_DEFAULT_LINKAGE "dynamic") -elseif(MODULES MATCHES "static") - set(MODULES_DEFAULT_LINKAGE "static") -else() - set(MODULES_DEFAULT_LINKAGE "disabled") -endif() - # Sets SCRIPTS_USE_WHITELIST # Sets SCRIPTS_WHITELIST if(SCRIPTS MATCHES "minimal") @@ -93,8 +78,8 @@ list(SORT SCRIPT_GRAPH_KEYS) list(REMOVE_DUPLICATES SCRIPT_GRAPH_KEYS) # Display the script graph -message("* Script configuration (${SCRIPTS}): - |") +message("* Script configuration (${SCRIPTS}):") +message(" |") foreach(SCRIPT_GRAPH_KEY ${SCRIPT_GRAPH_KEYS}) if(NOT SCRIPT_GRAPH_KEY STREQUAL "disabled") @@ -108,10 +93,8 @@ foreach(SCRIPT_GRAPH_KEY ${SCRIPT_GRAPH_KEYS}) message(" |") endforeach() -message("") - # Base sources which are used by every script project -if(USE_SCRIPTPCH) +if (USE_SCRIPTPCH) set(PRIVATE_PCH_HEADER ScriptPCH.h) endif() diff --git a/src/server/shared/SharedDefines.h b/src/server/shared/SharedDefines.h index 36a0c9242..16069658b 100644 --- a/src/server/shared/SharedDefines.h +++ b/src/server/shared/SharedDefines.h @@ -19,7 +19,6 @@ #define ACORE_SHAREDDEFINES_H #include "Define.h" -#include "DetourNavMesh.h" #include "EnumFlag.h" #include diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt deleted file mode 100644 index bb7b75d30..000000000 --- a/src/server/worldserver/CMakeLists.txt +++ /dev/null @@ -1,91 +0,0 @@ -# -# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# - -CollectSourceFiles( - ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE_SOURCES - # Exclude - ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders) - -if( WIN32 ) - list(APPEND PRIVATE_SOURCES ${winDebugging} ${winService}) - if ( MSVC ) - list(APPEND PRIVATE_SOURCES worldserver.rc) - endif() -endif() - -if (USE_COREPCH) - set(PRIVATE_PCH_HEADER PrecompiledHeaders/worldPCH.h) -endif() - -# Group sources -GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) - -add_executable(worldserver - ${PRIVATE_SOURCES}) - -add_dependencies(worldserver revision.h) - -if(UNIX AND NOT NOJEM) - set(worldserver_LINK_FLAGS "-pthread -lncurses ${worldserver_LINK_FLAGS}") -endif() - -set_target_properties(worldserver PROPERTIES LINK_FLAGS "${worldserver_LINK_FLAGS}") - -CollectIncludeDirectories( - ${CMAKE_CURRENT_SOURCE_DIR} - PUBLIC_INCLUDES - # Exclude - ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders) - -target_include_directories(worldserver - PUBLIC - ${PUBLIC_INCLUDES} - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}) - -target_link_libraries(worldserver - PRIVATE - acore-core-interface - PUBLIC - modules - scripts - game - gsoap - readline - gperftools) - -set_target_properties(worldserver - PROPERTIES - FOLDER - "server") - -# Add all dynamic projects as dependency to the worldserver -if(WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES) - add_dependencies(worldserver ${WORLDSERVER_DYNAMIC_SCRIPT_MODULES_DEPENDENCIES}) -endif() - -# Install config -CopyDefaultConfig(worldserver) - -if( UNIX ) - install(TARGETS worldserver DESTINATION bin) -elseif( WIN32 ) - install(TARGETS worldserver DESTINATION "${CMAKE_INSTALL_PREFIX}") -endif() - -# Generate precompiled header -if( USE_COREPCH ) - add_cxx_pch(worldserver ${PRIVATE_PCH_HEADER}) -endif() - -CU_RUN_HOOK("AFTER_WORLDSERVER_CMAKE") diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index 046265c77..9ce44a36e 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -8,9 +8,155 @@ # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# -add_subdirectory(map_extractor) -add_subdirectory(vmap4_assembler) -add_subdirectory(vmap4_extractor) -add_subdirectory(mmaps_generator) +# Make the tools list available in the current scope +GetToolsList(TOOLS_BUILD_LIST) + +if (TOOLS_BUILD STREQUAL "none") + set(TOOLS_DEFAULT_BUILD "disabled") +else() + set(TOOLS_DEFAULT_BUILD "enabled") +endif() + +# Sets BUILD_TOOLS_USE_WHITELIST +# Sets BUILD_TOOLS_WHITELIST +if (TOOLS_BUILD MATCHES "-only") + set(BUILD_TOOLS_USE_WHITELIST ON) + + if (TOOLS_BUILD STREQUAL "maps-only") + list(APPEND BUILD_TOOLS_WHITELIST map_extractor mmaps_generator vmap4_assembler vmap4_extractor) + endif() + + # if (TOOLS_BUILD STREQUAL "db-only") + # list(APPEND BUILD_TOOLS_WHITELIST dbimport) + # endif() +endif() + +# Set the TOOL_${TOOL_BUILD_NAME} variables from the +# variables set above +foreach(TOOL_BUILD_NAME ${TOOLS_BUILD_LIST}) + ToolNameToVariable(${TOOL_BUILD_NAME} TOOL_BUILD_VARIABLE) + + if(${TOOL_BUILD_VARIABLE} STREQUAL "default") + if(BUILD_TOOLS_USE_WHITELIST) + list(FIND BUILD_TOOLS_WHITELIST "${TOOL_BUILD_NAME}" INDEX) + if(${INDEX} GREATER -1) + set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD}) + else() + set(${TOOL_BUILD_VARIABLE} "disabled") + endif() + else() + set(${TOOL_BUILD_VARIABLE} ${TOOLS_DEFAULT_BUILD}) + endif() + endif() + + # Build the Graph values + if(${TOOL_BUILD_VARIABLE} MATCHES "enabled") + list(APPEND TOOL_BUILD_GRAPH_KEYS tools) + set(TOOL_BUILD_VALUE_DISPLAY_tools tools) + list(APPEND TOOL_BUILD_VALUE_CONTAINS_tools ${TOOL_BUILD_NAME}) + else() + list(APPEND TOOL_BUILD_GRAPH_KEYS disabled) + set(TOOL_BUILD_VALUE_DISPLAY_disabled disabled) + list(APPEND TOOL_BUILD_VALUE_CONTAINS_disabled ${TOOL_BUILD_NAME}) + endif() +endforeach() + +list(SORT TOOL_BUILD_GRAPH_KEYS) +list(REMOVE_DUPLICATES TOOL_BUILD_GRAPH_KEYS) + +# Display the graphs +# message("") +message("* Tools build list (${TOOLS_BUILD}):") +message(" |") + +foreach(TOOL_BUILD_GRAPH_KEY ${TOOL_BUILD_GRAPH_KEYS}) + if(NOT TOOL_BUILD_GRAPH_KEY STREQUAL "disabled") + message(" +- ${TOOL_BUILD_VALUE_DISPLAY_${TOOL_BUILD_GRAPH_KEY}}") + else() + message(" | ${TOOL_BUILD_VALUE_DISPLAY_${TOOL_BUILD_GRAPH_KEY}}") + endif() + foreach(TOOL_BUILD_GRAPH_ENTRY ${TOOL_BUILD_VALUE_CONTAINS_${TOOL_BUILD_GRAPH_KEY}}) + message(" | +- ${TOOL_BUILD_GRAPH_ENTRY}") + endforeach() + message(" |") +endforeach() + +message("") + +GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) + +# Generates the actual tools projects +foreach(TOOL_NAME ${TOOLS_BUILD_LIST}) + GetPathToTool(${TOOL_NAME} SOURCE_TOOL_PATH) + ToolNameToVariable(${TOOL_NAME} TOOL_BUILD_VARIABLE) + + if (${TOOL_BUILD_VARIABLE} STREQUAL "disabled") + continue() + endif() + + unset(TOOL_PRIVATE_SOURCES) + CollectSourceFiles( + ${SOURCE_TOOL_PATH} + TOOL_PRIVATE_SOURCES) + + if (WIN32) + list(APPEND TOOL_PRIVATE_SOURCES ${winDebugging}) + endif() + + GetProjectNameOfToolName(${TOOL_NAME} TOOL_PROJECT_NAME) + + # Create the application project + add_executable(${TOOL_PROJECT_NAME} + ${TOOL_PRIVATE_SOURCES}) + + add_dependencies(${TOOL_PROJECT_NAME} revision.h) + + # Need fix errors + # target_link_libraries(${TOOL_PROJECT_NAME} + # PRIVATE + # acore-core-interface) + + # if (${TOOL_PROJECT_NAME} MATCHES "dbimport") + # target_link_libraries(${TOOL_PROJECT_NAME} + # PUBLIC + # database) + + # # Install config + # CopyToolConfig(${TOOL_PROJECT_NAME} ${TOOL_NAME}) + # else() + target_link_libraries(${TOOL_PROJECT_NAME} + PUBLIC + common + mpq + zlib + Recast + g3dlib) + # endif() + + unset(TOOL_PUBLIC_INCLUDES) + CollectIncludeDirectories( + ${SOURCE_TOOL_PATH} + TOOL_PUBLIC_INCLUDES) + + target_include_directories(${TOOL_PROJECT_NAME} + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}) + + target_include_directories(${TOOL_PROJECT_NAME} + PUBLIC + ${TOOL_PUBLIC_INCLUDES} + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/${TOOL_NAME}) + + set_target_properties(${TOOL_PROJECT_NAME} + PROPERTIES + FOLDER + "tools") + + if (UNIX) + install(TARGETS ${TOOL_PROJECT_NAME} DESTINATION bin) + elseif (WIN32) + install(TARGETS ${TOOL_PROJECT_NAME} DESTINATION "${CMAKE_INSTALL_PREFIX}") + endif() +endforeach() diff --git a/src/tools/map_extractor/CMakeLists.txt b/src/tools/map_extractor/CMakeLists.txt deleted file mode 100644 index 5b092c7c9..000000000 --- a/src/tools/map_extractor/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -# -# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# - -CollectSourceFiles( - ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE_SOURCES) - -add_executable(mapextractor - ${PRIVATE_SOURCES} -) - -target_include_directories(mapextractor - PUBLIC - ${CMAKE_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/loadlib) - -target_link_libraries(mapextractor - PRIVATE - acore-core-interface - PUBLIC - common - mpq) - -CollectIncludeDirectories( - ${CMAKE_CURRENT_SOURCE_DIR} - PUBLIC_INCLUDES) - -# Group sources -GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) - -target_include_directories(mapextractor - PUBLIC - ${PUBLIC_INCLUDES} - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}) - -set_target_properties(mapextractor - PROPERTIES - FOLDER - "tools") - -if( UNIX ) - install(TARGETS mapextractor DESTINATION bin) -elseif( WIN32 ) - install(TARGETS mapextractor DESTINATION "${CMAKE_INSTALL_PREFIX}") -endif() diff --git a/src/tools/mmaps_generator/CMakeLists.txt b/src/tools/mmaps_generator/CMakeLists.txt deleted file mode 100644 index c7d295acb..000000000 --- a/src/tools/mmaps_generator/CMakeLists.txt +++ /dev/null @@ -1,50 +0,0 @@ -# -# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# - -CollectSourceFiles( - ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE_SOURCES) - -add_executable(mmaps_generator ${PRIVATE_SOURCES}) - -target_link_libraries(mmaps_generator - PRIVATE - acore-core-interface - PUBLIC - common - Recast - mpq) - -# Group sources -GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) - -CollectIncludeDirectories( - ${CMAKE_CURRENT_SOURCE_DIR} - PUBLIC_INCLUDES) - -target_include_directories(mmaps_generator - PUBLIC - ${PUBLIC_INCLUDES} - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_SOURCE_DIR}/src/server/game/Conditions) - -set_target_properties(mmaps_generator - PROPERTIES - FOLDER - "tools") - -if( UNIX ) - install(TARGETS mmaps_generator DESTINATION bin) -elseif( WIN32 ) - install(TARGETS mmaps_generator DESTINATION "${CMAKE_INSTALL_PREFIX}") -endif() diff --git a/src/tools/vmap4_assembler/CMakeLists.txt b/src/tools/vmap4_assembler/CMakeLists.txt deleted file mode 100644 index 0b0108d7c..000000000 --- a/src/tools/vmap4_assembler/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -# -# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# - -add_executable(vmap4assembler VMapAssembler.cpp) - -if(CMAKE_SYSTEM_NAME MATCHES "Darwin") - set_target_properties(vmap4assembler PROPERTIES LINK_FLAGS "-framework Carbon") -endif() - -target_link_libraries(vmap4assembler - PRIVATE - acore-core-interface - PUBLIC - common - zlib) - -# Group sources -GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) - -set_target_properties(vmap4assembler - PROPERTIES - FOLDER - "tools") - -if( UNIX ) - install(TARGETS vmap4assembler DESTINATION bin) -elseif( WIN32 ) - install(TARGETS vmap4assembler DESTINATION "${CMAKE_INSTALL_PREFIX}") -endif() diff --git a/src/tools/vmap4_extractor/CMakeLists.txt b/src/tools/vmap4_extractor/CMakeLists.txt deleted file mode 100644 index cc0a69548..000000000 --- a/src/tools/vmap4_extractor/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -# -# This file is part of the AzerothCore Project. See AUTHORS file for Copyright information -# -# This file is free software; as a special exception the author gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# - -CollectSourceFiles( - ${CMAKE_CURRENT_SOURCE_DIR} - PRIVATE_SOURCES) - -add_executable(vmap4extractor ${PRIVATE_SOURCES}) - -target_link_libraries(vmap4extractor - PUBLIC - g3dlib - mpq) - -# Group sources -GroupSources(${CMAKE_CURRENT_SOURCE_DIR}) - -CollectIncludeDirectories( - ${CMAKE_CURRENT_SOURCE_DIR} - PUBLIC_INCLUDES) - -target_include_directories(vmap4extractor - PUBLIC - ${PUBLIC_INCLUDES} - PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}) - -set_target_properties(vmap4extractor - PROPERTIES - FOLDER - "tools") - -if( UNIX ) - install(TARGETS vmap4extractor DESTINATION bin) -elseif( WIN32 ) - install(TARGETS vmap4extractor DESTINATION "${CMAKE_INSTALL_PREFIX}") -endif()