/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="currentTab">The selected tab.</param> /// <param name="sortBy">How to sort items.</param> /// <param name="quality">The item quality to display.</param> /// <param name="search">The search term to prepopulate.</param> /// <param name="i18n">Provides translations for the mod.</param> /// <param name="itemRepository">Provides methods for searching and constructing items.</param> public ItemMenu(MenuTab currentTab, ItemSort sortBy, ItemQuality quality, string search, ITranslationHelper i18n, ItemRepository itemRepository) : base(null, true, true, 0, -50) { // initialise this.TranslationHelper = i18n; this.ItemRepository = itemRepository; this.MovePosition(110, Game1.viewport.Height / 2 - (650 + IClickableMenu.borderWidth * 2) / 2); this.CurrentTab = currentTab; this.SortBy = sortBy; this.Quality = quality; this.SpawnableItems = this.ItemRepository.GetFiltered().Select(p => p.Item).ToArray(); this.AllowRightClick = true; // create search box int textWidth = Game1.tileSize * 8; this.Textbox = new TextBox(null, null, Game1.dialogueFont, Game1.textColor) { X = this.xPositionOnScreen + (this.width / 2) - (textWidth / 2) - Game1.tileSize + 32, Y = this.yPositionOnScreen + (this.height / 2) + Game1.tileSize * 2 + 40, Width = textWidth, Height = Game1.tileSize * 3, Selected = false, Text = search }; Game1.keyboardDispatcher.Subscriber = this.Textbox; this.TextboxBounds = new Rectangle(this.Textbox.X, this.Textbox.Y, this.Textbox.Width, this.Textbox.Height / 3); // create buttons this.Title = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize, this.yPositionOnScreen - Game1.tileSize * 2, Game1.tileSize * 4, Game1.tileSize), i18n.Get("title")); this.QualityButton = new ClickableComponent(new Rectangle(this.xPositionOnScreen, this.yPositionOnScreen - Game1.tileSize * 2 + 10, (int)Game1.smallFont.MeasureString(i18n.Get("labels.quality")).X, Game1.tileSize), i18n.Get("labels.quality")); this.SortButton = new ClickableComponent(new Rectangle(this.xPositionOnScreen + this.QualityButton.bounds.Width + 40, this.yPositionOnScreen - Game1.tileSize * 2 + 10, Game1.tileSize * 4, Game1.tileSize), this.GetSortLabel(sortBy)); this.UpArrow = new ClickableTextureComponent("up-arrow", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize / 2, this.yPositionOnScreen - Game1.tileSize, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 459, 11, 12), Game1.pixelZoom); this.DownArrow = new ClickableTextureComponent("down-arrow", new Rectangle(this.xPositionOnScreen + this.width - Game1.tileSize / 2, this.yPositionOnScreen + this.height / 2 - Game1.tileSize * 2, 11 * Game1.pixelZoom, 12 * Game1.pixelZoom), "", "", Game1.mouseCursors, new Rectangle(421, 472, 11, 12), Game1.pixelZoom); // create tabs { int i = -1; int x = (int)(this.xPositionOnScreen - Game1.tileSize * 5.3f); int y = this.yPositionOnScreen + 10; int lblHeight = (int)(Game1.tileSize * 0.9F); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.All.ToString(), i18n.Get("tabs.all"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ToolsAndEquipment.ToString(), i18n.Get("tabs.equipment"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.SeedsAndCrops.ToString(), i18n.Get("tabs.crops"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.FishAndBaitAndTrash.ToString(), i18n.Get("tabs.fishing"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ForageAndFruits.ToString(), i18n.Get("tabs.forage"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ArtifactsAndMinerals.ToString(), i18n.Get("tabs.artifacts-and-minerals"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ResourcesAndCrafting.ToString(), i18n.Get("tabs.resources-and-crafting"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.ArtisanAndCooking.ToString(), i18n.Get("tabs.artisan-and-cooking"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.AnimalAndMonster.ToString(), i18n.Get("tabs.animal-and-monster"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i++, Game1.tileSize * 5, Game1.tileSize), MenuTab.Decorating.ToString(), i18n.Get("tabs.decorating"))); this.Tabs.Add(new ClickableComponent(new Rectangle(x, y + lblHeight * i, Game1.tileSize * 5, Game1.tileSize), MenuTab.Misc.ToString(), i18n.Get("tabs.miscellaneous"))); } // load items this.LoadInventory(this.SpawnableItems); }
/********* ** Public methods *********/ /// <summary>Get the next sort option.</summary> /// <param name="current">The current sort value.</param> public static ItemSort GetNext(this ItemSort current) { return(current switch { ItemSort.DisplayName => ItemSort.Category, ItemSort.Category => ItemSort.ID, ItemSort.ID => ItemSort.DisplayName, _ => throw new NotSupportedException($"Unknown sort '{current}'.") });
// // GET: /Trade/ public ActionResult List(ItemType category, ItemSort sort, SexType sex, PriceRange range, int age) { ViewBag.ItemType = category; ViewBag.ItemSort = sort; ViewBag.SexType = sex; ViewBag.Age = age; ViewBag.PriceRange = range; return(View("~/Views/Trade/Index.cshtml", GetGoods(0, 20, category, sort, range, sex, age).Data)); }
private static void SortStashEventHandler(object sender, RoutedEventArgs e) { try { ItemSort.SortStash(); } catch (Exception ex) { Logger.LogError("Error dropping legendaries:" + ex); } }
//获取所有宝贝列表 public AdvancedResult <PageEntity <ProProduct> > LoadBBList(ItemType bbType, ItemSort bbSort, PriceRange bbRange, SexType sex, int age, int pageSize, int pageIndex) { AdvancedResult <PageEntity <ProProduct> > result = new AdvancedResult <PageEntity <ProProduct> >(); PageEntity <ProProduct> bblist = new PageEntity <ProProduct>(); bblist = ProProductAccessor.Instance.Search(age, bbType, bbSort, bbRange, sex, pageIndex, pageSize); result.Data = bblist; result.Error = AppError.ERROR_SUCCESS; return(result); }
private static void SortBackEventHandler(object sender, RoutedEventArgs e) { try { ItemSort.SortBackpack(); } catch (Exception ex) { Logger.LogError("Error sorting backpack:" + ex); } }
/********* ** Public methods *********/ /// <summary>Get the next sort option.</summary> /// <param name="current">The current sort value.</param> public static ItemSort GetNext(this ItemSort current) { switch (current) { case ItemSort.DisplayName: return(ItemSort.Category); case ItemSort.Category: return(ItemSort.ID); case ItemSort.ID: return(ItemSort.DisplayName); default: throw new NotSupportedException($"Unknown sort '{current}'."); } }
/// <summary>Handle a left-click by the player.</summary> /// <param name="x">The X-position of the cursor.</param> /// <param name="y">The Y-position of the cursor.</param> /// <param name="playSound">Whether to play interaction sounds.</param> /// <returns>Whether the event has been handled and shouldn't be propagated further.</returns> public override void receiveLeftClick(int x, int y, bool playSound = true) { // allow trashing any item if (this.trashCan.containsPoint(x, y) && this.heldItem != null) { Utility.trashItem(this.heldItem); this.heldItem = null; } // sort button else if (this.SortButton.bounds.Contains(x, y)) { this.SortBy = this.SortBy.GetNext(); this.SortButton.label = this.SortButton.name = this.GetSortLabel(this.SortBy); this.ResetItemView(rebuild: true); } // quality button else if (this.QualityButton.bounds.Contains(x, y)) { this.Quality = this.Quality.GetNext(); this.ResetItemView(); } // scroll buttons else if (this.UpArrow.bounds.Contains(x, y)) { this.receiveScrollWheelAction(1); } else if (this.DownArrow.bounds.Contains(x, y)) { this.receiveScrollWheelAction(-1); } // category dropdown else if (this.CategoryDropdown.TryClick(x, y, out bool itemClicked, out bool dropdownToggled)) { if (dropdownToggled) { this.SetDropdown(this.CategoryDropdown.IsExpanded); } if (itemClicked) { this.SetCategory(this.CategoryDropdown.Selected); } }
public JsonResult AjaxGetGoods() { ItemType itemType = ItemType.Ignore; SexType sexType = SexType.Ignore; ItemSort itemSort = ItemSort.Ignore; PriceRange priceRange = PriceRange.Ignore; int age = 0; int pageSize = 20; int pageIndex = 0; Enum.TryParse <ItemType>(Request["itemType"], out itemType); Enum.TryParse <SexType>(Request["sexType"], out sexType); Enum.TryParse <ItemSort>(Request["itemSort"], out itemSort); Enum.TryParse <PriceRange>(Request["priceRange"], out priceRange); int.TryParse(Request["age"], out age); int.TryParse(Request["page"], out pageIndex); return(Json(GetGoods(pageIndex, pageSize, itemType, itemSort, priceRange, sexType, age), JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> Collection(int Id, ItemSort sortOrder = ItemSort.IdAsc) { User user_2; string role = null; string username = null; Collection collection = await db.Collections.FindAsync(Id); username = collection.UserName; if (User.Identity.Name != null) { user_2 = await _userManager.FindByNameAsync(User.Identity.Name); role = user_2.Role; } if (collection != null) { IQueryable <Item> items = db.Items.Include(x => x); ViewData["IdSort"] = sortOrder == ItemSort.IdAsc ? ItemSort.IdDesc : ItemSort.IdAsc; ViewData["NameSort"] = sortOrder == ItemSort.NameAsc ? ItemSort.NameDesc : ItemSort.NameAsc; ViewData["TextSort"] = sortOrder == ItemSort.TextAsc ? ItemSort.TextDesc : ItemSort.TextAsc; items = sortOrder switch { ItemSort.IdDesc => items.OrderByDescending(s => s.Id), ItemSort.NameAsc => items.OrderBy(s => s.ItemName), ItemSort.NameDesc => items.OrderByDescending(s => s.ItemName), ItemSort.TextAsc => items.OrderBy(s => s.Text), ItemSort.TextDesc => items.OrderByDescending(s => s.Text), _ => items.OrderBy(s => s.Id), }; CollectionViewModel model = new CollectionViewModel { collection = collection, CollectionId = collection.Id, Items = await items.AsNoTracking().ToListAsync(), Role_2 = role, UserName = username, }; return(View(model)); } return(NotFound()); }
/// <summary> /// 根据年龄,宝贝类型(小类),宝贝分类(大类),性别查询宝贝列表 /// <param name="pageIndex">当前页</param> /// <para>索引从0开始</para> /// <param name="pageSize">每页记录条数</param> /// <para>记录数必须大于0</para> /// </summary> public PageEntity <ProProduct> Search(Int32 MaxAge, ItemType bbType, ItemSort bbSort, PriceRange bbRange, SexType sex, int pageIndex, int pageSize) { PageEntity <ProProduct> returnValue = new PageEntity <ProProduct>(); List <ProProduct> bblist = new List <ProProduct>(); MySqlConnection oc = ConnectManager.Create(); MySqlCommand _cmdLoadBB = cmdLoadBB.Clone() as MySqlCommand; MySqlCommand _cmdGetBBCount = cmdGetBBCount.Clone() as MySqlCommand; _cmdLoadBB.Connection = oc; _cmdGetBBCount.Connection = oc; try { _cmdLoadBB.Parameters["@PageIndex"].Value = pageIndex * pageSize; _cmdLoadBB.Parameters["@PageSize"].Value = (pageIndex + 1) * pageSize; _cmdLoadBB.Parameters["@bbType"].Value = (int)bbType; _cmdLoadBB.Parameters["@bbSort"].Value = (int)bbSort; _cmdLoadBB.Parameters["@Sex"].Value = (int)sex; string PriceRangeSql = string.Empty; switch (bbRange) { case PriceRange.Ignore: PriceRangeSql = " "; break; case PriceRange.TenZone: PriceRangeSql = "and price>=0 and price<=10 "; break; case PriceRange.HundredZone: PriceRangeSql = "and price>=10 and price<=100"; break; default: break; } if (MaxAge > 0) { _cmdLoadBB.CommandText = string.Format(_cmdLoadBB.CommandText, " and " + MaxAge + " >= min_age and " + MaxAge + "<= max_age ", PriceRangeSql); } else { _cmdLoadBB.CommandText = string.Format(_cmdLoadBB.CommandText, " ", PriceRangeSql); } _cmdGetBBCount.Parameters["@bbType"].Value = (int)bbType; _cmdGetBBCount.Parameters["@bbSort"].Value = (int)bbSort; _cmdGetBBCount.Parameters["@Sex"].Value = (int)sex; if (MaxAge > 0) { _cmdGetBBCount.CommandText = string.Format(_cmdGetBBCount.CommandText, " and " + MaxAge + " >= min_age and " + MaxAge + "<= max_age ", PriceRangeSql); } else { _cmdGetBBCount.CommandText = string.Format(_cmdGetBBCount.CommandText, " ", PriceRangeSql); } if (oc.State == ConnectionState.Closed) { oc.Open(); } MySqlDataReader reader = _cmdLoadBB.ExecuteReader(); while (reader.Read()) { bblist.Add(new ProProduct().BuildSampleEntity(reader)); } reader.Close(); for (int i = 0; i < bblist.Count; i++) { List <ResPic> returnValue_item = new List <ResPic>(); returnValue_item = ResPicAccessor.Instance.Search(bblist[i].Pid, PicType.BBPicture); bblist[i].pics = returnValue_item; } returnValue.Items = bblist; returnValue.PageIndex = pageIndex; returnValue.PageSize = pageSize; returnValue.RecordsCount = Convert.ToInt32(_cmdGetBBCount.ExecuteScalar()); } finally { oc.Close(); oc.Dispose(); oc = null; _cmdLoadBB.Dispose(); _cmdLoadBB = null; _cmdGetBBCount.Dispose(); _cmdGetBBCount = null; GC.Collect(); } return(returnValue); }
public static string GeneratParamUrl(RouteValueDictionary requestValues, RouteValueDictionary values) { StringBuilder path = new StringBuilder(); ItemSort itemSort = ItemSort.Ignore; RouteHepler.ParseRouteValue <ItemSort>(requestValues, values, "sort", out itemSort, itemSort); switch (itemSort) { case ItemSort.AboutBaby: path.Append("aboutbaby"); break; case ItemSort.AboutMother: path.Append("Aboutmother"); break; default: break; } ItemType itemType = ItemType.Ignore; RouteHepler.ParseRouteValue <ItemType>(requestValues, values, "category", out itemType, itemType); switch (itemType) { case ItemType.Clothes: path.Append("-clothes"); break; case ItemType.Toys: path.Append("-toys"); break; case ItemType.Cots: path.Append("-cots"); break; case ItemType.Others: path.Append("-others"); break; default: break; } PriceRange priceRange = PriceRange.Ignore; RouteHepler.ParseRouteValue <PriceRange>(requestValues, values, "range", out priceRange, priceRange); switch (priceRange) { case PriceRange.TenZone: path.Append("-tenzone"); break; case PriceRange.HundredZone: path.Append("-hundredzone"); break; default: break; } SexType sexType = SexType.Ignore; RouteHepler.ParseRouteValue <SexType>(requestValues, values, "sex", out sexType, sexType); switch (sexType) { case SexType.Man: path.Append("-男孩"); break; case SexType.Woman: path.Append("-女孩"); break; } int age = 0; RouteHepler.ParseRouteValue <int>(requestValues, values, "age", out age, age); switch (age) { case 1: path.Append("-0-1岁"); break; case 2: path.Append("-2岁"); break; case 3: path.Append("-3岁"); break; case 4: path.Append("-4岁"); break; } return(path.ToString()); }
private AdvancedResult <List <ProductModel> > GetGoods(int pageIndex, int pageSize, ItemType itemType, ItemSort itemSort, PriceRange bbRange, SexType sexType, int age) { ProductServiceClient client = new ProductServiceClient(); AdvancedResult <PageEntity <ProProduct> > response = client.LoadBBList(itemType, itemSort, bbRange, sexType, age, pageSize, pageIndex); List <ProductModel> items = new List <ProductModel>(); if (response.Error == DataStructure.AppError.ERROR_SUCCESS) { response.Data.Items = response.Data.Items ?? new List <ProProduct>(); ViewModelBindOption bindOptions = ViewModelBindOption.DefalutBindOption; bindOptions.ProductBindType = bindOptions.ProductBindType | ProductBindType.ReplyCount | ProductBindType.Pics; bindOptions.BindProductPicsCount = 1; foreach (var p in response.Data.Items) { items.Add(new ProductModel().Bind(p, bindOptions)); } } AdvancedResult <List <ProductModel> > result = new AdvancedResult <List <ProductModel> >(); result.Error = response.Error; result.ErrorMessage = response.ErrorMessage; result.ExMessage = response.ExMessage; result.Data = items; return(result); }
public override void OnInspectorGUI() { DrawDefaultInspector(); EditorGUILayout.BeginHorizontal(); if (createItem == null) { createItem = (CreateItem)EditorGUILayout.ObjectField("Create Item", createItem, typeof(CreateItem), true); } if (createItem != null) { if (createItem.ShowMe) { GUILayout.Label("SHOWING"); }else { GUILayout.Label("HIDING"); } } EditorGUILayout.EndHorizontal(); CreateItem createItemScript = (CreateItem)target; Item item = new Item(); GUILayout.Box(message); if (itemSort == ItemSort.Weapon) { if (GUILayout.Button("Switch to Create Armor")) { itemSort = ItemSort.Armor; } GUILayout.Label("Weapon Name"); weaponName = GUILayout.TextField(weaponName); GUILayout.Label("Physical Damage"); physicalDamage = EditorGUILayout.IntField(physicalDamage); GUILayout.Label("Magical Damage"); magicalDamage = EditorGUILayout.IntField(magicalDamage); GUILayout.Label("Weapon Attack Speed = " + attackSpeed.ToString("F2")); attackSpeed = GUILayout.HorizontalSlider(attackSpeed, 0.5f, 1.5f); //attackSpeed = GUILayout.TextField(attackSpeed); //attackSpeed = Regex.Replace(attackSpeed, "[^0-9]", ""); GUILayout.Label("Weapon Requirement Level"); itemLevel = EditorGUILayout.IntField(itemLevel); GUILayout.Label("Buy Value"); buyValue = EditorGUILayout.IntField(buyValue); if (GUILayout.Button("Selected Element : " + itemElement)) openElements = openElements == false ? true : false; if (openElements) { if (GUILayout.Button("Element : Normal")) itemElement = Item.ItemElement.Normal; if (GUILayout.Button("Element : Dark")) itemElement = Item.ItemElement.Dark; if (GUILayout.Button("Element : Earth")) itemElement = Item.ItemElement.Earth; if (GUILayout.Button("Element : Fire")) itemElement = Item.ItemElement.Fire; if (GUILayout.Button("Element : Frost")) itemElement = Item.ItemElement.Frost; if (GUILayout.Button("Element : Light")) itemElement = Item.ItemElement.Light; if (GUILayout.Button("Element : Lightning")) itemElement = Item.ItemElement.Lightning; if (GUILayout.Button("Element : Poison")) itemElement = Item.ItemElement.Poison; if (GUILayout.Button("Element : Silver")) itemElement = Item.ItemElement.Silver; if (GUILayout.Button("Element : Water")) itemElement = Item.ItemElement.Water; } if (GUILayout.Button("Create Weapon")) { if (weaponName != "" && (physicalDamage != 0 || magicalDamage != 0) && itemLevel != 0) { item.getItemName = weaponName; item.getItemAttackSpeed = Mathf.Floor(attackSpeed * 100) / 100; item.getItemLevel = itemLevel; item.getItemPhysicalDamage = physicalDamage; item.getItemMagicalDamage = magicalDamage; item.getItemBuyValue = buyValue; item.getItemSellValue = buyValue / 4; item.getItemElement = itemElement; item.itemClass = Item.ItemClass.Weapon; item.getItemEquipAble = true; weaponName = ""; attackSpeed = 1f; itemLevel = 0; physicalDamage = 0; magicalDamage = 0; buyValue = 0; itemElement = Item.ItemElement.Normal; createItemScript.CreateNewWeapons(item); message = ""; }else message = "Fill in all the fields!"; } }else if (itemSort == ItemSort.Armor) { if (GUILayout.Button("Switch to Create Weapon")) { itemSort = ItemSort.Weapon; } if (GUILayout.Button("BAG")) Debug.Log("SUP"); } }
public bool Add(Item item, bool isLogin = false) { ItemPosition pos = Calculations.GetItemPosition(item.Type); #region Sanity Checks if (!isLogin) { // Level check if (item.Itemtype.ReqLevel > m_pOwner.Level) { return(false); } // Profession check if (m_pOwner.Metempsychosis > 0 && m_pOwner.Level >= 70 && item.Itemtype.ReqLevel <= 70) { } else { if (item.Itemtype.ReqProfession > 0) { // item int iProfession = item.Itemtype.ReqProfession / 10; int iProfessionLevel = item.Itemtype.ReqProfession % 10; if (iProfession == 19) { iProfession = 10; } // user int uProfession = m_pOwner.Profession / 10; int uProfessionLevel = m_pOwner.Profession % 10; if (uProfession > 10 && iProfession == 10) { uProfession = 10; } if (iProfession == uProfession) { if (iProfessionLevel > uProfessionLevel) { return(false); } } else { return(false); } } // Attribute check if (item.Itemtype.ReqForce != 0 && item.Itemtype.ReqForce > m_pOwner.Strength) { return(false); } if (item.Itemtype.ReqSpeed != 0 && item.Itemtype.ReqSpeed > m_pOwner.Agility) { return(false); } if (item.Itemtype.ReqHealth != 0 && item.Itemtype.ReqHealth > m_pOwner.Vitality) { return(false); } if (item.Itemtype.ReqSoul != 0 && item.Itemtype.ReqSoul > m_pOwner.Spirit) { return(false); } ushort type = (ushort)(item.Type / 1000); if (pos == ItemPosition.RIGHT_HAND && !m_pOwner.WeaponSkill.Skills.ContainsKey(type) && item.Itemtype.ReqWeaponskill > 0) { return(false); } if (m_pOwner.WeaponSkill.Skills.ContainsKey(type)) { if (pos == ItemPosition.RIGHT_HAND && m_pOwner.WeaponSkill.Skills[type].Level < item.Itemtype.ReqWeaponskill) { return(false); } } if (type == 421 && item.Position < (ItemPosition)20 && Items.ContainsKey(ItemPosition.LEFT_HAND)) { m_pOwner.Send("Please remove the equipment in your left hand first."); return(false); } if (type == 900 && Items.ContainsKey(ItemPosition.RIGHT_HAND) && Items[ItemPosition.RIGHT_HAND].GetItemSubtype() == 421) { m_pOwner.Send("You cannot equip a shield while wearing a backsword."); return(false); } } // Gender check if (item.Itemtype.ReqSex != 0) { if (item.Itemtype.ReqSex != m_pOwner.Gender) { return(false); } } } ItemSort itemSort = item.GetSort(); if ((itemSort == ItemSort.ITEMSORT_USABLE || itemSort == ItemSort.ITEMSORT_USABLE2 || itemSort == ItemSort.ITEMSORT_USABLE3) && pos == ItemPosition.INVENTORY && item.Type / 1000 != 1050) { // Stores the item temporary data. m_pOwner.LastItemResource = 0; m_pOwner.LastUsedItem = item.Identity; m_pOwner.LastUsedItemTime = (uint)UnixTimestamp.Timestamp(); m_pOwner.LastUsedItemtype = item.Type; if ((item.Type >= 1000000 && item.Type < 1050000) || item.Type == 725065 || item.Type == 725066) // potion { if (!m_pOwner.IsAlive) { m_pOwner.Send(ServerString.STR_NOT_ALIVE); return(false); } if (item.Itemtype.Life > 0 && m_pOwner.QueryStatus(FlagInt.POISON_STAR) != null) { //m_pOwner.Send(ServerString.STR_CANT_HEAL_POISON_STAR); return(false); } if (item.Itemtype.Life > 0 && m_pOwner.Life >= m_pOwner.MaxLife) { //m_pOwner.Send(ServerString.STR_YOUR_LIFE_FULL); return(false); // return false so it wont spend processing recalculating the user stts } if (item.Itemtype.Mana > 0 && m_pOwner.Mana >= m_pOwner.MaxMana) { //m_pOwner.Send(ServerString.STR_YOUR_MANA_FULL); return(false); // return false so it wont spend processing recalculating the user stts } if (m_pOwner.IsGm) { m_pOwner.FillLife(); m_pOwner.FillMana(); return(false); } if (m_pOwner.Inventory.Remove(item.Type, 1)) { m_pOwner.AddAttribute(ClientUpdateType.HITPOINTS, item.Itemtype.Life, true); m_pOwner.AddAttribute(ClientUpdateType.MANA, item.Itemtype.Mana, true); } return(false); } if (item.Type == SpecialItem.MEMORY_AGATE) { item.SendCarry(); return(false); } if (item.Type == 723726) { if (m_pOwner.Inventory.Remove(item.Type, 1)) { m_pOwner.FillLife(); m_pOwner.FillMana(); } return(false); } if (item.Type == 723790 && m_pOwner.Inventory.Remove(723790)) { m_pOwner.AddAttribute(ClientUpdateType.HITPOINTS, 500, true); return(false); } if (item.Type == SpecialItem.TYPE_EXP_BALL || item.Type == 723834) { if (m_pOwner.ExpBallAmount >= 10) { int nDayOfYear = UnixTimestamp.ToDateTime(m_pOwner.LastUsedExpBall).DayOfYear; int nDayOfYear2 = DateTime.Now.DayOfYear; if (nDayOfYear == nDayOfYear2) { return(false); } m_pOwner.ExpBallAmount = 0; } if (m_pOwner.Inventory.Remove(item.Identity)) { m_pOwner.ExpBallAmount = (byte)(m_pOwner.ExpBallAmount + 1); m_pOwner.LastUsedExpBall = (uint)UnixTimestamp.Timestamp(); m_pOwner.Save(); m_pOwner.AwardExperience(ServerKernel.GetExpBallExperience(m_pOwner.Level), true, true); } return(false); } if ((item.Type >= 1060020 && item.Type <= 1060039) || item.Type == 1060102) { if (m_pOwner.Map.IsChgMapDisable()) { return(false); } m_pOwner.Inventory.Remove(item.Identity); } else if (item.Type / 1000 == 1060) { m_pOwner.Inventory.Remove(item.Identity); } m_pOwner.TaskItem = item; m_pOwner.GameAction.ProcessAction(item.Itemtype.IdAction, m_pOwner, null, item, null); return(false); } if (pos == ItemPosition.INVENTORY) { return(false); } if (pos == ItemPosition.LEFT_HAND && itemSort == ItemSort.ITEMSORT_WEAPON_SHIELD) { if (Items.ContainsKey(ItemPosition.RIGHT_HAND) && Items[ItemPosition.RIGHT_HAND].GetSort() == ItemSort.ITEMSORT_WEAPON_DOUBLE_HAND) { if (!m_pOwner.Magics.CheckType(10311)) { return(false); } } if (!Items.ContainsKey(ItemPosition.RIGHT_HAND)) { return(false); } } #endregion if (item.IsArrowSort()) { item.Position = ItemPosition.LEFT_HAND; } switch (item.Position) { case ItemPosition.RIGHT_HAND: if (pos != ItemPosition.RIGHT_HAND || (itemSort != ItemSort.ITEMSORT_WEAPON_SINGLE_HAND && itemSort != ItemSort.ITEMSORT_WEAPON_DOUBLE_HAND && itemSort != ItemSort.ITEMSORT_WEAPON_SINGLE_HAND2)) { item.Position = 0; return(false); } if ((itemSort == ItemSort.ITEMSORT_WEAPON_DOUBLE_HAND && Items.ContainsKey(ItemPosition.LEFT_HAND))) { Remove(ItemPosition.LEFT_HAND); } if (Items.ContainsKey(ItemPosition.RIGHT_HAND) && item.Position == ItemPosition.RIGHT_HAND) { Remove(ItemPosition.RIGHT_HAND, ItemRemoveMethod.REMOVE_TO_INVENTORY); } break; case ItemPosition.LEFT_HAND: if (itemSort != ItemSort.ITEMSORT_WEAPON_SINGLE_HAND && itemSort != ItemSort.ITEMSORT_WEAPON_SHIELD && itemSort != ItemSort.ITEMSORT_WEAPON_SINGLE_HAND2 && item.Type / 1000 != 1050) { item.Position = 0; return(false); } if (m_pOwner.Profession >= 100) { if (Items.ContainsKey(ItemPosition.LEFT_HAND) && Items[ItemPosition.LEFT_HAND] == item) { Remove(ItemPosition.LEFT_HAND, ItemRemoveMethod.REMOVE_TO_INVENTORY); } item.Position = 0; return(false); } if (item.IsArrowSort() && (!Items.ContainsKey(ItemPosition.RIGHT_HAND) || !Items[ItemPosition.RIGHT_HAND].IsBow())) { item.Position = 0; return(false); } if (Items.ContainsKey(ItemPosition.LEFT_HAND)) { Remove(ItemPosition.LEFT_HAND, ItemRemoveMethod.REMOVE_TO_INVENTORY); } break; case ItemPosition.ACCESSORY_R: { if ((itemSort != ItemSort.ITEMSORT_ACCESSORY) || item.Type / 10000 == 38) { item.Position = 0; return(false); } switch (item.Type / 10000) { case 38: item.Position = 0; return(false); } if (Items.ContainsKey(ItemPosition.ACCESSORY_R)) { Remove(ItemPosition.ACCESSORY_R); } break; } case ItemPosition.ACCESSORY_L: { if (itemSort != ItemSort.ITEMSORT_ACCESSORY || item.Type / 10000 == 37) { item.Position = 0; return(false); } switch (item.Type / 10000) { case 37: item.Position = 0; return(false); } if (Items.ContainsKey(ItemPosition.ACCESSORY_L)) { Remove(ItemPosition.ACCESSORY_L); } break; } default: if (pos == item.Position && Items.ContainsKey(item.Position)) { Remove(item.Position); } else if (pos != item.Position) { if (item.Position < ItemPosition.ALT_HEAD && pos != item.Position) { item.Position = 0; return(false); } if (item.Position >= ItemPosition.ALT_HEAD && item.Position <= ItemPosition.ALT_STEED) { switch (item.Position) { case ItemPosition.ALT_HEAD: { if (pos != ItemPosition.HEADWEAR) { return(false); } break; } case ItemPosition.ALT_NECKLACE: { if (pos != ItemPosition.NECKLACE) { return(false); } break; } case ItemPosition.ALT_RING: { if (pos != ItemPosition.RING) { return(false); } break; } case ItemPosition.ALT_WEAPON_R: { if (pos != ItemPosition.RIGHT_HAND) { return(false); } break; } case ItemPosition.ALT_WEAPON_L: { if (pos != ItemPosition.LEFT_HAND && pos != ItemPosition.RIGHT_HAND) { return(false); } break; } case ItemPosition.ALT_ARMOR: { if (pos != ItemPosition.ARMOR) { return(false); } break; } case ItemPosition.ALT_BOOTS: { if (pos != ItemPosition.BOOTS) { return(false); } break; } case ItemPosition.ALT_BOTTLE: { if (pos != ItemPosition.BOTTLE) { return(false); } break; } case ItemPosition.ALT_GARMENT: { if (pos != ItemPosition.GARMENT) { return(false); } break; } default: item.Position = 0; return(false); } if (Items.ContainsKey(item.Position) && Items.Count >= 40) { item.Position = 0; return(false); } if (Items.ContainsKey(item.Position)) { Remove(item.Position); } } else { item.Position = 0; return(false); } } break; } var itemEquip = new MsgItem { Identity = item.Identity, Action = ItemAction.EQUIP, Param1 = (uint)item.Position }; // We build the item information packet MsgItemInformation itemInfo = item.InformationPacket(!isLogin); // If we are logging in, we set this as default, because the item hasnt been // created yet, otherwise, we send this as an update. if (isLogin) { itemInfo.ItemMode = ItemMode.DEFAULT; m_pOwner.Send(itemInfo); } else { //itemInfo.ItemMode = ItemMode.Update; if (!m_pOwner.Inventory.Contains(item.Identity)) { return(false); } Item trash; m_pOwner.Inventory.Items.TryRemove(item.Identity, out trash); item.Save(); m_pOwner.RecalculateAttributes(); } m_pOwner.Send(itemEquip); Items.TryAdd(item.Position, item); SendEquipedItems(); item.SendPurification(); item.TryUnlockItem(); item.SendItemLockTime(); switch (item.Position) { case ItemPosition.HEADWEAR: m_pOwner.Helmet = item.Type; m_pOwner.HelmetColor = (ushort)item.Color; break; case ItemPosition.ARMOR: m_pOwner.Armor = item.Type; m_pOwner.ArmorColor = (ushort)item.Color; break; case ItemPosition.LEFT_HAND: m_pOwner.LeftHand = item.Type; m_pOwner.ShieldColor = (ushort)item.Color; break; case ItemPosition.RIGHT_HAND: m_pOwner.RightHand = item.Type; break; case ItemPosition.GARMENT: m_pOwner.Garment = item.Type; break; case ItemPosition.ACCESSORY_R: m_pOwner.RightAccessory = item.Type; break; case ItemPosition.ACCESSORY_L: m_pOwner.LeftAccessory = item.Type; break; case ItemPosition.STEED: m_pOwner.MountType = item.Type; m_pOwner.MountColor = item.SocketProgress; m_pOwner.MountPlus = item.Plus; break; case ItemPosition.STEED_ARMOR: m_pOwner.MountArmor = item.Type; break; } return(true); }
/// <summary> /// Create a ListViewWrapper arround the specified views /// </summary> /// <param name="context"></param> /// <param name="wrappedView"></param> /// <param name="revealView"></param> /// <param name="title"></param> /// <param name="orderHandler"></param> public ListViewWrapper(Activity context, ListView wrappedView, ListView revealView, string title, ItemSort orderHandler) : this(context, wrappedView, revealView, title) { SortOrderHandler = orderHandler; }
public ProductsController(ItemSort context) { _context = context; }
//发布宝贝帖子 public AdvancedResult <int> publishBBPost(string title, string qq, string mobile, string bbinfo, bool iswash, double price, int age, ItemType bbType, ItemSort bbSort, SexType sex, string token) { AdvancedResult <int> result = new AdvancedResult <int>(); try { if (!CacheManagerFactory.GetMemoryManager().Contains(token)) { result.Error = AppError.ERROR_PERSON_NOT_LOGIN; } else { int userid = Convert.ToInt32(CacheManagerFactory.GetMemoryManager().Get(token)); if (!string.IsNullOrEmpty(qq) || !string.IsNullOrEmpty(mobile)) { AdUser user = UserAccessor.Instance.Get(userid, string.Empty, string.Empty, StateType.Active); if (!string.IsNullOrEmpty(qq)) { user.Qq = qq; } if (!string.IsNullOrEmpty(mobile)) { user.Mobile = mobile; } UserAccessor.Instance.Update(user); } ProProduct pro = new ProProduct(); pro.Title = title.Trim(); pro.BbInfo = bbinfo.Trim(); pro.Price = price; pro.MinAge = (age - 1) < 0 ? 0 : (age - 1); pro.MaxAge = age + 1; pro.ItemType = bbType; pro.Sex = sex; pro.ItemSort = bbSort; pro.CreateId = userid; pro.CreateTime = DateTime.Now; pro.Level = 1; pro.IsWash = iswash; result.Data = ProProductAccessor.Instance.Insert(pro); result.Error = AppError.ERROR_SUCCESS; } } catch (Exception e) { result.Error = AppError.ERROR_FAILED; result.ExMessage = e.ToString(); } return(result); }
public override void OnInspectorGUI() { DrawDefaultInspector(); EditorGUILayout.BeginHorizontal(); if (createItem == null) { createItem = (CreateItem)EditorGUILayout.ObjectField("Create Item", createItem, typeof(CreateItem), true); } if (createItem != null) { if (createItem.ShowMe) { GUILayout.Label("SHOWING"); } else { GUILayout.Label("HIDING"); } } EditorGUILayout.EndHorizontal(); CreateItem createItemScript = (CreateItem)target; Item item = new Item(); GUILayout.Box(message); if (itemSort == ItemSort.Weapon) { if (GUILayout.Button("Switch to Create Armor")) { itemSort = ItemSort.Armor; } GUILayout.Label("Weapon Name"); weaponName = GUILayout.TextField(weaponName); GUILayout.Label("Physical Damage"); physicalDamage = EditorGUILayout.IntField(physicalDamage); GUILayout.Label("Magical Damage"); magicalDamage = EditorGUILayout.IntField(magicalDamage); GUILayout.Label("Weapon Attack Speed = " + attackSpeed.ToString("F2")); attackSpeed = GUILayout.HorizontalSlider(attackSpeed, 0.5f, 1.5f); //attackSpeed = GUILayout.TextField(attackSpeed); //attackSpeed = Regex.Replace(attackSpeed, "[^0-9]", ""); GUILayout.Label("Weapon Requirement Level"); itemLevel = EditorGUILayout.IntField(itemLevel); GUILayout.Label("Buy Value"); buyValue = EditorGUILayout.IntField(buyValue); if (GUILayout.Button("Selected Element : " + itemElement)) { openElements = openElements == false ? true : false; } if (openElements) { if (GUILayout.Button("Element : Normal")) { itemElement = Item.ItemElement.Normal; } if (GUILayout.Button("Element : Dark")) { itemElement = Item.ItemElement.Dark; } if (GUILayout.Button("Element : Earth")) { itemElement = Item.ItemElement.Earth; } if (GUILayout.Button("Element : Fire")) { itemElement = Item.ItemElement.Fire; } if (GUILayout.Button("Element : Frost")) { itemElement = Item.ItemElement.Frost; } if (GUILayout.Button("Element : Light")) { itemElement = Item.ItemElement.Light; } if (GUILayout.Button("Element : Lightning")) { itemElement = Item.ItemElement.Lightning; } if (GUILayout.Button("Element : Poison")) { itemElement = Item.ItemElement.Poison; } if (GUILayout.Button("Element : Silver")) { itemElement = Item.ItemElement.Silver; } if (GUILayout.Button("Element : Water")) { itemElement = Item.ItemElement.Water; } } if (GUILayout.Button("Create Weapon")) { if (weaponName != "" && (physicalDamage != 0 || magicalDamage != 0) && itemLevel != 0) { item.getItemName = weaponName; item.getItemAttackSpeed = Mathf.Floor(attackSpeed * 100) / 100; item.getItemLevel = itemLevel; item.getItemPhysicalDamage = physicalDamage; item.getItemMagicalDamage = magicalDamage; item.getItemBuyValue = buyValue; item.getItemSellValue = buyValue / 4; item.getItemElement = itemElement; item.itemClass = Item.ItemClass.Weapon; item.getItemEquipAble = true; weaponName = ""; attackSpeed = 1f; itemLevel = 0; physicalDamage = 0; magicalDamage = 0; buyValue = 0; itemElement = Item.ItemElement.Normal; createItemScript.CreateNewWeapons(item); message = ""; } else { message = "Fill in all the fields!"; } } } else if (itemSort == ItemSort.Armor) { if (GUILayout.Button("Switch to Create Weapon")) { itemSort = ItemSort.Weapon; } if (GUILayout.Button("BAG")) { Debug.Log("SUP"); } } }
public AvailableListWrapper(Activity context, ListView wrappedView, ListView revealView, string title, ItemSort orderHandler) : base(context, wrappedView, revealView, title, orderHandler) { GetDataAccordingToCurrentSortState(); }