/// <summary> /// Rejects all availble drops. /// </summary> /// <param name="skipWait">Whether the SafeTimings option is ignored.</param> public void RejectAll(bool skipWait = false) { FlashUtil.Call("rejectExcept", ""); if (Bot.Options.SafeTimings && !skipWait) { Bot.Wait.ForPickup("*"); } }
/// <summary> /// Picks up all available drops. /// </summary> /// <param name="skipWait">Whether the SafeTimings option is ignored.</param> public void PickupAll(bool skipWait = false) { FlashUtil.Call("pickupDrops", "*"); if (Bot.Options.SafeTimings && !skipWait) { Bot.Wait.ForPickup("*"); } }
/// <summary> /// Picks up the specified list of items. /// </summary> /// <param name="items">The names of the items to pick up.</param> public void Pickup(params string[] items) { string whitelist = CreateWhitelistString(items); List <string> existing = CurrentDrops.FindAll(x => items.Any(i => i.Equals(x, StringComparison.OrdinalIgnoreCase))); FlashUtil.Call("pickupDrops", whitelist); if (Bot.Options.SafeTimings) { existing.ForEach(i => Bot.Wait.ForPickup(i)); } }
/// <summary> /// Rejects all drops except those in the specified list. /// </summary> /// <param name="items">The list of items to not reject.</param> public void RejectExcept(params string[] items) { string whitelist = CreateWhitelistString(items); IEnumerable <string> toRemove = CurrentDrops.Where(x => !items.Any(i => i.Equals(x, StringComparison.OrdinalIgnoreCase))); FlashUtil.Call("rejectExcept", whitelist); if (Bot.Options.SafeTimings) { toRemove.ForEach(i => Bot.Wait.ForPickup(i)); } }
/// <summary> /// Rejects all drops except those in the specified list, without waiting for the items to be picked up. This method disregards the SafeTimings option. /// </summary> /// <param name="items"></param> public void RejectExceptFast(params string[] items) { FlashUtil.Call("rejectExcept", CreateWhitelistString(items)); }
/// <summary> /// Picks up the specified list of items, without waiting for the items to be picked up. This method disregards the SafeTimings option. /// </summary> /// <param name="items"></param> public void PickupFast(params string[] items) { FlashUtil.Call("pickupDrops", CreateWhitelistString(items)); }
/// <summary> /// Calls the actionscript object with the given name at the given location. /// </summary> /// <param name="path">The path to the object and its function name.</param> /// <param name="args">The arguments to pass to the function.</param> /// <returns>The value of the object returned by calling the function as a serialzied JSON string.</returns> public string CallGameFunction(string path, params object[] args) { return(args.Length > 0 ? FlashUtil.Call("callGameFunction", new object[] { path }.Concat(args).ToArray()) : FlashUtil.Call("callGameFunction0", path)); }
/// <summary> /// Sets the value of the actionscript object at the given path. /// </summary> /// <param name="path">The path of the object to set.</param> /// <param name="value">The value to set the object to. This can be a string, any number type or a bool.</param> public void SetGameObject(string path, object value) { FlashUtil.Call("setGameObject", path, value); }
/// <summary> /// Gets a static actionscript object at the given location as a JSON string. /// </summary> /// <param name="path">The path of the object to get.</param> /// <returns>The value of the object at the given path as a serialzied JSON string.</returns> public string GetGameObjectStatic(string path) { return(FlashUtil.Call("getGameObjectS", path)); }
/// <summary> /// Checks if the actionscript object at the given path is null. /// </summary> /// <param name="path">The path of the object to check.</param> /// <returns>True if the object at the given path is null (unset).</returns> public bool IsNull(string path) { return(FlashUtil.Call <bool>("isNull", path)); }
/// <summary> /// Sends the specified packet to the client (simulates a response as if the server sent the packet). /// </summary> /// <param name="packet">The packet to send.</param> /// <param name="type">The type of the packet. This can be xml, json or str.</param> public void SendClientPacket(string packet, string type = "str") { FlashUtil.Call("sendClientPacket", packet, type); }
/// <summary> /// Sends a message packet to client in chat. /// </summary> /// <param name="message"></param> /// <param name="sentBy">Name of which who sent the message, defaults to "Message"</param> /// <param name="messageType">moderator, warning, server, event, guild, zone, whisper</param> public void SendMSGPacket(string message = " ", string sentBy = "SERVER", string messageType = "zone") { FlashUtil.Call("sendClientPacket", $"%xt%chatm%0%{messageType}~{message}%{sentBy}%", "str"); }