diff --git a/conf/mod_guildhouse.conf.dist b/conf/mod_guildhouse.conf.dist index 314eca0..1778eb6 100644 --- a/conf/mod_guildhouse.conf.dist +++ b/conf/mod_guildhouse.conf.dist @@ -14,13 +14,6 @@ CostGuildHouse = 10000000 # GuildHouseMailbox = 500000 -# GuildHouseInnKeeper -# -# The amount of money to buy a Innkeeper for your guild house -# default = 1000000 (100g) -# -GuildHouseInnKeeper = 1000000 - # GuildHouseBank # # The amount of money to buy a bank for your guild house diff --git a/sql/world/creatures_objects.sql b/sql/world/creatures_objects.sql index 0bcceb6..3368c75 100644 --- a/sql/world/creatures_objects.sql +++ b/sql/world/creatures_objects.sql @@ -3,14 +3,12 @@ SET @C_TEMPLATE = 500030; DELETE FROM `creature_template` WHERE `entry` IN ( @C_TEMPLATE + 0, - @C_TEMPLATE + 1, - @C_TEMPLATE + 2 + @C_TEMPLATE + 1 ); INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES (@C_TEMPLATE + 0, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Talamortis', 'Guild House Seller', '', 0, 35, 35, 0, 35, 0, 1, 1.14286, 1, 1, 20, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 7, 4096, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'GuildHouseSeller', 12340), - (@C_TEMPLATE + 1, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Xrispins', 'Guild House Butler', '', 0, 35, 35, 0, 35, 0, 1, 1.14286, 1, 1, 20, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 7, 4096, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'GuildHouseSpawner', 12340), - (@C_TEMPLATE + 2, 0, 0, 0, 0, 0, 18234, 0, 0, 0, 'Innkeeper Monica', NULL, NULL, 0, 1, 2, 0, 35, 65536, 0.8, 0.28571, 1, 1, 20, 1, 0, 0, 4.6, 2000, 1900, 1, 1, 1, 0, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, '', 1, 1, 1, 1, 1, 1, 0, 70, 1, 0, 0, 2, 'npc_innkeeper', 12340); + (@C_TEMPLATE + 1, 0, 0, 0, 0, 0, 25901, 0, 0, 0, 'Xrispins', 'Guild House Butler', '', 0, 35, 35, 0, 35, 0, 1, 1.14286, 1, 1, 20, 1, 0, 0, 1, 2000, 2000, 1, 1, 1, 33536, 2048, 0, 0, 0, 0, 0, 0, 7, 4096, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 'GuildHouseSpawner', 12340); -- !!! NOTE: set these before running the queries in order to avoid conflicts !!! SET @GO_TEMPLATE = 500000; diff --git a/sql/world/guildhouse_spawns.sql b/sql/world/guildhouse_spawns.sql index 10406cf..7aef894 100644 --- a/sql/world/guildhouse_spawns.sql +++ b/sql/world/guildhouse_spawns.sql @@ -1,68 +1,140 @@ +DROP TABLE IF EXISTS `guild_house_spawns`; + CREATE TABLE IF NOT EXISTS `guild_house_spawns` ( - `id` int(11) NOT NULL AUTO_INCREMENT, `entry` int(11) NOT NULL DEFAULT '0', `posX` float NOT NULL DEFAULT '0', `posY` float NOT NULL DEFAULT '0', `posZ` float NOT NULL DEFAULT '0', `orientation` float NOT NULL DEFAULT '0', `comment` varchar(500) DEFAULT '0', - PRIMARY KEY (`id`), UNIQUE KEY `entry` (`entry`) -) ENGINE=InnoDB AUTO_INCREMENT=51 DEFAULT CHARSET=utf8; - -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'), - (2, 26324, 16221.3, 16275.7, 20.9285, 1.37363, 'Druid Trainer'), - (3, 26325, 16218.6, 16277, 20.9872, 0.967188, 'Hunter Trainer'), - (4, 26326, 16224.9, 16274.9, 20.9319, 1.58765, 'Mage Trainer'), - (5, 26328, 16227.9, 16275.9, 20.9254, 1.9941, 'Priest Trainer'), - (6, 26329, 16231.4, 16278.1, 20.9222, 2.20026, 'Rogue Trainer'), - (7, 26330, 16235.5, 16280.8, 20.9257, 2.18652, 'Shaman Trainer'), - (8, 26331, 16240.8, 16283.3, 20.9299, 1.86843, 'Warlock Trainer'), - (9, 26332, 16246.6, 16284.5, 20.9301, 1.68975, 'Warrior Trainer'), - (10, 500032, 16218.9, 16284.5, 13.1761, 6.18533, 'Innkeeper'), - (11, 30605, 16228.0, 16280.5, 13.1761, 2.98877, 'Banker'), - (12, 29195, 16252.3, 16284.9, 20.9324, 1.79537, 'Death Knight Trainer'), - (13, 2836, 16220.5, 16302.3, 13.176, 6.14647, 'Blacksmithing Trainer'), - (14, 8128, 16220.2, 16299.6, 13.178, 6.22894, 'Mining Trainer'), - (15, 8736, 16219.8, 16296.9, 13.1746, 6.24465, 'Engineering Trainer'), - (16, 18774, 16222.4, 16293, 13.1813, 1.51263, 'Jewelcrafting Trainer (Alliance)'), - (17, 18751, 16222.4, 16293, 13.1813, 1.51263, 'Jewelcrafting Trainer (Horde)'), - (18, 18773, 16227.5, 16292.3, 13.1839, 1.49691, 'Enchanting Trainer (Alliance)'), - (19, 18753, 16227.5, 16292.3, 13.1839, 1.49691, 'Enchanting Trainer (Horde)'), - (20, 30721, 16231.6, 16301, 13.1757, 3.07372, 'Inscription Trainer (Alliance)'), - (21, 30722, 16231.6, 16301, 13.1757, 3.07372, 'Inscription Trainer (Horde)'), - (22, 19187, 16231.2, 16295, 13.1761, 3.06574, 'Leatherworking Trainer'), - (23, 19180, 16228.9, 16304.7, 13.1819, 4.64831, 'Skinning Trainer'), - (24, 19052, 16218.1, 16281.8, 13.1756, 6.1975, 'Alchemy Trainer'), - (25, 908, 16218.3, 16284.3, 13.1756, 6.1975, 'Herbalism Trainer'), - (26, 2627, 16220.4, 16278.7, 13.1756, 1.46157, 'Tailoring Trainer'), - (27, 19184, 16225, 16310.9, 29.262, 6.22119, 'First Aid Trainer'), - (28, 2834, 16225.3, 16313.9, 29.262, 6.28231, 'Fishing Trainer'), - (29, 19185, 16227, 16278, 13.1762, 1.4872, 'Cooking Trainer'), - (30, 8719, 16242, 16291.6, 22.9311, 1.52061, 'Alliance Auctioneer'), - (31, 9856, 16242, 16291.6, 22.9311, 1.52061, 'Horde Auctioneer'), - (32, 184137, 16220.3, 16272, 12.9736, 4.45592, 'Mailbox (Object)'), - (33, 1685, 16253.8, 16294.3, 13.1758, 6.11938, 'Forge (Object)'), - (34, 4087, 16254.4, 16298.7, 13.1758, 3.36027, 'Anvil (Object)'), - (35, 500000, 16232.9, 16264.1, 13.55570, 3.028813, 'Portal: Stormwind (Object)'), - (36, 500001, 16232.8, 16257.1, 13.93456, 3.028813, 'Portal: Darnassus (Object)'), - (37, 500002, 16231.3, 16254.2, 13.65647, 3.028813, 'Portal: Exodar (Object)'), - (38, 500003, 16233.4, 16260.6, 13.84770, 3.028813, 'Portal: Ironforge (Object)'), - (39, 500004, 16232.9, 16264.1, 13.55570, 3.028813, 'Portal: Orgrimmar (Object)'), - (40, 500005, 16231.3, 16254.2, 13.65647, 3.028813, 'Portal: Silvermoon (Object)'), - (41, 500006, 16233.4, 16260.6, 13.84770, 3.028813, 'Portal: Thunder Bluff (Object)'), - (42, 500007, 16232.8, 16257.1, 13.93456, 3.028813, 'Portal: Undercity (Object)'), - (43, 500008, 16211.1, 16266.9, 13.7458, 5.6724, 'Portal: Shattrath (Object)'), - (44, 500009, 16213.9, 16270.5, 13.1378, 5.4996, 'Portal: Dalaran (Object)'), - (45, 187293, 16230.5, 16283.5, 13.9061, 3, 'Guild Vault (Object)'), - (46, 28692, 16236.2, 16315.7, 20.8454, 4.64365, 'Trade Supplies'), - (47, 28776, 16223.7, 16297.9, 20.8454, 6.17044, 'Tabard Vendor'), - (48, 4255, 16230.2, 16316.1, 20.8455, 4.64365, 'Food & Drink Vendor'), - (49, 6491, 16319.937, 16242.404, 24.4747, 2.206830, 'Spirit Healer'), - (50, 191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'), - (51, 29636, 16233.2, 16315.9, 20.8454, 4.64365, 'Reagent Vendor'), - (52, 29493, 16229.1, 16286.4, 13.176, 3.03831, 'Ammo & Repair Vendor'), - (53, 28690, 16226.97, 16267.9, 13.15, 4.6533, 'Stable Master'), - (54, 9858, 16238.2, 16291.8, 22.9306, 1.55386, 'Neutral Auctioneer'), - (55, 2622, 16242.8, 16302.1, 13.176, 4.55570, 'Poisons Vendor'); \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +INSERT INTO `guild_house_spawns` (`entry`, `posX`, `posY`, `posZ`, `orientation`, `comment`) VALUES + (26327, 16216.5, 16279.4, 20.9306, 0.552869, 'Paladin Trainer'), + (26324, 16221.3, 16275.7, 20.9285, 1.37363, 'Druid Trainer'), + (26325, 16218.6, 16277, 20.9872, 0.967188, 'Hunter Trainer'), + (26326, 16224.9, 16274.9, 20.9319, 1.58765, 'Mage Trainer'), + (26328, 16227.9, 16275.9, 20.9254, 1.9941, 'Priest Trainer'), + (26329, 16231.4, 16278.1, 20.9222, 2.20026, 'Rogue Trainer'), + (26330, 16235.5, 16280.8, 20.9257, 2.18652, 'Shaman Trainer'), + (26331, 16240.8, 16283.3, 20.9299, 1.86843, 'Warlock Trainer'), + (26332, 16246.6, 16284.5, 20.9301, 1.68975, 'Warrior Trainer'), + (29195, 16252.3, 16284.9, 20.9324, 1.79537, 'Death Knight Trainer'), + (28694, 16252.3, 16300.4, 13.175, 4.60370, 'Blacksmithing Trainer (Grand Master)'), + (28698, 16256.8, 16296.5, 13.176, 3.06334, 'Mining Trainer (Grand Master)'), + (28697, 16219.8, 16296.9, 13.1746, 6.24465, 'Engineering Trainer (Grand Master)'), + (28701, 16222.4, 16293, 13.1813, 1.51263, 'Jewelcrafting Trainer (Grand Master)'), + (28693, 16228.5, 16292.3, 13.1780, 1.82008, 'Enchanting Trainer (Grand Master)'), + (19540, 16227.1, 16292.4, 13.1770, 1.45487, 'Enchanting Trainer (Master)'), + (28702, 16231.6, 16301, 13.1757, 3.07372, 'Inscription Trainer (Grand Master)'), + (28700, 16231.0, 16294.3, 13.1759, 3.02255, 'Leatherworking Trainer (Grand Master)'), + (19187, 16231.1, 16295.6, 13.1759, 3.02647, 'Leatherworking Trainer (Master)'), + (28696, 16228.9, 16304.7, 13.1819, 4.64831, 'Skinning Trainer (Grand Master)'), + (28703, 16222.9, 16304.7, 13.1821, 4.56585, 'Alchemy Trainer (Grand Master)'), + (19052, 16220.5, 16302.3, 13.176, 6.14647, 'Alchemy Trainer (Master)'), + (28704, 16218.3, 16284.3, 13.1756, 6.1975, 'Herbalism Trainer (Grand Master)'), + (28699, 16220.2, 16299.6, 13.178, 6.22894, 'Tailoring Trainer (Grand Master)'), + (28706, 16225, 16310.9, 29.262, 6.22119, 'First Aid Trainer (Grand Master)'), + (28742, 16225.3, 16313.9, 29.262, 6.28231, 'Fishing Trainer (Grand Master)'), + (33587, 16256.3, 16291.7, 13.174, 2.22426, 'Cooking Trainer (Grand Master)'), + (6491, 16319.937, 16242.404, 24.4747, 2.206830, 'Spirit Healer'), + (30605, 16228.0, 16280.5, 13.1761, 2.98877, 'Banker'), + (8719, 16238.1, 16291.9, 22.9303, 1.46240, 'Alliance Auctioneer'), + (9856, 16242.7, 16291.3, 22.9318, 1.45454, 'Horde Auctioneer'), + (9858, 16240.5, 16291.5, 22.9318, 1.47417, 'Neutral Auctioneer'), + (184137, 16220.3, 16272, 12.9736, 4.45592, 'Mailbox (Object)'), + (187293, 16230.5, 16283.5, 13.9061, 3, 'Guild Vault (Object)'), + (191028, 16255.5, 16304.9, 20.9785, 2.97516, 'Barber Chair (Object)'), + (1685, 16257.3, 16298.8, 13.1758, 3.14050, 'Forge (Object)'), + (4087, 16254.5, 16299.8, 13.1758, 6.19537, 'Anvil (Object)'), + (59853, 16257.6, 16293.0, 13.17508, 2.989519, 'Stove (Object)'), + (500000, 16232.9, 16264.1, 13.55570, 3.028813, 'Portal: Stormwind (Object)'), + (500001, 16232.8, 16257.1, 13.93456, 3.028813, 'Portal: Darnassus (Object)'), + (500002, 16231.3, 16254.2, 13.65647, 3.028813, 'Portal: Exodar (Object)'), + (500003, 16233.4, 16260.6, 13.84770, 3.028813, 'Portal: Ironforge (Object)'), + (500004, 16232.9, 16264.1, 13.55570, 3.028813, 'Portal: Orgrimmar (Object)'), + (500005, 16231.3, 16254.2, 13.65647, 3.028813, 'Portal: Silvermoon (Object)'), + (500006, 16233.4, 16260.6, 13.84770, 3.028813, 'Portal: Thunder Bluff (Object)'), + (500007, 16232.8, 16257.1, 13.93456, 3.028813, 'Portal: Undercity (Object)'), + (500008, 16211.1, 16266.9, 13.7458, 5.6724, 'Portal: Shattrath (Object)'), + (500009, 16213.9, 16270.5, 13.1378, 5.4996, 'Portal: Dalaran (Object)'), + (28690, 16226.8, 16269.4, 13.0858, 3.88255, 'Stable Master'), + (28692, 16236.2, 16315.7, 20.8454, 4.64365, 'Trade Supplies'), + (28776, 16223.7, 16297.9, 20.8454, 6.17044, 'Tabard Vendor'), + (4255, 16230.2, 16316.1, 20.8455, 4.64365, 'Food & Drink Vendor'), + (29636, 16233.2, 16315.9, 20.8454, 4.64365, 'Reagent Vendor'), + (29493, 16229.1, 16286.4, 13.176, 3.03831, 'Ammo & Repair Vendor'), + (2622, 16242.8, 16302.1, 13.176, 4.55570, 'Poisons Vendor'); + +/* +-- Updates existing creatures to the new creatures. +-- Replace and with your database names! + +-- The following only needs to be ran if you used this module before 5-1-2022. + +-- First Aid trainer +UPDATE .creature SET id1 = 28706 WHERE id1 = 19184 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Fishing trainer +UPDATE .creature SET id1 = 28742 WHERE id1 = 2834 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Enchanting trainers +UPDATE .creature SET id1 = 28693, position_x = 16228.5, position_y = 16292.3, position_z = 13.1780, orientation = 1.82008 WHERE id1 IN (18773,18753,28693) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Jewelcrafting trainers +UPDATE .creature SET id1 = 28701 WHERE id1 IN (18774,18751) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Inscription trainers +UPDATE .creature SET id1 = 28702 WHERE id1 IN (30721,30722) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Herbalism trainer +UPDATE .creature SET id1 = 28704 WHERE id1 = 908 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Blacksmithing trainer +UPDATE .creature SET id1 = 28694, position_x = 16252.3, position_y = 16300.4, position_z = 13.175, orientation = 4.60370 WHERE id1 IN (2836,28694) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Mining trainer +UPDATE .creature SET id1 = 28698, position_x = 16256.8, position_y = 16296.5, position_z = 13.176, orientation = 3.06334 WHERE id1 IN (8128,28698) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Alchemy trainer +UPDATE .creature SET id1 = 28703, position_x = 16222.9, position_y = 16304.7, position_z = 13.1821, orientation = 4.56585 WHERE id1 IN (19052,28703) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Skinning trainer +UPDATE .creature SET id1 = 28696 WHERE id1 = 19180 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Leatherworking trainer +UPDATE .creature SET id1 = 28700, position_x = 16231.0, position_y = 16294.3, position_z = 13.1759, orientation = 3.02255 WHERE id1 IN (19187,28700) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Tailoring trainer +UPDATE .creature SET id1 = 28699, position_x = 16220.2, position_y = 16299.6, position_z = 13.178, orientation = 6.22894 WHERE id1 IN (2627,28699) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Engineering trainer +UPDATE .creature SET id1 = 28697 WHERE id1 = 8736 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Cooking trainer +UPDATE .creature SET id1 = 33587, position_x = 16256.3, position_y = 16291.7, position_z = 13.174, orientation = 2.22426 WHERE id1 IN (19185,33587) AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Forge object +UPDATE .gameobject SET position_x = 16257.3, position_y = 16298.8, position_z = 13.1758, orientation = 3.14050 WHERE id = 1685 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .gameobject.phaseMask); + +-- Anvil object +UPDATE .gameobject SET position_x = 16254.5, position_y = 16299.8, position_z = 13.1758, orientation = 6.19537 WHERE id = 4087 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .gameobject.phaseMask); + +-- Neutral auctioneer +UPDATE .creature SET position_x = 16240.5, position_y = 16291.5, position_z = 22.9318, orientation = 1.47417 WHERE id1 = 9858 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Horde auctioneer +UPDATE .creature SET position_x = 16242.7, position_y = 16291.3, position_z = 22.9318, orientation = 1.45454 WHERE id1 = 9856 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Alliance auctioneer +UPDATE .creature SET position_x = 16238.1, position_y = 16291.9, position_z = 22.9303, orientation = 1.46240 WHERE id1 = 8719 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Stable master +UPDATE .creature SET position_x = 16226.8, position_y = 16269.4, position_z = 13.0858, orientation = 3.88255 WHERE id1 = 28690 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); + +-- Remove innkeeper +DELETE FROM .creature WHERE id1 = 500032 AND EXISTS (SELECT * FROM .guild_house where .guild_house.phase = .creature.phaseMask); +DELETE FROM .creature_template WHERE entry = 500032 + +*/ \ No newline at end of file diff --git a/src/mod_guildhouse.cpp b/src/mod_guildhouse.cpp index ed77172..256ff11 100644 --- a/src/mod_guildhouse.cpp +++ b/src/mod_guildhouse.cpp @@ -95,7 +95,7 @@ class GuildHelper : public GuildScript { Field *fields = GameobjResult->Fetch(); uint32 lowguid = fields[0].Get(); - if (GameObjectData const *go_data = sObjectMgr->GetGOData(lowguid)) + if (GameObjectData const *go_data = sObjectMgr->GetGameObjectData(lowguid)) { if (GameObject *gobject = map->GetGameObject(ObjectGuid::Create(go_data->id, lowguid))) { @@ -246,8 +246,9 @@ class GuildHouseSeller : public CreatureScript player->GetGuild()->BroadcastToGuild(player->GetSession(), false, "In chat, type `.guildhouse teleport` or `.gh tele` to meet me there!", LANG_UNIVERSAL); LOG_INFO("modules", "GUILDHOUSE: GuildId: '{}' has purchased a guildhouse", player->GetGuildId()); - // Spawn a portal and the guild house butler automatically as part of purchase. - SpawnStarterPortal(player); + // Spawn starter portals and the guild house butler automatically as part of purchase. + SpawnStarterPortal(player, 500000); // Stormwind + SpawnStarterPortal(player, 500004); // Orgrimmar SpawnButlerNPC(player); CloseGossipMenuFor(player); } @@ -298,7 +299,7 @@ class GuildHouseSeller : public CreatureScript { Field *fields = GameobjResult->Fetch(); uint32 lowguid = fields[0].Get(); - if (GameObjectData const *go_data = sObjectMgr->GetGOData(lowguid)) + if (GameObjectData const *go_data = sObjectMgr->GetGameObjectData(lowguid)) { if (GameObject *gobject = map->GetGameObject(ObjectGuid::Create(go_data->id, lowguid))) { @@ -319,28 +320,16 @@ class GuildHouseSeller : public CreatureScript return true; } - void SpawnStarterPortal(Player *player) + void SpawnStarterPortal(Player *player, uint32 entry) { - 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 = 500000; - } - else - { - // Portal to Orgrimmar - entry = 500004; - } - + if (entry == 0) { LOG_INFO("modules", "Error with SpawnStarterPortal in GuildHouse Module!"); @@ -412,7 +401,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)); + sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGameObjectData(guidLow)); CloseGossipMenuFor(player); } @@ -519,9 +508,13 @@ class GuildHousePlayerScript : public PlayerScript void OnUpdateZone(Player *player, uint32 newZone, uint32 /*newArea*/) { if (newZone == 876) + { CheckPlayer(player); + } else + { player->SetPhaseMask(GetNormalPhase(player), true); + } } bool OnBeforeTeleport(Player *player, uint32 mapid, float x, float y, float z, float orientation, uint32 options, Unit *target) @@ -546,13 +539,19 @@ class GuildHousePlayerScript : public PlayerScript 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) @@ -595,15 +594,21 @@ class GuildHousePlayerScript : public PlayerScript player->SetPhaseMask(guildData->phase, true); } else - player->SetPhaseMask(GetNormalPhase(player), true); + { + player->SetPhaseMask(GetNormalPhase(player), true); + } } void teleportToDefault(Player *player) { if (player->GetTeamId() == TEAM_ALLIANCE) - player->TeleportTo(0, -8833.379883f, 628.627991f, 94.006599f, 1.0f); + { + player->TeleportTo(0, -8833.379883f, 628.627991f, 94.006599f, 1.0f); + } else - player->TeleportTo(1, 1486.048340f, -4415.140625f, 24.187496f, 0.13f); + { + player->TeleportTo(1, 1486.048340f, -4415.140625f, 24.187496f, 0.13f); + } } }; @@ -696,7 +701,9 @@ class GuildHouseCommand : public CommandScript Player *player = handler->GetSession()->GetPlayer(); if (!player) - return false; + { + return false; + } if (player->IsInCombat()) { @@ -744,9 +751,13 @@ class GuildHouseGlobal : public GlobalScript void OnBeforeWorldObjectSetPhaseMask(WorldObject const *worldObject, uint32 & /*oldPhaseMask*/, uint32 & /*newPhaseMask*/, bool &useCombinedPhases, bool & /*update*/) override { if (worldObject->GetZoneId() == 876) - useCombinedPhases = false; + { + useCombinedPhases = false; + } else - useCombinedPhases = true; + { + useCombinedPhases = true; + } } }; diff --git a/src/mod_guildhouse_butler.cpp b/src/mod_guildhouse_butler.cpp index 2b23018..6da99ac 100644 --- a/src/mod_guildhouse_butler.cpp +++ b/src/mod_guildhouse_butler.cpp @@ -14,7 +14,7 @@ #include "Transport.h" #include "CreatureAI.h" -int cost, GuildHouseInnKeeper, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProf, GuildHouseBuyRank; +int cost, GuildHouseBank, GuildHouseMailBox, GuildHouseAuctioneer, GuildHouseTrainer, GuildHouseVendor, GuildHouseObject, GuildHousePortal, GuildHouseSpirit, GuildHouseProf, GuildHouseBuyRank; class GuildHouseSpawner : public CreatureScript { @@ -58,14 +58,14 @@ class GuildHouseSpawner : public CreatureScript } ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_TALK, "Spawn Innkeeper", GOSSIP_SENDER_MAIN, 500032, "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 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); 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_MONEY_BAG, "Spawn Alliance Auctioneer", GOSSIP_SENDER_MAIN, 8719, "Spawn an Alliance Auctioneer?", GuildHouseAuctioneer, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Spawn Horde Auctioneer", GOSSIP_SENDER_MAIN, 9856, "Spawn a Horde Auctioneer?", GuildHouseAuctioneer, false); AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Spawn Neutral Auctioneer", GOSSIP_SENDER_MAIN, 9858, "Spawn a Neutral Auctioneer?", GuildHouseAuctioneer, false); AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Spawn Primary Profession Trainers", GOSSIP_SENDER_MAIN, 7); AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Spawn Secondary Profession Trainers", GOSSIP_SENDER_MAIN, 8); @@ -107,14 +107,16 @@ class GuildHouseSpawner : public CreatureScript 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, "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); + AddGossipItemFor(player, GOSSIP_ICON_TALK, "Stove", GOSSIP_SENDER_MAIN, 59853, "Add a Stove?", GuildHouseObject, 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); if (player->GetTeamId() == TEAM_ALLIANCE) { // ALLIANCE players get these options + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Stormwind", GOSSIP_SENDER_MAIN, 500000, "Add Stormwind Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Ironforge", GOSSIP_SENDER_MAIN, 500003, "Add Ironforge Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Darnassus", GOSSIP_SENDER_MAIN, 500001, "Add Darnassus Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Exodar", GOSSIP_SENDER_MAIN, 500002, "Add Exodar Portal?", GuildHousePortal, false); @@ -122,6 +124,7 @@ class GuildHouseSpawner : public CreatureScript else { // HORDE players get these options + AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Orgrimmar", GOSSIP_SENDER_MAIN, 500004, "Add Orgrimmar Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Undercity", GOSSIP_SENDER_MAIN, 500007, "Add Undercity Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Thunderbluff", GOSSIP_SENDER_MAIN, 500006, "Add Thunderbuff Portal?", GuildHousePortal, false); AddGossipItemFor(player, GOSSIP_ICON_TAXI, "Portal: Silvermoon", GOSSIP_SENDER_MAIN, 500005, "Add Silvermoon Portal?", GuildHousePortal, false); @@ -134,51 +137,33 @@ class GuildHouseSpawner : public CreatureScript AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Go Back!", GOSSIP_SENDER_MAIN, 9); SendGossipMenuFor(player, DEFAULT_GOSSIP_MESSAGE, m_creature->GetGUID()); break; - case 6: // Auctioneer - { - uint32 auctioneer = 0; - auctioneer = player->GetTeamId() == TEAM_ALLIANCE ? 8719 : 9856; - SpawnNPC(auctioneer, player); - break; - } + case 8719: // Alliance Auctioneer + case 9856: // Horde Auctioneer case 9858: // Neutral Auctioneer cost = GuildHouseAuctioneer; SpawnNPC(action, player); break; case 7: // Spawn Profession Trainers ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Alchemy Trainer", GOSSIP_SENDER_MAIN, 19052, "Spawn Alchemy Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Blacksmithing Trainer", GOSSIP_SENDER_MAIN, 2836, "Spawn Blacksmithing Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Engineering Trainer", GOSSIP_SENDER_MAIN, 8736, "Spawn Engineering Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Tailoring Trainer", GOSSIP_SENDER_MAIN, 2627, "Spawn Tailoring Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Leatherworking Trainer", GOSSIP_SENDER_MAIN, 19187, "Spawn Leatherworking Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Skinning Trainer", GOSSIP_SENDER_MAIN, 19180, "Spawn Skinning Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Mining Trainer", GOSSIP_SENDER_MAIN, 8128, "Spawn Mining Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Herbalism Trainer", GOSSIP_SENDER_MAIN, 908, "Spawn Herbalism Trainer?", GuildHouseProf, false); - - if (player->GetTeamId() == TEAM_ALLIANCE) - { - // ALLIANCE players get these options - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 18773, "Spawn Enchanting Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Jewelcrafing Trainer", GOSSIP_SENDER_MAIN, 18774, "Spawn Jewelcrafting Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 30721, "Spawn Inscription Trainer?", GuildHouseProf, false); - } - else - { - // HORDE players get these options - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 18753, "Spawn Enchanting Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Jewelcrafing Trainer", GOSSIP_SENDER_MAIN, 18751, "Spawn Jewelcrafting Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 30722, "Spawn Inscription Trainer?", GuildHouseProf, false); - } - + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Alchemy Trainer", GOSSIP_SENDER_MAIN, 28703, "Spawn Alchemy Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Blacksmithing Trainer", GOSSIP_SENDER_MAIN, 28694, "Spawn Blacksmithing Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Engineering Trainer", GOSSIP_SENDER_MAIN, 28697, "Spawn Engineering Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Tailoring Trainer", GOSSIP_SENDER_MAIN, 28699, "Spawn Tailoring Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Leatherworking Trainer", GOSSIP_SENDER_MAIN, 28700, "Spawn Leatherworking Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Skinning Trainer", GOSSIP_SENDER_MAIN, 28696, "Spawn Skinning Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Mining Trainer", GOSSIP_SENDER_MAIN, 28698, "Spawn Mining Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Herbalism Trainer", GOSSIP_SENDER_MAIN, 28704, "Spawn Herbalism Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Enchanting Trainer", GOSSIP_SENDER_MAIN, 28693, "Spawn Enchanting Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Jewelcrafing Trainer", GOSSIP_SENDER_MAIN, 28701, "Spawn Jewelcrafting Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_TRAINER, "Inscription Trainer", GOSSIP_SENDER_MAIN, 28702, "Spawn Inscription 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: // Secondary Profession Trainers ClearGossipMenuFor(player); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "First Aid Trainer", GOSSIP_SENDER_MAIN, 19184, "Spawn First Aid Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 2834, "Spawn Fishing Trainer?", GuildHouseProf, false); - AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 19185, "Spawn Cooking Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "First Aid Trainer", GOSSIP_SENDER_MAIN, 28706, "Spawn First Aid Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Fishing Trainer", GOSSIP_SENDER_MAIN, 28742, "Spawn Fishing Trainer?", GuildHouseProf, false); + AddGossipItemFor(player, GOSSIP_ICON_MONEY_BAG, "Cooking Trainer", GOSSIP_SENDER_MAIN, 33587, "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; @@ -191,10 +176,6 @@ class GuildHouseSpawner : public CreatureScript cost = GuildHouseBank; SpawnNPC(action, player); break; - case 500032: // Innkeeper - cost = GuildHouseInnKeeper; - SpawnNPC(action, player); - break; case 26327: // Paladin case 26324: // Druid case 26325: // Hunter @@ -208,25 +189,43 @@ class GuildHouseSpawner : public CreatureScript cost = GuildHouseTrainer; SpawnNPC(action, player); break; - case 2836: // Blacksmithing - case 8128: // Mining - case 8736: // Engineering - case 18774: // Jewelcrafting (Alliance) - case 18751: // Jewelcrafting (Horde) - case 18773: // Enchanting (Alliance) - case 18753: // Enchanting (Horde) - case 30721: // Inscription (Alliance) - case 30722: // Inscription (Horde) - case 19187: // Leatherworking - case 19180: // Skinning - case 19052: // Alchemy - case 908: // Herbalism - case 2627: // Tailoring - case 19185: // Cooking - case 2834: // Fishing - case 19184: // First Aid + case 28694: // Blacksmithing + case 28698: // Mining + case 28697: // Engineering + case 28701: // Jewelcrafting + case 28693: // Enchanting + case 28702: // Inscription + case 28700: // Leatherworking + case 28696: // Skinning + case 28703: // Alchemy + case 28704: // Herbalism + case 28699: // Tailoring + case 33587: // Cooking + case 28742: // Fishing + case 28706: // First Aid + cost = 0; + + // Check if we need multiple trainers, a few require this otherwise + // you can't learn it soley in the guild house (Master is needed) + if (action == 28693) + { + // Enchanting + SpawnNPC(19540, player); + } + else if (action == 28700) + { + // Leatherworking + SpawnNPC(19187, player); + } + else if (action == 28703) + { + // Alchemy + SpawnNPC(19052, player); + } + cost = GuildHouseProf; SpawnNPC(action, player); + break; case 28692: // Trade Supplies case 28776: // Tabard Vendor @@ -251,20 +250,29 @@ class GuildHouseSpawner : public CreatureScript break; case 1685: // Forge case 4087: // Anvil + case 59853: // Stove case 187293: // Guild Vault case 191028: // Barber Chair cost = GuildHouseObject; SpawnObject(action, player); break; + case 500000: // Stormwind Portal case 500001: // Darnassus Portal case 500002: // Exodar Portal case 500003: // Ironforge Portal + case 500004: // Orgrimmar Portal case 500005: // Silvermoon Portal case 500006: // Thunder Bluff Portal case 500007: // Undercity Portal case 500008: // Shattrath Portal case 500009: // Dalaran Portal cost = GuildHousePortal; + + if (action == 500000 || action == 500004) + { + cost = 0; + } + SpawnObject(action, player); break; } @@ -395,7 +403,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)); + sObjectMgr->AddGameobjectToGrid(guidLow, sObjectMgr->GetGameObjectData(guidLow)); player->ModifyMoney(-cost); CloseGossipMenuFor(player); } @@ -408,7 +416,6 @@ class GuildHouseButlerConf : public WorldScript void OnBeforeConfigLoad(bool /*reload*/) override { - GuildHouseInnKeeper = sConfigMgr->GetOption("GuildHouseInnKeeper", 1000000); GuildHouseBank = sConfigMgr->GetOption("GuildHouseBank", 1000000); GuildHouseMailBox = sConfigMgr->GetOption("GuildHouseMailbox", 500000); GuildHouseAuctioneer = sConfigMgr->GetOption("GuildHouseAuctioneer", 500000);