From 56bce9842201f62830f777798b501d31ba02341b Mon Sep 17 00:00:00 2001
From: vvo <>
Date: Mon, 17 Oct 2022 19:33:03 +0800
Subject: [PATCH 1/3] pregene initial impl
---
sdvx@asphyxia/index.ts | 2 +-
.../webui/asset/js/premiumgenerator.js | 80 +++++++++++++++++++
.../webui/profile_-premium generator.pug | 38 +++++++++
3 files changed, 119 insertions(+), 1 deletion(-)
create mode 100644 sdvx@asphyxia/webui/asset/js/premiumgenerator.js
create mode 100644 sdvx@asphyxia/webui/profile_-premium generator.pug
diff --git a/sdvx@asphyxia/index.ts b/sdvx@asphyxia/index.ts
index c822d4b..05bbb1b 100644
--- a/sdvx@asphyxia/index.ts
+++ b/sdvx@asphyxia/index.ts
@@ -31,7 +31,7 @@ export function register() {
R.GameCode('KFC');
R.Config('sdvx_eg_root_dir', { type: 'string', needRestart: true, default: '', name: 'Exceed Gear Data Directory', desc: 'The root directory of your SDVX Exceed Gear game files (for asset copying)'});
- R.Config('unlock_all_valk_items', { type: 'boolean', default: false, name:'Unlock All Valkyrie Items', desc: 'Unlock Nemsys, BGM, Submonitor BG and Stamp Items (Valk crews not included; check \'unlock all navigators\' option)'});
+ R.Config('unlock_all_valk_items', { type: 'boolean', default: false, name:'Unlock All Valkyrie and Premium Items', desc: 'Unlock Nemsys, BGM, Submonitor BG and Stamp Items (Valk crews not included; check \'unlock all navigators\' option)'});
R.Config('enable_valk_songs' ,{ type: 'boolean', default: false, name:'Enable Valkyrie Model Songs', desc:'Unlock the valkyrie model songs on non-valkyrie mode.'});
R.Config('arena_szn',{ type: 'string', options: Object.keys(ARENA), default: 'Set 1 (04/25/22)', name: 'Arena Station Item Set', desc: 'Choose which season set of items in the arena station you want to show up in arena station'});
R.Config('x_record', {type: 'boolean', default: false, name: 'X-Record', desc: 'Activates X-record. 10 VM and 1 LM points per play.'})
diff --git a/sdvx@asphyxia/webui/asset/js/premiumgenerator.js b/sdvx@asphyxia/webui/asset/js/premiumgenerator.js
new file mode 100644
index 0000000..4d597fb
--- /dev/null
+++ b/sdvx@asphyxia/webui/asset/js/premiumgenerator.js
@@ -0,0 +1,80 @@
+function countPreGeneItems(preGeneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) {
+ let totalItemsGot = 0
+ console.log(totalItemsGot)
+ totalItemsGot += items_crew.filter(crew => preGeneItems['crew'].includes(crew['id'])).length
+ console.log(totalItemsGot)
+ totalItemsGot += items_stamp.filter(stamp => preGeneItems['stamp'].includes(stamp['id'])).length
+ console.log(totalItemsGot)
+ totalItemsGot += items_subbg.filter(subbg => preGeneItems['subbg'].includes(subbg['id'])).length
+ console.log(totalItemsGot)
+ return totalItemsGot
+}
+
+$(document).ready(function() {
+ // let profile_data = JSON.parse(document.getElementById("data-pass").innerText);
+ let preGeneImageFetchURL = 'https://eacache.s.konaminet.jp/game/sdvx/common/images/pregene_item/'
+ let items_crew = JSON.parse(document.getElementById("data-pass-crew").innerText);
+ let items_stamp = JSON.parse(document.getElementById("data-pass-stamp").innerText);
+ let items_subbg = JSON.parse(document.getElementById("data-pass-subbg").innerText);
+ let items_bgm = JSON.parse(document.getElementById("data-pass-bgm").innerText);
+ let items_nemsys = JSON.parse(document.getElementById("data-pass-nemsys").innerText);
+ let unlock_all = (document.getElementById("data-pass-unlock-all").innerText === 'true');
+ let preGeneItems = {
+ 'crew': [131],
+ 'stamp': [69, 70, 71, 72, 73, 74, 75, 76, 77, 78],
+ 'subbg': [166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185]
+ }
+
+ console.log('crew')
+ $('.item_banners').append('
')
+ preGeneItems['crew'].forEach(crew => {
+ let itemBrightness = items_crew.find(item => item.id == subbg) != undefined ? 1 : 0.5
+ $.get('/static/asset/pregene_item/crew/item_crew_' + crew + '.png', function(data, textStatus) {
+ if (textStatus == "success") {
+ console.log(crew + " loaded");
+ }
+ }).fail(function(){
+ console.log(crew + " not loaded. file not exist")
+ $('.crew-items').append('
')
+ });
+ })
+
+ console.log('stamp')
+ $('.item_banners').append('
')
+ preGeneItems['stamp'].forEach(stamp => {
+ let itemBrightness = items_stamp.find(item => item.id == stamp) != undefined ? 1 : 0.5
+ $.get('/static/asset/pregene_item/stamp/item_stamp_' + stamp + '.png', function(data, textStatus) {
+ if (textStatus == "success") {
+ console.log(stamp + " loaded");
+ }
+ }).fail(function(){
+ console.log(stamp + " not loaded. file not exist")
+ $('.stamp-items').append('
')
+ });
+ })
+
+ console.log('subbg')
+ $('.item_banners').append('
')
+ preGeneItems['subbg'].forEach(subbg => {
+ let itemBrightness = items_subbg.find(item => item.id == subbg) != undefined ? 1 : 0.5
+ $.get('/static/asset/pregene_item/bg/item_bg_' + subbg + '.png', function(data, textStatus) {
+ if (textStatus == "success") {
+ console.log(subbg + " loaded");
+ }
+ }).fail(function(){
+ console.log(subbg + " not loaded. file not exist")
+ $('.subbg-items').append('
')
+ });
+ })
+
+ if(!unlock_all) {
+ $('.count').text(countPreGeneItems(preGeneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) + "/" + (preGeneItems['crew'].length + preGeneItems['stamp'].length + preGeneItems['subbg'].length))
+ } else {
+ $('.card-content').text("Unlock all enabled.")
+ $('#pregene-roll').attr('disabled')
+ }
+
+ $('#pregene-roll').on('click', function() {
+ console.log('clique')
+ })
+})
\ No newline at end of file
diff --git a/sdvx@asphyxia/webui/profile_-premium generator.pug b/sdvx@asphyxia/webui/profile_-premium generator.pug
new file mode 100644
index 0000000..f442d51
--- /dev/null
+++ b/sdvx@asphyxia/webui/profile_-premium generator.pug
@@ -0,0 +1,38 @@
+//DATA//
+ prem_items_crew: DB.Find(refid, {collection:"item",type:11,id:131})
+
+ prem_items_stamp: DB.Find(refid, { collection:"item",type:17 })
+
+ prem_items_subbg: DB.Find(refid, { collection:"item",type:18 })
+
+ prem_items_bgm: DB.Find(refid, { collection:"item",type:19 })
+
+ prem_items_nemsys: DB.Find(refid, { collection:"item",type:20 })
+
+ unlock_all: U.GetConfig('unlock_all_valk_items')
+
+-
+ //const padded = _.padStart(profile.id.toString(), 8);
+ //const sdvxid = `${padded.slice(0, 4)}-${padded.slice(4)}`;
+
+link(rel="stylesheet" href="static/asset/css/datatables.css")
+div
+ .card
+ .card-header
+ p.card-header-title
+ span.icon
+ i.mdi.mdi-account-edit
+ | Premium Generator
+ .card-content
+ input.input(type="text" name="refid", value=refid readonly)
+ button(id="pregene-roll") Roll
+ div.count()
+ div.item_banners()
+
+div(hidden id='data-pass-crew') !{JSON.stringify(prem_items_crew)}
+div(hidden id='data-pass-stamp') !{JSON.stringify(prem_items_stamp)}
+div(hidden id='data-pass-subbg') !{JSON.stringify(prem_items_subbg)}
+div(hidden id='data-pass-bgm') !{JSON.stringify(prem_items_bgm)}
+div(hidden id='data-pass-nemsys') !{JSON.stringify(prem_items_nemsys)}
+div(hidden id='data-pass-unlock-all') !{unlock_all}
+script(src="static/asset/js/premiumgenerator.js")
\ No newline at end of file
From 6685df201d3c92c2a66b84876fc13da1df9199b8 Mon Sep 17 00:00:00 2001
From: vvo <>
Date: Mon, 17 Oct 2022 22:31:29 +0800
Subject: [PATCH 2/3] pregene js optimize + page layout update
---
.../webui/asset/js/premiumgenerator.js | 84 ++++++++-----------
.../webui/profile_-premium generator.pug | 11 ++-
2 files changed, 41 insertions(+), 54 deletions(-)
diff --git a/sdvx@asphyxia/webui/asset/js/premiumgenerator.js b/sdvx@asphyxia/webui/asset/js/premiumgenerator.js
index 4d597fb..bd6aa24 100644
--- a/sdvx@asphyxia/webui/asset/js/premiumgenerator.js
+++ b/sdvx@asphyxia/webui/asset/js/premiumgenerator.js
@@ -1,78 +1,62 @@
function countPreGeneItems(preGeneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) {
let totalItemsGot = 0
- console.log(totalItemsGot)
totalItemsGot += items_crew.filter(crew => preGeneItems['crew'].includes(crew['id'])).length
- console.log(totalItemsGot)
totalItemsGot += items_stamp.filter(stamp => preGeneItems['stamp'].includes(stamp['id'])).length
- console.log(totalItemsGot)
totalItemsGot += items_subbg.filter(subbg => preGeneItems['subbg'].includes(subbg['id'])).length
- console.log(totalItemsGot)
return totalItemsGot
}
-$(document).ready(function() {
- // let profile_data = JSON.parse(document.getElementById("data-pass").innerText);
+function loadImages(itemList, itemType, userItems) {
let preGeneImageFetchURL = 'https://eacache.s.konaminet.jp/game/sdvx/common/images/pregene_item/'
+ itemList.forEach(item => {
+ let itemBrightness = userItems.find(userItem => userItem.id == item) != undefined ? 1 : 0.5
+ let imageUrl = 'static/asset/pregene_item/item_' + itemType + '_' + item + '.png'
+ $.get(imageUrl, function(data, textStatus) {
+ if (textStatus == "success") {
+ $('.' + itemType + '-items').append('
')
+ }
+ }).fail(function(){
+ imageUrl = preGeneImageFetchURL + itemType + '/item_' + itemType + '_' + item + '.png'
+ $('.' + itemType + '-items').append('
')
+ });
+ })
+}
+
+$(document).ready(function() {
+ if(document.getElementById("data-pass-unlock-all").innerText === 'true') {
+ $('.card-content').text("The \"Unlock All Valkyrie and Premium Items\" option is enabled. You wouldn't need this.")
+ $('#pregene-roll').attr('disabled')
+ return 0;
+ }
+
+ $('.input').hide()
+ $('.button').addClass('is-link')
let items_crew = JSON.parse(document.getElementById("data-pass-crew").innerText);
let items_stamp = JSON.parse(document.getElementById("data-pass-stamp").innerText);
let items_subbg = JSON.parse(document.getElementById("data-pass-subbg").innerText);
let items_bgm = JSON.parse(document.getElementById("data-pass-bgm").innerText);
let items_nemsys = JSON.parse(document.getElementById("data-pass-nemsys").innerText);
- let unlock_all = (document.getElementById("data-pass-unlock-all").innerText === 'true');
let preGeneItems = {
'crew': [131],
'stamp': [69, 70, 71, 72, 73, 74, 75, 76, 77, 78],
'subbg': [166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185]
}
- console.log('crew')
- $('.item_banners').append('
')
- preGeneItems['crew'].forEach(crew => {
- let itemBrightness = items_crew.find(item => item.id == subbg) != undefined ? 1 : 0.5
- $.get('/static/asset/pregene_item/crew/item_crew_' + crew + '.png', function(data, textStatus) {
- if (textStatus == "success") {
- console.log(crew + " loaded");
- }
- }).fail(function(){
- console.log(crew + " not loaded. file not exist")
- $('.crew-items').append('
')
- });
- })
+ $('.count').text('Unlocked items: ' + countPreGeneItems(preGeneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) + "/" + (preGeneItems['crew'].length + preGeneItems['stamp'].length + preGeneItems['subbg'].length))
+ $('.item_banners').append('Nemsys Crew
')
+ $('.item_banners').append('
')
+ loadImages(preGeneItems['crew'], 'crew', items_crew)
console.log('stamp')
- $('.item_banners').append('
')
- preGeneItems['stamp'].forEach(stamp => {
- let itemBrightness = items_stamp.find(item => item.id == stamp) != undefined ? 1 : 0.5
- $.get('/static/asset/pregene_item/stamp/item_stamp_' + stamp + '.png', function(data, textStatus) {
- if (textStatus == "success") {
- console.log(stamp + " loaded");
- }
- }).fail(function(){
- console.log(stamp + " not loaded. file not exist")
- $('.stamp-items').append('
')
- });
- })
+ $('.item_banners').append('Appeal Stamp
')
+ $('.item_banners').append('
')
+ loadImages(preGeneItems['stamp'], 'stamp', items_stamp)
console.log('subbg')
- $('.item_banners').append('
')
- preGeneItems['subbg'].forEach(subbg => {
- let itemBrightness = items_subbg.find(item => item.id == subbg) != undefined ? 1 : 0.5
- $.get('/static/asset/pregene_item/bg/item_bg_' + subbg + '.png', function(data, textStatus) {
- if (textStatus == "success") {
- console.log(subbg + " loaded");
- }
- }).fail(function(){
- console.log(subbg + " not loaded. file not exist")
- $('.subbg-items').append('
')
- });
- })
+ $('.item_banners').append('Submonitor BG
')
+ $('.item_banners').append('
')
+ loadImages(preGeneItems['subbg'], 'bg', items_subbg)
- if(!unlock_all) {
- $('.count').text(countPreGeneItems(preGeneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) + "/" + (preGeneItems['crew'].length + preGeneItems['stamp'].length + preGeneItems['subbg'].length))
- } else {
- $('.card-content').text("Unlock all enabled.")
- $('#pregene-roll').attr('disabled')
- }
$('#pregene-roll').on('click', function() {
console.log('clique')
diff --git a/sdvx@asphyxia/webui/profile_-premium generator.pug b/sdvx@asphyxia/webui/profile_-premium generator.pug
index f442d51..d2611b9 100644
--- a/sdvx@asphyxia/webui/profile_-premium generator.pug
+++ b/sdvx@asphyxia/webui/profile_-premium generator.pug
@@ -21,12 +21,15 @@ div
.card-header
p.card-header-title
span.icon
- i.mdi.mdi-account-edit
+ i.mdi.mdi-star
| Premium Generator
.card-content
- input.input(type="text" name="refid", value=refid readonly)
- button(id="pregene-roll") Roll
- div.count()
+ div(style="padding: 15px; text-align: center;")
+ div(style="padding: 5px")
+ h3.count()
+ input.input(type="text" name="refid", value=refid readonly)
+ button.button(id="pregene-roll" style="font-size: 20px") Roll
+ br()
div.item_banners()
div(hidden id='data-pass-crew') !{JSON.stringify(prem_items_crew)}
From 5bd0a9f83499581c3d482e904144e22b212c0b44 Mon Sep 17 00:00:00 2001
From: vvo <>
Date: Thu, 20 Oct 2022 23:27:58 +0800
Subject: [PATCH 3/3] update pregene js
---
.../webui/asset/js/premiumgenerator.js | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/sdvx@asphyxia/webui/asset/js/premiumgenerator.js b/sdvx@asphyxia/webui/asset/js/premiumgenerator.js
index bd6aa24..d3993fd 100644
--- a/sdvx@asphyxia/webui/asset/js/premiumgenerator.js
+++ b/sdvx@asphyxia/webui/asset/js/premiumgenerator.js
@@ -1,24 +1,18 @@
function countPreGeneItems(preGeneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) {
- let totalItemsGot = 0
- totalItemsGot += items_crew.filter(crew => preGeneItems['crew'].includes(crew['id'])).length
- totalItemsGot += items_stamp.filter(stamp => preGeneItems['stamp'].includes(stamp['id'])).length
- totalItemsGot += items_subbg.filter(subbg => preGeneItems['subbg'].includes(subbg['id'])).length
- return totalItemsGot
+ return items_crew.filter(crew => preGeneItems['crew'].includes(crew['id'])).length +
+ items_stamp.filter(stamp => preGeneItems['stamp'].includes(stamp['id'])).length +
+ items_subbg.filter(subbg => preGeneItems['subbg'].includes(subbg['id'])).length
}
function loadImages(itemList, itemType, userItems) {
- let preGeneImageFetchURL = 'https://eacache.s.konaminet.jp/game/sdvx/common/images/pregene_item/'
itemList.forEach(item => {
let itemBrightness = userItems.find(userItem => userItem.id == item) != undefined ? 1 : 0.5
- let imageUrl = 'static/asset/pregene_item/item_' + itemType + '_' + item + '.png'
+ let imageUrl = 'static/asset/valgene_item/item_' + itemType + '_' + item + '.png'
$.get(imageUrl, function(data, textStatus) {
if (textStatus == "success") {
$('.' + itemType + '-items').append('
')
}
- }).fail(function(){
- imageUrl = preGeneImageFetchURL + itemType + '/item_' + itemType + '_' + item + '.png'
- $('.' + itemType + '-items').append('
')
- });
+ })
})
}
@@ -59,6 +53,6 @@ $(document).ready(function() {
$('#pregene-roll').on('click', function() {
- console.log('clique')
+ console.log('not yet implemented')
})
})
\ No newline at end of file