mirror of
https://github.com/ZhengPeiRu21/mod-individual-progression
synced 2025-11-29 23:44:51 +08:00
Refactoring to re-organize scripts
This commit is contained in:
221
src/IndividualProgressionAwarenessScripts.cpp
Normal file
221
src/IndividualProgressionAwarenessScripts.cpp
Normal file
@@ -0,0 +1,221 @@
|
||||
#include "IndividualProgression.h"
|
||||
|
||||
class gobject_ipp_wotlk : public GameObjectScript
|
||||
{
|
||||
public:
|
||||
gobject_ipp_wotlk() : GameObjectScript("gobject_ipp_wotlk") { }
|
||||
|
||||
struct gobject_ipp_wotlkAI: GameObjectAI
|
||||
{
|
||||
explicit gobject_ipp_wotlkAI(GameObject* object) : GameObjectAI(object) { };
|
||||
|
||||
bool CanBeSeen(Player const* player) override
|
||||
{
|
||||
if (player->IsGameMaster() || !sIndividualProgression->enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||
return sIndividualProgression->hasPassedProgression(target, PROGRESSION_TBC_TIER_5);
|
||||
}
|
||||
};
|
||||
|
||||
GameObjectAI* GetAI(GameObject* object) const override
|
||||
{
|
||||
return new gobject_ipp_wotlkAI(object);
|
||||
}
|
||||
};
|
||||
|
||||
class gobject_ipp_tbc : public GameObjectScript
|
||||
{
|
||||
public:
|
||||
gobject_ipp_tbc() : GameObjectScript("gobject_ipp_tbc") { }
|
||||
|
||||
struct gobject_ipp_tbcAI: GameObjectAI
|
||||
{
|
||||
explicit gobject_ipp_tbcAI(GameObject* object) : GameObjectAI(object) { };
|
||||
|
||||
bool CanBeSeen(Player const* player) override
|
||||
{
|
||||
if (player->IsGameMaster() || !sIndividualProgression->enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||
return sIndividualProgression->hasPassedProgression(target, PROGRESSION_NAXX40);
|
||||
}
|
||||
};
|
||||
|
||||
GameObjectAI* GetAI(GameObject* object) const override
|
||||
{
|
||||
return new gobject_ipp_tbcAI(object);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_ipp_tbc : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_ipp_tbc() : CreatureScript("npc_ipp_tbc") { }
|
||||
|
||||
struct npc_ipp_tbcAI: ScriptedAI
|
||||
{
|
||||
explicit npc_ipp_tbcAI(Creature* creature) : ScriptedAI(creature) { };
|
||||
|
||||
bool CanBeSeen(Player const* player) override
|
||||
{
|
||||
if (player->IsGameMaster() || !sIndividualProgression->enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||
return sIndividualProgression->hasPassedProgression(target, PROGRESSION_NAXX40);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_ipp_tbcAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_ipp_tbc_t4 : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_ipp_tbc_t4() : CreatureScript("npc_ipp_tbc_t4") { }
|
||||
|
||||
struct npc_ipp_tbc_t4AI: ScriptedAI
|
||||
{
|
||||
explicit npc_ipp_tbc_t4AI(Creature* creature) : ScriptedAI(creature) { };
|
||||
|
||||
bool CanBeSeen(Player const* player) override
|
||||
{
|
||||
if (player->IsGameMaster() || !sIndividualProgression->enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||
return sIndividualProgression->hasPassedProgression(target, PROGRESSION_TBC_TIER_3);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_ipp_tbc_t4AI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_ipp_tbc_pre_t4 : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_ipp_tbc_pre_t4() : CreatureScript("npc_ipp_tbc_pre_t4") { }
|
||||
|
||||
struct npc_ipp_tbc_pre_t4AI: ScriptedAI
|
||||
{
|
||||
explicit npc_ipp_tbc_pre_t4AI(Creature* creature) : ScriptedAI(creature) { };
|
||||
|
||||
bool CanBeSeen(Player const* player) override
|
||||
{
|
||||
if (player->IsGameMaster() || !sIndividualProgression->enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||
return sIndividualProgression->isBeforeProgression(target,PROGRESSION_TBC_TIER_3);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_ipp_tbc_pre_t4AI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_ipp_wotlk : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_ipp_wotlk() : CreatureScript("npc_ipp_wotlk") { }
|
||||
|
||||
struct npc_ipp_wotlkAI: ScriptedAI
|
||||
{
|
||||
explicit npc_ipp_wotlkAI(Creature* creature) : ScriptedAI(creature) { };
|
||||
|
||||
bool CanBeSeen(Player const* player) override
|
||||
{
|
||||
if (player->IsGameMaster() || !sIndividualProgression->enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||
return sIndividualProgression->hasPassedProgression(target, PROGRESSION_TBC_TIER_5);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_ipp_wotlkAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_ipp_aq : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_ipp_aq() : CreatureScript("npc_ipp_aq") { }
|
||||
|
||||
struct npc_ipp_aqAI: ScriptedAI
|
||||
{
|
||||
explicit npc_ipp_aqAI(Creature* creature) : ScriptedAI(creature) { };
|
||||
|
||||
bool CanBeSeen(Player const* player) override
|
||||
{
|
||||
if (player->IsGameMaster() || !sIndividualProgression->enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||
return sIndividualProgression->hasPassedProgression(target, PROGRESSION_BLACKWING_LAIR);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_ipp_aqAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class npc_ipp_naxx40 : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_ipp_naxx40() : CreatureScript("npc_ipp_naxx40") { }
|
||||
|
||||
struct npc_ipp_naxx40AI: ScriptedAI
|
||||
{
|
||||
explicit npc_ipp_naxx40AI(Creature* creature) : ScriptedAI(creature) { };
|
||||
|
||||
bool CanBeSeen(Player const* player) override
|
||||
{
|
||||
if (player->IsGameMaster() || !sIndividualProgression->enabled)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(player->GetGUID());
|
||||
return sIndividualProgression->hasPassedProgression(target, PROGRESSION_AQ);
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_ipp_naxx40AI(creature);
|
||||
}
|
||||
};
|
||||
// Add all scripts in one
|
||||
void AddSC_mod_individual_progression_awareness()
|
||||
{
|
||||
new npc_ipp_aq();
|
||||
new npc_ipp_naxx40();
|
||||
new npc_ipp_tbc();
|
||||
new npc_ipp_tbc_t4();
|
||||
new npc_ipp_tbc_pre_t4();
|
||||
new npc_ipp_wotlk();
|
||||
new gobject_ipp_tbc();
|
||||
// new gobject_ipp_wotlk(); // Not used yet
|
||||
}
|
||||
Reference in New Issue
Block a user