/// <summary> /// Sets a given player's color. /// </summary> /// <param name="player"></param> private void setPlayerColor(SSCEnums.PlayerID player) { if (SeasideScramble.self.getPlayer(player) == null) { return; } ModCore.log("Player: " + player); ModCore.log("Index: " + this.playerColorIndex[player]); SeasideScramble.self.getPlayer(player).setColor(this.possibleColors[this.playerColorIndex[player]]); if (player == SSCEnums.PlayerID.One) { this.animatedSprites["P1Color"].color = this.possibleColors[this.playerColorIndex[player]]; } if (player == SSCEnums.PlayerID.Two) { this.animatedSprites["P2Color"].color = this.possibleColors[this.playerColorIndex[player]]; } if (player == SSCEnums.PlayerID.Three) { this.animatedSprites["P3Color"].color = this.possibleColors[this.playerColorIndex[player]]; } if (player == SSCEnums.PlayerID.Four) { this.animatedSprites["P4Color"].color = this.possibleColors[this.playerColorIndex[player]]; } }
public override void GameComponentOnGUI() { if (Find.UIRoot.screenshotMode.FiltersCurrentEvent || !ModCore.DoZooHelper()) { return; } var area = new Rect(Verse.UI.screenWidth - 260, 100, 250, 150); float a = 0.5f; if (area.ExpandedBy(10).Contains(Verse.UI.MousePositionOnUIInverted)) { a = 1f; if (Input.GetMouseButtonDown(0)) { Find.WindowStack.Add(new MyWindow()); } } GUI.color = new Color(1, 1, 1, a); GUILayout.BeginArea(area); Draw(() => GUILayout.Label($"<b><size=25>Zoo Score: <color=#6bff26{(a == 1f ? "ff" : "88")}>{Main.CurrentPoints:F1}</color></size></b>")); Draw(() => GUILayout.Label($"Total zoo animals: {Main.AllTameAnimals.Count} ({Main.CurrentAnimals.Count} give points)")); Draw(() => GUILayout.Label("<i>Click for more info.</i>")); GUILayout.EndArea(); GUI.color = Color.white; }
//~~~~~~~~~~~~~~~~~~~~~~~// // World Ore Spawn Code // //~~~~~~~~~~~~~~~~~~~~~~~// #region /// <summary> /// Spawns an ore vein at the given location if possible. /// </summary> /// <param name="name"></param> public bool spawnOreVein(string name, GameLocation Location, Vector2 TilePosition) { if (this.oreVeins.ContainsKey(name)) { OreVein spawn; this.oreVeins.TryGetValue(name, out spawn); if (spawn != null) { spawn = (OreVein)spawn.getOne(); bool spawnable = this.canResourceBeSpawnedHere(spawn, Location, TilePosition); if (spawnable) { //ModCore.log("Location is: " + Location.Name); spawn.placementAction(Location, (int)TilePosition.X * Game1.tileSize, (int)TilePosition.Y * Game1.tileSize, Game1.player); } else { ModCore.log("Can't spawn ore: " + name + "at tile location: " + TilePosition); } return(spawnable); } ModCore.log("Key doesn't exist. Weird."); return(false); } else { throw new Exception("The ore dictionary doesn't contain they key for resource: " + name); } }
public void openCraftingMenu(int x, int y, int width, int height, ref IList <Item> items) { CraftingMenuV1 menu = new Framework.Menus.CraftingMenuV1(x, y, width, height, Color.White, items); //menu.addInCraftingPageTab("Default", new AnimatedButton(new StardustCore.Animations.AnimatedSprite("Default Tab", new Vector2(100 + 48, 100 + (24 * 4)), new AnimationManager(TextureManager.GetExtendedTexture(ModCore.Manifest, "Menus", "MenuTabHorizontal"), new Animation(0, 0, 24, 24)), Color.White), new Rectangle(0, 0, 24, 24), 2f)); foreach (KeyValuePair <string, AnimatedButton> pair in this.craftingMenuTabs) { menu.addInCraftingPageTab(pair.Key, pair.Value); } foreach (KeyValuePair <string, UnlockableCraftingRecipe> pair in this.craftingRecipes) { if (pair.Value.hasUnlocked) { menu.addInCraftingRecipe(new Framework.Menus.MenuComponents.CraftingRecipeButton(pair.Value.recipe, null, new Vector2(), new Rectangle(0, 0, 16, 16), 4f, true, Color.White), pair.Value.whichTab); //ModCore.log("Add in a crafting recipe to the menu!"); } else { ModCore.log("Recipe is locked!"); } } menu.currentTab = this.defaultTab; menu.sortRecipes(); if (Game1.activeClickableMenu == null) { Game1.activeClickableMenu = menu; } }
/// <summary>Calculates how dark it should be a night.</summary> public static void CalculateDarkerNightColor() { if (!Config.Enabled || Game1.player?.currentLocation == null) { return; } //Calculate original lighting. if (Game1.timeOfDay >= Game1.getTrulyDarkTime()) { float num = Math.Min(0.93f, (float)(0.75 + ((int)(Game1.timeOfDay - Game1.timeOfDay % 100 + Game1.timeOfDay % 100 / 10 * 16.6599998474121) - Game1.getTrulyDarkTime() + Game1.gameTimeInterval / 7000.0 * 16.6000003814697) * 0.000624999986030161)); Game1.outdoorLight = (Game1.isRaining ? Game1.ambientLight : Game1.eveningColor) * num; } else if (Game1.timeOfDay >= Game1.getStartingToGetDarkTime()) { float num = Math.Min(0.93f, (float)(0.300000011920929 + ((int)(Game1.timeOfDay - Game1.timeOfDay % 100 + Game1.timeOfDay % 100 / 10 * 16.6599998474121) - Game1.getStartingToGetDarkTime() + Game1.gameTimeInterval / 7000.0 * 16.6000003814697) * 0.00224999990314245)); Game1.outdoorLight = (Game1.isRaining ? Game1.ambientLight : Game1.eveningColor) * num; } ModCore.log("OUT: " + Game1.outdoorLight); int red = Game1.outdoorLight.R; if (Game1.player.currentLocation.IsOutdoors && Game1.timeOfDay >= Game1.getStartingToGetDarkTime()) { //Game1.ambientLight = Game1.ambientLight.GreyScaleAverage(); CalculatedColor = Game1.ambientLight * ((red + 30) / 255f) * Config.DarknessIntensity; ModCore.log("OUT: " + CalculatedColor); ModCore.log("Ambient" + Game1.ambientLight); } }
public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement) { Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); string GUID = additionalSaveData["GUID"]; Machine self = Revitalize.ModCore.Serializer.DeserializeGUID <Machine>(additionalSaveData["GUID"]); if (ModCore.IsNullOrDefault <Machine>(self)) { return(null); } try { if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) { MultiTiledObject obj = (MultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <MultiTiledObject>(additionalSaveData["ParentGUID"]); self.containerObject = obj; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj); } else { self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); } } catch (Exception err) { ModCore.log(err); } return(self); }
public Item DeserializeFromFarmhandInventory(string JsonName) { //ModCore.log("Found a custom object in a chest!"); string jsonString = JsonName; //ModCore.log(JsonName); string dataSplit = jsonString.Split(new string[] { "<" }, StringSplitOptions.None)[2]; string backUpGUID = dataSplit.Split('|')[0]; string[] guidArr = jsonString.Split(new string[] { "|" }, StringSplitOptions.None); string infoStr = jsonString.Split(new string[] { "<" }, StringSplitOptions.None)[0]; string guidStr = jsonString.Split(new string[] { "<" }, StringSplitOptions.None)[1]; CustomObjectData pyTkData = ModCore.Serializer.DeserializeFromJSONString <CustomObjectData>(dataSplit); Type t = Type.GetType(pyTkData.type); string id = pyTkData.id; //Need Item info string guidName = backUpGUID; string infoSplit = infoStr.Split('|')[3]; infoSplit = infoSplit.Substring(3); BasicItemInformation info = ModCore.Serializer.DeserializeFromJSONString <BasicItemInformation>(infoSplit); CustomObject clone = (CustomObject)ModCore.ObjectManager.getItemByIDAndType(id, t); if (clone != null) { clone.info = info; ModCore.log("Guid is????:" + guidStr); clone.guid = Guid.Parse(guidStr); return(clone); } return(null); }
/// <summary> /// Called after load to deal with internal file cleanUp /// </summary> public void afterLoad() { ModCore.log("WHAT"); this.deleteAllUnusedFiles(); //this.removeNullObjects(); this.restoreModObjects(); }
public bool addComponent(Vector2 key, MultiTiledComponent obj) { if (this.objects.ContainsKey(key)) { ModCore.log("Bad DATA"); return(false); } this.objects.Add(key, obj); if (this.childrenGuids.ContainsKey(key) == false) { this.childrenGuids.Add(key, obj.guid); } if (key.X > this.width) { this.width = (int)key.X; } if (key.Y > this.height) { this.height = (int)key.Y; } (obj as MultiTiledComponent).containerObject = this; (obj as MultiTiledComponent).offsetKey = key; this.info.forceUpdate(); return(true); }
public void debugInfo() { Layer layer = this.map.GetLayer("Back"); ModCore.log("layer Tile Size: " + new Vector2(layer.TileSize.Width, layer.TileSize.Height)); ModCore.log("Layer Width/Height: " + new Vector2(layer.LayerWidth, layer.LayerHeight)); ModCore.log("Size multiplier: 4"); }
/// <summary>What happens when the player left clicks the object.</summary> public override bool clicked(Farmer who) { ModCore.log("Clicky click!"); ModCore.log(System.Environment.StackTrace); return(this.removeAndAddToPlayersInventory()); //return base.clicked(who); }
/// <summary> /// Write a dataInfo file to binary. /// </summary> /// <param name="writer"></param> /// <param name="obj"></param> public static void WriteDataInfo(this BinaryWriter writer, object obj) { DataInfo dataInfo = (DataInfo)obj; writer.WriteString(dataInfo.type); //ModCore.monitor.Log("WRITE DATA INFO FUNCTION3: " + dataInfo.type); ModCore.processTypesToWrite(writer, dataInfo.type, dataInfo.data); writer.WriteString(dataInfo.recipientID); }
/// <summary> /// Read a data info file from a binary stream. /// </summary> /// <param name="reader"></param> /// <returns></returns> public static DataInfo ReadDataInfo(this BinaryReader reader) { String key = reader.ReadString(); object data = ModCore.processTypesToRead(reader, key); string ID = reader.ReadString(); DataInfo info = new DataInfo(key, data, ID); return(info); }
public void processIncomingMessage(IncomingMessage message) { //ModCore.monitor.Log("MESSAGES????"); switch (message.MessageType) { case 2: message.Reader.ReadString(); ModCore.multiplayer.processIncomingMessage(message); break; case 5: this.warpFarmer(message.SourceFarmer, message.Reader.ReadInt16(), message.Reader.ReadInt16(), message.Reader.ReadString(), (int)message.Reader.ReadByte() == 1); break; case Enums.MessageTypes.SendOneWay: object[] obj = message.Reader.ReadModdedInfoPacket(); string functionName = (string)obj[0]; string classType = (string)obj[1]; object actualObject = ModCore.processTypesToRead(message.Reader, classType); ModCore.processVoidFunction(functionName, actualObject); break; case Enums.MessageTypes.SendToAll: object[] obj2 = message.Reader.ReadModdedInfoPacket(); string functionName2 = (string)obj2[0]; string classType2 = (string)obj2[1]; object actualObject2 = ModCore.processTypesToRead(message.Reader, classType2); ModCore.processVoidFunction(functionName2, actualObject2); this.rebroadcastClientMessageToAllClients(message); break; case Enums.MessageTypes.SendToSpecific: //Read in specific info. object[] obj3 = message.Reader.ReadModdedInfoPacket(); string functionName3 = (string)obj3[0]; string classType3 = (string)obj3[1]; //Parse object actualObject3 = ModCore.processTypesToRead(message.Reader, classType3); DataInfo info = (DataInfo)actualObject3; if (info.recipientID == Game1.player.UniqueMultiplayerID.ToString()) { ModCore.processVoidFunction(functionName3, actualObject3); } else { this.sendMessageToSpecificClient(message, info); } break; default: ModCore.multiplayer.processIncomingMessage(message); break; } //this.rebroadcastClientMessage(message); }
/// <summary> /// Stops a said sound from the music pack. /// </summary> /// <param name="packName"></param> /// <param name="soundName"></param> public void stopSound(string packName, string soundName) { if (this.MusicPacks.ContainsKey(packName)) { this.MusicPacks[packName].StopSound(); } else { ModCore.DebugLog("No pack with specified key/name: " + packName); } }
/// <summary> /// Checks to see if the player can craft this object and if so go ahead and craft it. /// </summary> /// <param name="o"></param> public bool craft(StardewValley.Object o) { if (this.PlayerCanCraft()) { IList <Item> playerItems = Game1.player.Items; List <Item> outPutItems = new List <Item>(); ModCore.log("Can craft recipe."); this.craft(ref playerItems, ref o); return(true); } return(false); }
/// <summary> /// Hijacks the shipping menu to process modded items. /// </summary> public static void EndOfDay_HackShipping() { if (EndOfDay_GetShippingMenu() != null) { //ModCore.log("Hooked shipping menu!"); ShippingMenu menu = EndOfDay_GetShippingMenu(); List <int> categoryTotals = new List <int>(); List <MoneyDial> categoryDials = new List <MoneyDial>(); List <List <Item> > categoryItems = new List <List <Item> >(); var CT_R = ModCore.ModHelper.Reflection.GetField <List <int> >(menu, "categoryTotals", true); var CD_R = ModCore.ModHelper.Reflection.GetField <List <MoneyDial> >(menu, "categoryDials", true); var CI_R = ModCore.ModHelper.Reflection.GetField <List <List <Item> > >(menu, "categoryItems", true); categoryTotals = CT_R.GetValue(); categoryDials = CD_R.GetValue(); categoryItems = CI_R.GetValue(); //Recalculate other category. foreach (ICommonObjectInterface obj in categoryItems[4]) { ModCore.log(obj.Name); if (obj is StardewValley.Object) { ModCore.log(obj.sellToStorePrice()); categoryTotals[4] += obj.sellToStorePrice() * obj.Stack; Game1.stats.itemsShipped += (uint)obj.Stack; /* * if (o.Category == -75 || o.Category == -79) * Game1.stats.CropsShipped += (uint)o.Stack; * if (o.countsForShippedCollection()) * Game1.player.shippedBasic((int)((NetFieldBase<int, NetInt>)o.parentSheetIndex), (int)((NetFieldBase<int, NetInt>)o.stack)); */ } } categoryTotals[5] = 0; for (int index = 0; index < 5; ++index) { categoryTotals[5] += categoryTotals[index]; categoryItems[5].AddRange((IEnumerable <Item>)categoryItems[index]); categoryDials[index].currentValue = categoryTotals[index]; categoryDials[index].previousTargetValue = categoryDials[index].currentValue; } categoryDials[5].currentValue = categoryTotals[5]; if (Game1.IsMasterGame) { Game1.player.Money += categoryTotals[5]; } Game1.setRichPresence("earnings", (object)categoryTotals[5]); } }
protected override void processIncomingMessage(IncomingMessage message) { base.processIncomingMessage(message); //Packet signiture for functions that return nothing. if (message.MessageType == Enums.MessageTypes.SendOneWay || message.MessageType == Enums.MessageTypes.SendToAll) { object[] obj = message.Reader.ReadModdedInfoPacket(); string functionName = (string)obj[0]; string classType = (string)obj[1]; object actualObject = ModCore.processTypesToRead(message.Reader, classType); ModCore.processVoidFunction(functionName, actualObject); return; } }
/// <summary> /// Sends a custom object to be synced. /// </summary> /// <param name="request"></param> public static void SendGuidObject(Guid request) { if (ModCore.CustomObjects.ContainsKey(request)) { //ModCore.log("Send guid request: "+request.ToString()); //ModCore.CustomObjects[request].forceUpdate(); ModCore.CustomObjects[request].info.forceUpdate(); ModCore.CustomObjects[request].updateInfo(); ModCore.ModHelper.Multiplayer.SendMessage <string>(ModCore.Serializer.ToJSONString(ModCore.CustomObjects[request]), ReceieveGUIDMessage, new string[] { Revitalize.ModCore.Manifest.UniqueID.ToString() }); } else { ModCore.log("This mod doesn't have the guid object"); } }
/// <summary> /// Adds in a new tab for the crafting recipe menu. /// </summary> /// <param name="name"></param> /// <param name="Button"></param> public void addInCraftingPageTab(string name, AnimatedButton Button) { int count = this.CraftingTabs.Count; if (this.CraftingTabs.ContainsKey(name)) { return; } else { Vector2 newPos = new Vector2(100 + (48), (this.yPositionOnScreen + 24) + ((24 * 4) * (count + 1))); ModCore.log("newPos: " + newPos.ToString()); Button.Position = newPos; this.CraftingTabs.Add(name, Button); this.craftingItemsToDisplay.Add(name, new List <CraftingRecipeButton>()); } }
public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement) { //instead of using this.offsetkey.x use get additional save data function and store offset key there //ModCore.log("Recreate a table tile component!"); Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); //ModCore.log("Got the offset key!"); string GUID = additionalSaveData["GUID"]; //ModCore.log("This tile has a parent guid of: " + additionalSaveData["ParentGUID"]); TableTileComponent self = Revitalize.ModCore.Serializer.DeserializeGUID <TableTileComponent>(additionalSaveData["GUID"]); if (ModCore.IsNullOrDefault <TableTileComponent>(self)) { //ModCore.log("SELF IS NULL"); return(null); } try { if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) { //ModCore.log("Load in the parent!"); //Get new container TableMultiTiledObject obj = (TableMultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <TableMultiTiledObject>(additionalSaveData["ParentGUID"]); self.containerObject = obj; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj); } else { //ModCore.log("Parent already exists!"); self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); //Revitalize.ModCore.log("READD AN OBJECT!!!!"); } } catch (Exception err) { ModCore.log(err); } return(self); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { if (SeasideScramble.self.getGamepadState(PlayerIndex.One).IsButtonDown(Buttons.A)) { //ModCore.log("Button a pressed. Intercepting left click."); return; } ModCore.log("Left clicked for Character selects screen!"); this.initializeCharacter(SSCEnums.PlayerID.One); if (this.buttons["P1NextButton"].containsPoint(x, y)) { this.iteratePlayerColorIndex(SSCEnums.PlayerID.One, 1); } if (this.buttons["P1PrevButton"].containsPoint(x, y)) { this.iteratePlayerColorIndex(SSCEnums.PlayerID.One, -1); } }
/// <summary> /// Consumes all of the ingredients for the recipe. /// </summary> /// <param name="from"></param> public void consume(ref IList <Item> from) { if (this.InventoryContainsAllIngredient(from) == false) { return; } InventoryManager manager = new InventoryManager(from); List <Item> removalList = new List <Item>(); foreach (KeyValuePair <Item, int> pair in this.requiredItems) { foreach (Item item in manager.items) { if (item == null) { continue; } if (this.ItemEqualsOther(item, pair.Key)) { if (item.Stack == pair.Value) { removalList.Add(item); //remove the item } else { item.Stack -= pair.Value; //or reduce the stack size. } ModCore.log("Remove: " + pair.Key.Name); } } } foreach (var v in removalList) { manager.items.Remove(v); } removalList.Clear(); from = manager.items; }
/// <summary> /// Recreates the farmhand's inventory even when they are offline. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public static void RecreateFarmhandInventory(object sender, StardewModdingAPI.Events.MenuChangedEventArgs e) { if (e.NewMenu != null) { ModCore.log(e.NewMenu.GetType()); if (e.NewMenu.GetType() == typeof(StardewValley.Menus.ItemGrabMenu)) { if (Game1.player.currentLocation is Cabin) { //ModCore.log("Let's get processing!"); List <KeyValuePair <int, Item> > addition = new List <KeyValuePair <int, Item> >(); for (int i = 0; i < (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.actualInventory.Count; i++) { Item I = (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.actualInventory[i]; if (I is Chest && I.Name != "Chest") { //ModCore.log("Found a custom object!"); Item cObj = ModCore.Serializer.DeserializeFromFarmhandInventory(I.Name); if (cObj == null) { continue; } addition.Add(new KeyValuePair <int, Item>(i, cObj)); } } foreach (KeyValuePair <int, Item> pair in addition) { (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.actualInventory[pair.Key] = pair.Value; } (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu = new InventoryMenu((Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.xPositionOnScreen, (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.yPositionOnScreen, true, (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.actualInventory, (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.highlightMethod, (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.capacity, (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.rows, (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.horizontalGap, (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.verticalGap, (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.drawSlots); (Game1.activeClickableMenu as ItemGrabMenu).populateClickableComponentList(); (Game1.activeClickableMenu as ItemGrabMenu).ItemsToGrabMenu.populateClickableComponentList(); } } } }
public override void GameComponentTick() { tickCounter++; float multi = Find.TickManager.TickRateMultiplier; if (multi < 1) { multi = 1; } if (tickCounter % Mathf.RoundToInt(60 * 10 * multi) == 0) { if (ModCore.DoMultithread()) { if (!Main.IsLoaded) { Main.Load(); } Task.Run(() => { try { Main.Recalculate(); } catch (Exception e) { Log.Warning("Exception during zoo score recalculation. If you see this error a lot, disable multithreading in mod settings."); Log.Warning(e.ToString()); } }); } else { Main.Recalculate(); } } }
/// <summary>What happens when the object is drawn at a tile location.</summary> public override void draw(SpriteBatch spriteBatch, int x, int y, float alpha = 1f) { if (x <= -1) { return; //spriteBatch.Draw(this.basicItemInfo.animationManager.getTexture(), Game1.GlobalToLocal(Game1.viewport, this.TileLocation), new Rectangle?(this.AnimationManager.currentAnimation.sourceRectangle), this.basicItemInfo.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); } else { if (this.AnimationManager == null) { if (this.CurrentTextureToDisplay == null) { ModCore.log("Texture null for item: " + this.basicItemInfo.id); return; } } if (this.AnimationManager == null) { if (this.AnimationManager.getExtendedTexture() == null) { ModCore.ModMonitor.Log("Tex Extended is null???"); } spriteBatch.Draw(this.CurrentTextureToDisplay, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.AnimationManager.getCurrentAnimationFrameRectangle()), this.basicItemInfo.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)(this.TileLocation.Y * Game1.tileSize) / 10000f)); this.drawStatusBubble(spriteBatch, x, y, alpha); // Log.AsyncG("ANIMATION IS NULL?!?!?!?!"); } else { //Log.AsyncC("Animation Manager is working!"); this.AnimationManager.draw(spriteBatch, this.CurrentTextureToDisplay, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)(x * Game1.tileSize), y * Game1.tileSize)), new Rectangle?(this.AnimationManager.getCurrentAnimationFrameRectangle()), this.basicItemInfo.DrawColor * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, this.flipped ? SpriteEffects.FlipHorizontally : SpriteEffects.None, Math.Max(0f, (float)((this.TileLocation.Y) * Game1.tileSize) / 10000f)); this.drawStatusBubble(spriteBatch, x, y, alpha); } // spriteBatch.Draw(Game1.mouseCursors, Game1.GlobalToLocal(Game1.viewport, new Vector2((float)((double)tileLocation.X * (double)Game1.tileSize + (((double)tileLocation.X * 11.0 + (double)tileLocation.Y * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2), (float)((double)tileLocation.Y * (double)Game1.tileSize + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) + (float)(Game1.tileSize / 2))), new Rectangle?(new Rectangle((int)((double)tileLocation.X * 51.0 + (double)tileLocation.Y * 77.0) % 3 * 16, 128 + this.whichForageCrop * 16, 16, 16)), Color.White, 0.0f, new Vector2(8f, 8f), (float)Game1.pixelZoom, SpriteEffects.None, (float)(((double)tileLocation.Y * (double)Game1.tileSize + (double)(Game1.tileSize / 2) + (((double)tileLocation.Y * 11.0 + (double)tileLocation.X * 7.0) % 10.0 - 5.0)) / 10000.0)); } }
/// <summary>Checks for interaction with the object.</summary> public override bool checkForAction(Farmer who, bool justCheckingForActivity = false) { MouseState mState = Mouse.GetState(); KeyboardState keyboardState = Game1.GetKeyboardState(); if (mState.RightButton == ButtonState.Pressed && (keyboardState.IsKeyDown(Keys.LeftShift) || !keyboardState.IsKeyDown(Keys.RightShift))) { ModCore.log("Right clicked!"); return(this.rightClicked(who)); } if (mState.RightButton == ButtonState.Pressed && (keyboardState.IsKeyDown(Keys.LeftShift) || keyboardState.IsKeyDown(Keys.RightShift))) { return(this.shiftRightClicked(who)); } if (justCheckingForActivity) { return(true); } ModCore.log("Left clicked!"); return(this.clicked(who)); }
public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement) { //instead of using this.offsetkey.x use get additional save data function and store offset key there Vector2 offsetKey = new Vector2(Convert.ToInt32(additionalSaveData["offsetKeyX"]), Convert.ToInt32(additionalSaveData["offsetKeyY"])); string GUID = additionalSaveData["GUID"]; LampTileComponent self = Revitalize.ModCore.Serializer.DeserializeGUID <LampTileComponent>(additionalSaveData["GUID"]); if (ModCore.IsNullOrDefault <LampTileComponent>(self)) { return(null); } try { if (!Revitalize.ModCore.ObjectGroups.ContainsKey(additionalSaveData["ParentGUID"])) { LampMultiTiledObject obj = (LampMultiTiledObject)Revitalize.ModCore.Serializer.DeserializeGUID <LampMultiTiledObject>(additionalSaveData["ParentGUID"]); self.containerObject = obj; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); Revitalize.ModCore.ObjectGroups.Add(additionalSaveData["ParentGUID"], obj); } else { self.containerObject = Revitalize.ModCore.ObjectGroups[additionalSaveData["ParentGUID"]]; self.containerObject.removeComponent(offsetKey); self.containerObject.addComponent(offsetKey, self); } } catch (Exception err) { ModCore.log(err); } return(self); }
public frmCad(ref ModCore core) { this.core = core; InitializeComponent(); }
public ApiController(CoreContainer cont) { this.core = cont.mcore; }