private void InitContents( BarrelType type ) { Item item = null; byte count = (byte)Utility.RandomMinMax( 10, 30 ); for( byte i = 0; i < count; i++ ) { switch( type ) { default: case BarrelType.Arrows: item = new Arrow( Utility.RandomMinMax( 2, 6 ) ); break; case BarrelType.Bolts: item = new Bolt( Utility.RandomMinMax( 2, 6 ) ); break; case BarrelType.Farming: { if( i > 3 ) return; switch( Utility.Random( 3 ) ) { case 0: item = new Shovel(); break; case 1: item = new Scythe(); break; case 2: item = new Pitchfork(); break; } break; } case BarrelType.LargeMining: { if( i > 5 ) return; switch( Utility.Random( 5 ) ) { case 0: item = new Pitchfork(); break; case 1: case 2: item = new Shovel(); break; case 3: case 4: item = new Pickaxe(); break; } break; } case BarrelType.LargeWeapon1: case BarrelType.LargeWeapon2: case BarrelType.LargeWeapon3: { if( i > 6 ) return; switch( Utility.Random( 6 ) ) { case 0: item = new Spear(); break; case 1: item = new Halberd(); break; case 2: item = new Axe(); break; case 3: item = new ThinLongsword(); break; case 4: item = new WarAxe(); break; case 5: item = new VikingSword(); break; } break; } case BarrelType.Mining: { if( i > 3 ) return; item = new Pickaxe(); break; } case BarrelType.Spears: { if( i > 4 ) return; item = new Spear(); break; } case BarrelType.Weapons: { if( i > 3 ) return; switch( Utility.Random( 3 ) ) { case 0: item = new WarAxe(); break; case 1: item = new WarMace(); break; case 2: item = new Maul(); break; } break; } } if( item != null ) DropItem( item ); } }
public static void Postfix(StardewValley.Farmer who, Dictionary <Item, int[]> __result) { Tool tool = who.getToolFromName("Axe"); if (tool != null && tool.UpgradeLevel == 4) { var newTool = new Axe(); newTool.UpgradeLevel = 5; __result.Add(newTool, new int[] { 100000, 1, CobaltBarItem.INDEX }); } tool = who.getToolFromName("Watering Can"); if (tool != null && tool.UpgradeLevel == 4) { var newTool = new WateringCan(); newTool.UpgradeLevel = 5; __result.Add(newTool, new int[] { 100000, 1, CobaltBarItem.INDEX }); } tool = who.getToolFromName("Pickaxe"); if (tool != null && tool.UpgradeLevel == 4) { var newTool = new Pickaxe(); newTool.UpgradeLevel = 5; __result.Add(newTool, new int[] { 100000, 1, CobaltBarItem.INDEX }); } tool = who.getToolFromName("Hoe"); if (tool != null && tool.UpgradeLevel == 4) { var newTool = new Hoe(); newTool.UpgradeLevel = 5; __result.Add(newTool, new int[] { 100000, 1, CobaltBarItem.INDEX }); } }
public static bool performToolAction_Prefix(ref Object __instance, Tool t, GameLocation location, ref bool __result) { // If the tool is a mattock and this object is one that requires a specific type of tool that is supported, // run the function with a stand-in tool instead. if (t is Mattock mattock && !mattock.struckObjects.Contains(__instance)) { // Treat the mattock as a pickaxe for stones. if (__instance.name.Equals("Stone") || __instance.name.Equals("Boulder")) { Pickaxe standinPickaxe = mattock.asPickaxe(); standinPickaxe.DoFunction(location, (int)(__instance.TileLocation.X * 64 + 32), (int)(__instance.TileLocation.Y * 64 + 32), 1, Game1.player); mattock.struckObjects.Add(__instance); return(false); } // Treat the mattock as an axe for twigs. else if (__instance.name.Contains("Twig")) { Axe standinAxe = mattock.asAxe(); standinAxe.DoFunction(location, (int)(__instance.TileLocation.X * 64 + 32), (int)(__instance.TileLocation.Y * 64 + 32), 1, Game1.player); mattock.struckObjects.Add(__instance); return(false); } } // Otherwise, just do the default functionality. return(true); }
public InternalSellInfo() { Add(typeof(Pickaxe), Pickaxe.GetSBSellValue()); Add(typeof(Shovel), Shovel.GetSBSellValue()); Add(typeof(Lockpick), Lockpick.GetSBSellValue()); Add(typeof(Scissors), Scissors.GetSBSellValue()); Add(typeof(Tongs), Tongs.GetSBSellValue()); Add(typeof(SledgeHammer), SledgeHammer.GetSBSellValue()); Add(typeof(SmithHammer), SmithHammer.GetSBSellValue()); Add(typeof(MortarPestle), MortarPestle.GetSBSellValue()); Add(typeof(TinkerTools), TinkerTools.GetSBSellValue()); Add(typeof(SewingKit), SewingKit.GetSBSellValue()); Add(typeof(Skillet), Skillet.GetSBSellValue()); Add(typeof(RollingPin), RollingPin.GetSBSellValue()); Add(typeof(MapmakersPen), MapmakersPen.GetSBSellValue()); Add(typeof(ScribesPen), ScribesPen.GetSBSellValue()); Add(typeof(Scorp), Scorp.GetSBSellValue()); Add(typeof(DrawKnife), DrawKnife.GetSBSellValue()); Add(typeof(Saw), Saw.GetSBSellValue()); Add(typeof(DovetailSaw), DovetailSaw.GetSBSellValue()); Add(typeof(Froe), Froe.GetSBSellValue()); Add(typeof(Hammer), Hammer.GetSBSellValue()); Add(typeof(Inshave), Inshave.GetSBSellValue()); Add(typeof(JointingPlane), JointingPlane.GetSBSellValue()); Add(typeof(WoodenPlane), WoodenPlane.GetSBSellValue()); Add(typeof(SmoothingPlane), SmoothingPlane.GetSBSellValue()); }
public InternalBuyInfo() { Add(new GenericBuyInfo("Pickaxe", typeof(Pickaxe), Pickaxe.GetSBPurchaseValue(), 50, 0xE86, 0)); Add(new GenericBuyInfo("Shovel", typeof(Shovel), Shovel.GetSBPurchaseValue(), 50, 0xF39, 0)); Add(new GenericBuyInfo("Hatchet", typeof(Hatchet), Hatchet.GetSBPurchaseValue(), 50, 0xF43, 0)); Add(new GenericBuyInfo("Lockpick", typeof(Lockpick), Lockpick.GetSBPurchaseValue(), 250, 0x14FC, 0)); Add(new GenericBuyInfo("Scissors", typeof(Scissors), Scissors.GetSBPurchaseValue(), 50, 0xF9F, 0)); Add(new GenericBuyInfo("Tongs", typeof(Tongs), Tongs.GetSBPurchaseValue(), 50, 0xFBB, 0)); Add(new GenericBuyInfo("SledgeHammer", typeof(SledgeHammer), SledgeHammer.GetSBPurchaseValue(), 50, 0xFB5, 0)); Add(new GenericBuyInfo("SmithHammer", typeof(SmithHammer), SmithHammer.GetSBPurchaseValue(), 50, 0x13E3, 0)); Add(new GenericBuyInfo("MortarPestle", typeof(MortarPestle), MortarPestle.GetSBPurchaseValue(), 50, 0xE9B, 0)); Add(new GenericBuyInfo("TinkerTools", typeof(TinkerTools), TinkerTools.GetSBPurchaseValue(), 50, 0x1EB8, 0)); Add(new GenericBuyInfo("SewingKit", typeof(SewingKit), SewingKit.GetSBPurchaseValue(), 50, 0xF9D, 0)); Add(new GenericBuyInfo("Skillet", typeof(Skillet), Skillet.GetSBPurchaseValue(), 50, 0x97F, 0)); Add(new GenericBuyInfo("RollingPin", typeof(RollingPin), RollingPin.GetSBPurchaseValue(), 50, 0x1043, 0)); Add(new GenericBuyInfo("MapmakersPen", typeof(MapmakersPen), MapmakersPen.GetSBPurchaseValue(), 50, 0x0FBF, 0)); Add(new GenericBuyInfo("ScribesPen", typeof(ScribesPen), ScribesPen.GetSBPurchaseValue(), 50, 0x0FBF, 0)); Add(new GenericBuyInfo("Scorp", typeof(Scorp), Scorp.GetSBPurchaseValue(), 50, 0x10E7, 0)); Add(new GenericBuyInfo("DrawKnife", typeof(DrawKnife), DrawKnife.GetSBPurchaseValue(), 50, 0x10E4, 0)); Add(new GenericBuyInfo("Saw", typeof(Saw), Saw.GetSBPurchaseValue(), 50, 0x1034, 0)); Add(new GenericBuyInfo("DovetailSaw", typeof(DovetailSaw), DovetailSaw.GetSBPurchaseValue(), 50, 0x1028, 0)); Add(new GenericBuyInfo("Froe", typeof(Froe), Froe.GetSBPurchaseValue(), 50, 0x10E5, 0)); Add(new GenericBuyInfo("Hammer", typeof(Hammer), Hammer.GetSBPurchaseValue(), 50, 0x102A, 0)); Add(new GenericBuyInfo("Inshave", typeof(Inshave), Inshave.GetSBPurchaseValue(), 50, 0x10E6, 0)); Add(new GenericBuyInfo("JointingPlane", typeof(JointingPlane), JointingPlane.GetSBPurchaseValue(), 50, 0x1030, 0)); Add(new GenericBuyInfo("WoodenPlane", typeof(WoodenPlane), WoodenPlane.GetSBPurchaseValue(), 50, 0x102C, 0)); Add(new GenericBuyInfo("SmoothingPlane", typeof(SmoothingPlane), SmoothingPlane.GetSBPurchaseValue(), 50, 0x1032, 0)); }
public void DisplayPickaxeInfo(Pickaxe pickaxe) { ClosePanel(); pickaxeHolder = pickaxe; Invoke("UpdatePickaxeInfo", moveDelay); Invoke("OpenPanel", moveDelay); }
public InternalBuyInfo() { Add(new GenericBuyInfo("Pickaxe", typeof(Pickaxe), Pickaxe.GetSBPurchaseValue(), 50, 0xE86, 0)); Add(new GenericBuyInfo("Shovel", typeof(Shovel), Shovel.GetSBPurchaseValue(), 50, 0xF39, 0)); Add(new AnimalBuyInfo(1, "Pack Horse", typeof(PackHorse), PackHorse.GetSBPurchaseValue(), 10, 0x123, 0)); Add(new AnimalBuyInfo(1, "Pack Horse", typeof(PackLlama), PackLlama.GetSBPurchaseValue(), 10, 0x124, 0)); }
private static void Pickaxe_DoFunction_Postfix(Pickaxe __instance, int __state) { if (!Config.EnableMod) { return; } __instance.additionalPower.Value = __state; }
public MountainMiner() : base(AIType.AI_Animal, FightMode.None, 10, 1, 0.2, 0.4) { SetStr(135, 163); SetDex(68, 92); SetInt(26, 46); SetSkill(SkillName.Anatomy, 60.0, 83.0); SetSkill(SkillName.Mining, 65.0, 88.0); SetSkill(SkillName.Parry, 61.0, 93.0); SetSkill(SkillName.Swords, 60.0, 83.0); SetSkill(SkillName.Tactics, 60.0, 83.0); Fame = 10; Karma = 1000; SpeechHue = Utility.RandomDyedHue(); Hue = Utility.RandomSkinHue(); Utility.AssignRandomHair(this); if (this.Female = Utility.RandomBool()) { this.Body = 0x191; this.Name = NameList.RandomName("female"); AddItem(new Skirt(Utility.RandomNeutralHue())); AddItem(new Shirt(Utility.RandomDyedHue())); Title = "the miner"; } else { this.Body = 0x190; this.Name = NameList.RandomName("male"); AddItem(new ShortPants(Utility.RandomNeutralHue())); AddItem(new Shirt(Utility.RandomDyedHue())); Title = "the miner"; } AddItem(new Boots(Utility.RandomNeutralHue())); LeatherGloves gloves = new LeatherGloves(); gloves.Movable = true; AddItem(gloves); Pickaxe weapon = new Pickaxe(); weapon.Movable = true; AddItem(weapon); Container pack = new Backpack(); pack.DropItem(new Gold(10, 15)); pack.Movable = false; AddItem(pack); }
public static void OrcBeg(Mobile m, object targeted, double chance) { Mobile t = (Mobile)targeted; Item reward = null; string rewardName = ""; if (chance > .99 && m.Skills.Begging.Base >= 100) { int rand = Utility.Random(2); if (rand == 0) { reward = new GruesomeStandardArtifact(); //Gruesome Standard Artifact! } else if (rand == 1) { reward = new BeggerCoins(50); rewardName = "50 Dull Silver Coins."; } else if (rand == 2) { reward = new FurCape(); } } if (chance >= .95) { int rand = Utility.Random(7); if (rand == 0) { reward = new LambLeg(); } else if (rand == 1) { reward = new Head(); } else if (rand == 2) { reward = new FishSteak(); } else if (rand == 3) { reward = new Pickaxe(); } else if (rand == 5) { reward = new IronIngot(1); } else if (rand == 5) { reward = new BeggerCoins(25); rewardName = "25 Dull Silver Coins."; } } Reward(m, t, reward, rewardName); }
protected override bool OnPickaxeAction(Pickaxe pickaxe) { if (!IsEmpty) { PlaySound(Sound.Bubbles); } IsEmpty = true; return(base.OnPickaxeAction(pickaxe)); }
public static bool performToolAction_Prefix(ref TerrainFeature __instance, Tool t, int damage, Vector2 tileLocation, GameLocation location, ref bool __result) { ModEntry.M.Log("performToolAction_Prefix A", StardewModdingAPI.LogLevel.Info); // Gotta have the original method available for mattock stand-ins. if (performToolActionOriginal == null) { return(true); } ModEntry.M.Log("performToolAction_Prefix B", StardewModdingAPI.LogLevel.Info); // If the tool is a mattock and this object is one that requires a specific type of tool that is supported, // run the function with a stand-in tool instead. if (t is Mattock mattock) { if (__instance is Tree || __instance is FruitTree || __instance is Bush || __instance is GiantCrop || __instance is Flooring) { ModEntry.M.Log("Struck a feature:" + __instance.GetType().ToString(), StardewModdingAPI.LogLevel.Info); // Treat the mattock as an axe for various terrain features. Axe standinAxe = mattock.asAxe(); __result = (bool)performToolActionOriginal.Invoke(__instance, new object[] { __instance, standinAxe, damage, tileLocation, location }); return(false); } else if (__instance is ResourceClump clump) { switch (clump.parentSheetIndex.Get()) { case 600: // Stump case 602: // Log { // Treat the mattock as an axe for stumps. Axe standinAxe = mattock.asAxe(); __result = (bool)performToolActionOriginal.Invoke(__instance, new object[] { __instance, standinAxe, damage, tileLocation, location }); return(false); } case 622: // Iridium meteorite case 672: // Boulder 1 case 752: // Boulder 2 case 754: // Boulder 3 case 756: // Icy Boulder 1 case 758: // Icy Boulder 2 { // Treat the mattock as a pickaxe for boulders. Pickaxe standinPickaxe = (t as Mattock).asPickaxe(); standinPickaxe.DoFunction(location, (int)(__instance.currentTileLocation.X * 64), (int)(__instance.currentTileLocation.Y * 64), 1, Game1.player); //__result = (bool) performToolActionOriginal.Invoke(__instance, new object[] { __instance, standinPickaxe, damage, tileLocation, location }); return(false); } } } } // Otherwise, just do the default functionality. return(true); }
public override void OnAfterSpawn() { base.OnAfterSpawn(); Server.Misc.TavernPatrons.RemoveSomeGear(this, false); Server.Misc.MorphingTime.CheckNecromancer(this); Server.Items.EssenceBase.ColorCitizen(this); Item hammer = new Pickaxe(); hammer.Movable = false; AddItem(hammer); }
public GokturForeman() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4) { Name = NameList.RandomName("orc"); Body = 0x190; BaseSoundID = 0x45A; Title = "the Goktur Clan Foreman"; Hue = 2211; SetStr(96, 120); SetDex(81, 105); SetInt(36, 60); SetHits(58, 72); SetDamage(5, 7); SetDamageType(ResistanceType.Physical, 100); SetResistance(ResistanceType.Physical, 25, 30); SetResistance(ResistanceType.Fire, 20, 30); SetResistance(ResistanceType.Cold, 10, 20); SetResistance(ResistanceType.Poison, 10, 20); SetResistance(ResistanceType.Energy, 20, 30); SetSkill(SkillName.MagicResist, 50.1, 75.0); SetSkill(SkillName.Tactics, 55.1, 80.0); SetSkill(SkillName.Wrestling, 50.1, 70.0); Fame = 0; Karma = 0; VirtualArmor = 28; OrcishKinMask helm = new OrcishKinMask(); helm.Hue = this.Hue; AddItem(helm);; Pickaxe pickaxe = new Pickaxe(); pickaxe.Hue = 0; AddItem(pickaxe); Torch torch = new Torch(); torch.Hue = 0; AddItem(torch); Spellbook spellbook = new Spellbook(); spellbook.Hue = 0; AddItem(spellbook); }
private static void Pickaxe_DoFunction_Prefix(Pickaxe __instance, Farmer who, ref int __state) { if (!Config.EnableMod || who == null) { return; } __state = __instance.additionalPower.Value; var power = GetStatMod(GetStatValue(who, "str", Config.BaseStatValue)) * Config.StrPickaxeDamageBonus; SMonitor.Log($"Modifying pickaxe power by {power}"); __instance.additionalPower.Value += power; }
static void Prefix(ref Pickaxe __instance, GameLocation location, int x, int y, int power, Farmer who) { if (__instance.UpgradeLevel == 5) { if (location.Objects.TryGetValue(new Vector2(x / 64, y / 64), out Object obj)) { if (obj.Name == "Stone") { obj.MinutesUntilReady = 0; } } } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.J)) { Pickaxe pick = new Pickaxe(); pick.ThrowPickaxe(); axes.Add(pick); } foreach(Pickaxe p in axes) { p.checkCollision(); } }
public Pickaxe asPickaxe() { Pickaxe standIn = new Pickaxe(); standIn.UpgradeLevel = 3; CopyEnchantments(this, standIn); // Set the "lastUser" field to the player. var lastUser = standIn.GetType().GetField("lastUser", NonPublic | Instance); lastUser.SetValue(standIn, Game1.player); return(standIn); }
void Start() { rectTransform = GetComponent <RectTransform>(); location = false; helmetSlot = GameManager.instance.helmet; chestSlot = GameManager.instance.chest; pantsSlot = GameManager.instance.pants; bootsSlot = GameManager.instance.boots; swordSlot = GameManager.instance.sword; pickaxeSlot = GameManager.instance.pickaxe; itemInfoPanel = GameObject.Find("ItemInfoPanel"); }
public static void Prefix(Pickaxe __instance, GameLocation location, int x, int y) { if (__instance.UpgradeLevel == 6) // Mythicite { Vector2 v2 = new Vector2(x / Game1.tileSize, y / Game1.tileSize); if (location.objects.ContainsKey(v2)) { var obj = location.objects[v2]; if (obj.Name == "Stone") { obj.MinutesUntilReady = 0; } } } }
public void Action(Pickaxe pickaxe) { if (pickaxe.tier >= getOreTier() && !depleted) { float x = Random.Range(0, 100) / 100f; if (x < pickaxe.efficiency) { currentTicks -= 1; } } if (currentTicks <= 0) { Mined(); } }
public static void Prefix(Pickaxe __instance, GameLocation location, int x, int y, int power, Farmer who) { if (!ModEntry.ModConfig.PickaxeDefine.TryGetValue(__instance.UpgradeLevel, out ModConfig.PowerDefine define)) { return; } if (location.Objects.TryGetValue(new Vector2(x / 0x40, y / 0x40), out SObject obj)) { if (obj.Name == "Stone") { int num = Math.Max(1, __instance.UpgradeLevel + 1); obj.MinutesUntilReady -= (int)(num * (define.Power - 1)); } } }
public MugdarMiner() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4) { Name = NameList.RandomName("orc"); Body = 0x190; BaseSoundID = 0x45A; Title = "the Mugdar Clan Miner"; Hue = Utility.RandomMinMax(2401, 2406); SetStr(96, 120); SetDex(81, 105); SetInt(36, 60); SetHits(58, 72); SetDamage(5, 7); SetDamageType(ResistanceType.Physical, 100); SetResistance(ResistanceType.Physical, 25, 30); SetResistance(ResistanceType.Fire, 20, 30); SetResistance(ResistanceType.Cold, 10, 20); SetResistance(ResistanceType.Poison, 10, 20); SetResistance(ResistanceType.Energy, 20, 30); SetSkill(SkillName.MagicResist, 50.1, 75.0); SetSkill(SkillName.Tactics, 55.1, 80.0); SetSkill(SkillName.Wrestling, 50.1, 70.0); Fame = 0; Karma = 0; VirtualArmor = 28; OrcishKinMask helm = new OrcishKinMask(); helm.Hue = this.Hue; AddItem(helm);; Pickaxe pickaxe = new Pickaxe(); pickaxe.Hue = 0; AddItem(pickaxe); HalfApron halfapron = new HalfApron(); halfapron.Hue = 0; AddItem(halfapron); }
private void BreakRocks() { SFarmer player = Game1.player; List <Vector2> tiles = new List <Vector2>(); if (this.PhantomPick == null) { this.PhantomPick = new Pickaxe { UpgradeLevel = 4 } } ; int min = this.PlantRadius * -1; for (int x = min; x <= this.PlantRadius; x++) { for (int y = min; y <= this.PlantRadius; y++) { tiles.Add(new Vector2(this.TileX + x, this.TileY + y)); } } foreach (Vector2 index in tiles) { try { if (player.currentLocation.objects.ContainsKey(index)) { StardewValley.Object o = Game1.player.currentLocation.Objects[index]; if (o != null && o.name.Equals("Stone")) { o.MinutesUntilReady = 0; this.PhantomPick.DoFunction(player.currentLocation, (int)(index.X * Game1.tileSize), (int)(index.Y * Game1.tileSize), 4, player); } } } catch (Exception exception) { if (this.LoggingEnabled) { this.Monitor.Log($"[Point-and-Plant] Rock Pounding Exception: {exception}", LogLevel.Error); } } } }
public Multitool(MultitoolMod m) { this.mod = m; this.attachedTools = new Dictionary <string, Tool>(); this.axe = new Axe(); this.pickaxe = new Pickaxe(); this.scythe = new MeleeWeapon(47); this.scythe = (MeleeWeapon)this.scythe.getOne(); this.scythe.Category = -99; this.wateringCan = new WateringCan(); this.hoe = new Hoe(); attachedTools["axe"] = this.axe; attachedTools["pickaxe"] = this.pickaxe; attachedTools["melee"] = this.scythe; attachedTools["wateringcan"] = this.wateringCan; attachedTools["hoe"] = this.hoe; }
void Start() { gHook = GetComponent <GrapplingHook> (); if (gHook == null) { Debug.LogWarning("gHook is Null"); } mPick = GetComponent <Pickaxe>(); respawn = GetComponent <Respawnable>(); stun = GetComponent <Stunnable>(); avatar = GetComponent <Avatar>(); if (avatar == null) { Debug.LogError("Avatar is Null"); } playerAssignCR = StartCoroutine(WaitForPlayerAssign()); }
public static bool performToolAction_Prefix(ref ResourceClump __instance, Tool t, int damage, Vector2 tileLocation, GameLocation location, ref bool __result) { // Gotta have the original method available for mattock stand-ins. if (performToolActionOriginal == null) { return(true); } // If the tool is a mattock and this object is one that requires a specific type of tool that is supported, // run the function with a stand-in tool instead. if (t is Mattock mattock && !mattock.struckFeatures.Contains(__instance)) { switch (__instance.parentSheetIndex.Get()) { case 600: // Stump case 602: // Log { // Treat the mattock as an axe for stumps. Axe standinAxe = mattock.asAxe(); mattock.struckFeatures.Add(__instance); __result = (bool)performToolActionOriginal.Invoke(__instance, new object[] { __instance, standinAxe, damage, tileLocation, location }); return(false); } case 622: // Iridium meteorite case 672: // Boulder 1 case 752: // Boulder 2 case 754: // Boulder 3 case 756: // Icy Boulder 1 case 758: // Icy Boulder 2 { // Treat the mattock as a pickaxe for boulders. Pickaxe standinPickaxe = mattock.asPickaxe(); mattock.struckFeatures.Add(__instance); //standinPickaxe.DoFunction(location, (int)(__instance.currentTileLocation.X * 64), (int)(__instance.currentTileLocation.Y * 64), 1, Game1.player); __result = (bool)performToolActionOriginal.Invoke(__instance, new object[] { __instance, standinPickaxe, damage, tileLocation, location }); return(false); } } } // Otherwise, just do the default functionality. return(true); }
public static bool Prefix(Pickaxe __instance, GameLocation location, int x, int y, int power, Farmer who) { if (__instance.UpgradeLevel == 5) { int num1 = x / Game1.tileSize; int num2 = y / Game1.tileSize; Vector2 index = new Vector2((float)num1, (float)num2); location.Objects.TryGetValue(index, out SObject obj); if (obj == null) { if (who.FacingDirection == 0 || who.FacingDirection == 2) { num1 = (x - 8) / Game1.tileSize; location.Objects.TryGetValue(new Vector2((float)num1, (float)num2), out obj); if (obj == null) { num1 = (x + 8) / Game1.tileSize; location.Objects.TryGetValue(new Vector2((float)num1, (float)num2), out obj); } } else { num2 = (y + 8) / Game1.tileSize; location.Objects.TryGetValue(new Vector2((float)num1, (float)num2), out obj); if (obj == null) { num2 = (y - 8) / Game1.tileSize; location.Objects.TryGetValue(new Vector2((float)num1, (float)num2), out obj); } } x = num1 * Game1.tileSize; y = num2 * Game1.tileSize; } index = new Vector2((float)num1, (float)num2); if (obj != null) { if (obj.Name.Equals("Stone")) { obj.MinutesUntilReady -= obj.MinutesUntilReady; } } } return(true); }
public void EquipItem(GameObject item) { if (item.tag == "Sword") { if (swordSlot == null) { swordSlot = item.GetComponent <Sword>(); DontDestroyOnLoad(swordSlot.gameObject); } else { if (GameManager.instance.ReturnToInventory(swordSlot.gameObject)) { swordSlot = item.GetComponent <Sword>(); DontDestroyOnLoad(swordSlot.gameObject); } else { GameManager.instance.ReturnToInventory(item); } } } else if (item.tag == "Pickaxe") { if (pickaxeSlot == null) { pickaxeSlot = item.GetComponent <Pickaxe>(); DontDestroyOnLoad(pickaxeSlot.gameObject); } else { if (GameManager.instance.ReturnToInventory(pickaxeSlot.gameObject)) { pickaxeSlot = item.GetComponent <Pickaxe>(); DontDestroyOnLoad(pickaxeSlot.gameObject); } else { GameManager.instance.ReturnToInventory(item); } } } }
public static void Postfix(Pickaxe __instance, GameLocation location, int x, int y, int power, Farmer who) { if (!Config.EnableMod) { return; } foreach (var kvp in location.objects.Pairs) { if (kvp.Value.boundingBox.Value.Contains(x, y) && customSignTypeDict.ContainsKey(kvp.Value.Name) && kvp.Value.modData.TryGetValue(templateKey, out string template) && customSignDataDict.ContainsKey(template)) { if (kvp.Value.performToolAction(__instance, location)) { kvp.Value.performRemoveAction(kvp.Key, location); Game1.currentLocation.debris.Add(new Debris(kvp.Value.bigCraftable.Value ? (-kvp.Value.ParentSheetIndex) : kvp.Value.ParentSheetIndex, who.GetToolLocation(false), new Vector2(who.GetBoundingBox().Center.X, who.GetBoundingBox().Center.Y))); Game1.currentLocation.Objects.Remove(kvp.Key); return; } } } }
private void OnButtonsChanged(object sender, ButtonsChangedEventArgs e) { if (!Context.IsWorldReady) { return; } if (e.Pressed.Contains(SButton.J)) { destructionModeActive = !destructionModeActive; if (destructionModeActive) { Game1.chatBox.addMessage("Destruction Mode Enabled", Color.White); } else { Game1.chatBox.addMessage("Destruction Mode Disabled", Color.White); } } if (destructionModeActive && e.Held.Contains(SButton.MouseLeft)) { Vector2 tile = e.Cursor.GrabTile; Pickaxe pickaxe = new Pickaxe(); float stamina = Game1.player.stamina; if (location.terrainFeatures.TryGetValue(tile, out TerrainFeature feature) && feature is Flooring) { if (userNeedsToBeNextToTile) { if (PlayerIsNextToTile(tile)) { pickaxe.DoFunction(location, (int)(tile.X * Game1.tileSize), (int)(tile.Y * Game1.tileSize), 1, Game1.player); Game1.player.stamina = stamina; } } else { pickaxe.DoFunction(location, (int)tile.X, (int)tile.Y, 1, Game1.player); Game1.player.stamina = stamina; } } } }
public void OnPointerClick(PointerEventData eventData) { PlayerComponent m_player = m_gameManager.LocalPlayer; m_worldManager = FindObjectOfType <WorldManager>(); Debug.Log("index: " + index.x + ", " + index.y); if (m_gameManager.LocalPlayer.currentHolded is Pickaxe) { Pickaxe m_pickaxe = (Pickaxe)m_gameManager.LocalPlayer.currentHolded; maxDigDistance = m_pickaxe.pickRange; diggingTime = m_pickaxe.diggingTime; } if (!isCracked && checkDistance() && m_State == ItemState.DEFAULT) { if (m_player.m_status != PlayerComponent.PlayerStatus.DIGGING) { StartCoroutine("DigTile"); } } }
public Pickaxe(Pickaxe pickaxe) : base(pickaxe) { }