| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- import {Item} from "./ConfigFile";
- import {DeleteDataByPath, GetDataByPath, PostDataByPath, PutDataByPath, ResponseData} from "./api";
- export class ShopData {
- Description: string
- Price: number
- Type: string
- constructor(Description: string, Price: number, Type: string) {
- this.Description = Description;
- this.Price = Price;
- this.Type = Type;
- }
- }
- export class ShopItem extends ShopData {
- Items: Item[]
- static Create(): ShopItem {
- return new ShopItem("item", "", 0, []);
- }
- constructor(Type: string, Description: string, Price: number, Items: Item[]) {
- super(Description, Price, Type);
- this.Items = Items;
- }
- }
- export class ShopDino extends ShopData {
- Level: number
- MinLevel: number
- MaxLevel: number
- Neutered: boolean
- Gender: string
- SaddleBlueprint: string
- Blueprint: string
- static Create(): ShopDino {
- return new ShopDino("", 0, "dino", 0, 0, 0, false, "", "", "");
- }
- constructor(Description: string, Price: number, Type: string, Level: number, MinLevel: number, MaxLevel: number, Neutered: boolean, Gender: string, SaddleBlueprint: string, Blueprint: string) {
- super(Description, Price, Type);
- this.Level = Level;
- this.MinLevel = MinLevel;
- this.MaxLevel = MaxLevel;
- this.Neutered = Neutered;
- this.Gender = Gender;
- this.SaddleBlueprint = SaddleBlueprint;
- this.Blueprint = Blueprint;
- }
- }
- export class ShopBeacon extends ShopData {
- ClassName: string
- static Create(): ShopBeacon {
- return new ShopBeacon("", 0, "beacon", "");
- }
- constructor(Description: string, Price: number, Type: string, ClassName: string) {
- super(Description, Price, Type);
- this.ClassName = ClassName;
- }
- }
- //ShopExperience
- export class ShopExperience extends ShopData {
- Amount: number
- GiveToDino: boolean
- static Create(): ShopExperience {
- return new ShopExperience("", 0, "experience", 0, false);
- }
- constructor(Description: string, Price: number, Type: string, Amount: number, GiveToDino: boolean) {
- super(Description, Price, Type);
- this.Amount = Amount;
- this.GiveToDino = GiveToDino;
- }
- }
- //ShopUnlockengram
- export class ShopUnlockengram extends ShopData {
- Items: ShopUnlockengramItem[]
- static Create(): ShopUnlockengram {
- return new ShopUnlockengram("", 0, "unlockengram", []);
- }
- constructor(Description: string, Price: number, Type: string, Items: ShopUnlockengramItem[]) {
- super(Description, Price, Type);
- this.Items = Items;
- }
- }
- export class ShopUnlockengramItem {
- Blueprint: string
- static Create(): ShopUnlockengramItem {
- return new ShopUnlockengramItem("");
- }
- constructor(Blueprint: string) {
- this.Blueprint = Blueprint;
- }
- }
- export class ShopCommand extends ShopData {
- Items: ShopCommandItem[]
- static Create(): ShopCommand {
- return new ShopCommand("", 0, "command", []);
- }
- constructor(Description: string, Price: number, Type: string, Items: ShopCommandItem[]) {
- super(Description, Price, Type);
- this.Items = Items;
- }
- }
- export class ShopCommandItem {
- Command: string
- DisplayAs: string
- constructor(Command: string, DisplayAs: string) {
- this.Command = Command;
- this.DisplayAs = DisplayAs;
- }
- }
- export function GetShopItems(type: string) {
- return GetDataByPath("/ark/shopItem?type=" + type, {}, true) as Promise<ResponseData<ShopData[]>>;
- }
- export function SaveShopItem(shopItem: ShopData, name: string, shopType: string) {
- return PostDataByPath("/ark/shopItem",
- {shopItem: shopItem, shopItemName: name, shopType: shopType},
- true)
- }
- export function UpdateShopItem(newShopItem: ShopData, name: string, shopType: string) {
- return PutDataByPath("/ark/shopItem", {
- newShopItem: newShopItem,
- shopItemName: name, shopType: shopType
- }, true)
- }
- export function DeleteShopItem(shopItemName: string) {
- return DeleteDataByPath("/ark/shopItem", {shopItemName: shopItemName}, true)
- }
|