From 1c75236508102252976fa862159463de255510fd Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Fri, 25 Jun 2021 15:38:02 -0400 Subject: [PATCH] [Spells Cleanup] Unify and add most hardcoded spell IDs (#1438) Move the newer stuff added that was recently to the same place all of our previous spell IDs were defined. Either of these solutions were good, but I went with defines since it was less changes I also added a bunch of stuff the client has hardcoded behavior for, but not currently implemented by us. The removed stuff from the command_castspell were reused on live, so I figured it was best to remove them from the restrictions since they are no longer test spells --- common/eq_constants.h | 2 - common/spdat.h | 120 ++++++++++++++++++++++++++++++++++++++++++ zone/attack.cpp | 2 +- zone/command.cpp | 46 +++++++++++++--- zone/spells.cpp | 2 +- 5 files changed, 161 insertions(+), 11 deletions(-) diff --git a/common/eq_constants.h b/common/eq_constants.h index 1a4f3c462..e5fbd9f64 100644 --- a/common/eq_constants.h +++ b/common/eq_constants.h @@ -438,8 +438,6 @@ static const uint8 SkillDamageTypes[EQ::skills::HIGHEST_SKILL + 1] = // change t static const uint32 MAX_SPELL_DB_ID_VAL = 65535; -static const uint32 DB_SPELL_CAZIC_TOUCH = 982; -static const uint32 DB_SPELL_TOUCH_OF_VINITRAS = 2859; static const uint32 DB_FACTION_GEM_CHOPPERS = 255; static const uint32 DB_FACTION_HERETICS = 265; static const uint32 DB_FACTION_KING_AKANON = 333; diff --git a/common/spdat.h b/common/spdat.h index a2a26da2e..7b3ff5ed7 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -33,6 +33,126 @@ #define SPELL_IMP_HARM_TOUCH 2774 #define SPELL_NPC_HARM_TOUCH 929 #define SPELL_AVATAR_ST_PROC 2434 +#define SPELL_CAZIC_TOUCH 982 +#define SPELL_TOUCH_OF_VINITRAS 2859 +#define SPELL_DESPERATE_HOPE 841 +#define SPELL_CHARM 300 +#define SPELL_METAMORPHOSIS65 2314 +#define SPELL_JT_BUFF 3716 +#define SPELL_CAN_O_WHOOP_ASS 911 +#define SPELL_PHOENIX_CHARM 3014 +#define SPELL_AVATAR_KNOCKBACK 905 +#define SPELL_SHAPECHANGE65 2079 +#define SPELL_SUNSET_HOME1218 1218 +#define SPELL_SUNSET_HOME819 819 +#define SPELL_SHAPECHANGE75 780 +#define SPELL_SHAPECHANGE80 781 +#define SPELL_SHAPECHANGE85 782 +#define SPELL_SHAPECHANGE90 783 +#define SPELL_SHAPECHANGE95 784 +#define SPELL_SHAPECHANGE100 785 +#define SPELL_SHAPECHANGE25 1200 +#define SPELL_SHAPECHANGE30 1201 +#define SPELL_SHAPECHANGE35 1202 +#define SPELL_SHAPECHANGE40 1203 +#define SPELL_SHAPECHANGE45 1204 +#define SPELL_SHAPECHANGE50 1205 +#define SPELL_NPC_AEGOLISM 1343 +#define SPELL_SHAPECHANGE55 1923 +#define SPELL_SHAPECHANGE60 1924 +#define SPELL_COMMAND_OF_DRUZZIL 3355 +#define SPELL_SHAPECHANGE70 6503 +// these have known hardcoded behavior but we don't do anything yet, move them above this comment when fixed +#define SPELL_THE_DAINS_JUSTICE 1476 +#define SPELL_MODULATION 1502 +#define SPELL_TORPOR 1576 +#define SPELL_SPLURT 1620 +#define SPELL_SEBILITE_POX 1814 +#define SPELL_SOUL_WELL 1816 +#define SPELL_MYSTICAL_TRANSVERGENCE 2716 +#define SPELL_ACT_OF_VALOR 2775 +#define SPELL_STOICISM 3694 +#define SPELL_ALTER_PLANE_HATE 666 +#define SPELL_ALTER_PLANE_SKY 674 +#define SPELL_DENONS_DESPERATE_DIRGE 742 +#define SPELL_BOND_OF_SATHIR 833 +#define SPELL_DISEASED_CLOUD 836 +#define SPELL_ACTING_RESIST 775 +#define SPELL_ACTING_SHIELD 776 +#define SPELL_ACTING_GUARD 777 +#define SPELL_GUIDE_ACTING 778 +#define SPELL_BYE_BYE 779 +#define SPELL_ACTING_RESIST_II 1206 +#define SPELL_ACTING_SHIELD_II 1207 +#define SPELL_ACTING_GUARD_II 1208 +#define SPELL_GUIDE_ACTING2 1209 +#define SPELL_BYE_BYTE2 1210 +#define SPELL_GUIDE_CANCEL_MAGIC 1211 +#define SPELL_GUIDE_JOURNEY 1212 +#define SPELL_GUIDE_VISION 1213 +#define SPELL_GUIDE_HEALTH 1214 +#define SPELL_GUIDE_INVULNERABILITY 1215 +#define SPELL_GUIDE_BOLT 1216 +#define SPELL_GUIDE_MEMORY_BLUE 1217 +#define SPELL_GUIDE_ALLIANCE 1219 +#define SPELL_SPECIAL_SIGHT 1220 +#define SPELL_TERROR_OF_DARKNESS 1221 +#define SPELL_TERROR_OF_SHADOWS 1222 +#define SPELL_TERROR_OF_DEATH 1223 +#define SPELL_TERROR_OF_TERRIS 1224 +#define SPELL_VOICE_OF_DARKNESS 1225 +#define SPELL_VOICE_OF_SHADOWS 1226 +#define SPELL_VOICE_OF_DEATH 1227 +#define SPELL_VOICE_OF_TERRIS 1228 +#define SPELL_VENGEANCE_V 1229 +#define SPELL_VENGEANCE_VII 1230 +#define SPELL_VENGEANCE_VIII 1231 +#define SPELL_VENGEANCE_IX 1232 +#define SPELL_CORRUPTED_LACERATION 1233 +#define SPELL_VISIONS_OF_CHAOS 1234 +#define SPELL_VISIONS_OF_PAIN 1235 +#define SPELL_COMMANDING_PRESENCE 1236 +#define SPELL_MALICIOUS_INTENT 1237 +#define SPELL_CURSE_OF_FLAMES 1238 +#define SPELL_DEVOURING_CONFLAGRATION 1239 +#define SPELL_AVATAR_SHIELD 1240 +#define SPELL_AVATAR_SIGHT 1241 +#define SPELL_AVATAR_GUARD 1242 +#define SPELL_AVATAR_RESIST 1243 +#define SPELL_MAGI_BOLT 1244 +#define SPELL_MAGI_STRIKE 1245 +#define SPELL_MAGI_CURSE 1246 +#define SPELL_MAGI_CIRCLE 1247 +#define SPELL_SPIRITUAL_ECHO 1248 +#define SPELL_BRISTLING_ARMAMENT 1249 +#define SPELL_WATON_DESTRUCTION 1250 +#define SPELL_ACTING_MAGIC_RESIST_I 1900 +#define SPELL_ACTING_FIRE_RESIST_I 1901 +#define SPELL_ACTING_COLD_RESIST_I 1902 +#define SPELL_ACTING_POISON_RESIST_I 1903 +#define SPELL_ACTING_DISEASE_RESIST_I 1904 +#define SPELL_ACTING_MAGIC_RESIST_II 1905 +#define SPELL_ACTING_FIRE_RESIST_II 1906 +#define SPELL_ACTING_COLD_RESIST_II 1907 +#define SPELL_ACTING_POISON_RESIST_II 1908 +#define SPELL_ACTING_DISEASE_RESIST_II 1909 +#define SPELL_ACTING_FIRE_SHIELD 1910 +#define SPELL_ACTING_POISON_SHIELD 1911 +#define SPELL_ACTING_COLD_SHIELD 1912 +#define SPELL_ACTING_DISEASE_SHIELD 1913 +#define SPELL_ACTING_ARMOR_I 1914 +#define SPELL_ACTING_ARMOR_II 1915 +#define SPELL_ACTING_ARMOR_III 1916 +#define SPELL_ACTING_HEALTH_I 1917 +#define SPELL_ACTING_HEALTH_II 1918 +#define SPELL_ACTING_HEALTH_III 1919 +#define SPELL_ACTING_HEALTH_IV 1920 +#define SPELL_ACTING_SPIRIT_I 1921 +#define SPELL_ACTING_SPIRIT_II 1922 +#define SPELL_RESURRECTION_SICKNESS 756 +#define SPELL_RESURRECTION_SICKNESS2 5249 +#define SPELL_REVIVAL_SICKNESS 13087 +#define SPELL_MANA_BURN 2751 #define EFFECT_COUNT 12 diff --git a/zone/attack.cpp b/zone/attack.cpp index fdcf553d9..980bd0dc9 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3444,7 +3444,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const bool FromDamageShield = (skill_used == EQ::skills::SkillAbjuration); bool ignore_invul = false; if (IsValidSpell(spell_id)) - ignore_invul = spell_id == 982 || spells[spell_id].cast_not_standing; // cazic touch + ignore_invul = spell_id == SPELL_CAZIC_TOUCH || spells[spell_id].cast_not_standing; if (!ignore_invul && (GetInvul() || DivineAura())) { LogCombat("Avoiding [{}] damage due to invulnerability", damage); diff --git a/zone/command.cpp b/zone/command.cpp index 89b3a22dd..50b209af1 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -2939,6 +2939,44 @@ void command_findspell(Client *c, const Seperator *sep) } } +inline bool CastRestrictedSpell(int spellid) +{ + switch (spellid) { + case SPELL_TOUCH_OF_VINITRAS: + case SPELL_DESPERATE_HOPE: + case SPELL_CHARM: + case SPELL_METAMORPHOSIS65: + case SPELL_JT_BUFF: + case SPELL_CAN_O_WHOOP_ASS: + case SPELL_PHOENIX_CHARM: + case SPELL_CAZIC_TOUCH: + case SPELL_AVATAR_KNOCKBACK: + case SPELL_SHAPECHANGE65: + case SPELL_SUNSET_HOME1218: + case SPELL_SUNSET_HOME819: + case SPELL_SHAPECHANGE75: + case SPELL_SHAPECHANGE80: + case SPELL_SHAPECHANGE85: + case SPELL_SHAPECHANGE90: + case SPELL_SHAPECHANGE95: + case SPELL_SHAPECHANGE100: + case SPELL_SHAPECHANGE25: + case SPELL_SHAPECHANGE30: + case SPELL_SHAPECHANGE35: + case SPELL_SHAPECHANGE40: + case SPELL_SHAPECHANGE45: + case SPELL_SHAPECHANGE50: + case SPELL_NPC_AEGOLISM: + case SPELL_SHAPECHANGE55: + case SPELL_SHAPECHANGE60: + case SPELL_COMMAND_OF_DRUZZIL: + case SPELL_SHAPECHANGE70: + return true; + default: + return false; + } +} + void command_castspell(Client *c, const Seperator *sep) { if (!sep->IsNumber(1)) @@ -2948,13 +2986,7 @@ void command_castspell(Client *c, const Seperator *sep) /* Spell restrictions. */ - if (((spellid == 2859) || (spellid == 841) || (spellid == 300) || (spellid == 2314) || - (spellid == 3716) || (spellid == 911) || (spellid == 3014) || (spellid == 982) || - (spellid == 905) || (spellid == 2079) || (spellid == 1218) || (spellid == 819) || - ((spellid >= 780) && (spellid <= 785)) || ((spellid >= 1200) && (spellid <= 1205)) || - ((spellid >= 1342) && (spellid <= 1348)) || (spellid == 1923) || (spellid == 1924) || - (spellid == 3355)) && - c->Admin() < commandCastSpecials) + if (CastRestrictedSpell(spellid) && c->Admin() < commandCastSpecials) c->Message(Chat::Red, "Unable to cast spell."); else if (spellid >= SPDAT_RECORDS) c->Message(Chat::White, "Error: #CastSpell: Argument out of range"); diff --git a/zone/spells.cpp b/zone/spells.cpp index 757ec0645..dee96509e 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2047,7 +2047,7 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui return false; //Death Touch targets the pet owner instead of the pet when said pet is tanking. - if ((RuleB(Spells, CazicTouchTargetsPetOwner) && spell_target && spell_target->HasOwner()) && spell_id == DB_SPELL_CAZIC_TOUCH || spell_id == DB_SPELL_TOUCH_OF_VINITRAS) { + if ((RuleB(Spells, CazicTouchTargetsPetOwner) && spell_target && spell_target->HasOwner()) && spell_id == SPELL_CAZIC_TOUCH || spell_id == SPELL_TOUCH_OF_VINITRAS) { Mob* owner = spell_target->GetOwner(); if (owner) {