public static double?GetNullableDoubleFromLSO(this ILSObject obj, string member, params string[] args) { using (var lavishScriptObject = obj.GetMember(member, args)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (double?)lavishScriptObject.GetValue <double>()); } }
public static float?GetNullableFloatFromLSO(this ILSObject obj, string member) { using (var lavishScriptObject = obj.GetMember(member)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (float?)lavishScriptObject.GetValue <float>()); } }
public static Int64 GetInt64FromLSO(this ILSObject obj, string member) { using (var lavishScriptObject = obj.GetMember(member)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue <Int64>()); } }
public static bool GetBoolFromLSO(this ILSObject obj, string member, params string[] args) { using (var lavishScriptObject = obj.GetMember(member, args)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? false : lavishScriptObject.GetValue <bool>()); } }
public static string GetString(this ILSObject obj, string member) { using (var lavishScriptObject = obj.GetMember(member)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : lavishScriptObject.GetValue <string>()); } }
internal static T GetFromIndexMember <T>(ILSObject obj, string memberName, string lsTypeName, int number, params string[] args) { // argument is 0-based number += 1; if (obj == null || !obj.IsValid) { return(default(T)); } using (var index = LavishScript.Objects.NewObject("index:" + lsTypeName)) { var allargs = PrefixArray(index.LSReference, args); using (var retval = obj.GetMember(memberName, allargs)) { if (LavishScriptObject.IsNullOrInvalid(retval) || retval.GetValue <int>() < number) { return(default(T)); } } var member = GetIndexMember <T>(index, number); return(member); } }
public static float GetFloat(this ILSObject obj, string member) { using (var lavishScriptObject = obj.GetMember(member)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue <float>()); } }
public static int?GetNullableInt(this ILSObject obj, string member) { using (var lavishScriptObject = obj.GetMember(member)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (int?)lavishScriptObject.GetValue <int>()); } }
public static bool?GetNullableBool(this ILSObject obj, string member, params string[] args) { using (var lavishScriptObject = obj.GetMember(member, args)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (bool?)lavishScriptObject.GetValue <bool>()); } }
public static bool IsFleetMember(this Entity entity) { var isInvalid = LavishScriptObject.IsNullOrInvalid(entity.Owner.ToFleetMember); var inFleet = !isInvalid; return(inFleet); }
private bool GetBookmarks() { var methodName = "GetBookmarks"; LogTrace(methodName); //First do pickup bookmark if (Core.StealthBot.Config.CargoConfig.PickupLocation.BookmarkLabel != String.Empty) { _pickupBookmark = null; var cachedBookMark = Core.StealthBot.BookMarkCache.FirstBookMarkStartingWith( Core.StealthBot.Config.CargoConfig.PickupLocation.BookmarkLabel, false); if (cachedBookMark != null) { _pickupBookmark = Core.StealthBot.BookMarkCache.GetBookMarkFor(cachedBookMark); } } //Next, dropoff bookmark if (Core.StealthBot.Config.CargoConfig.DropoffLocation.BookmarkLabel != String.Empty) { _dropoffBookmark = null; var cachedBookMark = Core.StealthBot.BookMarkCache.FirstBookMarkStartingWith( Core.StealthBot.Config.CargoConfig.DropoffLocation.BookmarkLabel, false); _dropoffBookmark = Core.StealthBot.BookMarkCache.GetBookMarkFor(cachedBookMark); } return(!LavishScriptObject.IsNullOrInvalid(_pickupBookmark) && !LavishScriptObject.IsNullOrInvalid(_dropoffBookmark)); }
internal static T GetFromIndexMethod <T>(ILSObject Obj, string MethodName, string LSTypeName, int number, params string[] Args) { // argument is 0-based number += 1; if (Obj == null || !Obj.IsValid || number <= 0) { return(default(T)); } LavishScriptObject Index = LavishScript.Objects.NewObject("index:" + LSTypeName); string[] allargs = PrefixArray <string>(Index.LSReference, Args); Obj.ExecuteMethod(MethodName, allargs); LavishScriptObject used = Index.GetMember("Used"); // if it failed or we want one off the end, return if (LavishScriptObject.IsNullOrInvalid(used) || used.GetValue <int>() < number) { return(default(T)); } return(GetIndexMember <T>(Index, number)); }
public static double GetDouble(this ILSObject obj, string member) { using (var lavishScriptObject = obj.GetMember(member)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue <double>()); } }
public override void PopulateEntities() { var methodName = "PopulateEntities"; LogTrace(methodName); if (_isxeveProvider.Eve.EntitiesCount == 0) { LogMessage(methodName, LogSeverityTypes.Standard, "Error: ISXEVE sees 0 entities. Forcing entity population."); _isxeveProvider.Eve.PopulateEntities(true); } StartMethodProfiling("EVE.QueryEntities"); var entities = _isxeveProvider.Eve.QueryEntities(); EndMethodProfiling(); //StartMethodProfiling("SortEntities"); //entities = entities.OrderBy<Entity, double>(x => x.Distance).ToList(); //EndMethodProfiling(); StartMethodProfiling("CreateEntityWrappers"); if (entities != null) { //Core.StealthBot.Logging.LogMessage(ObjectName, new LogEventArgs(LogSeverityTypes.Debug, //methodName, String.Format("Got {0} entities from query.", entities.Count))); //StartMethodProfiling("BuildEntityWrappers"); foreach (var entity in entities) { if (LavishScriptObject.IsNullOrInvalid(entity)) { continue; } //Ignore certain entities if (entity.CategoryID == (int)CategoryIDs.Charge) { continue; } var entityWrapper = new EntityWrapper(entity); _entityWrappers.Add(entityWrapper); try { _entityWrappersById.Add(entityWrapper.ID, entityWrapper); } catch (Exception) { LogMessage(methodName, LogSeverityTypes.Standard, "Error: An entity matching entity \"{0}\" id {1} is already being tracked.", entityWrapper.ID, entityWrapper.Name); } } //EndMethodProfiling(); } else { LogMessage(methodName, LogSeverityTypes.Debug, "Got null result from QueryEntities."); } EndMethodProfiling(); }
private static void TestGetLocalGridEntities(Character me, EVE.ISXEVE.EVE eve, ILogger logger) { //var entities = EntityRepository.GetLocalGridEntities(me, eve); eve.RefreshStandings(); var entities = eve.QueryEntities().Where(x => x.IsPC); //var anObj = LavishScript.Objects.GetObject("Local", "Romvex"); //logger.Log(anObj.ToString()); var pilot = new Pilot("Romvex "); logger.Log(pilot.ToString()); foreach (var entity in entities) { logger.Log(entity.Name); logger.Log(LavishScriptObject.IsNullOrInvalid(entity.Owner.ToFleetMember).ToString()); logger.Log(entity.Owner.CharID.ToString()); logger.Log(entity.Owner.Corp.ID.ToString()); logger.Log(entity.AllianceID.ToString()); var standing = me.StandingTo(entity.CharID, entity.Corp.ID, entity.AllianceID); logger.Log(standing.AllianceToAlliance.ToString()); logger.Log(standing.AllianceToCorp.ToString()); logger.Log(standing.AllianceToPilot.ToString()); logger.Log(standing.CorpToAlliance.ToString()); logger.Log(standing.CorpToCorp.ToString()); logger.Log(standing.CorpToPilot.ToString()); logger.Log(standing.MeToAlliance.ToString()); logger.Log(standing.MeToCorp.ToString()); logger.Log(standing.MeToPilot.ToString()); } }
/// <summary> /// Translate an index of a given LavishScript type returned from the given member on the given object to a List of a .NET datatype equivalent. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="obj"></param> /// <param name="memberName"></param> /// <param name="lsTypeName"></param> /// <param name="args"></param> /// <returns></returns> public static List <T> GetListFromMember <T>(this ILSObject obj, string memberName, string lsTypeName, params string[] args) { //var methodName = "GetListFromMember"; //Tracing.SendCallback(methodName, MemberName, LSTypeName); if (obj == null || !obj.IsValid) { return(null); } //Tracing.SendCallback(methodName, "new index"); using (var index = LavishScript.Objects.NewObject("index:" + lsTypeName)) { //Tracing.SendCallback(methodName, "arg condensing"); var allargs = PrefixArray(index.LSReference, args); //Tracing.SendCallback(methodName, "getmember retval"); using (var retval = obj.GetMember(memberName, allargs)) { if (LavishScriptObject.IsNullOrInvalid(retval)) { return(null); } } //Tracing.SendCallback(methodName, "index to list"); var list = IndexToList <T>(index, lsTypeName); //Tracing.SendCallback(methodName, "invalidate"); //Tracing.SendCallback(methodName, "return"); return(list); } }
/// <summary> /// Retireves the requested boolean member /// </summary> /// <param name="obj">this</param> /// <param name="member">the member to retrieve</param> /// <returns>LavishScriptObject boolean member value</returns> public static bool GetBoolFromLSO(this ILSObject obj, string member) { using (var lavishScriptObject = obj.GetMember(member)) { return(!LavishScriptObject.IsNullOrInvalid(lavishScriptObject) && lavishScriptObject.GetValue <bool>()); } }
internal static T GetFromIndexMethod <T>(ILSObject obj, string methodName, string lsTypeName, int number, params string[] args) { // argument is 0-based number += 1; if (obj == null || !obj.IsValid || number <= 0) { return(default(T)); } using (var index = LavishScript.Objects.NewObject("index:" + lsTypeName)) { var allargs = PrefixArray(index.LSReference, args); if (!obj.ExecuteMethod(methodName, allargs)) { return(default(T)); } using (var used = index.GetMember("Used")) { // if it failed or we want one off the end, return if (LavishScriptObject.IsNullOrInvalid(used) || used.GetValue <int>() < number) { return(default(T)); } } var member = GetIndexMember <T>(index, number); return(member); } }
static void Main() { /* This doesn't do anything useful except give me a place to test wrapper functions -- CyberTech */ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); InnerSpace.Echo("ISXEVEWrapperTest: Begin"); using (new FrameLock(true)) { LavishScriptObject _Me = LavishScript.Objects.GetObject("Me"); InnerSpace.Echo("Name: " + _Me.GetMember("Name")); //Extension Ext = new Extension(); //InnerSpace.Echo("Name: " + Ext.Me.Name); // InnerSpace.Echo("Nearest Stargate (fails in station): " + Ext.Entity("Stargate").Name); // InnerSpace.Echo("Undocking Method 1..."); // //Ext.EVE().Execute(ExecuteCommand.CmdExitStation); // InnerSpace.Echo("Undocking Method 2..."); // //Ext.EVE().Execute("CmdExitStation"); // InnerSpace.Echo(Ext.ISXEVE().SecsToString(500)); //Extension Ext = new Extension(); //InnerSpace.Echo(Ext.Me.Name.ToString(CultureInfo.CurrentCulture)); //InnerSpace.Echo(Me.Ship.ToString(CultureInfo.CurrentCulture)); } InnerSpace.Echo("ISXEVEWrapperTest: End"); }
/// <summary> /// Checks the collision. /// </summary> /// <param name="FromX">From X.</param> /// <param name="FromY">From Y.</param> /// <param name="FromZ">From Z.</param> /// <param name="ToX">To X.</param> /// <param name="ToY">To Y.</param> /// <param name="ToZ">To Z.</param> /// <returns></returns> public Actor CheckCollision(float FromX, float FromY, float FromZ, float ToX, float ToY, float ToZ) { LavishScriptObject Obj = GetMember("CheckCollision", FromX.ToString(), FromY.ToString(), FromZ.ToString(), ToX.ToString(), ToY.ToString(), ToZ.ToString()); return(new Actor(Obj)); }
/// <summary> /// Retrieves the requested unsigned integer member /// </summary> /// <param name="obj">this</param> /// <param name="member">the member to retrieve</param> /// <returns>LavishScriptObject integer member value</returns> public static uint GetUIntFromLSO(this ILSObject obj, string member) { using (var lavishScriptObject = obj.GetMember(member)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? 0 : lavishScriptObject.GetValue <uint>()); } }
public CachedDrone(ActiveDrone activeDrone) { _activeDrone = activeDrone; State = activeDrone.State; Id = activeDrone.ID; var activeDroneEntity = activeDrone.ToEntity; if (LavishScriptObject.IsNullOrInvalid(activeDroneEntity) || activeDroneEntity.ID <= 0) { Distance = -1; ShieldPct = -1; ArmorPct = -1; IsEntityValid = false; } else { Distance = activeDroneEntity.Distance; ShieldPct = activeDroneEntity.ShieldPct; ArmorPct = activeDroneEntity.ArmorPct; TargetEntityId = LavishScriptObject.IsNullOrInvalid(activeDrone.Target) ? -1 : activeDrone.Target.ID; IsEntityValid = true; //StealthBot.Logging.LogMessage("CachedDrone", "CachedDrone", LogSeverityTypes.Debug, "ActiveDrone dump: ID {0}, Name \"{1}\", State {2}, Distance {3}", //activeDrone.ID, activeDrone.ToEntity.Name, activeDrone.State, activeDrone.ToEntity.Distance); } //TargetEntityID = activeDrone.Target.ID; }
public static int GetInt(this ILSObject obj, string member, params string[] args) { using (var lavishScriptObject = obj.GetMember(member, args)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? -1 : lavishScriptObject.GetValue <int>()); } }
public static T GetIndexMember <T>(LavishScriptObject index, int number) { if (typeof(T).IsSubclassOf(typeof(LavishScriptObject))) { return((T)typeof(T).GetConstructor(new[] { typeof(LavishScriptObject) }).Invoke(new object[] { index.GetIndex(number.ToString(CultureInfo.CurrentCulture)) })); } return(index.GetIndex <T>(number.ToString(CultureInfo.CurrentCulture))); }
/// <summary> /// Retrieves the requested boolean member based on the arguments provided /// </summary> /// <param name="obj">this</param> /// <param name="member">the member to retrieve</param> /// <param name="args"></param> /// <returns>LavishScriptObject boolean member value</returns> // ReSharper disable MethodOverloadWithOptionalParameter public static bool GetBoolFromLSO(this ILSObject obj, string member, params string[] args) // ReSharper restore MethodOverloadWithOptionalParameter { using (var lavishScriptObject = obj.GetMember(member, args)) { return(!LavishScriptObject.IsNullOrInvalid(lavishScriptObject) && lavishScriptObject.GetValue <bool>()); } }
/// <summary> /// This TLO only works when the "Your Remains" window is open and populated. /// </summary> /// <param name="Argument">At this point (4.18.2007) the only parameter accepted is "Corpse"</param> /// <param name="Index">between 1 and the number of corpses available for summoning</param> public SCorpse Altar(string Argument, int Index) { if (Argument.Contains("Corpse") || Argument.Contains("corpse")) { LavishScriptObject Obj = LavishScript.Objects.GetObject("Altar", "Corpse", Index.ToString()); return(new SCorpse(Obj)); } return(null); }
public override void InFrameCleanup() { if (!LavishScriptObject.IsNullOrInvalid(_toEntity)) { _toEntity.Dispose(); } Approaching = null; }
private static T IndexToLavishScriptObject <T>(LavishScriptObject index, int number) { var constructor = typeof(T).GetConstructor(new[] { typeof(LavishScriptObject) }); if (constructor != null) { return((T)constructor.Invoke(new object[] { index.GetIndex(number.ToString(CultureInfo.InvariantCulture)) })); } return(default(T)); }
/// <summary> /// Retrieves the requested integer member based on the arguments provided /// </summary> /// <param name="obj">this</param> /// <param name="member">the member to retrieve</param> /// <param name="args">string array of arguments to pass to the member</param> /// <returns>LavishScriptObject integer member value</returns> // ReSharper disable MethodOverloadWithOptionalParameter public static int?GetNullableIntFromLSO(this ILSObject obj, string member, params string[] args) // ReSharper restore MethodOverloadWithOptionalParameter { using (var lavishScriptObject = obj.GetMember(member, args)) { return(LavishScriptObject.IsNullOrInvalid(lavishScriptObject) ? null : (int?)lavishScriptObject.GetValue <int>()); } }
private int GetSkillLevel(string skillName) { var methodName = "GetSkillLevel"; LogTrace(methodName, "Skill name: {0}", skillName); var skill = StealthBot.MeCache.Me.Skill(skillName); return(!LavishScriptObject.IsNullOrInvalid(skill) ? skill.Level : 0); }