// Update is called once per frame void Update () { switch(buttonOption) { case Hash.ButtonOption.ButtonA: if(inventario.heldItems.Count > 0) { SourceImage.sprite = inventario.heldItems[0].spriteImage; inventoryItem = inventario.heldItems[0];} break; case Hash.ButtonOption.ButtonB: if(inventario.heldItems.Count > 1) { SourceImage.sprite = inventario.heldItems[1].spriteImage; inventoryItem = inventario.heldItems[1];} break; case Hash.ButtonOption.ButtonC: if(inventario.heldItems.Count > 2) { SourceImage.sprite = inventario.heldItems[2].spriteImage; inventoryItem = inventario.heldItems[2]; } break; case Hash.ButtonOption.ButtonD: if(inventario.heldItems.Count > 3) { SourceImage.sprite = inventario.heldItems[3].spriteImage; inventoryItem = inventario.heldItems[3]; } break; } }
public string ItemNumString(InventoryItems item) { switch(item) { case InventoryItems.NADA: return "00"; case InventoryItems.CAMARA: return "01"; case InventoryItems.DINERO: return "02"; case InventoryItems.TRIPODE: return "03"; case InventoryItems.CARRETE: return "04"; case InventoryItems.PENDULO: return "05"; case InventoryItems.CAMPANA_1: return "06"; case InventoryItems.CAMPANA_2: return "07"; case InventoryItems.CAMPANA_3: return "08"; case InventoryItems.CAMPANA_4: return "09"; case InventoryItems.ESCALERAS: return "10"; case InventoryItems.SOMBRERO: return "11"; case InventoryItems.PEGAMENTO: return "12"; case InventoryItems.PALO: return "13"; case InventoryItems.GUSANOS: return "14"; case InventoryItems.ANZUELO: return "15"; case InventoryItems.CANA: return "16"; case InventoryItems.MECHERO_1: return "17"; case InventoryItems.MECHERO_2: return "18"; case InventoryItems.ACEITE: return "19"; case InventoryItems.GANZUAS: return "20"; case InventoryItems.PAGINA_1: return "21"; case InventoryItems.PAGINA_2: return "22"; case InventoryItems.PAGINA_3: return "23"; case InventoryItems.PAGINA_4: return "24"; default: return "-1"; } }
public void RemoveInventory(Item pItem) { try { locker.WaitOne(); Handler12.ModifyInventorySlot(InventoryOwner, 0x24, (byte)pItem.Slot, 0, null); pItem.Delete(); InventoryItems.Remove((byte)pItem.Slot); } finally { locker.ReleaseMutex(); } }
public ActionResult Create([Bind(Include = "InventoryId,ReOrderQuantity,ProductId,QuantityOnHand")] InventoryItems inventoryItems) { if (ModelState.IsValid) { _rangamoRepository.InsertInventory(inventoryItems); _rangamoRepository.ItemSave(); //db.Inventory.Add(inventoryItems); //db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductId = new SelectList(db.Products, "ProductId", "Title", inventoryItems.ProductId); return(View(inventoryItems)); }
public bool GetEmptySlot(out byte pSlot) //cpu intensive? { pSlot = 0; for (byte i = 0; i < InventoryCount * 24; ++i) { if (!InventoryItems.ContainsKey(i)) { pSlot = i; return(true); } } return(false); //no more empty slots found }
/// <summary> /// Removes an item from the inventory by its uid. /// </summary> /// <param name="ItemUID">The item uid.</param> /// <returns>Returns the removed item. [null if failed]</returns> public ItemInfo RemoveItemByUID(uint ItemUID) { byte pos = GetPositionFromItemUID(ItemUID); ItemInfo rItem; if (InventoryItems.TryRemove(pos, out rItem)) { Database.CharacterDatabase.SaveInventory(Owner, null, pos); RemoveItemFromClient(rItem); return(rItem); } return(null); }
// GET: InventoryItems/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InventoryItems inventoryItems = db.Inventory.Find(id); if (inventoryItems == null) { return(HttpNotFound()); } return(View(inventoryItems)); }
private void Btn_Save_Input_Click(object sender, EventArgs e) { if (Com_Material_Input.SelectedIndex == -1) { MessageBox.Show("请选择入库物品"); return; } else if (Num_Number_Input.Value == 0) { MessageBox.Show("入库数量不得为0"); return; } var item = new InventoryItems() { ObjectID = Guid.NewGuid().ToString(), MaterialID = ((ComboboxItems)Com_Material_Input.SelectedItem).Value.ToString(), Price = (double)Num_Price_InPut.Value, Number = (double)Num_Number_Input.Value, CreatedTime = Time_InPutTime_Input.Value.ToFileTimeUtc(), Mark = Txt_Mark_Input.Text }; try { new InInventoryQuery().DoInventoryIn(item); var currentInventory = new CurrentInventoryQuery().GetCurrentInventory(item.MaterialID, ""); if (currentInventory.Any()) { new CurrentInventoryQuery().DoUpdateCurrentInventory(item.MaterialID, item.Number); } else { while (currentInventory.Any(t => t.ObjectID.Equals(item.ObjectID))) { item.ObjectID = Guid.NewGuid().ToString(); } new CurrentInventoryQuery().InsertInventory(item.ObjectID, item.MaterialID, item.Number); } MessageBox.Show("保存成功"); Btn_Reset_Input_Click(sender, e); } catch (Exception exp) { MessageBox.Show("保存失败," + exp.Message); } }
//Adds item to bag Boolean IContainer.AddItem(InventoryItems item) { if (count < bagSize) { count++; bagOfHolding.Add(item); bagWeight += item.weight; return(true); } else { return(false); } }
// VERIFICA SE ITEM ESTÁ NO INVENTÁRIO public static bool HasItemType(InventoryItems item) { if (listItems != null && listItems.Count > 0) { foreach (DataItems i in listItems) { if (item == i.type) { return(true); } } } return(false); }
public bool AddToInventory(Hash.ItemTypes myItemType, Sprite mySprite) { audio.PlayOneShot(audio.clip, 1.0F); if(heldItems.Count < 4) { InventoryItems item = new InventoryItems( myItemType.ToString(), myItemType); item.spriteImage = mySprite; heldItems.Add(item); return true; } else { return false; } }
public WeaponMenu() { headerTitle = "Weapons"; foreach (var weapon in Enum.GetValues(typeof(WeaponHash)).Cast<WeaponHash>()) { var weaponItem = InventoryItems.GetInvItemData($"WEAPON_{weapon.ToString().ToLower()}"); if(weaponItem != null) { menuItems.Add(new WeaponSubItem(weaponItem)); } } menuItems = menuItems.OrderBy(o => o.Title).ToList(); }
// GET: InventoryItems/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } InventoryItems inventoryItems = db.Inventory.Find(id); if (inventoryItems == null) { return(HttpNotFound()); } ViewBag.ProductId = new SelectList(db.Products, "ProductId", "Title", inventoryItems.ProductId); return(View(inventoryItems)); }
public bool Remove(InventoryItems item) { for (var i = 0; i < GetInventory.Count; i++) { if (GetInventory[i].Key.ItemName == item.ItemName) { currentWeight -= GetInventory[i].Key.ItemWeight * GetInventory[i].Value; GetInventory.Remove(GetInventory[i]); return(true); } } return(false); }
private void BtnAddDetail_Click(object sender, EventArgs e) { if (cmbDetailItems.SelectedIndex == -1) { MessageBox.Show("Please select a detail item"); return; } InventoryItem item = _context.InventoryItems.FirstOrDefault(i => i.ID == (int)cmbDetailItems.SelectedValue); if (!InventoryItems.Any(i => i.ID == item.ID)) { InventoryItems.Add(item); } }
public InventoryItems GetAllInventoryItems() { List <Item> items = dataService.GetObjectData <Item>(); InventoryItems inventoryItems = new InventoryItems(); inventoryItems.Automation = items.FindAll(ii => ii.Category == InventoryItemType.Automation); inventoryItems.Cabletrays = items.FindAll(ii => ii.Category == InventoryItemType.CableTrays); inventoryItems.Extras = items.FindAll(ii => ii.Category == InventoryItemType.Extras); inventoryItems.Instrumentation = items.FindAll(ii => ii.Category == InventoryItemType.Instumentation); inventoryItems.Labour = items.FindAll(ii => ii.Category == InventoryItemType.Labour); inventoryItems.Other = items.FindAll(ii => ii.Category == InventoryItemType.Other); inventoryItems.Monitoring = items.FindAll(ii => ii.Category == InventoryItemType.RemoteMonitoring); inventoryItems.Switchgear = items.FindAll(ii => ii.Category == InventoryItemType.Switchgear); return(inventoryItems); }
/// <summary> /// Gets an item position from an item uid. /// </summary> /// <param name="ItemID">The item id.</param> /// <returns>Returns the item uid.</returns> public byte GetPositionFromItemUID(uint ItemUID) { foreach (byte key in InventoryItems.Keys) { ItemInfo finditem; if (InventoryItems.TryGetValue(key, out finditem)) { if (finditem.UID == ItemUID) { return(key); } } } return(40); }
public bool Collect(InventoryItems id, int progressModifier) { for (int i = 0; i < MAX_ITEMS; i++) { if (objectList[i] == InventoryItems.NADA) { objectList[i] = id; progress += progressModifier; return true; } } return false; }
public bool Contains(InventoryItems item, int amountOf) { foreach (var inventoryItem in GetInventory) { if (inventoryItem.Key.ItemName == item.ItemName) { if (inventoryItem.Value >= amountOf) { return(true); } } } return(false); }
public bool DoUpdateInventory(InventoryItems items) { var sql = @"update table_InventoryIn set price=@Price,number=@Number,createdtime=@CreatedTime,mark=@Mark where ObjectID=@ObjectID"; SQLiteParameter[] parameter = new SQLiteParameter[] { new SQLiteParameter("@ObjectID", items.ObjectID), new SQLiteParameter("@MaterialID", items.MaterialID), new SQLiteParameter("@Price", items.Price), new SQLiteParameter("@Number", items.Number), new SQLiteParameter("@CreatedTime", items.CreatedTime), new SQLiteParameter("@Mark", items.Mark) }; return(SqlHelper.ExecuteNonQuery(sql, parameter) == 1); }
public bool DoInventoryIn(InventoryItems items) { var sql = "insert into table_InventoryIn (ObjectID,MaterialID,Price,Number,CreatedTime,Mark)values(@ObjectID,@MaterialID,@Price,@Number,@CreatedTime,@Mark)"; SQLiteParameter[] parameter = new SQLiteParameter[] { new SQLiteParameter("@ObjectID", items.ObjectID), new SQLiteParameter("@MaterialID", items.MaterialID), new SQLiteParameter("@Price", items.Price), new SQLiteParameter("@Number", items.Number), new SQLiteParameter("@CreatedTime", items.CreatedTime), new SQLiteParameter("@Mark", items.Mark) }; return(SqlHelper.ExecuteNonQuery(sql, parameter) == 1); }
public InventoryItems UpdateInventoryItem(InventoryItems item) { var InventoryItem = context.InventoryItem.FirstOrDefault(s => s.Id == item.Id); try { InventoryItem.Id = item.Id; InventoryItem.ItemName = item.ItemName; InventoryItem.Price = item.Price; return(InventoryItem); } catch { return(null); } }
public bool DoInventoryUpdate(InventoryItems items) { var sql = "update table_InventoryOut set UserID=@UserID,Number=@Number,CreatedTime=@CreatedTime,Mark=@Mark where ObjectID=@ObjectID "; SQLiteParameter[] parameter = new SQLiteParameter[] { new SQLiteParameter("@ObjectID", items.ObjectID), new SQLiteParameter("@MaterialID", items.MaterialID), new SQLiteParameter("@UserID", items.UserID), new SQLiteParameter("@Number", items.Number), new SQLiteParameter("@CreatedTime", items.CreatedTime), new SQLiteParameter("@Mark", items.Mark) }; return(SqlHelper.ExecuteNonQuery(sql, parameter) == 1); }
/// <summary> /// Find the selected item in InventoryItems and subtract 1 from the count /// If the count becomes 0 remove the item from InventoryItems /// </summary> private void RemoveOneFromList() { if (SelectedItem == null) { MessageBox.Show("Please Select an Item to remove."); return; } InventoryItem item = InventoryItems.First(x => x.Name == SelectedItem.Name); item.ItemCount--; if (item.ItemCount == 0) { InventoryItems.Remove(item); } }
private void Interact() { if (CurrentInteractable is InventoryItem) { InventoryItems.AddToInventory(CurrentInteractable as InventoryItem); } //Remove item from inventory if (InventoryItems.HasRequirements(CurrentInteractable)) { // Interact with current detected interactable CurrentInteractable.Interact(); OnInteracted(CurrentInteractable); RemoveItemFromInventory(); } }
public void InsertBonusShipRazerClaw() { foreach (var item in InventoryItems) { var shipBuilder = item.ItemObjectBuilder as MyMwcObjectBuilder_SmallShip; if (shipBuilder != null && shipBuilder.ShipType == MyMwcObjectBuilder_SmallShip_TypesEnum.RAZORCLAW) { return; } } var razorBuilder = MyMwcObjectBuilder_SmallShip_Player.CreateDefaultShip(MyMwcObjectBuilder_SmallShip_TypesEnum.RAZORCLAW, MyMwcObjectBuilder_FactionEnum.Rainiers, 100); razorBuilder.Inventory.MaxItems = 60; InventoryItems.Add(new MyMwcObjectBuilder_InventoryItem(razorBuilder, 1)); }
public void RemoveEquipment(InventoryItems item, bool willEquip = false) { var equip = equipment[item.GetType().ToString()]; if (equip == null) { return; } if (item.GetType() == typeof(Lightsource)) { Lightsource temp = equip.item as Lightsource; CharacterStats.sightBonusFromItems -= temp.lightRadius; } else if (item.GetType() == typeof(Weapon)) { References.rf.playerMovement.meleeWeapon = null; AnimationClip idleClip = animations.DefaultIdleClip("One_handedMelee"); AnimationClip walkClip = animations.DefaultWalkClip("One_handedMelee"); overrider["BaseIdle"] = idleClip; overrider["BaseWalk"] = walkClip; anim.runtimeAnimatorController = overrider; anim.SetLayerWeight(1, 1f); } else { Armor armor = item as Armor; if (item.GetType() == typeof(Chestgear)) { foreach (var obj in chestgearEquipment) { obj.Value.sprite = null; } } Info.AddDefenses(armor, true); } if (equip.obj != null) { Destroy(equip.obj); } ApplyGearEffects(equip.item, true); if (!willEquip) { CalculateStats(); StartCoroutine("UpdateInventoryGear"); } equip.item = null; }
public void MustAddObject() { //Arrange var inventoryServices = new InventoryServices(); var inventoryController = new InventoryController(inventoryServices); var inventoryItem = new InventoryItems() { Id = 2, ItemName = "Test", Price = 100 }; //Act var actionResult = inventoryController.AddInvetoryItems(inventoryItem); var result = actionResult.Result as CreatedResult; //Assert Assert.AreEqual(actionResult.Result, result); }
[HttpPost] // For Posting Inventory Item public bool Post(InventoryItems Data) { try { var param = new DynamicParameters(); param.Add("@Item_Name", Data.Item_Name); param.Add("@Item_Description", Data.Item_Description); param.Add("@Item_Price", Data.Item_Price); param.Add("@ImageUrl", Data.ImageUrl); var Result = Dap.ExecuteSPAsync <InventoryItems>("PostInventoryItems_SP", param); return(true); } catch (Exception ex) { throw; } }
public string AddInventoryItems(InventoryItems item) { string result = ""; bool alreadyExist = _inventoryItems.Any((x) => x.Id == item.Id); if (alreadyExist) { result = "A Car with id:" + item.Id + " is already exist."; } else { _inventoryItems.Add(item); result = "Car with id: " + item.Id + " has been added successfully."; } return(result); }
public void AddSingleItem(InventoryItems itemToAdd) { var tempItem = CharacterStats.inventoryItems.Find(_item => _item.item == itemToAdd); if (tempItem != null) { tempItem.amount++; } else { CharacterStats.inventoryItems.Add(new Inventory { amount = 1, item = itemToAdd }); } Events.updateFilteredItems(filteredItems); Events.onInventoryChange(); }
/// <summary> /// Creator: Cash Carlson /// Created: 2020/04/29 /// Approver: Rasha Mohammed /// /// Method used for Activate Button on Click /// </summary> /// <remarks> /// Updater: Robert Holmes /// Updated: 5/5/2020 /// Update: No longer crashes if nothing is selected. /// </remarks> /// <param name="sender"></param> /// <param name="e"></param> private void btnActivateProduct_Click(object sender, RoutedEventArgs e) { InventoryItems _inventoryItem = (InventoryItems)dgInventoryItems.SelectedItem; if (_inventoryItem != null) { if (!_inventoryItem.Active) { _productManager.ActivateProduct(_inventoryItem.ProductID); RefreshData(); } else { MessageBox.Show("This product is already active!"); } } }
/// <summary> /// Sets the inventory when the game is being loaded /// </summary> /// <param name="inv">The inventory using strings</param> public void SetInventory(ArrayList inv) { inventory.Clear(); InventoryItems invIt = GetComponent <InventoryItems>(); for (int i = 0; i < inv.Count; i++) { for (int j = 0; j < invIt.pItemNames.Length; j++) { if ((string)inv[i] == invIt.pItemNames[j] + "(Clone)") { AddItem(invIt.possibleItems[j]); } } } }
public void ApplyLoot(InventoryItems item, int amount, string playerTag) { // Call inventory system here and add to it. switch (playerTag) { case "Player1": player1Inventory.AddItemToInventory(item, amount); break; case "Player2": player2Inventory.AddItemToInventory(item, amount); break; default: throw new System.Exception("PlayerTag String wrong: " + playerTag); } }
public void test() { AItem i; i = new HealPot (); i.init (); this._items.Add(new Pair<AItem, int>(i, 2)); AItem it; it = new HealPot (); it.init (); this._items.Add(new Pair<AItem, int>(it, 2)); AItem itt; itt = new HealPot (); itt.init (); this._items.Add(new Pair<AItem, int>(itt, 2)); this._iList = new InventoryItems(); }
public string ItemString(InventoryItems item) { switch(item) { case InventoryItems.NADA: return "Nada"; case InventoryItems.CAMARA: return "CAMARA"; case InventoryItems.DINERO: return "DINERO"; case InventoryItems.TRIPODE: return "TRIPODE"; case InventoryItems.CARRETE: return "CARRETE"; case InventoryItems.PENDULO: return "PENDULO"; case InventoryItems.CAMPANA_1: return "CAMPANA_1"; case InventoryItems.CAMPANA_2: return "CAMPANA_2"; case InventoryItems.CAMPANA_3: return "CAMPANA_3"; case InventoryItems.CAMPANA_4: return "CAMPANA_4"; case InventoryItems.ESCALERAS: return "ESCALERAS"; case InventoryItems.SOMBRERO: return "SOMBRERO"; case InventoryItems.PEGAMENTO: return "PEGAMENTO"; case InventoryItems.PALO: return "PALO"; case InventoryItems.GUSANOS: return "GUSANOS"; case InventoryItems.ANZUELO: return "ANZUELO"; case InventoryItems.CANA: return "CAÑA"; case InventoryItems.MECHERO_1: return "MECHERO_1"; case InventoryItems.MECHERO_2: return "MECHERO_2"; case InventoryItems.ACEITE: return "ACEITE"; case InventoryItems.GANZUAS: return "GANZUAS"; case InventoryItems.PAGINA_1: return "PAGINA_1"; case InventoryItems.PAGINA_2: return "PAGINA_2"; case InventoryItems.PAGINA_3: return "PAGINA_3"; case InventoryItems.PAGINA_4: return "PAGINA_4"; default: return " "; } }
private void SetCurAndTradeoffForEquipable(InventoryItems selectedItem) { CurSelectStrLabel.Text = "Strength: " + selectedItem.GetProperty(StatsType.Strength).Magnitude; CurSelectAgiLabel.Text = "Agility: " + selectedItem.GetProperty(StatsType.Agility).Magnitude; CurSelectIntLabel.Text = "Intelligence: " + selectedItem.GetProperty(StatsType.Intelegence).Magnitude; CurSelectDefLabel.Text = "Defense: " + selectedItem.GetProperty(StatsType.Defense).Magnitude; CurSelectMHPLabel.Text = "Bonus HP: " + selectedItem.GetProperty(StatsType.MaxHp).Magnitude; CurSelectMMPLabel.Text = "Bonus MP: " + selectedItem.GetProperty(StatsType.MaxResources).Magnitude; EnumGearSlot selectedType = ((Equipable)selectedItem).Slot; int tStr = (selectedItem.GetProperty(StatsType.Strength).Magnitude) - (equiped[selectedType].GetProperty(StatsType.Strength).Magnitude); int tAgi = (selectedItem.GetProperty(StatsType.Agility).Magnitude) - (equiped[selectedType].GetProperty(StatsType.Agility).Magnitude); int tInt = (selectedItem.GetProperty(StatsType.Intelegence).Magnitude) - (equiped[selectedType].GetProperty(StatsType.Intelegence).Magnitude); int tDef = (selectedItem.GetProperty(StatsType.Defense).Magnitude) - (equiped[selectedType].GetProperty(StatsType.Defense).Magnitude); int tMHP = (selectedItem.GetProperty(StatsType.MaxHp).Magnitude) - (equiped[selectedType].GetProperty(StatsType.MaxHp).Magnitude); int tMMP = (selectedItem.GetProperty(StatsType.MaxResources).Magnitude) - (equiped[selectedType].GetProperty(StatsType.MaxResources).Magnitude); // tradeoff adjustments TradeoffStrLabel.Text = "Strength: " + tStr; TradeoffAgiLabel.Text = "Agility: " + tAgi; TradeoffIntLabel.Text = "Intelligence: " + tInt; TradeoffDefLabel.Text = "Defense: " + tDef; TradeoffMHPLabel.Text = "Bonus HP: " + tMHP; TradeoffMMPLabel.Text = "Bonus MP: " + tMMP; SetTradeoffColors(tStr, tAgi, tInt, tDef, tMHP, tMMP); this.Equip.Text = "Equip"; }
private void SetCurAndTradeoffForDye(InventoryItems selectedItem) { Dye selectedDye = (Dye)selectedItem; CurSelectStrLabel.Text = selectedDye.GetDescription(); CurSelectAgiLabel.Text = ""; CurSelectIntLabel.Text = ""; CurSelectDefLabel.Text = ""; CurSelectMHPLabel.Text = ""; CurSelectMMPLabel.Text = ""; TradeoffStrLabel.Text = ""; TradeoffAgiLabel.Text = ""; TradeoffIntLabel.Text = ""; TradeoffDefLabel.Text = ""; TradeoffMHPLabel.Text = ""; TradeoffMMPLabel.Text = ""; this.Equip.Text = "Apply"; }
private void SetCurAndTradeoffForConsumable(InventoryItems selectedItem) { Consumable potion = (Consumable)selectedItem; int stat = -1; // DEFAULT VALUE foreach (EffectInformation effect in potion.Properties) { if (effect.Magnitude > 0) stat = (int)effect.Stat; } CurSelectStrLabel.Text = potion.GetDescription() + ": " + selectedItem.GetProperty((StatsType)stat).Magnitude; CurSelectAgiLabel.Text = "Duration: " + selectedItem.GetProperty((StatsType)stat).Duration; CurSelectIntLabel.Text = ""; CurSelectDefLabel.Text = ""; CurSelectMHPLabel.Text = ""; CurSelectMMPLabel.Text = ""; TradeoffStrLabel.Text = ""; TradeoffAgiLabel.Text = ""; TradeoffIntLabel.Text = ""; TradeoffDefLabel.Text = ""; TradeoffMHPLabel.Text = ""; TradeoffMMPLabel.Text = ""; this.Equip.Text = "Drink"; }
// Use this for initialization public void init(InventoryItems it) { this._iList = it; }