feat(Scripts/Commands): show SpellSchoolImmuneMask in .npc info (#6788)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1625629454877092500');
|
||||||
|
|
||||||
|
DELETE FROM `acore_string` WHERE `entry` = 5062;
|
||||||
|
INSERT INTO `acore_string` (`entry`, `content_default`) VALUES
|
||||||
|
(5062, 'SpellSchoolImmuneMask: %u');
|
||||||
@@ -1175,7 +1175,9 @@ enum AcoreStrings
|
|||||||
LANG_COMMAND_MUTEHISTORY_EMPTY = 5060,
|
LANG_COMMAND_MUTEHISTORY_EMPTY = 5060,
|
||||||
LANG_COMMAND_MUTEHISTORY_OUTPUT = 5061,
|
LANG_COMMAND_MUTEHISTORY_OUTPUT = 5061,
|
||||||
|
|
||||||
// Room for more Trinity strings 5062-9999
|
LANG_NPCINFO_SPELL_SCHOOL_IMMUNE = 5062,
|
||||||
|
|
||||||
|
// Room for more strings 5063-9999
|
||||||
|
|
||||||
// Level requirement notifications
|
// Level requirement notifications
|
||||||
LANG_SAY_REQ = 6604,
|
LANG_SAY_REQ = 6604,
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ struct MechanicImmune
|
|||||||
char const* text;
|
char const* text;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_MECHANIC 32
|
constexpr auto MAX_MECHANIC = 32;
|
||||||
|
|
||||||
MechanicImmune const mechanicImmunes[MAX_MECHANIC] =
|
MechanicImmune const mechanicImmunes[MAX_MECHANIC] =
|
||||||
{
|
{
|
||||||
@@ -103,6 +103,23 @@ MechanicImmune const mechanicImmunes[MAX_MECHANIC] =
|
|||||||
{ MECHANIC_ENRAGED, "MECHANIC_ENRAGED" },
|
{ MECHANIC_ENRAGED, "MECHANIC_ENRAGED" },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SpellSchoolImmune
|
||||||
|
{
|
||||||
|
uint32 flag;
|
||||||
|
char const* text;
|
||||||
|
};
|
||||||
|
|
||||||
|
SpellSchoolImmune const spellSchoolImmunes[MAX_SPELL_SCHOOL] =
|
||||||
|
{
|
||||||
|
{ SPELL_SCHOOL_NORMAL, "SPELL_SCHOOL_NORMAL" },
|
||||||
|
{ SPELL_SCHOOL_HOLY, "SPELL_SCHOOL_HOLY" },
|
||||||
|
{ SPELL_SCHOOL_FIRE, "SPELL_SCHOOL_FIRE" },
|
||||||
|
{ SPELL_SCHOOL_NATURE, "SPELL_SCHOOL_NATURE" },
|
||||||
|
{ SPELL_SCHOOL_FROST, "SPELL_SCHOOL_FROST" },
|
||||||
|
{ SPELL_SCHOOL_SHADOW, "SPELL_SCHOOL_SHADOW" },
|
||||||
|
{ SPELL_SCHOOL_ARCANE, "SPELL_SCHOOL_ARCANE" },
|
||||||
|
};
|
||||||
|
|
||||||
class npc_commandscript : public CommandScript
|
class npc_commandscript : public CommandScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -716,6 +733,7 @@ public:
|
|||||||
uint32 faction = target->getFaction();
|
uint32 faction = target->getFaction();
|
||||||
uint32 npcflags = target->GetUInt32Value(UNIT_NPC_FLAGS);
|
uint32 npcflags = target->GetUInt32Value(UNIT_NPC_FLAGS);
|
||||||
uint32 mechanicImmuneMask = cInfo->MechanicImmuneMask;
|
uint32 mechanicImmuneMask = cInfo->MechanicImmuneMask;
|
||||||
|
uint32 spellSchoolImmuneMask = cInfo->SpellSchoolImmuneMask;
|
||||||
uint32 displayid = target->GetDisplayId();
|
uint32 displayid = target->GetDisplayId();
|
||||||
uint32 nativeid = target->GetNativeDisplayId();
|
uint32 nativeid = target->GetNativeDisplayId();
|
||||||
uint32 Entry = target->GetEntry();
|
uint32 Entry = target->GetEntry();
|
||||||
@@ -740,13 +758,30 @@ public:
|
|||||||
handler->PSendSysMessage(LANG_NPCINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str());
|
handler->PSendSysMessage(LANG_NPCINFO_AIINFO, target->GetAIName().c_str(), target->GetScriptName().c_str());
|
||||||
|
|
||||||
for (uint8 i = 0; i < NPCFLAG_COUNT; i++)
|
for (uint8 i = 0; i < NPCFLAG_COUNT; i++)
|
||||||
|
{
|
||||||
if (npcflags & npcFlagTexts[i].flag)
|
if (npcflags & npcFlagTexts[i].flag)
|
||||||
|
{
|
||||||
handler->PSendSysMessage(npcFlagTexts[i].text, npcFlagTexts[i].flag);
|
handler->PSendSysMessage(npcFlagTexts[i].text, npcFlagTexts[i].flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handler->PSendSysMessage(LANG_NPCINFO_MECHANIC_IMMUNE, mechanicImmuneMask);
|
handler->PSendSysMessage(LANG_NPCINFO_MECHANIC_IMMUNE, mechanicImmuneMask);
|
||||||
for (uint8 i = 1; i < MAX_MECHANIC; ++i)
|
for (uint8 i = 1; i < MAX_MECHANIC; ++i)
|
||||||
|
{
|
||||||
if (mechanicImmuneMask & (1 << (mechanicImmunes[i].flag - 1)))
|
if (mechanicImmuneMask & (1 << (mechanicImmunes[i].flag - 1)))
|
||||||
|
{
|
||||||
handler->PSendSysMessage(mechanicImmunes[i].text, mechanicImmunes[i].flag);
|
handler->PSendSysMessage(mechanicImmunes[i].text, mechanicImmunes[i].flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_NPCINFO_SPELL_SCHOOL_IMMUNE, spellSchoolImmuneMask);
|
||||||
|
for (uint8 i = 0; i < MAX_SPELL_SCHOOL; ++i)
|
||||||
|
{
|
||||||
|
if (spellSchoolImmuneMask & (1 << spellSchoolImmunes[i].flag))
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(spellSchoolImmunes[i].text, spellSchoolImmunes[i].flag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ enum SpellSchools
|
|||||||
SPELL_SCHOOL_ARCANE = 6
|
SPELL_SCHOOL_ARCANE = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_SPELL_SCHOOL 7
|
constexpr auto MAX_SPELL_SCHOOL = 7;
|
||||||
|
|
||||||
enum SpellSchoolMask
|
enum SpellSchoolMask
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user