From 00181d53df143bfe1f0678e19941afed26f8cb05 Mon Sep 17 00:00:00 2001 From: mik1893 Date: Thu, 4 Aug 2016 16:57:45 +0100 Subject: [PATCH 1/8] Core/Spells: Fix Spirit Heal (battleground), abilities with rage/energy should also have no cost --- src/server/game/Spells/SpellMgr.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index bb9a55330e..e9712a2a5d 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3133,6 +3133,9 @@ void SpellMgr::LoadSpellCustomAttr() spellInfo->RecoveryTime = 1500; spellInfo->_requireCooldownInfo = true; break; + case 44535: // Spirit Heal, abilities also have no cost + spellInfo->Effects[EFFECT_0].MiscValue = 127; + break; } switch (spellInfo->SpellFamilyName) From c1495f1efa547095381b12c0a1332eadcacfeadf Mon Sep 17 00:00:00 2001 From: mik1893 Date: Thu, 4 Aug 2016 18:02:50 +0100 Subject: [PATCH 2/8] Core/Custom: Implement RATE_ARENA_POINTS and fixed arena points distribution! --- modules/azerothshard/conf/azth_mod.conf.dist | 2 ++ src/server/game/World/World.cpp | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/modules/azerothshard/conf/azth_mod.conf.dist b/modules/azerothshard/conf/azth_mod.conf.dist index 57fe588b54..92126f6268 100644 --- a/modules/azerothshard/conf/azth_mod.conf.dist +++ b/modules/azerothshard/conf/azth_mod.conf.dist @@ -73,6 +73,8 @@ Arena.ArenaStartRating = 1000 Arena.ArenaStartPersonalRating = 1000 +Arena.Points.Rate = 1 + CharDelete.Method = 1 diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index f478da4e26..66ad5d4086 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -602,6 +602,14 @@ void World::LoadConfigSettings(bool reload) sLog->outError("DurabilityLossChance.Block (%f) must be >=0. Using 0.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); rate_values[RATE_DURABILITY_LOSS_BLOCK] = 0.0f; } + //[AZTH] Arena Points Rate + rate_values[RATE_ARENA_POINTS] = sConfigMgr->GetFloatDefault("Arena.Points.Rate", 1.0f); + if (rate_values[RATE_ARENA_POINTS] < 1.0f) + { + sLog->outError("Arena.Points.Rate (%f) must be >=1. Using 1.0 instead.", rate_values[RATE_DURABILITY_LOSS_BLOCK]); + rate_values[RATE_ARENA_POINTS] = 1.0f; + } + //[/AZTH] ///- Read other configuration items from the config file m_bool_configs[CONFIG_DURABILITY_LOSS_IN_PVP] = sConfigMgr->GetBoolDefault("DurabilityLoss.InPvP", false); From 1c865973e0c7516c433b82a838cc150e7c196c40 Mon Sep 17 00:00:00 2001 From: mik1893 Date: Thu, 4 Aug 2016 18:23:09 +0100 Subject: [PATCH 3/8] Core/Custom: removed Crossfaction disable warning message --- .../src/server/plugins/CrossFaction/CrossFaction.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/azerothshard/src/server/plugins/CrossFaction/CrossFaction.cpp b/modules/azerothshard/src/server/plugins/CrossFaction/CrossFaction.cpp index 7c71059636..913caefbea 100644 --- a/modules/azerothshard/src/server/plugins/CrossFaction/CrossFaction.cpp +++ b/modules/azerothshard/src/server/plugins/CrossFaction/CrossFaction.cpp @@ -20,11 +20,7 @@ void CrossFaction::UpdatePlayerTeam(Group* group, uint64 guid, bool reset /* = f if (isMapEnabled(player->GetMapId()) && isZoneEnabled(player->GetZoneId()) && isAreaEnabled(player->GetAreaId())) disable = false; else - { - // message player when crossfaction disabled in a specific area - player->Whisper("Quest'area ha il crossfaction disabilitato", LANG_UNIVERSAL, player->GetGUID()); sLog->outDebug(LOG_FILTER_CROSSFACTION, "Crossfaction: disabled for player %s", player->GetName().c_str()); - } // if not reset or disable, check and change if (!reset && !disable) From 28787faee849bb92c17c58061e94ab5406fe0b3a Mon Sep 17 00:00:00 2001 From: Gargarensis Date: Fri, 5 Aug 2016 01:38:02 +0200 Subject: [PATCH 4/8] gossip item patch + first gossip item morph --- .../table_azth_character_morph.sql | 9 + .../db-world/hearthstone/07_item_morph.sql | 22 +++ .../azth_custom_hearthstone_mode.cpp | 169 +++++++++++++++++- 3 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 modules/azerothshard/data/sql/db-characters/hearthstone/table_azth_character_morph.sql create mode 100644 modules/azerothshard/data/sql/db-world/hearthstone/07_item_morph.sql diff --git a/modules/azerothshard/data/sql/db-characters/hearthstone/table_azth_character_morph.sql b/modules/azerothshard/data/sql/db-characters/hearthstone/table_azth_character_morph.sql new file mode 100644 index 0000000000..eb82a0d0a9 --- /dev/null +++ b/modules/azerothshard/data/sql/db-characters/hearthstone/table_azth_character_morph.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS `azth_character_morph`; +CREATE TABLE `azth_character_morph`( + `guid` INT NOT NULL, + `entry` INT NOT NULL, + `name` TEXT, + `comment` TEXT +); +ALTER TABLE `azth_character_morph` + ADD CONSTRAINT `azth_character_morph` UNIQUE(guid, entry); \ No newline at end of file diff --git a/modules/azerothshard/data/sql/db-world/hearthstone/07_item_morph.sql b/modules/azerothshard/data/sql/db-world/hearthstone/07_item_morph.sql new file mode 100644 index 0000000000..069c1d47db --- /dev/null +++ b/modules/azerothshard/data/sql/db-world/hearthstone/07_item_morph.sql @@ -0,0 +1,22 @@ +UPDATE `item_template` SET `Flags` = 64, `ScriptName` = 'azth_main_morph', stackable = 1, `spellid_1` = 36177, maxcount = 5 WHERE (entry = 32561); + +DROP TABLE IF EXISTS `azth_morph_template`; +CREATE TABLE `azth_morph_template`( + `entry` INT NOT NULL UNIQUE, + `flags` INT DEFAULT 0, + `default_name` TEXT, + `scale` FLOAT DEFAULT 1, + `aura` INT DEFAULT -1, + `comment` TEXT +); + +-- some morph +DELETE FROM `azth_morph_template` WHERE entry = 1060; +INSERT INTO `azth_morph_template` VALUES (1060, 0, "MUCCA!", 3, 17, "prova muccaaa"); +UPDATE `item_template` SET `Flags` = 64, `ScriptName` = 'azth_get_morph', `spellid_1` = 36177, stackable = 1060, NAME = "Mucca" WHERE (entry = 32543); + +DELETE FROM `azth_morph_template` WHERE entry = 30721; +INSERT INTO `azth_morph_template` VALUES (30721, 0, "The Lich King", 3, 17, "Lich King Morph"); +UPDATE `item_template` SET `Flags` = 64, `ScriptName` = 'azth_get_morph', `spellid_1` = 36177, stackable = 30721, NAME = "The Lich King" WHERE (entry = 32544); + + \ 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 c87401c844..3e40c0ccbf 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 @@ -8,6 +8,9 @@ #include "WorldPacket.h" #include "Chat.h" #include "Spell.h" +#include "Define.h" +#include "GossipDef.h" +#include "Item.h" #define GOSSIP_ITEM_GIVE_PVE_QUEST "Vorrei ricevere la mia missione PVE giornaliera." @@ -336,10 +339,174 @@ class item_azth_hearthstone_loot_sack : public ItemScript } }; +class azth_main_morph : public ItemScript +{ +public: + azth_main_morph() : ItemScript("azth_main_morph") { } + + bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override // Any hook here + { + player->PlayerTalkClass->ClearMenus(); + + std::string part1 = "SELECT entry, name FROM azth_character_morph WHERE guid = "; + std::string part2 = " LIMIT 0, 200000; "; + std::string temp = part1 + std::to_string(player->GetGUID()) + part2; + const char *query = temp.c_str(); + + QueryResult result = CharacterDatabase.Query(query); + + if (result.null()) + return false; + + do + { + Field* fields = result->Fetch(); + uint32 entry = fields[0].GetUInt32(); + std::string name = fields[1].GetString(); + + if (name == "" || name.empty()) + { + std::string part1 = "SELECT default_name FROM azth_morph_template WHERE entry = "; + std::string part2 = " LIMIT 0, 200000; "; + std::string temp = part1 + std::to_string(entry) + part2; + const char *query = temp.c_str(); + + QueryResult result = WorldDatabase.Query(query); + Field* fields = result->Fetch(); + name = fields[0].GetString(); + } + + player->ADD_GOSSIP_ITEM(0, name, GOSSIP_SENDER_MAIN, entry); + + } while (result->NextRow()); + + + player->ADD_GOSSIP_ITEM(0, "Demorph", GOSSIP_SENDER_MAIN, 1); + + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, item->GetGUID()); + return false; // Cast the spell on use normally + } + + void OnGossipSelect(Player* player, Item* /*item*/, uint32 /*sender*/, uint32 action) override + { + player->PlayerTalkClass->ClearMenus(); + uint32 entry; + if (action == 1) + entry = player->GetDisplayId(); + else + entry = action; + std::string part1 = "SELECT flags, scale, aura FROM azth_morph_template WHERE entry = "; + std::string part2 = " LIMIT 0, 1; "; + std::string temp = part1 + std::to_string(entry) + part2; + const char *query = temp.c_str(); + + QueryResult result = WorldDatabase.Query(query); + + if (result.null()) + { + player->CLOSE_GOSSIP_MENU(); + return; + } + + Field* fields = result->Fetch(); + + uint32 flags = fields[0].GetUInt32(); + float scale = fields[1].GetFloat(); + uint32 aura = 0; + + if (fields[2].GetInt32() != -1) + aura = fields[2].GetUInt32(); + + switch (action) + { + case 1: + player->DeMorph(); + player->SetObjectScale(1); + if (aura > 0) + player->RemoveAura(aura, AURA_REMOVE_BY_DEFAULT); + break; + + default: + player->SetDisplayId(action); + player->SetObjectScale(scale); + + if (aura > 0) + player->AddAura(aura, player); + + //if (flags > 0) + // do something + + break; + } + player->CLOSE_GOSSIP_MENU(); + } +}; + +class azth_get_morph : public ItemScript +{ +public: + azth_get_morph() : ItemScript("azth_get_morph") { } + + bool OnUse(Player* player, Item* item, SpellCastTargets const& /*targets*/) override // Any hook here + { + player->PlayerTalkClass->ClearMenus(); + + player->ADD_GOSSIP_ITEM(0, "Aggiungi senza soprannome.", GOSSIP_SENDER_MAIN, 1); + player->ADD_GOSSIP_ITEM_EXTENDED(GOSSIP_ICON_CHAT, "Aggiungi con soprannome.", GOSSIP_SENDER_MAIN, 2, "Scrivi un soprannome per questa skin.", 0, true); + + player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, item->GetGUID()); + + return false; + } + + void OnGossipSelect(Player* player, Item* item, uint32 /*sender*/, uint32 action) override + { + player->PlayerTalkClass->ClearMenus(); + + if (action != 1) + return; + + std::string part1 = "REPLACE INTO azth_character_morph (guid, entry) VALUES ("; + std::string part2 = ");"; + std::string part3 = ","; + std::string temp = part1 + std::to_string(player->GetGUID()) + part3 + std::to_string(item->GetMaxStackCount()) + part2; + const char *query = temp.c_str(); + + QueryResult result = CharacterDatabase.Query(query); + + player->CLOSE_GOSSIP_MENU(); + } + + void OnGossipSelectCode(Player* player, Item* item, uint32 /*sender*/, uint32 action, const char* code) override + { + player->PlayerTalkClass->ClearMenus(); + + if (code == "" || *code == 0) + { + ChatHandler(player->GetSession()).SendSysMessage("Verrą salvata la skin senza soprannome!"); + } + + if (action != 2) + return; + + std::string part1 = "REPLACE INTO azth_character_morph (guid, entry, name) VALUES ("; + std::string part2 = ");"; + std::string part3 = ","; + std::string apici = "\""; + std::string temp = part1 + std::to_string(player->GetGUID()) + part3 + std::to_string(item->GetMaxStackCount()) + part3 + apici + code + apici + part2; + const char *query = temp.c_str(); + + QueryResult result = CharacterDatabase.Query(query); + + player->CLOSE_GOSSIP_MENU(); + } +}; + void AddSC_hearthstone() { new npc_han_al(); new npc_azth_vendor(); new item_azth_hearthstone_loot_sack(); - + new azth_main_morph(); + new azth_get_morph(); } \ No newline at end of file From 3549874ee4deb618f0aee5b06844f7cf8494cea9 Mon Sep 17 00:00:00 2001 From: Yehonal Date: Fri, 5 Aug 2016 09:31:21 +0200 Subject: [PATCH 5/8] [AZTH] Some changes to GM commands --- .../data/sql/db-world/azth_gm_commands.sql | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/modules/azerothshard/data/sql/db-world/azth_gm_commands.sql b/modules/azerothshard/data/sql/db-world/azth_gm_commands.sql index f3de7663b3..e652b5b844 100644 --- a/modules/azerothshard/data/sql/db-world/azth_gm_commands.sql +++ b/modules/azerothshard/data/sql/db-world/azth_gm_commands.sql @@ -7,6 +7,8 @@ # lvl 3: GM T2 # lvl 4: Administrator # +# NOTE: use "[^a-z,\,] as regexp to search rows without comma +# # Move to GM level 4 ( admin ) some dangerous commands UPDATE command SET `security` = 4 WHERE NAME IN @@ -40,7 +42,8 @@ UPDATE command SET `security` = 0 WHERE `name` IN "lookup map", "lookup skill", "qc", -"server motd" +"server motd", +"" ); # @@ -126,6 +129,7 @@ UPDATE command SET `security` = 1 WHERE `name` IN "titles remove", "titles add", "titles current", +"recall", "tele add", "tele group", "tele name", @@ -136,11 +140,6 @@ UPDATE command SET `security` = 1 WHERE `name` IN "send mail", "send items", "announce", -"ban", -"ban account", -"ban character", -"ban ip", -"ban playeraccount", "bank", "freeze", "unfreeze", @@ -156,7 +155,7 @@ UPDATE command SET `security` = 1 WHERE `name` IN "go taxinode", "go ticket", "go trigger", -"go zonexy" +"go zonexy", "gobject activate", "gobject near", "gobject target", @@ -209,6 +208,7 @@ UPDATE command SET `security` = 1 WHERE `name` IN "ticket unassign", "ticket viewid", "ticket viewname", +"ticket complete", "ticket", "morph", "demorph", @@ -249,8 +249,9 @@ UPDATE command SET `security` = 1 WHERE `name` IN "gobject move", "gobject delete", "gobject add temp", -"gobject add" -"server info" +"gobject add", +"server info", +"" ); # lvl 2: Entertainer @@ -265,7 +266,8 @@ UPDATE command SET `security` = 2 WHERE `name` IN "pet create", "event stop", "event start", -"playall" +"playall", +"" ); @@ -277,9 +279,10 @@ UPDATE command SET `security` = 3 WHERE `name` IN "unban character", "unban account", "unban", -"ban playeraccount", -"ban ip", -"ban character", +"ban", "ban account", -"ban" +"ban character", +"ban ip", +"ban playeraccount", +"" ); From 8f187edc2a4df535fc7ac584a078fdbc16deeb02 Mon Sep 17 00:00:00 2001 From: Gargarensis Date: Fri, 5 Aug 2016 13:11:01 +0200 Subject: [PATCH 6/8] hotfix rele price --- .../sql/db-world/azth_world_relentless_price_reduction.sql | 6 +++++- .../data/sql/updates/world/hotfix_rele_price_frost.sql | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 modules/azerothshard/data/sql/updates/world/hotfix_rele_price_frost.sql diff --git a/modules/azerothshard/data/sql/db-world/azth_world_relentless_price_reduction.sql b/modules/azerothshard/data/sql/db-world/azth_world_relentless_price_reduction.sql index 01e765e70e..cb8d54bb9e 100644 --- a/modules/azerothshard/data/sql/db-world/azth_world_relentless_price_reduction.sql +++ b/modules/azerothshard/data/sql/db-world/azth_world_relentless_price_reduction.sql @@ -1,4 +1,8 @@ UPDATE npc_vendor SET extendedcost = 2440 WHERE item IN (41088,41158,41206,41679,41668,41662,40791,40830,40851,41994,41999,42006,41322,41299,41311,41673,41656,41651,41082,41152,41200,40995,41020,41034,41855,41865,41860,40910,40934,40940,40790,40829,40850,40994,41014,41028,41916,41928,41922,40792,40831,40852,41947,41954,41960,41328,41305,41317); UPDATE npc_vendor SET extendedcost = 2445 WHERE item IN (41218,41716,40871,42012,41276,41684,41212,41045,41870,40964,40870,41039,41935,40872,41966,41282); UPDATE npc_vendor SET extendedcost = 2443 WHERE item IN (41144,41774,40811,42018,41288,41768,41138,41008,41875,40928,40810,41002,41941,40812,41972,41294); -UPDATE npc_vendor SET extendedcost = 2444 WHERE item IN (42591,42585,42580,42854,42616,42622,42609,42604,42599); \ No newline at end of file +UPDATE npc_vendor SET extendedcost = 2444 WHERE item IN (42591,42585,42580,42854,42616,42622,42609,42604,42599); + +UPDATE npc_vendor SET extendedcost = 2742 WHERE item IN (41088,41158,41206,41679,41668,41662,40791,40830,40851,41994,41999,42006,41322,41299,41311,41673,41656,41651,41082,41152,41200,40995,41020,41034,41855,41865,41860,40910,40934,40940,40790,40829,40850,40994,41014,41028,41916,41928,41922,40792,40831,40852,41947,41954,41960,41328,41305,41317) AND entry IN (37941, 37942, 38858);; +UPDATE npc_vendor SET extendedcost = 2740 WHERE item IN (41218,41716,40871,42012,41276,41684,41212,41045,41870,40964,40870,41039,41935,40872,41966,41282) AND entry IN (37941, 37942, 38858);; +UPDATE npc_vendor SET extendedcost = 2740 WHERE item IN (41144,41774,40811,42018,41288,41768,41138,41008,41875,40928,40810,41002,41941,40812,41972,41294) AND entry IN (37941, 37942, 38858);; \ No newline at end of file diff --git a/modules/azerothshard/data/sql/updates/world/hotfix_rele_price_frost.sql b/modules/azerothshard/data/sql/updates/world/hotfix_rele_price_frost.sql new file mode 100644 index 0000000000..41c6c8cbb1 --- /dev/null +++ b/modules/azerothshard/data/sql/updates/world/hotfix_rele_price_frost.sql @@ -0,0 +1,3 @@ +UPDATE npc_vendor SET extendedcost = 2742 WHERE item IN (41088,41158,41206,41679,41668,41662,40791,40830,40851,41994,41999,42006,41322,41299,41311,41673,41656,41651,41082,41152,41200,40995,41020,41034,41855,41865,41860,40910,40934,40940,40790,40829,40850,40994,41014,41028,41916,41928,41922,40792,40831,40852,41947,41954,41960,41328,41305,41317) AND entry IN (37941, 37942, 38858);; +UPDATE npc_vendor SET extendedcost = 2740 WHERE item IN (41218,41716,40871,42012,41276,41684,41212,41045,41870,40964,40870,41039,41935,40872,41966,41282) AND entry IN (37941, 37942, 38858);; +UPDATE npc_vendor SET extendedcost = 2740 WHERE item IN (41144,41774,40811,42018,41288,41768,41138,41008,41875,40928,40810,41002,41941,40812,41972,41294) AND entry IN (37941, 37942, 38858);; \ No newline at end of file From 415436d802d98fd0ca5c61c040c0c48a8b983adb Mon Sep 17 00:00:00 2001 From: Gargarensis Date: Sat, 6 Aug 2016 01:10:13 +0200 Subject: [PATCH 7/8] patch item and player gossip --- src/server/game/Handlers/MiscHandler.cpp | 38 ++++++++++++++++++++++-- src/server/game/Scripting/ScriptMgr.cpp | 28 +++++++++++++++++ src/server/game/Scripting/ScriptMgr.h | 26 ++++++++++++++++ 3 files changed, 90 insertions(+), 2 deletions(-) diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 03ebb65c17..d23105a42f 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -101,6 +101,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) Creature* unit = NULL; GameObject* go = NULL; + Item* item = NULL; if (IS_CRE_OR_VEH_GUID(guid)) { unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); @@ -119,6 +120,23 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) return; } } + else if (IS_ITEM_GUID(guid)) + { + item = _player->GetItemByGuid(guid); + if (!item || _player->IsBankPos(item->GetPos())) + { + //TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - %s not found.", guid.ToString().c_str()); + return; + } + } + else if (IS_PLAYER_GUID(guid)) + { + if (guid != _player->GetGUID() || menuId != _player->PlayerTalkClass->GetGossipMenu().GetMenuId()) + { + //TC_LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - %s not found.", guid.ToString().c_str()); + return; + } + } else { ;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid))); @@ -147,11 +165,19 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) if (!sScriptMgr->OnGossipSelectCode(_player, unit, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str())) _player->OnGossipSelect(unit, gossipListId, menuId); } - else + else if (go) { go->AI()->GossipSelectCode(_player, menuId, gossipListId, code.c_str()); sScriptMgr->OnGossipSelectCode(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str()); } + else if (item) + { + sScriptMgr->OnGossipSelectCode(_player, item, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str()); + } + else + { + sScriptMgr->OnGossipSelectCode(_player, menuId, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId), code.c_str()); + } } else { @@ -161,12 +187,20 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) if (!sScriptMgr->OnGossipSelect(_player, unit, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId))) _player->OnGossipSelect(unit, gossipListId, menuId); } - else + else if (go) { go->AI()->GossipSelect(_player, menuId, gossipListId); if (!sScriptMgr->OnGossipSelect(_player, go, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId))) _player->OnGossipSelect(go, gossipListId, menuId); } + else if (item) + { + sScriptMgr->OnGossipSelect(_player, item, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId)); + } + else + { + sScriptMgr->OnGossipSelect(_player, menuId, _player->PlayerTalkClass->GetGossipOptionSender(gossipListId), _player->PlayerTalkClass->GetGossipOptionAction(gossipListId)); + } } } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 089105b9b6..d568af8be4 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -703,6 +703,34 @@ bool ScriptMgr::OnItemExpire(Player* player, ItemTemplate const* proto) return tmpscript->OnExpire(player, proto); } +void ScriptMgr::OnGossipSelect(Player* player, Item* item, uint32 sender, uint32 action) +{ + ASSERT(player); + ASSERT(item); + + GET_SCRIPT(ItemScript, item->GetScriptId(), tmpscript); + tmpscript->OnGossipSelect(player, item, sender, action); +} + +void ScriptMgr::OnGossipSelectCode(Player* player, Item* item, uint32 sender, uint32 action, const char* code) +{ + ASSERT(player); + ASSERT(item); + + GET_SCRIPT(ItemScript, item->GetScriptId(), tmpscript); + tmpscript->OnGossipSelectCode(player, item, sender, action, code); +} + +void ScriptMgr::OnGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action) +{ + FOREACH_SCRIPT(PlayerScript)->OnGossipSelect(player, menu_id, sender, action); +} + +void ScriptMgr::OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code) +{ + FOREACH_SCRIPT(PlayerScript)->OnGossipSelectCode(player, menu_id, sender, action, code); +} + bool ScriptMgr::OnGossipHello(Player* player, Creature* creature) { ASSERT(player); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 7c1a87811f..ce0a4ce044 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -422,6 +422,15 @@ class ItemScript : public ScriptObject // Called when the item expires (is destroyed). virtual bool OnExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return false; } + + + // AZTH }; class CreatureScript : public ScriptObject, public UpdatableScript @@ -767,6 +776,15 @@ class PlayerScript : public ScriptObject virtual void OnAchiSave(SQLTransaction& /*trans*/, Player* /*player*/, uint16 /*achId*/, CompletedAchievementData /*achiData*/) { } virtual void OnCriteriaSave(SQLTransaction& /*trans*/, Player* /*player*/, uint16 /*achId*/, CriteriaProgress /*criteriaData*/) { } + + + // Called when a player selects an option in a player gossip window + virtual void OnGossipSelect(Player* /*player*/, uint32 /*menu_id*/, uint32 /*sender*/, uint32 /*action*/) { } + + // Called when a player selects an option in a player gossip window + virtual void OnGossipSelectCode(Player* /*player*/, uint32 /*menu_id*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { } + + //[/AZTH] }; @@ -924,6 +942,12 @@ class ScriptMgr bool OnItemUse(Player* player, Item* item, SpellCastTargets const& targets); bool OnItemExpire(Player* player, ItemTemplate const* proto); + // AZTH + + public: /* CreatureScript */ bool OnGossipHello(Player* player, Creature* creature); @@ -1044,6 +1068,8 @@ class ScriptMgr void OnCriteriaProgress(Player *player, AchievementCriteriaEntry const* criteria); void OnAchievementSave(SQLTransaction& trans, Player* player, uint16 achiId, CompletedAchievementData achiData); void OnCriteriaSave(SQLTransaction& trans, Player* player, uint16 critId, CriteriaProgress criteriaData); + void OnGossipSelect(Player* player, uint32 menu_id, uint32 sender, uint32 action); + void OnGossipSelectCode(Player* player, uint32 menu_id, uint32 sender, uint32 action, const char* code); // [/AZTH] public: /* GuildScript */ From 671e3a6f30763e2acc105857cef41f53909b53b5 Mon Sep 17 00:00:00 2001 From: Gargarensis Date: Sat, 6 Aug 2016 13:07:44 +0200 Subject: [PATCH 8/8] i forgot something --- data/sql/updates/world/2016_07_28_00.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data/sql/updates/world/2016_07_28_00.sql b/data/sql/updates/world/2016_07_28_00.sql index 90b69837cd..8fa38d7a9e 100644 --- a/data/sql/updates/world/2016_07_28_00.sql +++ b/data/sql/updates/world/2016_07_28_00.sql @@ -6,10 +6,10 @@ INSERT INTO `creature_loot_template` (`Entry`, `Item`, `ChanceOrQuestChance`, `L (26536, 26011, 1, 1, 1, -26011, 1), (26536, 26012, 1, 1, 1, -26012, 1), (26536, 26040, 21.4, 1, 0, -26040, 1), -(26536, 33370, 3.6, 0, 1, 1, 1), -(26536, 33399, 3.6, 0, 1, 1, 1), +(26536, 33370, 3.6, 1, 1, 1, 1), +(26536, 33399, 3.6, 1, 1, 1, 1), (26536, 33454, 35.5, 1, 0, 1, 1), -(26536, 37068, 0.69, 0, 1, 1, 1), -(26536, 37069, 0.69, 0, 1, 1, 1), -(26536, 37070, 0.69, 0, 1, 1, 1), -(26536, 45912, 0.1, 0, 1, 1, 1); \ No newline at end of file +(26536, 37068, 0.69, 1, 1, 1, 1), +(26536, 37069, 0.69, 1, 1, 1, 1), +(26536, 37070, 0.69, 1, 1, 1, 1), +(26536, 45912, 0.1, 1, 1, 1, 1); \ No newline at end of file