/// <summary> /// When overridden in the derived class, loads an item from the database. /// </summary> /// <param name="id">The ID of the item to load.</param> /// <returns>The item loaded from the database.</returns> protected override IShop <ShopItem> LoadItem(ShopID id) { var shopItemTables = _selectShopItemsQuery.Execute(id); var shopTable = _selectShopQuery.Execute(id); return(new Shop(shopTable, shopItemTables)); }
/// <summary> /// Initializes a new instance of the <see cref="EditorShop"/> class. /// </summary> /// <param name="id">The <see cref="ShopID"/>.</param> /// <param name="dbController">The <see cref="IDbController"/>.</param> /// <exception cref="ArgumentException">No shop exists for the specified <paramref name="id"/>.</exception> public EditorShop(ShopID id, IDbController dbController) { _id = id; // Grab the general shop information var table = dbController.GetQuery <SelectShopQuery>().Execute(id); if (table == null) { const string errmsg = "No Shop with ID `{0}` exists."; throw new ArgumentException(string.Format(errmsg, id), "id"); } Debug.Assert(id == table.ID); Name = table.Name; CanBuy = table.CanBuy; // Grab the items from the database and add them var dbItems = dbController.GetQuery <SelectShopItemsQuery>().Execute(id); _items = new List <ItemTemplateID>(); if (dbItems != null) { _items.AddRange(dbItems.Select(x => x.ItemTemplateID)); } }
public void Execute(ShopID shopID, IEnumerable <ItemTemplateID> itemIDs) { foreach (var itemID in itemIDs) { Execute(shopID, itemID); } }
public IActionResult SetShopID([FromBody] ShopID shop) //设置商品ID { Global.GShopId = shop.ID; JsonData jsondata = new JsonData(); jsondata["shopID"] = shop.ID; return(Json(jsondata.ToJson())); }
/// <summary> /// Initializes a new instance of the <see cref="EditorShop"/> class. /// </summary> /// <param name="id">The <see cref="ShopID"/>.</param> /// <param name="existing">The <see cref="EditorShop"/> to copy the values from.</param> public EditorShop(ShopID id, EditorShop existing) { _id = id; Name = existing.Name; CanBuy = existing.CanBuy; _items = new List <ItemTemplateID>(existing._items); }
/// <summary> /// Initializes a new instance of the <see cref="EditorShop"/> class. /// </summary> /// <param name="id">The <see cref="ShopID"/>.</param> /// <param name="existing">The <see cref="EditorShop"/> to copy the values from.</param> public EditorShop(ShopID id, EditorShop existing) { _id = id; Name = existing.Name; CanBuy = existing.CanBuy; _items = new List<ItemTemplateID>(existing._items); }
/// <summary> /// Provides the extra text for the <see cref="AdvancedPropertyDescriptor"/> for a /// <see cref="ShopID"/>. /// </summary> /// <param name="v">The value.</param> /// <returns>The extra text to display.</returns> static string ExtraTextProvider_ShopID(ShopID v) { var shop = ShopManager.Instance[v]; if (shop == null) { return(null); } return(shop.Name); }
/// <summary> /// Initializes a new instance of the <see cref="WorldStatsUserShoppingTable"/> class. /// </summary> /// <param name="amount">The initial value for the corresponding property.</param> /// <param name="characterID">The initial value for the corresponding property.</param> /// <param name="cost">The initial value for the corresponding property.</param> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="itemTemplateID">The initial value for the corresponding property.</param> /// <param name="mapID">The initial value for the corresponding property.</param> /// <param name="saleType">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> /// <param name="when">The initial value for the corresponding property.</param> /// <param name="x">The initial value for the corresponding property.</param> /// <param name="y">The initial value for the corresponding property.</param> public WorldStatsUserShoppingTable(Byte @amount, CharacterID @characterID, Int32 @cost, UInt32 @iD, ItemTemplateID? @itemTemplateID, MapID? @mapID, SByte @saleType, ShopID @shopID, DateTime @when, UInt16 @x, UInt16 @y) { Amount = @amount; CharacterID = @characterID; Cost = @cost; ID = @iD; ItemTemplateID = @itemTemplateID; MapID = @mapID; SaleType = @saleType; ShopID = @shopID; When = @when; X = @x; Y = @y; }
/// <summary> /// Initializes a new instance of the <see cref="EditorShop"/> class. /// </summary> /// <param name="id">The <see cref="ShopID"/>.</param> /// <param name="dbController">The <see cref="IDbController"/>.</param> /// <exception cref="ArgumentException">No shop exists for the specified <paramref name="id"/>.</exception> public EditorShop(ShopID id, IDbController dbController) { _id = id; // Grab the general shop information var table = dbController.GetQuery<SelectShopQuery>().Execute(id); if (table == null) { const string errmsg = "No Shop with ID `{0}` exists."; throw new ArgumentException(string.Format(errmsg, id), "id"); } Debug.Assert(id == table.ID); Name = table.Name; CanBuy = table.CanBuy; // Grab the items from the database and add them var dbItems = dbController.GetQuery<SelectShopItemsQuery>().Execute(id); _items = new List<ItemTemplateID>(); if (dbItems != null) _items.AddRange(dbItems.Select(x => x.ItemTemplateID)); }
/// <summary> /// Initializes a new instance of the <see cref="ViewNpcCharacterTable"/> class. /// </summary> /// <param name="aIID">The initial value for the corresponding property.</param> /// <param name="bodyID">The initial value for the corresponding property.</param> /// <param name="cash">The initial value for the corresponding property.</param> /// <param name="characterTemplateID">The initial value for the corresponding property.</param> /// <param name="chatDialog">The initial value for the corresponding property.</param> /// <param name="exp">The initial value for the corresponding property.</param> /// <param name="hP">The initial value for the corresponding property.</param> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="level">The initial value for the corresponding property.</param> /// <param name="loadMapID">The initial value for the corresponding property.</param> /// <param name="loadX">The initial value for the corresponding property.</param> /// <param name="loadY">The initial value for the corresponding property.</param> /// <param name="moveSpeed">The initial value for the corresponding property.</param> /// <param name="mP">The initial value for the corresponding property.</param> /// <param name="name">The initial value for the corresponding property.</param> /// <param name="respawnMapID">The initial value for the corresponding property.</param> /// <param name="respawnX">The initial value for the corresponding property.</param> /// <param name="respawnY">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> /// <param name="statPoints">The initial value for the corresponding property.</param> /// <param name="statAgi">The initial value for the corresponding property.</param> /// <param name="statDefence">The initial value for the corresponding property.</param> /// <param name="statInt">The initial value for the corresponding property.</param> /// <param name="statMaxhit">The initial value for the corresponding property.</param> /// <param name="statMaxhp">The initial value for the corresponding property.</param> /// <param name="statMaxmp">The initial value for the corresponding property.</param> /// <param name="statMinhit">The initial value for the corresponding property.</param> /// <param name="statStr">The initial value for the corresponding property.</param> public ViewNpcCharacterTable(AIID? @aIID, BodyID @bodyID, Int32 @cash, CharacterTemplateID? @characterTemplateID, NPCChatDialogID? @chatDialog, Int32 @exp, SPValueType @hP, Int32 @iD, Byte @level, MapID @loadMapID, UInt16 @loadX, UInt16 @loadY, UInt16 @moveSpeed, SPValueType @mP, String @name, MapID? @respawnMapID, Single @respawnX, Single @respawnY, ShopID? @shopID, Int32 @statPoints, Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit, Int16 @statMaxhp, Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr) { AIID = @aIID; BodyID = @bodyID; Cash = @cash; CharacterTemplateID = @characterTemplateID; ChatDialog = @chatDialog; Exp = @exp; HP = @hP; ID = @iD; Level = @level; LoadMapID = @loadMapID; LoadX = @loadX; LoadY = @loadY; MoveSpeed = @moveSpeed; MP = @mP; Name = @name; RespawnMapID = @respawnMapID; RespawnX = @respawnX; RespawnY = @respawnY; ShopID = @shopID; StatPoints = @statPoints; StatAgi = @statAgi; StatDefence = @statDefence; StatInt = @statInt; StatMaxhit = @statMaxhit; StatMaxhp = @statMaxhp; StatMaxmp = @statMaxmp; StatMinhit = @statMinhit; StatStr = @statStr; }
/// <summary> /// Initializes a new instance of the <see cref="WorldStatsCountShopSellTable"/> class. /// </summary> /// <param name="count">The initial value for the corresponding property.</param> /// <param name="lastUpdate">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> public WorldStatsCountShopSellTable(Int32 @count, DateTime @lastUpdate, ShopID @shopID) { Count = @count; LastUpdate = @lastUpdate; ShopID = @shopID; }
/// <summary> /// Initializes a new instance of the <see cref="EventCountersShopTable"/> class. /// </summary> /// <param name="counter">The initial value for the corresponding property.</param> /// <param name="shopEventCounterId">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> public EventCountersShopTable(Int64 @counter, Byte @shopEventCounterId, ShopID @shopID) { Counter = @counter; ShopEventCounterId = @shopEventCounterId; ShopID = @shopID; }
/// <summary> /// Initializes a new instance of the <see cref="ShopItemTable"/> class. /// </summary> /// <param name="itemTemplateID">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> public ShopItemTable(ItemTemplateID @itemTemplateID, ShopID @shopID) { ItemTemplateID = @itemTemplateID; ShopID = @shopID; }
/// <summary> /// When overridden in the derived class, adds when a user sells an item to a shop. /// </summary> /// <param name="user">The user that sold to a shop.</param> /// <param name="itemTemplateID">The template ID of the item that was sold.</param> /// <param name="amount">How many units of the item was sold.</param> /// <param name="cost">How much the user sold the items for. When the amount is greater than one, this includes /// the cost of all the items together, not a single item. That is, the cost of the transaction as a whole.</param> /// <param name="shopID">The ID of the shop the transaction took place at.</param> protected abstract void InternalAddUserShopSellItem(TUser user, int?itemTemplateID, byte amount, int cost, ShopID shopID);
/// <summary> /// Initializes a new instance of the <see cref="CharacterTable"/> class. /// </summary> /// <param name="aIID">The initial value for the corresponding property.</param> /// <param name="bodyID">The initial value for the corresponding property.</param> /// <param name="cash">The initial value for the corresponding property.</param> /// <param name="characterTemplateID">The initial value for the corresponding property.</param> /// <param name="chatDialog">The initial value for the corresponding property.</param> /// <param name="exp">The initial value for the corresponding property.</param> /// <param name="hP">The initial value for the corresponding property.</param> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="level">The initial value for the corresponding property.</param> /// <param name="loadMapID">The initial value for the corresponding property.</param> /// <param name="loadX">The initial value for the corresponding property.</param> /// <param name="loadY">The initial value for the corresponding property.</param> /// <param name="moveSpeed">The initial value for the corresponding property.</param> /// <param name="mP">The initial value for the corresponding property.</param> /// <param name="name">The initial value for the corresponding property.</param> /// <param name="respawnMapID">The initial value for the corresponding property.</param> /// <param name="respawnX">The initial value for the corresponding property.</param> /// <param name="respawnY">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> /// <param name="statPoints">The initial value for the corresponding property.</param> /// <param name="statAgi">The initial value for the corresponding property.</param> /// <param name="statDefence">The initial value for the corresponding property.</param> /// <param name="statInt">The initial value for the corresponding property.</param> /// <param name="statMaxhit">The initial value for the corresponding property.</param> /// <param name="statMaxhp">The initial value for the corresponding property.</param> /// <param name="statMaxmp">The initial value for the corresponding property.</param> /// <param name="statMinhit">The initial value for the corresponding property.</param> /// <param name="statStr">The initial value for the corresponding property.</param> public CharacterTable(AIID? @aIID, BodyID @bodyID, Int32 @cash, CharacterTemplateID? @characterTemplateID, NPCChatDialogID? @chatDialog, Int32 @exp, SPValueType @hP, CharacterID @iD, Byte @level, MapID @loadMapID, UInt16 @loadX, UInt16 @loadY, UInt16 @moveSpeed, SPValueType @mP, String @name, MapID? @respawnMapID, Single @respawnX, Single @respawnY, ShopID? @shopID, Int32 @statPoints, Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit, Int16 @statMaxhp, Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr) { AIID = @aIID; BodyID = @bodyID; Cash = @cash; CharacterTemplateID = @characterTemplateID; ChatDialog = @chatDialog; Exp = @exp; HP = @hP; ID = @iD; Level = @level; LoadMapID = @loadMapID; LoadX = @loadX; LoadY = @loadY; MoveSpeed = @moveSpeed; MP = @mP; Name = @name; RespawnMapID = @respawnMapID; RespawnX = @respawnX; RespawnY = @respawnY; ShopID = @shopID; StatPoints = @statPoints; SetStat(StatType.Agi, @statAgi); SetStat(StatType.Defence, @statDefence); SetStat(StatType.Int, @statInt); SetStat(StatType.MaxHit, @statMaxhit); SetStat(StatType.MaxHP, @statMaxhp); SetStat(StatType.MaxMP, @statMaxmp); SetStat(StatType.MinHit, @statMinhit); SetStat(StatType.Str, @statStr); }
/// <summary> /// Initializes a new instance of the <see cref="EventCountersShopTable"/> class. /// </summary> /// <param name="counter">The initial value for the corresponding property.</param> /// <param name="shopEventCounterId">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> public EventCountersShopTable(Int64 @counter, Byte @shopEventCounterId, ShopID @shopID) { Counter = @counter; ShopEventCounterId = @shopEventCounterId; ShopID = @shopID; }
/// <summary> /// Initializes a new instance of the <see cref="ShopItem"/> class. /// </summary> /// <param name="shopItemTable">The shop item table.</param> public ShopItem(IShopItemTable shopItemTable) { _shopID = shopItemTable.ShopID; _itemTemplate = _itemTemplateManager[shopItemTable.ItemTemplateID]; }
/// <summary> /// Initializes a new instance of the <see cref="WorldStatsUserShoppingTable"/> class. /// </summary> /// <param name="amount">The initial value for the corresponding property.</param> /// <param name="characterID">The initial value for the corresponding property.</param> /// <param name="cost">The initial value for the corresponding property.</param> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="itemTemplateID">The initial value for the corresponding property.</param> /// <param name="mapID">The initial value for the corresponding property.</param> /// <param name="saleType">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> /// <param name="when">The initial value for the corresponding property.</param> /// <param name="x">The initial value for the corresponding property.</param> /// <param name="y">The initial value for the corresponding property.</param> public WorldStatsUserShoppingTable(Byte @amount, CharacterID @characterID, Int32 @cost, UInt32 @iD, ItemTemplateID? @itemTemplateID, MapID? @mapID, SByte @saleType, ShopID @shopID, DateTime @when, UInt16 @x, UInt16 @y) { Amount = @amount; CharacterID = @characterID; Cost = @cost; ID = @iD; ItemTemplateID = @itemTemplateID; MapID = @mapID; SaleType = @saleType; ShopID = @shopID; When = @when; X = @x; Y = @y; }
/// <summary> /// When overridden in the derived class, adds when a user sells an item to a shop. /// </summary> /// <param name="user">The user that sold to a shop.</param> /// <param name="itemTemplateID">The template ID of the item that was sold.</param> /// <param name="amount">How many units of the item was sold.</param> /// <param name="cost">How much the user sold the items for. When the amount is greater than one, this includes /// the cost of all the items together, not a single item. That is, the cost of the transaction as a whole.</param> /// <param name="shopID">The ID of the shop the transaction took place at.</param> protected override void InternalAddUserShopSellItem(User user, int?itemTemplateID, byte amount, int cost, ShopID shopID) { var mapID = (user.Map == null ? (MapID?)null : user.Map.ID); var args = new WorldStatsUserShoppingTable(saleType: 1, amount: amount, characterID: user.ID, cost: cost, itemTemplateID: (ItemTemplateID?)itemTemplateID, mapID: mapID, shopID: shopID, when: Now(), x: (ushort)user.Position.X, y: (ushort)user.Position.Y, iD: 0); _userShoppingQuery.Execute(args); }
/// <summary> /// When overridden in the derived class, converts the <paramref name="value"/> to an int. /// </summary> /// <param name="value">The value.</param> /// <returns>The <paramref name="value"/> as an int.</returns> protected override int IDToInt(ShopID value) { return((int)value); }
/// <summary> /// Adds when a user sells an item to a shop. /// </summary> /// <param name="user">The user that sold to a shop.</param> /// <param name="itemTemplateID">The template ID of the item that was sold.</param> /// <param name="amount">How many units of the item was sold.</param> /// <param name="cost">How much the user sold the items for. When the amount is greater than one, this includes /// the cost of all the items together, not a single item. That is, the cost of the transaction as a whole.</param> /// <param name="shopID">The ID of the shop the transaction took place at.</param> public void AddUserShopSellItem(TUser user, int?itemTemplateID, byte amount, int cost, ShopID shopID) { try { if (user == null) { return; } if (amount <= 0) { return; } InternalAddUserLevel(user); } catch (Exception ex) { OnQueryException(ex); } }
/// <summary> /// Initializes a new instance of the <see cref="ShopTable"/> class. /// </summary> /// <param name="canBuy">The initial value for the corresponding property.</param> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="name">The initial value for the corresponding property.</param> public ShopTable(Boolean @canBuy, ShopID @iD, String @name) { CanBuy = @canBuy; ID = @iD; Name = @name; }
/// <summary> /// Initializes a new instance of the <see cref="CharacterTemplateTable"/> class. /// </summary> /// <param name="aIID">The initial value for the corresponding property.</param> /// <param name="allianceID">The initial value for the corresponding property.</param> /// <param name="bodyID">The initial value for the corresponding property.</param> /// <param name="chatDialog">The initial value for the corresponding property.</param> /// <param name="exp">The initial value for the corresponding property.</param> /// <param name="giveCash">The initial value for the corresponding property.</param> /// <param name="giveExp">The initial value for the corresponding property.</param> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="level">The initial value for the corresponding property.</param> /// <param name="moveSpeed">The initial value for the corresponding property.</param> /// <param name="name">The initial value for the corresponding property.</param> /// <param name="respawn">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> /// <param name="statPoints">The initial value for the corresponding property.</param> /// <param name="statAgi">The initial value for the corresponding property.</param> /// <param name="statDefence">The initial value for the corresponding property.</param> /// <param name="statInt">The initial value for the corresponding property.</param> /// <param name="statMaxhit">The initial value for the corresponding property.</param> /// <param name="statMaxhp">The initial value for the corresponding property.</param> /// <param name="statMaxmp">The initial value for the corresponding property.</param> /// <param name="statMinhit">The initial value for the corresponding property.</param> /// <param name="statStr">The initial value for the corresponding property.</param> public CharacterTemplateTable(AIID? @aIID, AllianceID @allianceID, BodyID @bodyID, NPCChatDialogID? @chatDialog, Int32 @exp, UInt16 @giveCash, UInt16 @giveExp, CharacterTemplateID @iD, Byte @level, UInt16 @moveSpeed, String @name, UInt16 @respawn, ShopID? @shopID, Int32 @statPoints, Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit, Int16 @statMaxhp, Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr) { AIID = @aIID; AllianceID = @allianceID; BodyID = @bodyID; ChatDialog = @chatDialog; Exp = @exp; GiveCash = @giveCash; GiveExp = @giveExp; ID = @iD; Level = @level; MoveSpeed = @moveSpeed; Name = @name; Respawn = @respawn; ShopID = @shopID; StatPoints = @statPoints; SetStat(StatType.Agi, @statAgi); SetStat(StatType.Defence, @statDefence); SetStat(StatType.Int, @statInt); SetStat(StatType.MaxHit, @statMaxhit); SetStat(StatType.MaxHP, @statMaxhp); SetStat(StatType.MaxMP, @statMaxmp); SetStat(StatType.MinHit, @statMinhit); SetStat(StatType.Str, @statStr); }
public void Execute(ShopID shopID, ItemTemplateID itemID) { Execute(new ShopItemTable(itemID, shopID)); }
/// <summary> /// Initializes a new instance of the <see cref="ShopItemTable"/> class. /// </summary> /// <param name="itemTemplateID">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> public ShopItemTable(ItemTemplateID @itemTemplateID, ShopID @shopID) { ItemTemplateID = @itemTemplateID; ShopID = @shopID; }
/// <summary> /// Initializes a new instance of the <see cref="ShopTable"/> class. /// </summary> /// <param name="canBuy">The initial value for the corresponding property.</param> /// <param name="iD">The initial value for the corresponding property.</param> /// <param name="name">The initial value for the corresponding property.</param> public ShopTable(Boolean @canBuy, ShopID @iD, String @name) { CanBuy = @canBuy; ID = @iD; Name = @name; }
/// <summary> /// Initializes a new instance of the <see cref="WorldStatsCountShopSellTable"/> class. /// </summary> /// <param name="count">The initial value for the corresponding property.</param> /// <param name="lastUpdate">The initial value for the corresponding property.</param> /// <param name="shopID">The initial value for the corresponding property.</param> public WorldStatsCountShopSellTable(Int32 @count, DateTime @lastUpdate, ShopID @shopID) { Count = @count; LastUpdate = @lastUpdate; ShopID = @shopID; }
/// <summary> /// Provides the extra text for the <see cref="AdvancedPropertyDescriptor"/> for a /// <see cref="ShopID"/>. /// </summary> /// <param name="v">The value.</param> /// <returns>The extra text to display.</returns> static string ExtraTextProvider_ShopID(ShopID v) { var shop = ShopManager.Instance[v]; if (shop == null) return null; return shop.Name; }