|
@@ -1,5 +1,5 @@
|
|
|
import {Item} from "./ConfigFile.ts";
|
|
import {Item} from "./ConfigFile.ts";
|
|
|
-import {GetDataByPath, PutDataByPath, ResponseData} from "./api.ts";
|
|
|
|
|
|
|
+import {DeleteDataByPath, GetDataByPath, PutDataByPath, ResponseData} from "./api.ts";
|
|
|
|
|
|
|
|
export class ShopData {
|
|
export class ShopData {
|
|
|
Description: string
|
|
Description: string
|
|
@@ -16,6 +16,10 @@ export class ShopData {
|
|
|
export class ShopItem extends ShopData {
|
|
export class ShopItem extends ShopData {
|
|
|
Items: Item[]
|
|
Items: Item[]
|
|
|
|
|
|
|
|
|
|
+ static Create(): ShopItem {
|
|
|
|
|
+ return new ShopItem("", 0, "item", []);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
constructor(Type: string, Description: string, Price: number, Items: Item[]) {
|
|
constructor(Type: string, Description: string, Price: number, Items: Item[]) {
|
|
|
super(Description, Price, Type);
|
|
super(Description, Price, Type);
|
|
|
this.Items = Items;
|
|
this.Items = Items;
|
|
@@ -31,6 +35,10 @@ export class ShopDino extends ShopData {
|
|
|
SaddleBlueprint: string
|
|
SaddleBlueprint: string
|
|
|
Blueprint: 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) {
|
|
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);
|
|
super(Description, Price, Type);
|
|
|
this.Level = Level;
|
|
this.Level = Level;
|
|
@@ -46,6 +54,9 @@ export class ShopDino extends ShopData {
|
|
|
export class ShopBeacon extends ShopData {
|
|
export class ShopBeacon extends ShopData {
|
|
|
ClassName: string
|
|
ClassName: string
|
|
|
|
|
|
|
|
|
|
+ static Create(): ShopBeacon {
|
|
|
|
|
+ return new ShopBeacon("", 0, "beacon", "");
|
|
|
|
|
+ }
|
|
|
constructor(Description: string, Price: number, Type: string, ClassName: string) {
|
|
constructor(Description: string, Price: number, Type: string, ClassName: string) {
|
|
|
super(Description, Price, Type);
|
|
super(Description, Price, Type);
|
|
|
this.ClassName = ClassName;
|
|
this.ClassName = ClassName;
|
|
@@ -57,6 +68,9 @@ export class ShopBeacon extends ShopData {
|
|
|
export class ShopExperience extends ShopData {
|
|
export class ShopExperience extends ShopData {
|
|
|
Amount: number
|
|
Amount: number
|
|
|
GiveToDino: boolean
|
|
GiveToDino: boolean
|
|
|
|
|
+ static Create(): ShopExperience {
|
|
|
|
|
+ return new ShopExperience("", 0, "experience", 0, false);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
constructor(Description: string, Price: number, Type: string, Amount: number, GiveToDino: boolean) {
|
|
constructor(Description: string, Price: number, Type: string, Amount: number, GiveToDino: boolean) {
|
|
|
super(Description, Price, Type);
|
|
super(Description, Price, Type);
|
|
@@ -68,6 +82,9 @@ export class ShopExperience extends ShopData {
|
|
|
//ShopUnlockengram
|
|
//ShopUnlockengram
|
|
|
export class ShopUnlockengram extends ShopData {
|
|
export class ShopUnlockengram extends ShopData {
|
|
|
Items: ShopUnlockengramItem[]
|
|
Items: ShopUnlockengramItem[]
|
|
|
|
|
+ static Create(): ShopUnlockengram {
|
|
|
|
|
+ return new ShopUnlockengram("", 0, "unlockengram", []);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
constructor(Description: string, Price: number, Type: string, Items: ShopUnlockengramItem[]) {
|
|
constructor(Description: string, Price: number, Type: string, Items: ShopUnlockengramItem[]) {
|
|
|
super(Description, Price, Type);
|
|
super(Description, Price, Type);
|
|
@@ -78,6 +95,9 @@ export class ShopUnlockengram extends ShopData {
|
|
|
export class ShopUnlockengramItem {
|
|
export class ShopUnlockengramItem {
|
|
|
Blueprint: string
|
|
Blueprint: string
|
|
|
|
|
|
|
|
|
|
+ static Create(): ShopUnlockengramItem {
|
|
|
|
|
+ return new ShopUnlockengramItem("");
|
|
|
|
|
+ }
|
|
|
constructor(Blueprint: string) {
|
|
constructor(Blueprint: string) {
|
|
|
this.Blueprint = Blueprint;
|
|
this.Blueprint = Blueprint;
|
|
|
}
|
|
}
|
|
@@ -86,6 +106,9 @@ export class ShopUnlockengramItem {
|
|
|
export class ShopCommand extends ShopData {
|
|
export class ShopCommand extends ShopData {
|
|
|
Items: ShopCommandItem[]
|
|
Items: ShopCommandItem[]
|
|
|
|
|
|
|
|
|
|
+ static Create(): ShopCommand {
|
|
|
|
|
+ return new ShopCommand("", 0, "command", []);
|
|
|
|
|
+ }
|
|
|
constructor(Description: string, Price: number, Type: string, Items: ShopCommandItem[]) {
|
|
constructor(Description: string, Price: number, Type: string, Items: ShopCommandItem[]) {
|
|
|
super(Description, Price, Type);
|
|
super(Description, Price, Type);
|
|
|
this.Items = Items;
|
|
this.Items = Items;
|
|
@@ -103,20 +126,23 @@ export class ShopCommandItem {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function GetShopItems(type: string) {
|
|
export function GetShopItems(type: string) {
|
|
|
- return GetDataByPath("/ark/shopItem?type=" + type, {}, true) as Promise<ResponseData<ShopItem[]>>;
|
|
|
|
|
|
|
+ return GetDataByPath("/ark/shopItem?type=" + type, {}, true) as Promise<ResponseData<ShopData[]>>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export function SaveShopItem(shopItem: ShopItem) {
|
|
|
|
|
- return PutDataByPath("/ark/shopItem", shopItem, true)
|
|
|
|
|
|
|
+export function SaveShopItem(shopItem: ShopItem, name: string, shopType: string) {
|
|
|
|
|
+ return PutDataByPath("/ark/shopItem",
|
|
|
|
|
+ {shopItem: shopItem, shopItemName: name, shopType: shopType},
|
|
|
|
|
+ true)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export function UpdateShopItem(oldShopItem: ShopItem, newShopItem: ShopItem) {
|
|
|
|
|
|
|
+export function UpdateShopItem(newShopItem: ShopItem, name: string, shopType: string) {
|
|
|
return PutDataByPath("/ark/shopItem", {
|
|
return PutDataByPath("/ark/shopItem", {
|
|
|
- oldShopItem: oldShopItem, newShopItem: newShopItem
|
|
|
|
|
|
|
+ newShopItem: newShopItem,
|
|
|
|
|
+ shopItemName: name, shopType: shopType
|
|
|
}, true)
|
|
}, true)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function DeleteShopItem(shopItemName: string) {
|
|
export function DeleteShopItem(shopItemName: string) {
|
|
|
- return PutDataByPath("/ark/shopItem", {shopItemName: shopItemName}, true)
|
|
|
|
|
|
|
+ return DeleteDataByPath("/ark/shopItem", {shopItemName: shopItemName}, true)
|
|
|
}
|
|
}
|
|
|
|
|
|