/// <summary> /// /// </summary> /// <param name="floor"></param> /// <returns></returns> public string GetLowerPrice(AuctionCategoryFloorEnum floor) { AuctionEntry entry = FirstOrDefault(floor); if (entry == null) { return(""); } return(entry.Price.ToString()); }
/// <summary> /// /// </summary> /// <param name="quantity"></param> /// <returns></returns> public int GetQuantityByFloor(AuctionCategoryFloorEnum floor) { switch (floor) { case AuctionCategoryFloorEnum.FLOOR_ONE: return(1); case AuctionCategoryFloorEnum.FLOOR_TEN: return(10); case AuctionCategoryFloorEnum.FLOOR_HUNDRED: return(100); default: throw new InvalidOperationException("AuctionCategory::GetQuantityByFloor invalid floor."); } }
/// <summary> /// /// </summary> /// <param name="quantity"></param> /// <param name="price"></param> public AuctionBuyResultEnum Buy(CharacterEntity character, AuctionCategoryFloorEnum floor, long price) { var auction = FirstOrDefault(floor); if (auction == null || auction.Price != price) { return(AuctionBuyResultEnum.ALREADY_SOLD); } character.Inventory.SubKamas(price); character.Inventory.AddItem(auction.Item); auction.Remove(); m_auctionsByFloor[floor].Remove(auction); return(AuctionBuyResultEnum.SUCCES); }
/// <summary> /// /// </summary> /// <returns></returns> public AuctionEntry FirstOrDefault(AuctionCategoryFloorEnum floor) { return(m_auctionsByFloor[floor].FirstOrDefault()); }
/// <summary> /// /// </summary> /// <param name="quantity"></param> /// <returns></returns> public int GetQuantityByFloor(AuctionCategoryFloorEnum floor) { switch (floor) { case AuctionCategoryFloorEnum.FLOOR_ONE: return 1; case AuctionCategoryFloorEnum.FLOOR_TEN: return 10; case AuctionCategoryFloorEnum.FLOOR_HUNDRED: return 100; default: throw new InvalidOperationException("AuctionCategory::GetQuantityByFloor invalid floor."); } }
/// <summary> /// /// </summary> /// <param name="floor"></param> /// <returns></returns> public string GetLowerPrice(AuctionCategoryFloorEnum floor) { AuctionEntry entry = FirstOrDefault(floor); if (entry == null) return ""; return entry.Price.ToString(); }
/// <summary> /// /// </summary> /// <returns></returns> public AuctionEntry FirstOrDefault(AuctionCategoryFloorEnum floor) { return m_auctionsByFloor[floor].FirstOrDefault(); }
/// <summary> /// /// </summary> /// <param name="quantity"></param> /// <param name="price"></param> public AuctionBuyResultEnum Buy(CharacterEntity character, AuctionCategoryFloorEnum floor, long price) { var auction = FirstOrDefault(floor); if (auction == null || auction.Price != price) return AuctionBuyResultEnum.ALREADY_SOLD; character.Inventory.SubKamas(price); character.Inventory.AddItem(auction.Item); auction.Remove(); m_auctionsByFloor[floor].Remove(auction); return AuctionBuyResultEnum.SUCCES; }