From 71182a0a1a0c259c0fc2169ce22dfc2d6347be58 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Mon, 22 Apr 2019 05:05:58 +1000 Subject: [PATCH 01/63] faction fix fixed creature factions https://github.com/azerothcore/mod-guildhouse/issues/1 --- sql/world/Creatures.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/world/Creatures.sql b/sql/world/Creatures.sql index a71ddc0..8af7b11 100644 --- a/sql/world/Creatures.sql +++ b/sql/world/Creatures.sql @@ -1,5 +1,5 @@ -REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 12, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), +REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), (18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Monica', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), (33251, 0, 0, 0, 0, 0, 28516, 0, 0, 0, 'Death Knight Trainer', '', '', 9691, 80, 80, 2, 35, 51, 1, 1.14286, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 32768, 2048, 0, 0, 0, 0, 6, 0, 345, 509, 103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 10, 1, 1, 0, 0, 1, 8388624, 0, '', 12340), -(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Speedfang', 'Guild House Assistant', '', 0, 35, 35, 0, 12, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); +(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Speedfang', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); From fe68660c54074ff864b0dcfcdd9d868852b31f93 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Mon, 22 Apr 2019 23:47:17 +1000 Subject: [PATCH 02/63] faction fix + merge (#2) * Update of module * faction fix fixed creature factions https://github.com/azerothcore/mod-guildhouse/issues/1 --- sql/world/Creatures.sql | 4 ++-- src/mod_guild_house_npc.cpp | 1 - src/mod_guild_house_v2.cpp | 4 +++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sql/world/Creatures.sql b/sql/world/Creatures.sql index a71ddc0..8af7b11 100644 --- a/sql/world/Creatures.sql +++ b/sql/world/Creatures.sql @@ -1,5 +1,5 @@ -REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 12, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), +REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), (18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Monica', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), (33251, 0, 0, 0, 0, 0, 28516, 0, 0, 0, 'Death Knight Trainer', '', '', 9691, 80, 80, 2, 35, 51, 1, 1.14286, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 32768, 2048, 0, 0, 0, 0, 6, 0, 345, 509, 103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 10, 1, 1, 0, 0, 1, 8388624, 0, '', 12340), -(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Speedfang', 'Guild House Assistant', '', 0, 35, 35, 0, 12, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); +(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Speedfang', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 87a2f9d..933091f 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -100,7 +100,6 @@ class GuildHouseSpawner : public CreatureScript { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; - break; case 6: // Auctioneer { uint32 auctioneer = 0; diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 9aacc04..db3be4f 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -191,6 +191,8 @@ class GuildHouseV2PlayerScript : public PlayerScript { if (newZone = 876) CheckPlayer(player); + else + player->SetPhaseMask(GetNormalPhase(player), true); } uint32 GetNormalPhase(Player* player) const @@ -242,7 +244,7 @@ class GuildHouseV2PlayerScript : public PlayerScript player->SetPhaseMask(guildData->phase, true); } else - player->SetPhaseMask(GetNormalPhase(player), false); + player->SetPhaseMask(GetNormalPhase(player), true); } void teleport(Player* player) From 841712edf6cdc4d1b55b949f1abda4f6d3390e8c Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Sat, 10 Aug 2019 17:43:39 +1000 Subject: [PATCH 03/63] add spirit healer --- sql/world/guild_house_spawns.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index aa7fafd..934a977 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -91,6 +91,7 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (46, 28692, 16230.2, 16316.4, 20.8455, 6.25643, 'Trade Supplies'), (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), + (50, 6491, 16218.6, 16241.1, 24.681, 2.298720, 'Spirit Healer'), (50, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; From b0334aa896186e8d6eb95a40922d87782b70adba Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Sat, 10 Aug 2019 17:45:24 +1000 Subject: [PATCH 04/63] update typo --- sql/world/guild_house_spawns.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index 934a977..052d3db 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -92,7 +92,7 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), (50, 6491, 16218.6, 16241.1, 24.681, 2.298720, 'Spirit Healer'), - (50, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); + (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; From 425b9c82771c3f2abec2d30627323f0aebffa1c5 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Sat, 10 Aug 2019 18:13:53 +1000 Subject: [PATCH 05/63] add spirit healer --- src/mod_guild_house_npc.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 933091f..de49cfb 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -44,6 +44,7 @@ class GuildHouseSpawner : public CreatureScript { player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn auctioneer", GuildHouseAuctioneer, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Secondry Profession Trainers", GOSSIP_SENDER_MAIN, 8); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn Spirit Healer?, GuildHouseSpirit, false); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } @@ -167,7 +168,8 @@ class GuildHouseSpawner : public CreatureScript { case 33618: // Skinning case 33608: // Alchemy case 33616: // Herbalism - case 33613: // Tailoring + + case 33613: // Tailoring case 33619: // Cooking case 33623: // Fishing case 33621: // First Aid @@ -187,6 +189,10 @@ class GuildHouseSpawner : public CreatureScript { cost = GuildHouseMailBox; SpawnObject(action, player); break; + case 6491: // spirit healer + cost = GuildHouseSpirit; + SpawnNPC(action, player); + break; case 1685: // forge case 4087: // Anvil case 187293: // Guild Vault @@ -350,6 +356,7 @@ class GuildHouseNPCConf : public WorldScript GuildHouseObject = sConfigMgr->GetIntDefault("GuildHouseObject", 500000); GuildHousePortal = sConfigMgr->GetIntDefault("GuildHousePortal", 500000); GuildHouseProff = sConfigMgr->GetIntDefault("GuildHouseProff", 500000); + GuildHouseSpirit = sConfigMgr->GetIntDefault("GuildHouseSpirit, 100000); } }; From e477a91ff263a3d11b6d89d0c385d691311f3f82 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Sun, 11 Aug 2019 07:53:15 +1000 Subject: [PATCH 06/63] Add config option Spirit healer --- conf/mod_guild_house_v2.conf.dist | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/conf/mod_guild_house_v2.conf.dist b/conf/mod_guild_house_v2.conf.dist index 4044c32..ad51f3a 100644 --- a/conf/mod_guild_house_v2.conf.dist +++ b/conf/mod_guild_house_v2.conf.dist @@ -69,3 +69,10 @@ GuildHousePortal = 1000000 # default = 500000 (50g) # GuildHouseProff = 500000 + +# GuildHouseSpirit +# +# Cost of Spirit Healer at the guildhouse graveyard . +# default = 100000 (10g) +# +GuildHouseSpirit = 100000 From bae0a04c4ed2a34c25dfba10a1f4e2aed624feb9 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Sun, 11 Aug 2019 07:57:26 +1000 Subject: [PATCH 07/63] Updates --- src/mod_guild_house_npc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index de49cfb..7db97f7 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -10,7 +10,7 @@ #include "GameObject.h" #include "Transport.h" -int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseProff; +int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff; class GuildHouseSpawner : public CreatureScript { From 691acf8f89c4cafe77079131f07cc27c48de8db3 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Wed, 14 Aug 2019 19:03:03 +1000 Subject: [PATCH 08/63] update fix build error --- src/mod_guild_house_npc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 7db97f7..5bb33ec 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -44,7 +44,7 @@ class GuildHouseSpawner : public CreatureScript { player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn auctioneer", GuildHouseAuctioneer, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Secondry Profession Trainers", GOSSIP_SENDER_MAIN, 8); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn Spirit Healer?, GuildHouseSpirit, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn Spirit Healer?", GuildHouseSpirit, false); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } @@ -356,7 +356,7 @@ class GuildHouseNPCConf : public WorldScript GuildHouseObject = sConfigMgr->GetIntDefault("GuildHouseObject", 500000); GuildHousePortal = sConfigMgr->GetIntDefault("GuildHousePortal", 500000); GuildHouseProff = sConfigMgr->GetIntDefault("GuildHouseProff", 500000); - GuildHouseSpirit = sConfigMgr->GetIntDefault("GuildHouseSpirit, 100000); + GuildHouseSpirit = sConfigMgr->GetIntDefault("GuildHouseSpirit", 100000); } }; From 24442d29c7cd7f0d6055e49317aaf532aa62ac83 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Wed, 14 Aug 2019 19:04:02 +1000 Subject: [PATCH 09/63] remove tabs --- sql/world/guild_house_spawns.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index 052d3db..f159638 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -92,7 +92,7 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), (50, 6491, 16218.6, 16241.1, 24.681, 2.298720, 'Spirit Healer'), - (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); + (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; From 463eea30cf13b70ffcac27882d3695d7124c53a5 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Wed, 14 Aug 2019 19:13:18 +1000 Subject: [PATCH 10/63] fix build warning --- src/mod_guild_house_v2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index db3be4f..86b45f9 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -189,7 +189,7 @@ class GuildHouseV2PlayerScript : public PlayerScript void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea) { - if (newZone = 876) + if (newZone == 876) CheckPlayer(player); else player->SetPhaseMask(GetNormalPhase(player), true); From 6fa05f5a060269b1a40e1105c7c3d958e9112a87 Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Wed, 14 Aug 2019 20:52:10 +1000 Subject: [PATCH 11/63] update coordinates --- sql/world/guild_house_spawns.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index f159638..4128944 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -91,7 +91,7 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (46, 28692, 16230.2, 16316.4, 20.8455, 6.25643, 'Trade Supplies'), (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), - (50, 6491, 16218.6, 16241.1, 24.681, 2.298720, 'Spirit Healer'), + (50, 6491, 16319.937, 16242.404, 24.4747, 2.206830, 'Spirit Healer'), (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; From b35e7067308f3a783488f0625efab6a733a85f8f Mon Sep 17 00:00:00 2001 From: Micrah <44911744+milestorme@users.noreply.github.com> Date: Thu, 15 Aug 2019 08:58:11 +1000 Subject: [PATCH 12/63] add spirit healer fix build warnings (#3) * Update of module * faction fix fixed creature factions https://github.com/azerothcore/mod-guildhouse/issues/1 * add spirit healer * update typo * add spirit healer * Add config option Spirit healer * Updates * update fix build error * remove tabs * fix build warning * update coordinates --- conf/mod_guild_house_v2.conf.dist | 7 +++++++ sql/world/guild_house_spawns.sql | 3 ++- src/mod_guild_house_npc.cpp | 11 +++++++++-- src/mod_guild_house_v2.cpp | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/conf/mod_guild_house_v2.conf.dist b/conf/mod_guild_house_v2.conf.dist index 4044c32..ad51f3a 100644 --- a/conf/mod_guild_house_v2.conf.dist +++ b/conf/mod_guild_house_v2.conf.dist @@ -69,3 +69,10 @@ GuildHousePortal = 1000000 # default = 500000 (50g) # GuildHouseProff = 500000 + +# GuildHouseSpirit +# +# Cost of Spirit Healer at the guildhouse graveyard . +# default = 100000 (10g) +# +GuildHouseSpirit = 100000 diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index aa7fafd..4128944 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -91,7 +91,8 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (46, 28692, 16230.2, 16316.4, 20.8455, 6.25643, 'Trade Supplies'), (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), - (50, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); + (50, 6491, 16319.937, 16242.404, 24.4747, 2.206830, 'Spirit Healer'), + (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 933091f..5bb33ec 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -10,7 +10,7 @@ #include "GameObject.h" #include "Transport.h" -int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseProff; +int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff; class GuildHouseSpawner : public CreatureScript { @@ -44,6 +44,7 @@ class GuildHouseSpawner : public CreatureScript { player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn auctioneer", GuildHouseAuctioneer, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Secondry Profession Trainers", GOSSIP_SENDER_MAIN, 8); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn Spirit Healer?", GuildHouseSpirit, false); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } @@ -167,7 +168,8 @@ class GuildHouseSpawner : public CreatureScript { case 33618: // Skinning case 33608: // Alchemy case 33616: // Herbalism - case 33613: // Tailoring + + case 33613: // Tailoring case 33619: // Cooking case 33623: // Fishing case 33621: // First Aid @@ -187,6 +189,10 @@ class GuildHouseSpawner : public CreatureScript { cost = GuildHouseMailBox; SpawnObject(action, player); break; + case 6491: // spirit healer + cost = GuildHouseSpirit; + SpawnNPC(action, player); + break; case 1685: // forge case 4087: // Anvil case 187293: // Guild Vault @@ -350,6 +356,7 @@ class GuildHouseNPCConf : public WorldScript GuildHouseObject = sConfigMgr->GetIntDefault("GuildHouseObject", 500000); GuildHousePortal = sConfigMgr->GetIntDefault("GuildHousePortal", 500000); GuildHouseProff = sConfigMgr->GetIntDefault("GuildHouseProff", 500000); + GuildHouseSpirit = sConfigMgr->GetIntDefault("GuildHouseSpirit", 100000); } }; diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index db3be4f..86b45f9 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -189,7 +189,7 @@ class GuildHouseV2PlayerScript : public PlayerScript void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea) { - if (newZone = 876) + if (newZone == 876) CheckPlayer(player); else player->SetPhaseMask(GetNormalPhase(player), true); From 847c08e76ae36293076047ac83ba184434dcd296 Mon Sep 17 00:00:00 2001 From: Rob Bedford Date: Tue, 8 Oct 2019 07:07:33 -0700 Subject: [PATCH 13/63] Added Portal: Shattrath & Reagent Vendor --- guildhouse.patch | 34 ++++++++++++++++---------------- sql/world/Creatures.sql | 6 +++--- sql/world/guild_house_spawns.sql | 6 ++++-- src/mod_guild_house_npc.cpp | 7 +++++-- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/guildhouse.patch b/guildhouse.patch index 73ed2f8..b3a0613 100644 --- a/guildhouse.patch +++ b/guildhouse.patch @@ -1,17 +1,17 @@ -diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h -index 0d779cd7..4d0d0594 100644 ---- a/src/server/game/Entities/Object/Object.h -+++ b/src/server/game/Entities/Object/Object.h -@@ -796,7 +796,11 @@ class WorldObject : public Object, public WorldLocation - virtual void SetPhaseMask(uint32 newPhaseMask, bool update); - uint32 GetPhaseMask() const { return m_phaseMask; } - bool InSamePhase(WorldObject const* obj) const { return InSamePhase(obj->GetPhaseMask()); } -- bool InSamePhase(uint32 phasemask) const { return (GetPhaseMask() & phasemask); } -+ bool InSamePhase(uint32 phasemask) const { -+ if (GetZoneId() == 876) -+ return GetPhaseMask() == phasemask; -+ return (GetPhaseMask() & phasemask) != 0; -+ } - - virtual uint32 GetZoneId(bool forceRecalc = false) const; - virtual uint32 GetAreaId(bool forceRecalc = false) const; +diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h +index 0d779cd7..4d0d0594 100644 +--- a/src/server/game/Entities/Object/Object.h ++++ b/src/server/game/Entities/Object/Object.h +@@ -796,7 +796,11 @@ class WorldObject : public Object, public WorldLocation + virtual void SetPhaseMask(uint32 newPhaseMask, bool update); + uint32 GetPhaseMask() const { return m_phaseMask; } + bool InSamePhase(WorldObject const* obj) const { return InSamePhase(obj->GetPhaseMask()); } +- bool InSamePhase(uint32 phasemask) const { return (GetPhaseMask() & phasemask); } ++ bool InSamePhase(uint32 phasemask) const { ++ if (GetZoneId() == 876) ++ return GetPhaseMask() == phasemask; ++ return (GetPhaseMask() & phasemask) != 0; ++ } + + virtual uint32 GetZoneId(bool forceRecalc = false) const; + virtual uint32 GetAreaId(bool forceRecalc = false) const; diff --git a/sql/world/Creatures.sql b/sql/world/Creatures.sql index 8af7b11..989e552 100644 --- a/sql/world/Creatures.sql +++ b/sql/world/Creatures.sql @@ -1,5 +1,5 @@ -REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), -(18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Monica', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), +REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Xrispins', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), +(18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Angela', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), (33251, 0, 0, 0, 0, 0, 28516, 0, 0, 0, 'Death Knight Trainer', '', '', 9691, 80, 80, 2, 35, 51, 1, 1.14286, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 32768, 2048, 0, 0, 0, 0, 6, 0, 345, 509, 103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 10, 1, 1, 0, 0, 1, 8388624, 0, '', 12340), -(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Speedfang', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); +(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Rapidomuerte', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index 4128944..19d392f 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -86,13 +86,15 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (41, 183326, 16202.1, 16223.1, 1.03401, 0.829316, 'Portal: Thunder Bluff (Object)'), (42, 183324, 16196.8, 16227.5, 1.37206, 0.762557, 'Portal: Silvermoon (Object)'), (43, 183321, 16196.8, 16227.5, 1.37206, 0.762557, 'Portal: Exodar (Object)'), - (44, 191164, 16206, 16216, 1.10669, 1.0453, 'Portal: Dalaran (Object)'), + (44, 191164, 16207, 16216, 1.10669, 1.0453, 'Portal: Dalaran (Object)'), (45, 187293, 16230.5, 16283.5, 13.9061, 3, 'Guild Vault (Object)'), (46, 28692, 16230.2, 16316.4, 20.8455, 6.25643, 'Trade Supplies'), (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), (50, 6491, 16319.937, 16242.404, 24.4747, 2.206830, 'Spirit Healer'), - (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); + (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'), + (52, 191013, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object)'), + (53, 29636, 16233.5, 16316.1, 20.8455, 3.07558, 'Reagent Vendor'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 5bb33ec..0240e32 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -74,6 +74,7 @@ class GuildHouseSpawner : public CreatureScript { player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Trade Supplies", GOSSIP_SENDER_MAIN, 28692, "Spawn Trade Supplies?", GuildHouseVendor, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Tabard Vendor", GOSSIP_SENDER_MAIN, 28776, "Spawn Tabard Vendor?", GuildHouseVendor, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Food & Drink", GOSSIP_SENDER_MAIN, 29715, "Spawn Food & Drink?", GuildHouseVendor, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Reagent Vendor", GOSSIP_SENDER_MAIN, 29636, "Spawn Reagent Vendor?", GuildHouseVendor, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; @@ -96,6 +97,7 @@ class GuildHouseSpawner : public CreatureScript { player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 183324, "Add Silvermoon Portal?", GuildHousePortal, false); } player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 191164, "Add Dalaran Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191013, "Add Shattrath Portal?", GuildHousePortal, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); @@ -168,8 +170,7 @@ class GuildHouseSpawner : public CreatureScript { case 33618: // Skinning case 33608: // Alchemy case 33616: // Herbalism - - case 33613: // Tailoring + case 33613: // Tailoring case 33619: // Cooking case 33623: // Fishing case 33621: // First Aid @@ -179,6 +180,7 @@ class GuildHouseSpawner : public CreatureScript { case 28692: // Trade supplies case 28776: // Tabard Vendor case 29715: // Food & Drink + case 29636: // Reagent Vendor cost = GuildHouseProff; SpawnNPC(action, player); break; @@ -209,6 +211,7 @@ class GuildHouseSpawner : public CreatureScript { case 183324: // Silvermoon Portal case 183321: // Exodar Portal case 191164: // Dalaran Portal + case 191013: // Shattrath Portal cost = GuildHousePortal; SpawnObject(action, player); break; From 6e3f23762ca4617e25fde93223523c73f05e6b87 Mon Sep 17 00:00:00 2001 From: Rob <34249320+rbedfordpro@users.noreply.github.com> Date: Tue, 8 Oct 2019 07:23:45 -0700 Subject: [PATCH 14/63] Updating Readme --- README.md | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e297534..b7328a3 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,27 @@ ## Description -This is a phased guild house system for Azerothcore, it allows players to from the same guild to visit their guild house to explore, train ect -All guilds will get their own phasing system which then the guild master will have to purchase NPC's creatures and other stuff to complete the creation. +This is a phased guild house system for Azerothcore, it allows players to from the same guild to visit their guild house. +All guilds will get their own phasing system which then the guild master will have to purchase NPC's creatures and other stuff to complete the creation. +### Purchasables -## How to use ingame -Once a player has brought a guild house from the NPC they can either teleport to the guildhouse by via the NPC or do .guildhouse tele +* Class Trainers (all available in Wrath) +* Primary Profession Trainers (all available in Wrath) +* Secondary Profession Trainers (all available in Wrath) +* Vendors: Reagents, Food & Water and Trade Goods +* Portals to Neutral, Horde and Alliance cities +* Spirit Healer +* Guild Bank and Personal Bank access +* Auctioneer -Once the player is in the location of the guild house the guild master has a command .guildhouse spawnnpc this will allow the guild master -to start placing objects / npc within the guild house. +## How to use ingame +1) Purchase a guild house from the NPC (entry:55005), then either teleport to the guildhouse via the NPC or chat: `.guildhouse tele` +2) Once the player is in the location of the guild house the guild master has a command .guildhouse spawnnpc this will load the Guild House Assistant. +3) Speak with the Guild House Assistant to begin purchasing objects ## Requirements -My new module requires: - - AzerothCore v1.0.1+ ## Installation @@ -28,9 +35,9 @@ My new module requires: 3) Apply the guildhouse.patch to your source 4) Re-run cmake and launch a clean build of AzerothCore. ``` -## Patch Information +## Patch Information (guildhouse.patch) -The patch basicly turns the selected area from a bitmask to a uint, this fixes the issues with the phasing +The patch basically turns the selected area from a bitmask to a uint, this fixes the issues with the phasing Before Patch : Guild 1 Can see phase 1 @@ -46,7 +53,8 @@ If you need to change the module configuration, go to your server configuration ## Credits -* [Me](https://github.com/talamortis) (author of the module) +* [Talamortis](https://github.com/talamortis) (Original author of the module) * [Rochet2](https://github.com/Rochet2/): Thanks for the help with the phasing situation & General support +* [Anhanga] (https://github.com/rbedfordpro) -AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd) +AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/64FH6Y8) From 9ffd5adbbb2071bb539e752a15b4ecd3d62a9d7b Mon Sep 17 00:00:00 2001 From: Rob <34249320+rbedfordpro@users.noreply.github.com> Date: Tue, 8 Oct 2019 07:24:28 -0700 Subject: [PATCH 15/63] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7328a3..47c3d18 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,6 @@ If you need to change the module configuration, go to your server configuration * [Talamortis](https://github.com/talamortis) (Original author of the module) * [Rochet2](https://github.com/Rochet2/): Thanks for the help with the phasing situation & General support -* [Anhanga] (https://github.com/rbedfordpro) +* [Anhanga](https://github.com/rbedfordpro) AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/64FH6Y8) From 7c5eea389d35f0b2af1b3eb3f10d2768402cb571 Mon Sep 17 00:00:00 2001 From: Rob Bedford Date: Tue, 8 Oct 2019 10:17:08 -0700 Subject: [PATCH 16/63] Working on adding ability to define guild rankIds ability to make purchases --- .gitignore | 5 +++++ conf/mod_guild_house_v2.conf.dist | 11 +++++++++++ src/mod_guild_house_npc.cpp | 18 +++++++++++------- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index c6e1299..ade4c67 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,8 @@ local.properties .loadpath .project .cproject + +# +# Config file +# +conf/mod_guild_house_v2.conf diff --git a/conf/mod_guild_house_v2.conf.dist b/conf/mod_guild_house_v2.conf.dist index ad51f3a..c64f4c8 100644 --- a/conf/mod_guild_house_v2.conf.dist +++ b/conf/mod_guild_house_v2.conf.dist @@ -76,3 +76,14 @@ GuildHouseProff = 500000 # default = 100000 (10g) # GuildHouseSpirit = 100000 + +# GuildHouseBuyRank +# +# Minimum GuildRank able to make purchases in guild house +# default = 0 (Guild Master) +# GR_GUILDMASTER = 0 +# GR_OFFICER = 1 +# GR_VETERAN = 2 ... etc +# +GuildHouseBuyRank = 0 + diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 287a2d3..a9b1d60 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -10,7 +10,7 @@ #include "GameObject.h" #include "Transport.h" -int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff; +int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff, GuildHouseBuyRank; class GuildHouseSpawner : public CreatureScript { @@ -22,9 +22,12 @@ class GuildHouseSpawner : public CreatureScript { if (player->GetGuild()) { + // WIP - Anhanga + //Member const* memberMe = GetMember(player->GetGUID()); + //if (memberMe->GetRankId() <= GuildHouseBuyRank) if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { - ChatHandler(player->GetSession()).PSendSysMessage("You are not the guild leader, sorry i cant do business with you"); + ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases."); return false; } } @@ -35,16 +38,16 @@ class GuildHouseSpawner : public CreatureScript { } player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 18649, "Add a Innkeeper?", GuildHouseInnKeeper, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 18649, "Add an Innkeeper?", GuildHouseInnKeeper, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Mailbox", GOSSIP_SENDER_MAIN, 184137, "Spawn a mailbox?", GuildHouseMailBox, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn Class Trainer", GOSSIP_SENDER_MAIN, 2); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn Vendor", GOSSIP_SENDER_MAIN, 3); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn City Portals / Objects", GOSSIP_SENDER_MAIN, 4); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Bank", GOSSIP_SENDER_MAIN, 30605, "Spawn banker?", GuildHouseBank, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn auctioneer", GuildHouseAuctioneer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Bank", GOSSIP_SENDER_MAIN, 30605, "Spawn a banker?", GuildHouseBank, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn an auctioneer", GuildHouseAuctioneer, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Secondry Profession Trainers", GOSSIP_SENDER_MAIN, 8); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn Spirit Healer?", GuildHouseSpirit, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn a Spirit Healer?", GuildHouseSpirit, false); player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } @@ -81,7 +84,7 @@ class GuildHouseSpawner : public CreatureScript { case 4: //objects / portals player->PlayerTalkClass->ClearMenus(); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Forge", GOSSIP_SENDER_MAIN, 1685, "Add a forge?", GuildHouseObject, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Anvil", GOSSIP_SENDER_MAIN, 4087, "Add a Anvil?", GuildHouseObject, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Anvil", GOSSIP_SENDER_MAIN, 4087, "Add an Anvil?", GuildHouseObject, false); if (player->GetTeamId() == TEAM_ALLIANCE) { player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Stormwind", GOSSIP_SENDER_MAIN, 183325, "Add Stormwind Portal?", GuildHousePortal, false); @@ -361,6 +364,7 @@ class GuildHouseNPCConf : public WorldScript GuildHousePortal = sConfigMgr->GetIntDefault("GuildHousePortal", 500000); GuildHouseProff = sConfigMgr->GetIntDefault("GuildHouseProff", 500000); GuildHouseSpirit = sConfigMgr->GetIntDefault("GuildHouseSpirit", 100000); + GuildHouseBuyRank = sConfigMgr->GetIntDefault("GuildHouseBuyRank", 1); } }; From a9ab8c98a5f0b0865fffdd6b6996372a2689a04c Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 8 Oct 2019 17:12:08 -0700 Subject: [PATCH 17/63] Working on allowing guildrank to define who can purchase --- src/mod_guild_house_npc.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index a9b1d60..7e15f78 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -23,11 +23,12 @@ class GuildHouseSpawner : public CreatureScript { if (player->GetGuild()) { // WIP - Anhanga - //Member const* memberMe = GetMember(player->GetGUID()); - //if (memberMe->GetRankId() <= GuildHouseBuyRank) - if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) + Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()); + Guild::Member const* memberMe = guild->GetMember(player->GetGUID()); + if (memberMe->GetRankId() <= GuildHouseBuyRank) + //if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { - ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases."); + ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases (RankId: %hhu | %d).", memberMe->GetRankId(), GuildHouseBuyRank); return false; } } @@ -364,7 +365,7 @@ class GuildHouseNPCConf : public WorldScript GuildHousePortal = sConfigMgr->GetIntDefault("GuildHousePortal", 500000); GuildHouseProff = sConfigMgr->GetIntDefault("GuildHouseProff", 500000); GuildHouseSpirit = sConfigMgr->GetIntDefault("GuildHouseSpirit", 100000); - GuildHouseBuyRank = sConfigMgr->GetIntDefault("GuildHouseBuyRank", 1); + GuildHouseBuyRank = sConfigMgr->GetIntDefault("GuildHouseBuyRank", 0); } }; From d8b36e0a7fe85c9ac1a77a625f049e9b556a4bdc Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 8 Oct 2019 18:53:14 -0700 Subject: [PATCH 18/63] Now can allow GuildRanks other than GuildMaster to make purchases. --- src/mod_guild_house_npc.cpp | 6 +++++- src/mod_guild_house_v2.cpp | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 7e15f78..55b0d2f 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -9,6 +9,10 @@ #include "DataMap.h" #include "GameObject.h" #include "Transport.h" +#include "Chat.h" +#include "ScriptedGossip.h" +#include "SpellAuraEffects.h" +#include "CreatureAI.h" int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff, GuildHouseBuyRank; @@ -25,7 +29,7 @@ class GuildHouseSpawner : public CreatureScript { // WIP - Anhanga Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()); Guild::Member const* memberMe = guild->GetMember(player->GetGUID()); - if (memberMe->GetRankId() <= GuildHouseBuyRank) + if ((int)memberMe->GetRankId() > GuildHouseBuyRank) //if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases (RankId: %hhu | %d).", memberMe->GetRankId(), GuildHouseBuyRank); diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 86b45f9..d4e5a6c 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -9,6 +9,9 @@ #include "DataMap.h" #include "GameObject.h" #include "Transport.h" +#include "Chat.h" +#include "ScriptedGossip.h" +#include "SpellAuraEffects.h" class GuildData : public DataMap::Base { From 53de92f9c5f2b0fc2c18f90ad32427e77eb622b6 Mon Sep 17 00:00:00 2001 From: Rob <34249320+rbedfordpro@users.noreply.github.com> Date: Tue, 8 Oct 2019 19:01:32 -0700 Subject: [PATCH 19/63] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 47c3d18..07e863c 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ All guilds will get their own phasing system which then the guild master will ha ## How to use ingame 1) Purchase a guild house from the NPC (entry:55005), then either teleport to the guildhouse via the NPC or chat: `.guildhouse tele` 2) Once the player is in the location of the guild house the guild master has a command .guildhouse spawnnpc this will load the Guild House Assistant. -3) Speak with the Guild House Assistant to begin purchasing objects +3) Speak with the Guild House Assistant to begin purchasing objects - to allow ranks other than Guild Master the privilege of making purchases, modify the .conf file's GuildHouseBuyRank value. ## Requirements From 56ade1f0b89232d678419a15872674b362f76e8f Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 8 Oct 2019 19:08:23 -0700 Subject: [PATCH 20/63] removing comments --- src/mod_guild_house_npc.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 55b0d2f..02b99b0 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -26,11 +26,9 @@ class GuildHouseSpawner : public CreatureScript { if (player->GetGuild()) { - // WIP - Anhanga Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()); Guild::Member const* memberMe = guild->GetMember(player->GetGUID()); if ((int)memberMe->GetRankId() > GuildHouseBuyRank) - //if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases (RankId: %hhu | %d).", memberMe->GetRankId(), GuildHouseBuyRank); return false; From da98617d850448d630e7dd708d15476c37a18049 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 8 Oct 2019 19:14:07 -0700 Subject: [PATCH 21/63] Removed small troubleshooting text in Message --- src/mod_guild_house_npc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 02b99b0..c33fe79 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -30,7 +30,7 @@ class GuildHouseSpawner : public CreatureScript { Guild::Member const* memberMe = guild->GetMember(player->GetGUID()); if ((int)memberMe->GetRankId() > GuildHouseBuyRank) { - ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases (RankId: %hhu | %d).", memberMe->GetRankId(), GuildHouseBuyRank); + ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases."); return false; } } From 2818929697a4016065561af68f656bcc669ec216 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 9 Oct 2019 06:18:23 -0700 Subject: [PATCH 22/63] Fixed merge issue --- sql/world/Creatures.sql | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sql/world/Creatures.sql b/sql/world/Creatures.sql index 8057fd9..212e367 100644 --- a/sql/world/Creatures.sql +++ b/sql/world/Creatures.sql @@ -1,12 +1,4 @@ -<<<<<<< HEAD REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Xrispins', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), (18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Angela', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), (33251, 0, 0, 0, 0, 0, 28516, 0, 0, 0, 'Death Knight Trainer', '', '', 9691, 80, 80, 2, 35, 51, 1, 1.14286, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 32768, 2048, 0, 0, 0, 0, 6, 0, 345, 509, 103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 10, 1, 1, 0, 0, 1, 8388624, 0, '', 12340), (70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Rapidomuerte', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); -======= -REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), -(18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Monica', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), -(33251, 0, 0, 0, 0, 0, 28516, 0, 0, 0, 'Death Knight Trainer', '', '', 9691, 80, 80, 2, 35, 51, 1, 1.14286, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 32768, 2048, 0, 0, 0, 0, 6, 0, 345, 509, 103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 10, 1, 1, 0, 0, 1, 8388624, 0, '', 12340), -(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Speedfang', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); ->>>>>>> 9ffd5adbbb2071bb539e752a15b4ecd3d62a9d7b - From 37dc33bbcccdf92b2d5a548d49be4f05bdfbe185 Mon Sep 17 00:00:00 2001 From: Rob <34249320+rbedfordpro@users.noreply.github.com> Date: Wed, 9 Oct 2019 10:06:18 -0700 Subject: [PATCH 23/63] Updated with correct info regarding mob to spawn Had incorrectly listed entry 55005 as npc to spawn for purchasing guild houses. --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 07e863c..39dccf2 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,10 @@ All guilds will get their own phasing system which then the guild master will ha * Auctioneer ## How to use ingame -1) Purchase a guild house from the NPC (entry:55005), then either teleport to the guildhouse via the NPC or chat: `.guildhouse tele` -2) Once the player is in the location of the guild house the guild master has a command .guildhouse spawnnpc this will load the Guild House Assistant. -3) Speak with the Guild House Assistant to begin purchasing objects - to allow ranks other than Guild Master the privilege of making purchases, modify the .conf file's GuildHouseBuyRank value. +1) As GM: .npc add 70101 -> somewhere public and accessible by other players. +2) Purchase a guild house from the added NPC, then either teleport to the guildhouse via the NPC or chat: `.guildhouse tele` +3) Once the player is in the location of the guild house the guild master has a command .guildhouse spawnnpc this will load the Guild House Assistant. +4) Speak with the Guild House Assistant to begin purchasing objects. ## Requirements From 9202da5b79f98e4fc5d84b4566d4eaf8d4214f7c Mon Sep 17 00:00:00 2001 From: WiZZy Date: Wed, 9 Oct 2019 21:02:01 +0300 Subject: [PATCH 24/63] Create .travis.yml --- .travis.yml | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..848d188 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,76 @@ +sudo: required +dist: bionic # (18.04) + +language: cpp + +cache: ccache + +addons: + apt: + update: true + +services: + - mysql + +git: + depth: 10 + +stages: + - prepare_cache + - run + +jobs: + include: + - stage: prepare_cache + env: TRAVIS_BUILD_ID="1" + before_install: + - cd .. + - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk + - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules + - cd azerothcore-wotlk + - source ./apps/ci/ci-before_install.sh + install: + - source ./apps/ci/ci-install.sh OFF + script: + - source ./apps/ci/ci-compile.sh + + - stage: run + env: TRAVIS_BUILD_ID="1" + before_install: + - cd .. + - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk + - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules + - cd azerothcore-wotlk + - source ./apps/ci/ci-before_install.sh + install: + - source ./apps/ci/ci-install.sh ON + - source ./apps/ci/ci-import-db.sh + script: + - source ./apps/ci/ci-compile.sh + - source ./apps/ci/ci-worldserver-dry-run.sh + + - stage: prepare_cache + env: TRAVIS_BUILD_ID="2" + before_install: + - cd .. + - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk + - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules + - cd azerothcore-wotlk + - source ./apps/ci/ci-before_install.sh + install: + - source ./apps/ci/ci-install.sh OFF + script: + - source ./apps/ci/ci-compile.sh + + - stage: run + env: TRAVIS_BUILD_ID="2" + before_install: + - cd .. + - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk + - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules + - cd azerothcore-wotlk + - source ./apps/ci/ci-before_install.sh + install: + - source ./apps/ci/ci-install.sh ON + script: + - source ./apps/ci/ci-compile.sh From e1b527b6cb10f6efe6e0c78f56ab8c79f8ea251e Mon Sep 17 00:00:00 2001 From: WiZZy Date: Wed, 9 Oct 2019 21:05:48 +0300 Subject: [PATCH 25/63] Fix travis and add new gossip functions --- src/mod_guild_house_v2.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index d4e5a6c..ed8996b 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -3,15 +3,15 @@ #include "Configuration/Config.h" #include "Creature.h" #include "Guild.h" +#include "SpellAuraEffects.h" +#include "Chat.h" +#include "ScriptedGossip.h" #include "GuildMgr.h" #include "Define.h" #include "GossipDef.h" #include "DataMap.h" #include "GameObject.h" #include "Transport.h" -#include "Chat.h" -#include "ScriptedGossip.h" -#include "SpellAuraEffects.h" class GuildData : public DataMap::Base { @@ -30,7 +30,7 @@ class GuildHelper : public GuildScript{ GuildHelper() : GuildScript("GuildHelper") { } - void OnCreate(Guild* guild, Player* leader, const std::string& name) + void OnCreate(Guild*, Player* leader, const std::string&) { ChatHandler(leader->GetSession()).PSendSysMessage("You now own a guild. You can purchase a guild house!"); } @@ -63,13 +63,13 @@ class GuildHouseSeller : public CreatureScript { if (player->GetGuild()->GetLeaderGUID() == player->GetGUID()) { // Only leader of the guild can buy / sell guild house - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "Buy Guild House!", GOSSIP_SENDER_MAIN, 2); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", NULL, false); + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Buy Guild House!", GOSSIP_SENDER_MAIN, 2); + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", NULL, false); } - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Close", GOSSIP_SENDER_MAIN, 5); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Close", GOSSIP_SENDER_MAIN, 5); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } @@ -89,7 +89,7 @@ class GuildHouseSeller : public CreatureScript { posZ = 13.257628f; break; case 5: // close - player->CLOSE_GOSSIP_MENU(); + CloseGossipMenuFor(player); break; case 3: // Sell back guild house { @@ -139,14 +139,14 @@ class GuildHouseSeller : public CreatureScript { if (result) { ChatHandler(player->GetSession()).PSendSysMessage("You cant buy any more guilds houses!"); - player->CLOSE_GOSSIP_MENU(); + CloseGossipMenuFor(player); return false; } - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "GM Island", GOSSIP_SENDER_MAIN, 100, "Buy GM island Guildhouse?", sConfigMgr->GetIntDefault("CostGuildHouse", 10000000), false); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, " ----- More to Come ----", GOSSIP_SENDER_MAIN, 4); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + ClearGossipMenuFor(player); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "GM Island", GOSSIP_SENDER_MAIN, 100, "Buy GM island Guildhouse?", sConfigMgr->GetIntDefault("CostGuildHouse", 10000000), false); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, " ----- More to Come ----", GOSSIP_SENDER_MAIN, 4); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } From 08a38cc0bff804ed780da23b3cbe78babf862789 Mon Sep 17 00:00:00 2001 From: WiZZy Date: Wed, 9 Oct 2019 21:07:59 +0300 Subject: [PATCH 26/63] Fix travis and add new gossip functions --- src/mod_guild_house_npc.cpp | 160 ++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 79 deletions(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index c33fe79..3070864 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -1,5 +1,7 @@ #include "ScriptMgr.h" #include "Player.h" +#include "Chat.h" +#include "ScriptedGossip.h" #include "Configuration/Config.h" #include "Creature.h" #include "Guild.h" @@ -9,9 +11,6 @@ #include "DataMap.h" #include "GameObject.h" #include "Transport.h" -#include "Chat.h" -#include "ScriptedGossip.h" -#include "SpellAuraEffects.h" #include "CreatureAI.h" int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff, GuildHouseBuyRank; @@ -26,11 +25,13 @@ class GuildHouseSpawner : public CreatureScript { if (player->GetGuild()) { + // WIP - Anhanga Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()); Guild::Member const* memberMe = guild->GetMember(player->GetGUID()); - if ((int)memberMe->GetRankId() > GuildHouseBuyRank) + if (memberMe->IsRankNotLower(GuildHouseBuyRank)) + //if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { - ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases."); + ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases (RankId: %hhu | %d).", memberMe->GetRankId(), GuildHouseBuyRank); return false; } } @@ -40,74 +41,74 @@ class GuildHouseSpawner : public CreatureScript { return false; } - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 18649, "Add an Innkeeper?", GuildHouseInnKeeper, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Mailbox", GOSSIP_SENDER_MAIN, 184137, "Spawn a mailbox?", GuildHouseMailBox, false); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn Class Trainer", GOSSIP_SENDER_MAIN, 2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn Vendor", GOSSIP_SENDER_MAIN, 3); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn City Portals / Objects", GOSSIP_SENDER_MAIN, 4); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Bank", GOSSIP_SENDER_MAIN, 30605, "Spawn a banker?", GuildHouseBank, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn an auctioneer", GuildHouseAuctioneer, false); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Secondry Profession Trainers", GOSSIP_SENDER_MAIN, 8); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn a Spirit Healer?", GuildHouseSpirit, false); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + ClearGossipMenuFor(player); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 18649, "Add an Innkeeper?", GuildHouseInnKeeper, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Mailbox", GOSSIP_SENDER_MAIN, 184137, "Spawn a mailbox?", GuildHouseMailBox, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Class Trainer", GOSSIP_SENDER_MAIN, 2); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Vendor", GOSSIP_SENDER_MAIN, 3); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn City Portals / Objects", GOSSIP_SENDER_MAIN, 4); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Spawn Bank", GOSSIP_SENDER_MAIN, 30605, "Spawn a banker?", GuildHouseBank, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn an auctioneer", GuildHouseAuctioneer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Spawn Secondry Profession Trainers", GOSSIP_SENDER_MAIN, 8); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn a Spirit Healer?", GuildHouseSpirit, false); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } - bool OnGossipSelect(Player *player, Creature * m_creature, uint32 sender, uint32 action) + bool OnGossipSelect(Player *player, Creature * m_creature, uint32, uint32 action) { switch (action) { case 2: // spawn class trainer - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Death Knight", GOSSIP_SENDER_MAIN, 33251, "Spawn Death Knight Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Druid", GOSSIP_SENDER_MAIN, 26324, "Spawn Druid Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Hunter", GOSSIP_SENDER_MAIN, 26325, "Spawn Hunter Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Mage", GOSSIP_SENDER_MAIN, 26326, "Spawn Mage Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Paladin", GOSSIP_SENDER_MAIN, 26327, "Spawn Paladin Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Priest", GOSSIP_SENDER_MAIN, 26328, "Spawn Priest Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Rogue", GOSSIP_SENDER_MAIN, 26329, "Spawn Rogue Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Shaman", GOSSIP_SENDER_MAIN, 26330, "Spawn Shaman Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Warlock", GOSSIP_SENDER_MAIN, 26331, "Spawn Warlock Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Warrior", GOSSIP_SENDER_MAIN, 26332, "Spawn Warrior Trainer?", GuildHouseTrainer, false); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + ClearGossipMenuFor(player); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Death Knight", GOSSIP_SENDER_MAIN, 33251, "Spawn Death Knight Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Druid", GOSSIP_SENDER_MAIN, 26324, "Spawn Druid Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Hunter", GOSSIP_SENDER_MAIN, 26325, "Spawn Hunter Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Mage", GOSSIP_SENDER_MAIN, 26326, "Spawn Mage Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Paladin", GOSSIP_SENDER_MAIN, 26327, "Spawn Paladin Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Priest", GOSSIP_SENDER_MAIN, 26328, "Spawn Priest Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Rogue", GOSSIP_SENDER_MAIN, 26329, "Spawn Rogue Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Shaman", GOSSIP_SENDER_MAIN, 26330, "Spawn Shaman Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Warlock", GOSSIP_SENDER_MAIN, 26331, "Spawn Warlock Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Warrior", GOSSIP_SENDER_MAIN, 26332, "Spawn Warrior Trainer?", GuildHouseTrainer, false); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 3: // Vendors - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Trade Supplies", GOSSIP_SENDER_MAIN, 28692, "Spawn Trade Supplies?", GuildHouseVendor, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Tabard Vendor", GOSSIP_SENDER_MAIN, 28776, "Spawn Tabard Vendor?", GuildHouseVendor, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Food & Drink", GOSSIP_SENDER_MAIN, 29715, "Spawn Food & Drink?", GuildHouseVendor, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Reagent Vendor", GOSSIP_SENDER_MAIN, 29636, "Spawn Reagent Vendor?", GuildHouseVendor, false); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + ClearGossipMenuFor(player); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Trade Supplies", GOSSIP_SENDER_MAIN, 28692, "Spawn Trade Supplies?", GuildHouseVendor, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Tabard Vendor", GOSSIP_SENDER_MAIN, 28776, "Spawn Tabard Vendor?", GuildHouseVendor, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Food & Drink", GOSSIP_SENDER_MAIN, 29715, "Spawn Food & Drink?", GuildHouseVendor, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Reagent Vendor", GOSSIP_SENDER_MAIN, 29636, "Spawn Reagent Vendor?", GuildHouseVendor, false); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 4: //objects / portals - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Forge", GOSSIP_SENDER_MAIN, 1685, "Add a forge?", GuildHouseObject, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Anvil", GOSSIP_SENDER_MAIN, 4087, "Add an Anvil?", GuildHouseObject, false); + ClearGossipMenuFor(player); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Forge", GOSSIP_SENDER_MAIN, 1685, "Add a forge?", GuildHouseObject, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Anvil", GOSSIP_SENDER_MAIN, 4087, "Add an Anvil?", GuildHouseObject, false); if (player->GetTeamId() == TEAM_ALLIANCE) { - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Stormwind", GOSSIP_SENDER_MAIN, 183325, "Add Stormwind Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Ironforge", GOSSIP_SENDER_MAIN, 183322, "Add Ironforge Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Darnassus", GOSSIP_SENDER_MAIN, 183317, "Add Darnassus Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Exodar", GOSSIP_SENDER_MAIN, 183321, "Add Exodar Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Stormwind", GOSSIP_SENDER_MAIN, 183325, "Add Stormwind Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Ironforge", GOSSIP_SENDER_MAIN, 183322, "Add Ironforge Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Darnassus", GOSSIP_SENDER_MAIN, 183317, "Add Darnassus Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Exodar", GOSSIP_SENDER_MAIN, 183321, "Add Exodar Portal?", GuildHousePortal, false); } else { - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Orgrimmar", GOSSIP_SENDER_MAIN, 183323, "Add Orgrimmar Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Undercity", GOSSIP_SENDER_MAIN, 183327, "Add Undercity Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 183326, "Add Thunderbuff Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 183324, "Add Silvermoon Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Orgrimmar", GOSSIP_SENDER_MAIN, 183323, "Add Orgrimmar Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Undercity", GOSSIP_SENDER_MAIN, 183327, "Add Undercity Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 183326, "Add Thunderbuff Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 183324, "Add Silvermoon Portal?", GuildHousePortal, false); } - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 191164, "Add Dalaran Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191013, "Add Shattrath Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 191164, "Add Dalaran Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191013, "Add Shattrath Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); + AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 6: // Auctioneer { @@ -117,28 +118,28 @@ class GuildHouseSpawner : public CreatureScript { break; } case 7: // spawn proffession trainers - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Alchemy Trainer", GOSSIP_SENDER_MAIN, 33608, "Spawn Alchemy Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Blacksmithing Trainer", GOSSIP_SENDER_MAIN, 33609, "Spawn Blacksmithing Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 33610, "Spawn Enchanting Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Engineering Trainer", GOSSIP_SENDER_MAIN, 33611, "Spawn Engineering Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Tailoring Trainer", GOSSIP_SENDER_MAIN, 33613, "Spawn Tailoring Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Leatherworking Trainer", GOSSIP_SENDER_MAIN, 33612, "Spawn Leatherworking Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Jewlelcrafing Trainer", GOSSIP_SENDER_MAIN, 33614, "Spawn Jewelcrafting Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 33615, "Spawn Inscription Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Skinning Trainer", GOSSIP_SENDER_MAIN, 33618, "Spawn Skinning Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Mining Trainer", GOSSIP_SENDER_MAIN, 33617, "Spawn Mining Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Herbalism Trainer", GOSSIP_SENDER_MAIN, 33616, "Spawn Herbalism Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + ClearGossipMenuFor(player); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Alchemy Trainer", GOSSIP_SENDER_MAIN, 33608, "Spawn Alchemy Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Blacksmithing Trainer", GOSSIP_SENDER_MAIN, 33609, "Spawn Blacksmithing Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 33610, "Spawn Enchanting Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Engineering Trainer", GOSSIP_SENDER_MAIN, 33611, "Spawn Engineering Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Tailoring Trainer", GOSSIP_SENDER_MAIN, 33613, "Spawn Tailoring Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Leatherworking Trainer", GOSSIP_SENDER_MAIN, 33612, "Spawn Leatherworking Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Jewlelcrafing Trainer", GOSSIP_SENDER_MAIN, 33614, "Spawn Jewelcrafting Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 33615, "Spawn Inscription Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Skinning Trainer", GOSSIP_SENDER_MAIN, 33618, "Spawn Skinning Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Mining Trainer", GOSSIP_SENDER_MAIN, 33617, "Spawn Mining Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Herbalism Trainer", GOSSIP_SENDER_MAIN, 33616, "Spawn Herbalism Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 8: // secondry proff trainers - player->PlayerTalkClass->ClearMenus(); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "First Aid Trainer", GOSSIP_SENDER_MAIN, 33621, "Spawn Fist Aid Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 33623, "Spawn Fishing Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 33619, "Spawn Cooking Trainer?", GuildHouseProff, false); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + ClearGossipMenuFor(player); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "First Aid Trainer", GOSSIP_SENDER_MAIN, 33621, "Spawn Fist Aid Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 33623, "Spawn Fishing Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 33619, "Spawn Cooking Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 9: // go back! OnGossipHello(player, m_creature); @@ -231,7 +232,7 @@ class GuildHouseSpawner : public CreatureScript { if (player->FindNearestCreature(entry, VISIBILITY_RANGE, true)) { ChatHandler(player->GetSession()).PSendSysMessage("You already have this creature!"); - player->CLOSE_GOSSIP_MENU(); + CloseGossipMenuFor(player); return; } @@ -276,7 +277,7 @@ class GuildHouseSpawner : public CreatureScript { sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid)); player->ModifyMoney(-cost); - player->CLOSE_GOSSIP_MENU(); + CloseGossipMenuFor(player); } void SpawnObject(uint32 entry, Player* player) @@ -304,7 +305,7 @@ class GuildHouseSpawner : public CreatureScript { if (player->FindNearestGameObject(entry, VISIBLE_RANGE)) { ChatHandler(player->GetSession()).PSendSysMessage("You already have this object!"); - player->CLOSE_GOSSIP_MENU(); + CloseGossipMenuFor(player); return; } @@ -346,7 +347,8 @@ class GuildHouseSpawner : public CreatureScript { // TODO: is it really necessary to add both the real and DB table guid here ? sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); player->ModifyMoney(-cost); - player->CLOSE_GOSSIP_MENU(); + CloseGossipMenuFor(player); + CloseGossipMenuFor(player); } }; From e62b7b524863e0a2740605c69f5caa8223bd7985 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 9 Oct 2019 11:11:45 -0700 Subject: [PATCH 27/63] differentiate between horde/alliance shattrath portal and updated phasing code --- sql/world/guild_house_spawns.sql | 7 ++++--- src/mod_guild_house_npc.cpp | 6 ++++-- src/mod_guild_house_v2.cpp | 15 ++++++++++++++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index 19d392f..c9e33eb 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `guild_house_spawns` ( UNIQUE KEY `entry` (`entry`) ) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8; --- Dumping data for table acore_world.guild_house_spawns: ~29 rows (approximately) +-- Dumping data for table acore_world.guild_house_spawns: ~48 rows (approximately) /*!40000 ALTER TABLE `guild_house_spawns` DISABLE KEYS */; REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orientation`, `comment`) VALUES (1, 26327, 16216.5, 16279.4, 20.9306, 0.552869, 'Paladin Trainer'), @@ -93,8 +93,9 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), (50, 6491, 16319.937, 16242.404, 24.4747, 2.206830, 'Spirit Healer'), (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'), - (52, 191013, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object)'), - (53, 29636, 16233.5, 16316.1, 20.8455, 3.07558, 'Reagent Vendor'); + (52, 191013, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Alliance'), + (53, 29636, 16233.5, 16316.1, 20.8455, 3.07558, 'Reagent Vendor'), + (54, 191014, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Horde'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index c33fe79..a1acb9c 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -94,6 +94,7 @@ class GuildHouseSpawner : public CreatureScript { player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Ironforge", GOSSIP_SENDER_MAIN, 183322, "Add Ironforge Portal?", GuildHousePortal, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Darnassus", GOSSIP_SENDER_MAIN, 183317, "Add Darnassus Portal?", GuildHousePortal, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Exodar", GOSSIP_SENDER_MAIN, 183321, "Add Exodar Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191013, "Add Shattrath Portal?", GuildHousePortal, false); } else { @@ -101,9 +102,9 @@ class GuildHouseSpawner : public CreatureScript { player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Undercity", GOSSIP_SENDER_MAIN, 183327, "Add Undercity Portal?", GuildHousePortal, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 183326, "Add Thunderbuff Portal?", GuildHousePortal, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 183324, "Add Silvermoon Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191014, "Add Shattrath Portal?", GuildHousePortal, false); } player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 191164, "Add Dalaran Portal?", GuildHousePortal, false); - player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191013, "Add Shattrath Portal?", GuildHousePortal, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); @@ -218,7 +219,8 @@ class GuildHouseSpawner : public CreatureScript { case 183324: // Silvermoon Portal case 183321: // Exodar Portal case 191164: // Dalaran Portal - case 191013: // Shattrath Portal + case 191013: // Shattrath Portal:Alliance + case 191014: // Shattrath Portal:Horde cost = GuildHousePortal; SpawnObject(action, player); break; diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index d4e5a6c..8613a8e 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -197,7 +197,8 @@ class GuildHouseV2PlayerScript : public PlayerScript else player->SetPhaseMask(GetNormalPhase(player), true); } - +/* + // WIP - Anhanga, per Stoabrogga suggestion uint32 GetNormalPhase(Player* player) const { if (player->IsGameMaster()) @@ -212,6 +213,18 @@ class GuildHouseV2PlayerScript : public PlayerScript return PHASEMASK_NORMAL; } +*/ + uint32 GetNormalPhase(Player* player) const + { + if (player->IsGameMaster()) + return PHASEMASK_ANYWHERE; + + uint32 phase = player->GetPhaseByAuras(); + if (!phase) + return PHASEMASK_NORMAL; + else + return phase; + } void CheckPlayer(Player* player) { From 37136bfbf781912b5aff85bc001129569aa97748 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 9 Oct 2019 11:24:10 -0700 Subject: [PATCH 28/63] changing functions per travis warning --- src/mod_guild_house_npc.cpp | 2 +- src/mod_guild_house_v2.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index a1acb9c..ed7fdfe 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -55,7 +55,7 @@ class GuildHouseSpawner : public CreatureScript { return true; } - bool OnGossipSelect(Player *player, Creature * m_creature, uint32 sender, uint32 action) + bool OnGossipSelect(Player *player, Creature * m_creature, uint32, uint32 action) { switch (action) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 8613a8e..c57344e 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -30,7 +30,7 @@ class GuildHelper : public GuildScript{ GuildHelper() : GuildScript("GuildHelper") { } - void OnCreate(Guild* guild, Player* leader, const std::string& name) + void OnCreate(Guild*, Player* leader, const std::string& name) { ChatHandler(leader->GetSession()).PSendSysMessage("You now own a guild. You can purchase a guild house!"); } @@ -73,7 +73,7 @@ class GuildHouseSeller : public CreatureScript { return true; } - bool OnGossipSelect(Player *player, Creature * m_creature, uint32 sender, uint32 action) + bool OnGossipSelect(Player *player, Creature * m_creature, uint32, uint32 action) { uint32 map; float posX; From e33a295550ca15d20f888034447299dd1354af8a Mon Sep 17 00:00:00 2001 From: WiZZy Date: Wed, 9 Oct 2019 21:52:23 +0300 Subject: [PATCH 29/63] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 39dccf2..425d4d6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ - +# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore +- Latest build status with azerothcore: [![Build Status](https://travis-ci.org/wizzymore/mod-guildhouse.svg?branch=master)](https://travis-ci.org/wizzymore/mod-guildhouse) # Guild House Module From 045b17cf5caff065c2b1b9214b193d7013774690 Mon Sep 17 00:00:00 2001 From: WiZZy Date: Wed, 9 Oct 2019 22:04:52 +0300 Subject: [PATCH 30/63] Update mod_guild_house_v2.cpp --- src/mod_guild_house_v2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index ed8996b..7ea2039 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -64,7 +64,7 @@ class GuildHouseSeller : public CreatureScript { { // Only leader of the guild can buy / sell guild house AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Buy Guild House!", GOSSIP_SENDER_MAIN, 2); - AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", NULL, false); + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", 0, false); } AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); From 83945506bd738a3d0bc6ef97530c5cd080cd7246 Mon Sep 17 00:00:00 2001 From: WiZZy Date: Wed, 9 Oct 2019 22:05:13 +0300 Subject: [PATCH 31/63] Update mod_guild_house_npc.cpp --- src/mod_guild_house_npc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 3070864..f27905a 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -357,7 +357,7 @@ class GuildHouseNPCConf : public WorldScript public: GuildHouseNPCConf() : WorldScript("GuildHouseNPCConf") {} - void OnBeforeConfigLoad(bool reload) override + void OnBeforeConfigLoad(bool /*reload*/) override { GuildHouseInnKeeper = sConfigMgr->GetIntDefault("GuildHouseInnKeeper", 1000000); GuildHouseBank = sConfigMgr->GetIntDefault("GuildHouseBank", 1000000); From 85f75b130bfc53d37457f8e99c001b30b9d00fe0 Mon Sep 17 00:00:00 2001 From: Cristian Bilu Date: Thu, 10 Oct 2019 00:54:06 +0300 Subject: [PATCH 32/63] Revert to AC --- .gitignore | 5 - .travis.yml | 76 -------------- README.md | 36 +++---- conf/mod_guild_house_v2.conf.dist | 11 -- sql/world/Creatures.sql | 7 +- sql/world/guild_house_spawns.sql | 9 +- src/mod_guild_house_npc.cpp | 166 ++++++++++++++---------------- src/mod_guild_house_v2.cpp | 44 +++----- 8 files changed, 110 insertions(+), 244 deletions(-) delete mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index ade4c67..c6e1299 100644 --- a/.gitignore +++ b/.gitignore @@ -46,8 +46,3 @@ local.properties .loadpath .project .cproject - -# -# Config file -# -conf/mod_guild_house_v2.conf diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 848d188..0000000 --- a/.travis.yml +++ /dev/null @@ -1,76 +0,0 @@ -sudo: required -dist: bionic # (18.04) - -language: cpp - -cache: ccache - -addons: - apt: - update: true - -services: - - mysql - -git: - depth: 10 - -stages: - - prepare_cache - - run - -jobs: - include: - - stage: prepare_cache - env: TRAVIS_BUILD_ID="1" - before_install: - - cd .. - - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk - - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules - - cd azerothcore-wotlk - - source ./apps/ci/ci-before_install.sh - install: - - source ./apps/ci/ci-install.sh OFF - script: - - source ./apps/ci/ci-compile.sh - - - stage: run - env: TRAVIS_BUILD_ID="1" - before_install: - - cd .. - - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk - - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules - - cd azerothcore-wotlk - - source ./apps/ci/ci-before_install.sh - install: - - source ./apps/ci/ci-install.sh ON - - source ./apps/ci/ci-import-db.sh - script: - - source ./apps/ci/ci-compile.sh - - source ./apps/ci/ci-worldserver-dry-run.sh - - - stage: prepare_cache - env: TRAVIS_BUILD_ID="2" - before_install: - - cd .. - - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk - - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules - - cd azerothcore-wotlk - - source ./apps/ci/ci-before_install.sh - install: - - source ./apps/ci/ci-install.sh OFF - script: - - source ./apps/ci/ci-compile.sh - - - stage: run - env: TRAVIS_BUILD_ID="2" - before_install: - - cd .. - - git clone --depth=1 --branch=master https://github.com/azerothcore/azerothcore-wotlk.git azerothcore-wotlk - - mv "$TRAVIS_BUILD_DIR" azerothcore-wotlk/modules - - cd azerothcore-wotlk - - source ./apps/ci/ci-before_install.sh - install: - - source ./apps/ci/ci-install.sh ON - script: - - source ./apps/ci/ci-compile.sh diff --git a/README.md b/README.md index 425d4d6..e297534 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,23 @@ -# ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore -- Latest build status with azerothcore: [![Build Status](https://travis-ci.org/wizzymore/mod-guildhouse.svg?branch=master)](https://travis-ci.org/wizzymore/mod-guildhouse) + # Guild House Module ## Description -This is a phased guild house system for Azerothcore, it allows players to from the same guild to visit their guild house. -All guilds will get their own phasing system which then the guild master will have to purchase NPC's creatures and other stuff to complete the creation. - -### Purchasables +This is a phased guild house system for Azerothcore, it allows players to from the same guild to visit their guild house to explore, train ect +All guilds will get their own phasing system which then the guild master will have to purchase NPC's creatures and other stuff to complete the creation. -* Class Trainers (all available in Wrath) -* Primary Profession Trainers (all available in Wrath) -* Secondary Profession Trainers (all available in Wrath) -* Vendors: Reagents, Food & Water and Trade Goods -* Portals to Neutral, Horde and Alliance cities -* Spirit Healer -* Guild Bank and Personal Bank access -* Auctioneer ## How to use ingame -1) As GM: .npc add 70101 -> somewhere public and accessible by other players. -2) Purchase a guild house from the added NPC, then either teleport to the guildhouse via the NPC or chat: `.guildhouse tele` -3) Once the player is in the location of the guild house the guild master has a command .guildhouse spawnnpc this will load the Guild House Assistant. -4) Speak with the Guild House Assistant to begin purchasing objects. +Once a player has brought a guild house from the NPC they can either teleport to the guildhouse by via the NPC or do .guildhouse tele + +Once the player is in the location of the guild house the guild master has a command .guildhouse spawnnpc this will allow the guild master +to start placing objects / npc within the guild house. ## Requirements +My new module requires: + - AzerothCore v1.0.1+ ## Installation @@ -37,9 +28,9 @@ All guilds will get their own phasing system which then the guild master will ha 3) Apply the guildhouse.patch to your source 4) Re-run cmake and launch a clean build of AzerothCore. ``` -## Patch Information (guildhouse.patch) +## Patch Information -The patch basically turns the selected area from a bitmask to a uint, this fixes the issues with the phasing +The patch basicly turns the selected area from a bitmask to a uint, this fixes the issues with the phasing Before Patch : Guild 1 Can see phase 1 @@ -55,8 +46,7 @@ If you need to change the module configuration, go to your server configuration ## Credits -* [Talamortis](https://github.com/talamortis) (Original author of the module) +* [Me](https://github.com/talamortis) (author of the module) * [Rochet2](https://github.com/Rochet2/): Thanks for the help with the phasing situation & General support -* [Anhanga](https://github.com/rbedfordpro) -AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/64FH6Y8) +AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/PaqQRkd) diff --git a/conf/mod_guild_house_v2.conf.dist b/conf/mod_guild_house_v2.conf.dist index c64f4c8..ad51f3a 100644 --- a/conf/mod_guild_house_v2.conf.dist +++ b/conf/mod_guild_house_v2.conf.dist @@ -76,14 +76,3 @@ GuildHouseProff = 500000 # default = 100000 (10g) # GuildHouseSpirit = 100000 - -# GuildHouseBuyRank -# -# Minimum GuildRank able to make purchases in guild house -# default = 0 (Guild Master) -# GR_GUILDMASTER = 0 -# GR_OFFICER = 1 -# GR_VETERAN = 2 ... etc -# -GuildHouseBuyRank = 0 - diff --git a/sql/world/Creatures.sql b/sql/world/Creatures.sql index 212e367..8af7b11 100644 --- a/sql/world/Creatures.sql +++ b/sql/world/Creatures.sql @@ -1,4 +1,5 @@ -REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Xrispins', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), -(18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Angela', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), +REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), +(18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Monica', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), (33251, 0, 0, 0, 0, 0, 28516, 0, 0, 0, 'Death Knight Trainer', '', '', 9691, 80, 80, 2, 35, 51, 1, 1.14286, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 32768, 2048, 0, 0, 0, 0, 6, 0, 345, 509, 103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 10, 1, 1, 0, 0, 1, 8388624, 0, '', 12340), -(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Rapidomuerte', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); +(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Speedfang', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); + diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index c9e33eb..4128944 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `guild_house_spawns` ( UNIQUE KEY `entry` (`entry`) ) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8; --- Dumping data for table acore_world.guild_house_spawns: ~48 rows (approximately) +-- Dumping data for table acore_world.guild_house_spawns: ~29 rows (approximately) /*!40000 ALTER TABLE `guild_house_spawns` DISABLE KEYS */; REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orientation`, `comment`) VALUES (1, 26327, 16216.5, 16279.4, 20.9306, 0.552869, 'Paladin Trainer'), @@ -86,16 +86,13 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (41, 183326, 16202.1, 16223.1, 1.03401, 0.829316, 'Portal: Thunder Bluff (Object)'), (42, 183324, 16196.8, 16227.5, 1.37206, 0.762557, 'Portal: Silvermoon (Object)'), (43, 183321, 16196.8, 16227.5, 1.37206, 0.762557, 'Portal: Exodar (Object)'), - (44, 191164, 16207, 16216, 1.10669, 1.0453, 'Portal: Dalaran (Object)'), + (44, 191164, 16206, 16216, 1.10669, 1.0453, 'Portal: Dalaran (Object)'), (45, 187293, 16230.5, 16283.5, 13.9061, 3, 'Guild Vault (Object)'), (46, 28692, 16230.2, 16316.4, 20.8455, 6.25643, 'Trade Supplies'), (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), (50, 6491, 16319.937, 16242.404, 24.4747, 2.206830, 'Spirit Healer'), - (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'), - (52, 191013, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Alliance'), - (53, 29636, 16233.5, 16316.1, 20.8455, 3.07558, 'Reagent Vendor'), - (54, 191014, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Horde'); + (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 673b96d..5bb33ec 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -1,7 +1,5 @@ #include "ScriptMgr.h" #include "Player.h" -#include "Chat.h" -#include "ScriptedGossip.h" #include "Configuration/Config.h" #include "Creature.h" #include "Guild.h" @@ -11,9 +9,8 @@ #include "DataMap.h" #include "GameObject.h" #include "Transport.h" -#include "CreatureAI.h" -int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff, GuildHouseBuyRank; +int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff; class GuildHouseSpawner : public CreatureScript { @@ -25,13 +22,9 @@ class GuildHouseSpawner : public CreatureScript { if (player->GetGuild()) { - // WIP - Anhanga - Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()); - Guild::Member const* memberMe = guild->GetMember(player->GetGUID()); - if (memberMe->IsRankNotLower(GuildHouseBuyRank)) - //if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) + if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { - ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases (RankId: %hhu | %d).", memberMe->GetRankId(), GuildHouseBuyRank); + ChatHandler(player->GetSession()).PSendSysMessage("You are not the guild leader, sorry i cant do business with you"); return false; } } @@ -41,74 +34,72 @@ class GuildHouseSpawner : public CreatureScript { return false; } - ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 18649, "Add an Innkeeper?", GuildHouseInnKeeper, false); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Mailbox", GOSSIP_SENDER_MAIN, 184137, "Spawn a mailbox?", GuildHouseMailBox, false); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Class Trainer", GOSSIP_SENDER_MAIN, 2); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Vendor", GOSSIP_SENDER_MAIN, 3); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn City Portals / Objects", GOSSIP_SENDER_MAIN, 4); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Spawn Bank", GOSSIP_SENDER_MAIN, 30605, "Spawn a banker?", GuildHouseBank, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn an auctioneer", GuildHouseAuctioneer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Spawn Secondry Profession Trainers", GOSSIP_SENDER_MAIN, 8); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn a Spirit Healer?", GuildHouseSpirit, false); - SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 18649, "Add a Innkeeper?", GuildHouseInnKeeper, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Mailbox", GOSSIP_SENDER_MAIN, 184137, "Spawn a mailbox?", GuildHouseMailBox, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn Class Trainer", GOSSIP_SENDER_MAIN, 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn Vendor", GOSSIP_SENDER_MAIN, 3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TALK, "Spawn City Portals / Objects", GOSSIP_SENDER_MAIN, 4); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Bank", GOSSIP_SENDER_MAIN, 30605, "Spawn banker?", GuildHouseBank, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Spawn Auctioneer", GOSSIP_SENDER_MAIN, 6, "Spawn auctioneer", GuildHouseAuctioneer, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, "Spawn Secondry Profession Trainers", GOSSIP_SENDER_MAIN, 8); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Spawn Sprirt Healer", GOSSIP_SENDER_MAIN, 6491, "Spawn Spirit Healer?", GuildHouseSpirit, false); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } - bool OnGossipSelect(Player *player, Creature * m_creature, uint32, uint32 action) + bool OnGossipSelect(Player *player, Creature * m_creature, uint32 sender, uint32 action) { switch (action) { case 2: // spawn class trainer - ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Death Knight", GOSSIP_SENDER_MAIN, 33251, "Spawn Death Knight Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Druid", GOSSIP_SENDER_MAIN, 26324, "Spawn Druid Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Hunter", GOSSIP_SENDER_MAIN, 26325, "Spawn Hunter Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Mage", GOSSIP_SENDER_MAIN, 26326, "Spawn Mage Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Paladin", GOSSIP_SENDER_MAIN, 26327, "Spawn Paladin Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Priest", GOSSIP_SENDER_MAIN, 26328, "Spawn Priest Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Rogue", GOSSIP_SENDER_MAIN, 26329, "Spawn Rogue Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Shaman", GOSSIP_SENDER_MAIN, 26330, "Spawn Shaman Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Warlock", GOSSIP_SENDER_MAIN, 26331, "Spawn Warlock Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Warrior", GOSSIP_SENDER_MAIN, 26332, "Spawn Warrior Trainer?", GuildHouseTrainer, false); - AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Death Knight", GOSSIP_SENDER_MAIN, 33251, "Spawn Death Knight Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Druid", GOSSIP_SENDER_MAIN, 26324, "Spawn Druid Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Hunter", GOSSIP_SENDER_MAIN, 26325, "Spawn Hunter Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Mage", GOSSIP_SENDER_MAIN, 26326, "Spawn Mage Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Paladin", GOSSIP_SENDER_MAIN, 26327, "Spawn Paladin Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Priest", GOSSIP_SENDER_MAIN, 26328, "Spawn Priest Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Rogue", GOSSIP_SENDER_MAIN, 26329, "Spawn Rogue Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Shaman", GOSSIP_SENDER_MAIN, 26330, "Spawn Shaman Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Warlock", GOSSIP_SENDER_MAIN, 26331, "Spawn Warlock Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Warrior", GOSSIP_SENDER_MAIN, 26332, "Spawn Warrior Trainer?", GuildHouseTrainer, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 3: // Vendors - ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Trade Supplies", GOSSIP_SENDER_MAIN, 28692, "Spawn Trade Supplies?", GuildHouseVendor, false); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Tabard Vendor", GOSSIP_SENDER_MAIN, 28776, "Spawn Tabard Vendor?", GuildHouseVendor, false); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Food & Drink", GOSSIP_SENDER_MAIN, 29715, "Spawn Food & Drink?", GuildHouseVendor, false); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Reagent Vendor", GOSSIP_SENDER_MAIN, 29636, "Spawn Reagent Vendor?", GuildHouseVendor, false); - AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Trade Supplies", GOSSIP_SENDER_MAIN, 28692, "Spawn Trade Supplies?", GuildHouseVendor, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Tabard Vendor", GOSSIP_SENDER_MAIN, 28776, "Spawn Tabard Vendor?", GuildHouseVendor, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Food & Drink", GOSSIP_SENDER_MAIN, 29715, "Spawn Food & Drink?", GuildHouseVendor, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 4: //objects / portals - ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Forge", GOSSIP_SENDER_MAIN, 1685, "Add a forge?", GuildHouseObject, false); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Anvil", GOSSIP_SENDER_MAIN, 4087, "Add an Anvil?", GuildHouseObject, false); + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Forge", GOSSIP_SENDER_MAIN, 1685, "Add a forge?", GuildHouseObject, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TALK, "Anvil", GOSSIP_SENDER_MAIN, 4087, "Add a Anvil?", GuildHouseObject, false); if (player->GetTeamId() == TEAM_ALLIANCE) { - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Stormwind", GOSSIP_SENDER_MAIN, 183325, "Add Stormwind Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Ironforge", GOSSIP_SENDER_MAIN, 183322, "Add Ironforge Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Darnassus", GOSSIP_SENDER_MAIN, 183317, "Add Darnassus Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Exodar", GOSSIP_SENDER_MAIN, 183321, "Add Exodar Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Stormwind", GOSSIP_SENDER_MAIN, 183325, "Add Stormwind Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Ironforge", GOSSIP_SENDER_MAIN, 183322, "Add Ironforge Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Darnassus", GOSSIP_SENDER_MAIN, 183317, "Add Darnassus Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Exodar", GOSSIP_SENDER_MAIN, 183321, "Add Exodar Portal?", GuildHousePortal, false); } else { - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Orgrimmar", GOSSIP_SENDER_MAIN, 183323, "Add Orgrimmar Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Undercity", GOSSIP_SENDER_MAIN, 183327, "Add Undercity Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 183326, "Add Thunderbuff Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 183324, "Add Silvermoon Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Orgrimmar", GOSSIP_SENDER_MAIN, 183323, "Add Orgrimmar Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Undercity", GOSSIP_SENDER_MAIN, 183327, "Add Undercity Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 183326, "Add Thunderbuff Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 183324, "Add Silvermoon Portal?", GuildHousePortal, false); } - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 191164, "Add Dalaran Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191013, "Add Shattrath Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); - AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); - AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 191164, "Add Dalaran Portal?", GuildHousePortal, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 6: // Auctioneer { @@ -118,28 +109,28 @@ class GuildHouseSpawner : public CreatureScript { break; } case 7: // spawn proffession trainers - ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Alchemy Trainer", GOSSIP_SENDER_MAIN, 33608, "Spawn Alchemy Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Blacksmithing Trainer", GOSSIP_SENDER_MAIN, 33609, "Spawn Blacksmithing Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 33610, "Spawn Enchanting Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Engineering Trainer", GOSSIP_SENDER_MAIN, 33611, "Spawn Engineering Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Tailoring Trainer", GOSSIP_SENDER_MAIN, 33613, "Spawn Tailoring Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Leatherworking Trainer", GOSSIP_SENDER_MAIN, 33612, "Spawn Leatherworking Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Jewlelcrafing Trainer", GOSSIP_SENDER_MAIN, 33614, "Spawn Jewelcrafting Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 33615, "Spawn Inscription Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Skinning Trainer", GOSSIP_SENDER_MAIN, 33618, "Spawn Skinning Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Mining Trainer", GOSSIP_SENDER_MAIN, 33617, "Spawn Mining Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Herbalism Trainer", GOSSIP_SENDER_MAIN, 33616, "Spawn Herbalism Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Alchemy Trainer", GOSSIP_SENDER_MAIN, 33608, "Spawn Alchemy Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Blacksmithing Trainer", GOSSIP_SENDER_MAIN, 33609, "Spawn Blacksmithing Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 33610, "Spawn Enchanting Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Engineering Trainer", GOSSIP_SENDER_MAIN, 33611, "Spawn Engineering Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Tailoring Trainer", GOSSIP_SENDER_MAIN, 33613, "Spawn Tailoring Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Leatherworking Trainer", GOSSIP_SENDER_MAIN, 33612, "Spawn Leatherworking Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Jewlelcrafing Trainer", GOSSIP_SENDER_MAIN, 33614, "Spawn Jewelcrafting Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 33615, "Spawn Inscription Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Skinning Trainer", GOSSIP_SENDER_MAIN, 33618, "Spawn Skinning Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Mining Trainer", GOSSIP_SENDER_MAIN, 33617, "Spawn Mining Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TRAINER, "Herbalism Trainer", GOSSIP_SENDER_MAIN, 33616, "Spawn Herbalism Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 8: // secondry proff trainers - ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "First Aid Trainer", GOSSIP_SENDER_MAIN, 33621, "Spawn Fist Aid Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 33623, "Spawn Fishing Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 33619, "Spawn Cooking Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); - SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "First Aid Trainer", GOSSIP_SENDER_MAIN, 33621, "Spawn Fist Aid Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 33623, "Spawn Fishing Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 33619, "Spawn Cooking Trainer?", GuildHouseProff, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; case 9: // go back! OnGossipHello(player, m_creature); @@ -188,7 +179,6 @@ class GuildHouseSpawner : public CreatureScript { case 28692: // Trade supplies case 28776: // Tabard Vendor case 29715: // Food & Drink - case 29636: // Reagent Vendor cost = GuildHouseProff; SpawnNPC(action, player); break; @@ -219,8 +209,6 @@ class GuildHouseSpawner : public CreatureScript { case 183324: // Silvermoon Portal case 183321: // Exodar Portal case 191164: // Dalaran Portal - case 191013: // Shattrath Portal:Alliance - case 191014: // Shattrath Portal:Horde cost = GuildHousePortal; SpawnObject(action, player); break; @@ -233,7 +221,7 @@ class GuildHouseSpawner : public CreatureScript { if (player->FindNearestCreature(entry, VISIBILITY_RANGE, true)) { ChatHandler(player->GetSession()).PSendSysMessage("You already have this creature!"); - CloseGossipMenuFor(player); + player->CLOSE_GOSSIP_MENU(); return; } @@ -278,7 +266,7 @@ class GuildHouseSpawner : public CreatureScript { sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid)); player->ModifyMoney(-cost); - CloseGossipMenuFor(player); + player->CLOSE_GOSSIP_MENU(); } void SpawnObject(uint32 entry, Player* player) @@ -306,7 +294,7 @@ class GuildHouseSpawner : public CreatureScript { if (player->FindNearestGameObject(entry, VISIBLE_RANGE)) { ChatHandler(player->GetSession()).PSendSysMessage("You already have this object!"); - CloseGossipMenuFor(player); + player->CLOSE_GOSSIP_MENU(); return; } @@ -348,8 +336,7 @@ class GuildHouseSpawner : public CreatureScript { // TODO: is it really necessary to add both the real and DB table guid here ? sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); player->ModifyMoney(-cost); - CloseGossipMenuFor(player); - CloseGossipMenuFor(player); + player->CLOSE_GOSSIP_MENU(); } }; @@ -358,7 +345,7 @@ class GuildHouseNPCConf : public WorldScript public: GuildHouseNPCConf() : WorldScript("GuildHouseNPCConf") {} - void OnBeforeConfigLoad(bool /*reload*/) override + void OnBeforeConfigLoad(bool reload) override { GuildHouseInnKeeper = sConfigMgr->GetIntDefault("GuildHouseInnKeeper", 1000000); GuildHouseBank = sConfigMgr->GetIntDefault("GuildHouseBank", 1000000); @@ -370,7 +357,6 @@ class GuildHouseNPCConf : public WorldScript GuildHousePortal = sConfigMgr->GetIntDefault("GuildHousePortal", 500000); GuildHouseProff = sConfigMgr->GetIntDefault("GuildHouseProff", 500000); GuildHouseSpirit = sConfigMgr->GetIntDefault("GuildHouseSpirit", 100000); - GuildHouseBuyRank = sConfigMgr->GetIntDefault("GuildHouseBuyRank", 0); } }; diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 0a1ac76..86b45f9 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -3,9 +3,6 @@ #include "Configuration/Config.h" #include "Creature.h" #include "Guild.h" -#include "SpellAuraEffects.h" -#include "Chat.h" -#include "ScriptedGossip.h" #include "GuildMgr.h" #include "Define.h" #include "GossipDef.h" @@ -30,7 +27,7 @@ class GuildHelper : public GuildScript{ GuildHelper() : GuildScript("GuildHelper") { } - void OnCreate(Guild*, Player* leader, const std::string&) + void OnCreate(Guild* guild, Player* leader, const std::string& name) { ChatHandler(leader->GetSession()).PSendSysMessage("You now own a guild. You can purchase a guild house!"); } @@ -63,17 +60,17 @@ class GuildHouseSeller : public CreatureScript { if (player->GetGuild()->GetLeaderGUID() == player->GetGUID()) { // Only leader of the guild can buy / sell guild house - AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Buy Guild House!", GOSSIP_SENDER_MAIN, 2); - AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", 0, false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "Buy Guild House!", GOSSIP_SENDER_MAIN, 2); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", NULL, false); } - AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); - AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Close", GOSSIP_SENDER_MAIN, 5); - SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Close", GOSSIP_SENDER_MAIN, 5); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } - bool OnGossipSelect(Player *player, Creature * m_creature, uint32, uint32 action) + bool OnGossipSelect(Player *player, Creature * m_creature, uint32 sender, uint32 action) { uint32 map; float posX; @@ -89,7 +86,7 @@ class GuildHouseSeller : public CreatureScript { posZ = 13.257628f; break; case 5: // close - CloseGossipMenuFor(player); + player->CLOSE_GOSSIP_MENU(); break; case 3: // Sell back guild house { @@ -139,14 +136,14 @@ class GuildHouseSeller : public CreatureScript { if (result) { ChatHandler(player->GetSession()).PSendSysMessage("You cant buy any more guilds houses!"); - CloseGossipMenuFor(player); + player->CLOSE_GOSSIP_MENU(); return false; } - ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "GM Island", GOSSIP_SENDER_MAIN, 100, "Buy GM island Guildhouse?", sConfigMgr->GetIntDefault("CostGuildHouse", 10000000), false); - AddGossipItemFor(player, GOSSIP_ICON_CHAT, " ----- More to Come ----", GOSSIP_SENDER_MAIN, 4); - SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); + player->PlayerTalkClass->ClearMenus(); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_MONEY_BAG, "GM Island", GOSSIP_SENDER_MAIN, 100, "Buy GM island Guildhouse?", sConfigMgr->GetIntDefault("CostGuildHouse", 10000000), false); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, " ----- More to Come ----", GOSSIP_SENDER_MAIN, 4); + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; } @@ -197,8 +194,7 @@ class GuildHouseV2PlayerScript : public PlayerScript else player->SetPhaseMask(GetNormalPhase(player), true); } -/* - // WIP - Anhanga, per Stoabrogga suggestion + uint32 GetNormalPhase(Player* player) const { if (player->IsGameMaster()) @@ -213,18 +209,6 @@ class GuildHouseV2PlayerScript : public PlayerScript return PHASEMASK_NORMAL; } -*/ - uint32 GetNormalPhase(Player* player) const - { - if (player->IsGameMaster()) - return PHASEMASK_ANYWHERE; - - uint32 phase = player->GetPhaseByAuras(); - if (!phase) - return PHASEMASK_NORMAL; - else - return phase; - } void CheckPlayer(Player* player) { From 5421b789a54c1adc1ba03e9eca60b8c4b68a4c71 Mon Sep 17 00:00:00 2001 From: WiZZy Date: Thu, 10 Oct 2019 00:59:56 +0300 Subject: [PATCH 33/63] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 425d4d6..023bf8e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # ![logo](https://raw.githubusercontent.com/azerothcore/azerothcore.github.io/master/images/logo-github.png) AzerothCore -- Latest build status with azerothcore: [![Build Status](https://travis-ci.org/wizzymore/mod-guildhouse.svg?branch=master)](https://travis-ci.org/wizzymore/mod-guildhouse) +- Latest build status with azerothcore: [![Build Status](https://travis-ci.org/azerothcore/mod-guildhouse.svg?branch=master)](https://travis-ci.org/azerothcore/mod-guildhouse) # Guild House Module From e9852101268db1bfcbecce3fd9e1059f05fe5f49 Mon Sep 17 00:00:00 2001 From: Cristian Bilu Date: Thu, 10 Oct 2019 01:58:49 +0300 Subject: [PATCH 34/63] Rank update --- conf/mod_guild_house_v2.conf.dist | 4 +++- src/mod_guild_house_npc.cpp | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/mod_guild_house_v2.conf.dist b/conf/mod_guild_house_v2.conf.dist index c64f4c8..aa5df0b 100644 --- a/conf/mod_guild_house_v2.conf.dist +++ b/conf/mod_guild_house_v2.conf.dist @@ -83,7 +83,9 @@ GuildHouseSpirit = 100000 # default = 0 (Guild Master) # GR_GUILDMASTER = 0 # GR_OFFICER = 1 -# GR_VETERAN = 2 ... etc +# GR_VETERAN = 2 +# GR_MEMBER = 3 +# GR_INITIATE = 4 # GuildHouseBuyRank = 0 diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 673b96d..3538e49 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -28,10 +28,9 @@ class GuildHouseSpawner : public CreatureScript { // WIP - Anhanga Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()); Guild::Member const* memberMe = guild->GetMember(player->GetGUID()); - if (memberMe->IsRankNotLower(GuildHouseBuyRank)) - //if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) + if (!memberMe->IsRankNotLower(GuildHouseBuyRank)) { - ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases (RankId: %hhu | %d).", memberMe->GetRankId(), GuildHouseBuyRank); + ChatHandler(player->GetSession()).PSendSysMessage("You are not authorized to make guild house purchases."); return false; } } From 3f16f26b5ebd21da6071bd54331a4dbcad506c04 Mon Sep 17 00:00:00 2001 From: Cristian Bilu Date: Thu, 10 Oct 2019 03:16:34 +0300 Subject: [PATCH 35/63] Fix phasing from deleting npc's and more --- src/mod_guild_house_npc.cpp | 3 +- src/mod_guild_house_v2.cpp | 166 ++++++++++++++++++++++++++++++------ 2 files changed, 143 insertions(+), 26 deletions(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 3538e49..11d8241 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -348,8 +348,7 @@ class GuildHouseSpawner : public CreatureScript { sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); player->ModifyMoney(-cost); CloseGossipMenuFor(player); - CloseGossipMenuFor(player); - } + } }; class GuildHouseNPCConf : public WorldScript diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 0a1ac76..4bebea7 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -37,7 +37,7 @@ class GuildHelper : public GuildScript{ void OnGuildDisband(Guild* guild) { - if (guild->GetId() != 1) + if (guild->GetId() > 2) { WorldDatabase.PQuery("DELETE FROM `creature` WHERE map = 1 AND phaseMask = %u", guild->GetId()); WorldDatabase.PQuery("DELETE FROM `gameobject WHERE map = 1 and phaseMask = %u", guild->GetId()); @@ -56,7 +56,8 @@ class GuildHouseSeller : public CreatureScript { { if (!player->GetGuild()) { - ChatHandler(player->GetSession()).PSendSysMessage("You are not in a guild"); + ChatHandler(player->GetSession()).PSendSysMessage("You are not a member of a guild."); + CloseGossipMenuFor(player); return false; } @@ -91,19 +92,23 @@ class GuildHouseSeller : public CreatureScript { case 5: // close CloseGossipMenuFor(player); break; + case 4: // --- MORE TO COME --- + BuyGuildHouse(player->GetGuild(), player, m_creature); + break; case 3: // Sell back guild house { QueryResult result = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); if (!result) { - ChatHandler(player->GetSession()).PSendSysMessage("You do not have a active Guild house!"); + ChatHandler(player->GetSession()).PSendSysMessage("Your guild currently doesn't own a Guild House!"); + CloseGossipMenuFor(player); return false; } CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); - if (player->GetGuildId() != 1) + if (player->GetGuildId() > 2) { WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = %u", player->GetGuildId()); WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = %u", player->GetGuildId()); @@ -112,6 +117,8 @@ class GuildHouseSeller : public CreatureScript { ChatHandler(player->GetSession()).PSendSysMessage("You have successfully sold your guild house"); player->ModifyMoney(+(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000) / 2)); + CloseGossipMenuFor(player); + break; } case 2: // buy guild house @@ -127,24 +134,117 @@ class GuildHouseSeller : public CreatureScript { CharacterDatabase.PQuery("INSERT INTO `guild_house` (guild, phase, map, positionX, positionY, positionZ) VALUES (%u, %u, %u, %f, %f, %f)", player->GetGuildId(), player->GetGuildId(), map, posX, posY, posZ); player->ModifyMoney(-(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000))); ChatHandler(player->GetSession()).PSendSysMessage("You have successfully purchased a guild house"); - player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We have now got a guild house", LANG_UNIVERSAL); + player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We now got a Guild House!", LANG_UNIVERSAL); + player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "Let's celebrate! Drinks on me.", LANG_UNIVERSAL); + SpawnDalaranPortal(player); + SpawnAssistantNPC(player); } return true; } + void SpawnDalaranPortal(Player* player) + { + uint32 entry = 191164; + float posX; + float posY; + float posZ; + float ori; + + QueryResult result = WorldDatabase.PQuery("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry` = %u", entry); + + if (!result) + return; + + do + { + Field* fields = result->Fetch(); + posX = fields[0].GetFloat(); + posY = fields[1].GetFloat(); + posZ = fields[2].GetFloat(); + ori = fields[3].GetFloat(); + + } while (result->NextRow()); + + if (player->FindNearestGameObject(entry, VISIBLE_RANGE)) + { + ChatHandler(player->GetSession()).PSendSysMessage("You already have this object!"); + CloseGossipMenuFor(player); + return; + } + + uint32 objectId = entry; + if (!objectId) + return; + + const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId); + + if (!objectInfo) + return; + + if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) + return; + + GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); + uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); + + if (!object->Create(guidLow, objectInfo->entry, player->GetMap(), player->GetPhaseMask(), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) + { + delete object; + return; + } + + // fill the gameobject data and save to the db + object->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), player->GetPhaseMask()); + // delete the old object and do a clean load from DB with a fresh new GameObject instance. + // this is required to avoid weird behavior and memory leaks + delete object; + + object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); + // this will generate a new guid if the object is in an instance + if (!object->LoadGameObjectFromDB(guidLow, player->GetMap())) + { + delete object; + return; + } + + // TODO: is it really necessary to add both the real and DB table guid here ? + sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); + CloseGossipMenuFor(player); + } + + void SpawnAssistantNPC(Player* player) + { + uint32 entry = 70102; + float posX = 16202.185547f; + float posY = 16255.916992f; + float posZ = 21.160221f; + float ori = 6.195375f; + + Creature* creature = new Creature(); + + creature->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), player->GetPhaseMask()); + uint32 db_guid = creature->GetDBTableGUIDLow(); + + creature->CleanupsBeforeDelete(); + delete creature; + creature = new Creature(); + + sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid)); + } + bool BuyGuildHouse(Guild* guild, Player* player, Creature* creature) { QueryResult result = CharacterDatabase.PQuery("SELECT `id`, `guild` FROM guild_house WHERE `guild` = %u", guild->GetId()); if (result) { - ChatHandler(player->GetSession()).PSendSysMessage("You cant buy any more guilds houses!"); + ChatHandler(player->GetSession()).PSendSysMessage("Your guild already has a Guild House."); CloseGossipMenuFor(player); return false; } ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "GM Island", GOSSIP_SENDER_MAIN, 100, "Buy GM island Guildhouse?", sConfigMgr->GetIntDefault("CostGuildHouse", 10000000), false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "GM Island", GOSSIP_SENDER_MAIN, 100, "Buy Guild House on GM Island?", sConfigMgr->GetIntDefault("CostGuildHouse", 10000000), false); AddGossipItemFor(player, GOSSIP_ICON_CHAT, " ----- More to Come ----", GOSSIP_SENDER_MAIN, 4); SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; @@ -154,7 +254,7 @@ class GuildHouseSeller : public CreatureScript { void TeleportGuildHouse(Guild* guild, Player* player) { GuildData* guildData = player->CustomData.GetDefault("phase"); - QueryResult result = CharacterDatabase.PQuery("SELECT `id`, `guild`, `phase`, `map`,`positionX`, `positionY`, `positionZ` FROM guild_house WHERE `guild` = %u", guild->GetId()); + QueryResult result = CharacterDatabase.PQuery("SELECT `phase`, `map`,`positionX`, `positionY`, `positionZ` FROM guild_house WHERE `guild` = %u", guild->GetId()); if (!result) { @@ -165,13 +265,11 @@ class GuildHouseSeller : public CreatureScript { do { Field* fields = result->Fetch(); - uint32 id = fields[0].GetUInt32(); - uint32 guild = fields[1].GetUInt32(); - guildData->phase = fields[2].GetUInt32(); - uint32 map = fields[3].GetUInt32(); - guildData->posX = fields[4].GetFloat(); - guildData->posY = fields[5].GetFloat(); - guildData->posZ = fields[6].GetFloat(); + guildData->phase = fields[0].GetUInt32(); + uint32 map = fields[1].GetUInt32(); + guildData->posX = fields[2].GetFloat(); + guildData->posY = fields[3].GetFloat(); + guildData->posZ = fields[4].GetFloat(); player->TeleportTo(map, guildData->posX, guildData->posY, guildData->posZ, player->GetOrientation()); player->SetPhaseMask(guildData->phase, true); @@ -253,7 +351,7 @@ class GuildHouseV2PlayerScript : public PlayerScript if (!result || !player->GetGuild()) { - ChatHandler(player->GetSession()).PSendSysMessage("Your Guild does not own a guild house"); + ChatHandler(player->GetSession()).PSendSysMessage("Your Guild does not own a guild house."); teleport(player); return; } @@ -299,14 +397,23 @@ class GuildHouseCommand : public CommandScript { Player* player = handler->GetSession()->GetPlayer(); - if (player->GetAreaId() != 876) - return false; + if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { + handler->SendSysMessage("You must be the Guild Master of a guild to use this command!"); + handler->SetSentErrorMessage(true); + return false; + } - if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) - return false; + if (player->GetAreaId() != 876) { + handler->SendSysMessage("You must be in your Guild House to use this command!"); + handler->SetSentErrorMessage(true); + return false; + } - if (player->FindNearestCreature(70102, VISIBLE_RANGE, true)) - return false; + if (player->FindNearestCreature(70102, VISIBLE_RANGE, true)) { + handler->SendSysMessage("You already have the Guild House Assistant!"); + handler->SetSentErrorMessage(true); + return false; + } float posX = 16202.185547f; float posY = 16255.916992f; @@ -317,6 +424,8 @@ class GuildHouseCommand : public CommandScript if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), player->GetMap(), player->GetPhaseMask(), 70102, 0, posX, posY, posZ, ori)) { + handler->SendSysMessage("You already have the Guild House Assistant!"); + handler->SetSentErrorMessage(true); delete creature; return false; } @@ -328,6 +437,8 @@ class GuildHouseCommand : public CommandScript creature = new Creature(); if (!creature->LoadCreatureFromDB(db_guid, player->GetMap())) { + handler->SendSysMessage("Something went wrong when adding the NPC."); + handler->SetSentErrorMessage(true); delete creature; return false; } @@ -340,15 +451,22 @@ class GuildHouseCommand : public CommandScript { Player* player = handler->GetSession()->GetPlayer(); - if (!player || player->IsInCombat()) + if (!player) return false; + if (player->IsInCombat()) { + handler->SendSysMessage("You can't use this command while in combat!"); + handler->SetSentErrorMessage(true); + return false; + } + GuildData* guildData = player->CustomData.GetDefault("phase"); QueryResult result = CharacterDatabase.PQuery("SELECT `id`, `guild`, `phase`, `map`,`positionX`, `positionY`, `positionZ` FROM guild_house WHERE `guild` = %u", player->GetGuildId()); if (!result) { - ChatHandler(player->GetSession()).PSendSysMessage("Your Guild does not own a guild house"); + handler->SendSysMessage("Your Guild does not own a guild house!"); + handler->SetSentErrorMessage(true); return false; } From f389d39f22894b68b54a478ea4bda8d3f79f700b Mon Sep 17 00:00:00 2001 From: Cristian Bilu Date: Thu, 10 Oct 2019 03:22:28 +0300 Subject: [PATCH 36/63] Fixed phasing --- src/mod_guild_house_v2.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 4bebea7..6c77dbc 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -108,11 +108,8 @@ class GuildHouseSeller : public CreatureScript { CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); - if (player->GetGuildId() > 2) - { - WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = %u", player->GetGuildId()); - WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = %u", player->GetGuildId()); - } + WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = %u", GetGuildPhase(player)); + WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = %u", GetGuildPhase(player)); ChatHandler(player->GetSession()).PSendSysMessage("You have successfully sold your guild house"); player->ModifyMoney(+(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000) / 2)); @@ -131,7 +128,7 @@ class GuildHouseSeller : public CreatureScript { if (action >= 100) { - CharacterDatabase.PQuery("INSERT INTO `guild_house` (guild, phase, map, positionX, positionY, positionZ) VALUES (%u, %u, %u, %f, %f, %f)", player->GetGuildId(), player->GetGuildId(), map, posX, posY, posZ); + CharacterDatabase.PQuery("INSERT INTO `guild_house` (guild, phase, map, positionX, positionY, positionZ) VALUES (%u, %u, %u, %f, %f, %f)", player->GetGuildId(), GetGuildPhase(player), map, posX, posY, posZ); player->ModifyMoney(-(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000))); ChatHandler(player->GetSession()).PSendSysMessage("You have successfully purchased a guild house"); player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We now got a Guild House!", LANG_UNIVERSAL); @@ -142,6 +139,10 @@ class GuildHouseSeller : public CreatureScript { return true; } + uint32 GetGuildPhase(Player* player) { + return player->GetGuildId() + 10; + } + void SpawnDalaranPortal(Player* player) { uint32 entry = 191164; From 349017a2a8f23e5d2dc8a0356b813c2d6125a84b Mon Sep 17 00:00:00 2001 From: Cristian Bilu Date: Thu, 10 Oct 2019 03:36:46 +0300 Subject: [PATCH 37/63] Fixed phasing v2 --- src/mod_guild_house_v2.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 6c77dbc..b1a7fdd 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -188,14 +188,14 @@ class GuildHouseSeller : public CreatureScript { GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if (!object->Create(guidLow, objectInfo->entry, player->GetMap(), player->GetPhaseMask(), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) + if (!object->Create(guidLow, objectInfo->entry, player->GetMap(), GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) { delete object; return; } // fill the gameobject data and save to the db - object->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), player->GetPhaseMask()); + object->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), GetGuildPhase(player)); // delete the old object and do a clean load from DB with a fresh new GameObject instance. // this is required to avoid weird behavior and memory leaks delete object; @@ -223,14 +223,25 @@ class GuildHouseSeller : public CreatureScript { Creature* creature = new Creature(); - creature->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), player->GetPhaseMask()); + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), player->GetMap(), GetGuildPhase(player), 70102, 0, posX, posY, posZ, ori)) + { + delete creature; + return; + } + creature->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), GetGuildPhase(player)); uint32 db_guid = creature->GetDBTableGUIDLow(); creature->CleanupsBeforeDelete(); delete creature; creature = new Creature(); + if (!creature->LoadCreatureFromDB(db_guid, player->GetMap())) + { + delete creature; + return; + } sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid)); + return; } bool BuyGuildHouse(Guild* guild, Player* player, Creature* creature) From cc615e34b00f11f2d25133c7de48106e1eedb85f Mon Sep 17 00:00:00 2001 From: Cristian Bilu Date: Thu, 10 Oct 2019 06:44:53 +0300 Subject: [PATCH 38/63] Resolving the left over NPC's and GObjects ( STILL WIP ) --- src/mod_guild_house_npc.cpp | 12 ++-- src/mod_guild_house_v2.cpp | 112 ++++++++++++++++++++++++++++++------ 2 files changed, 104 insertions(+), 20 deletions(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 11d8241..758fd17 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -227,6 +227,10 @@ class GuildHouseSpawner : public CreatureScript { return true; } + uint32 GetGuildPhase(Player* player) { + return player->GetGuildId() + 10; + } + void SpawnNPC(uint32 entry, Player* player) { if (player->FindNearestCreature(entry, VISIBILITY_RANGE, true)) @@ -258,12 +262,12 @@ class GuildHouseSpawner : public CreatureScript { Creature* creature = new Creature(); - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), player->GetMap(), player->GetPhaseMask(), entry, 0, posX,posY, posZ, ori)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), player->GetMap(), GetGuildPhase(player), entry, 0, posX,posY, posZ, ori)) { delete creature; return; } - creature->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), player->GetPhaseMask()); + creature->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), GetGuildPhase(player)); uint32 db_guid = creature->GetDBTableGUIDLow(); creature->CleanupsBeforeDelete(); @@ -324,14 +328,14 @@ class GuildHouseSpawner : public CreatureScript { GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if (!object->Create(guidLow, objectInfo->entry, player->GetMap(), player->GetPhaseMask(), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) + if (!object->Create(guidLow, objectInfo->entry, player->GetMap(), GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) { delete object; return; } // fill the gameobject data and save to the db - object->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), player->GetPhaseMask()); + object->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), GetGuildPhase(player)); // delete the old object and do a clean load from DB with a fresh new GameObject instance. // this is required to avoid weird behavior and memory leaks delete object; diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index b1a7fdd..d748486 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -12,6 +12,7 @@ #include "DataMap.h" #include "GameObject.h" #include "Transport.h" +#include class GuildData : public DataMap::Base { @@ -35,15 +36,41 @@ class GuildHelper : public GuildScript{ ChatHandler(leader->GetSession()).PSendSysMessage("You now own a guild. You can purchase a guild house!"); } - void OnGuildDisband(Guild* guild) - { - if (guild->GetId() > 2) - { - WorldDatabase.PQuery("DELETE FROM `creature` WHERE map = 1 AND phaseMask = %u", guild->GetId()); - WorldDatabase.PQuery("DELETE FROM `gameobject WHERE map = 1 and phaseMask = %u", guild->GetId()); - } + uint32 GetGuildPhase(Guild* guild) { + return guild->GetId() + 10; + } - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", guild->GetId()); + void OnRemoveMember(Guild* guild, Player* player, bool isDisbanding, bool /*isKicked*/) + { + if (isDisbanding) { + QueryResult result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); + + if (result) { + Map* creatureMap = sMapMgr->FindMap(1, 0); + Creature* creature = nullptr; + do + { + + Field* fields = result->Fetch(); + uint64 lowguid = fields[0].GetInt64(); + + if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { + creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + creature->CombatStop(); + creature->DeleteFromDB(); + creature->AddObjectToRemoveList(); + } + + delete creature; + + } while (result->NextRow()); + } + + WorldDatabase.PQuery("DELETE FROM `creature` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); + WorldDatabase.PQuery("DELETE FROM `gameobject WHERE map = 1 and phaseMask = %u", GetGuildPhase(guild)); + + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", GetGuildPhase(guild)); + } } }; @@ -106,6 +133,51 @@ class GuildHouseSeller : public CreatureScript { return false; } + result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); + + if (result) { + Map* creatureMap = sMapMgr->FindMap(1, 0); + Creature* creature = nullptr; + do + { + + Field* fields = result->Fetch(); + uint64 lowguid = fields[0].GetInt64(); + + if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { + creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + creature->CombatStop(); + creature->DeleteFromDB(); + creature->AddObjectToRemoveList(); + } + + delete creature; + + } while (result->NextRow()); + } + + result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); + + if (result) { + Map* gobMap = sMapMgr->FindMap(1, 0); + GameObject* object = nullptr; + do + { + Field* fields = result->Fetch(); + uint64 lowguid = fields[0].GetInt64(); + + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { + object = gobMap->GetGameObject(lowguid); + object->SetRespawnTime(0); + object->Delete(); + object->DeleteFromDB(); + } + + } while (result->NextRow()); + } + + + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = %u", GetGuildPhase(player)); @@ -142,6 +214,10 @@ class GuildHouseSeller : public CreatureScript { uint32 GetGuildPhase(Player* player) { return player->GetGuildId() + 10; } + uint32 GetGuildPhase(Guild* guild) { + return guild->GetId() + 10; + } + void SpawnDalaranPortal(Player* player) { @@ -188,21 +264,21 @@ class GuildHouseSeller : public CreatureScript { GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); - if (!object->Create(guidLow, objectInfo->entry, player->GetMap(), GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) + if (!object->Create(guidLow, objectInfo->entry, sMapMgr->FindMap(1, 0), GetGuildPhase(player->GetGuild()), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) { delete object; return; } // fill the gameobject data and save to the db - object->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), GetGuildPhase(player)); + object->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player->GetGuild())); // delete the old object and do a clean load from DB with a fresh new GameObject instance. // this is required to avoid weird behavior and memory leaks delete object; object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); // this will generate a new guid if the object is in an instance - if (!object->LoadGameObjectFromDB(guidLow, player->GetMap())) + if (!object->LoadGameObjectFromDB(guidLow, sMapMgr->FindMap(1, 0))) { delete object; return; @@ -223,18 +299,18 @@ class GuildHouseSeller : public CreatureScript { Creature* creature = new Creature(); - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), player->GetMap(), GetGuildPhase(player), 70102, 0, posX, posY, posZ, ori)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), sMapMgr->FindMap(1, 0), GetGuildPhase(player->GetGuild()), 70102, 0, posX, posY, posZ, ori)) { delete creature; return; } - creature->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), GetGuildPhase(player)); + creature->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player->GetGuild())); uint32 db_guid = creature->GetDBTableGUIDLow(); creature->CleanupsBeforeDelete(); delete creature; creature = new Creature(); - if (!creature->LoadCreatureFromDB(db_guid, player->GetMap())) + if (!creature->LoadCreatureFromDB(db_guid, sMapMgr->FindMap(1, 0))) { delete creature; return; @@ -405,6 +481,10 @@ class GuildHouseCommand : public CommandScript return GuildHouseCommandBaseTable; } + static uint32 GetGuildPhase(Player* player) { + return player->GetGuildId() + 10; + } + static bool HandleSpawnNPCCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); @@ -434,14 +514,14 @@ class GuildHouseCommand : public CommandScript Creature* creature = new Creature(); - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), player->GetMap(), player->GetPhaseMask(), 70102, 0, posX, posY, posZ, ori)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), player->GetMap(), GetGuildPhase(player), 70102, 0, posX, posY, posZ, ori)) { handler->SendSysMessage("You already have the Guild House Assistant!"); handler->SetSentErrorMessage(true); delete creature; return false; } - creature->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), player->GetPhaseMask()); + creature->SaveToDB(player->GetMapId(), (1 << player->GetMap()->GetSpawnMode()), GetGuildPhase(player)); uint32 db_guid = creature->GetDBTableGUIDLow(); creature->CleanupsBeforeDelete(); From 75a2ca3422acbee6bc305933db1562f01aac5c55 Mon Sep 17 00:00:00 2001 From: Cristian Bilu Date: Thu, 10 Oct 2019 06:55:34 +0300 Subject: [PATCH 39/63] Fix SQL Error --- src/mod_guild_house_v2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index d748486..1152b30 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -67,7 +67,7 @@ class GuildHelper : public GuildScript{ } WorldDatabase.PQuery("DELETE FROM `creature` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); - WorldDatabase.PQuery("DELETE FROM `gameobject WHERE map = 1 and phaseMask = %u", GetGuildPhase(guild)); + WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", GetGuildPhase(guild)); } From 6e6bd19ac681b7519e1dd7bdbe06f4e9ee3aa28d Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 10 Oct 2019 08:53:45 -0700 Subject: [PATCH 40/63] adding new food/water and ammo/repair npcs --- sql/world/Creatures.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/world/Creatures.sql b/sql/world/Creatures.sql index 212e367..64947b8 100644 --- a/sql/world/Creatures.sql +++ b/sql/world/Creatures.sql @@ -1,4 +1,6 @@ REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Xrispins', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), (18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Angela', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), (33251, 0, 0, 0, 0, 0, 28516, 0, 0, 0, 'Death Knight Trainer', '', '', 9691, 80, 80, 2, 35, 51, 1, 1.14286, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 32768, 2048, 0, 0, 0, 0, 6, 0, 345, 509, 103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 10, 1, 1, 0, 0, 1, 8388624, 0, '', 12340), -(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Rapidomuerte', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340); +(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Rapidomuerte', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340), +(70103, 0, 0, 0, 0, 0, 27211, 0, 0, 0, 'Essenbaum', 'Food & Water Vendor', '', 0, 80, 80, 0, 2007, 640, 1, 1.4286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, '', 12340), +(70104, 0, 0, 0, 0, 0, 26307, 0, 0, 0, 'Archie', 'Ammo & Repairs', '', 0, 80, 80, 0, 2007, 4480, 1, 1.4286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, '', 12340); From efce3135ed874269a2754eb1aa9a8e779a55db9e Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 10 Oct 2019 08:59:34 -0700 Subject: [PATCH 41/63] Adding sql for new vendor's items --- sql/world/Vendor_items.sql | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 sql/world/Vendor_items.sql diff --git a/sql/world/Vendor_items.sql b/sql/world/Vendor_items.sql new file mode 100644 index 0000000..8075abd --- /dev/null +++ b/sql/world/Vendor_items.sql @@ -0,0 +1,2 @@ +REPLACE INTO `npc_vendor` VALUES(70103, 0, 1179, 0, 0, 0, 12340),(70103, 0, 414, 0, 0, 0, 12340),(70103, 0, 1205, 0, 0, 0, 12340),(70103, 0, 422, 0, 0, 0, 12340),(70103, 0, 1708, 0, 0, 0, 12340),(70103, 0, 1707, 0, 0, 0, 12340),(70103, 0, 1645, 0, 0, 0, 12340),(70103, 0, 1707, 0, 0, 0, 12340),(70103, 0, 8766, 0, 0, 0, 12340),(70103, 0, 8953, 0, 0, 0, 12340),(70103, 0, 18300, 0, 0, 0, 12340),(70103, 0, 29393, 0, 0, 0, 12340),(70103, 0, 27860, 0, 0, 0, 12340),(70103, 0, 38428, 0, 0, 0, 12340),(70103, 0, 44941, 0, 0, 0, 12340),(70103, 0, 42430, 0, 0, 0, 12340),(70103, 0, 33445, 0, 0, 0, 12340),(70103, 0, 42431, 0, 0, 0, 12340), +(70104, 0, 2515, 0, 0, 0, 12340),(70104, 0, 2519, 0, 0, 0, 12340),(70104, 0, 3030, 0, 0, 0, 12340),(70104, 0, 11285, 0, 0, 0, 12340),(70104, 0, 11284, 0, 0, 0, 12340),(70104, 0, 28053, 0, 0, 0, 12340),(70104, 0, 28060, 0, 0, 0, 12340),(70104, 0, 28056, 0, 0, 0, 12340),(70104, 0, 28061, 0, 0, 0, 12340),(70104, 0, 41586, 0, 0, 0, 12340),(70104, 0, 41584, 0, 0, 0, 12340) From d67f63cc67ee634779efc8f8ba2e97d92b55c47f Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 10 Oct 2019 09:13:51 -0700 Subject: [PATCH 42/63] Added 2 new specialized vendors to purchasables. --- src/mod_guild_house_npc.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 3538e49..213afaf 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -79,8 +79,9 @@ class GuildHouseSpawner : public CreatureScript { ClearGossipMenuFor(player); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Trade Supplies", GOSSIP_SENDER_MAIN, 28692, "Spawn Trade Supplies?", GuildHouseVendor, false); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Tabard Vendor", GOSSIP_SENDER_MAIN, 28776, "Spawn Tabard Vendor?", GuildHouseVendor, false); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Food & Drink", GOSSIP_SENDER_MAIN, 29715, "Spawn Food & Drink?", GuildHouseVendor, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Food & Drink", GOSSIP_SENDER_MAIN, 70103, "Spawn Food & Drink?", GuildHouseVendor, false); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Reagent Vendor", GOSSIP_SENDER_MAIN, 29636, "Spawn Reagent Vendor?", GuildHouseVendor, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Ammo & Repair Vendor", GOSSIP_SENDER_MAIN, 70104, "Spawn Ammo & Repair Vendor?", GuildHouseVendor, false); AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; @@ -176,8 +177,7 @@ class GuildHouseSpawner : public CreatureScript { case 33618: // Skinning case 33608: // Alchemy case 33616: // Herbalism - - case 33613: // Tailoring + case 33613: // Tailoring case 33619: // Cooking case 33623: // Fishing case 33621: // First Aid @@ -186,8 +186,9 @@ class GuildHouseSpawner : public CreatureScript { break; case 28692: // Trade supplies case 28776: // Tabard Vendor - case 29715: // Food & Drink + case 70103: // Food & Drink case 29636: // Reagent Vendor + case 70104: // Ammo & Repair Vendor cost = GuildHouseProff; SpawnNPC(action, player); break; From f47544ff5e6cb3f05798218ef772b37b03f1fdc0 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 10 Oct 2019 09:21:59 -0700 Subject: [PATCH 43/63] adding vendors to spawns list --- sql/world/guild_house_spawns.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index c9e33eb..c2ca9d9 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -90,12 +90,13 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (45, 187293, 16230.5, 16283.5, 13.9061, 3, 'Guild Vault (Object)'), (46, 28692, 16230.2, 16316.4, 20.8455, 6.25643, 'Trade Supplies'), (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), - (49, 29715, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), + (49, 70103, 16223.7, 16293.3, 20.852, 4.57958, 'Food & Drink'), (50, 6491, 16319.937, 16242.404, 24.4747, 2.206830, 'Spirit Healer'), (51, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'), (52, 191013, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Alliance'), (53, 29636, 16233.5, 16316.1, 20.8455, 3.07558, 'Reagent Vendor'), - (54, 191014, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Horde'); + (54, 191014, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Horde'), + (55, 70104, 16242.8, 16302.1, 13.174, 4.6153, 'Ammo & Repair Vendor'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; From c0865fbf971ab1b5b34b7985e947e0a43d000fd1 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Oct 2019 08:02:15 -0700 Subject: [PATCH 44/63] restored original name of ingame npc --- sql/world/Creatures.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/world/Creatures.sql b/sql/world/Creatures.sql index 64947b8..ddba569 100644 --- a/sql/world/Creatures.sql +++ b/sql/world/Creatures.sql @@ -1,6 +1,6 @@ -REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Xrispins', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), -(18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Angela', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), +REPLACE INTO `creature_template` VALUES (70101, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSeller', 12340), +(18649, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Monica', NULL, NULL, 0, 1, 2, 0, 35, 65537, 0.8, 0.28571, 1, 0, 2, 2, 0, 26, 4.6, 2000, 1900, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 1, 1, 100, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 3, 1, 1, 1, 1, 0, 70, 1, 0, 2, 'npc_innkeeper', 12340), (33251, 0, 0, 0, 0, 0, 28516, 0, 0, 0, 'Death Knight Trainer', '', '', 9691, 80, 80, 2, 35, 51, 1, 1.14286, 1, 1, 422, 586, 0, 642, 7.5, 2000, 2000, 1, 32768, 2048, 0, 0, 0, 0, 6, 0, 345, 509, 103, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 10, 1, 1, 0, 0, 1, 8388624, 0, '', 12340), -(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Rapidomuerte', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340), +(70102, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Xrispins', 'Guild House Assistant', '', 0, 35, 35, 0, 35, 1, 1, 1.14286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, 'GuildHouseSpawner', 12340), (70103, 0, 0, 0, 0, 0, 27211, 0, 0, 0, 'Essenbaum', 'Food & Water Vendor', '', 0, 80, 80, 0, 2007, 640, 1, 1.4286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, '', 12340), (70104, 0, 0, 0, 0, 0, 26307, 0, 0, 0, 'Archie', 'Ammo & Repairs', '', 0, 80, 80, 0, 2007, 4480, 1, 1.4286, 1, 0, 49, 64, 0, 118, 1, 2000, 2000, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 33, 49, 11, 7, 4096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 1, 1, 1, 0, 0, 1, 0, 0, '', 12340); From 586a5c88f7a25065996db3c8fea106558a20ead7 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 15 Oct 2019 08:43:55 -0700 Subject: [PATCH 45/63] adding wizzy to credits list --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 023bf8e..1c050b6 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,10 @@ All guilds will get their own phasing system which then the guild master will ha * Auctioneer ## How to use ingame -1) As GM: .npc add 70101 -> somewhere public and accessible by other players. + +1) As GM: `.npc add 70101` -> somewhere public and accessible by other players. 2) Purchase a guild house from the added NPC, then either teleport to the guildhouse via the NPC or chat: `.guildhouse tele` -3) Once the player is in the location of the guild house the guild master has a command .guildhouse spawnnpc this will load the Guild House Assistant. +3) Once the player is in the location of the guild house the guild master has a command .guildhouse SpawnNpc this will load the Guild House Assistant. (WIP: NPC automatically spawns as part of the purchase sequence) 4) Speak with the Guild House Assistant to begin purchasing objects. ## Requirements @@ -37,6 +38,7 @@ All guilds will get their own phasing system which then the guild master will ha 3) Apply the guildhouse.patch to your source 4) Re-run cmake and launch a clean build of AzerothCore. ``` + ## Patch Information (guildhouse.patch) The patch basically turns the selected area from a bitmask to a uint, this fixes the issues with the phasing @@ -57,6 +59,6 @@ If you need to change the module configuration, go to your server configuration * [Talamortis](https://github.com/talamortis) (Original author of the module) * [Rochet2](https://github.com/Rochet2/): Thanks for the help with the phasing situation & General support -* [Anhanga](https://github.com/rbedfordpro) +* [Anhanga](https://github.com/rbedfordpro) & [WiZZy](https://github.com/wizzymore) AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/64FH6Y8) From da00cf43f505855c9bcbfebc3715d6d7a4a7960c Mon Sep 17 00:00:00 2001 From: Cristian Bilu Date: Wed, 16 Oct 2019 01:58:29 +0300 Subject: [PATCH 46/63] Last fixes --- src/mod_guild_house_v2.cpp | 120 +++++++++++++++++++++++-------------- 1 file changed, 76 insertions(+), 44 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 1152b30..4f50c26 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -40,37 +40,57 @@ class GuildHelper : public GuildScript{ return guild->GetId() + 10; } - void OnRemoveMember(Guild* guild, Player* player, bool isDisbanding, bool /*isKicked*/) + void OnDisband(Guild* guild) { - if (isDisbanding) { - QueryResult result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); + QueryResult result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); - if (result) { - Map* creatureMap = sMapMgr->FindMap(1, 0); - Creature* creature = nullptr; - do - { + if (result) { + Map* creatureMap = sMapMgr->FindMap(1, 0); + Creature* creature = nullptr; + do + { - Field* fields = result->Fetch(); - uint64 lowguid = fields[0].GetInt64(); - - if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { - creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); - creature->CombatStop(); - creature->DeleteFromDB(); - creature->AddObjectToRemoveList(); - } + Field* fields = result->Fetch(); + uint32 lowguid = fields[0].GetInt32(); - delete creature; + if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { + creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + creature->CombatStop(); + creature->DeleteFromDB(); + creature->AddObjectToRemoveList(); + delete creature; + } - } while (result->NextRow()); - } - WorldDatabase.PQuery("DELETE FROM `creature` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); - WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); + } while (result->NextRow()); + } - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", GetGuildPhase(guild)); - } + /*result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); + + if (result) { + Map* gobMap = sMapMgr->FindMap(1, 0); + GameObject* object = nullptr; + do + { + Field* fields = result->Fetch(); + uint32 lowguid = fields[0].GetInt32(); + + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { + object = gobMap->GetGameObject(gameObjectData->id); + object->SetRespawnTime(0); + object->DeleteFromDB(); + object->CleanupsBeforeDelete(); + delete object; + } + + } while (result->NextRow()); + }*/ + + WorldDatabase.PQuery("DELETE FROM `creature` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); + WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); + + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", guild->GetId()); + } }; @@ -142,39 +162,40 @@ class GuildHouseSeller : public CreatureScript { { Field* fields = result->Fetch(); - uint64 lowguid = fields[0].GetInt64(); + uint32 lowguid = fields[0].GetInt32(); if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); creature->CombatStop(); creature->DeleteFromDB(); creature->AddObjectToRemoveList(); + delete creature; } - delete creature; } while (result->NextRow()); } - result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); + /*result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); - if (result) { - Map* gobMap = sMapMgr->FindMap(1, 0); - GameObject* object = nullptr; - do - { - Field* fields = result->Fetch(); - uint64 lowguid = fields[0].GetInt64(); + if (result) { + Map* gobMap = sMapMgr->FindMap(1, 0); + GameObject* object = nullptr; + do + { + Field* fields = result->Fetch(); + uint32 lowguid = fields[0].GetInt32(); - if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { - object = gobMap->GetGameObject(lowguid); - object->SetRespawnTime(0); - object->Delete(); - object->DeleteFromDB(); - } + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { + if (object = gobMap->GetGameObject(gameObjectData->id)) { + object->SetRespawnTime(0); + object->DeleteFromDB(); + object->CleanupsBeforeDelete(); + } + } - } while (result->NextRow()); - } + } while (result->NextRow()); + }*/ @@ -194,7 +215,7 @@ class GuildHouseSeller : public CreatureScript { BuyGuildHouse(player->GetGuild(), player, m_creature); break; case 1: // teleport to guild house - TeleportGuildHouse(player->GetGuild(), player); + TeleportGuildHouse(player->GetGuild(), player, m_creature); break; } @@ -339,13 +360,24 @@ class GuildHouseSeller : public CreatureScript { } - void TeleportGuildHouse(Guild* guild, Player* player) + void TeleportGuildHouse(Guild* guild, Player* player, Creature* creature) { GuildData* guildData = player->CustomData.GetDefault("phase"); QueryResult result = CharacterDatabase.PQuery("SELECT `phase`, `map`,`positionX`, `positionY`, `positionZ` FROM guild_house WHERE `guild` = %u", guild->GetId()); if (!result) { + ClearGossipMenuFor(player); + if (player->GetGuild()->GetLeaderGUID() == player->GetGUID()) + { + // Only leader of the guild can buy / sell guild house + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Buy Guild House!", GOSSIP_SENDER_MAIN, 2); + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", 0, false); + } + + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Close", GOSSIP_SENDER_MAIN, 5); + SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); ChatHandler(player->GetSession()).PSendSysMessage("Your Guild does not own a guild house"); return; } From 2a60fa5f20700d82de864c5b71ccab7547830d1b Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 16 Oct 2019 08:44:32 -0700 Subject: [PATCH 47/63] Seller now changes options based on if guild or guild_home exists --- src/mod_guild_house_v2.cpp | 72 +++++++++++++++++++++++++------------- 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 4f50c26..e3bc143 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -12,7 +12,7 @@ #include "DataMap.h" #include "GameObject.h" #include "Transport.h" -#include +#include "Maps/MapManager.h" class GuildData : public DataMap::Base { @@ -65,7 +65,7 @@ class GuildHelper : public GuildScript{ } while (result->NextRow()); } - /*result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); + result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); if (result) { Map* gobMap = sMapMgr->FindMap(1, 0); @@ -84,7 +84,7 @@ class GuildHelper : public GuildScript{ } } while (result->NextRow()); - }*/ + } WorldDatabase.PQuery("DELETE FROM `creature` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); @@ -103,19 +103,33 @@ class GuildHouseSeller : public CreatureScript { { if (!player->GetGuild()) { - ChatHandler(player->GetSession()).PSendSysMessage("You are not a member of a guild."); + ChatHandler(player->GetSession()).PSendSysMessage("Sorry, I cannot help you. You are not a member of a guild."); CloseGossipMenuFor(player); return false; } + QueryResult has_gh_result; + + has_gh_result = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); + + // Only show Teleport option if guild owns a guildhouse + if (has_gh_result) + { + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); + } if (player->GetGuild()->GetLeaderGUID() == player->GetGUID()) { - // Only leader of the guild can buy / sell guild house + // Only show "Sell" option if they have a guild house & are guild leader + if (has_gh_result) + { + AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", 0, false); + } + else { + // Only leader of the guild can buy / sell guild house & only show if they don't already have a guild house AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Buy Guild House!", GOSSIP_SENDER_MAIN, 2); - AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", 0, false); + } } - AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Close", GOSSIP_SENDER_MAIN, 5); SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; @@ -144,26 +158,35 @@ class GuildHouseSeller : public CreatureScript { break; case 3: // Sell back guild house { - QueryResult result = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); - if (!result) + QueryResult has_gh_result; + + has_gh_result = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); + if (!has_gh_result) { ChatHandler(player->GetSession()).PSendSysMessage("Your guild currently doesn't own a Guild House!"); CloseGossipMenuFor(player); return false; } + ChatHandler(player->GetSession()).PSendSysMessage("Select query:"); + ChatHandler(player->GetSession()).PSendSysMessage("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); + + QueryResult result; + result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); + ChatHandler(player->GetSession()).PSendSysMessage("Selected, now deleting creature guild house data..."); + if (result) { + ChatHandler(player->GetSession()).PSendSysMessage("Got a result!"); Map* creatureMap = sMapMgr->FindMap(1, 0); Creature* creature = nullptr; do { - Field* fields = result->Fetch(); uint32 lowguid = fields[0].GetInt32(); - + ChatHandler(player->GetSession()).PSendSysMessage("Deleting: %u", lowguid); if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); creature->CombatStop(); @@ -171,32 +194,31 @@ class GuildHouseSeller : public CreatureScript { creature->AddObjectToRemoveList(); delete creature; } - - } while (result->NextRow()); } - - /*result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); - - if (result) { + + // QueryResult gresult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); + ChatHandler(player->GetSession()).PSendSysMessage("Would have performed SELECT query!"); + /* + if (gresult) { Map* gobMap = sMapMgr->FindMap(1, 0); GameObject* object = nullptr; do { - Field* fields = result->Fetch(); + Field* fields = gresult->Fetch(); uint32 lowguid = fields[0].GetInt32(); if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { - if (object = gobMap->GetGameObject(gameObjectData->id)) { + if (object == gobMap->GetGameObject(gameObjectData->id)) { object->SetRespawnTime(0); object->DeleteFromDB(); object->CleanupsBeforeDelete(); } } - } while (result->NextRow()); - }*/ - + } while (gresult->NextRow()); + } + */ CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); @@ -205,6 +227,7 @@ class GuildHouseSeller : public CreatureScript { WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = %u", GetGuildPhase(player)); ChatHandler(player->GetSession()).PSendSysMessage("You have successfully sold your guild house"); + player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We just sold our guild house.", LANG_UNIVERSAL); player->ModifyMoney(+(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000) / 2)); CloseGossipMenuFor(player); @@ -224,8 +247,8 @@ class GuildHouseSeller : public CreatureScript { CharacterDatabase.PQuery("INSERT INTO `guild_house` (guild, phase, map, positionX, positionY, positionZ) VALUES (%u, %u, %u, %f, %f, %f)", player->GetGuildId(), GetGuildPhase(player), map, posX, posY, posZ); player->ModifyMoney(-(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000))); ChatHandler(player->GetSession()).PSendSysMessage("You have successfully purchased a guild house"); - player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We now got a Guild House!", LANG_UNIVERSAL); - player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "Let's celebrate! Drinks on me.", LANG_UNIVERSAL); + player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We now have a Guild House!", LANG_UNIVERSAL); + player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "In chat, type `.guildhouse teleport` to meet me there!", LANG_UNIVERSAL); SpawnDalaranPortal(player); SpawnAssistantNPC(player); } @@ -242,6 +265,7 @@ class GuildHouseSeller : public CreatureScript { void SpawnDalaranPortal(Player* player) { + // 195682 - Dalaran portal enterable by alliance uint32 entry = 191164; float posX; float posY; From ecf3a54acbfcf62491d41a7cab56ef5b6ad6b49d Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 16 Oct 2019 15:39:00 -0700 Subject: [PATCH 48/63] Working on fixing crash when removing guildhouse --- src/mod_guild_house_v2.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index e3bc143..65928ed 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -42,7 +42,9 @@ class GuildHelper : public GuildScript{ void OnDisband(Guild* guild) { - QueryResult result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); + QueryResult result; + + result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); if (result) { Map* creatureMap = sMapMgr->FindMap(1, 0); @@ -58,7 +60,7 @@ class GuildHelper : public GuildScript{ creature->CombatStop(); creature->DeleteFromDB(); creature->AddObjectToRemoveList(); - delete creature; + //delete creature; } @@ -125,7 +127,7 @@ class GuildHouseSeller : public CreatureScript { AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", 0, false); } else { - // Only leader of the guild can buy / sell guild house & only show if they don't already have a guild house + // Only leader of the guild can buy guild house & only if they don't already have a guild house AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Buy Guild House!", GOSSIP_SENDER_MAIN, 2); } } @@ -179,48 +181,49 @@ class GuildHouseSeller : public CreatureScript { ChatHandler(player->GetSession()).PSendSysMessage("Selected, now deleting creature guild house data..."); if (result) { - ChatHandler(player->GetSession()).PSendSysMessage("Got a result!"); Map* creatureMap = sMapMgr->FindMap(1, 0); Creature* creature = nullptr; do { Field* fields = result->Fetch(); uint32 lowguid = fields[0].GetInt32(); - ChatHandler(player->GetSession()).PSendSysMessage("Deleting: %u", lowguid); + ChatHandler(player->GetSession()).PSendSysMessage("CREATURE Deleting: %u", lowguid); if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); creature->CombatStop(); creature->DeleteFromDB(); creature->AddObjectToRemoveList(); - delete creature; + // delete creature; } } while (result->NextRow()); } - - // QueryResult gresult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); - ChatHandler(player->GetSession()).PSendSysMessage("Would have performed SELECT query!"); - /* - if (gresult) { + + ChatHandler(player->GetSession()).PSendSysMessage("SELECT guid FROM gameobject WHERE phaseMask = %u and map = 1", GetGuildPhase(player)); + // THIS QUERY IS CAUSING ISSUES - WHY??? + // QueryResult result = WorldDatabase.PQuery("SELECT guid FROM gameobject WHERE phaseMask = %u and map = 1", GetGuildPhase(player)); + QueryResult gResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); + ChatHandler(player->GetSession()).PSendSysMessage("Finished select, going on to if (gResult)."); + if (gResult) { Map* gobMap = sMapMgr->FindMap(1, 0); GameObject* object = nullptr; do { - Field* fields = gresult->Fetch(); + Field* fields = gResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); - + ChatHandler(player->GetSession()).PSendSysMessage("GAMEOBJECT Deleting: %u", lowguid); if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { if (object == gobMap->GetGameObject(gameObjectData->id)) { object->SetRespawnTime(0); object->DeleteFromDB(); object->CleanupsBeforeDelete(); + delete object; } } - } while (gresult->NextRow()); + } while (gResult->NextRow()); } - */ - - + + ChatHandler(player->GetSession()).PSendSysMessage("Performing DELETEs in SQL..."); CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = %u", GetGuildPhase(player)); From 02373a8b321cd1c286ef3fcb426325470702fd12 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 17 Oct 2019 14:16:05 -0700 Subject: [PATCH 49/63] Moving Guild House Deletion to its own function --- src/mod_guild_house_v2.cpp | 490 ++++++++++++++++++------------------- 1 file changed, 242 insertions(+), 248 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 65928ed..2aa0463 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -36,9 +36,9 @@ class GuildHelper : public GuildScript{ ChatHandler(leader->GetSession()).PSendSysMessage("You now own a guild. You can purchase a guild house!"); } - uint32 GetGuildPhase(Guild* guild) { - return guild->GetId() + 10; - } + uint32 GetGuildPhase(Guild* guild) { + return guild->GetId() + 10; + } void OnDisband(Guild* guild) { @@ -105,16 +105,15 @@ class GuildHouseSeller : public CreatureScript { { if (!player->GetGuild()) { - ChatHandler(player->GetSession()).PSendSysMessage("Sorry, I cannot help you. You are not a member of a guild."); - CloseGossipMenuFor(player); + ChatHandler(player->GetSession()).PSendSysMessage("You are not a member of a guild."); + CloseGossipMenuFor(player); return false; } - QueryResult has_gh_result; - has_gh_result = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); + QueryResult has_gh = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); // Only show Teleport option if guild owns a guildhouse - if (has_gh_result) + if (has_gh) { AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Teleport to Guild House", GOSSIP_SENDER_MAIN, 1); } @@ -122,7 +121,7 @@ class GuildHouseSeller : public CreatureScript { if (player->GetGuild()->GetLeaderGUID() == player->GetGUID()) { // Only show "Sell" option if they have a guild house & are guild leader - if (has_gh_result) + if (has_gh) { AddGossipItemFor(player, GOSSIP_ICON_TABARD, "Sell Guild House!", GOSSIP_SENDER_MAIN, 3, "Are you sure you want to sell your Guild house?", 0, false); } @@ -155,86 +154,31 @@ class GuildHouseSeller : public CreatureScript { case 5: // close CloseGossipMenuFor(player); break; - case 4: // --- MORE TO COME --- - BuyGuildHouse(player->GetGuild(), player, m_creature); - break; + case 4: // --- MORE TO COME --- + BuyGuildHouse(player->GetGuild(), player, m_creature); + break; case 3: // Sell back guild house { - - QueryResult has_gh_result; - has_gh_result = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); - if (!has_gh_result) + QueryResult has_gh = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); + if (!has_gh) { ChatHandler(player->GetSession()).PSendSysMessage("Your guild currently doesn't own a Guild House!"); - CloseGossipMenuFor(player); + CloseGossipMenuFor(player); return false; } - ChatHandler(player->GetSession()).PSendSysMessage("Select query:"); - ChatHandler(player->GetSession()).PSendSysMessage("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); - - QueryResult result; - - result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); - - ChatHandler(player->GetSession()).PSendSysMessage("Selected, now deleting creature guild house data..."); - - if (result) { - Map* creatureMap = sMapMgr->FindMap(1, 0); - Creature* creature = nullptr; - do - { - Field* fields = result->Fetch(); - uint32 lowguid = fields[0].GetInt32(); - ChatHandler(player->GetSession()).PSendSysMessage("CREATURE Deleting: %u", lowguid); - if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { - creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); - creature->CombatStop(); - creature->DeleteFromDB(); - creature->AddObjectToRemoveList(); - // delete creature; - } - } while (result->NextRow()); - } - - ChatHandler(player->GetSession()).PSendSysMessage("SELECT guid FROM gameobject WHERE phaseMask = %u and map = 1", GetGuildPhase(player)); - // THIS QUERY IS CAUSING ISSUES - WHY??? - // QueryResult result = WorldDatabase.PQuery("SELECT guid FROM gameobject WHERE phaseMask = %u and map = 1", GetGuildPhase(player)); - QueryResult gResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(player)); - ChatHandler(player->GetSession()).PSendSysMessage("Finished select, going on to if (gResult)."); - if (gResult) { - Map* gobMap = sMapMgr->FindMap(1, 0); - GameObject* object = nullptr; - do - { - Field* fields = gResult->Fetch(); - uint32 lowguid = fields[0].GetInt32(); - ChatHandler(player->GetSession()).PSendSysMessage("GAMEOBJECT Deleting: %u", lowguid); - if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { - if (object == gobMap->GetGameObject(gameObjectData->id)) { - object->SetRespawnTime(0); - object->DeleteFromDB(); - object->CleanupsBeforeDelete(); - delete object; - } - } - - } while (gResult->NextRow()); - } - - ChatHandler(player->GetSession()).PSendSysMessage("Performing DELETEs in SQL..."); - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); - - WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = %u", GetGuildPhase(player)); - WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = %u", GetGuildPhase(player)); - - ChatHandler(player->GetSession()).PSendSysMessage("You have successfully sold your guild house"); - player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We just sold our guild house.", LANG_UNIVERSAL); - player->ModifyMoney(+(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000) / 2)); - - CloseGossipMenuFor(player); + ChatHandler(player->GetSession()).PSendSysMessage("Calling RemoveGuildHouse(player)"); + if (RemoveGuildHouse(player)) + { + ChatHandler(player->GetSession()).PSendSysMessage("You have successfully sold your guild house."); + player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We just sold our guild house.", LANG_UNIVERSAL); + player->ModifyMoney(+(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000) / 2)); + CloseGossipMenuFor(player); + } else { + ChatHandler(player->GetSession()).PSendSysMessage("There was an error selling your guild house."); + } break; } case 2: // buy guild house @@ -250,123 +194,188 @@ class GuildHouseSeller : public CreatureScript { CharacterDatabase.PQuery("INSERT INTO `guild_house` (guild, phase, map, positionX, positionY, positionZ) VALUES (%u, %u, %u, %f, %f, %f)", player->GetGuildId(), GetGuildPhase(player), map, posX, posY, posZ); player->ModifyMoney(-(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000))); ChatHandler(player->GetSession()).PSendSysMessage("You have successfully purchased a guild house"); - player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We now have a Guild House!", LANG_UNIVERSAL); - player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "In chat, type `.guildhouse teleport` to meet me there!", LANG_UNIVERSAL); - SpawnDalaranPortal(player); - SpawnAssistantNPC(player); + player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We now have a Guild House!", LANG_UNIVERSAL); + player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "In chat, type `.guildhouse teleport` to meet me there!", LANG_UNIVERSAL); + SpawnDalaranPortal(player); + SpawnAssistantNPC(player); } return true; } - uint32 GetGuildPhase(Player* player) { - return player->GetGuildId() + 10; - } - uint32 GetGuildPhase(Guild* guild) { - return guild->GetId() + 10; - } + uint32 GetGuildPhase(Player* player) { + return player->GetGuildId() + 10; + } + + uint32 GetGuildPhase(Guild* guild) { + return guild->GetId() + 10; + } + + + bool RemoveGuildHouse(Player* player) + { + + uint32 guildPhase = GetGuildPhase(player); + + ChatHandler(player->GetSession()).PSendSysMessage("Selecting from gameobject where phaseMask = %u ", guildPhase); + QueryResult GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u AND `map` = 1", guildPhase); + + ChatHandler(player->GetSession()).PSendSysMessage("Selecting from creature where phaseMask = %u ", guildPhase); + QueryResult CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", guildPhase); + + if (CreatureResult) { + Map* creatureMap = sMapMgr->FindMap(1, 0); + Creature* creature = nullptr; + do + { + Field* fields = CreatureResult->Fetch(); + uint32 lowguid = fields[0].GetInt32(); + ChatHandler(player->GetSession()).PSendSysMessage("CREATURE Deleting: %u", lowguid); + if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { + creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + creature->CombatStop(); + creature->DeleteFromDB(); + creature->AddObjectToRemoveList(); + //delete creature; + } + } while (CreatureResult->NextRow()); + } + + if (GameobjResult) { + Map* gobMap = sMapMgr->FindMap(1, 0); + GameObject* object = nullptr; + do + { + Field* fields = GameobjResult->Fetch(); + uint32 lowguid = fields[0].GetInt32(); + ChatHandler(player->GetSession()).PSendSysMessage("GAMEOBJECT Deleting: %u", lowguid); + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { + if (object == gobMap->GetGameObject(gameObjectData->id)) { + object->SetRespawnTime(0); + object->DeleteFromDB(); + object->CleanupsBeforeDelete(); + delete object; + } + } + } while (GameobjResult->NextRow()); + } + + // Perform database deletes to clean up, although this may happen above in object->DeleteFromDB() & creature->DeleteFromDB() + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); + ChatHandler(player->GetSession()).PSendSysMessage("Deleting from creature where phaseMask = %u ", guildPhase); + WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = %u", guildPhase); + ChatHandler(player->GetSession()).PSendSysMessage("Deleting from gameobject where phaseMask = %u ", guildPhase); + WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = %u", guildPhase); + + return true; + + } - void SpawnDalaranPortal(Player* player) - { + void SpawnDalaranPortal(Player* player) + { // 195682 - Dalaran portal enterable by alliance - uint32 entry = 191164; - float posX; - float posY; - float posZ; - float ori; - - QueryResult result = WorldDatabase.PQuery("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry` = %u", entry); - - if (!result) - return; - - do - { - Field* fields = result->Fetch(); - posX = fields[0].GetFloat(); - posY = fields[1].GetFloat(); - posZ = fields[2].GetFloat(); - ori = fields[3].GetFloat(); - - } while (result->NextRow()); - - if (player->FindNearestGameObject(entry, VISIBLE_RANGE)) - { - ChatHandler(player->GetSession()).PSendSysMessage("You already have this object!"); - CloseGossipMenuFor(player); - return; - } - - uint32 objectId = entry; - if (!objectId) - return; - - const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId); - - if (!objectInfo) - return; - - if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) - return; - - GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); - uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); - - if (!object->Create(guidLow, objectInfo->entry, sMapMgr->FindMap(1, 0), GetGuildPhase(player->GetGuild()), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) - { - delete object; - return; - } - - // fill the gameobject data and save to the db - object->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player->GetGuild())); - // delete the old object and do a clean load from DB with a fresh new GameObject instance. - // this is required to avoid weird behavior and memory leaks - delete object; - - object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); - // this will generate a new guid if the object is in an instance - if (!object->LoadGameObjectFromDB(guidLow, sMapMgr->FindMap(1, 0))) - { - delete object; - return; - } - - // TODO: is it really necessary to add both the real and DB table guid here ? - sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); - CloseGossipMenuFor(player); - } - - void SpawnAssistantNPC(Player* player) - { - uint32 entry = 70102; - float posX = 16202.185547f; - float posY = 16255.916992f; - float posZ = 21.160221f; - float ori = 6.195375f; - - Creature* creature = new Creature(); - - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), sMapMgr->FindMap(1, 0), GetGuildPhase(player->GetGuild()), 70102, 0, posX, posY, posZ, ori)) - { - delete creature; - return; - } - creature->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player->GetGuild())); - uint32 db_guid = creature->GetDBTableGUIDLow(); - - creature->CleanupsBeforeDelete(); - delete creature; - creature = new Creature(); - if (!creature->LoadCreatureFromDB(db_guid, sMapMgr->FindMap(1, 0))) - { - delete creature; - return; - } - - sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid)); - return; - } + uint32 entry = 191164; + float posX; + float posY; + float posZ; + float ori; + + QueryResult result = WorldDatabase.PQuery("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry` = %u", entry); + + if (!result) + return; + + do + { + Field* fields = result->Fetch(); + posX = fields[0].GetFloat(); + posY = fields[1].GetFloat(); + posZ = fields[2].GetFloat(); + ori = fields[3].GetFloat(); + + } while (result->NextRow()); + + if (player->FindNearestGameObject(entry, VISIBLE_RANGE)) + { + ChatHandler(player->GetSession()).PSendSysMessage("You already have this object!"); + CloseGossipMenuFor(player); + return; + } + + uint32 objectId = entry; + if (!objectId) + return; + + const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId); + + if (!objectInfo) + return; + + if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) + return; + + GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); + uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); + + //if (!object->Create(guidLow, objectInfo->entry, sMapMgr->FindMap(1, 0), GetGuildPhase(player->GetGuild()), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) + if (!object->Create(guidLow, objectInfo->entry, sMapMgr->FindMap(1, 0), GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) + { + delete object; + return; + } + + // fill the gameobject data and save to the db + //object->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player->GetGuild())); + object->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player)); + // delete the old object and do a clean load from DB with a fresh new GameObject instance. + // this is required to avoid weird behavior and memory leaks + delete object; + + object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); + // this will generate a new guid if the object is in an instance + if (!object->LoadGameObjectFromDB(guidLow, sMapMgr->FindMap(1, 0))) + { + delete object; + return; + } + + // TODO: is it really necessary to add both the real and DB table guid here ? + sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); + CloseGossipMenuFor(player); + } + + void SpawnAssistantNPC(Player* player) + { + uint32 entry = 70102; + float posX = 16202.185547f; + float posY = 16255.916992f; + float posZ = 21.160221f; + float ori = 6.195375f; + + Creature* creature = new Creature(); + + //if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), sMapMgr->FindMap(1, 0), GetGuildPhase(player->GetGuild()), 70102, 0, posX, posY, posZ, ori)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), sMapMgr->FindMap(1, 0), GetGuildPhase(player), 70102, 0, posX, posY, posZ, ori)) + { + delete creature; + return; + } + //creature->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player->GetGuild())); + creature->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player)); + uint32 db_guid = creature->GetDBTableGUIDLow(); + + creature->CleanupsBeforeDelete(); + delete creature; + creature = new Creature(); + if (!creature->LoadCreatureFromDB(db_guid, sMapMgr->FindMap(1, 0))) + { + delete creature; + return; + } + + sObjectMgr->AddCreatureToGrid(db_guid, sObjectMgr->GetCreatureData(db_guid)); + return; + } bool BuyGuildHouse(Guild* guild, Player* player, Creature* creature) { @@ -423,6 +432,7 @@ class GuildHouseSeller : public CreatureScript { } while (result->NextRow()); } + }; class GuildHouseV2PlayerScript : public PlayerScript @@ -442,23 +452,7 @@ class GuildHouseV2PlayerScript : public PlayerScript else player->SetPhaseMask(GetNormalPhase(player), true); } -/* - // WIP - Anhanga, per Stoabrogga suggestion - uint32 GetNormalPhase(Player* player) const - { - if (player->IsGameMaster()) - return uint32(PHASEMASK_ANYWHERE); - uint32 phase = PHASEMASK_NORMAL; - Player::AuraEffectList const& phases = player->GetAuraEffectsByType(SPELL_AURA_PHASE); - if (!phases.empty()) - phase = phases.front()->GetMiscValue(); - if (uint32 n_phase = phase & ~PHASEMASK_NORMAL) - return n_phase; - - return PHASEMASK_NORMAL; - } -*/ uint32 GetNormalPhase(Player* player) const { if (player->IsGameMaster()) @@ -476,21 +470,21 @@ class GuildHouseV2PlayerScript : public PlayerScript GuildData* guildData = player->CustomData.GetDefault("phase"); QueryResult result = CharacterDatabase.PQuery("SELECT `id`, `guild`, `phase`, `map`,`positionX`, `positionY`, `positionZ` FROM guild_house WHERE `guild` = %u", player->GetGuildId()); - if (!result) - return; - - do { + if (result) + { + do { - Field* fields = result->Fetch(); - uint32 id = fields[0].GetUInt32(); - uint32 guild = fields[1].GetUInt32(); - guildData->phase = fields[2].GetUInt32(); - uint32 map = fields[3].GetUInt32(); - guildData->posX = fields[4].GetFloat(); - guildData->posY = fields[5].GetFloat(); - guildData->posZ = fields[6].GetFloat(); + Field* fields = result->Fetch(); + uint32 id = fields[0].GetUInt32(); + uint32 guild = fields[1].GetUInt32(); + guildData->phase = fields[2].GetUInt32(); + uint32 map = fields[3].GetUInt32(); + guildData->posX = fields[4].GetFloat(); + guildData->posY = fields[5].GetFloat(); + guildData->posZ = fields[6].GetFloat(); - } while (result->NextRow()); + } while (result->NextRow()); + } if (player->GetZoneId() == 876 && player->GetAreaId() == 876) // GM Island { @@ -540,31 +534,31 @@ class GuildHouseCommand : public CommandScript return GuildHouseCommandBaseTable; } - static uint32 GetGuildPhase(Player* player) { - return player->GetGuildId() + 10; - } + static uint32 GetGuildPhase(Player* player) { + return player->GetGuildId() + 10; + } static bool HandleSpawnNPCCommand(ChatHandler* handler, char const* /*args*/) { Player* player = handler->GetSession()->GetPlayer(); - if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { - handler->SendSysMessage("You must be the Guild Master of a guild to use this command!"); - handler->SetSentErrorMessage(true); - return false; - } + if (player->GetGuild()->GetLeaderGUID() != player->GetGUID()) { + handler->SendSysMessage("You must be the Guild Master of a guild to use this command!"); + handler->SetSentErrorMessage(true); + return false; + } - if (player->GetAreaId() != 876) { - handler->SendSysMessage("You must be in your Guild House to use this command!"); - handler->SetSentErrorMessage(true); - return false; - } + if (player->GetAreaId() != 876) { + handler->SendSysMessage("You must be in your Guild House to use this command!"); + handler->SetSentErrorMessage(true); + return false; + } - if (player->FindNearestCreature(70102, VISIBLE_RANGE, true)) { - handler->SendSysMessage("You already have the Guild House Assistant!"); - handler->SetSentErrorMessage(true); - return false; - } + if (player->FindNearestCreature(70102, VISIBLE_RANGE, true)) { + handler->SendSysMessage("You already have the Guild House Assistant!"); + handler->SetSentErrorMessage(true); + return false; + } float posX = 16202.185547f; float posY = 16255.916992f; @@ -575,8 +569,8 @@ class GuildHouseCommand : public CommandScript if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), player->GetMap(), GetGuildPhase(player), 70102, 0, posX, posY, posZ, ori)) { - handler->SendSysMessage("You already have the Guild House Assistant!"); - handler->SetSentErrorMessage(true); + handler->SendSysMessage("You already have the Guild House Assistant!"); + handler->SetSentErrorMessage(true); delete creature; return false; } @@ -588,8 +582,8 @@ class GuildHouseCommand : public CommandScript creature = new Creature(); if (!creature->LoadCreatureFromDB(db_guid, player->GetMap())) { - handler->SendSysMessage("Something went wrong when adding the NPC."); - handler->SetSentErrorMessage(true); + handler->SendSysMessage("Something went wrong when adding the NPC."); + handler->SetSentErrorMessage(true); delete creature; return false; } @@ -605,19 +599,19 @@ class GuildHouseCommand : public CommandScript if (!player) return false; - if (player->IsInCombat()) { - handler->SendSysMessage("You can't use this command while in combat!"); - handler->SetSentErrorMessage(true); - return false; - } + if (player->IsInCombat()) { + handler->SendSysMessage("You can't use this command while in combat!"); + handler->SetSentErrorMessage(true); + return false; + } GuildData* guildData = player->CustomData.GetDefault("phase"); QueryResult result = CharacterDatabase.PQuery("SELECT `id`, `guild`, `phase`, `map`,`positionX`, `positionY`, `positionZ` FROM guild_house WHERE `guild` = %u", player->GetGuildId()); if (!result) { - handler->SendSysMessage("Your Guild does not own a guild house!"); - handler->SetSentErrorMessage(true); + handler->SendSysMessage("Your Guild does not own a guild house!"); + handler->SetSentErrorMessage(true); return false; } From 55c45abaaae762406e3d44f3e59407ebe2f5c358 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 17 Oct 2019 21:49:26 -0700 Subject: [PATCH 50/63] updating dalaran portal entry id and adding try catch to sql queries --- sql/world/guild_house_spawns.sql | 4 +-- src/mod_guild_house_npc.cpp | 2 -- src/mod_guild_house_v2.cpp | 53 ++++++++++++++++++++------------ 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index c2ca9d9..5d4693c 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `guild_house_spawns` ( UNIQUE KEY `entry` (`entry`) ) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8; --- Dumping data for table acore_world.guild_house_spawns: ~48 rows (approximately) +-- Dumping data for table acore_world.guild_house_spawns: ~55 rows (approximately) /*!40000 ALTER TABLE `guild_house_spawns` DISABLE KEYS */; REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orientation`, `comment`) VALUES (1, 26327, 16216.5, 16279.4, 20.9306, 0.552869, 'Paladin Trainer'), @@ -86,7 +86,7 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (41, 183326, 16202.1, 16223.1, 1.03401, 0.829316, 'Portal: Thunder Bluff (Object)'), (42, 183324, 16196.8, 16227.5, 1.37206, 0.762557, 'Portal: Silvermoon (Object)'), (43, 183321, 16196.8, 16227.5, 1.37206, 0.762557, 'Portal: Exodar (Object)'), - (44, 191164, 16207, 16216, 1.10669, 1.0453, 'Portal: Dalaran (Object)'), + (44, 195682, 16207, 16216, 1.10669, 1.0453, 'Portal: Dalaran (Object)'), (45, 187293, 16230.5, 16283.5, 13.9061, 3, 'Guild Vault (Object)'), (46, 28692, 16230.2, 16316.4, 20.8455, 6.25643, 'Trade Supplies'), (48, 28776, 16236.3, 16316.1, 20.8454, 3.06771, 'Tabard Vendor'), diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 3f65f4b..5192e7e 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -103,7 +103,6 @@ class GuildHouseSpawner : public CreatureScript { AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 183326, "Add Thunderbuff Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 183324, "Add Silvermoon Portal?", GuildHousePortal, false); } - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 191164, "Add Dalaran Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191013, "Add Shattrath Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); @@ -218,7 +217,6 @@ class GuildHouseSpawner : public CreatureScript { case 183326: // Thunder bluff portal case 183324: // Silvermoon Portal case 183321: // Exodar Portal - case 191164: // Dalaran Portal case 191013: // Shattrath Portal:Alliance case 191014: // Shattrath Portal:Horde cost = GuildHousePortal; diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 2aa0463..13c32b3 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -191,11 +191,14 @@ class GuildHouseSeller : public CreatureScript { if (action >= 100) { - CharacterDatabase.PQuery("INSERT INTO `guild_house` (guild, phase, map, positionX, positionY, positionZ) VALUES (%u, %u, %u, %f, %f, %f)", player->GetGuildId(), GetGuildPhase(player), map, posX, posY, posZ); + CharacterDatabase.PQuery("INSERT INTO `guild_house` (guild, phase, map, positionX, positionY, positionZ) VALUES (%u, %u, %u, %f, %f, %f)", + player->GetGuildId(), GetGuildPhase(player), map, posX, posY, posZ); player->ModifyMoney(-(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000))); + // Msg to purchaser and Msg Guild as purchaser ChatHandler(player->GetSession()).PSendSysMessage("You have successfully purchased a guild house"); player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We now have a Guild House!", LANG_UNIVERSAL); player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "In chat, type `.guildhouse teleport` to meet me there!", LANG_UNIVERSAL); + // Spawn a portal and the guild assistant automatically as part of purchase. SpawnDalaranPortal(player); SpawnAssistantNPC(player); } @@ -206,21 +209,23 @@ class GuildHouseSeller : public CreatureScript { return player->GetGuildId() + 10; } - uint32 GetGuildPhase(Guild* guild) { - return guild->GetId() + 10; - } - - bool RemoveGuildHouse(Player* player) { uint32 guildPhase = GetGuildPhase(player); + QueryResult CreatureResult; + QueryResult GameobjResult; + bool go = true; - ChatHandler(player->GetSession()).PSendSysMessage("Selecting from gameobject where phaseMask = %u ", guildPhase); - QueryResult GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u AND `map` = 1", guildPhase); + try { + ChatHandler(player->GetSession()).PSendSysMessage("Selecting from creature where phaseMask = %u ", guildPhase); + CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", guildPhase); + } catch (...) { + ChatHandler(player->GetSession()).PSendSysMessage("Houston, we have a problem with the creature SELECT."); + go = false; + } - ChatHandler(player->GetSession()).PSendSysMessage("Selecting from creature where phaseMask = %u ", guildPhase); - QueryResult CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", guildPhase); + if (!go){ return false; } // error in query, unsuccessful guild house delete if (CreatureResult) { Map* creatureMap = sMapMgr->FindMap(1, 0); @@ -229,25 +234,35 @@ class GuildHouseSeller : public CreatureScript { { Field* fields = CreatureResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); - ChatHandler(player->GetSession()).PSendSysMessage("CREATURE Deleting: %u", lowguid); + ChatHandler(player->GetSession()).PSendSysMessage("Deleting creatures: %u", lowguid); if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); creature->CombatStop(); creature->DeleteFromDB(); creature->AddObjectToRemoveList(); - //delete creature; + delete creature; } - } while (CreatureResult->NextRow()); - } - - if (GameobjResult) { + } while (CreatureResult->NextRow()); + } else {ChatHandler(player->GetSession()).PSendSysMessage("No creatures to delete?"); } + + try { + ChatHandler(player->GetSession()).PSendSysMessage("Selecting from gameobject where phaseMask = %u ", guildPhase); + GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u AND `map` = 2", guildPhase); + } catch (...) { + ChatHandler(player->GetSession()).PSendSysMessage("Houston, we have a problem with the gameobject SELECT"); + go = false; + } + + if (!go) { return false; } // error in query, unsuccessful guild house delete + + if (GameobjResult) { Map* gobMap = sMapMgr->FindMap(1, 0); GameObject* object = nullptr; do { Field* fields = GameobjResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); - ChatHandler(player->GetSession()).PSendSysMessage("GAMEOBJECT Deleting: %u", lowguid); + ChatHandler(player->GetSession()).PSendSysMessage("Deleting gameobjects: %u", lowguid); if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { if (object == gobMap->GetGameObject(gameObjectData->id)) { object->SetRespawnTime(0); @@ -258,7 +273,7 @@ class GuildHouseSeller : public CreatureScript { } } while (GameobjResult->NextRow()); - } + } else {ChatHandler(player->GetSession()).PSendSysMessage("No gameobjects to delete?"); } // Perform database deletes to clean up, although this may happen above in object->DeleteFromDB() & creature->DeleteFromDB() CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); @@ -274,7 +289,7 @@ class GuildHouseSeller : public CreatureScript { void SpawnDalaranPortal(Player* player) { // 195682 - Dalaran portal enterable by alliance - uint32 entry = 191164; + uint32 entry = 195682; float posX; float posY; float posZ; From 4f248daa184103db648ce77fa19b6ba801d7b334 Mon Sep 17 00:00:00 2001 From: Rob Date: Sat, 19 Oct 2019 19:53:47 -0700 Subject: [PATCH 51/63] working on removal of guild house gameobjects and creatures --- src/mod_guild_house_v2.cpp | 98 ++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 52 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 13c32b3..5d01f25 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -215,72 +215,73 @@ class GuildHouseSeller : public CreatureScript { uint32 guildPhase = GetGuildPhase(player); QueryResult CreatureResult; QueryResult GameobjResult; - bool go = true; - try { - ChatHandler(player->GetSession()).PSendSysMessage("Selecting from creature where phaseMask = %u ", guildPhase); - CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", guildPhase); - } catch (...) { - ChatHandler(player->GetSession()).PSendSysMessage("Houston, we have a problem with the creature SELECT."); - go = false; - } + // Lets find all of the gameobjects to be removed + ChatHandler(player->GetSession()).PSendSysMessage("Selecting from gameobject where phaseMask = %u ", guildPhase); + GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = '%u' AND `map` = 1", guildPhase); + // Lets find all of the creatures to be removed + ChatHandler(player->GetSession()).PSendSysMessage("Selecting from creature where phaseMask = %u ", guildPhase); + CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = '%u' and `map` = 1", guildPhase); - if (!go){ return false; } // error in query, unsuccessful guild house delete + sLog->outBasic("Removing gameobjects"); + // remove gameobjects from the deleted guild house map + if (GameobjResult) { + Map* gobMap = sMapMgr->FindMap(1, 0); + GameObject* gobject = nullptr; + do + { + Field* fields = GameobjResult->Fetch(); + uint32 lowguid = fields[0].GetInt32(); + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { + if ((gobject = gobMap->GetGameObject(gameObjectData->id))) { + if (!gobject){ sLog->outBasic("NULL gobject"); return false; } + sLog->outBasic("Deleting gameobject: %u", lowguid); + gobject->SetRespawnTime(0); + gobject->Delete(); + gobject->DeleteFromDB(); + gobject->CleanupsBeforeDelete(); + delete gobject; + sLog->outBasic("Completed deletion of gameobject: %u", lowguid); + } + } + + } while (GameobjResult->NextRow()); + } + + + sLog->outBasic("Removing creatures"); + // remove creatures from the deleted guild house map if (CreatureResult) { Map* creatureMap = sMapMgr->FindMap(1, 0); + if (!creatureMap) { sLog->outBasic("NULL creatureMap"); return false; } Creature* creature = nullptr; do { Field* fields = CreatureResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); - ChatHandler(player->GetSession()).PSendSysMessage("Deleting creatures: %u", lowguid); + sLog->outBasic("Deleting creatures: %u", lowguid); if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { + if (!cr_data) { sLog->outBasic("Data for %u not found in `creature` table.", lowguid); return false; } + sLog->outBasic("cr_data->id: %u, lowguid: %u, HIGHGUID_UNIT: %u", cr_data->id, lowguid, HIGHGUID_UNIT); creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + if (!creature) { sLog->outBasic("NULL Creature!"); return false; } creature->CombatStop(); creature->DeleteFromDB(); creature->AddObjectToRemoveList(); - delete creature; + sLog->outBasic("Completed deletion of creature: %u", lowguid); } } while (CreatureResult->NextRow()); } else {ChatHandler(player->GetSession()).PSendSysMessage("No creatures to delete?"); } - - try { - ChatHandler(player->GetSession()).PSendSysMessage("Selecting from gameobject where phaseMask = %u ", guildPhase); - GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u AND `map` = 2", guildPhase); - } catch (...) { - ChatHandler(player->GetSession()).PSendSysMessage("Houston, we have a problem with the gameobject SELECT"); - go = false; - } - if (!go) { return false; } // error in query, unsuccessful guild house delete - - if (GameobjResult) { - Map* gobMap = sMapMgr->FindMap(1, 0); - GameObject* object = nullptr; - do - { - Field* fields = GameobjResult->Fetch(); - uint32 lowguid = fields[0].GetInt32(); - ChatHandler(player->GetSession()).PSendSysMessage("Deleting gameobjects: %u", lowguid); - if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { - if (object == gobMap->GetGameObject(gameObjectData->id)) { - object->SetRespawnTime(0); - object->DeleteFromDB(); - object->CleanupsBeforeDelete(); - delete object; - } - } - } while (GameobjResult->NextRow()); - } else {ChatHandler(player->GetSession()).PSendSysMessage("No gameobjects to delete?"); } - // Perform database deletes to clean up, although this may happen above in object->DeleteFromDB() & creature->DeleteFromDB() - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", player->GetGuildId()); - ChatHandler(player->GetSession()).PSendSysMessage("Deleting from creature where phaseMask = %u ", guildPhase); - WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = %u", guildPhase); - ChatHandler(player->GetSession()).PSendSysMessage("Deleting from gameobject where phaseMask = %u ", guildPhase); - WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = %u", guildPhase); + ChatHandler(player->GetSession()).PSendSysMessage("Deleting from guild_house where guild = %u ", player->GetGuildId()); + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = '%u'", player->GetGuildId()); + ChatHandler(player->GetSession()).PSendSysMessage("Deleting from creature where phaseMask = '%u' ", guildPhase); + WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = '%u'", guildPhase); + ChatHandler(player->GetSession()).PSendSysMessage("Deleting from gameobject where phaseMask = '%u' ", guildPhase); + WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = '%u'", guildPhase); return true; @@ -310,13 +311,6 @@ class GuildHouseSeller : public CreatureScript { } while (result->NextRow()); - if (player->FindNearestGameObject(entry, VISIBLE_RANGE)) - { - ChatHandler(player->GetSession()).PSendSysMessage("You already have this object!"); - CloseGossipMenuFor(player); - return; - } - uint32 objectId = entry; if (!objectId) return; From 39d478b20324a1f3caea61aba49a273c9ac63536 Mon Sep 17 00:00:00 2001 From: Rob Date: Sun, 20 Oct 2019 17:04:04 -0700 Subject: [PATCH 52/63] latest fixes, no longer crashes when gameobject or creature not found. --- src/mod_guild_house_v2.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 5d01f25..730d6b7 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -163,13 +163,11 @@ class GuildHouseSeller : public CreatureScript { QueryResult has_gh = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); if (!has_gh) { - ChatHandler(player->GetSession()).PSendSysMessage("Your guild currently doesn't own a Guild House!"); + ChatHandler(player->GetSession()).PSendSysMessage("Your guild does not own a Guild House!"); CloseGossipMenuFor(player); return false; } - ChatHandler(player->GetSession()).PSendSysMessage("Calling RemoveGuildHouse(player)"); - if (RemoveGuildHouse(player)) { ChatHandler(player->GetSession()).PSendSysMessage("You have successfully sold your guild house."); @@ -217,10 +215,8 @@ class GuildHouseSeller : public CreatureScript { QueryResult GameobjResult; // Lets find all of the gameobjects to be removed - ChatHandler(player->GetSession()).PSendSysMessage("Selecting from gameobject where phaseMask = %u ", guildPhase); GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = '%u' AND `map` = 1", guildPhase); // Lets find all of the creatures to be removed - ChatHandler(player->GetSession()).PSendSysMessage("Selecting from creature where phaseMask = %u ", guildPhase); CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = '%u' and `map` = 1", guildPhase); @@ -255,7 +251,7 @@ class GuildHouseSeller : public CreatureScript { if (CreatureResult) { Map* creatureMap = sMapMgr->FindMap(1, 0); if (!creatureMap) { sLog->outBasic("NULL creatureMap"); return false; } - Creature* creature = nullptr; + //Creature* creature = nullptr; do { Field* fields = CreatureResult->Fetch(); @@ -264,23 +260,23 @@ class GuildHouseSeller : public CreatureScript { if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { if (!cr_data) { sLog->outBasic("Data for %u not found in `creature` table.", lowguid); return false; } sLog->outBasic("cr_data->id: %u, lowguid: %u, HIGHGUID_UNIT: %u", cr_data->id, lowguid, HIGHGUID_UNIT); - creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); - if (!creature) { sLog->outBasic("NULL Creature!"); return false; } - creature->CombatStop(); - creature->DeleteFromDB(); - creature->AddObjectToRemoveList(); - sLog->outBasic("Completed deletion of creature: %u", lowguid); + if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT), (Creature*)NULL)) + { + //creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + if (!creature) { sLog->outBasic("NULL Creature!"); return false; } + creature->CombatStop(); + creature->DeleteFromDB(); + creature->AddObjectToRemoveList(); + sLog->outBasic("Completed deletion of creature: %u", lowguid); + } else { sLog->outBasic("We probably still aren't finding a creature match..."); return false; } } } while (CreatureResult->NextRow()); - } else {ChatHandler(player->GetSession()).PSendSysMessage("No creatures to delete?"); } + } // Perform database deletes to clean up, although this may happen above in object->DeleteFromDB() & creature->DeleteFromDB() - ChatHandler(player->GetSession()).PSendSysMessage("Deleting from guild_house where guild = %u ", player->GetGuildId()); CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = '%u'", player->GetGuildId()); - ChatHandler(player->GetSession()).PSendSysMessage("Deleting from creature where phaseMask = '%u' ", guildPhase); WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = '%u'", guildPhase); - ChatHandler(player->GetSession()).PSendSysMessage("Deleting from gameobject where phaseMask = '%u' ", guildPhase); WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = '%u'", guildPhase); return true; From 184ddb1a0a2d21712202a5691e163ee46139ade3 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Oct 2019 08:25:11 -0700 Subject: [PATCH 53/63] Final round of fixes (selling guildhouse no longer crashes game), portal and seller autospawn on purchase --- conf/mod_guild_house_v2.conf.dist | 4 +- sql/world/guild_house_spawns.sql | 5 +- src/mod_guild_house_npc.cpp | 64 +++++----- src/mod_guild_house_v2.cpp | 190 +++++++++++++++++++----------- 4 files changed, 163 insertions(+), 100 deletions(-) diff --git a/conf/mod_guild_house_v2.conf.dist b/conf/mod_guild_house_v2.conf.dist index aa5df0b..189376c 100644 --- a/conf/mod_guild_house_v2.conf.dist +++ b/conf/mod_guild_house_v2.conf.dist @@ -63,12 +63,12 @@ GuildHouseObject = 500000 # GuildHousePortal = 1000000 -# GuildHouseProff +# GuildHouseProf # # Cost of profession vendors within the guild. # default = 500000 (50g) # -GuildHouseProff = 500000 +GuildHouseProf = 500000 # GuildHouseSpirit # diff --git a/sql/world/guild_house_spawns.sql b/sql/world/guild_house_spawns.sql index 5d4693c..cdb6100 100644 --- a/sql/world/guild_house_spawns.sql +++ b/sql/world/guild_house_spawns.sql @@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `guild_house_spawns` ( UNIQUE KEY `entry` (`entry`) ) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8; --- Dumping data for table acore_world.guild_house_spawns: ~55 rows (approximately) +-- Dumping data for table acore_world.guild_house_spawns: ~56 rows (approximately) /*!40000 ALTER TABLE `guild_house_spawns` DISABLE KEYS */; REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orientation`, `comment`) VALUES (1, 26327, 16216.5, 16279.4, 20.9306, 0.552869, 'Paladin Trainer'), @@ -96,7 +96,8 @@ REPLACE INTO `guild_house_spawns` (`id`, `entry`, `posX`, `posY`, `posZ`, `orien (52, 191013, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Alliance'), (53, 29636, 16233.5, 16316.1, 20.8455, 3.07558, 'Reagent Vendor'), (54, 191014, 16203, 16216, 1.10669, 1.0453, 'Portal: Shattrath (Object) - Horde'), - (55, 70104, 16242.8, 16302.1, 13.174, 4.6153, 'Ammo & Repair Vendor'); + (55, 70104, 16242.8, 16302.1, 13.174, 4.6153, 'Ammo & Repair Vendor'), + (56, 28690, 16226.97, 16267.9, 13.15, 4.6533, 'Stable Master'); /*!40000 ALTER TABLE `guild_house_spawns` ENABLE KEYS */; diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 5192e7e..80ce4f5 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -13,7 +13,7 @@ #include "Transport.h" #include "CreatureAI.h" -int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProff, GuildHouseBuyRank; +int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProf, GuildHouseBuyRank; class GuildHouseSpawner : public CreatureScript { @@ -25,7 +25,6 @@ class GuildHouseSpawner : public CreatureScript { if (player->GetGuild()) { - // WIP - Anhanga Guild* guild = sGuildMgr->GetGuildById(player->GetGuildId()); Guild::Member const* memberMe = guild->GetMember(player->GetGUID()); if (!memberMe->IsRankNotLower(GuildHouseBuyRank)) @@ -43,6 +42,7 @@ class GuildHouseSpawner : public CreatureScript { ClearGossipMenuFor(player); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 18649, "Add an Innkeeper?", GuildHouseInnKeeper, false); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Mailbox", GOSSIP_SENDER_MAIN, 184137, "Spawn a mailbox?", GuildHouseMailBox, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Stable Master", GOSSIP_SENDER_MAIN, 28690, "Spawn a Stable Master?", GuildHouseVendor, false); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Class Trainer", GOSSIP_SENDER_MAIN, 2); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Vendor", GOSSIP_SENDER_MAIN, 3); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn City Portals / Objects", GOSSIP_SENDER_MAIN, 4); @@ -89,23 +89,29 @@ class GuildHouseSpawner : public CreatureScript { ClearGossipMenuFor(player); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Forge", GOSSIP_SENDER_MAIN, 1685, "Add a forge?", GuildHouseObject, false); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Anvil", GOSSIP_SENDER_MAIN, 4087, "Add an Anvil?", GuildHouseObject, false); - if (player->GetTeamId() == TEAM_ALLIANCE) + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); + AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); + + if (player->GetTeamId() == TEAM_ALLIANCE) // ALLIANCE players get these options { - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Stormwind", GOSSIP_SENDER_MAIN, 183325, "Add Stormwind Portal?", GuildHousePortal, false); + // Commenting out as we are auto-creating Stormwind portal upon guild purchase + //AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Stormwind", GOSSIP_SENDER_MAIN, 183325, "Add Stormwind Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Ironforge", GOSSIP_SENDER_MAIN, 183322, "Add Ironforge Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Darnassus", GOSSIP_SENDER_MAIN, 183317, "Add Darnassus Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Exodar", GOSSIP_SENDER_MAIN, 183321, "Add Exodar Portal?", GuildHousePortal, false); } - else + else // HORDE players get these options: { - AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Orgrimmar", GOSSIP_SENDER_MAIN, 183323, "Add Orgrimmar Portal?", GuildHousePortal, false); + // Commenting out as we are auto-creating Orgrimmar portal upon guild purchase + //AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Orgrimmar", GOSSIP_SENDER_MAIN, 183323, "Add Orgrimmar Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Undercity", GOSSIP_SENDER_MAIN, 183327, "Add Undercity Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 183326, "Add Thunderbuff Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 183324, "Add Silvermoon Portal?", GuildHousePortal, false); } + // These two portals work for either Team AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Shattrath", GOSSIP_SENDER_MAIN, 191013, "Add Shattrath Portal?", GuildHousePortal, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Guild Vault", GOSSIP_SENDER_MAIN, 187293, "Add Guild Vault?", GuildHouseObject, false); - AddGossipItemFor(player, GOSSIP_ICON_INTERACT_1, "Barber Chair", GOSSIP_SENDER_MAIN, 191028, "Add a Barber Chair?", GuildHouseObject, false); + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Dalaran", GOSSIP_SENDER_MAIN, 195682, "Add Dalaran Portal?", GuildHousePortal, false); + AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; @@ -116,27 +122,27 @@ class GuildHouseSpawner : public CreatureScript { SpawnNPC(auctioneer, player); break; } - case 7: // spawn proffession trainers + case 7: // spawn profession trainers ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Alchemy Trainer", GOSSIP_SENDER_MAIN, 33608, "Spawn Alchemy Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Blacksmithing Trainer", GOSSIP_SENDER_MAIN, 33609, "Spawn Blacksmithing Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 33610, "Spawn Enchanting Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Engineering Trainer", GOSSIP_SENDER_MAIN, 33611, "Spawn Engineering Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Tailoring Trainer", GOSSIP_SENDER_MAIN, 33613, "Spawn Tailoring Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Leatherworking Trainer", GOSSIP_SENDER_MAIN, 33612, "Spawn Leatherworking Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Jewlelcrafing Trainer", GOSSIP_SENDER_MAIN, 33614, "Spawn Jewelcrafting Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 33615, "Spawn Inscription Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Skinning Trainer", GOSSIP_SENDER_MAIN, 33618, "Spawn Skinning Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Mining Trainer", GOSSIP_SENDER_MAIN, 33617, "Spawn Mining Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Herbalism Trainer", GOSSIP_SENDER_MAIN, 33616, "Spawn Herbalism Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Alchemy Trainer", GOSSIP_SENDER_MAIN, 33608, "Spawn Alchemy Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Blacksmithing Trainer", GOSSIP_SENDER_MAIN, 33609, "Spawn Blacksmithing Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 33610, "Spawn Enchanting Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Engineering Trainer", GOSSIP_SENDER_MAIN, 33611, "Spawn Engineering Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Tailoring Trainer", GOSSIP_SENDER_MAIN, 33613, "Spawn Tailoring Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Leatherworking Trainer", GOSSIP_SENDER_MAIN, 33612, "Spawn Leatherworking Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Jewlelcrafing Trainer", GOSSIP_SENDER_MAIN, 33614, "Spawn Jewelcrafting Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 33615, "Spawn Inscription Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Skinning Trainer", GOSSIP_SENDER_MAIN, 33618, "Spawn Skinning Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Mining Trainer", GOSSIP_SENDER_MAIN, 33617, "Spawn Mining Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Herbalism Trainer", GOSSIP_SENDER_MAIN, 33616, "Spawn Herbalism Trainer?", GuildHouseProf, false); AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; - case 8: // secondry proff trainers + case 8: // secondry prof trainers ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "First Aid Trainer", GOSSIP_SENDER_MAIN, 33621, "Spawn Fist Aid Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 33623, "Spawn Fishing Trainer?", GuildHouseProff, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 33619, "Spawn Cooking Trainer?", GuildHouseProff, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "First Aid Trainer", GOSSIP_SENDER_MAIN, 33621, "Spawn Fist Aid Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 33623, "Spawn Fishing Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 33619, "Spawn Cooking Trainer?", GuildHouseProf, false); AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; @@ -180,7 +186,7 @@ class GuildHouseSpawner : public CreatureScript { case 33619: // Cooking case 33623: // Fishing case 33621: // First Aid - cost = GuildHouseProff; + cost = GuildHouseProf; SpawnNPC(action, player); break; case 28692: // Trade supplies @@ -188,7 +194,8 @@ class GuildHouseSpawner : public CreatureScript { case 70103: // Food & Drink case 29636: // Reagent Vendor case 70104: // Ammo & Repair Vendor - cost = GuildHouseProff; + case 28690: // Stable Master + cost = GuildHouseVendor; SpawnNPC(action, player); break; // @@ -209,8 +216,6 @@ class GuildHouseSpawner : public CreatureScript { cost = GuildHouseObject; SpawnObject(action, player); break; - case 183325: // Stormwind Portal - case 183323: // Orgrimmar Portal case 183322: // Ironforge Portal case 183327: // Undercity Portal case 183317: // Darnassus Portal @@ -219,6 +224,7 @@ class GuildHouseSpawner : public CreatureScript { case 183321: // Exodar Portal case 191013: // Shattrath Portal:Alliance case 191014: // Shattrath Portal:Horde + case 195682: // Dalaran Portal cost = GuildHousePortal; SpawnObject(action, player); break; @@ -369,7 +375,7 @@ class GuildHouseNPCConf : public WorldScript GuildHouseVendor = sConfigMgr->GetIntDefault("GuildHouseVendor", 500000); GuildHouseObject = sConfigMgr->GetIntDefault("GuildHouseObject", 500000); GuildHousePortal = sConfigMgr->GetIntDefault("GuildHousePortal", 500000); - GuildHouseProff = sConfigMgr->GetIntDefault("GuildHouseProff", 500000); + GuildHouseProf = sConfigMgr->GetIntDefault("GuildHouseProf", 500000); GuildHouseSpirit = sConfigMgr->GetIntDefault("GuildHouseSpirit", 100000); GuildHouseBuyRank = sConfigMgr->GetIntDefault("GuildHouseBuyRank", 0); } diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 730d6b7..e908de0 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -42,58 +42,85 @@ class GuildHelper : public GuildScript{ void OnDisband(Guild* guild) { - QueryResult result; - - result = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); - if (result) { - Map* creatureMap = sMapMgr->FindMap(1, 0); - Creature* creature = nullptr; - do - { + if (RemoveGuildHouse(guild)) + { + sLog->outBasic("GUILDHOUSE: Deleting guild house data due to disbanding of guild..."); + } else { sLog->outBasic("GUILDHOUSE: Error deleting guild house data during disbanding of guild!!"); } - Field* fields = result->Fetch(); - uint32 lowguid = fields[0].GetInt32(); - - if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { - creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); - creature->CombatStop(); - creature->DeleteFromDB(); - creature->AddObjectToRemoveList(); - //delete creature; - } + } + bool RemoveGuildHouse(Guild* guild) + { + // TODO: Determine cost of all purchased items and return that value so we can calculate + uint32 guildPhase = GetGuildPhase(guild); + QueryResult CreatureResult; + QueryResult GameobjResult; - } while (result->NextRow()); - } + // Lets find all of the gameobjects to be removed + GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = '%u' AND `map` = 1", guildPhase); + // Lets find all of the creatures to be removed + CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = '%u' and `map` = 1", guildPhase); - result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = %u and `map` = 1", GetGuildPhase(guild)); - if (result) { + sLog->outBasic("GUILDHOUSE: Removing gameobjects from guildhouse"); + // remove gameobjects from the deleted guild house map + if (GameobjResult) { Map* gobMap = sMapMgr->FindMap(1, 0); - GameObject* object = nullptr; + GameObject* gobject = nullptr; do { - Field* fields = result->Fetch(); + Field* fields = GameobjResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); - if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { - object = gobMap->GetGameObject(gameObjectData->id); - object->SetRespawnTime(0); - object->DeleteFromDB(); - object->CleanupsBeforeDelete(); - delete object; + if ((gobject = gobMap->GetGameObject(gameObjectData->id))) { + if (!gobject){ sLog->outBasic("GUILDHOUSE: NULL gobject"); return false; } + gobject->SetRespawnTime(0); + gobject->Delete(); + gobject->DeleteFromDB(); + gobject->CleanupsBeforeDelete(); + delete gobject; + sLog->outBasic("GUILDHOUSE: Completed deletion of gameobject: %u", lowguid); + } } - } while (result->NextRow()); + } while (GameobjResult->NextRow()); } + - WorldDatabase.PQuery("DELETE FROM `creature` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); - WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE map = 1 AND phaseMask = %u", GetGuildPhase(guild)); + sLog->outBasic("GUILDHOUSE: Removing creatures from guildhouse"); + // remove creatures from the deleted guild house map + if (CreatureResult) { + Map* creatureMap = sMapMgr->FindMap(1, 0); + if (!creatureMap) { sLog->outBasic("GUILDHOUSE: NULL creatureMap"); return false; } + do + { + Field* fields = CreatureResult->Fetch(); + uint32 lowguid = fields[0].GetInt32(); + if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { + if (!cr_data) { sLog->outBasic("GUILDHOUSE: Data for %u not found in `creature` table.", lowguid); return false; } + if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT), (Creature*)NULL)) + { + //creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); + if (!creature) { sLog->outBasic("GUILDHOUSE: NULL Creature!"); return false; } + creature->CombatStop(); + creature->DeleteFromDB(); + creature->AddObjectToRemoveList(); + delete creature; + sLog->outBasic("GUILDHOUSE: Completed deletion of creature: %u", lowguid); + } else { sLog->outBasic("We probably still aren't finding a creature match..."); return false; } + } + } while (CreatureResult->NextRow()); + } + + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = '%u'", guild->GetId()); + //WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = '%u'", guildPhase); + //WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = '%u'", guildPhase); + + return true; - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = %u", guild->GetId()); - } + }; class GuildHouseSeller : public CreatureScript { @@ -159,7 +186,6 @@ class GuildHouseSeller : public CreatureScript { break; case 3: // Sell back guild house { - QueryResult has_gh = CharacterDatabase.PQuery("SELECT id, `guild` FROM `guild_house` WHERE guild = %u", player->GetGuildId()); if (!has_gh) { @@ -168,15 +194,19 @@ class GuildHouseSeller : public CreatureScript { return false; } + // Calculate total gold returned: 1) cost of guildhouse and cost of each purchase made. if (RemoveGuildHouse(player)) { ChatHandler(player->GetSession()).PSendSysMessage("You have successfully sold your guild house."); player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We just sold our guild house.", LANG_UNIVERSAL); player->ModifyMoney(+(sConfigMgr->GetIntDefault("CostGuildHouse", 10000000) / 2)); + sLog->outBasic("GUILDHOUSE: Successfully returned money and sold guildhouse"); CloseGossipMenuFor(player); } else { ChatHandler(player->GetSession()).PSendSysMessage("There was an error selling your guild house."); + CloseGossipMenuFor(player); } + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE `guild` = '%u'", player->GetGuildId()); break; } case 2: // buy guild house @@ -196,10 +226,14 @@ class GuildHouseSeller : public CreatureScript { ChatHandler(player->GetSession()).PSendSysMessage("You have successfully purchased a guild house"); player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "We now have a Guild House!", LANG_UNIVERSAL); player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "In chat, type `.guildhouse teleport` to meet me there!", LANG_UNIVERSAL); + sLog->outBasic("GUILDHOUSE: GuildId: '%u' has purchased a guildhouse", player->GetGuildId()); + // Spawn a portal and the guild assistant automatically as part of purchase. - SpawnDalaranPortal(player); + SpawnStarterPortal(player); SpawnAssistantNPC(player); + CloseGossipMenuFor(player); } + return true; } @@ -215,12 +249,12 @@ class GuildHouseSeller : public CreatureScript { QueryResult GameobjResult; // Lets find all of the gameobjects to be removed - GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = '%u' AND `map` = 1", guildPhase); + GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `map` = 1 AND `phaseMask` = '%u'", guildPhase); // Lets find all of the creatures to be removed - CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = '%u' and `map` = 1", guildPhase); + CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `map` = 1 AND `phaseMask` = '%u'", guildPhase); - sLog->outBasic("Removing gameobjects"); + sLog->outBasic("GUILDHOUSE: Removing gameobjects from guildhouse"); // remove gameobjects from the deleted guild house map if (GameobjResult) { Map* gobMap = sMapMgr->FindMap(1, 0); @@ -231,14 +265,14 @@ class GuildHouseSeller : public CreatureScript { uint32 lowguid = fields[0].GetInt32(); if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { if ((gobject = gobMap->GetGameObject(gameObjectData->id))) { - if (!gobject){ sLog->outBasic("NULL gobject"); return false; } - sLog->outBasic("Deleting gameobject: %u", lowguid); + if (!gobject){ sLog->outBasic("GUILDHOUSE: NULL gobject"); return false; } gobject->SetRespawnTime(0); gobject->Delete(); gobject->DeleteFromDB(); gobject->CleanupsBeforeDelete(); delete gobject; - sLog->outBasic("Completed deletion of gameobject: %u", lowguid); + WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `guid` = '%u'", lowguid); + sLog->outBasic("GUILDHOUSE: Completed deletion of gameobject: %u", lowguid); } } @@ -246,56 +280,65 @@ class GuildHouseSeller : public CreatureScript { } - sLog->outBasic("Removing creatures"); + sLog->outBasic("GUILDHOUSE: Removing creatures from guildhouse"); // remove creatures from the deleted guild house map if (CreatureResult) { Map* creatureMap = sMapMgr->FindMap(1, 0); - if (!creatureMap) { sLog->outBasic("NULL creatureMap"); return false; } - //Creature* creature = nullptr; + if (!creatureMap) { sLog->outBasic("GUILDHOUSE: NULL creatureMap"); return false; } do { Field* fields = CreatureResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); - sLog->outBasic("Deleting creatures: %u", lowguid); if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { - if (!cr_data) { sLog->outBasic("Data for %u not found in `creature` table.", lowguid); return false; } - sLog->outBasic("cr_data->id: %u, lowguid: %u, HIGHGUID_UNIT: %u", cr_data->id, lowguid, HIGHGUID_UNIT); + if (!cr_data) { sLog->outBasic("GUILDHOUSE: Data for %u not found in `creature` table.", lowguid); return false; } if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT), (Creature*)NULL)) { //creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); - if (!creature) { sLog->outBasic("NULL Creature!"); return false; } + if (!creature) { sLog->outBasic("GUILDHOUSE: NULL Creature!"); return false; } creature->CombatStop(); creature->DeleteFromDB(); creature->AddObjectToRemoveList(); - sLog->outBasic("Completed deletion of creature: %u", lowguid); - } else { sLog->outBasic("We probably still aren't finding a creature match..."); return false; } + sLog->outBasic("GUILDHOUSE: Completed deletion of creature: %u", lowguid); + } } } while (CreatureResult->NextRow()); } - // Perform database deletes to clean up, although this may happen above in object->DeleteFromDB() & creature->DeleteFromDB() - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = '%u'", player->GetGuildId()); - WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = '%u'", guildPhase); - WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = '%u'", guildPhase); - return true; } - void SpawnDalaranPortal(Player* player) + void SpawnStarterPortal(Player* player) { - // 195682 - Dalaran portal enterable by alliance - uint32 entry = 195682; + + uint32 entry = 0; float posX; float posY; float posZ; float ori; + Map* map = sMapMgr->FindMap(1,0); + + if (player->GetTeamId() == TEAM_ALLIANCE) + { + // Portal to Stormwind + entry = 183325; + } else { + // Portal to Orgrimmar + entry = 183323; + } + + + if (entry == 0) { sLog->outBasic("Error with SpawnStarterPortal in GuildHouse Module!"); return; } + QueryResult result = WorldDatabase.PQuery("SELECT `posX`, `posY`, `posZ`, `orientation` FROM `guild_house_spawns` WHERE `entry` = %u", entry); if (!result) + { + sLog->outBasic("GUILDHOUSE: Unable to find data on portal for entry: '%u'", entry); return; + } do { @@ -307,30 +350,42 @@ class GuildHouseSeller : public CreatureScript { } while (result->NextRow()); + uint32 objectId = entry; if (!objectId) + { + sLog->outBasic("GUILDHOUSE: objectId IS NULL, should be '%u'", entry); return; + } const GameObjectTemplate* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId); if (!objectInfo) + { + sLog->outBasic("GUILDHOUSE: objectInfo is NULL!"); return; + } if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId)) + { + sLog->outBasic("GUILDHOUSE: Unable to find displayId??"); return; + } GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); - //if (!object->Create(guidLow, objectInfo->entry, sMapMgr->FindMap(1, 0), GetGuildPhase(player->GetGuild()), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) - if (!object->Create(guidLow, objectInfo->entry, sMapMgr->FindMap(1, 0), GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) + sLog->outBasic("GUILDHOUSE: Found portal(%u) to place: posX: %f, posY: %f, posZ: %f | Created '%u'", entry, posX, posY, posZ, guidLow); + + if (!object->Create(guidLow, objectInfo->entry, map, GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) { delete object; + sLog->outBasic("GUILDHOUSE: Unable to create object!!"); return; } + // fill the gameobject data and save to the db - //object->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player->GetGuild())); object->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player)); // delete the old object and do a clean load from DB with a fresh new GameObject instance. // this is required to avoid weird behavior and memory leaks @@ -347,6 +402,7 @@ class GuildHouseSeller : public CreatureScript { // TODO: is it really necessary to add both the real and DB table guid here ? sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); CloseGossipMenuFor(player); + sLog->outBasic("GUILDHOUSE: Supposedly we just loaded the portal with id: '%u'", entry); } void SpawnAssistantNPC(Player* player) @@ -359,13 +415,11 @@ class GuildHouseSeller : public CreatureScript { Creature* creature = new Creature(); - //if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), sMapMgr->FindMap(1, 0), GetGuildPhase(player->GetGuild()), 70102, 0, posX, posY, posZ, ori)) - if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), sMapMgr->FindMap(1, 0), GetGuildPhase(player), 70102, 0, posX, posY, posZ, ori)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), sMapMgr->FindMap(1, 0), GetGuildPhase(player), entry, 0, posX, posY, posZ, ori)) { delete creature; return; } - //creature->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player->GetGuild())); creature->SaveToDB(sMapMgr->FindMap(1, 0)->GetId(), (1 << sMapMgr->FindMap(1, 0)->GetSpawnMode()), GetGuildPhase(player)); uint32 db_guid = creature->GetDBTableGUIDLow(); @@ -395,7 +449,8 @@ class GuildHouseSeller : public CreatureScript { ClearGossipMenuFor(player); AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "GM Island", GOSSIP_SENDER_MAIN, 100, "Buy Guild House on GM Island?", sConfigMgr->GetIntDefault("CostGuildHouse", 10000000), false); - AddGossipItemFor(player, GOSSIP_ICON_CHAT, " ----- More to Come ----", GOSSIP_SENDER_MAIN, 4); + // Removing this tease for now, as right now the phasing code is specific go GM Island, so its not a simple thing to add new areas yet. + //AddGossipItemFor(player, GOSSIP_ICON_CHAT, " ----- More to Come ----", GOSSIP_SENDER_MAIN, 4); SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, creature->GetGUID()); return true; @@ -494,6 +549,7 @@ class GuildHouseV2PlayerScript : public PlayerScript if (player->GetZoneId() == 876 && player->GetAreaId() == 876) // GM Island { // If player is not in a guild he doesnt have a guild house teleport away + // TODO: What if they are in a guild, but somehow are in the wrong phaseMask and seeing someone else's area? if (!result || !player->GetGuild()) { From 83f6a90b87fbea10accc49742e19765bbb18cde6 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Oct 2019 13:51:01 -0700 Subject: [PATCH 54/63] WIP: deleting gameobjects from sold guildhouse --- src/mod_guild_house_v2.cpp | 64 ++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 34 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index e908de0..43af68e 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -206,7 +206,6 @@ class GuildHouseSeller : public CreatureScript { ChatHandler(player->GetSession()).PSendSysMessage("There was an error selling your guild house."); CloseGossipMenuFor(player); } - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE `guild` = '%u'", player->GetGuildId()); break; } case 2: // buy guild house @@ -247,6 +246,7 @@ class GuildHouseSeller : public CreatureScript { uint32 guildPhase = GetGuildPhase(player); QueryResult CreatureResult; QueryResult GameobjResult; + Map* map = sMapMgr->FindMap(1,0); // Lets find all of the gameobjects to be removed GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `map` = 1 AND `phaseMask` = '%u'", guildPhase); @@ -254,46 +254,16 @@ class GuildHouseSeller : public CreatureScript { CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `map` = 1 AND `phaseMask` = '%u'", guildPhase); - sLog->outBasic("GUILDHOUSE: Removing gameobjects from guildhouse"); - // remove gameobjects from the deleted guild house map - if (GameobjResult) { - Map* gobMap = sMapMgr->FindMap(1, 0); - GameObject* gobject = nullptr; - do - { - Field* fields = GameobjResult->Fetch(); - uint32 lowguid = fields[0].GetInt32(); - if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { - if ((gobject = gobMap->GetGameObject(gameObjectData->id))) { - if (!gobject){ sLog->outBasic("GUILDHOUSE: NULL gobject"); return false; } - gobject->SetRespawnTime(0); - gobject->Delete(); - gobject->DeleteFromDB(); - gobject->CleanupsBeforeDelete(); - delete gobject; - WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `guid` = '%u'", lowguid); - sLog->outBasic("GUILDHOUSE: Completed deletion of gameobject: %u", lowguid); - } - } - - } while (GameobjResult->NextRow()); - } - - - sLog->outBasic("GUILDHOUSE: Removing creatures from guildhouse"); // remove creatures from the deleted guild house map if (CreatureResult) { - Map* creatureMap = sMapMgr->FindMap(1, 0); - if (!creatureMap) { sLog->outBasic("GUILDHOUSE: NULL creatureMap"); return false; } + sLog->outBasic("GUILDHOUSE: Removing creatures from guildhouse"); do { Field* fields = CreatureResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { - if (!cr_data) { sLog->outBasic("GUILDHOUSE: Data for %u not found in `creature` table.", lowguid); return false; } if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT), (Creature*)NULL)) { - //creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); if (!creature) { sLog->outBasic("GUILDHOUSE: NULL Creature!"); return false; } creature->CombatStop(); creature->DeleteFromDB(); @@ -305,6 +275,34 @@ class GuildHouseSeller : public CreatureScript { } + // remove gameobjects from the deleted guild house map + if (GameobjResult) { + sLog->outBasic("GUILDHOUSE: Removing gameobjects from guildhouse"); + do + { + Field* fields = GameobjResult->Fetch(); + uint32 lowguid = fields[0].GetInt32(); + sLog->outBasic("GUILDHOUSE: Starting deletion of gameobject: %u", lowguid); + if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) { + sLog->outBasic("GUILDHOUSE: lowguid: '%u', go_data->id: '%u', HIGHGUID_GAMEOBJECT: '%u'", lowguid, go_data->id, HIGHGUID_GAMEOBJECT); + if (GameObject* gobject = ObjectAccessor::GetObjectInWorld(lowguid, (GameObject*)NULL)) + { + gobject->SetRespawnTime(0); + gobject->Delete(); + gobject->DeleteFromDB(); + gobject->CleanupsBeforeDelete(); + delete gobject; + WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `guid` = '%u'", lowguid); + sLog->outBasic("GUILDHOUSE: Completed deletion of gameobject: %u", lowguid); + } else { sLog->outBasic("GUILDHOUSE: gobject IS NULL, when it shouldn't be. "); return false; } + } else { sLog->outBasic("GUILDHOUSE: sObjectMgr->GetGOData(lowguid) returned NULL"); return false; } + + } while (GameobjResult->NextRow()); + } else { sLog->outBasic("GUILDHOUSE: What?? For some reason GameobjResult is NULL?"); return false;} + + // Delete actual guild_house data from characters database + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE `guild` = '%u'", player->GetGuildId()); + return true; } @@ -375,7 +373,6 @@ class GuildHouseSeller : public CreatureScript { GameObject* object = sObjectMgr->IsGameObjectStaticTransport(objectInfo->entry) ? new StaticTransport() : new GameObject(); uint32 guidLow = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); - sLog->outBasic("GUILDHOUSE: Found portal(%u) to place: posX: %f, posY: %f, posZ: %f | Created '%u'", entry, posX, posY, posZ, guidLow); if (!object->Create(guidLow, objectInfo->entry, map, GetGuildPhase(player), posX, posY, posZ, ori, G3D::Quat(), 0, GO_STATE_READY)) { @@ -402,7 +399,6 @@ class GuildHouseSeller : public CreatureScript { // TODO: is it really necessary to add both the real and DB table guid here ? sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGOData(guidLow)); CloseGossipMenuFor(player); - sLog->outBasic("GUILDHOUSE: Supposedly we just loaded the portal with id: '%u'", entry); } void SpawnAssistantNPC(Player* player) From 168d70001775082391c75403038248306ddb2f76 Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Oct 2019 15:38:32 -0700 Subject: [PATCH 55/63] Wrapping up last changes, RemoveGuildHouse function now works. --- src/mod_guild_house_v2.cpp | 98 ++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 58 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 43af68e..83779a1 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -52,76 +52,64 @@ class GuildHelper : public GuildScript{ bool RemoveGuildHouse(Guild* guild) { - // TODO: Determine cost of all purchased items and return that value so we can calculate + uint32 guildPhase = GetGuildPhase(guild); QueryResult CreatureResult; - QueryResult GameobjResult; + QueryResult GameobjResult; + Map* map = sMapMgr->FindMap(1,0); - // Lets find all of the gameobjects to be removed - GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `phaseMask` = '%u' AND `map` = 1", guildPhase); + // Lets find all of the gameobjects to be removed + GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `map` = 1 AND `phaseMask` = '%u'", guildPhase); // Lets find all of the creatures to be removed - CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `phaseMask` = '%u' and `map` = 1", guildPhase); - - - sLog->outBasic("GUILDHOUSE: Removing gameobjects from guildhouse"); - // remove gameobjects from the deleted guild house map - if (GameobjResult) { - Map* gobMap = sMapMgr->FindMap(1, 0); - GameObject* gobject = nullptr; - do - { - Field* fields = GameobjResult->Fetch(); - uint32 lowguid = fields[0].GetInt32(); - if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(lowguid)) { - if ((gobject = gobMap->GetGameObject(gameObjectData->id))) { - if (!gobject){ sLog->outBasic("GUILDHOUSE: NULL gobject"); return false; } - gobject->SetRespawnTime(0); - gobject->Delete(); - gobject->DeleteFromDB(); - gobject->CleanupsBeforeDelete(); - delete gobject; - sLog->outBasic("GUILDHOUSE: Completed deletion of gameobject: %u", lowguid); - } - } + CreatureResult = WorldDatabase.PQuery("SELECT `guid` FROM `creature` WHERE `map` = 1 AND `phaseMask` = '%u'", guildPhase); - } while (GameobjResult->NextRow()); - } - - sLog->outBasic("GUILDHOUSE: Removing creatures from guildhouse"); // remove creatures from the deleted guild house map if (CreatureResult) { - Map* creatureMap = sMapMgr->FindMap(1, 0); - if (!creatureMap) { sLog->outBasic("GUILDHOUSE: NULL creatureMap"); return false; } do { Field* fields = CreatureResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { - if (!cr_data) { sLog->outBasic("GUILDHOUSE: Data for %u not found in `creature` table.", lowguid); return false; } if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT), (Creature*)NULL)) { - //creature = creatureMap->GetCreature(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT)); - if (!creature) { sLog->outBasic("GUILDHOUSE: NULL Creature!"); return false; } creature->CombatStop(); creature->DeleteFromDB(); creature->AddObjectToRemoveList(); - delete creature; - sLog->outBasic("GUILDHOUSE: Completed deletion of creature: %u", lowguid); - } else { sLog->outBasic("We probably still aren't finding a creature match..."); return false; } + } } } while (CreatureResult->NextRow()); } - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE guild = '%u'", guild->GetId()); - //WorldDatabase.PQuery("DELETE FROM `creature` WHERE `map` = 1 AND phaseMask = '%u'", guildPhase); - //WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `map` = 1 and phaseMask = '%u'", guildPhase); + + // remove gameobjects from the deleted guild house map + if (GameobjResult) { + do + { + Field* fields = GameobjResult->Fetch(); + uint32 lowguid = fields[0].GetInt32(); + if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) { + //if (GameObject* gobject = ObjectAccessor::GetObjectInWorld(lowguid, (GameObject*)NULL)) + if (GameObject* gobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(lowguid, go_data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL)) + { + gobject->SetRespawnTime(0); + gobject->Delete(); + gobject->DeleteFromDB(); + gobject->CleanupsBeforeDelete(); + //delete gobject; + } + } + + } while (GameobjResult->NextRow()); + } + + // Delete actual guild_house data from characters database + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE `guild` = '%u'", player->GetGuildId()); return true; - } + } -}; class GuildHouseSeller : public CreatureScript { @@ -239,7 +227,8 @@ class GuildHouseSeller : public CreatureScript { uint32 GetGuildPhase(Player* player) { return player->GetGuildId() + 10; } - + + bool RemoveGuildHouse(Player* player) { @@ -256,7 +245,6 @@ class GuildHouseSeller : public CreatureScript { // remove creatures from the deleted guild house map if (CreatureResult) { - sLog->outBasic("GUILDHOUSE: Removing creatures from guildhouse"); do { Field* fields = CreatureResult->Fetch(); @@ -264,11 +252,9 @@ class GuildHouseSeller : public CreatureScript { if (CreatureData const* cr_data = sObjectMgr->GetCreatureData(lowguid)) { if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(lowguid, cr_data->id, HIGHGUID_UNIT), (Creature*)NULL)) { - if (!creature) { sLog->outBasic("GUILDHOUSE: NULL Creature!"); return false; } creature->CombatStop(); creature->DeleteFromDB(); creature->AddObjectToRemoveList(); - sLog->outBasic("GUILDHOUSE: Completed deletion of creature: %u", lowguid); } } } while (CreatureResult->NextRow()); @@ -277,28 +263,24 @@ class GuildHouseSeller : public CreatureScript { // remove gameobjects from the deleted guild house map if (GameobjResult) { - sLog->outBasic("GUILDHOUSE: Removing gameobjects from guildhouse"); do { Field* fields = GameobjResult->Fetch(); uint32 lowguid = fields[0].GetInt32(); - sLog->outBasic("GUILDHOUSE: Starting deletion of gameobject: %u", lowguid); if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) { - sLog->outBasic("GUILDHOUSE: lowguid: '%u', go_data->id: '%u', HIGHGUID_GAMEOBJECT: '%u'", lowguid, go_data->id, HIGHGUID_GAMEOBJECT); - if (GameObject* gobject = ObjectAccessor::GetObjectInWorld(lowguid, (GameObject*)NULL)) + //if (GameObject* gobject = ObjectAccessor::GetObjectInWorld(lowguid, (GameObject*)NULL)) + if (GameObject* gobject = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(lowguid, go_data->id, HIGHGUID_GAMEOBJECT), (GameObject*)NULL)) { gobject->SetRespawnTime(0); gobject->Delete(); gobject->DeleteFromDB(); gobject->CleanupsBeforeDelete(); - delete gobject; - WorldDatabase.PQuery("DELETE FROM `gameobject` WHERE `guid` = '%u'", lowguid); - sLog->outBasic("GUILDHOUSE: Completed deletion of gameobject: %u", lowguid); - } else { sLog->outBasic("GUILDHOUSE: gobject IS NULL, when it shouldn't be. "); return false; } - } else { sLog->outBasic("GUILDHOUSE: sObjectMgr->GetGOData(lowguid) returned NULL"); return false; } + //delete gobject; + } + } } while (GameobjResult->NextRow()); - } else { sLog->outBasic("GUILDHOUSE: What?? For some reason GameobjResult is NULL?"); return false;} + } // Delete actual guild_house data from characters database CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE `guild` = '%u'", player->GetGuildId()); From 71e3a6caf78ac48157de49122aa188dcb0f34dcf Mon Sep 17 00:00:00 2001 From: Rob Date: Tue, 29 Oct 2019 15:53:08 -0700 Subject: [PATCH 56/63] Final? commits and README update --- README.md | 23 ++++++++++++----------- src/mod_guild_house_npc.cpp | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1c050b6..d3e0010 100644 --- a/README.md +++ b/README.md @@ -5,26 +5,27 @@ ## Description -This is a phased guild house system for Azerothcore, it allows players to from the same guild to visit their guild house. -All guilds will get their own phasing system which then the guild master will have to purchase NPC's creatures and other stuff to complete the creation. +This is a phased guild house system for AzerothCore, it allows players from the same guild to visit their guild house. +All guilds will get their own phasing system and then the guild master can purchase NPC creatures and other stuff to complete the Guild House. ### Purchasables * Class Trainers (all available in Wrath) * Primary Profession Trainers (all available in Wrath) * Secondary Profession Trainers (all available in Wrath) -* Vendors: Reagents, Food & Water and Trade Goods +* Vendors: Reagents Vendor, Food & Water, Trade Goods, and Repairs/Ammo Vendor * Portals to Neutral, Horde and Alliance cities * Spirit Healer * Guild Bank and Personal Bank access * Auctioneer +* Stable Master ## How to use ingame -1) As GM: `.npc add 70101` -> somewhere public and accessible by other players. -2) Purchase a guild house from the added NPC, then either teleport to the guildhouse via the NPC or chat: `.guildhouse tele` -3) Once the player is in the location of the guild house the guild master has a command .guildhouse SpawnNpc this will load the Guild House Assistant. (WIP: NPC automatically spawns as part of the purchase sequence) -4) Speak with the Guild House Assistant to begin purchasing objects. +1) After installation, as GM you will need to: `.npc add 70101` -> somewhere public and accessible by other players. +2) Players can purchase a guild house from the added NPC, then either teleport to the guildhouse via the NPC or chat: `.guildhouse tele` +3) Each new Guild House starts with a portal to either Orgrimmar or Stormwind, based on Team (ALLIANCE / HORDE), and the Guild House Assistant. +4) Speak with the Guild House Assistant to begin purchasing additions to your Guild House! ## Requirements @@ -33,15 +34,15 @@ All guilds will get their own phasing system which then the guild master will ha ## Installation ``` -1) Simply place the module under the `modules` directory of your AzerothCore source. -2) Import the SQL manually to the right Database (auth, world or characters) +1) Place the module under the `modules` directory of your AzerothCore source. +2) Import the SQL files manually to the right Database (auth, world or characters) 3) Apply the guildhouse.patch to your source 4) Re-run cmake and launch a clean build of AzerothCore. ``` ## Patch Information (guildhouse.patch) -The patch basically turns the selected area from a bitmask to a uint, this fixes the issues with the phasing +The patch basically turns the selected area from a bitmask to a uint, this fixes the issues with the phasing on GM Island ONLY Before Patch : Guild 1 Can see phase 1 @@ -59,6 +60,6 @@ If you need to change the module configuration, go to your server configuration * [Talamortis](https://github.com/talamortis) (Original author of the module) * [Rochet2](https://github.com/Rochet2/): Thanks for the help with the phasing situation & General support -* [Anhanga](https://github.com/rbedfordpro) & [WiZZy](https://github.com/wizzymore) +* [rbedfordpro](https://github.com/rbedfordpro) & [WiZZy](https://github.com/wizzymore) AzerothCore: [repository](https://github.com/azerothcore) - [website](http://azerothcore.org/) - [discord chat community](https://discord.gg/64FH6Y8) diff --git a/src/mod_guild_house_npc.cpp b/src/mod_guild_house_npc.cpp index 80ce4f5..28df421 100644 --- a/src/mod_guild_house_npc.cpp +++ b/src/mod_guild_house_npc.cpp @@ -42,7 +42,7 @@ class GuildHouseSpawner : public CreatureScript { ClearGossipMenuFor(player); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 18649, "Add an Innkeeper?", GuildHouseInnKeeper, false); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Mailbox", GOSSIP_SENDER_MAIN, 184137, "Spawn a mailbox?", GuildHouseMailBox, false); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Stable Master", GOSSIP_SENDER_MAIN, 28690, "Spawn a Stable Master?", GuildHouseVendor, false); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Stable Master", GOSSIP_SENDER_MAIN, 28690, "Spawn a Stable Master?", GuildHouseVendor, false); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Class Trainer", GOSSIP_SENDER_MAIN, 2); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Vendor", GOSSIP_SENDER_MAIN, 3); AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn City Portals / Objects", GOSSIP_SENDER_MAIN, 4); From fae639bda7ee91af40d26e136d360501ccb63959 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Oct 2019 08:13:01 -0700 Subject: [PATCH 57/63] fixing minor issues --- src/mod_guild_house_v2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 83779a1..f69c286 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -104,12 +104,13 @@ class GuildHelper : public GuildScript{ } // Delete actual guild_house data from characters database - CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE `guild` = '%u'", player->GetGuildId()); + CharacterDatabase.PQuery("DELETE FROM `guild_house` WHERE `guild` = '%u'", guild->GetId()); return true; } +}; class GuildHouseSeller : public CreatureScript { From e518f46f96f7f5c1a0f0e053df94aae8e179ae46 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Oct 2019 08:36:44 -0700 Subject: [PATCH 58/63] fixing travis errors --- src/mod_guild_house_v2.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index f69c286..c398efc 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -56,7 +56,6 @@ class GuildHelper : public GuildScript{ uint32 guildPhase = GetGuildPhase(guild); QueryResult CreatureResult; QueryResult GameobjResult; - Map* map = sMapMgr->FindMap(1,0); // Lets find all of the gameobjects to be removed GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `map` = 1 AND `phaseMask` = '%u'", guildPhase); @@ -236,7 +235,6 @@ class GuildHouseSeller : public CreatureScript { uint32 guildPhase = GetGuildPhase(player); QueryResult CreatureResult; QueryResult GameobjResult; - Map* map = sMapMgr->FindMap(1,0); // Lets find all of the gameobjects to be removed GameobjResult = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject` WHERE `map` = 1 AND `phaseMask` = '%u'", guildPhase); From 45a1e936990fc7de91e56a81603225336da3493d Mon Sep 17 00:00:00 2001 From: Lee Date: Wed, 30 Oct 2019 16:12:17 +0000 Subject: [PATCH 59/63] Fix travis --- src/mod_guild_house_v2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index c398efc..d28350a 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -482,7 +482,7 @@ class GuildHouseV2PlayerScript : public PlayerScript CheckPlayer(player); } - void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea) + void OnUpdateZone(Player* player, uint32 newZone, uint32 /*newArea*/) { if (newZone == 876) CheckPlayer(player); From 860f8958d6ff8bb0b993e200a2832e760d15ab56 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Oct 2019 09:41:23 -0700 Subject: [PATCH 60/63] unused variable fix for travis --- src/mod_guild_house_v2.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index c398efc..4ee4f54 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -25,11 +25,11 @@ class GuildData : public DataMap::Base float posZ; }; -class GuildHelper : public GuildScript{ +class GuildHelper : public GuildScript { public: - GuildHelper() : GuildScript("GuildHelper") { } + GuildHelper() : GuildScript("GuildHelper") {} void OnCreate(Guild*, Player* leader, const std::string&) { @@ -107,7 +107,7 @@ class GuildHelper : public GuildScript{ return true; - } + } }; @@ -484,6 +484,7 @@ class GuildHouseV2PlayerScript : public PlayerScript void OnUpdateZone(Player* player, uint32 newZone, uint32 newArea) { + newArea = newArea; // Seriously? Just because Travis bombs out if we don't use a variable. if (newZone == 876) CheckPlayer(player); else @@ -512,7 +513,7 @@ class GuildHouseV2PlayerScript : public PlayerScript do { Field* fields = result->Fetch(); - uint32 id = fields[0].GetUInt32(); + //uint32 id = fields[0].GetUInt32(); // fix for travis uint32 guild = fields[1].GetUInt32(); guildData->phase = fields[2].GetUInt32(); uint32 map = fields[3].GetUInt32(); From c5209ed80c3555cd5625f84b0744246ee7c33942 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Oct 2019 10:11:42 -0700 Subject: [PATCH 61/63] more travis fixes/tweaks --- src/mod_guild_house_v2.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 8bec8ba..d1a30fc 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -484,7 +484,6 @@ class GuildHouseV2PlayerScript : public PlayerScript void OnUpdateZone(Player* player, uint32 newZone, uint32 /*newArea*/) { - newArea = newArea; // Seriously? Just because Travis bombs out if we don't use a variable. if (newZone == 876) CheckPlayer(player); else From 22e67e99d8a13f8ebe29db35405c330ac5f50833 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Oct 2019 10:46:00 -0700 Subject: [PATCH 62/63] further travis fixes --- src/mod_guild_house_v2.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index d1a30fc..40db5ca 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -510,15 +510,15 @@ class GuildHouseV2PlayerScript : public PlayerScript if (result) { do { - + // commented out due to travis, but keeping for future expansion into other areas Field* fields = result->Fetch(); - //uint32 id = fields[0].GetUInt32(); // fix for travis - uint32 guild = fields[1].GetUInt32(); + //uint32 id = fields[0].GetUInt32(); // fix for travis + //uint32 guild = fields[1].GetUInt32(); // fix for travis guildData->phase = fields[2].GetUInt32(); - uint32 map = fields[3].GetUInt32(); - guildData->posX = fields[4].GetFloat(); - guildData->posY = fields[5].GetFloat(); - guildData->posZ = fields[6].GetFloat(); + //uint32 map = fields[3].GetUInt32(); // fix for travis + //guildData->posX = fields[4].GetFloat(); // fix for travis + //guildData->posY = fields[5].GetFloat(); // fix for travis + //guildData->posZ = fields[6].GetFloat(); // fix for travis } while (result->NextRow()); } From 138033347f66255938410df9dbe346c4828e1f90 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 30 Oct 2019 11:19:04 -0700 Subject: [PATCH 63/63] more travis fixing - unused variables --- src/mod_guild_house_v2.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod_guild_house_v2.cpp b/src/mod_guild_house_v2.cpp index 40db5ca..8339764 100644 --- a/src/mod_guild_house_v2.cpp +++ b/src/mod_guild_house_v2.cpp @@ -656,8 +656,8 @@ class GuildHouseCommand : public CommandScript do { Field* fields = result->Fetch(); - uint32 id = fields[0].GetUInt32(); - uint32 guild = fields[1].GetUInt32(); + //uint32 id = fields[0].GetUInt32(); // fix for travis + //uint32 guild = fields[1].GetUInt32(); // fix for travis guildData->phase = fields[2].GetUInt32(); uint32 map = fields[3].GetUInt32(); guildData->posX = fields[4].GetFloat();