pregene stamp unlock fix

This commit is contained in:
vvo
2022-10-23 19:47:29 +08:00
parent 676ec11c7c
commit 808da5f7c2
2 changed files with 19 additions and 8 deletions
+17 -6
View File
@@ -373,12 +373,23 @@ export const preGeneRoll = async (data: {
if(unobtainedItems.length > 0) {
let randomItemIndex = Math.floor(Math.random() * unobtainedItems.length);
console.log("Rolled item id: " + unobtainedItems[randomItemIndex] + " | item type: " + itemId[Object.keys(preGeneSet.items)[rollWhat]])
DB.Insert(data.refid, {
"collection": "item",
"type": itemId[Object.keys(preGeneSet.items)[rollWhat]],
"id": unobtainedItems[randomItemIndex],
"param": 1
})
if(itemId[Object.keys(preGeneSet.items)[rollWhat]] == 17) {
for(let stampID = (unobtainedItems[randomItemIndex] * 4) - 3; stampID <= (unobtainedItems[randomItemIndex] * 4); stampID++) {
DB.Insert(data.refid, {
"collection": "item",
"type": itemId[Object.keys(preGeneSet.items)[rollWhat]],
"id": stampID,
"param": 1
})
}
} else {
DB.Insert(data.refid, {
"collection": "item",
"type": itemId[Object.keys(preGeneSet.items)[rollWhat]],
"id": unobtainedItems[randomItemIndex],
"param": 1
})
}
let finalItemType = (Object.keys(preGeneSet.items)[rollWhat] === 'subbg') ? 'bg' : Object.keys(preGeneSet.items)[rollWhat]
await IO.WriteFile('webui/asset/logs/preGeneRollResult.json', JSON.stringify({'id': unobtainedItems[randomItemIndex], 'type': finalItemType}))
finishedRolling = true
+2 -2
View File
@@ -5,7 +5,7 @@ function countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_b
total += geneItems.items['crew'].length
}
if('stamp' in geneItems.items) {
obtained += items_stamp.filter(stamp => geneItems.items.stamp.includes(stamp['id'])).length
obtained += items_stamp.filter(stamp => geneItems.items.stamp.includes(stamp['id'] / 4)).length
total += geneItems.items['stamp'].length
}
if('subbg' in geneItems.items) {
@@ -26,7 +26,7 @@ function countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_b
function loadImages(itemList, itemType, userItems) {
itemList.forEach(item => {
let itemBrightness = userItems.find(userItem => userItem.id == item) != undefined ? 1 : 0.25
let itemBrightness = userItems.find(userItem => userItem.id == ((itemType !== 'stamp') ? item : (item * 4))) != undefined ? 1 : 0.25
let imageUrl = 'static/asset/valgene_item/item_' + itemType + '_' + item + '.png'
$.get(imageUrl, function(data, textStatus) {
if (textStatus == "success") {