mirror of
https://github.com/Lawin0129/LawinServer.git
synced 2026-01-13 02:42:22 +01:00
Catalog structure update
This commit is contained in:
@@ -1,35 +1,35 @@
|
|||||||
{
|
{
|
||||||
"//": "BR Item Shop Config",
|
"//": "BR Item Shop Config",
|
||||||
"daily1": {
|
"daily1": {
|
||||||
"templateId": "",
|
"itemGrants": [""],
|
||||||
"price": 0
|
"price": 0
|
||||||
},
|
},
|
||||||
"daily2": {
|
"daily2": {
|
||||||
"templateId": "",
|
"itemGrants": [""],
|
||||||
"price": 0
|
"price": 0
|
||||||
},
|
},
|
||||||
"daily3": {
|
"daily3": {
|
||||||
"templateId": "",
|
"itemGrants": [""],
|
||||||
"price": 0
|
"price": 0
|
||||||
},
|
},
|
||||||
"daily4": {
|
"daily4": {
|
||||||
"templateId": "",
|
"itemGrants": [""],
|
||||||
"price": 0
|
"price": 0
|
||||||
},
|
},
|
||||||
"daily5": {
|
"daily5": {
|
||||||
"templateId": "",
|
"itemGrants": [""],
|
||||||
"price": 0
|
"price": 0
|
||||||
},
|
},
|
||||||
"daily6": {
|
"daily6": {
|
||||||
"templateId": "",
|
"itemGrants": [""],
|
||||||
"price": 0
|
"price": 0
|
||||||
},
|
},
|
||||||
"featured1": {
|
"featured1": {
|
||||||
"templateId": "",
|
"itemGrants": [""],
|
||||||
"price": 0
|
"price": 0
|
||||||
},
|
},
|
||||||
"featured2": {
|
"featured2": {
|
||||||
"templateId": "",
|
"itemGrants": [""],
|
||||||
"price": 0
|
"price": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,17 +60,28 @@ function getItemShop() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
for (var value in CatalogConfig) {
|
for (var value in CatalogConfig) {
|
||||||
if (typeof CatalogConfig[value].templateId == "string") {
|
if (Array.isArray(CatalogConfig[value].itemGrants)) {
|
||||||
if (CatalogConfig[value].templateId.length != 0) {
|
if (CatalogConfig[value].itemGrants.length != 0) {
|
||||||
const CatalogEntry = {"devName":"","offerId":"","fulfillmentIds":[],"dailyLimit":-1,"weeklyLimit":-1,"monthlyLimit":-1,"categories":[],"prices":[{"currencyType":"MtxCurrency","currencySubType":"","regularPrice":0,"finalPrice":0,"saleExpiration":"9999-12-02T01:12:00Z","basePrice":0}],"matchFilter":"","filterWeight":0,"appStoreId":[],"requirements":[{"requirementType":"DenyOnItemOwnership","requiredId":"","minQuantity":1}],"offerType":"StaticPrice","giftInfo":{"bIsEnabled":false,"forcedGiftBoxTemplateId":"","purchaseRequirements":[],"giftRecordIds":[]},"refundable":true,"metaInfo":[],"displayAssetPath":"","itemGrants":[{"templateId":"","quantity":1}],"sortPriority":0,"catalogGroupPriority":0};
|
const CatalogEntry = {"devName":"","offerId":"","fulfillmentIds":[],"dailyLimit":-1,"weeklyLimit":-1,"monthlyLimit":-1,"categories":[],"prices":[{"currencyType":"MtxCurrency","currencySubType":"","regularPrice":0,"finalPrice":0,"saleExpiration":"9999-12-02T01:12:00Z","basePrice":0}],"matchFilter":"","filterWeight":0,"appStoreId":[],"requirements":[],"offerType":"StaticPrice","giftInfo":{"bIsEnabled":false,"forcedGiftBoxTemplateId":"","purchaseRequirements":[],"giftRecordIds":[]},"refundable":true,"metaInfo":[],"displayAssetPath":"","itemGrants":[],"sortPriority":0,"catalogGroupPriority":0};
|
||||||
|
|
||||||
if (value.toLowerCase().startsWith("daily")) {
|
if (value.toLowerCase().startsWith("daily")) {
|
||||||
catalog.storefronts.forEach((storefront, i) => {
|
catalog.storefronts.forEach((storefront, i) => {
|
||||||
if (storefront.name == "BRDailyStorefront") {
|
if (storefront.name == "BRDailyStorefront") {
|
||||||
CatalogEntry.devName = CatalogConfig[value].templateId
|
CatalogEntry.requirements = [];
|
||||||
CatalogEntry.offerId = CatalogConfig[value].templateId
|
CatalogEntry.itemGrants = [];
|
||||||
CatalogEntry.requirements[0].requiredId = CatalogConfig[value].templateId
|
|
||||||
CatalogEntry.itemGrants[0].templateId = CatalogConfig[value].templateId
|
for (var i in CatalogConfig[value].itemGrants) {
|
||||||
|
if (typeof CatalogConfig[value].itemGrants[i] == "string") {
|
||||||
|
if (CatalogConfig[value].itemGrants[i].length != 0) {
|
||||||
|
CatalogEntry.devName = CatalogConfig[value].itemGrants[0]
|
||||||
|
CatalogEntry.offerId = CatalogConfig[value].itemGrants[0]
|
||||||
|
|
||||||
|
CatalogEntry.requirements.push({ "requirementType": "DenyOnItemOwnership", "requiredId": CatalogConfig[value].itemGrants[i], "minQuantity": 1 })
|
||||||
|
CatalogEntry.itemGrants.push({ "templateId": CatalogConfig[value].itemGrants[i], "quantity": 1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CatalogEntry.prices[0].basePrice = CatalogConfig[value].price
|
CatalogEntry.prices[0].basePrice = CatalogConfig[value].price
|
||||||
CatalogEntry.prices[0].regularPrice = CatalogConfig[value].price
|
CatalogEntry.prices[0].regularPrice = CatalogConfig[value].price
|
||||||
CatalogEntry.prices[0].finalPrice = CatalogConfig[value].price
|
CatalogEntry.prices[0].finalPrice = CatalogConfig[value].price
|
||||||
@@ -83,10 +94,21 @@ function getItemShop() {
|
|||||||
if (value.toLowerCase().startsWith("featured")) {
|
if (value.toLowerCase().startsWith("featured")) {
|
||||||
catalog.storefronts.forEach((storefront, i) => {
|
catalog.storefronts.forEach((storefront, i) => {
|
||||||
if (storefront.name == "BRWeeklyStorefront") {
|
if (storefront.name == "BRWeeklyStorefront") {
|
||||||
CatalogEntry.devName = CatalogConfig[value].templateId
|
CatalogEntry.requirements = [];
|
||||||
CatalogEntry.offerId = CatalogConfig[value].templateId
|
CatalogEntry.itemGrants = [];
|
||||||
CatalogEntry.requirements[0].requiredId = CatalogConfig[value].templateId
|
|
||||||
CatalogEntry.itemGrants[0].templateId = CatalogConfig[value].templateId
|
for (var i in CatalogConfig[value].itemGrants) {
|
||||||
|
if (typeof CatalogConfig[value].itemGrants[i] == "string") {
|
||||||
|
if (CatalogConfig[value].itemGrants[i].length != 0) {
|
||||||
|
CatalogEntry.devName = CatalogConfig[value].itemGrants[0]
|
||||||
|
CatalogEntry.offerId = CatalogConfig[value].itemGrants[0]
|
||||||
|
|
||||||
|
CatalogEntry.requirements.push({ "requirementType": "DenyOnItemOwnership", "requiredId": CatalogConfig[value].itemGrants[i], "minQuantity": 1 })
|
||||||
|
CatalogEntry.itemGrants.push({ "templateId": CatalogConfig[value].itemGrants[i], "quantity": 1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CatalogEntry.prices[0].basePrice = CatalogConfig[value].price
|
CatalogEntry.prices[0].basePrice = CatalogConfig[value].price
|
||||||
CatalogEntry.prices[0].regularPrice = CatalogConfig[value].price
|
CatalogEntry.prices[0].regularPrice = CatalogConfig[value].price
|
||||||
CatalogEntry.prices[0].finalPrice = CatalogConfig[value].price
|
CatalogEntry.prices[0].finalPrice = CatalogConfig[value].price
|
||||||
@@ -95,7 +117,6 @@ function getItemShop() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,11 @@ express.get("/clearitemsforshop", async (req, res) => {
|
|||||||
|
|
||||||
for (var value in CatalogConfig) {
|
for (var value in CatalogConfig) {
|
||||||
for (var key in athena.items) {
|
for (var key in athena.items) {
|
||||||
if (typeof CatalogConfig[value].templateId == "string") {
|
if (Array.isArray(CatalogConfig[value].itemGrants)) {
|
||||||
if (CatalogConfig[value].templateId.length != 0) {
|
for (var i in CatalogConfig[value].itemGrants) {
|
||||||
if (CatalogConfig[value].templateId.toLowerCase() == athena.items[key].templateId.toLowerCase()) {
|
if (typeof CatalogConfig[value].itemGrants[i] == "string") {
|
||||||
|
if (CatalogConfig[value].itemGrants[i].length != 0) {
|
||||||
|
if (CatalogConfig[value].itemGrants[i].toLowerCase() == athena.items[key].templateId.toLowerCase()) {
|
||||||
delete athena.items[key]
|
delete athena.items[key]
|
||||||
|
|
||||||
StatChanged = true;
|
StatChanged = true;
|
||||||
@@ -23,6 +25,8 @@ express.get("/clearitemsforshop", async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (StatChanged == true) {
|
if (StatChanged == true) {
|
||||||
athena.rvn += 1;
|
athena.rvn += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user