mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 17:27:36 +01:00
Core/Wintergrasp: cleanup and codestyle.
(cherry picked from commit eb1a7297cf)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
--
|
||||
UPDATE `creature_template` SET `ScriptName`="npc_wg_give_promotion_credit" WHERE `entry` IN (30739, 30740, 31036, 31051, 31052, 31053, 31054, 31091, 31101, 31102, 31106, 31107, 31151, 31153);
|
||||
@@ -955,8 +955,6 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER)
|
||||
HandlePromotion(killer, victim);
|
||||
|
||||
return;
|
||||
|
||||
/// @todoRecent PvP activity worldstate
|
||||
}
|
||||
|
||||
|
||||
@@ -203,26 +203,6 @@ enum WintergraspNpcs
|
||||
BATTLEFIELD_WG_NPC_GUARD_A = 30740,
|
||||
BATTLEFIELD_WG_NPC_STALKER = 15214,
|
||||
|
||||
BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER = 31102,
|
||||
BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR = 32296, // <WINTERGRASP QUARTERMASTER>
|
||||
BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN = 31101, // <MASTER HEXXER>
|
||||
BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI = 39173, // <WINTERGRASP QUARTERMASTER>
|
||||
BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH = 31091,
|
||||
BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH = 31151,
|
||||
BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106,
|
||||
BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053,
|
||||
BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107,
|
||||
|
||||
BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052,
|
||||
BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294, // <WINTERGRASP QUARTERMASTER>
|
||||
BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA = 31051, // <ENCHANTRESS>
|
||||
BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER = 39172, // <WINTERGRASP QUARTERMASTER>
|
||||
BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH = 31036,
|
||||
BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS = 31153,
|
||||
BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE = 31108,
|
||||
BATTLEFIELD_WG_NPC_ANCHORITE_TESSA = 31054,
|
||||
BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO = 31109,
|
||||
|
||||
NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp
|
||||
NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
|
||||
|
||||
|
||||
@@ -384,120 +384,21 @@ class go_wg_vehicle_teleporter : public GameObjectScript
|
||||
}
|
||||
};
|
||||
|
||||
class npc_wg_quest_giver : public CreatureScript
|
||||
class npc_wg_give_promotion_credit : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_wg_quest_giver() : CreatureScript("npc_wg_quest_giver") { }
|
||||
npc_wg_give_promotion_credit() : CreatureScript("npc_wg_give_promotion_credit") { }
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
struct npc_wg_give_promotion_creditAI : public ScriptedAI
|
||||
{
|
||||
Battlefield* wintergrasp = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (!wintergrasp)
|
||||
return true;
|
||||
|
||||
if (creature->IsVendor())
|
||||
AddGossipItemFor(player, Player::GetDefaultGossipMenuForSource(creature), 0, GOSSIP_SENDER_MAIN, GOSSIP_OPTION_VENDOR);
|
||||
|
||||
/// @todo: move this to conditions or something else
|
||||
|
||||
// Player::PrepareQuestMenu(guid)
|
||||
if (creature->IsQuestGiver())
|
||||
{
|
||||
QuestRelationBounds objectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry());
|
||||
QuestRelationBounds objectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry());
|
||||
|
||||
QuestMenu& qm = player->PlayerTalkClass->GetQuestMenu();
|
||||
qm.ClearMenu();
|
||||
|
||||
for (QuestRelations::const_iterator i = objectQIR.first; i != objectQIR.second; ++i)
|
||||
{
|
||||
uint32 questId = i->second;
|
||||
QuestStatus status = player->GetQuestStatus(questId);
|
||||
if (status == QUEST_STATUS_COMPLETE)
|
||||
qm.AddMenuItem(questId, 4);
|
||||
else if (status == QUEST_STATUS_INCOMPLETE)
|
||||
qm.AddMenuItem(questId, 4);
|
||||
//else if (status == QUEST_STATUS_AVAILABLE)
|
||||
// qm.AddMenuItem(quest_id, 2);
|
||||
}
|
||||
|
||||
for (QuestRelations::const_iterator i = objectQR.first; i != objectQR.second; ++i)
|
||||
{
|
||||
uint32 questId = i->second;
|
||||
Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
|
||||
if (!quest)
|
||||
continue;
|
||||
|
||||
if (!player->CanTakeQuest(quest, false))
|
||||
continue;
|
||||
|
||||
switch (questId)
|
||||
{
|
||||
// Horde attacker
|
||||
case QUEST_BONES_AND_ARROWS_HORDE_ATT:
|
||||
case QUEST_JINXING_THE_WALLS_HORDE_ATT:
|
||||
case QUEST_SLAY_THEM_ALL_HORDE_ATT:
|
||||
case QUEST_FUELING_THE_DEMOLISHERS_HORDE_ATT:
|
||||
case QUEST_HEALING_WITH_ROSES_HORDE_ATT:
|
||||
case QUEST_DEFEND_THE_SIEGE_HORDE_ATT:
|
||||
if (wintergrasp->GetAttackerTeam() != TEAM_HORDE)
|
||||
continue;
|
||||
break;
|
||||
// Horde defender
|
||||
case QUEST_BONES_AND_ARROWS_HORDE_DEF:
|
||||
case QUEST_WARDING_THE_WALLS_HORDE_DEF:
|
||||
case QUEST_SLAY_THEM_ALL_HORDE_DEF:
|
||||
case QUEST_FUELING_THE_DEMOLISHERS_HORDE_DEF:
|
||||
case QUEST_HEALING_WITH_ROSES_HORDE_DEF:
|
||||
case QUEST_TOPPLING_THE_TOWERS_HORDE_DEF:
|
||||
case QUEST_STOP_THE_SIEGE_HORDE_DEF:
|
||||
if (wintergrasp->GetDefenderTeam() != TEAM_HORDE)
|
||||
continue;
|
||||
break;
|
||||
// Alliance attacker
|
||||
case QUEST_BONES_AND_ARROWS_ALLIANCE_ATT:
|
||||
case QUEST_WARDING_THE_WARRIORS_ALLIANCE_ATT:
|
||||
case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_ATT:
|
||||
case QUEST_DEFEND_THE_SIEGE_ALLIANCE_ATT:
|
||||
case QUEST_A_RARE_HERB_ALLIANCE_ATT:
|
||||
if (wintergrasp->GetAttackerTeam() != TEAM_ALLIANCE)
|
||||
continue;
|
||||
break;
|
||||
// Alliance defender
|
||||
case QUEST_BONES_AND_ARROWS_ALLIANCE_DEF:
|
||||
case QUEST_WARDING_THE_WARRIORS_ALLIANCE_DEF:
|
||||
case QUEST_NO_MERCY_FOR_THE_MERCILESS_ALLIANCE_DEF:
|
||||
case QUEST_SHOUTHERN_SABOTAGE_ALLIANCE_DEF:
|
||||
case QUEST_STOP_THE_SIEGE_ALLIANCE_DEF:
|
||||
case QUEST_A_RARE_HERB_ALLIANCE_DEF:
|
||||
if (wintergrasp->GetDefenderTeam() != TEAM_ALLIANCE)
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (quest->IsAutoComplete())
|
||||
qm.AddMenuItem(questId, 4);
|
||||
else if (player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
|
||||
qm.AddMenuItem(questId, 2);
|
||||
}
|
||||
}
|
||||
|
||||
SendGossipMenuFor(player, player->GetGossipTextId(creature), creature->GetGUID());
|
||||
return true;
|
||||
}
|
||||
|
||||
struct npc_wg_quest_giverAI : public ScriptedAI
|
||||
{
|
||||
npc_wg_quest_giverAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
npc_wg_give_promotion_creditAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void JustDied(Unit* killer) override
|
||||
{
|
||||
if (killer->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
BattlefieldWG* wintergrasp = (BattlefieldWG*)sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
BattlefieldWG* wintergrasp = static_cast<BattlefieldWG*>(sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG));
|
||||
if (!wintergrasp)
|
||||
return;
|
||||
|
||||
@@ -507,38 +408,10 @@ class npc_wg_quest_giver : public CreatureScript
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_wg_quest_giverAI(creature);
|
||||
return new npc_wg_give_promotion_creditAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_wg_guard : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_wg_guard() : CreatureScript("npc_wg_guard") { }
|
||||
|
||||
struct npc_wg_guardAI : public ScriptedAI
|
||||
{
|
||||
npc_wg_guardAI(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void JustDied(Unit* killer) override
|
||||
{
|
||||
if (killer->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
BattlefieldWG* wintergrasp = (BattlefieldWG*)sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
|
||||
if (!wintergrasp)
|
||||
return;
|
||||
|
||||
wintergrasp->HandlePromotion(killer->ToPlayer(), me);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_wg_guardAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class spell_wintergrasp_force_building : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
@@ -728,8 +601,7 @@ void AddSC_wintergrasp()
|
||||
new npc_wg_spirit_guide();
|
||||
new npc_wg_demolisher_engineer();
|
||||
new go_wg_vehicle_teleporter();
|
||||
new npc_wg_quest_giver();
|
||||
new npc_wg_guard();
|
||||
new npc_wg_give_promotion_credit();
|
||||
new spell_wintergrasp_force_building();
|
||||
new spell_wintergrasp_grab_passenger();
|
||||
new achievement_wg_didnt_stand_a_chance();
|
||||
|
||||
Reference in New Issue
Block a user