Fixes server shutdowns
This commit is contained in:
@@ -1579,7 +1579,7 @@ namespace Game.Maps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Transport transport in _transports)
|
foreach (Transport transport in _transports.ToList())
|
||||||
RemoveFromMap(transport, true);
|
RemoveFromMap(transport, true);
|
||||||
|
|
||||||
_transports.Clear();
|
_transports.Clear();
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ namespace Game.Entities
|
|||||||
foreach (var pair in i_maps.ToList())
|
foreach (var pair in i_maps.ToList())
|
||||||
{
|
{
|
||||||
pair.Value.UnloadAll();
|
pair.Value.UnloadAll();
|
||||||
i_maps.Remove(pair.Value.GetId());
|
i_maps.Remove(pair.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -401,8 +401,13 @@ namespace Game.Scripting
|
|||||||
//Unloading
|
//Unloading
|
||||||
public void Unload()
|
public void Unload()
|
||||||
{
|
{
|
||||||
foreach (ScriptRegistry<ScriptObject> scr in ScriptStorage)
|
foreach (DictionaryEntry entry in ScriptStorage)
|
||||||
scr.Unload();
|
{
|
||||||
|
IScriptRegistry scriptRegistry = (IScriptRegistry)entry.Value;
|
||||||
|
scriptRegistry.Unload();
|
||||||
|
}
|
||||||
|
|
||||||
|
ScriptStorage.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//SpellScriptLoader
|
//SpellScriptLoader
|
||||||
@@ -1339,7 +1344,6 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
RunScript<QuestScript>(script => script.OnQuestStatusChange(player, quest, oldStatus, newStatus), quest.ScriptId);
|
RunScript<QuestScript>(script => script.OnQuestStatusChange(player, quest, oldStatus, newStatus), quest.ScriptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnQuestObjectiveChange(Player player, Quest quest, QuestObjective objective, int oldAmount, int newAmount)
|
public void OnQuestObjectiveChange(Player player, Quest quest, QuestObjective objective, int oldAmount, int newAmount)
|
||||||
{
|
{
|
||||||
Contract.Assert(player);
|
Contract.Assert(player);
|
||||||
@@ -1416,7 +1420,12 @@ namespace Game.Scripting
|
|||||||
MultiMap<Tuple<uint, ushort>, SplineChainLink> m_mSplineChainsMap = new MultiMap<Tuple<uint, ushort>, SplineChainLink>(); // spline chains
|
MultiMap<Tuple<uint, ushort>, SplineChainLink> m_mSplineChainsMap = new MultiMap<Tuple<uint, ushort>, SplineChainLink>(); // spline chains
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ScriptRegistry<TValue> where TValue : ScriptObject
|
public interface IScriptRegistry
|
||||||
|
{
|
||||||
|
void Unload();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ScriptRegistry<TValue> : IScriptRegistry where TValue : ScriptObject
|
||||||
{
|
{
|
||||||
public void AddScript(TValue script)
|
public void AddScript(TValue script)
|
||||||
{
|
{
|
||||||
@@ -1486,8 +1495,7 @@ namespace Game.Scripting
|
|||||||
|
|
||||||
public void Unload()
|
public void Unload()
|
||||||
{
|
{
|
||||||
foreach (var key in ScriptMap.Keys)
|
ScriptMap.Clear();
|
||||||
ScriptMap.Remove(key);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Counter used for code-only scripts.
|
// Counter used for code-only scripts.
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ namespace WorldServer
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Log.outException(ex);
|
Log.outException(ex);
|
||||||
|
ExitNow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user