public TileActionsHandler(IModHelper helper) { Plato = helper.GetPlatoHelper(); Plato.Events.CallingTileAction += Events_CallingTileActionLua; Plato.Events.CallingTileAction += Events_CallingTileActionReloadMap; Plato.Events.CallingTileAction += Events_CallingTileActionFlag; Plato.Events.CallingTileAction += Events_CallingTileActionDropIn; Plato.Events.CallingTileAction += Events_CallingTileActionShops; helper.Events.GameLoop.GameLaunched += GameLoop_GameLaunched; Plato.Content.Injections.InjectLoad(LuaScriptRepository, new Dictionary <string, string>()); Plato.Content.Injections.InjectLoad(MapTKShop.ShopDataAsset, new Dictionary <string, MapTKShop>()); Plato.Content.Injections.InjectLoad(MapTKInventory.InventoryDataAsset, new Dictionary <string, MapTKInventory>()); helper.Events.GameLoop.SaveLoaded += GameLoop_SaveLoaded; helper.Events.GameLoop.Saving += GameLoop_Saving; helper.Events.GameLoop.DayStarted += GameLoop_DayStarted; helper.ConsoleCommands.Add("MapTKShop", "Start a MapTK shop by id: MapTKShop IdOfTheShop", (command, parameter) => { if (parameter.Length > 0) { OpenMapTKShop(parameter[0]); } }); }
public SaveIndex(string id, string genericData, IPlatoHelper helper, int minIndex = 13000) : this(id, () => GenericData, (s) => s.Value == genericData, (s) => s.SetGenericData(genericData), helper, minIndex) { }
public ContentHelper(IPlatoHelper helper) : base(helper) { Textures = new TextureHelper(helper); Injections = new InjectionHelper(helper); Maps = new MapHelper(helper); }
public TypeForwarding(Type fromType, Type toType, IPlatoHelper helper, object targetForAllInstances = null) { FromType = fromType; ToType = toType; Helper = helper; TargetForAllInstances = targetForAllInstances; }
public InjectionHelper(IPlatoHelper helper) : base(helper) { if (!Injected.Any(i => i.Mod == helper.ModHelper.ModRegistry.ModID)) { Injected.Add(new AssetInjector(helper)); } }
public SharedDataHelper(IPlatoHelper helper) { Helper = helper; if (Collections == null) { Collections = new HashSet <SharedDataCollection>(); } }
public override void OnConstruction(IPlatoHelper helper, object linkedObject) { base.OnConstruction(helper, linkedObject); EmptySaveIndex.ValidateIndex(); if (Base != null && Base.ParentSheetIndex != TileIndex) { Base.ParentSheetIndex = TileIndex; } }
public SaveIndex(string id, string dataSource, Func <ISaveIndexHandle, bool> validateValue, Action <ISaveIndexHandle> injectValue, IPlatoHelper helper, int minIndex = 13000) : this(id, () => Game1.content.Load <Dictionary <int, string> >(dataSource), validateValue, injectValue, helper, minIndex) { }
public TextureInjection( IPlatoHelper helper, string assetName, Texture2D value, InjectionMethod method, Rectangle?sourceArea = null, Rectangle?targetArea = null, string conditions = "") : base(helper, assetName, value, method, sourceArea, targetArea, conditions) { }
public UIMenu(IPlatoHelper helper, IWrapper menu) : base(0, 0, Game1.viewport.Width, Game1.viewport.Height, false) { #if ANDROID #else LastUIZoom = Game1.options.desiredUIScale; Game1.options.desiredUIScale = Game1.options.desiredBaseZoomLevel; #endif Helper = helper; Menu = menu; Helper.ModHelper.Events.GameLoop.UpdateTicked += ResetZoom; }
public static IPlatoHelper GetPlatoHelper(this IModHelper helper) { IPlatoHelper platoHelper = Helper.FirstOrDefault(p => p.ModHelper.ModRegistry.ModID == helper.ModRegistry.ModID); if (platoHelper is IPlatoHelper) { return(platoHelper); } platoHelper = new PlatoHelper(helper); Helper.Add(platoHelper); return(platoHelper); }
public static void Add(ArcadeMachineSpecs specs, IPlatoHelper helper) { if (!Machines.Contains(specs)) { Machines.Add(specs); if (helper.ModHelper.ModRegistry.GetApi <IArcadeApi>("spacechase0.ArcadeRoom") is IArcadeApi arcade) { specs.Spot = arcade.ReserveMachineSpot(); } Setup(helper, specs); } }
public SaveIndex(string id, Func <IDictionary <int, string> > loadData, Func <ISaveIndexHandle, bool> validateValue, Action <ISaveIndexHandle> injectValue, IPlatoHelper helper, int minIndex = 13000) { Helper = helper; Id = id; Validator = validateValue; Injector = injectValue; DataLoader = loadData; MinIndex = minIndex; Index = GetNewIndex(); Injector?.Invoke(this); Validator?.Invoke(this); }
public static void Setup(IPlatoHelper helper, ArcadeMachineSpecs specs) { if (!Patched) { var instance = new Harmony("PlatoTK.ArcadeMachine"); instance.Patch( original: AccessTools.Method(typeof(StardewValley.Object), nameof(StardewValley.Object.checkForAction)), postfix: new HarmonyMethod(AccessTools.Method(typeof(ArcadeMachinePreset), nameof(CheckForActionPatch)))); helper.Events.CallingTileAction += Events_CallingTileAction; if (helper.ModHelper.ModRegistry.GetApi <IArcadeApi>("spacechase0.ArcadeRoom") is IArcadeApi arcade) { arcade.OnRoomSetup += (x, y) => { if (Game1.getLocationFromName("Arcade") is GameLocation a) { AddArcades(a); } helper.ModHelper.Events.Player.Warped += (s, e) => { if (e.NewLocation is GameLocation l && l.Name == "Arcade") { AddArcades(e.NewLocation); } }; } } ; Patched = true; } if (helper.ModHelper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone") is IMobilePhoneApi phone) { Texture2D appIcon = helper.ModHelper.Content.Load <Texture2D>(specs.Icon, StardewModdingAPI.ContentSource.GameContent); bool success = phone.AddApp(specs.Id, specs.Name, () => { specs.Start(); }, appIcon); } }
public virtual IComponent Clone(IPlatoHelper helper, string id = "", IComponent parent = null) { IComponent clone = New(helper); clone.Parent = parent ?? Parent; foreach (var parsed in Parsed.Where(p => p.Attribute.ToLower() != "id")) { clone.ParseAttribute(parsed.Attribute, parsed.Value); } clone.ParseAttribute("Id", id); foreach (var child in Children) { var cClone = child.Clone(helper, "", clone); clone.AddChild(cClone); } return(clone); }
public override void OnConstruction(IPlatoHelper helper, object linkedObject) { base.OnConstruction(helper, linkedObject); SaveIndex.ValidateIndex(Base?.parentSheetIndex.Value ?? -1); Data?.Set("IsComicFrameObject", true); CheckParentSheetIndex(); if (!(Base?.heldObject.Value is StardewValley.Object)) { if (Data != null && Data.TryGet("ComicId", out string comicId)) { Base?.heldObject.Set(ComicBook.GetNew(comicId)); } else { Base?.heldObject.Set(ComicBook.GetNew("216384")); } } Base?.updateDrawPosition(); }
public override void OnConstruction(IPlatoHelper helper, object linkedObject) { base.OnConstruction(helper, linkedObject); SaveIndex.ValidateIndex(); Data?.Set("IsComicBookObject", true); CheckParentSheetIndex(); if (!string.IsNullOrEmpty(ComicId)) { Issue issue = AssetManager.Instance.GetIssue(ComicId); Data.Set("Volume", issue.Volume.Name); Data.Set("Number", issue.IssueNumber); Data.Set("SmallImage", issue.Image.SmallUrl.ToString()); Data.Set("BigImage", issue.Image.MediumUrl.ToString()); Data.Set("Name", $"{Volume} #{Number}"); Data.Set("Description", issue.Name + " (Comic Book)"); Data.Set("IsComicBookObject", true); Helper.SetDelayedAction(1, () => checkLoad()); } }