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>; } 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) }