bool InstanceHasScript(WorldObject obj, string scriptName) { InstanceMap instance = obj.GetMap().ToInstanceMap(); if (instance != null) { return(instance.GetScriptName() == scriptName); } return(false); }
public static T GetInstanceAI <T>(WorldObject obj, string scriptName) where T : class { InstanceMap instance = obj.GetMap().ToInstanceMap(); if (instance != null && instance.GetInstanceScript() != null) { if (instance.GetScriptName() == scriptName) { return((T)Activator.CreateInstance(typeof(T), obj)); } } return(null); }