internal void OpenPortal(string arg1, string[] arg2) { if (!Game1.IsMasterGame) { return; } GameLocation location = Game1.getLocationFromName("Custom_Ridgeside_RidgeFalls"); foreach (var pedestalTemplate in PedestalTemplates) { ItemPedestal pedestal = (ItemPedestal)location.Objects[pedestalTemplate.tilePosition]; pedestal.heldObject.Value = (SObject)pedestal.requiredItem.Value.getOne(); pedestal.UpdateItemMatch(); } }
private void AddMissingPedestals() { Log.Trace("Adding pedestals"); GameLocation location = Game1.getLocationFromName("Custom_Ridgeside_RidgeFalls"); foreach (var pedestal in PedestalTemplates) { location.Objects.TryGetValue(pedestal.tilePosition, out SObject existing_object); if (existing_object != null && !(existing_object is ItemPedestal)) { location.Objects.Remove(pedestal.tilePosition); } else if (existing_object == null) { location.Objects.Add(pedestal.tilePosition, new ItemPedestal(pedestal.tilePosition, new SObject(ExternalAPIs.JA.GetObjectId(pedestal.RequiredItemName), 1), false, Color.White)); } } try { foreach (var pedestal in PedestalTemplates) { ItemPedestal itemPedestal = (ItemPedestal)location.Objects[pedestal.tilePosition]; itemPedestal.requiredItem.Value = new SObject(ExternalAPIs.JA.GetObjectId(pedestal.RequiredItemName), 1); itemPedestal.lockOnSuccess.Value = false; itemPedestal.UpdateItemMatch(); } } catch (Exception exception) { Log.Warn("Issue with pedestals detected in AddMissingPedestals. Check Trace for Details"); Log.Trace(exception.Message); Log.Trace(exception.StackTrace); } }