mirror of
https://github.com/araxiaonline/mod-mythic-plus.git
synced 2026-06-13 03:02:24 -04:00
Starting to build out the base setup for the module
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
|
||||
Appender.MythicPlusLog=2,5,0,mod-mythic-plus.log,w
|
||||
Appender.MythicPlusConsole=1,5,0,"1 9 3 6 5 8"
|
||||
Logger.module.MythicPlus=5,MythicPlusLog MythicPlusConsole
|
||||
|
||||
@@ -12,16 +12,22 @@ public:
|
||||
|
||||
void OnCreatureAddWorld(Creature* creature) override
|
||||
{
|
||||
// if (creature->GetMap()->IsDungeon() || creature->GetMap()->IsRaid())
|
||||
// LOG_DEBUG("module.MythicPlus",
|
||||
// "MythicPlus_AllCreatureScript::OnCreatureAddWorld(): {} ({})",
|
||||
// creature->GetName(),
|
||||
// creature->GetLevel()
|
||||
// );
|
||||
MythicPlus* mp = MythicPlus::getInstance();
|
||||
if(!mp->IsMapEligible(creature->GetMap())) {
|
||||
return;
|
||||
}
|
||||
|
||||
mp->debug("OnCreatureAddWorld({}, {})", creature->GetName(), creature->GetLevel());
|
||||
|
||||
}
|
||||
|
||||
void OnCreatureRemoveWorld(Creature* creature) override
|
||||
{
|
||||
MythicPlus* mp = MythicPlus::getInstance();
|
||||
if(!mp->IsMapEligible(creature->GetMap())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (creature->GetMap()->IsDungeon() || creature->GetMap()->IsRaid())
|
||||
// LOG_DEBUG("module.MythicPlus",
|
||||
// "MythicPlus_AllCreatureScript::OnCreatureRemoveWorld(): {} ({})",
|
||||
@@ -35,6 +41,8 @@ public:
|
||||
|
||||
void OnAllCreatureUpdate(Creature* creature, uint32 /*diff*/) override
|
||||
{
|
||||
MythicPlus* mp = MythicPlus::getInstance();
|
||||
|
||||
// If the config is out of date and the creature was reset, run modify against it
|
||||
// if (ResetCreatureIfNeeded(creature))
|
||||
// {
|
||||
@@ -54,7 +62,9 @@ public:
|
||||
|
||||
};
|
||||
|
||||
void AddAllCreatureScripts()
|
||||
void Add_MP_AllCreatureScripts()
|
||||
{
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("Add_MP_AllCreatureScripts()");
|
||||
new MythicPlus_AllCreatureScript();
|
||||
}
|
||||
|
||||
@@ -14,34 +14,43 @@ public:
|
||||
|
||||
void OnCreateMap(Map* map)
|
||||
{
|
||||
// LOG_DEBUG("module.MythicPlus", "MythicPlus_AllMapScript::OnCreateMap(): {}", map->GetMapName());
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("AllMapScript::OnCreateMap(): {}", map->GetMapName());
|
||||
|
||||
if (!mp->IsMapEligible(map)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (!map->IsDungeon() && !map->IsRaid())
|
||||
// return;
|
||||
|
||||
}
|
||||
|
||||
void OnPlayerEnterAll(Map* map, Player* player)
|
||||
{
|
||||
// LOG_DEBUG("module.MythicPlus", "MythicPlus_AllMapScript::OnPlayerEnterAll(): {}", map->GetMapName());
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("AllMapScript::OnPlayerEnterAll(): {}", map->GetMapName());
|
||||
|
||||
// if (!map->IsDungeon() && !map->IsRaid())
|
||||
// return;
|
||||
if (!mp->IsMapEligible(map)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// if (player->IsGameMaster())
|
||||
// return;
|
||||
}
|
||||
|
||||
void OnPlayerLeaveAll(Map* map, Player* player)
|
||||
{
|
||||
// LOG_DEBUG("module.MythicPlus", "MythicPlus_AllMapScript::OnPlayerLeaveAll(): {}", map->GetMapName());
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("AllMapScript::OnPlayerLeaveAll(): {}", map->GetMapName());
|
||||
|
||||
if (!mp->IsMapEligible(map)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// if (!sMythicPlus->EnableGlobal)
|
||||
// return;
|
||||
}
|
||||
};
|
||||
|
||||
void AddAllMapScripts()
|
||||
void Add_MP_AllMapScripts()
|
||||
{
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("Add_MP_AllMapScripts()");
|
||||
new MythicPlus_AllMapScript();
|
||||
}
|
||||
@@ -5,12 +5,17 @@
|
||||
class MythicPlus_CommandScript : public CommandScript
|
||||
{
|
||||
public:
|
||||
MythicPlus_CommandScript() : CommandScript("MythicPlus_CommandScript")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
void AddCommandScripts()
|
||||
void Add_MP_CommandScripts()
|
||||
{
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("Add_MP_CommandScripts()");
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,9 @@ public:
|
||||
|
||||
};
|
||||
|
||||
void AddGlobalScripts()
|
||||
void Add_MP_GlobalScripts()
|
||||
{
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("Add_MP_GlobalScripts()");
|
||||
new MythicPlus_GlobalScript();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,9 @@ class MythicPlus_GroupScript : public GroupScript
|
||||
}
|
||||
};
|
||||
|
||||
void AddGroupScripts()
|
||||
void Add_MP_GroupScripts()
|
||||
{
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("Add_MP_GroupScripts()");
|
||||
new MythicPlus_GroupScript();
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "MythicPlus.h"
|
||||
#include "MapMgr.h"
|
||||
|
||||
MythicPlus::MythicPlus()
|
||||
{
|
||||
@@ -9,3 +10,16 @@ MythicPlus::~MythicPlus()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool MythicPlus::IsMapEligible(Map* map)
|
||||
{
|
||||
if (!Enabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (map->IsDungeon()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
#ifndef MYTHICPLUS_H
|
||||
#define MYTHICPLUS_H
|
||||
|
||||
#include "MapMgr.h"
|
||||
#include "Log.h"
|
||||
|
||||
class MythicPlus {
|
||||
private:
|
||||
MythicPlus();
|
||||
~MythicPlus();
|
||||
public:
|
||||
~MythicPlus();
|
||||
public:
|
||||
|
||||
static MythicPlus * getInstance() {
|
||||
static MythicPlus instance;
|
||||
return &instance;
|
||||
}
|
||||
bool Enabled = true;
|
||||
|
||||
bool IsMapEligible(Map* map);
|
||||
|
||||
// create a variadic function called `debug` that takes a string and a variadic number of arguments
|
||||
template<typename... Args>
|
||||
void debug(const char* fmt, Args&&... args) {
|
||||
LOG_DEBUG("module.MythicPlus", "[MythicPlus] " + std::string(fmt), std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
static MythicPlus * getInstance() {
|
||||
static MythicPlus instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#define sMythicPlus MythicPlus::getInstance()
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,22 +1,25 @@
|
||||
|
||||
#include "Log.h"
|
||||
|
||||
void Addmod_mythic_plusScripts();
|
||||
void AddAllCreatureScripts();
|
||||
void AddAllMapScripts();
|
||||
void AddCommandScripts();
|
||||
void AddGlobalScripts();
|
||||
void AddGroupScripts();
|
||||
void AddPlayerScripts();
|
||||
void AddUnitScripts();
|
||||
void AddWorldScripts();
|
||||
void Add_MP_AllCreatureScripts();
|
||||
void Add_MP_AllMapScripts();
|
||||
void Add_MP_CommandScripts();
|
||||
void Add_MP_GlobalScripts();
|
||||
void Add_MP_GroupScripts();
|
||||
void Add_MP_PlayerScripts();
|
||||
void Add_MP_UnitScripts();
|
||||
void Add_MP_WorldScripts();
|
||||
|
||||
void Addmod_mythic_plusScripts()
|
||||
{
|
||||
AddAllCreatureScripts();
|
||||
AddAllMapScripts();
|
||||
AddCommandScripts();
|
||||
AddGlobalScripts();
|
||||
AddGroupScripts();
|
||||
AddPlayerScripts();
|
||||
AddUnitScripts();
|
||||
AddWorldScripts();
|
||||
LOG_DEBUG("module.MythicPlus", "[MythicPlus] Initializing scripts.");
|
||||
Add_MP_AllCreatureScripts();
|
||||
Add_MP_AllMapScripts();
|
||||
Add_MP_CommandScripts();
|
||||
Add_MP_GlobalScripts();
|
||||
Add_MP_GroupScripts();
|
||||
Add_MP_PlayerScripts();
|
||||
Add_MP_UnitScripts();
|
||||
Add_MP_WorldScripts();
|
||||
}
|
||||
|
||||
@@ -50,7 +50,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void AddPlayerScripts()
|
||||
void Add_MP_PlayerScripts()
|
||||
{
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("Add_MP_PlayerScripts()");
|
||||
new MythicPlus_PlayerScript();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,9 @@ public:
|
||||
|
||||
};
|
||||
|
||||
void AddUnitScripts()
|
||||
void Add_MP_UnitScripts()
|
||||
{
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("Add_MP_UnitScripts()");
|
||||
new MythicPlus_UnitScript();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,9 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
void AddWorldScripts()
|
||||
void Add_MP_WorldScripts()
|
||||
{
|
||||
static MythicPlus* mp = MythicPlus::getInstance();
|
||||
mp->debug("Add_MP_WorldScripts()");
|
||||
new MythicPlus_WorldScript();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user