internal virtual void ReplaceWithFake(int type) { if (real && item.stack > 0) { // Main.player[Main.myPlayer].QuickSpawnItem(RecipeBrowserWindow.lookupItemSlot.item.type, RecipeBrowserWindow.lookupItemSlot.item.stack); Player player = Main.player[Main.myPlayer]; item.position = player.Center; Item item2 = player.GetItem(player.whoAmI, item, false, true); if (item2.stack > 0) { int num = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, item2.type, item2.stack, false, (int)item.prefix, true, false); Main.item[num].newAndShiny = false; if (Main.netMode == 1) { NetMessage.SendData(21, -1, -1, null, num, 1f, 0f, 0f, 0, 0, 0); } } item = new Item(); } item.SetDefaults(type); real = type == 0; backgroundTexture = real ? defaultBackgroundTexture : backgroundTextureFake; OnItemChanged?.Invoke(); }
internal virtual void ReplaceWithFake(int type) { if (real && item.stack > 0) { // Main.player[Main.myPlayer].QuickSpawnItem(RecipeBrowserWindow.lookupItemSlot.item.type, RecipeBrowserWindow.lookupItemSlot.item.stack); Player player = Main.player[Main.myPlayer]; item.position = player.Center; Item item2 = player.GetItem(player.whoAmI, item, false, true); if (item2.stack > 0) { int num = Item.NewItem((int)player.position.X, (int)player.position.Y, player.width, player.height, item2.type, item2.stack, false, (int)item.prefix, true, false); Main.item[num].newAndShiny = false; if (Main.netMode == NetmodeID.MultiplayerClient) { NetMessage.SendData(MessageID.SyncItem, -1, -1, null, num, 1f, 0f, 0f, 0, 0, 0); } else { // TODO: Detect PreSaveAndQuit only. RecipeBrowser.instance.Logger.Warn("You left an item in the recipe browser with a full inventory and have lost the item: " + item2.Name); } } item = new Item(); } item.SetDefaults(type); real = type == 0; backgroundTexture = real ? defaultBackgroundTexture : backgroundTextureFake; OnItemChanged?.Invoke(); }
public bool AddToInventory(Item item) { //Debug.Log("Attempting to add item to inventory..."); if (inventoryItems.Count >= maxInventorySpace) { // Debug.Log("Could not add to inventory"); GameManager.instance.player.DisplayPopupText("Inventory full!"); return(false); } else { inventoryItems.Add(item); onItemChangedCallback?.Invoke(item); // '?' = a check to see if the variable is true or not, if so perform the operation return(true); } }
public bool Add(Item item) { if (!item.isDefaultItem) { if (items.Count >= space) { Debug.Log("Not enough space in the inventory!"); return(false); } items.Add(item); onItemChangedCallback?.Invoke(); } return(true); }
public override void Click(UIMouseEvent evt) { Player player = Main.LocalPlayer; if (player.itemAnimation == 0 && player.itemTime == 0) { if (real) { Item item = Main.mouseItem.Clone(); Main.mouseItem = this.item.Clone(); if (Main.mouseItem.type > 0) { Main.playerInventory = true; } this.item = item.Clone(); } else { item = Main.mouseItem.Clone(); Main.mouseItem.SetDefaults(0); real = true; } if (item.type == 0) { real = true; } OnItemChanged?.Invoke(); } backgroundTexture = real ? defaultBackgroundTexture : backgroundTextureFake; }
public void AddItemIntoInventory(Loot loot) { Item item = loot.GetItem(); loot.PickUp(); //currentCollidedItem = null; OnItemAdd?.Invoke(item); }
public bool Add(Item item) { if (!item.isDefaultItem) { if (Items.Count >= space) { Debug.Log("Not enough room."); return(false); } Items.Add(item); if (Callback != null) { Callback.Invoke(); } } return(true); }
public bool Add(Item item) { if (!item.isDefaultItem) { if (items.Count >= space) { print("Not enough room"); return(false); } items.Add(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } } return(true); }
public bool addToInv(InventoryItem item) { if (getSize() < maxSize) { invItems.Add(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } return(true); } else { Debug.Log("no room for Item!"); return(false); } }
public bool Add(InvItem invItem, int replaceIndex = -1) { if (invItem.item.stackable) { InvItem _item = FindItem(invItem.item); if (_item == null) { if (IsFull()) { return(false); } if (replaceIndex >= 0 && replaceIndex < items.Count) { items[replaceIndex] = invItem; } else { items.Add(invItem); } } else { _item.stackCount += invItem.stackCount; } } else { if (replaceIndex != -1 && replaceIndex < items.Count) { items[replaceIndex] = invItem; } else if (IsFull()) { return(false); } else { items.Add(invItem); } } if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } return(true); }
public bool Add(Item item) { if (!item.isDefaultItem) { if (items.Count >= space) { Debug.Log("Not enough Inventory space"); return(false); } items.Add(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } } return(true); }
public bool Add(Item item) { if (!item.isDefaultItem) { if (items.Count >= space) { Debug.Log("Not Enough Room"); return(false);; } items.Add(item); if (OnItemChangedCallback != null) { OnItemChangedCallback.Invoke(); } } return(true); }
public bool Add(Item item) { if (items.Count >= space) { Debug.Log("Not enough room"); return(false); } items.Add(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } return(true); }
// Add a new item. If there is enough room we // return true. Else we return false. public bool Add(Item item, int amount) { // Don't do anything if it's a default item if (!item.isDefaultItem) { if ((this.GetWeight() + item.weight) > PlayerMovement.Statistics.GetCarriableWeight()) { Debug.Log("Not enough strengh: can only carry " + PlayerMovement.Statistics.GetCarriableWeight() + "."); return(false); } // Check if out of space if (items.Count >= space) { Debug.Log("Not enough room."); return(false); } if (items.ContainsKey(item)) { items[item] += amount; } else { items.Add(item, amount); Debug.LogError(item.name + " has been added"); } Debug.Log("New inventory weight: " + GetWeight() + " " + "(can carry " + PlayerMovement.Statistics.GetCarriableWeight() + ")."); // Trigger callback if (onItemChangedCallback != null) { Debug.Log("Invoking callback"); onItemChangedCallback.Invoke(); } else { Debug.Log("No callback."); } } return(true); }
public bool Add(Item item) { /* * Add a single item in the inventory (ex: if you loot a single sword) */ if (!item.isDefaultItem) { ItemStack itemStack = itemsStack.Find(x => x.item == item); if (itemStack != null) { itemStack.AddStack(); } else { if (itemsStack.Count >= space) { Debug.Log("Not enough space in inventory"); return(false); } itemsStack.Add(new ItemStack(item)); } onItemChangedCallback?.Invoke(); return(true); } return(false); }
public bool AddItem(Item _item) { if (!_item.isDefaultItem) { if (items.Count >= space) { return(false); } if (!items.Contains(_item)) { items.Add(_item); AmountItens.Add(1); } else { int index = -1; for (int i = 0; i < items.Count; i++) { if (items[i] == _item) { if (AmountItens[i] < items[i].MaximunStacks) { AmountItens[i]++; index = i; break; } } } if (index == -1) { items.Add(_item); AmountItens.Add(1); } } if (onItemChangedCallBack != null) { onItemChangedCallBack.Invoke(); } } return(true); }
public bool Add(ItemSO item) { if (items.Count < space) { items.Add(item); // CallBack Triggered if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } return(true); } else { //Inventory Full return(false); } }
// Add a new item if enough room public void Add(Item item) { if (item.showInInventory) { if (items.Count >= space) { Debug.Log("Not enough room."); return; } items.Add(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } } }
//add item to inventory public bool Add(Item item) { if (!item.isDefaultItem) { if (items.Count >= space) { // no more room return(false); } items.Add(item); if (onItemChangedCallBack != null) { onItemChangedCallBack.Invoke(); } } return(true); }
public bool add(Item item) { if (!item.isDefaultItem) { if (items.Count >= space) { Debug.Log("pas assez d'espace"); return(false); } items.Add(item); if (onItemChangedCallBack != null) { onItemChangedCallBack.Invoke(); } } return(true); }
// Add a new item if enough room public void Add(Item item, string act) { if (range) { if (items.Count >= space) { Debug.Log("Not enough room."); return; } items.Add(act, item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } } }
// Add a new item. If there is enough room we // return true. Else we return false. public bool Add(HI_Prop item) { // Check if out of space if (items.Count >= space) { Debug.Log("Inventory Full"); return(false); } items.Add(item); // Add item to list // Trigger callback if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } return(true); }
public bool Add(Item item) { for (int i = 0; i < space; i++) { if (items[i] == null) { items[i] = item; if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } return(true); } } Debug.Log("Not enough room!"); return(false); }
public bool AddItem(ItemInfo item) { if (listItems.Count >= nRelicSpace) { Debug.Log("Not enough room."); return(false); } ItemChange(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } return(true); }
public bool Add(Item item) { if (!item.isDefaultItem) { if (items.Count >= space) { Debug.Log("Your inventory is full"); return(false); } items.Add(item); if (OnItemChangedCallback != null) { OnItemChangedCallback.Invoke(); } } return(true); }
public bool Add(Vegetable vegetable) { if (veggies.Count < slots) { veggies.Add(vegetable); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } return(true); } else { return(false); } }
public void Add(Product item) { products.Add(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } }
public bool Add(Item item) { if (!item.isDefaultItem) { if (items.Count >= space) { Debug.Log("I can't carry anymore!"); return(false); } items.Add(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } } return(true); }
public bool Add(Item item) { if (!item.isDeafaultItem) { if (items.Count >= space) { Debug.Log("nie ma miejsca"); return(false); } items.Add(item); if (onItemCHangedCallback != null) { onItemCHangedCallback.Invoke(); } } return(true); }
// Remove an item public void Remove(Item item) { items.Remove(item); if (onItemChangedCallback != null) { onItemChangedCallback.Invoke(); } }