public async Task <ActionResult <Account> > TTND([Bind(include: "UserName,Password")] Item_ item) { var User = await _context.Accounts .FirstOrDefaultAsync(m => (m.UserName == item.UserName) && (m.Password == item.Password)); if (User == null) { return(NotFound()); } var tienDo = await _context.TienDoNguoiDungs.FirstOrDefaultAsync(m => m.AccountID == User.Id); if (tienDo == null) { return(NotFound()); } User.tienDoNguoiDung = tienDo; var lichSus = from p in _context.LichSuNguoiDungs select p; if (lichSus == null) { return(NotFound()); } lichSus = lichSus.Where(s => s.TienDoNguoiDungID == tienDo.ID); User.tienDoNguoiDung.lichSuNguoiDung = await lichSus.ToListAsync(); if (lichSus.Count() == 0) { return(NotFound()); } return(User); }
public void EquipItem(Item_ item) { if (IsInInventory(item)) //Si el ítem ya está en alguna ranura del inventario { if (!IsEquipped(item)) //Si no está equipado { Slot_ oldSlot = item.occupyingSlot; oldSlot.RemoveItem(item); //Quitarlo de la ranura en que se encuentra actualmente slots.Find(t => t.slotType == item.equippableSlot).AddItem(item); //Ponerlo en la ranura equipable item.graphics_.inGame_.animator.SetTrigger("isEquipped"); //Equipar visualmente el ítem en el personaje } else//Si ya está equipado { Debug.Log($"Item {item.name} is already in the equippable slot. It isn't necessary re-equip it."); } } else//Y si no está en el inventario { if (currentWeight + ((ItemStats_)item.mechanics_.stats_).weight > weightCapacity) { return; //No equiparlo porque el jugador no puede llevar tanto peso } slots.Find(t => t.slotType == item.equippableSlot).AddItem(item); //Simplemente equiparlo item.graphics_.inGame_.animator.SetTrigger("isEquipped"); //Equipar visualmente el ítem en el personaje SetWeightCapacity(); } }
public void StoreItem(Item_ item) { if (IsInInventory(item)) //Si el ítem ya está en alguna ranura del inventario { if (!IsStored(item)) //Si no está en la ranura genérica { if (IsEquipped(item)) //Si está equipado { item.graphics_.inGame_.animator.SetTrigger("isStored"); //Dejar de mostrarlo } Slot_ oldSlot = item.occupyingSlot; oldSlot.RemoveItem(item); //Quitarlo de la ranura en que se encuentra actualmente genericSlot.AddItem(item); //Ponerlo en la ranura genérica ("almacenarlo") } else//Y si ya está en la ranura genérica ("almacenado") { Debug.Log($"Item {item.name} is already in the generic slot. It isn't necessary re-store it."); } } else//Y si no está en el inventario { float itemWeight = ((ItemStats_)item.mechanics_.stats_).weight; if ((currentWeight + itemWeight) > weightCapacity) { return; //No equiparlo porque el jugador no puede llevar tanto peso } genericSlot.AddItem(item); //Simplemente ponerlo en la ranura genérica ("almacenarlo") RefreshCurrentWeight(); item.graphics_.inGame_.animator.SetTrigger("isStored"); } }
// Start is called before the first frame update void Start() { Item_ sword = new Item_(); Item_ bread = new Item_(); Item_ cape = new Item_(); Item_ fish = new Item_(); Debug.Log(Item_.itemCount); }
public void DropItem(Item_ item) { if (IsInInventory(item))//Si el ítem está en alguna ranura del inventario { Slot_ oldSlot = item.occupyingSlot; oldSlot.RemoveItem(item); RefreshCurrentWeight(); item.graphics_.inGame_.animator.SetTrigger("isDropped"); } }
public bool IsEquipped(Item_ item) { if (IsInInventory(item)) { return(item.occupyingSlot.slotType == item.equippableSlot); } else { return(false); } }
public bool IsStored(Item_ item) { if (IsInInventory(item)) { return(item.occupyingSlot == genericSlot); } else { return(false); } }
public int GetHitDamage() { int attackDamage = 10; Item_ equippedWeapon = inventory.GetEquippedItems().Find(t => t.itemType == ItemType.Weapon); if (equippedWeapon != null) { int weaponDamage = inventory.GetEquippedItems().Find(i => i.itemType == ItemType.Weapon).damage; attackDamage += weaponDamage; } return(attackDamage); }
static void AddItem() { Sword_ longsword = new Sword_("Longsword", 15, 3); Sword_ greatsword = new Sword_("Greatsword", 50, 5); Shield_ buckler = new Shield_("Buckler", 5, 1); Armor_ chainmail = new Armor_("Chainmail", 15, 3); Item_ item = null; Debug.ClearDeveloperConsole(); Debug.Log("Add Item"); Debug.Log("==========="); Debug.Log("1- Longsword"); Debug.Log("2- Greatsword"); Debug.Log("3- Buckler"); Debug.Log("4- Chainmail"); Debug.Log("0- Exit"); string itemId = respuesta; switch (itemId) { case "1": item = longsword; break; case "2": item = greatsword; break; case "3": item = buckler; break; case "4": item = chainmail; break; case "0": break; } if (item != null) { inventory.Add(item); } MainMenu(); }
public void RemoveItem(Item_ item) { storedItems.Remove(item); item.transform.parent = null; isOccupied = false; item.occupyingSlot = null; //UI Actions if (IsPlayer()) { GameObject itemIcon = slotUI.GetComponentsInChildren <Image>().ToList().Find(t => t.name == item.name + "(Clone)").gameObject; DestroyImmediate(itemIcon, true); } }
public void DropItem(Item_ item) { if (inventory_.IsInInventory(item))//Si el ítem está en alguna ranura del inventario { Slot_ oldSlot = item.occupyingSlot; oldSlot.RemoveItem(item); //Quitarlo de la ranura en que se encuentra inventory_.RefreshCurrentWeight(); //Rebajar el peso if (!item.graphics_.inGame_.gameObject.activeSelf) //Si la gráfica ingame no está activa { item.graphics_.inGame_.gameObject.SetActive(true); } item.graphics_.inGame_.animator.SetTrigger("isDropped");//Iniciar animación "isDropped" del ítem } }
public void UnequipItem(Item_ item) { if (IsEquipped(item))//Si el ítem está equipado { Slot_ oldSlot = item.occupyingSlot; oldSlot.RemoveItem(item); //Quitarlo de la ranura equipable genericSlot.AddItem(item); //Ponerlo en la ranura genérica ("almacenarlo") item.graphics_.inGame_.animator.SetTrigger("isStored"); //Dejar de mostrarlo } else//Si el ítem no está equipado { Debug.Log($"Item {item.name} isn't equipped. It isn't necessary unequip it."); } }
public static void Start() { ExecuteSavedQueries(); PulseTimer.Elapsed += new ElapsedEventHandler(Pulse); Character = new Character_(); Mastery = new Mastery_(); Item = new Item_(); Skill = new Skill_(); User = new User_(); if (PulseFlag) { PulseTimer.Start(); } Pulse(null, null); }
public void EquipItem(Item_ item) { if (inventory_.IsInInventory(item)) //Si el ítem ya está en alguna ranura del inventario { if (!inventory_.IsEquipped(item)) //Si el ítem no está equipado { Slot_ oldSlot = item.occupyingSlot; oldSlot.RemoveItem(item); //Quitarlo de la ranura en que se encontraba inventory_.slots.Find(t => t.slotType == item.equippableSlot).AddItem(item); //Ponerlo en la ranura capaz de equipar el ítem if (!item.graphics_.inGame_.gameObject.activeSelf) //Si la gráfica ingame no estaba activa { item.graphics_.inGame_.gameObject.SetActive(true); //...activarla } item.graphics_.inGame_.animator.SetTrigger("isEquipped"); //Equipar visualmente el ítem en el personaje (iniciar animación "isEquipped" del ítem) SyncAnimators(); } else//Si ya está equipado { Debug.Log($"Item {item.name} is already in the equippable slot. It is not necessary re-equip it."); } } else//Y si no está en el inventario { if (Vector3.Distance(item.transform.position, owner.transform.position) <= 1) { float itemWeight = ((ItemStats_)item.mechanics_.stats_).weight; if (inventory_.currentWeight + itemWeight <= inventory_.weightCapacity) //Si el jugador puede cargar con el peso adicional del ítem { inventory_.slots.Find(t => t.slotType == item.equippableSlot).AddItem(item); //Simplemente equiparlo (ponerlo en la ranura del inventario capaz de equipar el ítem) if (!item.graphics_.inGame_.gameObject.activeSelf) //Si la gráfica ingame no estaba activa { item.graphics_.inGame_.gameObject.SetActive(true); //...activarla } item.graphics_.inGame_.animator.SetTrigger("isEquipped"); //Equipar visualmente el ítem en el personaje (iniciar animación "isEquipped" del ítem) inventory_.RefreshCurrentWeight(); //Adicionar el peso del personaje al peso total llevado por el jugador SyncAnimators(); } else { Debug.Log($"{owner.name} can't equip item {item.name}, because his weight capacity would be exceeded."); } } else { Debug.Log($"{owner.name} can't equip item {item.name}, because it is too far ({Vector3.Distance(item.transform.position, owner.transform.position)} m)."); } } }
public void AddItem(Item_ item) { storedItems.Add(item); item.transform.parent = transform; item.transform.localPosition = Vector3.zero; isOccupied = true; item.occupyingSlot = this; //UI Actions GameObject itemIcon = ((ItemUi_)item.graphics_.ui).icon; itemIcon.name = item.name; if (IsPlayer()) { Instantiate(itemIcon, slotUI.transform); } }
public void StoreItem(Item_ item) { if (inventory_.IsInInventory(item)) //Si el ítem ya está en alguna ranura del inventario { if (!inventory_.IsStored(item)) //Si no está en la ranura genérica { if (inventory_.IsEquipped(item)) //Si está equipado { item.graphics_.inGame_.gameObject.SetActive(false); //No mostrarlo, ya que se "almacenará" o "guardará" (no debe quedar a la vista) } Slot_ oldSlot = item.occupyingSlot; oldSlot.RemoveItem(item); //Quitarlo de la ranura en que se encontraba inventory_.genericSlot.AddItem(item); //Ponerlo en la ranura genérica ("almacenarlo") } else//Y si ya está en la ranura genérica ("almacenado") { Debug.Log($"Item {item.name} is already in the generic slot. It isn't necessary re-store it."); } } else//Y si no está en el inventario { if (Vector3.Distance(item.transform.position, owner.transform.position) <= 1)//Si el objeto esta a lo más a un metro ingame de distancia { float itemWeight = ((ItemStats_)item.mechanics_.stats_).weight; if ((inventory_.currentWeight + itemWeight) <= inventory_.weightCapacity) //Si el jugador es capaz de llevar el peso adicional del ítem { inventory_.genericSlot.AddItem(item); //Simplemente ponerlo en la ranura genérica ("almacenarlo") inventory_.RefreshCurrentWeight(); //Adicionar el peso del ítem al peso total cargado por el jugador item.graphics_.inGame_.gameObject.SetActive(false); //No mostrarlo, ya que se "almacenará" o "guardará" (no debe quedar a la vista) } else { Debug.Log($"{owner.name} can't carry item {item.name}, because his weight capacity would be exceeded."); } } else { Debug.Log($"{owner.name} can't carry Item {item.name}, because it is too far ({Vector3.Distance(item.transform.position, owner.transform.position)} m)."); } } }
public async Task <ActionResult <NguoiDung_> > PostAccount([Bind(include: "UserName,Password")] Item_ item) { var TaiKhoan = await _context.Accounts .FirstOrDefaultAsync(m => (m.UserName == item.UserName) && (m.Password == item.Password)); if (TaiKhoan == null) { return(NotFound()); } var nguoiDung = new NguoiDung_() { Id = TaiKhoan.Id, Name = TaiKhoan.Name, UserName = TaiKhoan.UserName, Password = TaiKhoan.Password, Mail = TaiKhoan.Mail, Sdt = TaiKhoan.Sdt, Status = TaiKhoan.Status }; return(nguoiDung); }
public void ChangeItemSlot(Item_ item, Slot_ newSlot) { RemoveItem(item); newSlot.AddItem(item); }
private static void DumpFilesToItems(string path) { string[] lines = File.ReadAllLines(path); for (int i = 0; i < lines.Length; i++) { lines[i] = lines[i].Replace(".", ","); string[] tmpString = lines[i].Split('\t'); Item_ tmp = new Item_(); tmp.ITEM_TYPE = Convert.ToUInt32(tmpString[1]); tmp.ITEM_TYPE_NAME = tmpString[2]; tmp.ITEM_MALL = Convert.ToByte(tmpString[7]); tmp.CLASS_A = Convert.ToByte(tmpString[10]); tmp.CLASS_B = Convert.ToByte(tmpString[11]); tmp.CLASS_C = Convert.ToByte(tmpString[12]); tmp.RACE = Convert.ToByte(tmpString[14]); tmp.SHOP_PRICE = Convert.ToUInt64(tmpString[26]); tmp.MIN_REPAIR = Convert.ToUInt16(tmpString[27]); tmp.MAX_REPAIR = Convert.ToUInt16(tmpString[28]); tmp.STORE_PRICE = Convert.ToUInt64(tmpString[30]); tmp.SELL_PRICE = Convert.ToUInt64(tmpString[31]); tmp.LV_REQ = Convert.ToByte(tmpString[33]); tmp.REQ1 = Convert.ToInt32(tmpString[34]); tmp.REQ1_LV = Convert.ToByte(tmpString[35]); tmp.REQ2 = Convert.ToInt32(tmpString[36]); tmp.REQ2_LV = Convert.ToByte(tmpString[37]); tmp.REQ3 = Convert.ToInt32(tmpString[38]); tmp.REQ3_LV = Convert.ToByte(tmpString[39]); tmp.MAX_POSSES = Convert.ToInt32(tmpString[40]); tmp.MAX_STACK = Convert.ToUInt16(tmpString[57]); tmp.GENDER = Convert.ToByte(tmpString[58]); tmp.MIN_DURA = Convert.ToSingle(tmpString[63]); tmp.MAX_DURA = Convert.ToSingle(tmpString[64]); tmp.MIN_PHYSDEF = Convert.ToDouble(tmpString[65]); tmp.MAX_PHYSDEF = Convert.ToDouble(tmpString[66]); tmp.PHYSDEF_INC = Convert.ToDouble(tmpString[67]); tmp.MIN_PARRY = Convert.ToSingle(tmpString[68]); tmp.MAX_PARRY = Convert.ToSingle(tmpString[69]); tmp.MIN_ABSORB = Convert.ToDouble(tmpString[70]); tmp.MAX_ABSORB = Convert.ToDouble(tmpString[71]); tmp.ABSORB_INC = Convert.ToDouble(tmpString[72]); tmp.MIN_BLOCK = Convert.ToSingle(tmpString[73]); tmp.MAX_BLOCK = Convert.ToSingle(tmpString[74]); tmp.MAGDEF_MIN = Convert.ToDouble(tmpString[75]); tmp.MAGDEF_MAX = Convert.ToDouble(tmpString[76]); tmp.MAGDEF_INC = Convert.ToDouble(tmpString[77]); tmp.MIN_APHYS_REINFORCE = Convert.ToSingle(tmpString[78]); tmp.MAX_APHYS_REINFORCE = Convert.ToSingle(tmpString[79]); tmp.MIN_AMAG_REINFORCE = Convert.ToSingle(tmpString[80]); tmp.MAX_AMAG_REINFORCE = Convert.ToSingle(tmpString[81]); tmp.ATTACK_DISTANCE = Convert.ToSingle(tmpString[94]); tmp.MIN_LPHYATK = Convert.ToDouble(tmpString[95]); tmp.MAX_LPHYATK = Convert.ToDouble(tmpString[96]); tmp.MIN_HPHYATK = Convert.ToDouble(tmpString[97]); tmp.MAX_HPHYATK = Convert.ToDouble(tmpString[99]); tmp.PHYATK_INC = Convert.ToDouble(tmpString[100]); tmp.MIN_LMAGATK = Convert.ToDouble(tmpString[101]); tmp.MAX_LMAGATK = Convert.ToDouble(tmpString[102]); tmp.MIN_HMAGATK = Convert.ToDouble(tmpString[103]); tmp.MAX_HMAGATK = Convert.ToDouble(tmpString[104]); tmp.MAGATK_INC = Convert.ToDouble(tmpString[105]); tmp.MIN_LPHYS_REINFORCE = Convert.ToSingle(tmpString[106]); tmp.MAX_LPHYS_REINFORCE = Convert.ToSingle(tmpString[107]); tmp.MIN_HPHYS_REINFORCE = Convert.ToSingle(tmpString[108]); tmp.MAX_HPHYS_REINFORCE = Convert.ToSingle(tmpString[109]); tmp.MIN_LMAG_REINFORCE = Convert.ToSingle(tmpString[110]); tmp.MAX_LMAG_REINFORCE = Convert.ToSingle(tmpString[111]); tmp.MIN_HMAG_REINFORCE = Convert.ToSingle(tmpString[112]); tmp.MAX_HMAG_REINFORCE = Convert.ToSingle(tmpString[113]); tmp.MIN_ATTACK_RATING = Convert.ToSingle(tmpString[114]); tmp.MAX_ATTACK_RATING = Convert.ToSingle(tmpString[115]); tmp.MIN_CRITICAL = Convert.ToSingle(tmpString[116]); tmp.MAX_CRITICAL = Convert.ToSingle(tmpString[117]); tmp.USE_TIME = Convert.ToInt32(tmpString[118]); tmp.USE_TIME2 = Convert.ToInt32(tmpString[120]); tmp.USE_TIME3 = Convert.ToInt32(tmpString[122]); tmp.USE_TIME4 = Convert.ToInt32(tmpString[124]); Items.Add(tmp); } }
public void EquipSelectedItem() { Item_ selectedItem = bottomUi.currentSelectedObject.GetComponent <Item_>(); EquipItem(selectedItem); }
public void StoreSelectedItem() { Item_ selectedItem = bottomUi.currentSelectedObject.GetComponent <Item_>(); StoreItem(selectedItem); }
public bool IsInInventory(Item_ item) { return(item.occupyingSlot != null); }
public static void Start() { ExecuteSavedQueries(); PulseTimer.Elapsed += new ElapsedEventHandler(Pulse); Character = new Character_(); Mastery = new Mastery_(); Item = new Item_(); Skill = new Skill_(); User = new User_(); if (PulseFlag) PulseTimer.Start(); Pulse(null, null); }
public void Add(Item_ item) { _slots.Add(item); }