public void AutoTorch() { for (int i = 0; i < player.inventory.Length; i++) { if (TileLoader.IsTorch(player.inventory[i].createTile)) { originalSelectedItem = player.selectedItem; autoRevertSelectedItem = true; player.selectedItem = i; player.controlUseItem = true; Player.tileTargetX = (int)(player.Center.X / 16); Player.tileTargetY = (int)(player.Center.Y / 16); //player.ItemCheck(Main.myPlayer); //break; int oldstack = player.inventory[player.selectedItem].stack; float oldClosest = float.MinValue; bool triedNewPlace = false; do { float closest = float.MaxValue; triedNewPlace = false; for (int j = -Player.tileRangeX - player.blockRange + (int)(player.position.X / 16f); j <= Player.tileRangeX + player.blockRange - 1 + (int)((player.position.X + player.width) / 16f); j++) { for (int k = -Player.tileRangeY - player.blockRange + (int)(player.position.Y / 16f); k <= Player.tileRangeY + player.blockRange - 2 + (int)((player.position.Y + player.height) / 16f); k++) { //ErrorLogger.Log(""+Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16))); if (closest > Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16)) && oldClosest < Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16))) { triedNewPlace = true; //ErrorLogger.Log("closest " + j + " " + k); closest = Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16)); Player.tileTargetX = j; Player.tileTargetY = k; } } } oldClosest = closest; // next round, try farther away from mouse. //ErrorLogger.Log("closest " + Player.tileTargetX + " " + Player.tileTargetY); //ErrorLogger.Log("stack " + player.inventory[player.selectedItem].stack); player.ItemCheck(Main.myPlayer); }while (triedNewPlace && oldstack == player.inventory[player.selectedItem].stack); break; //if (this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX // && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX // && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY // && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY) } } }
public void AutoTorch() { for (int i = 0; i < player.inventory.Length; i++) { if (TileLoader.IsTorch(player.inventory[i].createTile)) { QuickUseItemAt(i, use: false); Player.tileTargetX = (int)(player.Center.X / 16); Player.tileTargetY = (int)(player.Center.Y / 16); int oldstack = player.inventory[player.selectedItem].stack; List <Tuple <float, Point> > targets = new List <Tuple <float, Point> >(); int fixedTileRangeX = Math.Min(Player.tileRangeX, 50); int fixedTileRangeY = Math.Min(Player.tileRangeY, 50); for (int j = -fixedTileRangeX - player.blockRange + (int)(player.position.X / 16f) + 1; j <= fixedTileRangeX + player.blockRange - 1 + (int)((player.position.X + player.width) / 16f); j++) { for (int k = -fixedTileRangeY - player.blockRange + (int)(player.position.Y / 16f) + 1; k <= fixedTileRangeY + player.blockRange - 2 + (int)((player.position.Y + player.height) / 16f); k++) { targets.Add(new Tuple <float, Point>(Vector2.Distance(Main.MouseWorld, new Vector2(j * 16, k * 16)), new Point(j, k))); } } targets.Sort((a, b) => a.Item1.CompareTo(b.Item1)); bool placeSuccess = false; foreach (var target in targets) { Player.tileTargetX = target.Item2.X; Player.tileTargetY = target.Item2.Y; Tile original = (Tile)Main.tile[Player.tileTargetX, Player.tileTargetY].Clone(); player.ItemCheck(Main.myPlayer); //Dust.QuickDust(target.Item2, Color.Aqua); int v = player.itemAnimation; if (!original.isTheSameAs(Main.tile[Player.tileTargetX, Player.tileTargetY])) { placeSuccess = true; break; } } if (placeSuccess) { break; } //if (this.position.X / 16f - (float)Player.tileRangeX - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetX // && (this.position.X + (float)this.width) / 16f + (float)Player.tileRangeX + (float)this.inventory[this.selectedItem].tileBoost - 1f + (float)this.blockRange >= (float)Player.tileTargetX // && this.position.Y / 16f - (float)Player.tileRangeY - (float)this.inventory[this.selectedItem].tileBoost - (float)this.blockRange <= (float)Player.tileTargetY // && (this.position.Y + (float)this.height) / 16f + (float)Player.tileRangeY + (float)this.inventory[this.selectedItem].tileBoost - 2f + (float)this.blockRange >= (float)Player.tileTargetY) } } }
private void SetupSortsAndCategories() { //Texture2D terrariaSort = ResizeImage(Main.inventorySortTexture[1], 24, 24); Texture2D rarity = ResizeImage(Main.itemTexture[ItemID.MetalDetector], 24, 24); // TODO: Implement Badge text as used in Item Checklist. sorts = new List <Sort>() { new Sort("ItemID", "Images/sortItemID", (x, y) => x.type.CompareTo(y.type)), new Sort("Value", "Images/sortValue", (x, y) => x.value.CompareTo(y.value)), new Sort("Alphabetical", "Images/sortAZ", (x, y) => x.Name.CompareTo(y.Name)), new Sort("Rarity", rarity, (x, y) => x.rare == y.rare ? x.value.CompareTo(y.value) : Math.Abs(x.rare).CompareTo(Math.Abs(y.rare))), //new Sort("Terraria Sort", terrariaSort, (x,y)=> -ItemChecklistUI.vanillaIDsInSortOrder[x.type].CompareTo(ItemChecklistUI.vanillaIDsInSortOrder[y.type]), x=>ItemChecklistUI.vanillaIDsInSortOrder[x.type].ToString()), }; Texture2D materialsIcon = Utilities.StackResizeImage(new Texture2D[] { Main.itemTexture[ItemID.SpellTome] }, 24, 24); Texture2D craftableIcon = ResizeImage(Main.itemTexture[ItemID.IronAnvil], 24, 24); Texture2D extendedCraftIcon = ResizeImage(Main.itemTexture[ItemID.MythrilAnvil], 24, 24); filters = new List <Filter>() { new Filter("Materials", x => x.material, materialsIcon), (CraftableFilter = new Filter("Craftable", x => true, craftableIcon)), (ObtainableFilter = new Filter("Extended Craftable (RMB on Recipe to view, Auto-disables to prevent lag)", x => true, extendedCraftIcon)), }; // TODOS: Vanity armor, grapple, cart, potions buffs // 24x24 pixels var yoyos = new List <int>(); for (int i = 0; i < ItemID.Sets.Yoyo.Length; ++i) { if (ItemID.Sets.Yoyo[i]) { yoyos.Add(i); } } var useAmmoTypes = new Dictionary <int, int>(); var ammoTypes = new Dictionary <int, int>(); var testItem = new Item(); for (int i = 0; i < ItemLoader.ItemCount; i++) { testItem.SetDefaults(i); if (testItem.useAmmo >= ItemLoader.ItemCount || testItem.ammo >= ItemLoader.ItemCount || testItem.useAmmo < 1 || testItem.ammo < 1) { continue; // Some mods misuse useAmmo } if (testItem.useAmmo > 0) { useAmmoTypes.TryGetValue(testItem.useAmmo, out var currentCount); useAmmoTypes[testItem.useAmmo] = currentCount + 1; } if (testItem.ammo > 0) { ammoTypes.TryGetValue(testItem.ammo, out var currentCount); ammoTypes[testItem.ammo] = currentCount + 1; } } var sortedUseAmmoTypes = from pair in useAmmoTypes orderby pair.Value descending select pair.Key; var sortedAmmoTypes = from pair in ammoTypes orderby pair.Value descending select pair.Key; var ammoFilters = sortedAmmoTypes.Select(ammoType => new Filter(Lang.GetItemNameValue(ammoType), x => x.ammo == ammoType, ResizeImage(Main.itemTexture[ammoType], 24, 24))).ToList(); var useAmmoFilters = sortedUseAmmoTypes.Select(ammoType => new Filter(Lang.GetItemNameValue(ammoType), x => x.useAmmo == ammoType, ResizeImage(Main.itemTexture[ammoType], 24, 24))).ToList(); var ammoFilter = new CycleFilter("Cycle Ammo Types", RecipeBrowser.instance.GetTexture("Images/sortAmmo"), ammoFilters); var useAmmoFilter = new CycleFilter("Cycle Used Ammo Types", RecipeBrowser.instance.GetTexture("Images/sortAmmo"), useAmmoFilters); Texture2D smallMelee = ResizeImage(Main.itemTexture[ItemID.GoldBroadsword], 24, 24); Texture2D smallYoyo = ResizeImage(Main.itemTexture[Main.rand.Next(yoyos)], 24, 24); //Main.rand.Next(ItemID.Sets.Yoyo) ItemID.Yelets Texture2D smallMagic = ResizeImage(Main.itemTexture[ItemID.GoldenShower], 24, 24); Texture2D smallRanged = ResizeImage(Main.itemTexture[ItemID.FlintlockPistol], 24, 24); Texture2D smallThrown = ResizeImage(Main.itemTexture[ItemID.Shuriken], 24, 24); Texture2D smallSummon = ResizeImage(Main.itemTexture[ItemID.SlimeStaff], 24, 24); Texture2D smallSentry = ResizeImage(Main.itemTexture[ItemID.DD2LightningAuraT1Popper], 24, 24); Texture2D smallHead = ResizeImage(Main.itemTexture[ItemID.SilverHelmet], 24, 24); Texture2D smallBody = ResizeImage(Main.itemTexture[ItemID.SilverChainmail], 24, 24); Texture2D smallLegs = ResizeImage(Main.itemTexture[ItemID.SilverGreaves], 24, 24); Texture2D smallVanity = ResizeImage(Main.itemTexture[ItemID.BunnyHood], 24, 24); //Texture2D smallVanity2 = ResizeImage(Main.itemTexture[ItemID.HerosHat], 24, 24); Texture2D smallNonVanity = ResizeImage(Main.itemTexture[ItemID.GoldHelmet], 24, 24); Texture2D smallTiles = ResizeImage(Main.itemTexture[ItemID.Sign], 24, 24); Texture2D smallCraftingStation = ResizeImage(Main.itemTexture[ItemID.IronAnvil], 24, 24); Texture2D smallWalls = ResizeImage(Main.itemTexture[ItemID.PearlstoneBrickWall], 24, 24); Texture2D smallExpert = ResizeImage(Main.itemTexture[ItemID.EoCShield], 24, 24); Texture2D smallPets = ResizeImage(Main.itemTexture[ItemID.ZephyrFish], 24, 24); Texture2D smallLightPets = ResizeImage(Main.itemTexture[ItemID.FairyBell], 24, 24); Texture2D smallBossSummon = ResizeImage(Main.itemTexture[ItemID.MechanicalSkull], 24, 24); Texture2D smallMounts = ResizeImage(Main.itemTexture[ItemID.SlimySaddle], 24, 24); Texture2D smallHooks = ResizeImage(Main.itemTexture[ItemID.AmethystHook], 24, 24); Texture2D smallDyes = ResizeImage(Main.itemTexture[ItemID.OrangeDye], 24, 24); Texture2D smallHairDye = ResizeImage(Main.itemTexture[ItemID.BiomeHairDye], 24, 24); Texture2D smallQuestFish = ResizeImage(Main.itemTexture[ItemID.FallenStarfish], 24, 24); Texture2D smallAccessories = ResizeImage(Main.itemTexture[ItemID.HermesBoots], 24, 24); Texture2D smallWings = ResizeImage(Main.itemTexture[ItemID.LeafWings], 24, 24); Texture2D smallCarts = ResizeImage(Main.itemTexture[ItemID.Minecart], 24, 24); Texture2D smallHealth = ResizeImage(Main.itemTexture[ItemID.HealingPotion], 24, 24); Texture2D smallMana = ResizeImage(Main.itemTexture[ItemID.ManaPotion], 24, 24); Texture2D smallBuff = ResizeImage(Main.itemTexture[ItemID.RagePotion], 24, 24); Texture2D smallAll = ResizeImage(Main.itemTexture[ItemID.AlphabetStatueA], 24, 24); Texture2D smallContainer = ResizeImage(Main.itemTexture[ItemID.GoldChest], 24, 24); Texture2D smallPaintings = ResizeImage(Main.itemTexture[ItemID.PaintingMartiaLisa], 24, 24); Texture2D smallStatue = ResizeImage(Main.itemTexture[ItemID.HeartStatue], 24, 24); Texture2D smallWiring = ResizeImage(Main.itemTexture[ItemID.Wire], 24, 24); Texture2D smallConsumables = ResizeImage(Main.itemTexture[ItemID.PurificationPowder], 24, 24); Texture2D smallExtractinator = ResizeImage(Main.itemTexture[ItemID.Extractinator], 24, 24); Texture2D smallOther = ResizeImage(Main.itemTexture[ItemID.UnicornonaStick], 24, 24); Texture2D smallArmor = StackResizeImage(new Texture2D[] { Main.itemTexture[ItemID.SilverHelmet], Main.itemTexture[ItemID.SilverChainmail], Main.itemTexture[ItemID.SilverGreaves] }, 24, 24); //Texture2D smallVanityFilterGroup = StackResizeImage2424(Main.itemTexture[ItemID.BunnyHood], Main.itemTexture[ItemID.GoldHelmet]); Texture2D smallPetsLightPets = StackResizeImage(new Texture2D[] { Main.itemTexture[ItemID.ZephyrFish], Main.itemTexture[ItemID.FairyBell] }, 24, 24); Texture2D smallPlaceables = StackResizeImage(new Texture2D[] { Main.itemTexture[ItemID.Sign], Main.itemTexture[ItemID.PearlstoneBrickWall] }, 24, 24); Texture2D smallWeapons = StackResizeImage(new Texture2D[] { smallMelee, smallMagic, smallThrown }, 24, 24); Texture2D smallTools = StackResizeImage(new Texture2D[] { RecipeBrowser.instance.GetTexture("Images/sortPick"), RecipeBrowser.instance.GetTexture("Images/sortAxe"), RecipeBrowser.instance.GetTexture("Images/sortHammer") }, 24, 24); Texture2D smallFishing = StackResizeImage(new Texture2D[] { RecipeBrowser.instance.GetTexture("Images/sortFish"), RecipeBrowser.instance.GetTexture("Images/sortBait"), Main.itemTexture[ItemID.FallenStarfish] }, 24, 24); Texture2D smallPotions = StackResizeImage(new Texture2D[] { Main.itemTexture[ItemID.HealingPotion], Main.itemTexture[ItemID.ManaPotion], Main.itemTexture[ItemID.RagePotion] }, 24, 24); Texture2D smallBothDyes = StackResizeImage(new Texture2D[] { Main.itemTexture[ItemID.OrangeDye], Main.itemTexture[ItemID.BiomeHairDye] }, 24, 24); Texture2D smallSortTiles = StackResizeImage(new Texture2D[] { Main.itemTexture[ItemID.Candelabra], Main.itemTexture[ItemID.GrandfatherClock] }, 24, 24); Texture2D StackResizeImage2424(params Texture2D[] textures) => StackResizeImage(textures, 24, 24); Texture2D ResizeImage2424(Texture2D texture) => ResizeImage(texture, 24, 24); // Potions, other? // should inherit children? // should have other category? if (WorldGen.statueList == null) { WorldGen.SetupStatueList(); } var vanity = new MutuallyExclusiveFilter("Vanity", x => x.vanity, smallVanity); var armor = new MutuallyExclusiveFilter("Armor", x => !x.vanity, smallNonVanity); vanity.SetExclusions(new List <Filter>() { vanity, armor }); armor.SetExclusions(new List <Filter>() { vanity, armor }); categories = new List <Category>() { new Category("All", x => true, smallAll), // TODO: Filter out tools from weapons. Separate belongs and doesn't belong predicates? How does inheriting work again? Other? new Category("Weapons" /*, x=>x.damage>0*/, x => false, smallWeapons) //"Images/sortDamage" { subCategories = new List <Category>() { new Category("Melee", x => x.melee, smallMelee), new Category("Yoyo", x => ItemID.Sets.Yoyo[x.type], smallYoyo), new Category("Magic", x => x.magic, smallMagic), new Category("Ranged", x => x.ranged && x.ammo == 0, smallRanged) // TODO and ammo no { sorts = new List <Sort>() { new Sort("Use Ammo Type", "Images/sortAmmo", (x, y) => x.useAmmo.CompareTo(y.useAmmo)), }, filters = new List <Filter> { useAmmoFilter } }, new Category("Throwing", x => x.thrown, smallThrown), new Category("Summon", x => x.summon && !x.sentry, smallSummon), new Category("Sentry", x => x.summon && x.sentry, smallSentry), }, sorts = new List <Sort>() { new Sort("Damage", "Images/sortDamage", (x, y) => x.damage.CompareTo(y.damage)), }, }, new Category("Tools" /*,x=>x.pick>0||x.axe>0||x.hammer>0*/, x => false, smallTools) { subCategories = new List <Category>() { new Category("Pickaxes", x => x.pick > 0, "Images/sortPick") { sorts = new List <Sort>() { new Sort("Pick Power", "Images/sortPick", (x, y) => x.pick.CompareTo(y.pick)), } }, new Category("Axes", x => x.axe > 0, "Images/sortAxe") { sorts = new List <Sort>() { new Sort("Axe Power", "Images/sortAxe", (x, y) => x.axe.CompareTo(y.axe)), } }, new Category("Hammers", x => x.hammer > 0, "Images/sortHammer") { sorts = new List <Sort>() { new Sort("Hammer Power", "Images/sortHammer", (x, y) => x.hammer.CompareTo(y.hammer)), } }, }, }, new Category("Armor" /*, x=>x.headSlot!=-1||x.bodySlot!=-1||x.legSlot!=-1*/, x => false, smallArmor) { subCategories = new List <Category>() { new Category("Head", x => x.headSlot != -1, smallHead), new Category("Body", x => x.bodySlot != -1, smallBody), new Category("Legs", x => x.legSlot != -1, smallLegs), }, sorts = new List <Sort>() { new Sort("Defense", "Images/sortDefense", (x, y) => x.defense.CompareTo(y.defense)), }, filters = new List <Filter> { //new Filter("Vanity", x=>x.vanity, RecipeBrowser.instance.GetTexture("Images/sortDefense")), // Prefer MutuallyExclusiveFilter for this, rather than CycleFilter since there are only 2 options. //new CycleFilter("Vanity/Armor", smallVanityFilterGroup, new List<Filter> { // new Filter("Vanity", x=>x.vanity, smallVanity), // new Filter("Armor", x=>!x.vanity, smallNonVanity), //}), vanity, armor, //new DoubleFilter("Vanity", "Armor", smallVanity2, x=>x.vanity), } }, new Category("Tiles", x => x.createTile != -1, smallTiles) { subCategories = new List <Category>() { new Category("Crafting Stations", x => RecipeCatalogueUI.instance.craftingTiles.Contains(x.createTile), smallCraftingStation), new Category("Containers", x => x.createTile != -1 && Main.tileContainer[x.createTile], smallContainer), new Category("Wiring", x => ItemID.Sets.SortingPriorityWiring[x.type] > -1, smallWiring), new Category("Statues", x => WorldGen.statueList.Any(point => point.X == x.createTile && point.Y == x.placeStyle), smallStatue), new Category("Doors", x => x.createTile > 0 && TileID.Sets.RoomNeeds.CountsAsDoor.Contains(x.createTile), ResizeImage2424(Main.itemTexture[ItemID.WoodenDoor])), new Category("Chairs", x => x.createTile > 0 && TileID.Sets.RoomNeeds.CountsAsChair.Contains(x.createTile), ResizeImage2424(Main.itemTexture[ItemID.WoodenChair])), new Category("Tables", x => x.createTile > 0 && TileID.Sets.RoomNeeds.CountsAsTable.Contains(x.createTile), ResizeImage2424(Main.itemTexture[ItemID.PalmWoodTable])), new Category("Light Sources", x => x.createTile > 0 && TileID.Sets.RoomNeeds.CountsAsTorch.Contains(x.createTile), ResizeImage2424(Main.itemTexture[ItemID.ChineseLantern])), new Category("Torches", x => x.createTile > 0 && TileLoader.IsTorch(x.createTile), ResizeImage2424(Main.itemTexture[ItemID.RainbowTorch])), // Banners => Banner Bonanza mod integration //Main.itemTexture[Main.rand.Next(TileID.Sets.RoomNeeds.CountsAsTable)] doesn't work since those are tilesids. yoyo approach? // todo: music box //new Category("Paintings", x=>ItemID.Sets.SortingPriorityPainting[x.type] > -1, smallPaintings), // oops, this is painting tools not painting tiles //new Category("5x4", x=>{ // if(x.createTile!=-1) // { // var tod = Terraria.ObjectData.TileObjectData.GetTileData(x.createTile, x.placeStyle); // return tod != null && tod.Width == 5 && tod.Height == 4; // } // return false; //} , smallContainer), }, sorts = new List <Sort>() { new Sort("Place Tile", smallSortTiles, (x, y) => x.createTile == y.createTile ? x.placeStyle.CompareTo(y.placeStyle) : x.createTile.CompareTo(y.createTile)), } }, new Category("Walls", x => x.createWall != -1, smallWalls), new Category("Accessories", x => x.accessory, smallAccessories) { subCategories = new List <Category>() { new Category("Wings", x => x.wingSlot > 0, smallWings) } }, new Category("Ammo", x => x.ammo != 0, RecipeBrowser.instance.GetTexture("Images/sortAmmo")) { sorts = new List <Sort>() { new Sort("Ammo Type", "Images/sortAmmo", (x, y) => x.ammo.CompareTo(y.ammo)), new Sort("Damage", "Images/sortDamage", (x, y) => x.damage.CompareTo(y.damage)), }, filters = new List <Filter> { ammoFilter } // TODO: Filters/Subcategories for all ammo types? // each click cycles? }, new Category("Potions", x => (x.UseSound != null && x.UseSound.Style == 3), smallPotions) { subCategories = new List <Category>() { new Category("Health Potions", x => x.healLife > 0, smallHealth) { sorts = new List <Sort>() { new Sort("Heal Life", smallHealth, (x, y) => x.healLife.CompareTo(y.healLife)), } }, new Category("Mana Potions", x => x.healMana > 0, smallMana) { sorts = new List <Sort>() { new Sort("Heal Mana", smallMana, (x, y) => x.healMana.CompareTo(y.healMana)), } }, new Category("Buff Potions", x => (x.UseSound != null && x.UseSound.Style == 3) && x.buffType > 0, smallBuff), // Todo: Automatic other category? } }, new Category("Expert", x => x.expert, smallExpert), new Category("Pets" /*, x=> x.buffType > 0 && (Main.vanityPet[x.buffType] || Main.lightPet[x.buffType])*/, x => false, smallPetsLightPets) { subCategories = new List <Category>() { new Category("Pets", x => Main.vanityPet[x.buffType], smallPets), new Category("Light Pets", x => Main.lightPet[x.buffType], smallLightPets), } }, new Category("Mounts", x => x.mountType != -1, smallMounts) { subCategories = new List <Category>() { new Category("Carts", x => x.mountType != -1 && MountID.Sets.Cart[x.mountType], smallCarts) // TODO: need mountType check? inherited parent logic or parent unions children? } }, new Category("Hooks", x => Main.projHook[x.shoot], smallHooks) { sorts = new List <Sort>() { new Sort("Grapple Range", smallHooks, (x, y) => GrappleRange(x.shoot).CompareTo(GrappleRange(y.shoot))), }, }, new Category("Dyes", x => false, smallBothDyes) { subCategories = new List <Category>() { new Category("Dyes", x => x.dye != 0, smallDyes), new Category("Hair Dyes", x => x.hairDye != -1, smallHairDye), } }, new Category("Boss Summons", x => ItemID.Sets.SortingPriorityBossSpawns[x.type] != -1 && x.type != ItemID.LifeCrystal && x.type != ItemID.ManaCrystal && x.type != ItemID.CellPhone && x.type != ItemID.IceMirror && x.type != ItemID.MagicMirror && x.type != ItemID.LifeFruit && x.netID != ItemID.TreasureMap || x.netID == ItemID.PirateMap, smallBossSummon) // vanilla bug. { sorts = new List <Sort>() { new Sort("Progression Order", "Images/sortDamage", (x, y) => ItemID.Sets.SortingPriorityBossSpawns[x.type].CompareTo(ItemID.Sets.SortingPriorityBossSpawns[y.type])), } }, new Category("Consumables", x => !(x.createWall > 0 || x.createTile > -1) && !(x.ammo > 0 && !x.notAmmo) && x.consumable, smallConsumables) { subCategories = new List <Category>() { new Category("Captured NPC", x => x.makeNPC != 0, ResizeImage2424(Main.itemTexture[ItemID.GoldBunny])), } }, new Category("Fishing" /*, x=> x.fishingPole > 0 || x.bait>0|| x.questItem*/, x => false, smallFishing) { subCategories = new List <Category>() { new Category("Poles", x => x.fishingPole > 0, "Images/sortFish") { sorts = new List <Sort>() { new Sort("Pole Power", "Images/sortFish", (x, y) => x.fishingPole.CompareTo(y.fishingPole)), } }, new Category("Bait", x => x.bait > 0, "Images/sortBait") { sorts = new List <Sort>() { new Sort("Bait Power", "Images/sortBait", (x, y) => x.bait.CompareTo(y.bait)), } }, new Category("Quest Fish", x => x.questItem, smallQuestFish), } }, new Category("Extractinator", x => ItemID.Sets.ExtractinatorMode[x.type] > -1, smallExtractinator), //modCategory, new Category("Other", x => BelongsInOther(x), smallOther), }; foreach (var modCategory in RecipeBrowser.instance.modCategories) { if (string.IsNullOrEmpty(modCategory.parent)) { categories.Insert(categories.Count - 2, new Category(modCategory.name, modCategory.belongs, modCategory.icon)); } else { foreach (var item in categories) { if (item.name == modCategory.parent) { item.subCategories.Add(new Category(modCategory.name, modCategory.belongs, modCategory.icon)); } } } } foreach (var modCategory in RecipeBrowser.instance.modFilters) { filters.Add(new Filter(modCategory.name, modCategory.belongs, modCategory.icon)); } foreach (var parent in categories) { foreach (var child in parent.subCategories) { child.parent = parent; // 3 levels? } } SelectedSort = sorts[0]; SelectedCategory = categories[0]; }
private static bool IsLight(int i, int j) { if (i == 0 && j == 0) { return(false); } Tile candidate = Main.tile[i, j]; bool light = candidate.type == TileID.Torches || candidate.type == TileID.Campfire || TileLoader.IsTorch(candidate.type); light &= !(candidate.type == TileType <ArkenTorchTile>() && candidate.frameX >= 66); return(candidate.active() && light); }
public static void Snuff(int i, int j, bool ignoreArken = false) { try { Tile tile = Main.tile[i, j]; int type = tile.type; Mod mod = GetInstance <Erilipah>(); bool light = tile.type == TileID.Torches || tile.type == TileID.Campfire || TileLoader.IsTorch(type); if (!ignoreArken) { light &= type != TileType <ArkenTorchTile>(); } else { light &= type != TileType <ArkenTorchTile>() || Main.rand.NextBool(); } if (light) { if (!ignoreArken && type == TileType <CrystallineTorchTile>() && Main.rand.Chance(0.50f)) { return; } if (Main.LocalPlayer.InErilipah()) { ErilipahItem.SnuffFx(new Vector2(i * 16 + 8, j * 16 + 8)); Main.PlaySound(SoundID.LiquidsWaterLava.WithPitchVariance(-0.35f), new Vector2(i * 16 + 8, j * 16 + 8)); WorldGen.KillTile(i, j, false, noItem: type != TileType <ArkenTorchTile>()); WorldGen.TileFrame(i, j); } } } catch { Main.NewText("PEE"); } }