Scripts/ExilesReach: Use new loot tracking quest feature to kill script hacks for it

This commit is contained in:
Shauren
2024-12-29 12:43:57 +01:00
parent b81355bb99
commit 44130cf9c4
2 changed files with 62 additions and 175 deletions

View File

@@ -0,0 +1,52 @@
DELETE FROM `creature_loot_template` WHERE `Entry`=150228 AND `ItemType`=0 AND `Item` BETWEEN 174791 AND 174794;
DELETE FROM `creature_loot_template` WHERE `Entry`=150237 AND `ItemType`=0 AND `Item` BETWEEN 174811 AND 174814;
DELETE FROM `creature_loot_template` WHERE `Entry`=162817 AND `ItemType`=0 AND `Item`=176398;
DELETE FROM `creature_loot_template` WHERE `Entry`=150228 AND `ItemType`=1 AND `Item`=150228;
DELETE FROM `creature_loot_template` WHERE `Entry`=150237 AND `ItemType`=1 AND `Item`=150237;
DELETE FROM `creature_loot_template` WHERE `Entry`=162817 AND `ItemType`=1 AND `Item`=162817;
INSERT INTO `creature_loot_template` (`Entry`, `ItemType`, `Item`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES
(150228, 1, 150228, 20, 0, 1, 0, 1, 1, 'Murloc Spearhunter/Watershaper - boots'),
(150237, 1, 150237, 20, 0, 1, 0, 1, 1, 'Quilboar Warrior/Geomancer - chest armor'),
(162817, 1, 162817, 100, 0, 1, 0, 1, 1, 'Torgok - Torgok''s Reagent Pouch');
DELETE FROM `reference_loot_template` WHERE `Entry` IN (150228,150237,162817);
INSERT INTO `reference_loot_template` (`Entry`, `ItemType`, `Item`, `Chance`, `QuestRequired`, `LootMode`, `GroupId`, `MinCount`, `MaxCount`, `Comment`) VALUES
(150228, 0, 174791, 100, 0, 1, 0, 1, 1, 'Exile''s Reach boot drop from murlocs - Stitched Cloth Shoes'),
(150228, 0, 174792, 100, 0, 1, 0, 1, 1, 'Exile''s Reach boot drop from murlocs - Stitched Leather Boots'),
(150228, 0, 174793, 100, 0, 1, 0, 1, 1, 'Exile''s Reach boot drop from murlocs - Linked Mail Boots'),
(150228, 0, 174794, 100, 0, 1, 0, 1, 1, 'Exile''s Reach boot drop from murlocs - Dented Plate Boots'),
(150228, 3, 58883, 100, 0, 1, 0, 1, 0, 'Exile''s Reach boot drop from murlocs - Tracking quest flag'),
(150237, 0, 174811, 100, 0, 1, 0, 1, 1, 'Exile''s Reach chest drop from quilboar - Stitched Cloth Tunic'),
(150237, 0, 174812, 100, 0, 1, 0, 1, 1, 'Exile''s Reach chest drop from quilboar - Stitched Leather Tunic'),
(150237, 0, 174813, 100, 0, 1, 0, 1, 1, 'Exile''s Reach chest drop from quilboar - Linked Mail Hauberk'),
(150237, 0, 174814, 100, 0, 1, 0, 1, 1, 'Exile''s Reach chest drop from quilboar - Dented Chestplate'),
(150237, 3, 58882, 100, 0, 1, 0, 1, 0, ' Exile''s Reach chest drop from quilboar - Tracking quest flag'),
(162817, 0, 176398, 100, 0, 1, 0, 1, 1, 'Exile''s Reach Torgok - Torgok''s Reagent Pouch'),
(162817, 3, 59610, 100, 0, 1, 0, 1, 0, ' Exile''s Reach Torgok - Torgok''s Reagent Pouch - Tracking quest flag');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=150228;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=150237;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=162817;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup`=150228;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup`=150237;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=10 AND `SourceGroup`=162817;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ConditionStringValue1`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(10, 150228, 174791, 0, 0, 15, 0, 400, 0, 0, '', 0, 0, 0, '', 'Item drops for cloth wearer'),
(10, 150228, 174792, 0, 0, 15, 0, 3592, 0, 0, '', 0, 0, 0, '', 'Item drops for leather wearer'),
(10, 150228, 174793, 0, 0, 15, 0, 4164, 0, 0, '', 0, 0, 0, '', 'Item drops for mail wearer'),
(10, 150228, 174794, 0, 0, 15, 0, 35, 0, 0, '', 0, 0, 0, '', 'Item drops for plate wearer'),
(10, 150228, 174791, 0, 0, 47, 0, 58883, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 58883 is not rewarded'),
(10, 150228, 174792, 0, 0, 47, 0, 58883, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 58883 is not rewarded'),
(10, 150228, 174793, 0, 0, 47, 0, 58883, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 58883 is not rewarded'),
(10, 150228, 174794, 0, 0, 47, 0, 58883, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 58883 is not rewarded'),
(10, 150237, 174811, 0, 0, 15, 0, 400, 0, 0, '', 0, 0, 0, '', 'Item drops for cloth wearer'),
(10, 150237, 174812, 0, 0, 15, 0, 3592, 0, 0, '', 0, 0, 0, '', 'Item drops for leather wearer'),
(10, 150237, 174813, 0, 0, 15, 0, 4164, 0, 0, '', 0, 0, 0, '', 'Item drops for mail wearer'),
(10, 150237, 174814, 0, 0, 15, 0, 35, 0, 0, '', 0, 0, 0, '', 'Item drops for plate wearer'),
(10, 150237, 174811, 0, 0, 47, 0, 58882, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 58882 is not rewarded'),
(10, 150237, 174812, 0, 0, 47, 0, 58882, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 58882 is not rewarded'),
(10, 150237, 174813, 0, 0, 47, 0, 58882, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 58882 is not rewarded'),
(10, 150237, 174814, 0, 0, 47, 0, 58882, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 58882 is not rewarded'),
(10, 162817, 176398, 0, 0, 47, 0, 59610, 64, 0, '', 1, 0, 0, '', 'Item drops if quest 59610 is not rewarded');
UPDATE `creature_template` SET `ScriptName`='' WHERE `ScriptName`='npc_murloc_spearhunter_watershaper';

View File

@@ -15,37 +15,28 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "AreaTrigger.h"
#include "AreaTriggerAI.h"
#include "Conversation.h"
#include "CreatureAIImpl.h"
#include "Map.h"
#include "Object.h"
#include "Player.h"
#include "CellImpl.h"
#include "CombatAI.h"
#include "Containers.h"
#include "Conversation.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "PassiveAI.h"
#include "PhasingHandler.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "ScriptSystem.h"
#include "SpellAuras.h"
#include "SpellHistory.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "TemporarySummon.h"
#include "Transport.h"
#include "Loot.h"
#include "SpellHistory.h"
#include "VehicleDefines.h"
#include "WorldStateMgr.h"
#include "Unit.h"
#include "Vehicle.h"
#include "WorldSession.h"
#include "CombatAI.h"
#include "PhasingHandler.h"
template<class privateAI, class publicAI>
CreatureAI* GetPrivatePublicPairAISelector(Creature* creature)
@@ -1522,58 +1513,11 @@ struct npc_lana_jordan_beach_laying : public ScriptedAI
}
};
enum ExilesReachMurlocsData
{
ITEM_STITCHED_CLOTH_SHOES = 174791,
ITEM_STITCHED_LEATHER_BOOTS = 174792,
ITEM_LINKED_MAIL_BOOTS = 174793,
ITEM_DENTED_PLATE_BOOTS = 174794,
QUEST_MURLOC_HIDEAWAY_BOOTS_DROPPED = 58883
};
// 150228 - Murloc Spearhunter
// 150229 - Murloc Watershaper
struct npc_murloc_spearhunter_watershaper : public ScriptedAI
struct npc_murloc_spearhunter_watershaper_higher_ground : public ScriptedAI
{
npc_murloc_spearhunter_watershaper(Creature* creature) : ScriptedAI(creature) { }
void JustDied(Unit* /*killer*/) override
{
for (auto const& [playerGuid, loot] : me->m_personalLoot)
{
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGuid))
{
if (player->IsQuestRewarded(QUEST_MURLOC_HIDEAWAY_BOOTS_DROPPED))
break;
for (LootItem const& lootItem : loot->items)
{
if (lootItem.type != LootItemType::Item)
continue;
switch (lootItem.itemid)
{
case ITEM_STITCHED_CLOTH_SHOES:
case ITEM_STITCHED_LEATHER_BOOTS:
case ITEM_LINKED_MAIL_BOOTS:
case ITEM_DENTED_PLATE_BOOTS:
player->SetRewardedQuest(QUEST_MURLOC_HIDEAWAY_BOOTS_DROPPED);
break;
default:
break;
}
}
}
}
}
};
// 150228 - Murloc Spearhunter
// 150229 - Murloc Watershaper
struct npc_murloc_spearhunter_watershaper_higher_ground : public npc_murloc_spearhunter_watershaper
{
npc_murloc_spearhunter_watershaper_higher_ground(Creature* creature) : npc_murloc_spearhunter_watershaper(creature) { }
using ScriptedAI::ScriptedAI;
void JustEngagedWith(Unit* who) override
{
@@ -4377,8 +4321,6 @@ enum GeolordData
SPELL_NECROTIC_RITUAL_DNT = 305513,
SPELL_EARTH_BOLT = 270453,
SPELL_UPHEAVAL = 319273,
WORLDSTATE_HORDE = 4486
};
static constexpr Position PrisonerPosition = { 16.4271f, -2511.82f, 78.8215f, 5.66398f };
@@ -4392,7 +4334,7 @@ struct npc_geolord_grekog : public ScriptedAI
{
uint32 prisonerEntry = NPC_LINDIE_SPRINGSTOCK;
if (sWorldStateMgr->GetValue(WORLDSTATE_HORDE, me->GetMap()) == 1)
if (sWorldStateMgr->GetValue(WS_TEAM_IN_INSTANCE_HORDE, me->GetMap()) == 1)
prisonerEntry = NPC_CORK_FIZZLEPOP;
Creature* bunny = me->FindNearestCreatureWithOptions(25.0f, { .CreatureId = NPC_INVIS_BUNNY_GEOLORD, .IgnorePhases = true });
@@ -4516,16 +4458,6 @@ enum OgreOverseerQuilboarText
SAY_DEATH = 1,
};
enum ExilesReachQuilboarData
{
ITEM_STITCHED_CLOTH_TUNIC = 174811,
ITEM_STITCHED_LEATHER_TUNIC = 174812,
ITEM_LINKED_MAIL_HAUBERK = 174813,
ITEM_DENTED_CHESTPLATE = 174814,
QUEST_BRIARPATCH_CHEST_DROPPED = 58904
};
enum QuilboarWarriorGeomancerData
{
EVENT_BRUTAL_STRIKE = 1,
@@ -4561,33 +4493,6 @@ struct npc_quilboar_warrior : public ScriptedAI
{
if (roll_chance_f(33.33f))
Talk(SAY_DEATH, killer);
for (auto const& [playerGuid, loot] : me->m_personalLoot)
{
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGuid))
{
if (player->IsQuestRewarded(QUEST_BRIARPATCH_CHEST_DROPPED))
break;
for (LootItem const& lootItem : loot->items)
{
if (lootItem.type != LootItemType::Item)
continue;
switch (lootItem.itemid)
{
case ITEM_STITCHED_CLOTH_TUNIC:
case ITEM_STITCHED_LEATHER_TUNIC:
case ITEM_LINKED_MAIL_HAUBERK:
case ITEM_DENTED_CHESTPLATE:
player->SetRewardedQuest(QUEST_BRIARPATCH_CHEST_DROPPED);
break;
default:
break;
}
}
}
}
}
void UpdateAI(uint32 diff) override
@@ -4639,33 +4544,6 @@ struct npc_quilboar_geomancer : public ScriptedAI
{
if (roll_chance_f(33.33f))
Talk(SAY_DEATH, killer);
for (auto const& [playerGuid, loot] : me->m_personalLoot)
{
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGuid))
{
if (player->IsQuestRewarded(QUEST_BRIARPATCH_CHEST_DROPPED))
break;
for (LootItem const& lootItem : loot->items)
{
if (lootItem.type != LootItemType::Item)
continue;
switch (lootItem.itemid)
{
case ITEM_STITCHED_CLOTH_TUNIC:
case ITEM_STITCHED_LEATHER_TUNIC:
case ITEM_LINKED_MAIL_HAUBERK:
case ITEM_DENTED_CHESTPLATE:
player->SetRewardedQuest(QUEST_BRIARPATCH_CHEST_DROPPED);
break;
default:
break;
}
}
}
}
}
void UpdateAI(uint32 diff) override
@@ -4697,11 +4575,6 @@ enum ExilesReachOgreOverseerData
EVENT_OVERSEER_BACKHAND = 1,
EVENT_OVERSEER_EARTHSHATTER = 2,
ITEM_BATTERED_CLOAK = 11847,
ITEM_OVERSEERS_MANDATE = 174790,
QUEST_BRIARPATCH_OVERSEER_CLOAK_DROPPED = 56051,
SPELL_BACKHAND = 276991,
SPELL_EARTHSHATTER = 319292
};
@@ -4727,24 +4600,6 @@ struct npc_ogre_overseer : public ScriptedAI
void JustDied(Unit* killer) override
{
Talk(SAY_DEATH, killer);
for (auto const& [playerGuid, loot] : me->m_personalLoot)
{
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGuid))
{
if (player->IsQuestRewarded(QUEST_BRIARPATCH_OVERSEER_CLOAK_DROPPED))
break;
for (LootItem const& lootItem : loot->items)
{
if (lootItem.type == LootItemType::Item && lootItem.itemid == ITEM_BATTERED_CLOAK)
{
player->SetRewardedQuest(QUEST_BRIARPATCH_OVERSEER_CLOAK_DROPPED);
break;
}
}
}
}
}
void UpdateAI(uint32 diff) override
@@ -6481,10 +6336,6 @@ enum TorgokData
EVENT_CAST_SPIRIT_BOLT = 1,
EVENT_CAST_SOUL_GRASP = 2,
ITEM_TORGOKS_REAGENT_POUCH = 176398,
QUEST_TORGOKS_REAGENT_POUCH_DROPPED = 59610,
SPELL_SPIRIT_BOLT = 319294,
SPELL_SOUL_GRASP = 319298
};
@@ -6510,21 +6361,6 @@ struct npc_torgok_q55879 : public ScriptedAI
void JustDied(Unit* killer) override
{
Talk(SAY_DEATH, killer);
for (auto const& [playerGuid, loot] : me->m_personalLoot)
{
if (Player* player = ObjectAccessor::GetPlayer(*me, playerGuid))
{
for (LootItem const& lootItem : loot->items)
{
if (lootItem.type == LootItemType::Item && lootItem.itemid == ITEM_TORGOKS_REAGENT_POUCH)
{
player->SetRewardedQuest(QUEST_TORGOKS_REAGENT_POUCH_DROPPED);
break;
}
}
}
}
}
void UpdateAI(uint32 diff) override
@@ -7121,7 +6957,6 @@ void AddSC_zone_exiles_reach()
RegisterCreatureAI(npc_bo_beach_laying);
RegisterCreatureAI(npc_mithran_dawntracker_beach_laying);
RegisterCreatureAI(npc_lana_jordan_beach_laying);
RegisterCreatureAI(npc_murloc_spearhunter_watershaper);
RegisterCreatureAI(npc_murloc_spearhunter_watershaper_higher_ground);
new FactoryCreatureScript<CreatureAI, &BoBeachStandingAISelector>("npc_bo_beach_standing");
new FactoryCreatureScript<CreatureAI, &MithdranBeachStandingAISelector>("npc_mithdran_dawntracker_beach_standing");