public override void ReadExtraData(BinaryReader reader) { item = new Item(); item.netDefaults((int)reader.ReadInt16()); item.Prefix((int)reader.ReadByte()); item.stack = (int)reader.ReadInt16(); }
public PUIItemSlot() { ShowTooltip = true; Width.Set(_texture.Width * SCALE, 0); Height.Set(_texture.Height * SCALE, 0); Item = new Item(); }
public static void Handle(ref Item inv, int context = 0) { ItemSlot.singleSlotArray[0] = inv; ItemSlot.Handle(ItemSlot.singleSlotArray, context, 0); inv = ItemSlot.singleSlotArray[0]; Recipe.FindRecipes(); }
public static void Swap(bool cycle) { Player p = Main.player[Main.myPlayer]; if (Main.gameMenu) return; Item[] temp = new Item[10]; if (cycle) { for (int i = 0; i < 10; i++) { temp[i] = p.inventory[i]; p.inventory[i] = p.inventory[i + 10]; p.inventory[i + 10] = p.inventory[i + 20]; p.inventory[i + 20] = p.inventory[i + 30]; p.inventory[i + 30] = p.inventory[i + 40]; p.inventory[i + 40] = temp[i]; } } else { for (int i = 0; i < 10; i++) { temp[i] = p.inventory[i]; p.inventory[i] = p.inventory[i + 40]; p.inventory[i + 40] = temp[i]; } } }
public override void SetDefaults(Item item) { if (item.type == ItemID.CopperShortsword) { item.damage = 50; } }
public static Item CreateItem(string itemName, int stack = 0) { Item item = new Item(); item.RealSetDefaults(itemName); if (stack > 0) item.stack = stack; return item; }
//new[] // { // new ItemId(1, "Gold Pickaxe"), // new ItemId(4, "Gold Broadsword"), // new ItemId(6, "Gold Shortsword"), // new ItemId(10, "Gold Axe"), // new ItemId(7, "Gold Hammer"), // new ItemId(99, "Gold Bow"), // new ItemId(1, "Silver Pickaxe"), // new ItemId(4, "Silver Broadsword"), // new ItemId(6, "Silver Shortsword"), // new ItemId(10, "Silver Axe"), // new ItemId(7, "Silver Hammer"), // new ItemId(99, "Silver Bow"), // new ItemId(1, "Copper Pickaxe"), // new ItemId(4, "Copper Broadsword"), // new ItemId(6, "Copper Shortsword"), // new ItemId(10, "Copper Axe"), // new ItemId(7, "Copper Hammer"), // new ItemId(198, "Blue Phasesaber"), // new ItemId(199, "Red Phasesaber"), // new ItemId(200, "Green Phasesaber"), // new ItemId(201, "Purple Phasesaber"), // new ItemId(202, "White Phasesaber"), // new ItemId(203, "Yellow Phasesaber"), // }; public Terraria.Item GetItem(int id) { var curitem = new Terraria.Item(); curitem.SetDefaults(id); return curitem; }
static UIController() { _userInterface = new UserInterface(); _state = new UIState(); _userInterface.SetState(_state); TooltipText = string.Empty; TooltipItem = new Item(); }
private void AddItem(Item item) { if (!string.IsNullOrEmpty(item.name)) { ItemType itemType = new ItemType(item.type, item.name, item.color); Items.Add(itemType); LoadIcon(itemType); } }
TextSnippet ITagHandler.Parse(string text, Color baseColor, string options) { Item obj = new Item(); int result1; if (int.TryParse(text, out result1)) obj.netDefaults(result1); else obj.SetDefaults(text); if (obj.itemId <= 0) return new TextSnippet(text); obj.stack = 1; if (options != null) { string[] strArray = options.Split(','); for (int index = 0; index < strArray.Length; ++index) { if (strArray[index].Length != 0) { switch (strArray[index][0]) { case 'p': int result2; if (int.TryParse(strArray[index].Substring(1), out result2)) { obj.Prefix(Utils.Clamp<int>(result2, 0, 84)); continue; } continue; case 's': case 'x': int result3; if (int.TryParse(strArray[index].Substring(1), out result3)) { obj.stack = Utils.Clamp<int>(result3, 1, obj.maxStack); continue; } continue; default: continue; } } } } string str = ""; if (obj.stack > 1) str = " (" + obj.stack + ")"; ItemSnippet itemSnippet = new ItemSnippet(obj); itemSnippet.Text = "[" + obj.AffixName() + str + "]"; itemSnippet.CheckForHover = true; itemSnippet.DeleteWhole = true; return itemSnippet; }
public static string GenerateTag(Item I) { string str = "[i"; if (I.prefix != 0) str = str + "/p" + I.prefix; if (I.stack != 1) str = str + "/s" + I.stack; return str + ":" + I.netID + "]"; }
public static void Handle(Item[] inv, int context = 0, int slot = 0) { ItemSlot.OverrideHover(inv, context, slot); if (Main.mouseLeftRelease && Main.mouseLeft) { ItemSlot.LeftClick(inv, context, slot); Recipe.FindRecipes(); } else ItemSlot.RightClick(inv, context, slot); ItemSlot.MouseHover(inv, context, slot); }
public Terraria.Item GetItem(int id) { try { var curitem = new Terraria.Item(); curitem.SetDefaults(id); return(curitem); } catch { return(null); } }
public static void OnSetDefaultsString(ref string itemname, Item item) { if (SetDefaultsString == null) return; var args = new SetDefaultsEventArgs<Item, string>() { Object = item, Info = itemname, }; SetDefaultsString(args); itemname = args.Info; }
public static void OnSetDefaultsInt(ref int itemtype, Item item) { if (SetDefaultsInt == null) return; var args = new SetDefaultsEventArgs<Item, int>() { Object = item, Info = itemtype, }; SetDefaultsInt(args); itemtype = args.Info; }
public void Initialize(Terraria.Item item) { if (item.damage > 0) { iexp = 0; ilevel = 0; oritemname = Name; oridamage = item.damage; oricrit = item.crit; } downedSorcerer = false; downedAttraidies = false; }
public string GetTiles() { List <Terraria.Item> curItems = new List <Item>(); for (int i = 0; i < maxItemTypes; i++) { var curitem = new Terraria.Item(); curitem.SetDefaults(i); curItems.Add(curitem); } string output = "<Tiles>\r\n"; for (int i = 0; i < maxTileSets; i++) { var creatingItem = curItems.FirstOrDefault(x => x.createTile == i); output += string.Format("<Tile Id=\"{0}\" Name=\"{22}\" {5}{16}{17}{8} {21}\r\n", i, tileAlch[i], tileAxe[i], tileBlockLight[i], tileDungeon[i], tileFrameImportant[i] ? " Framed=\"true\"" : string.Empty, tileHammer[i], tileLavaDeath[i], tileLighted[i] ? " Light=\"true\"" : string.Empty, tileMergeDirt[i], //tileName[i], tileNoAttach[i], tileNoFail[i], tileNoSunLight[i], tilePick[i], tileShine[i], tileShine2[i], tileSolid[i] ? " Solid=\"true\"" : string.Empty, tileSolidTop[i] ? " SolidTop=\"true\"" : string.Empty, tileStone[i], tileTable[i], tileWaterDeath[i], (tileFrameImportant[i]) ? ">\r\n <Frames>\r\n </Frames>\r\n</Tile>" : " />", creatingItem != null ? creatingItem.name : string.Empty); } return(output + "</Tiles>"); }
public List <ItemId> GetItems() { //maxTileSets var sitems = new List <ItemId>(); for (int i = -255; i < maxItemTypes; i++) { try { var curitem = new Terraria.Item(); curitem.netDefaults(i); if (string.IsNullOrWhiteSpace(curitem.Name)) { continue; } var isFood = Terraria.ID.ItemID.Sets.IsFood[i]; var isRackable = Terraria.ID.ItemID.Sets.CanBePlacedOnWeaponRacks[i] || curitem.fishingPole > 0 || (curitem.damage > 0 && curitem.useStyle != 0); var isDeprecated = Terraria.ID.ItemID.Sets.Deprecated[i]; string name = curitem.Name; if (isDeprecated) { name += " (Deprecated)"; } //curitem.SetDefaults(i); sitems.Add(new ItemId(i, name, GetItemType(curitem)) { IsFood = isFood, Head = curitem.headSlot, Body = curitem.bodySlot, Legs = curitem.legSlot, Accessory = curitem.accessory, Rack = isRackable }); } catch { } } //sitems.AddRange(HardCodedItems); return(sitems); }
public static bool RemoveItem(Item item) { if (item != null && item.active) { item.active = false; for (int i = 0; i < me.inventory.Length; i++) { if (me.inventory[i] == item) { me.inventory[i] = new Item(); Main.PlaySound(7, (int)me.position.X, (int)me.position.Y, 1); return true; } } } return false; }
public override bool UseItem(Item item, Player player) { if (item.healLife > 0) { if (player.GetModPlayer<ExamplePlayer>(mod).badHeal) { int heal = item.healLife; int damage = player.statLifeMax2 - player.statLife; if (heal > damage) { heal = damage; } if (heal > 0) { player.AddBuff(mod.BuffType("Undead2"), 2 * heal, false); } } } return base.UseItem(item, player); }
public override void SetDefaults(Terraria.Item item) { if (item.type == ItemID.EmptyBucket) { item.ammo = ItemID.EmptyBucket; item.maxStack = 99; item.consumable = true; } if (item.type == ItemID.BottledHoney) { item.ammo = ItemID.BottledHoney; item.maxStack = 30; item.consumable = true; } if (item.type == ItemID.BeachBall) { item.ammo = ItemID.BeachBall; item.maxStack = 99; item.consumable = true; } }
//public Terraria.Item GetN public List <string> Prefixes() { var result = new List <string> { string.Empty }; var curitem = new Terraria.Item(); curitem.name = ""; for (int prefix = 1; prefix < byte.MaxValue; prefix++) { curitem.prefix = (byte)prefix; string affixName = curitem.AffixName(); if (string.IsNullOrWhiteSpace(affixName)) { break; } result.Add(affixName); } return(result); }
public string GetWalls() { List <Terraria.Item> curItems = new List <Item>(); for (int i = -255; i < maxItemTypes; i++) { var curitem = new Terraria.Item(); curitem.SetDefaults(i); curItems.Add(curitem); } string output = "<Walls>\r\n"; for (int i = 0; i < maxWallTypes; i++) { var creatingWall = curItems.FirstOrDefault(x => x.createWall == i); output += string.Format("<Wall Id=\"{0}\" Name=\"{2}\" Color=\"#FFFF00FF\" IsHouse=\"{1}\"/>\r\n", i, wallHouse[i], creatingWall != null ? creatingWall.name : string.Empty); } return(output + "</Walls>"); }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("PrismCrystalBody") && legs.type == mod.ItemType("PrismCrystalLegs")); }
public static Item[] IIArrayToItemArray(InventoryItem[] iis) { Item[] items = new Item[iis.Length]; for (int i = 0; i < iis.Length; i++) { items[i] = new Item(); items[i].SetDefaults(iis[i].Name); if (items[i].type == 0 || iis[i].Name == "") { if (iis[i].ID != 0) { iis[i].ID = iis[i].ID; } items[i].SetDefaults(iis[i].ID); if (items[i].type == 0 || items[i].name == "") { items[i].SetDefaults(0); items[i].name = ""; items[i].stack = 0; } } } return items; }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("BloodReaperBody") && legs.type == mod.ItemType("BloodReaperLegs")); }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("EmberFlareBody") && legs.type == mod.ItemType("EmberFlareLegs")); }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("StarlightCasterBody") && legs.type == mod.ItemType("StarlightCasterLegs")); }
public override bool IsArmorSet(Item head, Item body, Item legs) { return body.type == mod.ItemType("DuskPlate") && legs.type == mod.ItemType("DuskLeggings"); }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("ArcherofLumeliaShirt") && legs.type == mod.ItemType("ArcherofLumeliaPants")); }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("AncientBody") && legs.type == mod.ItemType("AncientLegs")); }
public static void MoveCoins(Item[] pInv, Item[] cInv) { int[] numArray1 = new int[4]; List<int> list1 = new List<int>(); List<int> list2 = new List<int>(); bool flag = false; int[] numArray2 = new int[40]; for (int index = 0; index < cInv.Length; ++index) { numArray2[index] = -1; if (cInv[index].stack < 1 || cInv[index].itemId < 1) { list2.Add(index); cInv[index] = new Item(); } if (cInv[index] != null && cInv[index].stack > 0) { int num = 0; if (cInv[index].itemId == 71) num = 1; if (cInv[index].itemId == 72) num = 2; if (cInv[index].itemId == 73) num = 3; if (cInv[index].itemId == 74) num = 4; numArray2[index] = num - 1; if (num > 0) { numArray1[num - 1] += cInv[index].stack; list2.Add(index); cInv[index] = new Item(); flag = true; } } } if (!flag) return; Main.PlaySound(7, -1, -1, 1); for (int index = 0; index < pInv.Length; ++index) { if (index != 58 && pInv[index] != null && pInv[index].stack > 0) { int num = 0; if (pInv[index].itemId == 71) num = 1; if (pInv[index].itemId == 72) num = 2; if (pInv[index].itemId == 73) num = 3; if (pInv[index].itemId == 74) num = 4; if (num > 0) { numArray1[num - 1] += pInv[index].stack; list1.Add(index); pInv[index] = new Item(); } } } for (int index = 0; index < 3; ++index) { while (numArray1[index] >= 100) { numArray1[index] -= 100; ++numArray1[index + 1]; } } for (int index1 = 0; index1 < 40; ++index1) { if (numArray2[index1] >= 0 && cInv[index1].itemId == 0) { int index2 = index1; int index3 = numArray2[index1]; if (numArray1[index3] > 0) { cInv[index2].SetDefaults(71 + index3, false); cInv[index2].stack = numArray1[index3]; if (cInv[index2].stack > cInv[index2].maxStack) cInv[index2].stack = cInv[index2].maxStack; numArray1[index3] -= cInv[index2].stack; numArray2[index1] = -1; } if (Main.netMode == 1 && Main.player[Main.myPlayer].chest > -1) NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)index2, 0.0f, 0.0f, 0, 0, 0); list2.Remove(index2); } } for (int index1 = 0; index1 < 40; ++index1) { if (numArray2[index1] >= 0 && cInv[index1].itemId == 0) { int index2 = index1; int index3 = 3; while (index3 >= 0) { if (numArray1[index3] > 0) { cInv[index2].SetDefaults(71 + index3, false); cInv[index2].stack = numArray1[index3]; if (cInv[index2].stack > cInv[index2].maxStack) cInv[index2].stack = cInv[index2].maxStack; numArray1[index3] -= cInv[index2].stack; numArray2[index1] = -1; break; } if (numArray1[index3] == 0) --index3; } if (Main.netMode == 1 && Main.player[Main.myPlayer].chest > -1) NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)index2, 0.0f, 0.0f, 0, 0, 0); list2.Remove(index2); } } while (list2.Count > 0) { int index1 = list2[0]; int index2 = 3; while (index2 >= 0) { if (numArray1[index2] > 0) { cInv[index1].SetDefaults(71 + index2, false); cInv[index1].stack = numArray1[index2]; if (cInv[index1].stack > cInv[index1].maxStack) cInv[index1].stack = cInv[index1].maxStack; numArray1[index2] -= cInv[index1].stack; break; } if (numArray1[index2] == 0) --index2; } if (Main.netMode == 1 && Main.player[Main.myPlayer].chest > -1) NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)list2[0], 0.0f, 0.0f, 0, 0, 0); list2.RemoveAt(0); } int index4 = 3; while (index4 >= 0 && list1.Count > 0) { int index1 = list1[0]; if (numArray1[index4] > 0) { pInv[index1].SetDefaults(71 + index4, false); pInv[index1].stack = numArray1[index4]; if (pInv[index1].stack > pInv[index1].maxStack) pInv[index1].stack = pInv[index1].maxStack; numArray1[index4] -= pInv[index1].stack; } if (numArray1[index4] == 0) --index4; list1.RemoveAt(0); } }
void OnGetData(GetDataEventArgs e) { if (!e.Handled && TShock.Players[e.Msg.whoAmI].GetData <bool>("buildmode")) { Player plr = Main.player[e.Msg.whoAmI]; TSPlayer tsplr = TShock.Players[e.Msg.whoAmI]; switch (e.MsgID) { case PacketTypes.PlayerHurtV2: using (MemoryStream data = new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)) { data.ReadByte(); PlayerDeathReason.FromReader(new BinaryReader(data)); int damage = data.ReadInt16(); tsplr.Heal((int)Terraria.Main.CalculateDamagePlayersTake(damage, plr.statDefense) + 2); } break; case PacketTypes.Teleport: if ((e.Msg.readBuffer[3] == 0)) { List <int> buffs = new List <int>(plr.buffType); if (buffs.Contains(Terraria.ID.BuffID.ChaosState) && plr.inventory[plr.selectedItem].netID == Terraria.ID.ItemID.RodofDiscord) //rod 1326 { tsplr.Heal(plr.statLifeMax2 / 7); } } break; case PacketTypes.PaintTile: case PacketTypes.PaintWall: //0% { int count = 0; int type = e.Msg.readBuffer[7]; Terraria.Item lastItem = null; foreach (Item i in plr.inventory) { if (i.paint == type) { lastItem = i; count += i.stack; } } if (count <= 10 && lastItem != null) { tsplr.GiveItem(lastItem.type, lastItem.maxStack + 1 - count); } } break; case PacketTypes.Tile: //1% { int count = 0; int type = e.Msg.readBuffer[e.Index]; switch (type) { case 1: //PlaceTile case 3: //PlaceWall case 21: //ReplaceTile case 22: //ReplaceWall if (plr.inventory[plr.selectedItem].type != Terraria.ID.ItemID.StaffofRegrowth) //230 { int tile = e.Msg.readBuffer[e.Index + 5]; if (tsplr.SelectedItem.tileWand > 0) { tile = tsplr.SelectedItem.tileWand; } Item lastItem = null; foreach (Item i in plr.inventory) { if (i.createTile == tile || i.createWall == tile) { lastItem = i; count += i.stack; } } if (count <= 10 && lastItem != null) { tsplr.GiveItem(lastItem.type, lastItem.maxStack + 1 - count); } } break; // Placing wires case 5: //Red case 10: //Blue case 12: //Green case 16: //Yellow foreach (Item i in plr.inventory) { if (i.type == Terraria.ID.ItemID.Wire) //530 { count += i.stack; } } if (count <= 10) { tsplr.GiveItem(Terraria.ID.ItemID.Wire, 1000 - count); } break; case 8: //Place Actuator foreach (Item i in plr.inventory) { if (i.type == Terraria.ID.ItemID.Actuator) //849 { count += i.stack; } } if (count <= 10) { tsplr.GiveItem(Terraria.ID.ItemID.Actuator, 1000 - count); } break; } } break; } } }
public Inventory(Item[] items) { Default(); Items = ItemArrayToIIArray(items); }
/// <summary> /// Applies server config data to the player /// </summary> /// <param name="player"></param> public void ApplyToPlayer(Player player) { //player.male = this.Male; player.statMana = this.Mana; player.statLife = this.Health; player.statLifeMax = this.MaxHealth; player.SpawnX = this.SpawnX; player.SpawnY = this.SpawnY; player.hideVisual = this.HideVisual; player.hairDye = this.HairDye; player.hair = this.Hair; player.difficulty = this.Difficulty; player.hairColor = this.HairColor.ToXna(); player.skinColor = this.SkinColor.ToXna(); player.eyeColor = this.EyeColor.ToXna(); player.shirtColor = this.ShirtColor.ToXna(); player.underShirtColor = this.UnderShirtColor.ToXna(); player.pantsColor = this.PantsColor.ToXna(); player.shoeColor = this.ShoeColor.ToXna(); //Reset and populate inventory player.inventory = Enumerable.Repeat(new Item(), player.inventory.Length).ToArray(); foreach (var slotItem in this.Inventory) { var item = new Terraria.Item(); item.netDefaults(slotItem.NetId); item.stack = slotItem.Stack; item.Prefix(slotItem.Prefix); player.inventory[slotItem.Slot] = item; } //Reset and populate dye player.dye = Enumerable.Repeat(new Item(), player.dye.Length).ToArray(); foreach (var slotItem in this.Dye) { var item = new Terraria.Item(); item.netDefaults(slotItem.NetId); item.Prefix(slotItem.Prefix); player.dye[slotItem.Slot] = item; } //Reset and populate armor player.armor = Enumerable.Repeat(new Item(), player.armor.Length).ToArray(); foreach (var slotItem in this.Armor) { var item = new Terraria.Item(); item.netDefaults(slotItem.NetId); item.Prefix(slotItem.Prefix); player.armor[slotItem.Slot] = item; } //Update client this.Send(player); }
private static Item Adapt(TerrariaItem terrariaItem) => new Item(terrariaItem.type, terrariaItem.stack, terrariaItem.prefix);
private void AddItem(string name) { Item item = new Item(); item.RealSetDefaults(name); AddItem(item); }
public override bool ReforgePrice(Terraria.Item item, ref int reforgePrice, ref bool canApplyDiscount) { reforgePrice = (int)(Main.player[Main.myPlayer].GetModPlayer <PlayerMod>().ReforgeValue *reforgePrice); return(base.ReforgePrice(item, ref reforgePrice, ref canApplyDiscount)); }
protected override void DrawSelf(SpriteBatch spriteBatch) //TODO Clean this mess up { base.DrawSelf(spriteBatch); if (_vanillaItemSlot.IsMouseHovering || Indicator.IsMouseHovering) { Main.hoverItemName = "Explosive"; Main.LocalPlayer.mouseInterface = true; } else if (_vanillaItemSlot2.IsMouseHovering || Indicator2.IsMouseHovering) { Main.hoverItemName = "Bullets (10 required)"; Main.LocalPlayer.mouseInterface = true; } else if (combineButton.IsMouseHovering) { combineButton.SetImage(Main.reforgeTexture[1]); hoveringOverReforgeButton = true; Main.hoverItemName = "Combine +1"; Main.LocalPlayer.mouseInterface = true; } else if (combineButtonTen.IsMouseHovering) { combineButtonTen.SetImage(Main.reforgeTexture[1]); hoveringOverReforgeButtonTen = true; Main.hoverItemName = "Combine +10"; Main.LocalPlayer.mouseInterface = true; } else { combineButton.SetImage(Main.reforgeTexture[0]); hoveringOverReforgeButton = false; combineButtonTen.SetImage(Main.reforgeTexture[0]); hoveringOverReforgeButtonTen = false; } // This will hide the crafting menu similar to the reforge menu. For best results this UI is placed before "Vanilla: Inventory" to prevent 1 frame of the craft menu showing. Main.HidePlayerCraftingMenu = true; // Here we have a lot of code. This code is mainly adapted from the vanilla code for the reforge option. // This code draws "Place an item here" when no item is in the slot and draws the reforge cost and a reforge button when an item is in the slot. // This code could possibly be better as different UIElements that are added and removed, but that's not the main point of this example. // If you are making a UI, add UIElements in OnInitialize that act on your ItemSlot or other inputs rather than the non-UIElement approach you see below. const int slotX = 50; const int slotY = 270; //string message2 = "Element/Ammo"; //Will be check depending on whats the first slot, for insance, if the first slot has a bullet boom then it will select ammo //ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, "Currently Working Explosives: Bullet Boom", new Vector2(slotX, slotY + 80), new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor), 0f, Vector2.Zero, Vector2.One, -1f, 2f); Indicator.SetImage(ModContent.GetTexture("ExtraExplosives/UI/Indicator")); Indicator2.SetImage(ModContent.GetTexture("ExtraExplosives/UI/Indicator")); bool Craftable = false; bool CraftTen = false; //ammo if (!_vanillaItemSlot2.Item.IsAir && _vanillaItemSlot.Item.IsAir) { if (_vanillaItemSlot2.Item.ammo == AmmoID.Bullet && _vanillaItemSlot2.Item.stack >= 10) { Indicator2.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorGreen")); Indicator.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorRed")); } else if (_vanillaItemSlot2.Item.ammo == AmmoID.Bullet) { Indicator2.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorYellow")); if (hoveringOverReforgeButton || hoveringOverReforgeButtonTen) { Main.hoverItemName = $"You need to add {10 - _vanillaItemSlot2.Item.stack} bullets"; Main.LocalPlayer.mouseInterface = true; } Indicator.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorRed")); } else { Indicator2.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorRed")); if (hoveringOverReforgeButton || hoveringOverReforgeButtonTen) { Main.hoverItemName = "You need to add 10 bullets and an empty shell"; Main.LocalPlayer.mouseInterface = true; } Indicator.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorRed")); } } //explosives if (!_vanillaItemSlot.Item.IsAir) //check to see if the slot is air or not { //bomb if (_vanillaItemSlot.Item.type == ModContent.ItemType <BulletBoomEmptyItem>()) { Indicator.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorGreen")); } else { Indicator.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorRed")); } //ammo if (_vanillaItemSlot2.Item.ammo == AmmoID.Bullet && _vanillaItemSlot2.Item.stack >= 10) { Indicator2.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorGreen")); if (hoveringOverReforgeButtonTen && _vanillaItemSlot2.Item.stack <= 100) { Main.hoverItemName = $"You need to add {100 - _vanillaItemSlot2.Item.stack} bullets for +10"; Main.LocalPlayer.mouseInterface = true; } } else if (_vanillaItemSlot2.Item.ammo == AmmoID.Bullet) { Indicator2.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorYellow")); if (hoveringOverReforgeButton || hoveringOverReforgeButtonTen) { Main.hoverItemName = $"You need to add {10 -_vanillaItemSlot2.Item.stack} bullets"; Main.LocalPlayer.mouseInterface = true; } } else { Indicator2.SetImage(ModContent.GetTexture("ExtraExplosives/UI/IndicatorRed")); if (hoveringOverReforgeButton || hoveringOverReforgeButtonTen) { Main.hoverItemName = "You need to add 10 bullets"; Main.LocalPlayer.mouseInterface = true; } } //------------------------------------------------------ Indicators above ----------------------------------------------- if (_vanillaItemSlot.Item.type == ModContent.ItemType <BulletBoomEmptyItem>() && _vanillaItemSlot2.Item.ammo == AmmoID.Bullet) //Check to see if the slot has a bulletboom here and ammo in the ammo slot { if (_vanillaItemSlot.Item.stack >= 1 && _vanillaItemSlot2.Item.stack >= 10) { Craftable = true; } if (_vanillaItemSlot.Item.stack >= 10 && _vanillaItemSlot2.Item.stack >= 100) { CraftTen = true; } //if (_vanillaItemSlot.Item.stack >= 1 && _vanillaItemSlot2.Item.stack < 10 && !_vanillaItemSlot2.Item.IsAir) //{ // ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, "Need 10!", new Vector2(slotX + 150, slotY + 50), new Color(255, 0, 0), 0f, Vector2.Zero, Vector2.One, -1f, 2f); //} } else { //if (_vanillaItemSlot.Item.type == ModContent.ItemType<BulletBoomEmptyItem>() && _vanillaItemSlot2.Item.ammo != AmmoID.Bullet && !_vanillaItemSlot2.Item.IsAir) //check to see if the item is a bullet boom and the second slot is not ammo and not air //{ // ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, message2, new Vector2(slotX + 150, slotY + 50), new Color(255, 0, 0), 0f, Vector2.Zero, Vector2.One, -1f, 2f); //} Craftable = false; CraftTen = false; } if (!_vanillaItemSlot.Item.IsAir && !_vanillaItemSlot2.Item.IsAir && (Craftable || CraftTen)) //if both spots are full summon the combine ----------------------- { int reforgeX = slotX + 290; int reforgeY = slotY + 40; //hoveringOverReforgeButton = Main.mouseX > reforgeX - 15 && Main.mouseX < reforgeX + 15 && Main.mouseY > reforgeY - 15 && Main.mouseY < reforgeY + 15 && !PlayerInput.IgnoreMouseInterface; //ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, "Combine", new Vector2(slotX + 250, (float)slotY), Color.White, 0f, Vector2.Zero, Vector2.One, -1f, 2f); //Texture2D reforgeTexture = Main.reforgeTexture[hoveringOverReforgeButton ? 1 : 0]; //Main.spriteBatch.Draw(reforgeTexture, new Vector2(reforgeX, reforgeY), null, Color.White, 0f, reforgeTexture.Size() / 1.5f, 0.8f, SpriteEffects.None, 0f); if (hoveringOverReforgeButton) { Main.hoverItemName = "Combine"; if (!tickPlayed) { Main.PlaySound(12, -1, -1, 1, 1f, 0f); } tickPlayed = true; Main.LocalPlayer.mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft && Craftable) //add a check here to see if its an item that can be combined and if it can produce it here { if (_vanillaItemSlot.Item.type == ModContent.ItemType <BulletBoomEmptyItem>() && _vanillaItemSlot2.Item.ammo == AmmoID.Bullet) { ItemAmmo = _vanillaItemSlot2.Item.type; //get the id for the ammo // Now that we've spawned the item back onto the player, we reset the item by turning it into air. if (_vanillaItemSlot.Item.stack >= 1 && _vanillaItemSlot2.Item.stack >= 10 && Main.netMode != NetmodeID.Server) { Player player = Main.player[Main.myPlayer]; spriteBatch.End(); bool flag = false; foreach (Item checkItem in Main.player[Main.myPlayer].inventory) { if (checkItem.type == ModContent.ItemType <BulletBoomItem>()) { BulletBoomItem modCheckItem = (BulletBoomItem)checkItem.modItem; if (modCheckItem.item.shoot == _vanillaItemSlot2.Item.shoot && modCheckItem.overStack <= 998) { modCheckItem.overStack++; ItemText.NewText(modCheckItem.item, modCheckItem.overStack, true, false); flag = true; } } } if (!flag) { string bulletType = ""; StringBuilder sb = new StringBuilder(_vanillaItemSlot2.Item.Name); sb.Replace(" bullet", ""); sb.Replace(" Bullet", ""); int itemInt = Item.NewItem(player.position, ModContent.ItemType <BulletBoomItem>(), 1); //Main.player[Main.myPlayer].QuickSpawnItem(ModContent.ItemType<TestItem>()); Main.item[itemInt].instanced = true; Main.item[itemInt].shoot = _vanillaItemSlot2.Item.shoot; //Main.item[itemInt].modItem.DisplayName.SetDefault(Main.item[itemInt].Name + " " + _vanillaItemSlot2.Item.Name); Main.item[itemInt] .SetNameOverride(sb.ToString() + " Bullet Boom"); Main.item[itemInt].damage = _vanillaItemSlot2.Item.damage; BulletBoomItem tmp = (BulletBoomItem)Main.item[itemInt].modItem; tmp.bulletType = _vanillaItemSlot2.Item.Name; tmp.overStack++; } spriteBatch.Begin(); // Removes the correct amount of each item _vanillaItemSlot.Item.stack = _vanillaItemSlot.Item.stack - 1; _vanillaItemSlot2.Item.stack = _vanillaItemSlot2.Item.stack - 10; } else { _vanillaItemSlot.Item.TurnToAir(); _vanillaItemSlot2.Item.TurnToAir(); } //ItemLoader.PostReforge(_vanillaItemSlot.Item); //ItemLoader.PostReforge(_vanillaItemSlot2.Item); Main.PlaySound(SoundID.Item37, -1, -1); } } } if (hoveringOverReforgeButtonTen && CraftTen) { Main.hoverItemName = "Combine Ten"; if (!tickPlayed) { Main.PlaySound(12, -1, -1, 1, 1f, 0f); } tickPlayed = true; Main.LocalPlayer.mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft && CraftTen) //add a check here to see if its an item that can be combined and if it can produce it here { if (_vanillaItemSlot.Item.type == ModContent.ItemType <BulletBoomEmptyItem>() && _vanillaItemSlot2.Item.ammo == AmmoID.Bullet) { ItemAmmo = _vanillaItemSlot2.Item.type; //get the id for the ammo // Now that we've spawned the item back onto the player, we reset the item by turning it into air. if (_vanillaItemSlot.Item.stack >= 10 && _vanillaItemSlot2.Item.stack >= 100 && Main.netMode != NetmodeID.Server) { Player player = Main.player[Main.myPlayer]; spriteBatch.End(); bool flag = false; foreach (Item checkItem in Main.player[Main.myPlayer].inventory) { if (checkItem.type == ModContent.ItemType <BulletBoomItem>()) { BulletBoomItem modCheckItem = (BulletBoomItem)checkItem.modItem; if (modCheckItem.item.shoot == _vanillaItemSlot2.Item.shoot && modCheckItem.overStack <= 998) { modCheckItem.overStack += 10; ItemText.NewText(modCheckItem.item, modCheckItem.overStack, true, false); flag = true; } } } if (!flag) { string bulletType = ""; StringBuilder sb = new StringBuilder(_vanillaItemSlot2.Item.Name); sb.Replace(" bullet", ""); sb.Replace(" Bullet", ""); int itemInt = Item.NewItem(player.position, ModContent.ItemType <BulletBoomItem>(), 1); //Main.player[Main.myPlayer].QuickSpawnItem(ModContent.ItemType<TestItem>()); Main.item[itemInt].instanced = true; Main.item[itemInt].shoot = _vanillaItemSlot2.Item.shoot; //Main.item[itemInt].modItem.DisplayName.SetDefault(Main.item[itemInt].Name + " " + _vanillaItemSlot2.Item.Name); Main.item[itemInt] .SetNameOverride(sb.ToString() + " Bullet Boom"); Main.item[itemInt].damage = _vanillaItemSlot2.Item.damage; BulletBoomItem tmp = (BulletBoomItem)Main.item[itemInt].modItem; tmp.bulletType = _vanillaItemSlot2.Item.Name; tmp.overStack += 10; } spriteBatch.Begin(); // Removes the correct amount of each item _vanillaItemSlot.Item.stack = _vanillaItemSlot.Item.stack - 10; _vanillaItemSlot2.Item.stack = _vanillaItemSlot2.Item.stack - 100; } else { _vanillaItemSlot.Item.TurnToAir(); _vanillaItemSlot2.Item.TurnToAir(); } //ItemLoader.PostReforge(_vanillaItemSlot.Item); //ItemLoader.PostReforge(_vanillaItemSlot2.Item); Main.PlaySound(SoundID.Item37, -1, -1); } } } } } //else //{ // string message = "Explosive"; // ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, message, new Vector2(slotX + 60, slotY + 170), new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor), 0f, Vector2.Zero, Vector2.One, -1f, 2f); //} //if (!_vanillaItemSlot2.Item.IsAir) //{ //} //else //{ // ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, message2, new Vector2(slotX + 150, slotY + 50), new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor), 0f, Vector2.Zero, Vector2.One, -1f, 2f); //} }
public string GetTilesXml() { XDocument original = null; using (TextReader tr = new StreamReader("settings.xml")) { original = XDocument.Load(tr); } var origTiles = original.Element("Settings").Element("Tiles"); XElement root = new XElement("Tiles"); XDocument tiles = new XDocument(root); List <Terraria.Item> curItems = new List <Item>(); for (int i = 0; i < maxItemTypes; i++) { try { var curitem = new Terraria.Item(); curitem.SetDefaults(i); curItems.Add(curitem); } catch { } } for (int i = 0; i < maxTileSets; i++) { string origName = origTiles.Elements().FirstOrDefault(e => e.Attribute("Id").Value == i.ToString())?.Attribute("Name").Value; var creatingItem = curItems.FirstOrDefault(x => x.createTile == i); //var creatingItems = curItems.Where(x => x.createTile == i).ToList(); string itemName = creatingItem != null ? creatingItem.Name : string.Empty; if (string.IsNullOrWhiteSpace(itemName)) { itemName = origName ?? i.ToString(); } var tile = new XElement( "Tile", new XAttribute("Id", i.ToString()), new XAttribute("Name", itemName)); root.Add(tile); if (tileLighted[i]) { tile.Add(new XAttribute("Light", "true")); } if (Terraria.ID.TileID.Sets.NonSolidSaveSlopes[i]) { tile.Add(new XAttribute("SaveSlope", "true")); } if (tileSolid[i]) { tile.Add(new XAttribute("Solid", "true")); } if (tileSolidTop[i]) { tile.Add(new XAttribute("SolidTop", "true")); } if (tileFrameImportant[i]) { tile.Add(new XAttribute("Framed", "true")); var frames = new XElement("Frames"); tile.Add(frames); TileObjectData data = TileObjectData.GetTileData(i, 0); if (data == null) { string value = itemName; frames.Add(new XElement("Frame", new XAttribute("Name", value), new XAttribute("UV", $"0, 0")) ); } else { var tileWidth = data.Width; var tileHeight = data.Height; var textureWidth = data.CoordinateWidth; var textureHeight = data.CoordinateHeights.First();; var shiftWidth = data.CoordinateFullWidth; var shiftHeight = data.CoordinateFullHeight; var anchor = string.Empty; var styleMultiplier = data.StyleMultiplier; var styleWrapLimit = data.StyleWrapLimit; if (textureWidth != 16 || textureHeight != 16) { tile.Add(new XAttribute("TextureGrid", $"{textureWidth},{textureHeight}")); } tile.Add(new XAttribute("Size", $"{tileWidth},{tileHeight}")); int style = 0; while ((data = TileObjectData.GetTileData(i, style, 0)) != null) { var creatingSubItem = curItems.FirstOrDefault(x => x.createTile == i && x.placeStyle == style); if (creatingSubItem == null) { if (style == 0) { frames.Add(new XElement("Frame", new XAttribute("Name", itemName), new XAttribute("UV", $"0, 0")) ); } break; } string subTypeName = creatingSubItem != null ? creatingSubItem.Name : string.Empty; int altCount = data.AlternatesCount; for (int alt = 0; alt < altCount || alt == 0; alt++) { data = TileObjectData.GetTileData(i, style, alt); if (data == null) { continue; } var frame = new XElement("Frame", new XAttribute("Name", subTypeName)); frames.Add(frame); frame.Add(new XAttribute("UV", $"{shiftWidth * alt}, {shiftHeight * style}")); //if (alt > 0 && data.AlternatesCount > 0) System.Diagnostics.Debugger.Break(); if (data.AnchorBottom.tileCount > 0) { anchor = "Bottom"; } if (data.AnchorLeft.tileCount > 0) { anchor = "Left"; } if (data.AnchorRight.tileCount > 0) { anchor = "Right"; } if (data.AnchorTop.tileCount > 0) { anchor = "Top"; } frame.Add(new XAttribute("Anchor", anchor)); } style++; } } } } return(tiles.ToString()); }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("OvergrowthChest") && legs.type == mod.ItemType("OvergrowthLegs")); }
public TEItemFrame() { item = new Item(); }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("AncientDragonScaleMail") && legs.type == mod.ItemType("AncientDragonScaleGreaves")); }
public override bool AutoSelect(int i, int j, Item item) { return item.type == ItemID.Bunny; }
public void DropItem() { if (Main.netMode != 1) Item.NewItem((int)Position.X * 16, (int)Position.Y * 16, 32, 32, item.netID, 1, false, (int)item.prefix, false); item = new Item(); }
public static InventoryItem[] ItemArrayToIIArray(Item[] items) { InventoryItem[] iis = new InventoryItem[items.Length]; for (int i = 0; i < iis.Length; i++) { iis[i].Name = items[i].name; iis[i].ID = items[i].type; } return iis; }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("AnkorWatArmor") && legs.type == mod.ItemType("AnkorWatGreaves")); }
public Inventory(Item[] items, string name) { Default(); Items = ItemArrayToIIArray(items); Name = name; }
private bool UpdateRarity(On.Terraria.Item.orig_Prefix orig, Terraria.Item item, int pre) { orig(item, pre); Terraria.Item It = new Terraria.Item(); It.SetDefaults(item.type); int baseRarity = It.rare; int baseDamage = It.damage; int baseUseTime = It.useTime; int baseMana = It.mana; float baseKnockback = It.knockBack; float baseScale = It.scale; float baseShootspeed = It.shootSpeed; int baseCrit = It.crit; item.rare = baseRarity; if (_isFixedRarity.Contains(item.rare)) { return(true); } float DamageInc = 1; if (baseDamage != 0) { DamageInc = item.damage / baseDamage; } float KnockBack = 1; if (baseKnockback != 0) { KnockBack = item.knockBack / baseKnockback; } float UseTimeMult = 1; if (baseUseTime != 0) { UseTimeMult = item.useTime / baseUseTime; } float ScaleMult = 1; if (baseScale != 0) { ScaleMult = item.scale / baseScale; } float ShootspeedMult = 1; if (baseShootspeed != 0) { ShootspeedMult = item.shootSpeed / baseShootspeed; } float ManaMult = 1; if (baseMana != 0) { ManaMult = item.mana / baseMana; } float CritMult = 1; if (baseCrit != 0) { CritMult = item.crit / baseCrit; } ; int i = item.prefix; float TotalValue = 1f * DamageInc * (2f - UseTimeMult) * (2f - ManaMult) * ScaleMult * KnockBack * ShootspeedMult * (1f + (float)CritMult * 0.02f); if (i == 62 || i == 69 || i == 73 || i == 77) { TotalValue *= 1.05f; } if (i == 63 || i == 70 || i == 74 || i == 78 || i == 67) { TotalValue *= 1.1f; } if (i == 64 || i == 71 || i == 75 || i == 79 || i == 66) { TotalValue *= 1.15f; } if (i == PrefixID.Warding || i == PrefixID.Menacing || i == PrefixID.Lucky || i == PrefixID.Quick || i == PrefixID.Violent) { TotalValue *= 1.2f; } if (i == ModContent.PrefixType <Shielding>() || i == ModContent.PrefixType <Wrathful>() || i == ModContent.PrefixType <Weighted>() || i == ModContent.PrefixType <Rapid>() || i == ModContent.PrefixType <Beserk>()) { TotalValue *= 1.5f; } if ((double)TotalValue >= 1.5) { item.rare += 3; } else if ((double)TotalValue >= 1.2) { item.rare += 2; } else if ((double)TotalValue >= 1.05) { item.rare++; } else if ((double)TotalValue <= 0.8) { item.rare -= 2; } else if ((double)TotalValue <= 0.95) { item.rare--; } if (item.rare > MaxRarity) { item.rare = MaxRarity; } return(true); }
public static void Restock() { Player player = Main.player[Main.myPlayer]; Item[] inv = player.inventory; Item[] objArray = player.bank.item; if (player.chest > -1) objArray = Main.chest[player.chest].item; else if (player.chest == -2) objArray = player.bank.item; else if (player.chest == -3) objArray = player.bank2.item; HashSet<int> hashSet = new HashSet<int>(); List<int> list1 = new List<int>(); List<int> list2 = new List<int>(); for (int index = 57; index >= 0; --index) { if ((index < 50 || index >= 54) && (inv[index].itemId < 71 || inv[index].itemId > 74)) { if (inv[index].stack > 0 && inv[index].maxStack > 1 && (int)inv[index].prefix == 0) { hashSet.Add(inv[index].netID); if (inv[index].stack < inv[index].maxStack) list1.Add(index); } else if (inv[index].stack == 0 || inv[index].netID == 0 || inv[index].itemId == 0) list2.Add(index); } } bool flag1 = false; for (int index1 = 0; index1 < objArray.Length; ++index1) { if (objArray[index1].stack >= 1 && (int)objArray[index1].prefix == 0 && hashSet.Contains(objArray[index1].netID)) { bool flag2 = false; for (int index2 = 0; index2 < list1.Count; ++index2) { int slot = list1[index2]; int context = 0; if (slot >= 50) context = 2; if (inv[slot].netID == objArray[index1].netID && ItemSlot.PickItemMovementAction(inv, context, slot, objArray[index1]) != -1) { int num = objArray[index1].stack; if (inv[slot].maxStack - inv[slot].stack < num) num = inv[slot].maxStack - inv[slot].stack; inv[slot].stack += num; objArray[index1].stack -= num; flag1 = true; if (inv[slot].stack == inv[slot].maxStack) { if (Main.netMode == 1 && Main.player[Main.myPlayer].chest > -1) NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)index1, 0.0f, 0.0f, 0, 0, 0); list1.RemoveAt(index2); --index2; } if (objArray[index1].stack == 0) { objArray[index1] = new Item(); flag2 = true; if (Main.netMode == 1 && Main.player[Main.myPlayer].chest > -1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)index1, 0.0f, 0.0f, 0, 0, 0); break; } break; } } } if (!flag2 && list2.Count > 0 && objArray[index1].ammo != 0) { for (int index2 = 0; index2 < list2.Count; ++index2) { int context = 0; if (list2[index2] >= 50) context = 2; if (ItemSlot.PickItemMovementAction(inv, context, list2[index2], objArray[index1]) != -1) { Utils.Swap<Item>(ref inv[list2[index2]], ref objArray[index1]); list1.Add(list2[index2]); list2.RemoveAt(index2); flag1 = true; break; } } } } } if (!flag1) return; Main.PlaySound(7, -1, -1, 1); }
public override void GrabRange(Terraria.Item item, Player player, ref int grabRange) { MPlayer mp = player.GetModPlayer <MPlayer>(); grabRange += (int)(mp.statCharge * 1.6f); }
public static bool TryPlacingInChest(Item I, bool justCheck) { bool flag1 = false; Player player = Main.player[Main.myPlayer]; Item[] objArray = player.bank.item; if (player.chest > -1) { objArray = Main.chest[player.chest].item; flag1 = Main.netMode == 1; } else if (player.chest == -2) objArray = player.bank.item; else if (player.chest == -3) objArray = player.bank2.item; bool flag2 = false; if (I.maxStack > 1) { for (int index = 0; index < 40; ++index) { if (objArray[index].stack < objArray[index].maxStack && I.IsTheSameAs(objArray[index])) { int num = I.stack; if (I.stack + objArray[index].stack > objArray[index].maxStack) num = objArray[index].maxStack - objArray[index].stack; if (justCheck) { flag2 = flag2 || num > 0; break; } I.stack -= num; objArray[index].stack += num; Main.PlaySound(7, -1, -1, 1); if (I.stack <= 0) { I.SetDefaults(0, false); if (flag1) { NetMessage.SendData(32, -1, -1, "", player.chest, (float)index, 0.0f, 0.0f, 0, 0, 0); break; } break; } if (objArray[index].itemId == 0) { objArray[index] = I.Clone(); I.SetDefaults(0, false); } if (flag1) NetMessage.SendData(32, -1, -1, "", player.chest, (float)index, 0.0f, 0.0f, 0, 0, 0); } } } if (I.stack > 0) { for (int index = 0; index < 40; ++index) { if (objArray[index].stack == 0) { if (justCheck) { flag2 = true; break; } Main.PlaySound(7, -1, -1, 1); objArray[index] = I.Clone(); I.SetDefaults(0, false); if (flag1) { NetMessage.SendData(32, -1, -1, "", player.chest, (float)index, 0.0f, 0.0f, 0, 0, 0); break; } break; } } } return flag2; }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("BlueHeroShirt") && legs.type == mod.ItemType("BlueHeroPants")); }
public void SetRefillItems(string raw) { string[] array = raw.Split(','); for (int i = 0; i < array.Length && i < 20; i++) { var item = new Item(); item.SetDefaults(array[i]); RefillItems[i] = item; } //if (set) // setChestItems(RefillItems); }
public override bool IsArmorSet(Terraria.Item head, Terraria.Item body, Terraria.Item legs) { return(body.type == mod.ItemType("MagicPlateArmor") && legs.type == mod.ItemType("MagicPlateGreaves")); }