private static void TP(string[] args) { if (Game1.currentLocation is null || Game1.player is null) { print("\nGame not loaded, cannot warp!\n"); return; } if (args.Length == 0) { print("\nMust specify warp network location\n"); return; } WarpHandler.DirectWarp(args[0], true); }
private static bool UseItem(Farmer who, string id) { Dictionary <string, WarpItem> items = Utils.GetWarpItems(); if (items.ContainsKey(id)) { WarpItem item = items[id]; if (item.Destination.ToLower() == "_all") { WarpHandler.ShowWarpMenu("", item.Consume); return(true); } Color color = Utils.ParseColor(item.Color); DoTotemWarpEffects(color, id, item.Consume, who, (f) => WarpHandler.DirectWarp(item.Destination, item.IgnoreDisabled)); return(true); } return(false); }
public static void ButtonPressed(object sender, ButtonPressedEventArgs action) { if (action.IsSuppressed()) { return; } Farmer who = Game1.player; if (action.Button.IsActionButton()) { if (CanUseHere(who)) { if (who.ActiveObject != null && !(who.ActiveObject is Furniture)) { if (!who.canMove || who.ActiveObject.isTemporarilyInvisible) { return; } string id = null; if (ModEntry.dgaAPI != null) { id = ModEntry.dgaAPI.GetDGAItemId(who.ActiveObject); } if (id == null) { id = who.ActiveObject.ParentSheetIndex.ToString(); } if (UseItem(who, id)) { ModEntry.helper.Input.Suppress(action.Button); } } } } else if (action.Button.IsUseToolButton() && who.CurrentTool is Wand && ModEntry.config.AccessFromWand && ModEntry.config.MenuEnabled) { if (CanUseHere(who) && who.CanMove) { WarpHandler.ShowWarpMenu("_wand"); ModEntry.helper.Input.Suppress(action.Button); } } }