diff --git a/modules/azerothshard/data/sql/db-world/hearthstone/00-general.sql b/modules/azerothshard/data/sql/db-world/hearthstone/00-general.sql index 08d1ec3408..c06da75b5e 100644 --- a/modules/azerothshard/data/sql/db-world/hearthstone/00-general.sql +++ b/modules/azerothshard/data/sql/db-world/hearthstone/00-general.sql @@ -41,7 +41,7 @@ UPDATE creature_template SET resistance2 = 6000 WHERE entry = 100004; UPDATE creature_template SET resistance2 = 12000 WHERE entry = 100005; UPDATE creature_template SET resistance2 = 21000 WHERE entry = 100006; -UPDATE creature_template SET `npcflag` = 129, `unit_flags` = 514, `type_flags` = 0, `flags_extra` = 0, scriptname = "npc_azth_vendor" WHERE entry IN (100002, 100003, 100004, 100005, 100006); +UPDATE creature_template SET `npcflag` = 129, `unit_flags` = 768, `type_flags` = 134217728, `flags_extra` = 2, scriptname = "npc_azth_vendor", resistance1 = 32001, gossip_menu_id = 32001 WHERE entry IN (100002, 100003, 100004, 100005, 100006); -- SELECT entry, resistance2 FROM creature_template WHERE entry >= 100002; diff --git a/modules/azerothshard/data/sql/db-world/hearthstone/03_update.sql b/modules/azerothshard/data/sql/db-world/hearthstone/03_update.sql index 0333ca7a44..c15634bc2f 100644 --- a/modules/azerothshard/data/sql/db-world/hearthstone/03_update.sql +++ b/modules/azerothshard/data/sql/db-world/hearthstone/03_update.sql @@ -1,5 +1,5 @@ -- update quests with rep -UPDATE `quest_template` SET `Flags` = 4290, `RewardFactionID1` = 1082, `RewardFactionValueId1` = 1 WHERE ID BETWEEN 100000 AND 100080; +UPDATE `quest_template` SET `Flags` = 4290, `RewardFactionID1` = 1082, `RewardFactionValueId1` = 0, RewardFactionValueIdOverride1 = 10 WHERE ID BETWEEN 100000 AND 100080; -- mark of azeroth diff --git a/modules/azerothshard/data/sql/db-world/hearthstone/04_vendors.sql b/modules/azerothshard/data/sql/db-world/hearthstone/04_vendors.sql index 67792e972f..44139d1c8d 100644 --- a/modules/azerothshard/data/sql/db-world/hearthstone/04_vendors.sql +++ b/modules/azerothshard/data/sql/db-world/hearthstone/04_vendors.sql @@ -1,3 +1,8 @@ +DELETE FROM npc_text WHERE ID IN (32001, 32002); +INSERT INTO npc_text (ID, text0_0, text0_1, lang0, Prob0, em0_0) VALUES +(32001, "Qui si paga in Marks of Azeroth!", 0, 0, 100, 0), +(32002, "Ti serve più reputazione!", 0, 0, 100, 0); + -- Quartermaster Ozorg (Dk start set vendor) -- FRIENDLY DELETE FROM `creature_template` WHERE (entry = 100100); @@ -5,7 +10,7 @@ INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entr (100100, 0, 0, 0, 0, 0, 16214, 0, 0, 0, 'Quartermaster Ozorg', 'Acherus Quartermaster', '', 0, 72, 72, 1, 35, 128, 1, 1.14286, 1, 0, 0, 2000, 2000, 1, 33555202, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 4, 1, 1, 0, 0, 1, 0, 128, '', 12340); -- requires friendly with azerothshard (3000 rep) -UPDATE creature_template SET resistance2 = 3000, `npcflag` = 129, `unit_flags` = 514, `type_flags` = 0, `flags_extra` = 0, scriptname = "npc_azth_vendor" WHERE entry = 100100; +UPDATE creature_template SET resistance2 = 3000, `npcflag` = 129, `unit_flags` = 768, `type_flags` = 134217728, `flags_extra` = 2, scriptname = "npc_azth_vendor" WHERE entry = 100100; DELETE FROM npc_vendor WHERE entry = 100100; INSERT INTO npc_vendor (entry, item, extendedcost) VALUES @@ -40,5 +45,11 @@ INSERT INTO npc_vendor (entry, item, extendedcost) VALUES (100100, 34658, 100003), -- ring (100100, 34659, 100008), -- back (100100, 34661, 100030), -- weapon -(100100, 38147, 100003), -(100100, 136942, 1002000); -- ring \ No newline at end of file +(100100, 38147, 100003); -- ring + +-- gossip id inside resistance1 to send the vendor with the gossip +UPDATE creature_template SET resistance1 = 32000, gossip_menu_id = 32001 WHERE entry = 100100; + +DELETE FROM npc_text WHERE ID = 32000; +INSERT INTO npc_text (ID, text0_0, text0_1, lang0, Prob0, em0_0) VALUES +(32000, "Se tu vuoi comprare, tu dare me Marks of Azeroth!", 0, 0, 100, 0); \ No newline at end of file diff --git a/modules/azerothshard/src/server/plugins/Hearthstone/azth_custom_hearthstone_mode.cpp b/modules/azerothshard/src/server/plugins/Hearthstone/azth_custom_hearthstone_mode.cpp index 7dac760d6f..987ef5af52 100644 --- a/modules/azerothshard/src/server/plugins/Hearthstone/azth_custom_hearthstone_mode.cpp +++ b/modules/azerothshard/src/server/plugins/Hearthstone/azth_custom_hearthstone_mode.cpp @@ -6,6 +6,7 @@ #include "WorldSession.h" #include "azth_custom_new_vendor.cpp" #include "WorldPacket.h" +#include "Chat.h" #define GOSSIP_ITEM_GIVE_PVE_QUEST "Vorrei ricevere la mia missione PVE giornaliera." @@ -159,18 +160,40 @@ public: } }; -int AZTH_REPUTATION_ID = 1082; +int AZTH_REPUTATION_ID = 1082; +#define GOSSIP_ITEM_SHOW_ACCESS "Vorrei vedere la tua merce, per favore." class npc_azth_vendor : public CreatureScript { public: npc_azth_vendor() : CreatureScript("npc_azth_vendor") { } - bool OnGossipHello(Player* player, Creature* creature) override + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { - uint32 rep = player->GetReputation(AZTH_REPUTATION_ID); - if ((rep >= creature->GetResistance(SPELL_SCHOOL_FIRE) && (player->GetReputationRank(AZTH_REPUTATION_ID) >= 3)) || player->IsGameMaster()) // resistance 2 + player->PlayerTalkClass->ClearMenus(); + + if (action == GOSSIP_ACTION_TRADE) AzthSendListInventory(creature->GetGUID(), player->GetSession(), 100000); + + return true; + } + + bool OnGossipHello(Player* player, Creature* creature) + { + uint16 gossip; + gossip = 32001; + if (creature->GetResistance(SPELL_SCHOOL_HOLY) != 0) + gossip = creature->GetResistance(SPELL_SCHOOL_HOLY); + + uint32 rep = player->GetReputation(AZTH_REPUTATION_ID); + if (creature->IsVendor() && rep >= creature->GetResistance(SPELL_SCHOOL_FIRE) && (player->GetReputationRank(AZTH_REPUTATION_ID) >= 3)) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_ITEM_SHOW_ACCESS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + if (player->GetReputation(AZTH_REPUTATION_ID) < creature->GetResistance(SPELL_SCHOOL_FIRE)) + player->SEND_GOSSIP_MENU(32002, creature->GetGUID()); + else + player->SEND_GOSSIP_MENU(gossip, creature->GetGUID()); + return true; } }; @@ -198,7 +221,7 @@ void getItems() } while (result->NextRow()); } -float CHANCES[8] = { 10.f, 30.f, 20.f, 15.f, 5.f, 0.01f, 0.01f, 10.f }; +float CHANCES[8] = { 10.f, 30.f, 20.f, 15.f, 5.f, 0.1f, 0.1f, 1.f }; int QUALITY_TO_FILL_PERCENTAGE = 1; int ONLY_COMMON = 2; int NOT_COMMON = 1; @@ -301,15 +324,36 @@ class item_azth_hearthstone_loot_sack : public ItemScript draft->SendMailTo(trans, MailReceiver(player), MailSender(player), MAIL_CHECK_MASK_RETURNED, deliverDelay); CharacterDatabase.CommitTransaction(trans); - + // devi controllare se le quest danno rep pure + // player->TextEmote("controlla la tua mail!"); + + + ChatHandler(player->GetSession()).SendSysMessage("Controlla la tua mail!"); + player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true); return true; } }; +class npc_azth_quest_taker : public CreatureScript +{ +public: + npc_azth_quest_taker() : CreatureScript("npc_azth_quest_taker") { } + + bool OnQuestComplete(Player* player, Creature* creature, Quest const* quest) + { + uint32 low = PVE_LOWER_RANGE; + uint32 up = PVE_UPPER_RANGE; + if (quest->GetQuestId() >= low && quest->GetQuestId() < up) + player->RewardReputation(player, 5.f); + return true; + } +}; + void AddSC_hearthstone() { new npc_han_al(); new npc_azth_vendor(); new item_azth_hearthstone_loot_sack(); + new npc_azth_quest_taker(); } \ No newline at end of file