[Items] Overhaul Item Hand-in System (#4593)

* [Items] Overhaul Item Hand-in System

* Edge case lua fix

* Merge fix

* I'm going to be amazed if this works first try

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Add protections against scripts that hand back items themselves

* Remove EVENT_ITEM_ScriptStopReturn

* test

* Update npc_handins.cpp

* Add Items:AlwaysReturnHandins

* Update spdat.cpp

* Bypass update prompt on CI
This commit is contained in:
Chris Miles
2025-02-03 16:51:09 -06:00
committed by GitHub
parent d1d6db3a09
commit 6fb919a16f
40 changed files with 2254 additions and 473 deletions
+58 -6
View File
@@ -233,8 +233,8 @@ bool IsDamageOverTimeSpell(uint16 spell_id)
for (int i = 0; i < EFFECT_COUNT; i++) {
const auto effect_id = spell.effect_id[i];
if (
spell.base_value[i] < 0 &&
effect_id == SE_CurrentHP &&
spell.base_value[i] < 0 &&
effect_id == SE_CurrentHP &&
spell.buff_duration > 1
) {
return true;
@@ -629,7 +629,7 @@ bool IsPBAENukeSpell(uint16 spell_id)
) {
return true;
}
return false;
}
@@ -670,7 +670,7 @@ bool IsAnyNukeOrStunSpell(uint16 spell_id) {
) {
return true;
}
return false;
}
@@ -2693,7 +2693,7 @@ bool IsAegolismSpell(uint16 spell_id) {
bool AegolismStackingIsSymbolSpell(uint16 spell_id) {
/*
This is hardcoded to be specific to the type of HP buffs that are removed if a mob has an Aegolism buff.
*/
@@ -2793,7 +2793,7 @@ bool IsValidSpellAndLoS(uint32 spell_id, bool has_los) {
if (!IsValidSpell(spell_id)) {
return false;
}
if (!has_los && IsTargetRequiredForSpell(spell_id)) {
return false;
}
@@ -2949,3 +2949,55 @@ bool IsHateSpell(uint16 spell_id) {
)
);
}
bool IsDisciplineTome(const EQ::ItemData* item)
{
if (!item->IsClassCommon() || item->ItemType != EQ::item::ItemTypeSpell) {
return false;
}
//Need a way to determine the difference between a spell and a tome
//so they cant turn in a spell and get it as a discipline
//this is kinda a hack:
const std::string item_name = item->Name;
if (
!Strings::BeginsWith(item_name, "Tome of ") &&
!Strings::BeginsWith(item_name, "Skill: ")
) {
return false;
}
//we know for sure none of the int casters get disciplines
uint32 class_bit = 0;
class_bit |= 1 << (Class::Wizard - 1);
class_bit |= 1 << (Class::Enchanter - 1);
class_bit |= 1 << (Class::Magician - 1);
class_bit |= 1 << (Class::Necromancer - 1);
if (item->Classes & class_bit) {
return false;
}
const auto& spell_id = static_cast<uint32>(item->Scroll.Effect);
if (!IsValidSpell(spell_id)) {
return false;
}
if (!IsDiscipline(spell_id)) {
return false;
}
const auto &spell = spells[spell_id];
if (
spell.classes[Class::Wizard - 1] != 255 &&
spell.classes[Class::Enchanter - 1] != 255 &&
spell.classes[Class::Magician - 1] != 255 &&
spell.classes[Class::Necromancer - 1] != 255
) {
return false;
}
return true;
}