Administrator 1 år sedan
förälder
incheckning
c973981659

+ 5 - 2
configs/config.go

@@ -8,8 +8,9 @@ import (
 )
 
 var (
-	Server  ServerConfiguration
-	Manager ServerManager
+	Server          ServerConfiguration
+	Manager         ServerManager
+	ARKJsonFilePath string
 )
 
 type ServerConfiguration struct {
@@ -60,4 +61,6 @@ func LoadServerConfiguration() {
 		Password: cast.ToString(password),
 	}
 
+	ARKJsonFilePath = cast.ToString(config.Get("server.file.ark-file"))
+
 }

+ 3 - 0
configs/config.yaml

@@ -3,6 +3,9 @@ server:
   manager:
     username: "admin"
     password: "123456"
+  file:
+    ark-file: "resources/demo.json"
+    #ark-file: "resources/config.json"
 mysql:
   host: localhost
   port: "3306"

+ 20 - 23
entity/ark/Config.go

@@ -3,12 +3,12 @@ package ark
 // ARKShopConfig  总配置
 
 type Config struct {
-	Mysql     Mysql               `json:"Mysql"`     //数据库
-	General   General             `json:"General"`   //概述
-	Kits      map[string]Kit      `json:"Kits"`      //礼包?
-	ShopItems map[string]ShopItem `json:"ShopItems"` //商品
-	SellItems map[string]SellItem `json:"SellItems"` //回收
-	Messages  Messages            `json:"Messages"`  //消息
+	Mysql     Mysql                  `json:"Mysql"`     //数据库
+	General   General                `json:"General"`   //概述
+	Kits      map[string]Kit         `json:"Kits"`      //礼包?
+	ShopItems map[string]interface{} `json:"ShopItems"` //商品
+	SellItems map[string]SellItem    `json:"SellItems"` //回收
+	Messages  Messages               `json:"Messages"`  //消息
 }
 
 type Mysql struct {
@@ -118,12 +118,15 @@ type SellItem struct {
 	Blueprint   string `json:"Blueprint"`   //图纸
 }
 
-// ShopItem 商城出售的商品
-type ShopItem struct {
-	Description string `json:"Description"` //描述
-	Items       []Item `json:"Items"`       //物品信息
-	Price       int    `json:"Price"`       //价格
-	Type        string `json:"Type"`        //类型,item,beacon,dino,experience,unlockengram,command
+// Kit 礼包
+type Kit struct {
+	DefaultAmount int       `json:"DefaultAmount"` //数量?
+	Price         int       `json:"Price"`         //价格
+	Description   string    `json:"Description"`   //描述
+	Permissions   string    `json:"Permissions"`   //购买权限,例如"Admins,VIP1"
+	Dinos         []Dino    `json:"Dinos"`         //恐龙
+	Items         []Item    `json:"Items"`
+	Commands      []Command `json:"Commands"`
 }
 
 // Item 物品信息
@@ -134,19 +137,13 @@ type Item struct {
 	ForceBlueprint bool    `json:"ForceBlueprint"` //
 	Quality        float64 `json:"Quality"`        //质量
 }
-
-// Kit 礼包
-type Kit struct {
-	DefaultAmount int    `json:"DefaultAmount"` //数量?
-	Price         int    `json:"Price"`         //价格
-	Description   string `json:"Description"`   //描述
-	Permissions   string `json:"Permissions"`   //购买权限,例如"Admins,VIP1"
-	Dinos         []Dino `json:"Dinos"`         //恐龙
-	Items         []Item `json:"Items"`
-}
-
 type Dino struct {
 	Level     int    `json:"Level"`     //等级
 	Neutered  bool   `json:"Neutered"`  //是否绝育
 	Blueprint string `json:"Blueprint"` //指令?
 }
+
+type Command struct {
+	Command   string `json:"Command"`
+	DisplayAs string `json:"DisplayAs"`
+}

+ 66 - 0
entity/ark/Item.go

@@ -0,0 +1,66 @@
+package ark
+
+// ShopItem 类型
+type ShopItem struct {
+	Type        string `json:"Type"`
+	Description string `json:"Description"`
+	Price       int    `json:"Price"`
+
+	Items []Item `json:"Items,omitempty"`
+}
+
+// ShopDino  类型
+type ShopDino struct {
+	Type        string `json:"Type"`
+	Description string `json:"Description"`
+	Price       int    `json:"Price"`
+
+	Level           int    `json:"Level"`
+	MinLevel        int    `json:"MinLevel,omitempty"`
+	MaxLevel        int    `json:"MaxLevel,omitempty"`
+	Neutered        bool   `json:"Neutered,omitempty"`
+	Gender          string `json:"Gender,omitempty"`
+	SaddleBlueprint string `json:"SaddleBlueprint,omitempty"`
+	Blueprint       string `json:"Blueprint"`
+}
+
+// ShopBeacon 类型
+type ShopBeacon struct {
+	Type        string `json:"Type"`
+	Description string `json:"Description"`
+	Price       int    `json:"Price"`
+
+	ClassName string `json:"ClassName"`
+}
+
+// ShopExperience 类型
+type ShopExperience struct {
+	Type        string `json:"Type"`
+	Description string `json:"Description"`
+	Price       int    `json:"Price"`
+
+	GiveToDino bool    `json:"GiveToDino"`
+	Amount     float64 `json:"Amount"`
+}
+
+// ShopUnlockengram 类型
+type ShopUnlockengram struct {
+	Type        string `json:"Type"`
+	Description string `json:"Description"`
+	Price       int    `json:"Price"`
+	Items       []struct {
+		Blueprint string `json:"Blueprint"`
+	}
+}
+
+// ShopCommand  类型
+type ShopCommand struct {
+	Type        string `json:"Type"`
+	Description string `json:"Description"`
+	Price       int    `json:"Price"`
+
+	Items []struct {
+		Command   string `json:"Command"`
+		DisplayAs string `json:"DisplayAs"`
+	} `json:"Items"`
+}

+ 264 - 0
entity/demo/Command.go

@@ -0,0 +1,264 @@
+package demo
+
+type T struct {
+	Mysql struct {
+		UseMysql  bool   `json:"UseMysql"`
+		MysqlHost string `json:"MysqlHost"`
+		MysqlUser string `json:"MysqlUser"`
+		MysqlPass string `json:"MysqlPass"`
+		MysqlDB   string `json:"MysqlDB"`
+		MysqlPort int    `json:"MysqlPort"`
+	} `json:"Mysql"`
+	General struct {
+		Discord struct {
+			Enabled    bool   `json:"Enabled"`
+			SenderName string `json:"SenderName"`
+			URL        string `json:"URL"`
+		} `json:"Discord"`
+		TimedPointsReward struct {
+			Enabled      bool `json:"Enabled"`
+			StackRewards bool `json:"StackRewards"`
+			Interval     int  `json:"Interval"`
+			Groups       struct {
+				DonatorDiamond struct {
+					Amount int `json:"Amount"`
+				} `json:"Donator-Diamond"`
+				DonatorPlatinum struct {
+					Amount int `json:"Amount"`
+				} `json:"Donator-Platinum"`
+				DonatorGold struct {
+					Amount int `json:"Amount"`
+				} `json:"Donator-Gold"`
+				Verified struct {
+					Amount int `json:"Amount"`
+				} `json:"Verified"`
+				Default struct {
+					Amount int `json:"Amount"`
+				} `json:"Default"`
+			} `json:"Groups"`
+		} `json:"TimedPointsReward"`
+		UseOriginalTradeCommandWithUI bool   `json:"UseOriginalTradeCommandWithUI"`
+		GiveDinosInCryopods           bool   `json:"GiveDinosInCryopods"`
+		UseSoulTraps                  bool   `json:"UseSoulTraps"`
+		CryoLimitedTime               bool   `json:"CryoLimitedTime"`
+		CryoItemPath                  string `json:"CryoItemPath"`
+		ItemsPerPage                  int    `json:"ItemsPerPage"`
+		ShopDisplayTime               int    `json:"ShopDisplayTime"`
+		ShopTextSize                  int    `json:"ShopTextSize"`
+		DbPathOverride                string `json:"DbPathOverride"`
+		DefaultKit                    string `json:"DefaultKit"`
+	} `json:"General"`
+	Kits struct {
+		Starter struct {
+			DefaultAmount int    `json:"DefaultAmount"`
+			Price         int    `json:"Price"`
+			Description   string `json:"Description"`
+			OnlyFromSpawn bool   `json:"OnlyFromSpawn"`
+			Items         []struct {
+				Amount         int    `json:"Amount"`
+				Quality        int    `json:"Quality"`
+				ForceBlueprint bool   `json:"ForceBlueprint"`
+				Armor          int    `json:"Armor"`
+				Blueprint      string `json:"Blueprint"`
+			} `json:"Items"`
+			Dinos []struct {
+				Level     int    `json:"Level"`
+				Blueprint string `json:"Blueprint"`
+			} `json:"Dinos"`
+		} `json:"starter"`
+		Vip struct {
+			DefaultAmount int    `json:"DefaultAmount"`
+			Description   string `json:"Description"`
+			Permissions   string `json:"Permissions"`
+			Dinos         []struct {
+				Level     int    `json:"Level"`
+				Neutered  bool   `json:"Neutered"`
+				Blueprint string `json:"Blueprint"`
+			} `json:"Dinos"`
+			Commands []struct {
+				Command   string `json:"Command"`
+				DisplayAs string `json:"DisplayAs"`
+			} `json:"Commands"`
+		} `json:"vip"`
+		Tools struct {
+			DefaultAmount int    `json:"DefaultAmount"`
+			Price         int    `json:"Price"`
+			MinLevel      int    `json:"MinLevel"`
+			MaxLevel      int    `json:"MaxLevel"`
+			Description   string `json:"Description"`
+			Items         []struct {
+				Amount         int    `json:"Amount"`
+				Quality        int    `json:"Quality"`
+				Damage         int    `json:"Damage,omitempty"`
+				ForceBlueprint bool   `json:"ForceBlueprint"`
+				Blueprint      string `json:"Blueprint"`
+				Durability     int    `json:"Durability,omitempty"`
+			} `json:"Items"`
+		} `json:"tools"`
+	} `json:"Kits"`
+	ShopItems struct {
+		Ingots100 struct {
+			Type        string `json:"Type"`
+			Description string `json:"Description"`
+			Price       int    `json:"Price"`
+			Items       []struct {
+				Quality        int    `json:"Quality"`
+				ForceBlueprint bool   `json:"ForceBlueprint"`
+				Amount         int    `json:"Amount"`
+				Blueprint      string `json:"Blueprint"`
+			} `json:"Items"`
+		} `json:"ingots100"`
+		Tools struct {
+			Type        string `json:"Type"`
+			Description string `json:"Description"`
+			Price       int    `json:"Price"`
+			Items       []struct {
+				Quality        int    `json:"Quality"`
+				ForceBlueprint bool   `json:"ForceBlueprint"`
+				Amount         int    `json:"Amount"`
+				Blueprint      string `json:"Blueprint"`
+			} `json:"Items"`
+		} `json:"tools"`
+		Para struct {
+			Type        string `json:"Type"`
+			Description string `json:"Description"`
+			Level       int    `json:"Level"`
+			Price       int    `json:"Price"`
+			MinLevel    int    `json:"MinLevel"`
+			MaxLevel    int    `json:"MaxLevel"`
+			Blueprint   string `json:"Blueprint"`
+		} `json:"para"`
+		Carno struct {
+			Type            string `json:"Type"`
+			Description     string `json:"Description"`
+			Level           int    `json:"Level"`
+			Price           int    `json:"Price"`
+			Neutered        bool   `json:"Neutered"`
+			Gender          string `json:"Gender"`
+			SaddleBlueprint string `json:"SaddleBlueprint"`
+			Blueprint       string `json:"Blueprint"`
+		} `json:"carno"`
+		Carno2 struct {
+			Type            string `json:"Type"`
+			Description     string `json:"Description"`
+			Level           int    `json:"Level"`
+			Price           int    `json:"Price"`
+			Neutered        bool   `json:"Neutered"`
+			Gender          string `json:"Gender"`
+			SaddleBlueprint string `json:"SaddleBlueprint"`
+			Blueprint       string `json:"Blueprint"`
+		} `json:"carno2"`
+		Carno3 struct {
+			Type            string `json:"Type"`
+			Description     string `json:"Description"`
+			Level           int    `json:"Level"`
+			Price           int    `json:"Price"`
+			Neutered        bool   `json:"Neutered"`
+			Gender          string `json:"Gender"`
+			SaddleBlueprint string `json:"SaddleBlueprint"`
+			Blueprint       string `json:"Blueprint"`
+		} `json:"carno3"`
+		Crate25 struct {
+			Type        string `json:"Type"`
+			Description string `json:"Description"`
+			Price       int    `json:"Price"`
+			ClassName   string `json:"ClassName"`
+		} `json:"crate25"`
+		Crate2 struct {
+			Type        string `json:"Type"`
+			Description string `json:"Description"`
+			Price       int    `json:"Price"`
+			ClassName   string `json:"ClassName"`
+		} `json:"crate2"`
+		Exp1000 struct {
+			Type        string  `json:"Type"`
+			Description string  `json:"Description"`
+			GiveToDino  bool    `json:"GiveToDino"`
+			Price       int     `json:"Price"`
+			Amount      float64 `json:"Amount"`
+		} `json:"exp1000"`
+		Tekengram struct {
+			Type        string `json:"Type"`
+			Description string `json:"Description"`
+			Price       int    `json:"Price"`
+			Items       []struct {
+				Blueprint string `json:"Blueprint"`
+			} `json:"Items"`
+		} `json:"tekengram"`
+		Allengrams struct {
+			Type        string `json:"Type"`
+			Description string `json:"Description"`
+			Price       int    `json:"Price"`
+			Items       []struct {
+				Command   string `json:"Command"`
+				DisplayAs string `json:"DisplayAs"`
+			} `json:"Items"`
+		} `json:"allengrams"`
+	} `json:"ShopItems"`
+	SellItems struct {
+		Metal struct {
+			Type        string `json:"Type"`
+			Description string `json:"Description"`
+			Price       int    `json:"Price"`
+			Amount      int    `json:"Amount"`
+			Blueprint   string `json:"Blueprint"`
+		} `json:"metal"`
+	} `json:"SellItems"`
+	Messages struct {
+		Sender                 string `json:"Sender"`
+		BoughtItem             string `json:"BoughtItem"`
+		BoughtDino             string `json:"BoughtDino"`
+		BoughtBeacon           string `json:"BoughtBeacon"`
+		BoughtExp              string `json:"BoughtExp"`
+		ReceivedPoints         string `json:"ReceivedPoints"`
+		HavePoints             string `json:"HavePoints"`
+		NoPoints               string `json:"NoPoints"`
+		WrongId                string `json:"WrongId"`
+		NoPermissionsKit       string `json:"NoPermissionsKit"`
+		CantBuyKit             string `json:"CantBuyKit"`
+		BoughtKit              string `json:"BoughtKit"`
+		AvailableKits          string `json:"AvailableKits"`
+		NoKits                 string `json:"NoKits"`
+		KitsLeft               string `json:"KitsLeft"`
+		NoKitsLeft             string `json:"NoKitsLeft"`
+		CantGivePoints         string `json:"CantGivePoints"`
+		RidingDino             string `json:"RidingDino"`
+		SentPoints             string `json:"SentPoints"`
+		GotPoints              string `json:"GotPoints"`
+		NoPlayer               string `json:"NoPlayer"`
+		FoundMorePlayers       string `json:"FoundMorePlayers"`
+		BuyUsage               string `json:"BuyUsage"`
+		ShopUsage              string `json:"ShopUsage"`
+		KitUsage               string `json:"KitUsage"`
+		BuyKitUsage            string `json:"BuyKitUsage"`
+		TradeUsage             string `json:"TradeUsage"`
+		PointsCmd              string `json:"PointsCmd"`
+		TradeCmd               string `json:"TradeCmd"`
+		BuyCmd                 string `json:"BuyCmd"`
+		ShopCmd                string `json:"ShopCmd"`
+		KitCmd                 string `json:"KitCmd"`
+		BuyKitCmd              string `json:"BuyKitCmd"`
+		SellCmd                string `json:"SellCmd"`
+		ShopSellCmd            string `json:"ShopSellCmd"`
+		SellUsage              string `json:"SellUsage"`
+		NotEnoughItems         string `json:"NotEnoughItems"`
+		SoldItems              string `json:"SoldItems"`
+		BadLevel               string `json:"BadLevel"`
+		KitsListPrice          string `json:"KitsListPrice"`
+		KitsListFormat         string `json:"KitsListFormat"`
+		StoreListDino          string `json:"StoreListDino"`
+		StoreListItem          string `json:"StoreListItem"`
+		StoreListFormat        string `json:"StoreListFormat"`
+		OnlyOnSpawnKit         string `json:"OnlyOnSpawnKit"`
+		HelpCmd                string `json:"HelpCmd"`
+		ShopMessage            string `json:"ShopMessage"`
+		HelpMessage            string `json:"HelpMessage"`
+		RefundError            string `json:"RefundError"`
+		ShopFindCmd            string `json:"ShopFindCmd"`
+		ShopFindUsage          string `json:"ShopFindUsage"`
+		ShopFindNotFound       string `json:"ShopFindNotFound"`
+		ShopFindTooManyResults string `json:"ShopFindTooManyResults"`
+		NoPermissionsStore     string `json:"NoPermissionsStore"`
+		InventoryIsFull        string `json:"InventoryIsFull"`
+	} `json:"Messages"`
+}

+ 0 - 2
main.go

@@ -17,8 +17,6 @@ import (
 )
 
 func main() {
-	//加载配置文件
-	router.ARKConfig = util.LoadArkShopConfig("resources/config.json")
 	engine := gin.Default()
 	router.LoadRouter(engine)
 	engine.StaticFS("/static", gin.Dir("file", true))

+ 120 - 0
resources/d.json

@@ -0,0 +1,120 @@
+{
+  "ingots100": {
+    "Type": "item",
+    "Description": "Metal Ingot (100x)",
+    "Price": 15,
+    "Items": [
+      {
+        "Quality": 0,
+        "ForceBlueprint": false,
+        "Amount": 100,
+        "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Resources/PrimalItemResource_MetalIngot.PrimalItemResource_MetalIngot'"
+      }
+    ]
+  },
+  "tools": {
+    "Type": "item",
+    "Description": "Tools (Metal Hatchet, Metal Pick)",
+    "Price": 5,
+    "Items": [
+      {
+        "Quality": 0,
+        "ForceBlueprint": false,
+        "Amount": 1,
+        "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalHatchet.PrimalItem_WeaponMetalHatchet'"
+      },
+      {
+        "Quality": 0,
+        "ForceBlueprint": false,
+        "Amount": 1,
+        "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalPick.PrimalItem_WeaponMetalPick'"
+      }
+    ]
+  },
+  "para": {
+    "Type": "dino",
+    "Description": "Parasaurolophus",
+    "Level": 10,
+    "Price": 20,
+    "MinLevel": 10,
+    "MaxLevel": 15,
+    "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Para/Para_Character_BP.Para_Character_BP'"
+  },
+  "carno": {
+    "Type": "dino",
+    "Description": "Male Carnotaurus",
+    "Level": 15,
+    "Price": 50,
+    "Neutered": true,
+    "Gender": "male",
+    //Give male dino
+    "SaddleBlueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_CarnoSaddle.PrimalItemArmor_CarnoSaddle'",
+    "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Carno/Carno_Character_BP.Carno_Character_BP'"
+  },
+  "carno2": {
+    "Type": "dino",
+    "Description": "Female Carnotaurus",
+    "Level": 15,
+    "Price": 50,
+    "Neutered": true,
+    "Gender": "female",
+    //Give female dino
+    "SaddleBlueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_CarnoSaddle.PrimalItemArmor_CarnoSaddle'",
+    "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Carno/Carno_Character_BP.Carno_Character_BP'"
+  },
+  "carno3": {
+    "Type": "dino",
+    "Description": "Random Gender Carnotaurus",
+    "Level": 15,
+    "Price": 50,
+    "Neutered": true,
+    "Gender": "random",
+    //Give random gender dino (this can be removed to also produce a random gender)
+    "SaddleBlueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_CarnoSaddle.PrimalItemArmor_CarnoSaddle'",
+    "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Carno/Carno_Character_BP.Carno_Character_BP'"
+  },
+  "crate25": {
+    "Type": "beacon",
+    "Description": "SupplyCrate Lvl 25",
+    "Price": 100,
+    "ClassName": "SupplyCrate_Level25_Double_C"
+  },
+  "crate2": {
+    "Type": "beacon",
+    "Description": "Artifact Crate 2",
+    "Price": 100,
+    "ClassName": "ArtifactCrate_2_C"
+  },
+  "exp1000": {
+    "Type": "experience",
+    "Description": "1000 points of experience",
+    "GiveToDino": false,
+    "Price": 55,
+    "Amount": 1000.0
+  },
+  "tekengram": {
+    "Type": "unlockengram",
+    "Description": "Engram TEK Boots & Gloves",
+    "Price": 20,
+    "Items": [
+      {
+        "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/TEK/PrimalItemArmor_TekBoots.PrimalItemArmor_TekBoots'"
+      },
+      {
+        "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/TEK/PrimalItemArmor_TekGloves.PrimalItemArmor_TekGloves'"
+      }
+    ]
+  },
+  "allengrams": {
+    "Type": "command",
+    "Description": "All engrams",
+    "Price": 1000,
+    "Items": [
+      {
+        "Command": "GiveEngrams",
+        "DisplayAs": "Gives you all engram unlocks"
+        //Only used in the Shop UI to display instead of the command itself
+      }
+    ]
+  }
+}

+ 296 - 0
resources/demo.json

@@ -0,0 +1,296 @@
+{
+  "Mysql": {
+    "UseMysql": false,
+    "MysqlHost": "localhost",
+    "MysqlUser": "apitest",
+    "MysqlPass": "12345",
+    "MysqlDB": "apitest",
+    "MysqlPort": 3306
+  },
+  "General": {
+    "Discord": {
+      "Enabled": false,
+      "SenderName": "ArkShop",
+      "URL": ""
+    },
+    "TimedPointsReward": {
+      "Enabled": true,
+      "StackRewards": false,
+      "Interval": 30,
+      "Groups": {
+        "Donator-Diamond": {
+          "Amount": 40
+        },
+        "Donator-Platinum": {
+          "Amount": 40
+        },
+        "Donator-Gold": {
+          "Amount": 40
+        },
+        "Verified": {
+          "Amount": 30
+        },
+        "Default": {
+          "Amount": 20
+        }
+      }
+    },
+    "UseOriginalTradeCommandWithUI": false,
+    "GiveDinosInCryopods": true,
+    "UseSoulTraps": false,
+    "CryoLimitedTime": false,
+    "CryoItemPath": "",
+    "ItemsPerPage": 25,
+    "ShopDisplayTime": 5,
+    "ShopTextSize": 1,
+    "DbPathOverride": "",
+    "DefaultKit": ""
+  },
+  "Kits": {
+    "starter": {
+      "DefaultAmount": 2,
+      "Price": 90,
+      "Description": "Starter kit (carno with saddle)",
+      "OnlyFromSpawn": true,
+      "Items": [
+        {
+          "Amount": 1,
+          "Quality": 0,
+          "ForceBlueprint": false,
+          "Armor": 80,
+          "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_CarnoSaddle.PrimalItemArmor_CarnoSaddle'"
+        }
+      ],
+      "Dinos": [
+        {
+          "Level": 10,
+          "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Carno/Carno_Character_BP.Carno_Character_BP'"
+        }
+      ]
+    },
+    "vip": {
+      "DefaultAmount": 1,
+      "Description": "Vip kit for premiums (ptero)",
+      "Permissions": "Admins,Premiums",
+      "Dinos": [
+        {
+          "Level": 20,
+          "Neutered": true,
+          "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Ptero/Ptero_Character_BP.Ptero_Character_BP'"
+        }
+      ],
+      "Commands": [
+        {
+          "Command": "GiveEngrams",
+          "DisplayAs": "Gives you all engram unlocks"
+        }
+      ]
+    },
+    "tools": {
+      "DefaultAmount": 3,
+      "Price": 50,
+      "MinLevel": 1,
+      "MaxLevel": 20,
+      "Description": "Tools kit (pike and club)",
+      "Items": [
+        {
+          "Amount": 1,
+          "Quality": 0,
+          "Damage": 300,
+
+          "ForceBlueprint": false,
+          "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponPike.PrimalItem_WeaponPike'"
+        },
+        {
+          "Amount": 1,
+          "Quality": 0,
+          "Durability": 300,
+          "ForceBlueprint": false,
+          "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponStoneClub.PrimalItem_WeaponStoneClub'"
+        }
+      ]
+    }
+  },
+  "ShopItems": {
+    "ingots100": {
+      "Type": "item",
+      "Description": "Metal Ingot (100x)",
+      "Price": 15,
+      "Items": [
+        {
+          "Quality": 0,
+          "ForceBlueprint": false,
+          "Amount": 100,
+          "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Resources/PrimalItemResource_MetalIngot.PrimalItemResource_MetalIngot'"
+        }
+      ]
+    },
+    "tools": {
+      "Type": "item",
+      "Description": "Tools (Metal Hatchet, Metal Pick)",
+      "Price": 5,
+      "Items": [
+        {
+          "Quality": 0,
+          "ForceBlueprint": false,
+          "Amount": 1,
+          "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalHatchet.PrimalItem_WeaponMetalHatchet'"
+        },
+        {
+          "Quality": 0,
+          "ForceBlueprint": false,
+          "Amount": 1,
+          "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Weapons/PrimalItem_WeaponMetalPick.PrimalItem_WeaponMetalPick'"
+        }
+      ]
+    },
+    "para": {
+      "Type": "dino",
+      "Description": "Parasaurolophus",
+      "Level": 10,
+      "Price": 20,
+      "MinLevel": 10,
+      "MaxLevel": 15,
+      "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Para/Para_Character_BP.Para_Character_BP'"
+    },
+    "carno": {
+      "Type": "dino",
+      "Description": "Male Carnotaurus",
+      "Level": 15,
+      "Price": 50,
+      "Neutered": true,
+      "Gender": "male",
+      "SaddleBlueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_CarnoSaddle.PrimalItemArmor_CarnoSaddle'",
+      "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Carno/Carno_Character_BP.Carno_Character_BP'"
+    },
+    "carno2": {
+      "Type": "dino",
+      "Description": "Female Carnotaurus",
+      "Level": 15,
+      "Price": 50,
+      "Neutered": true,
+      "Gender": "female",
+      "SaddleBlueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_CarnoSaddle.PrimalItemArmor_CarnoSaddle'",
+      "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Carno/Carno_Character_BP.Carno_Character_BP'"
+    },
+    "carno3": {
+      "Type": "dino",
+      "Description": "Random Gender Carnotaurus",
+      "Level": 15,
+      "Price": 50,
+      "Neutered": true,
+      "Gender": "random",
+      "SaddleBlueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/Saddles/PrimalItemArmor_CarnoSaddle.PrimalItemArmor_CarnoSaddle'",
+      "Blueprint": "Blueprint'/Game/PrimalEarth/Dinos/Carno/Carno_Character_BP.Carno_Character_BP'"
+    },
+    "crate25": {
+      "Type": "beacon",
+      "Description": "SupplyCrate Lvl 25",
+      "Price": 100,
+      "ClassName": "SupplyCrate_Level25_Double_C"
+    },
+    "crate2": {
+      "Type": "beacon",
+      "Description": "Artifact Crate 2",
+      "Price": 100,
+      "ClassName": "ArtifactCrate_2_C"
+    },
+    "exp1000": {
+      "Type": "experience",
+      "Description": "1000 points of experience",
+      "GiveToDino": false,
+      "Price": 55,
+      "Amount": 1000.0
+    },
+    "tekengram": {
+      "Type": "unlockengram",
+      "Description": "Engram TEK Boots & Gloves",
+      "Price": 20,
+      "Items": [
+        {
+          "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/TEK/PrimalItemArmor_TekBoots.PrimalItemArmor_TekBoots'"
+        },
+        {
+          "Blueprint": "Blueprint'/Game/PrimalEarth/CoreBlueprints/Items/Armor/TEK/PrimalItemArmor_TekGloves.PrimalItemArmor_TekGloves'"
+        }
+      ]
+    },
+    "allengrams": {
+      "Type": "command",
+      "Description": "All engrams",
+      "Price": 1000,
+      "Items": [
+        {
+          "Command": "GiveEngrams",
+          "DisplayAs": "Gives you all engram unlocks"
+        }
+      ]
+    }
+  },
+  "SellItems": {
+    "metal": {
+      "Type": "item",
+      "Description": "100x stone",
+      "Price": 10,
+      "Amount": 100,
+      "Blueprint": "Blueprint'/Game/Mods/Stack50/Resources/PrimalItemResource_Stone_Child.PrimalItemResource_Stone_Child'"
+    }
+  },
+  "Messages": {
+    "Sender": "ArkShop",
+    "BoughtItem": "<RichColor Color=\"0, 1, 0, 1\">You have successfully bought item</>",
+    "BoughtDino": "<RichColor Color=\"0, 1, 0, 1\">You have successfully bought dino</>",
+    "BoughtBeacon": "<RichColor Color=\"0, 1, 0, 1\">You have successfully bought beacon</>",
+    "BoughtExp": "<RichColor Color=\"0, 1, 0, 1\">You have successfully bought experience</>",
+    "ReceivedPoints": "<RichColor Color=\"1, 1, 0, 1\">You have received {0} points! (total: {1})</>",
+    "HavePoints": "You have {0} points",
+    "NoPoints": "<RichColor Color=\"1, 0, 0, 1\">You don't have enough points</>",
+    "WrongId": "<RichColor Color=\"1, 0, 0, 1\">Wrong id</>",
+    "NoPermissionsKit": "<RichColor Color=\"1, 0, 0, 1\">You don't have permission to use this kit</>",
+    "CantBuyKit": "<RichColor Color=\"1, 0, 0, 1\">You can't buy this kit</>",
+    "BoughtKit": "<RichColor Color=\"0, 1, 0, 1\">You have successfully bought {0} kit</>",
+    "AvailableKits": "Available kits for you:",
+    "NoKits": "No available kits",
+    "KitsLeft": "You have {0} {1} kits left",
+    "NoKitsLeft": "You don't have {0} kits left",
+    "CantGivePoints": "<RichColor Color=\"1, 0, 0, 1\">You can't give points to yourself</>",
+    "RidingDino": "<RichColor Color=\"1, 0, 0, 1\">You can't buy this item while riding a dino</>",
+    "SentPoints": "<RichColor Color=\"0, 1, 0, 1\">You have successfully sent {0} points to {1}</>",
+    "GotPoints": "You have received {0} points from {1}",
+    "NoPlayer": "<RichColor Color=\"1, 0, 0, 1\">Player doesn't exist</>",
+    "FoundMorePlayers": "<RichColor Color=\"1, 0, 0, 1\">Found more than one player with the given name</>",
+    "BuyUsage": "Usage: /buy id amount",
+    "ShopUsage": "Usage: /shop page",
+    "KitUsage": "Usage: /kit KitName",
+    "BuyKitUsage": "Usage: /BuyKit KitName amount",
+    "TradeUsage": "Usage: /trade 'Player Name' amount",
+    "PointsCmd": "/points",
+    "TradeCmd": "/trade",
+    "BuyCmd": "/buy",
+    "ShopCmd": "/shop",
+    "KitCmd": "/kit",
+    "BuyKitCmd": "/buykit",
+    "SellCmd": "/sell",
+    "ShopSellCmd": "/shopsell",
+    "SellUsage": "Usage: /sell id amount",
+    "NotEnoughItems": "<RichColor Color=\"1, 0, 0, 1\">You don't have enough items ({0}/{1})</>",
+    "SoldItems": "<RichColor Color=\"0, 1, 0, 1\">You have successfully sold items</>",
+    "BadLevel": "<RichColor Color=\"1, 0, 0, 1\">Required level: {0} - {1}</>",
+    "KitsListPrice": "Price: {0}",
+    "KitsListFormat": "\"{0}\" - {1}. {2} left. {3}\n",
+    "StoreListDino": "{0}) {1}. Level: {2}. Id: {3}. Price: {4}\n",
+    "StoreListItem": "{0}) {1}. Id: {2}. Price: {3}\n",
+    "StoreListFormat": "{0}",
+    "OnlyOnSpawnKit": "This kit can be used only on spawn",
+    "HelpCmd": "/shophelp",
+    "ShopMessage": "Usage: /buy id amount",
+    "HelpMessage": "This is shop help message",
+    "RefundError": "Points refunded due to an error",
+    "ShopFindCmd": "/shopfind",
+    "ShopFindUsage": "Usage: /shopfind searchterm",
+    "ShopFindNotFound": "No items matched your search",
+    "ShopFindTooManyResults": "Too many results to display refine your search term",
+    "NoPermissionsStore": "<RichColor Color=\"1, 0, 0, 1\">You don't have permission to buy this {0}!</>",
+    "InventoryIsFull": "<RichColor Color=\"1, 0, 0, 1\">Unable to redeem your kit, inventory full!</>"
+  }
+}

+ 182 - 39
router/ARKConfigRouter.go

@@ -167,40 +167,43 @@ func DeleteGroup(c *gin.Context) {
 func GetKits(c *gin.Context) {
 	c.JSON(200, CreateResultData(ARKConfig.Kits))
 }
+
 func SaveKit(c *gin.Context) {
 	param := util.GetJsonAnyParam(c)
-	g, err := param("kit")
+	obj, err := param("kit")
+	Name, err := param("kitName")
 	if err != nil {
 		c.JSON(200, CreateResultError(400, "参数错误"))
 		return
 	}
 	var Kit = ark.Kit{}
-	err = util.DataToObject(g, &Kit)
+	err = util.DataToObject(obj, &Kit)
 	if Kit.Description == "" || Kit.Price == 0 || Kit.DefaultAmount == 0 {
 		c.JSON(200, CreateResultError(400, "礼包描述不能为空,价格,数量不能为0"))
 		return
 	}
-	ARKConfig.Kits[Kit.Description] = Kit
+	ARKConfig.Kits[cast.ToString(Name)] = Kit
 }
 func UpdateKit(c *gin.Context) {
 	param := util.GetJsonAnyParam(c)
-	g, err := param("kit")
+	obj, err := param("kit")
+	Name, err := param("kitName")
 	if err != nil {
 		c.JSON(200, CreateResultError(400, "参数错误"))
 		return
 	}
 	var Kit = ark.Kit{}
-	err = util.DataToObject(g, &Kit)
-	if Kit.Description == "" {
-		c.JSON(200, CreateResultError(400, "礼包描述不能为空"))
+	err = util.DataToObject(obj, &Kit)
+	if Name == "" {
+		c.JSON(200, CreateResultError(400, "礼包不能为空"))
 	}
-	_, ok := ARKConfig.Kits[Kit.Description]
+	_, ok := ARKConfig.Kits[cast.ToString(Name)]
 	if ok {
 		if Kit.Price == 0 || Kit.DefaultAmount == 0 {
 			c.JSON(200, CreateResultError(400, "价格,数量不能为0"))
 			return
 		}
-		ARKConfig.Kits[Kit.Description] = Kit
+		ARKConfig.Kits[cast.ToString(Name)] = Kit
 		c.JSON(200, CreateResult())
 		return
 	}
@@ -231,54 +234,186 @@ func DeleteKit(c *gin.Context) {
 //====================商店==========================
 
 func GetShopItem(c *gin.Context) {
-	c.JSON(200, CreateResultData(ARKConfig.ShopItems))
+	value := c.Query("type")
+	if value == "" {
+		c.JSON(200, CreateResultData(ARKConfig.ShopItems))
+		return
+	}
+	switch cast.ToString(value) {
+	case "item":
+		c.JSON(200, CreateResultData(ARKShopItems))
+		break
+	case "dino":
+		c.JSON(200, CreateResultData(ARKShopDines))
+		break
+	case "beacon":
+		c.JSON(200, CreateResultData(ARKShopBeacons))
+		break
+	case "experience":
+		c.JSON(200, CreateResultData(ARKShopExperiences))
+		break
+	case "unlockengram":
+		c.JSON(200, CreateResultData(ARKShopUnlockengram))
+		break
+	case "command":
+		c.JSON(200, CreateResultData(ARKShopCommands))
+		break
+	default:
+		c.JSON(200, CreateResultError(400, "商店类型错误"))
+	}
+
 }
 
 func SaveShopItem(c *gin.Context) {
 	param := util.GetJsonAnyParam(c)
-	g, err := param("shopItem")
+	obj, err := param("shopItem")
+	if err != nil {
+		c.JSON(200, CreateResultError(400, "参数错误"))
+		return
+	}
+	shopType, err := param("shopType")
+	if err != nil {
+		c.JSON(200, CreateResultError(400, "参数错误"))
+		return
+	}
+	Name, err := param("shopItemName")
 	if err != nil {
 		c.JSON(200, CreateResultError(400, "参数错误"))
 		return
 	}
-	var ShopItem = ark.ShopItem{}
-	err = util.DataToObject(g, &ShopItem)
-	if ShopItem.Description == "" || ShopItem.Price == 0 || ShopItem.Type == "" {
+	toMap := util.DataToMap(obj)
+	if cast.ToString(Name) == "" || toMap["Price"] == 0 || toMap["Type"] == "" {
 		c.JSON(200, CreateResultError(400, "商店描述,价格,类型不能为空,为0"))
 		return
 	}
-	_, ok := ARKConfig.ShopItems[ShopItem.Description]
+	_, ok := ARKConfig.ShopItems[cast.ToString(Name)]
 	if ok {
 		c.JSON(200, CreateResultError(400, "商品名已存在"))
 		return
 	}
-	ARKConfig.ShopItems[ShopItem.Description] = ShopItem
+
+	switch cast.ToString(shopType) {
+	case "item":
+		var item = ark.ShopItem{}
+		err = util.DataToObject(obj, &item)
+		ARKConfig.ShopItems[cast.ToString(Name)] = item
+		ARKShopItems[cast.ToString(Name)] = item
+		break
+	case "dino":
+		var dino = ark.ShopDino{}
+		err = util.DataToObject(obj, &dino)
+		ARKConfig.ShopItems[cast.ToString(Name)] = dino
+		ARKShopDines[cast.ToString(Name)] = dino
+		break
+	case "baecon":
+		var beacon = ark.ShopBeacon{}
+		err = util.DataToObject(obj, &beacon)
+		ARKConfig.ShopItems[cast.ToString(Name)] = beacon
+		ARKShopBeacons[cast.ToString(Name)] = beacon
+		break
+	case "experience":
+		var experience = ark.ShopExperience{}
+		err = util.DataToObject(obj, &experience)
+		ARKConfig.ShopItems[cast.ToString(Name)] = experience
+		ARKShopExperiences[cast.ToString(Name)] = experience
+		break
+	case "unlockengram":
+		var unlockengram = ark.ShopCommand{}
+		err = util.DataToObject(obj, &unlockengram)
+		ARKConfig.ShopItems[cast.ToString(Name)] = unlockengram
+		ARKShopCommands[cast.ToString(Name)] = unlockengram
+		break
+	case "command":
+		var command = ark.ShopCommand{}
+		err = util.DataToObject(obj, &command)
+		ARKConfig.ShopItems[cast.ToString(Name)] = command
+		ARKShopCommands[cast.ToString(Name)] = command
+		break
+	default:
+		c.JSON(200, CreateResultError(400, "商店类型错误"))
+		return
+	}
+	c.JSON(200, CreateResult())
 }
 
 func UpdateShopItem(c *gin.Context) {
 	param := util.GetJsonAnyParam(c)
-	g, err := param("shopItem")
+	obj, err := param("shopItem")
+	if err != nil {
+		c.JSON(200, CreateResultError(400, "参数错误"))
+		return
+	}
+	shopType, err := param("shopType")
+	if err != nil {
+		c.JSON(200, CreateResultError(400, "参数错误"))
+		return
+	}
+	Name, err := param("shopItemName")
 	if err != nil {
 		c.JSON(200, CreateResultError(400, "参数错误"))
 		return
 	}
-	var ShopItem = ark.ShopItem{}
-	err = util.DataToObject(g, &ShopItem)
-	if ShopItem.Description == "" {
+
+	if cast.ToString(Name) == "" {
 		c.JSON(200, CreateResultError(400, "商店名不能为空"))
 		return
 	}
-	_, ok := ARKConfig.ShopItems[ShopItem.Description]
-	if ok {
-		if ShopItem.Price == 0 || ShopItem.Type == "" {
-			c.JSON(200, CreateResultError(400, "价格,类型不能为空,为0"))
-			return
-		}
-		ARKConfig.ShopItems[ShopItem.Description] = ShopItem
-		c.JSON(200, CreateResult())
+	toMap := util.DataToMap(obj)
+	if cast.ToString(Name) == "" || toMap["Price"] == 0 || toMap["Type"] == "" {
+		c.JSON(200, CreateResultError(400, "商店描述,价格,类型不能为空,为0"))
+		return
+	}
+	_, ok := ARKConfig.ShopItems[cast.ToString(Name)]
+	if !ok {
+		c.JSON(200, CreateResultError(400, "商品名不存在"))
+		return
+	}
+	if toMap["Price"] == 0 || toMap["Type"] == "" {
+		c.JSON(200, CreateResultError(400, "价格,类型不能为空,为0"))
+		return
+	}
+	switch cast.ToString(shopType) {
+	case "item":
+		var item = ark.ShopItem{}
+		err = util.DataToObject(obj, &item)
+		ARKConfig.ShopItems[cast.ToString(Name)] = item
+		ARKShopItems[cast.ToString(Name)] = item
+		break
+	case "dino":
+		var dino = ark.ShopDino{}
+		err = util.DataToObject(obj, &dino)
+		ARKConfig.ShopItems[cast.ToString(Name)] = dino
+		ARKShopDines[cast.ToString(Name)] = dino
+		break
+	case "baecon":
+		var beacon = ark.ShopBeacon{}
+		err = util.DataToObject(obj, &beacon)
+		ARKConfig.ShopItems[cast.ToString(Name)] = beacon
+		ARKShopBeacons[cast.ToString(Name)] = beacon
+		break
+	case "experience":
+		var experience = ark.ShopExperience{}
+		err = util.DataToObject(obj, &experience)
+		ARKConfig.ShopItems[cast.ToString(Name)] = experience
+		ARKShopExperiences[cast.ToString(Name)] = experience
+		break
+	case "unlockengram":
+		var unlockengram = ark.ShopCommand{}
+		err = util.DataToObject(obj, &unlockengram)
+		ARKConfig.ShopItems[cast.ToString(Name)] = unlockengram
+		ARKShopCommands[cast.ToString(Name)] = unlockengram
+		break
+	case "command":
+		var command = ark.ShopCommand{}
+		err = util.DataToObject(obj, &command)
+		ARKConfig.ShopItems[cast.ToString(Name)] = command
+		ARKShopCommands[cast.ToString(Name)] = command
+		break
+	default:
+		c.JSON(200, CreateResultError(400, "商店类型错误"))
 		return
 	}
-	c.JSON(200, CreateResultError(400, "商品名不存在"))
+	c.JSON(200, CreateResult())
 }
 
 func DeleteShopItem(c *gin.Context) {
@@ -296,6 +431,12 @@ func DeleteShopItem(c *gin.Context) {
 	if ok {
 		//删除一个元素
 		delete(ARKConfig.ShopItems, cast.ToString(name))
+		delete(ARKShopItems, cast.ToString(name))
+		delete(ARKShopDines, cast.ToString(name))
+		delete(ARKShopBeacons, cast.ToString(name))
+		delete(ARKShopExperiences, cast.ToString(name))
+		delete(ARKShopUnlockengram, cast.ToString(name))
+		delete(ARKShopCommands, cast.ToString(name))
 		c.JSON(200, CreateResult())
 		return
 	}
@@ -310,46 +451,48 @@ func GetSellItem(c *gin.Context) {
 
 func SaveSellItem(c *gin.Context) {
 	param := util.GetJsonAnyParam(c)
-	g, err := param("sellItem")
+	obj, err := param("sellItem")
+	Name, err := param("sellItemName")
 	if err != nil {
 		c.JSON(http.StatusBadRequest, CreateResultError(400, "参数错误"))
 		return
 	}
 	var sellItem ark.SellItem
-	err = util.DataToObject(g, &sellItem)
-	if sellItem.Description == "" || sellItem.Price == 0 || sellItem.Type == "" {
+	err = util.DataToObject(obj, &sellItem)
+	if cast.ToString(Name) == "" || sellItem.Price == 0 || sellItem.Type == "" {
 		c.JSON(http.StatusBadRequest, CreateResultError(400, "描述、价格、类型不能为空或为0"))
 		return
 	}
-	_, ok := ARKConfig.SellItems[sellItem.Description]
+	_, ok := ARKConfig.SellItems[cast.ToString(Name)]
 	if ok {
 		c.JSON(http.StatusBadRequest, CreateResultError(400, "商品名已存在"))
 		return
 	}
-	ARKConfig.SellItems[sellItem.Description] = sellItem
+	ARKConfig.SellItems[cast.ToString(Name)] = sellItem
 	c.JSON(http.StatusOK, CreateResult())
 }
 
 func UpdateSellItem(c *gin.Context) {
 	param := util.GetJsonAnyParam(c)
-	g, err := param("sellItem")
+	obj, err := param("sellItem")
+	Name, err := param("sellItemName")
 	if err != nil {
 		c.JSON(http.StatusBadRequest, CreateResultError(400, "参数错误"))
 		return
 	}
 	var sellItem ark.SellItem
-	err = util.DataToObject(g, &sellItem)
-	if sellItem.Description == "" {
+	err = util.DataToObject(obj, &sellItem)
+	if cast.ToString(Name) == "" {
 		c.JSON(http.StatusBadRequest, CreateResultError(400, "商品描述不能为空"))
 		return
 	}
-	_, ok := ARKConfig.SellItems[sellItem.Description]
+	_, ok := ARKConfig.SellItems[cast.ToString(Name)]
 	if ok {
 		if sellItem.Price == 0 || sellItem.Type == "" {
 			c.JSON(http.StatusBadRequest, CreateResultError(400, "价格、类型不能为空或为0"))
 			return
 		}
-		ARKConfig.SellItems[sellItem.Description] = sellItem
+		ARKConfig.SellItems[cast.ToString(Name)] = sellItem
 		c.JSON(http.StatusOK, CreateResult())
 		return
 	}

+ 15 - 1
router/Router.go

@@ -10,6 +10,20 @@ import (
 
 var ARKConfig ark.Config
 
+// ARKShopItems 商城物品列表
+var ARKShopItems map[string]ark.ShopItem
+var ARKShopDines map[string]ark.ShopDino
+var ARKShopBeacons map[string]ark.ShopBeacon
+var ARKShopExperiences map[string]ark.ShopExperience
+var ARKShopUnlockengram map[string]ark.ShopUnlockengram
+var ARKShopCommands map[string]ark.ShopCommand
+
+func init() {
+	//加载配置文件
+	ARKConfig, ARKShopItems, ARKShopDines, ARKShopBeacons, ARKShopExperiences, ARKShopUnlockengram, ARKShopCommands =
+		util.LoadArkShopConfig(configs.ARKJsonFilePath)
+}
+
 func LoadRouter(router *gin.Engine) {
 	router.POST("/login", Login)
 	router.Use(Calibration())
@@ -26,7 +40,7 @@ func Calibration() gin.HandlerFunc {
 		}
 		token, err := util.ParseToken(header)
 		if err != nil {
-			c.JSON(200, CreateResultError(500, "token解析失败"))
+			c.JSON(200, CreateResultError(565, "token解析失败"))
 			c.Abort()
 			return
 		}

+ 122 - 0
ui/src/api/ARKShopItemAPI.ts

@@ -0,0 +1,122 @@
+import {Item} from "./ConfigFile.ts";
+import {GetDataByPath, PutDataByPath, ResponseData} from "./api.ts";
+
+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[]
+
+    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
+
+    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
+
+    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
+
+    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[]
+
+    constructor(Description: string, Price: number, Type: string, Items: ShopUnlockengramItem[]) {
+        super(Description, Price, Type);
+        this.Items = Items;
+    }
+}
+
+export class ShopUnlockengramItem {
+    Blueprint: string
+
+    constructor(Blueprint: string) {
+        this.Blueprint = Blueprint;
+    }
+}
+
+export class ShopCommand extends ShopData {
+    Items: ShopCommandItem[]
+
+    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<ShopItem[]>>;
+}
+
+export function SaveShopItem(shopItem: ShopItem) {
+    return PutDataByPath("/ark/shopItem", shopItem, true)
+}
+
+export function UpdateShopItem(oldShopItem: ShopItem, newShopItem: ShopItem) {
+    return PutDataByPath("/ark/shopItem", {
+        oldShopItem: oldShopItem, newShopItem: newShopItem
+    }, true)
+}
+
+export function DeleteShopItem(shopItemName: string) {
+    return PutDataByPath("/ark/shopItem", {shopItemName: shopItemName}, true)
+}
+

+ 146 - 14
ui/src/api/ConfigFile.ts

@@ -1,6 +1,5 @@
 import {GetDataByPath, PutDataByPath, ResponseData} from './api.ts';
 
-
 export class Messages {
     Sender: string;
     BoughtItem: string;
@@ -120,19 +119,6 @@ export function GetArkConfig(): Promise<ResponseData<Messages>> {
     return GetDataByPath("/ark/messages", {}, true) as Promise<ResponseData<Messages>>;
 }
 
-//type General struct {
-// 	Discord                       Discord           `json:"Discord"`           //联系方式
-// 	TimedPointsReward             TimedPointsReward `json:"TimedPointsReward"` //计时积分奖励
-// 	UseOriginalTradeCommandWithUI bool              `json:"UseOriginalTradeCommandWithUI"`
-// 	ItemsPerPage                  int               `json:"ItemsPerPage"`        //每页项目数
-// 	ShopDisplayTime               float64           `json:"ShopDisplayTime"`     //店铺展示时间
-// 	ShopTextSize                  float64           `json:"ShopTextSize"`        //店铺文字大小
-// 	DbPathOverride                string            `json:"DbPathOverride"`      //db文件位置
-// 	DefaultKit                    string            `json:"DefaultKit"`          //默认礼包?
-// 	GiveDinosInCryopods           bool              `json:"GiveDinosInCryopods"` //在低温仓给恐龙
-// 	UseSoulTraps                  bool              `json:"UseSoulTraps"`        //使用灵魂陷阱?
-// 	CryoLimitedTime               bool              `json:"CryoLimitedTime"`     //低温仓有限时间?
-
 export class General {
     Discord: Discord
     TimedPointsReward: TimedPointsReward
@@ -235,7 +221,153 @@ export function UpdateGroup(oldGroup: Group, newGroup: Group) {
 export function GetGeneral(): Promise<ResponseData<General>> {
     return GetDataByPath("/ark/general", {}, true) as Promise<ResponseData<General>>;
 }
+
 export function UpdateGeneral(general: General) {
     return PutDataByPath("/ark/general", general, true)
 }
 
+//礼包
+export class Kit {
+    Name: string
+    DefaultAmount: number
+    Price: number
+    Description: string
+    Permissions: string
+    Dinos: Dino[]
+    Items: Item[]
+
+    constructor(Name: string, DefaultAmount: number, Price: number, Description: string, Permissions: string, Dinos: Dino[], Items: Item[]) {
+        this.Name = Name;
+        this.DefaultAmount = DefaultAmount;
+        this.Price = Price;
+        this.Description = Description;
+        this.Permissions = Permissions;
+        this.Dinos = Dinos;
+        this.Items = Items;
+    }
+}
+
+export class Dino {
+    Level: number
+    Neutered: boolean
+    Blueprint: string
+
+    constructor(Level: number, Neutered: boolean, Blueprint: string) {
+        this.Level = Level;
+        this.Neutered = Neutered;
+        this.Blueprint = Blueprint;
+    }
+}
+
+export class Item {
+    Amount: number
+    Blueprint: string
+    Fixed: boolean
+    ForceBlueprint: boolean
+    Quality: number
+
+
+    constructor(Amount: number, Blueprint: string, Fixed: boolean, ForceBlueprint: boolean, Quality: number) {
+        this.Amount = Amount;
+        this.Blueprint = Blueprint;
+        this.Fixed = Fixed;
+        this.ForceBlueprint = ForceBlueprint;
+        this.Quality = Quality;
+    }
+}
+
+export function GetKits() {
+    return GetDataByPath("/ark/kit", {}, true) as Promise<ResponseData<Kit[]>>;
+}
+
+export function SaveKit(kit: Kit) {
+    return PutDataByPath("/ark/kit", kit, true)
+}
+
+export function UpdateKit(oldKit: Kit, newKit: Kit) {
+    return PutDataByPath("/ark/kit", {
+        oldKit: oldKit, newKit: newKit
+    }, true)
+}
+
+export function DeleteKit(kitName: string) {
+    return PutDataByPath("/ark/kit", {kitName: kitName}, true)
+}
+
+export class ShopItem {
+    Description: string
+    Items: Item[]
+    Price: number
+    Type: string
+
+    constructor(Description: string, Items: Item[], Price: number, Type: string) {
+        this.Description = Description;
+        this.Items = Items;
+        this.Price = Price;
+        this.Type = Type;
+    }
+}
+//
+// export function GetShopItems() {
+//     return GetDataByPath("/ark/shopItems", {}, true) as Promise<ResponseData<ShopItem[]>>;
+// }
+//
+// export function SaveShopItem(shopItem: ShopItem) {
+//     return PutDataByPath("/ark/shopItems", shopItem, true)
+// }
+//
+// export function UpdateShopItem(oldShopItem: ShopItem, newShopItem: ShopItem) {
+//     return PutDataByPath("/ark/shopItems", {
+//         oldShopItem: oldShopItem, newShopItem: newShopItem
+//     }, true)
+// }
+//
+// export function DeleteShopItem(shopItemName: string) {
+//     return PutDataByPath("/ark/shopItems", {shopItemName: shopItemName}, true)
+// }
+
+
+// SellItem 允许玩家出售物资,以换取积分
+export class SellItem {
+    Type: string
+    Description: string
+    Price: number
+    Amount: number
+    Blueprint: string
+
+    constructor(Type: string, Description: string, Price: number, Amount: number, Blueprint: string) {
+        this.Type = Type;
+        this.Description = Description;
+        this.Price = Price;
+        this.Amount = Amount;
+        this.Blueprint = Blueprint;
+    }
+}
+
+export function GetSellItems() {
+    return GetDataByPath("/ark/sellItems", {}, true) as Promise<ResponseData<SellItem[]>>;
+}
+
+export function SaveSellItem(sellItem: SellItem) {
+    return PutDataByPath("/ark/sellItems", sellItem, true)
+}
+
+export function UpdateSellItem(oldSellItem: SellItem, newSellItem: SellItem) {
+    return PutDataByPath("/ark/sellItems", {
+        oldSellItem: oldSellItem, newSellItem: newSellItem
+    }, true)
+}
+
+export function DeleteSellItem(sellItemName: string) {
+    return PutDataByPath("/ark/sellItems", {sellItemName: sellItemName}, true)
+}
+
+export class BaseData<T> {
+    Name: string
+    data: T
+
+    constructor(Name: string, data: T) {
+        this.Name = Name;
+        this.data = data;
+    }
+}

+ 17 - 4
ui/src/api/api.ts

@@ -11,11 +11,11 @@ export default {
 
 function getToken(): string {
     let token = localStorage.getItem("token");
-    if (!token){
-        Router.push({path:"/"})
+    if (!token) {
+        Router.push({path: "/"})
         return ""
     }
-    return token??"";
+    return token ?? "";
 }
 
 const HeaderTokenName = "auth-sign"
@@ -23,7 +23,7 @@ const BaseApiPathPrefix = "/api/"
 const JsonGetTypeKey = "Accept"
 const JsonPostTypeKey = "Content-Type"
 
-export class ResponseData <T>{
+export class ResponseData<T> {
     data: T;
     code: number;
     message: string;
@@ -51,6 +51,10 @@ export async function GetDataByPath(path: string, params?: Object, calibration =
         params: params
     }).then(
         res => {
+            if (res.data.code === 565) {
+                localStorage.removeItem("token")
+            }
+
             data = res.data
         }
     )
@@ -73,6 +77,9 @@ export async function PostDataByPath(path: string, json?: Object, calibration =
         headers: headers
     }).then(
         res => {
+            if (res.data.code === 565) {
+                localStorage.removeItem("token")
+            }
             data = res.data
         }
     )
@@ -95,6 +102,9 @@ export async function PutDataByPath(path: string, json?: Object, calibration = f
         headers: headers
     }).then(
         res => {
+            if (res.data.code === 565) {
+                localStorage.removeItem("token")
+            }
             data = res.data
         }
     )
@@ -118,6 +128,9 @@ export async function DeleteDataByPath(path: string, params?: Object, calibratio
         params: params
     }).then(
         res => {
+            if (res.data.code === 565) {
+                localStorage.removeItem("token")
+            }
             data = res.data
         }
     )

+ 46 - 0
ui/src/components/ShopItemsComponent.vue

@@ -0,0 +1,46 @@
+<template>
+  <el-dialog title="查看物品列表" v-model="show" width="1000px">
+    <el-table :data="props.shopItem" border stripe>
+      <el-table-column prop="Amount" label="数量"></el-table-column>
+      <el-table-column prop="Blueprint" label="蓝图"></el-table-column>
+      <el-table-column prop="Fixed" label="固定"></el-table-column>
+      <el-table-column prop="ForceBlueprint" label="强制"></el-table-column>
+      <el-table-column prop="Quality" label="品质"></el-table-column>
+    </el-table>
+  </el-dialog>
+</template>
+
+<script setup lang="ts">
+const props = defineProps({
+  shopItem: {
+    type: Array,
+    default: () => []
+  },
+})
+let show = defineModel<string>("show")
+
+function getTypeNameByType(type: string): string {
+  switch (type) {
+    case "item":
+      return "物品"
+    case "dino":
+      return "恐龙"
+    case "beacon":
+      return "信标"
+    case "experience":
+      return "经验"
+    case "unlockengram":
+      return "技能点"
+    case "command":
+      return "命令"
+    default:
+      return ""
+  }
+
+}
+
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 53 - 0
ui/src/page/back/KitsView.vue

@@ -0,0 +1,53 @@
+<template>
+  <div class="body-kit">
+    <el-row>
+      <el-col :span="4"></el-col>
+      <el-col :span="16">
+        <el-table :data="Kits" border>
+          <el-table-column prop="Name" label="名称" width="75"></el-table-column>
+          <el-table-column prop="data.Price" label="价格" width="100"></el-table-column>
+          <el-table-column prop="data.Permissions" label="权限" width="150"></el-table-column>
+          <el-table-column prop="data.Description" label="描述"></el-table-column>
+          <el-table-column prop="data.DefaultAmount" label="默认数量" width="100"></el-table-column>
+          <el-table-column prop="data.Dinos" label="恐龙" width="60">
+            <template #default="scope">
+              <el-button type="danger" link @click="" v-if="scope.row.data.Dinos" >恐龙</el-button>
+            </template>
+          </el-table-column>
+          <el-table-column prop="data.Items" label="物品" width="60">
+            <template #default="scope">
+              <el-button type="success" link @click="" v-if="scope.row.data.Items">物品</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+import {BaseData, GetKits, Kit} from "../../api/ConfigFile.ts";
+import {ref} from "vue";
+
+let Kits = ref<BaseData<Kit>[]>([])
+
+function replay() {
+  Kits.value = []
+  GetKits().then(res => {
+    if (res.code == 200) {
+      for (let item in res.data) {
+        Kits.value.push(new BaseData(item, res.data[item]))
+      }
+    }
+  })
+}
+
+replay()
+</script>
+
+<style scoped lang="scss">
+.body-kit{
+  padding: 10px;
+}
+
+</style>

+ 38 - 0
ui/src/page/back/SellItemView.vue

@@ -0,0 +1,38 @@
+<template>
+  <div>
+    <el-row>
+      <el-col :span="4"></el-col>
+      <el-col :span="16">
+        <el-table :data="SellItems" border stripe>
+          <el-table-column prop="Name" label="Name"></el-table-column>
+          <el-table-column prop="data.Description" label="Description"></el-table-column>
+          <el-table-column prop="data.Price" label="Price"></el-table-column>
+
+
+        </el-table>
+
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+import {BaseData, GetSellItems, SellItem} from "../../api/ConfigFile.ts";
+import {ref} from "vue";
+
+let SellItems = ref<BaseData<SellItem>[]>([]);
+replay()
+function replay() {
+  GetSellItems().then((res) => {
+    if (res.code == 200) {
+      for (let key in res) {
+        SellItems.value.push(new BaseData(key, res.data[key]))
+      }
+    }
+  });
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 48 - 0
ui/src/page/back/ShopItemView.vue

@@ -0,0 +1,48 @@
+<template>
+  <div>
+    <el-row>
+      <el-col :span="4"></el-col>
+      <el-col :span="16">
+        <el-table :data="shopItems" border stripe>
+          <el-table-column prop="Name" label="名字"></el-table-column>
+          <el-table-column prop="Type" label="类型"></el-table-column>
+          <el-table-column prop="Description" label="描述"></el-table-column>
+          <el-table-column prop="Price" label="价格"></el-table-column>
+          <el-table-column prop="Amount" label="数量"></el-table-column>
+          <el-table-column prop="Blueprint" label="蓝图"></el-table-column>
+          <el-table-column label="操作">
+            <template #default="scope">
+              <el-button type="primary">添加</el-button>
+              <el-button type="primary">删除</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script setup lang="ts">
+import {BaseData , ShopItem} from "../../api/ConfigFile.ts";
+import {ref} from "vue";
+
+let shopItems = ref<BaseData<ShopItem>[]>([])
+
+function replay() {
+
+  // GetShopItems().then(res => {
+  //   if (res.code == 200) {
+  //     for (let item in res.data) {
+  //       shopItems.value.push(new BaseData(item, res.data[item]))
+  //     }
+  //   }
+  // })
+}
+
+
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 118 - 0
ui/src/page/back/ShopItemView2.vue

@@ -0,0 +1,118 @@
+<template>
+  <div style="margin: 10px;border: #dddddd solid 1px;padding: 10px">
+    <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
+
+      <el-tab-pane label="全部" name="all">
+        <el-table :data="shopItems" border stripe>
+          <el-table-column prop="Name" label="商品名称"></el-table-column>
+          <el-table-column prop="data.Description" label="商品描述"></el-table-column>
+          <el-table-column prop="data.Price" label="商品价格"></el-table-column>
+          <el-table-column prop="data.Type" label="商品类型">
+            <template #default="scope">
+              <el-text>{{ getTypeNameByType(scope.row.data.Type) }}</el-text>
+            </template>
+          </el-table-column>
+
+        </el-table>
+      </el-tab-pane>
+
+      <el-tab-pane label="物品" name="item">
+        <el-table :data="shopItems" border stripe>
+          <el-table-column prop="Name" label="商品名称"></el-table-column>
+          <el-table-column prop="data.Description" label="商品描述"></el-table-column>
+          <el-table-column prop="data.Price" label="商品价格"></el-table-column>
+          <el-table-column prop="data.Type" label="商品类型">
+            <template #default="scope">
+              <el-text>{{ getTypeNameByType(scope.row.data.Type) }}</el-text>
+            </template>
+          </el-table-column>
+
+          <el-table-column label="操作">
+            <template #default="scope">
+              <el-button type="primary" @click="OpenShow(scope.row.data.Items)">查看物品列表</el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+        <ShopItemsComponent v-if="activeName=='item'" v-model:show="open" :shop-item="showItem"/>
+      </el-tab-pane>
+      <el-tab-pane label="恐龙" name="dino">Config</el-tab-pane>
+      <el-tab-pane label="信标" name="beacon">Role</el-tab-pane>
+      <el-tab-pane label="经验" name="experience">Task</el-tab-pane>
+      <el-tab-pane label="技能点?" name="unlockengram">Task</el-tab-pane>
+      <el-tab-pane label="命令" name="command">Task</el-tab-pane>
+    </el-tabs>
+  </div>
+</template>
+<script setup lang="ts">
+import {ref} from "vue";
+import {TabsPaneContext} from "element-plus";
+import {GetShopItems, ShopData, ShopItem} from "../../api/ARKShopItemAPI.ts";
+import {BaseData} from "../../api/ConfigFile.ts";
+import ShopItemsComponent from "../../components/ShopItemsComponent.vue";
+
+let activeName = ref('all')
+
+let open = ref(false)
+let showItem = ref<BaseData<ShopData>>()
+
+let shopItems = ref<BaseData<ShopData>[]>([])
+function OpenShow(item:BaseData<ShopData>){
+  open.value = true
+  showItem.value = item
+  console.log(item)
+}
+function replay() {
+  let type = activeName.value
+  if (activeName.value == "all") {
+    type = ""
+  }
+  shopItems.value = []
+  GetShopItems(type).then(res => {
+    if (res.code == 200) {
+      if (type == "") {
+        for (let item in res.data) {
+          shopItems.value.push(new BaseData(item, res.data[item]))
+        }
+      }
+      if (type == "item") {
+        for (let item in res.data) {
+          shopItems.value.push(new BaseData(item, res.data[item] as ShopItem))
+        }
+      }
+    }
+  })
+}
+
+replay()
+
+function getTypeNameByType(type: string): string {
+  switch (type) {
+    case "item":
+      return "物品"
+    case "dino":
+      return "恐龙"
+    case "beacon":
+      return "信标"
+    case "experience":
+      return "经验"
+    case "unlockengram":
+      return "技能点"
+    case "command":
+      return "命令"
+    default:
+      return ""
+  }
+
+}
+
+const handleClick = (tab: TabsPaneContext, event: Event) => {
+  activeName.value = tab.props.name
+  replay()
+}
+
+
+</script>
+
+<style scoped lang="scss">
+
+</style>

+ 3 - 3
ui/src/page/back/index.vue

@@ -63,9 +63,9 @@ const menus = ref<Menu[]>([new Menu("1", "基本功能", "/back/base", []),
   new Menu("2", "概述", "/back/general", []),
   new Menu("3", "商城", "/back/vip", [
     new Menu("2-1", "VIP", "/back/general", []),
-    new Menu("2-2", "礼包", "/back/vip", []),
-    new Menu("2-3", "商品", "/back/vip", []),
-    new Menu("2-4", "回收", "/back/vip", [])
+    new Menu("2-2", "礼包", "/back/kit", []),
+    new Menu("2-3", "商品", "/back/shopItem", []),
+    new Menu("2-4", "回收", "/back/sellItem", [])
   ]),
   new Menu("4", "消息", "/back/message", []),
   new Menu("5", "设置", "/back/message", [])

+ 15 - 0
ui/src/router/index.ts

@@ -38,6 +38,21 @@ const routes: Array<RouteRecordRaw> = [
                 path: "general",
                 component: () => import("../page/back/GeneralView.vue"),
             },
+            {
+                name: "back-kit",
+                path: "kit",
+                component: () => import("../page/back/KitsView.vue"),
+            },
+            {
+                name: "back-shopItem",
+                path: "shopItem",
+                component: () => import("../page/back/ShopItemView2.vue"),
+            },
+            {
+                name: "back-sellItem",
+                path: "sellItem",
+                component: () => import("../page/back/SellItemView.vue"),
+            },
         ],
     },
 ];

+ 1 - 1
ui/tsconfig.json

@@ -8,7 +8,7 @@
 
     /* Bundler mode */
     "moduleResolution": "bundler",
-    "allowImportingTsExtensions": true,
+    "allowImportingTsExtensions": false,
     "resolveJsonModule": true,
     "isolatedModules": true,
     "noEmit": true,

+ 68 - 3
util/ReadARKShopConfig.go

@@ -3,6 +3,7 @@ package util
 import (
 	"ARKItems/entity/ark"
 	"encoding/json"
+	"fmt"
 	"io"
 	"os"
 	"strings"
@@ -10,7 +11,10 @@ import (
 
 //读取ark shop配置
 
-func LoadArkShopConfig(url string) ark.Config {
+func LoadArkShopConfig(url string) (
+	ark.Config, map[string]ark.ShopItem, map[string]ark.ShopDino,
+	map[string]ark.ShopBeacon, map[string]ark.ShopExperience,
+	map[string]ark.ShopUnlockengram, map[string]ark.ShopCommand) {
 	file, err := os.OpenFile(url, os.O_RDWR, 0666)
 	if err != nil {
 		panic(err)
@@ -26,11 +30,72 @@ func LoadArkShopConfig(url string) ark.Config {
 	return LoadArkShopConfigByString(all)
 }
 
-func LoadArkShopConfigByString(jsonContent []byte) ark.Config {
+func LoadArkShopConfigByString(jsonContent []byte) (
+	ark.Config, map[string]ark.ShopItem, map[string]ark.ShopDino,
+	map[string]ark.ShopBeacon, map[string]ark.ShopExperience,
+	map[string]ark.ShopUnlockengram, map[string]ark.ShopCommand) {
 	var config ark.Config
+
+	var ARKShopItems = make(map[string]ark.ShopItem)
+	var ARKShopDines = make(map[string]ark.ShopDino)
+	var ARKShopBeacons = make(map[string]ark.ShopBeacon)
+	var ARKShopExperiences = make(map[string]ark.ShopExperience)
+	var ARKShopUnlockengram = make(map[string]ark.ShopUnlockengram)
+	var ARKShopCommands = make(map[string]ark.ShopCommand)
+
 	err := json.Unmarshal(jsonContent, &config)
 	if err != nil {
 		panic(err)
 	}
-	return config
+	//接卸shopItems内容
+	var m map[string]interface{}
+	err = json.Unmarshal(jsonContent, &m)
+	if err != nil {
+		panic(err)
+	}
+	ShopItems, ok := m["ShopItems"].(map[string]interface{})
+	if ok {
+		for key := range ShopItems {
+			item := ShopItems[key].(map[string]interface{})
+			t := item["Type"]
+
+			switch t {
+			case "item":
+				var obj ark.ShopItem
+				DataToObject(item, &obj)
+				ARKShopItems[key] = obj
+				continue
+			case "dino":
+				var obj ark.ShopDino
+				DataToObject(item, &obj)
+				ARKShopDines[key] = obj
+				continue
+			case "beacon":
+				var obj ark.ShopBeacon
+				DataToObject(item, &obj)
+				ARKShopBeacons[key] = obj
+				continue
+			case "experience":
+				var obj ark.ShopExperience
+				DataToObject(item, &obj)
+				ARKShopExperiences[key] = obj
+				continue
+			case "unlockengram":
+				var obj ark.ShopUnlockengram
+				DataToObject(item, &obj)
+				ARKShopUnlockengram[key] = obj
+				continue
+			case "command":
+				var obj ark.ShopCommand
+				DataToObject(item, &obj)
+				ARKShopCommands[key] = obj
+				continue
+			default:
+				fmt.Println("=================>", t)
+			}
+		}
+	} else {
+		panic("ShopItems is not a map")
+	}
+	return config, ARKShopItems, ARKShopDines, ARKShopBeacons, ARKShopExperiences, ARKShopUnlockengram, ARKShopCommands
 }

+ 11 - 0
util/RequestHandler.go

@@ -99,6 +99,8 @@ func RandomInt(min, max *big.Int) *big.Int {
 	r.Rem(r, new(big.Int).Sub(max, min)).Add(r, min)
 	return r
 }
+
+// DataToObject json转对象
 func DataToObject(data interface{}, obj interface{}) error {
 	marshal, err := json.Marshal(data)
 	if err != nil {
@@ -106,3 +108,12 @@ func DataToObject(data interface{}, obj interface{}) error {
 	}
 	return json.Unmarshal(marshal, obj)
 }
+func DataToMap(data interface{}) map[string]interface{} {
+	marshal, err := json.Marshal(data)
+	if err != nil {
+		fmt.Println(err)
+	}
+	var obj map[string]interface{}
+	json.Unmarshal(marshal, &obj)
+	return obj
+}