Convert NPC Spell AI from int16 to uint16. (#1262)

This commit is contained in:
Alex 2021-02-23 19:33:33 -05:00 committed by GitHub
parent 86ce506956
commit e6dee96266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 8 deletions

View File

@ -34,7 +34,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9160
#define CURRENT_BINARY_DATABASE_VERSION 9161
#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9027

View File

@ -414,6 +414,7 @@
9158|2020_12_09_underworld.sql|SHOW COLUMNS from `zone` LIKE 'underworld_teleport_index'|empty|
9159|2020_12_22_expedition_system.sql|SELECT * FROM db_version WHERE version >= 9159|empty|
9160|2021_02_14_npc_exp_mod.sql|SHOW COLUMNS from `npc_types` LIKE 'exp_mod'|empty|
9161|2021_02_15_npc_spell_entries_unsigned.sql|SELECT * FROM db_version WHERE version >= 9161|empty|
# Upgrade conditions:
# This won't be needed after this system is implemented, but it is used database that are not

View File

@ -0,0 +1 @@
ALTER TABLE `npc_spell_entries` MODIFY `spellid` UNSIGNED SMALLINT(5) NOT NULL DEFAULT 0;

View File

@ -2489,7 +2489,7 @@ create table npc_spells_entries (
);
*/
bool IsSpellInList(DBnpcspells_Struct* spell_list, int16 iSpellID);
bool IsSpellInList(DBnpcspells_Struct* spell_list, uint16 iSpellID);
bool IsSpellEffectInList(DBnpcspellseffects_Struct* spelleffect_list, uint16 iSpellEffectID, int32 base, int32 limit, int32 max);
bool NPC::AI_AddNPCSpells(uint32 iDBSpellsID) {
@ -2761,14 +2761,14 @@ bool IsSpellEffectInList(DBnpcspellseffects_Struct* spelleffect_list, uint16 iSp
return false;
}
bool IsSpellInList(DBnpcspells_Struct* spell_list, int16 iSpellID) {
bool IsSpellInList(DBnpcspells_Struct* spell_list, uint16 iSpellID) {
auto it = std::find_if(spell_list->entries.begin(), spell_list->entries.end(),
[iSpellID](const DBnpcspells_entries_Struct &a) { return a.spellid == iSpellID; });
return it != spell_list->entries.end();
}
// adds a spell to the list, taking into account priority and resorting list as needed.
void NPC::AddSpellToNPCList(int16 iPriority, int16 iSpellID, uint32 iType,
void NPC::AddSpellToNPCList(int16 iPriority, uint16 iSpellID, uint32 iType,
int16 iManaCost, int32 iRecastDelay, int16 iResistAdjust, int8 min_hp, int8 max_hp)
{
@ -2795,7 +2795,7 @@ void NPC::AddSpellToNPCList(int16 iPriority, int16 iSpellID, uint32 iType,
AIautocastspell_timer->Start(RandomTimer(0, 300), false);
}
void NPC::RemoveSpellFromNPCList(int16 spell_id)
void NPC::RemoveSpellFromNPCList(uint16 spell_id)
{
auto iter = AIspells.begin();
while(iter != AIspells.end())

View File

@ -437,9 +437,9 @@ public:
void NPCSlotTexture(uint8 slot, uint16 texture); // Sets new material values for slots
uint32 GetAdventureTemplate() const { return adventure_template_id; }
void AddSpellToNPCList(int16 iPriority, int16 iSpellID, uint32 iType, int16 iManaCost, int32 iRecastDelay, int16 iResistAdjust, int8 min_hp, int8 max_hp);
void AddSpellToNPCList(int16 iPriority, uint16 iSpellID, uint32 iType, int16 iManaCost, int32 iRecastDelay, int16 iResistAdjust, int8 min_hp, int8 max_hp);
void AddSpellEffectToNPCList(uint16 iSpellEffectID, int32 base, int32 limit, int32 max);
void RemoveSpellFromNPCList(int16 spell_id);
void RemoveSpellFromNPCList(uint16 spell_id);
Timer *GetRefaceTimer() const { return reface_timer; }
const uint32 GetAltCurrencyType() const { return NPCTypedata->alt_currency_type; }

View File

@ -52,7 +52,7 @@ struct wplist {
#pragma pack(1)
struct DBnpcspells_entries_Struct {
int16 spellid;
uint16 spellid;
uint8 minlevel;
uint8 maxlevel;
uint32 type;