public bool MasterForbidsPickup(ItemCheck check) { ItemType type = ItemType.Nothing; if (check.Info.Effect == ItemEffect.ItemPart && check.Item.Stats[Stat.ItemIndex] > 0) { type = SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).ItemType; if (type == ItemType.Book) { return(CompanionOwner.CompanionForbiddenItems.Contains(Tuple.Create(type, SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).RequiredClass)) || (CompanionOwner.CompanionForbiddenGrades.Contains(SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).Rarity))); } else { return(CompanionOwner.CompanionForbiddenItems.Contains(Tuple.Create(type, RequiredClass.None)) || (check.Info.Effect != ItemEffect.Gold && CompanionOwner.CompanionForbiddenGrades.Contains(SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).Rarity))); } } type = check.Info.ItemType; if (type == ItemType.Book) { return(CompanionOwner.CompanionForbiddenItems.Contains(Tuple.Create(check.Info.ItemType, check.Info.RequiredClass)) || (check.Info.Effect != ItemEffect.Gold && CompanionOwner.CompanionForbiddenGrades.Contains(check.Info.Rarity))); } else { return(CompanionOwner.CompanionForbiddenItems.Contains(Tuple.Create(check.Info.ItemType, RequiredClass.None)) || (check.Info.Effect != ItemEffect.Gold && CompanionOwner.CompanionForbiddenGrades.Contains(check.Info.Rarity))); } }
public CheckedListBoxControl() { InitializeComponent(); listView1.ItemSelectionChanged += (sender, args) => { ItemCheck?.Invoke(this, new ItemCheckEventArgs(args.ItemIndex, CheckState.Checked, CheckState.Unchecked)); }; }
private void InitBlockCheck() { itemChecks = new List <ItemCheck>(); for (int i = 0; i < arrayLeft.Length; i++) { ItemCheck itemCheck = Instantiate(prefabCheck, rectCheck); itemCheck.SetIndex(i); itemChecks.Add(itemCheck); } }
public async Task <ActionResult <InventoryReportWithItems> > StartInventory() { User user = await database.Users.FirstOrDefaultAsync(r => r.Username == User.Identity.Name); if (user == null) { return(NotFound()); } var inventoryReport = new InventoryReport { OrganizationId = user.OrganizationId, StartInventory = DateTime.Now, EndInventory = false }; database.InventoryReports.Add(inventoryReport); await database.SaveChangesAsync(); var inventoryReportWithItems = new InventoryReportWithItems(inventoryReport); var items = database.Items.Where(r => r.OrganizationId == inventoryReport.OrganizationId && r.Status != "Списан"); var checkitems = new List <ItemCheck>(); foreach (var item in items) { var checkItem = new ItemCheck { InventoryNumber = item.InventoryNumber, Description = item.Description, InventoryReportId = inventoryReport.Id, RoomId = item.RoomId, UserId = item.UserId, Name = item.Name, Status = item.Status, Cost = item.Cost, Check = false }; database.ItemsCheck.Add(checkItem); checkitems.Add(checkItem); } await database.SaveChangesAsync(); inventoryReportWithItems.Items = checkitems; return(inventoryReportWithItems); }
// Use this for initialization void Start() { healthPotion = GameObject.Find("Health Potion").GetComponent <ItemCheck>(); enragePotion = GameObject.Find("Enrage Potion").GetComponent <ItemCheck>(); m_GodHandler = this.GetComponentInParent <GodHandler>().God; // Listener for the gold change m_GodHandler.onGoldChange += ReactToChange; if (item) { item.SetValues(this.gameObject, m_GodHandler); } EnableItems(); }
private void item_CheckStateChanged(object sender, EventArgs e) { if (!_handleEvents || (!(sender is CheckBox))) { return; } var checkBox = (CheckBox)sender; if ((checkBox.Tag is InternalItem) && checkBox.Enabled) { var item = (InternalItem)checkBox.Tag; ItemCheckEventArgs eventArgs; int itemIndex = _itemList.IndexOf(item); if (checkBox.CheckState == CheckState.Checked) { eventArgs = new ItemCheckEventArgs( itemIndex, CheckState.Checked, CheckState.Unchecked); } else { eventArgs = new ItemCheckEventArgs( itemIndex, CheckState.Unchecked, CheckState.Checked); } if (ItemCheck != null) { try { _handleEvents = false; ItemCheck.Invoke(this, eventArgs); // Note: client might changed NewValue: checkBox.CheckState = eventArgs.NewValue; } finally { _handleEvents = true; } } } }
public bool FilterCompanionPicks(ItemCheck check) { if (check.Info.ItemName == "Gold") { return(true); } ItemType itemType; Rarity itemRarity; RequiredClass itemClass; List <string> listClass = CompanionOwner.FiltersClass.Split(',').ToList(); List <string> listRarity = CompanionOwner.FiltersRarity.Split(',').ToList(); List <string> listType = CompanionOwner.FiltersItemType.Split(',').ToList(); bool hasFilterType, hasRarity, hasClass; hasFilterType = true; hasClass = true; hasRarity = true; if (check.Info.Effect == ItemEffect.ItemPart && check.Item.Stats[Stat.ItemIndex] > 0) { itemType = SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).ItemType; itemRarity = SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).Rarity; itemClass = SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).RequiredClass; } else { itemType = check.Info.ItemType; itemRarity = check.Info.Rarity; itemClass = check.Info.RequiredClass; } if (listType.Count > 0) { hasFilterType = listType.Contains(itemType.ToString()); } if (listRarity.Count > 0) { hasRarity = listRarity.Contains(itemRarity.ToString()); } if (listClass.Count > 0) { hasClass = itemClass == RequiredClass.All || listClass.Contains(itemClass.ToString()); } return(hasFilterType && hasRarity && hasClass); }
private void listBox_ItemCheck(object sender, ItemCheckEventArgs e) { if (!manuallyFired) { // Force the update of the checkeditems try { manuallyFired = true; SetItemCheckState(e.Index, e.NewValue); } finally { manuallyFired = false; } // Update the combobox's text displayText = GetTextValue(); Invalidate(); ItemCheck?.Invoke(sender, e); } }
internal void OnItemCheck(object sender, ItemCheckEventArgs e) { ItemCheck?.Invoke(sender, e); }
public override void ProcessSearch() { if (!CanMove || SEnvir.Now < SearchTime) { return; } int bestDistance = int.MaxValue; List <ItemObject> closest = new List <ItemObject>(); foreach (MapObject ob in CompanionOwner.VisibleObjects) { if (ob.Race != ObjectType.Item) { continue; } int distance = Functions.Distance(ob.CurrentLocation, CurrentLocation); if (distance > ViewRange) { continue; } if (distance > bestDistance) { continue; } ItemObject item = (ItemObject)ob; if (item.Account != CompanionOwner.Character.Account || !item.MonsterDrop) { continue; } long amount = 0; if (item.Item.Info.Effect == ItemEffect.Gold && item.Account.GuildMember != null && item.Account.GuildMember.Guild.GuildTax > 0) { amount = (long)Math.Ceiling(item.Item.Count * item.Account.GuildMember.Guild.GuildTax); } ItemCheck check = new ItemCheck(item.Item, item.Item.Count - amount, item.Item.Flags, item.Item.ExpireTime); if (!CanGainItems(true, check)) { continue; } if (distance != bestDistance) { closest.Clear(); } closest.Add(item); bestDistance = distance; } if (closest.Count == 0) { SearchTime = SEnvir.Now.AddSeconds(10); return; } TargetItem = closest[SEnvir.Random.Next(closest.Count)]; }
public override bool TakeAction() { var package = UserItemPackage.Get(Uid); var userItemList = package.ItemPackage.FindAll(m => !m.IsRemove && m.UserItemID.Equals(_userItemId)); if (userItemList.Count == 0) { return(false); } //原因:卖出装备,装备上有灵件时提示 int currNum = ContextUser.SparePartList.FindAll(m => m.UserItemID.Equals(_userItemId)).Count; if (currNum > 0) { ErrorCode = LanguageManager.GetLang().ErrorCode; ErrorInfo = LanguageManager.GetLang().St7006_UserItemHaveSpare; return(false); } foreach (var userItem in userItemList) { if (ItemCheck.check(_userItemId)) { continue; } if (userItem.ItemStatus == ItemStatus.Sell) { package.RemoveItem(userItem); continue; } if (userItem.ItemStatus != ItemStatus.Sell && userItem.SoldDate > MathUtils.SqlMinDate) { userItem.SoldDate = MathUtils.SqlMinDate; //package.Update(); continue; } ItemBaseInfo itemInfo = new ConfigCacheSet <ItemBaseInfo>().FindKey(userItem.ItemID); if (itemInfo != null) { int salePrice; if (itemInfo.ItemType == ItemType.ZhuangBei) { salePrice = UserHelper.StrongEquPayPrice(Uid, userItem.UserItemID); } else { salePrice = (itemInfo.SalePrice * userItem.Num); } _salePrice = salePrice; if (userItem.ItemStatus != ItemStatus.Sell) { ItemCheck.add(_userItemId); UserItemHelper.AddItemLog(ContextUser.UserID, userItem.ItemID, userItem.Num, userItem.ItemLv, 3, userItem.UserItemID); //package.RemoveItem(userItem); package.ItemPackage.Remove(userItem); ContextUser.GameCoin = MathUtils.Addition(ContextUser.GameCoin, salePrice, int.MaxValue); //ContextUser.Update(); } } } return(true); }
/// <summary> /// Trigger the ItemCheck event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnItemCheck(object sender, ItemCheckEventArgs e) => ItemCheck?.Invoke(this, e);
/// <summary> /// check the line item /// </summary> public void CheckOnItem() { ItemCheck.Click(); }
protected virtual void OnItemCheck(ItemCheckEventArgs e) => ItemCheck?.Invoke(this, e);
public bool FilterCompanionPicks(ItemCheck check) { if (check.Info.ItemName == "Gold") { return(true); } ItemType itemType; Rarity itemRarity; RequiredClass itemClass; List <string> allClasses = new List <string>(); List <string> listClass; List <string> listRarity; List <string> listType; bool hasFilterType, hasRarity, hasClass; if (CompanionOwner.FiltersClass.Trim() != String.Empty) { listClass = CompanionOwner.FiltersClass.Split(',').ToList(); } else { listClass = new List <string>(); } if (CompanionOwner.FiltersRarity.Trim() != String.Empty) { listRarity = CompanionOwner.FiltersRarity.Split(',').ToList(); } else { listRarity = new List <string>(); } if (CompanionOwner.FiltersItemType.Trim() != String.Empty) { listType = CompanionOwner.FiltersItemType.Split(',').ToList(); } else { listType = new List <string>(); } hasFilterType = true; hasClass = true; hasRarity = true; if (check.Info.Effect == ItemEffect.ItemPart && check.Item.Stats[Stat.ItemIndex] > 0) { itemType = SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).ItemType; itemRarity = SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).Rarity; itemClass = SEnvir.ItemInfoList.Binding.First(x => x.Index == check.Item.Stats[Stat.ItemIndex]).RequiredClass; } else { itemType = check.Info.ItemType; itemRarity = check.Info.Rarity; itemClass = check.Info.RequiredClass; } if (listType.Count > 0) { hasFilterType = listType.Contains(itemType.ToString()); } if (listRarity.Count > 0) { hasRarity = listRarity.Contains(itemRarity.ToString()); } if (listClass.Count > 0) { switch (itemClass) { case RequiredClass.All: allClasses.Add(RequiredClass.Assassin.ToString()); allClasses.Add(RequiredClass.Warrior.ToString()); allClasses.Add(RequiredClass.Wizard.ToString()); allClasses.Add(RequiredClass.Taoist.ToString()); break; case RequiredClass.WarWizTao: allClasses.Add(RequiredClass.Warrior.ToString()); allClasses.Add(RequiredClass.Wizard.ToString()); allClasses.Add(RequiredClass.Taoist.ToString()); break; case RequiredClass.AssWar: allClasses.Add(RequiredClass.Assassin.ToString()); allClasses.Add(RequiredClass.Warrior.ToString()); break; case RequiredClass.WizTao: allClasses.Add(RequiredClass.Wizard.ToString()); allClasses.Add(RequiredClass.Taoist.ToString()); break; default: allClasses.Add(itemClass.ToString()); break; } List <string> intersect = listClass.Intersect(allClasses).ToList(); hasClass = intersect.Count > 0; } return(hasFilterType && hasRarity && hasClass); }