reload spells now works with the lua state redesign and we delete spell in the spell_scripts instead of other places (casttimer, active_spells, so on)
This commit is contained in:
parent
297c17b177
commit
555045cbe2
@ -1948,10 +1948,11 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
|
|||||||
else {
|
else {
|
||||||
client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Spells & NPC Spell Lists (Note: Must Reload Spawns/Repop to reset npc spells)...");
|
client->SimpleMessage(CHANNEL_COLOR_YELLOW, "Reloading Spells & NPC Spell Lists (Note: Must Reload Spawns/Repop to reset npc spells)...");
|
||||||
world.SetReloadingSubsystem("Spells");
|
world.SetReloadingSubsystem("Spells");
|
||||||
|
|
||||||
zone_list.DeleteSpellProcess();
|
zone_list.DeleteSpellProcess();
|
||||||
master_spell_list.Reload();
|
|
||||||
if (lua_interface)
|
if (lua_interface)
|
||||||
lua_interface->ReloadSpells();
|
lua_interface->DestroySpells();
|
||||||
|
master_spell_list.Reload();
|
||||||
zone_list.LoadSpellProcess();
|
zone_list.LoadSpellProcess();
|
||||||
world.RemoveReloadingSubSystem("Spells");
|
world.RemoveReloadingSubSystem("Spells");
|
||||||
world.PurgeNPCSpells();
|
world.PurgeNPCSpells();
|
||||||
@ -3081,9 +3082,9 @@ void Commands::Process(int32 index, EQ2_16BitString* command_parms, Client* clie
|
|||||||
}
|
}
|
||||||
|
|
||||||
zone_list.DeleteSpellProcess();
|
zone_list.DeleteSpellProcess();
|
||||||
master_spell_list.Reload();
|
|
||||||
if (lua_interface)
|
if (lua_interface)
|
||||||
lua_interface->ReloadSpells();
|
lua_interface->DestroySpells();
|
||||||
|
master_spell_list.Reload();
|
||||||
zone_list.LoadSpellProcess();
|
zone_list.LoadSpellProcess();
|
||||||
if(lua_interface){
|
if(lua_interface){
|
||||||
map<Client*, int32> debug_clients = lua_interface->GetDebugClients();
|
map<Client*, int32> debug_clients = lua_interface->GetDebugClients();
|
||||||
|
@ -151,9 +151,9 @@ void LuaInterface::DestroySpells() {
|
|||||||
LuaSpell* cur_spell = inner_itr->second;
|
LuaSpell* cur_spell = inner_itr->second;
|
||||||
MSpellDelete.lock();
|
MSpellDelete.lock();
|
||||||
RemoveCurrentSpell(inner_itr->first, inner_itr->second, false, true, false);
|
RemoveCurrentSpell(inner_itr->first, inner_itr->second, false, true, false);
|
||||||
MSpellDelete.unlock();
|
|
||||||
lua_close(inner_itr->first);
|
lua_close(inner_itr->first);
|
||||||
safe_delete(cur_spell);
|
safe_delete(cur_spell);
|
||||||
|
MSpellDelete.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
Mutex* mutex = GetSpellScriptMutex(spell_script_itr->first.c_str());
|
Mutex* mutex = GetSpellScriptMutex(spell_script_itr->first.c_str());
|
||||||
@ -260,11 +260,6 @@ void LuaInterface::DestroyRegionScripts() {
|
|||||||
MRegionScripts.releasewritelock(__FUNCTION__, __LINE__);
|
MRegionScripts.releasewritelock(__FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LuaInterface::ReloadSpells() {
|
|
||||||
DestroySpells();
|
|
||||||
database.LoadSpellScriptData();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool LuaInterface::LoadItemScript(string name) {
|
bool LuaInterface::LoadItemScript(string name) {
|
||||||
return LoadItemScript(name.c_str());
|
return LoadItemScript(name.c_str());
|
||||||
}
|
}
|
||||||
@ -2357,8 +2352,8 @@ LuaSpell* LuaInterface::CreateSpellScript(const char* name, lua_State* existStat
|
|||||||
return new_spell;
|
return new_spell;
|
||||||
}
|
}
|
||||||
|
|
||||||
LuaSpell* LuaInterface::GetSpell(const char* name) {
|
LuaSpell* LuaInterface::GetSpell(const char* name, bool use) {
|
||||||
return GetSpellScript(name, true);
|
return GetSpellScript(name, true, use);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LuaInterface::RunItemScript(string script_name, const char* function_name, Item* item, Spawn* spawn, Spawn* target, sint64* returnValue) {
|
bool LuaInterface::RunItemScript(string script_name, const char* function_name, Item* item, Spawn* spawn, Spawn* target, sint64* returnValue) {
|
||||||
|
@ -236,7 +236,7 @@ public:
|
|||||||
LuaSpell* GetCurrentSpell(lua_State* state, bool needsLock = true);
|
LuaSpell* GetCurrentSpell(lua_State* state, bool needsLock = true);
|
||||||
void RemoveCurrentSpell(lua_State* state, LuaSpell* cur_spell, bool needsLock = true, bool removeCurSpell = true, bool removeSpellScript = true);
|
void RemoveCurrentSpell(lua_State* state, LuaSpell* cur_spell, bool needsLock = true, bool removeCurSpell = true, bool removeSpellScript = true);
|
||||||
bool CallSpellProcess(LuaSpell* spell, int8 num_parameters, std::string functionCalled);
|
bool CallSpellProcess(LuaSpell* spell, int8 num_parameters, std::string functionCalled);
|
||||||
LuaSpell* GetSpell(const char* name);
|
LuaSpell* GetSpell(const char* name, bool use = true);
|
||||||
void UseItemScript(const char* name, lua_State* state, bool val);
|
void UseItemScript(const char* name, lua_State* state, bool val);
|
||||||
void UseSpawnScript(const char* name, lua_State* state, bool val);
|
void UseSpawnScript(const char* name, lua_State* state, bool val);
|
||||||
void UseZoneScript(const char* name, lua_State* state, bool val);
|
void UseZoneScript(const char* name, lua_State* state, bool val);
|
||||||
@ -269,7 +269,6 @@ public:
|
|||||||
void DestroySpells();
|
void DestroySpells();
|
||||||
void DestroySpawnScripts();
|
void DestroySpawnScripts();
|
||||||
void DestroyItemScripts();
|
void DestroyItemScripts();
|
||||||
void ReloadSpells();
|
|
||||||
void DestroyQuests(bool reload = false);
|
void DestroyQuests(bool reload = false);
|
||||||
void DestroyZoneScripts();
|
void DestroyZoneScripts();
|
||||||
void DestroyRegionScripts();
|
void DestroyRegionScripts();
|
||||||
|
@ -83,7 +83,6 @@ void SpellProcess::RemoveAllSpells(bool reload_spells){
|
|||||||
MutexList<CastTimer*>::iterator cast_timers_itr = cast_timers.begin();
|
MutexList<CastTimer*>::iterator cast_timers_itr = cast_timers.begin();
|
||||||
while(cast_timers_itr.Next()){
|
while(cast_timers_itr.Next()){
|
||||||
safe_delete(cast_timers_itr->value->timer);
|
safe_delete(cast_timers_itr->value->timer);
|
||||||
safe_delete(cast_timers_itr->value->spell);
|
|
||||||
cast_timers.Remove(cast_timers_itr->value, true);
|
cast_timers.Remove(cast_timers_itr->value, true);
|
||||||
}
|
}
|
||||||
cast_timers.clear();
|
cast_timers.clear();
|
||||||
|
@ -4508,7 +4508,7 @@ int32 WorldDatabase::LoadSpellScriptData() {
|
|||||||
|
|
||||||
while (result && (row = mysql_fetch_row(result))) {
|
while (result && (row = mysql_fetch_row(result))) {
|
||||||
if (row[0] && strlen(row[0]) > 0) {
|
if (row[0] && strlen(row[0]) > 0) {
|
||||||
if (lua_interface->GetSpell(row[0]))
|
if (lua_interface->GetSpell(row[0], false))
|
||||||
LogWrite(SPELL__DEBUG, 5, "Spells", "SpellScript: %s loaded.", row[0]);
|
LogWrite(SPELL__DEBUG, 5, "Spells", "SpellScript: %s loaded.", row[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user