Skip to content

Commit

Permalink
sortie sim: Statistics: Copy text summary to clipboard buttons, texta…
Browse files Browse the repository at this point in the history
…rea click selects all, modal no overscroll (#73) (#76)

sim: aaci 48 (provisional)
update data
  • Loading branch information
fourinone41 committed Jun 29, 2024
1 parent 53cf22e commit cc2d779
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 6 deletions.
Binary file added assets/stats/content-copy-custom.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions css/simulator-ui/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ div.progressBarInner {
#divResults tr.tableSpace {
height: 10px;
}
img.copyIcons {
cursor: pointer;
}

#divBonusEditorMain {
background-color: #DDEEFF;
Expand Down Expand Up @@ -475,4 +478,21 @@ span.autoBonusStatus.good {
}
.invisible {
visibility: hidden;
}

#divNotice {
position: fixed;
bottom: 30px;
right: 0;
display: flex;
align-items: center;
justify-content: center;
width: 190px;
height: 65px;
border: 2px solid #6ae3ff;
border-right: none;
font-size: 15px;
font-weight: 600;
color: #ffffff;
background-color: #4EABF5;
}
3 changes: 3 additions & 0 deletions css/simulator-ui/selector.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#divShipSelResults, #divEquipSelResults {
overflow-y: scroll;
height: 504px;
overscroll-behavior: contain;
}
div.selectResult:hover {
cursor: pointer;
Expand Down Expand Up @@ -84,6 +85,7 @@ div.selButtonBack > :last-child {
flex-wrap: wrap;
font-family: Verdana,Arial,sans-serif;
font-size: 1.1em;
overscroll-behavior: contain;
}
#divShipSelButtonsShip div.remodelButtonWrap {
display: flex;
Expand All @@ -107,6 +109,7 @@ div.selButtonBack > :last-child {
margin: 15px 30px;
font-family: Verdana,Arial,sans-serif;
font-size: 1.1em;
overscroll-behavior: contain;
}
#divEquipSelButtonsEquip div.equipButtonWrap {
display: flex;
Expand Down
33 changes: 33 additions & 0 deletions js/data/mst_slotitem_bonus.json
Original file line number Diff line number Diff line change
Expand Up @@ -8575,6 +8575,39 @@
}
]
},
{
"ids": [531],
"bonuses": [
{
"bonus": { "houm": 1 },
"level": 4
},
{
"bonus": { "houg": 1 },
"level": 5
},
{
"bonus": { "kaih": 1 },
"level": 6
},
{
"bonus": { "houm": 1 },
"level": 7
},
{
"bonus": { "houg": 1 },
"level": 8
},
{
"bonus": { "kaih": 1 },
"level": 9
},
{
"bonus": { "houm": 1 },
"level": 10
}
]
},
{
"ids": [533],
"bonuses": [
Expand Down
3 changes: 3 additions & 0 deletions js/kcships.js
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,9 @@ Ship.prototype.getAACItype = function(atypes) {
hasID[this.equips[i].mid] = hasID[this.equips[i].mid] + 1 || 1;
}

if ([330,346,357,537,538,968].includes(this.mid)) {
if (this.equips.filter(eq => eq.mid == 533).length >= 2 && this.equips.find(eq => eq.btype == B_RADAR && eq.AA >= 4)) types.push(48);
}
if (this.sclass == 54) { //Akizuki-class
if (atypes[A_HAGUN] >= 2 && this.equiptypesB[B_RADAR]) types.push(1);
if (atypes[A_HAGUN] && this.equiptypesB[B_RADAR]) types.push(2);
Expand Down
3 changes: 2 additions & 1 deletion js/kcsim.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ var AACIDATA = {
45:{num:5,rate:.5,mod:1.55,equip:'HR',num1:1},
46:{num:8,rate:.6,mod:1.55,equip:'MCR',num1:1},
47:{num:2,rate:.7,mod:1.3,equip:'MG',num1:1},
48:{num:8,rate:.65,mod:1.75,equip:'HHR',num1:1},
};
(() => {
let orderKnown = [38,39,40,42,41,10,43,46,11,25,1,34,44,26,4,2,35,36,27,45,19,21,29,16,14,3,5,6,28,37,33,30,8,13,15,7,20,24,32,12,31,47,17,18,22,9,23];
let orderKnown = [38,39,40,42,41,10,43,46,11,25,48,1,34,44,26,4,2,35,36,27,45,19,21,29,16,14,3,5,6,28,37,33,30,8,13,15,7,20,24,32,12,31,47,17,18,22,9,23];
let orderUnknown = Object.keys(AACIDATA).map(key => +key).filter(type => !orderKnown.includes(type)).sort((a,b) => AACIDATA[a].num != AACIDATA[b].num ? AACIDATA[b].num - AACIDATA[a].num : AACIDATA[a].mod != AACIDATA[b].mod ? AACIDATA[b].mod - AACIDATA[a].mod : +a-+b);
let orderAll = [], n = 0;
for (let id of orderKnown) {
Expand Down
24 changes: 24 additions & 0 deletions js/simulator-ui/cmp.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ let messages = {
'equip_cat_Interceptor': 'Interceptor',
'equip_cat_Other': 'Other',
},
'results': {
'retreat_rate': 'Retreat',
'S_rate': 'S Rate',
'flagsunk_rate': 'Flagship Sunk Rate',
'avg_per_S': 'Avg Resource Per S',
'avg_per_flagsunk': 'Avg Resource Per Flagship Sunk',
'fuel': 'Fuel',
'ammo': 'Ammo',
'steel': 'Steel',
'baux': 'Bauxite',
'buckets': 'Buckets',
},
},
ja: {
'ui_search': '検索',
Expand Down Expand Up @@ -171,6 +183,18 @@ let messages = {
'equip_cat_Interceptor': '局地戦闘機',
'equip_cat_Other': 'その他',
},
'results': {
'retreat_rate': '撤退率',
'S_rate': 'S率',
'flagsunk_rate': '旗艦撃沈率',
'avg_per_S': 'S勝利あたり',
'avg_per_flagsunk': '旗艦撃沈あたり',
'fuel': '燃料',
'ammo': '弾薬',
'steel': '鋼材',
'baux': 'ボーキ',
'buckets': 'バケツ',
},
},
}
for (let id in SHIPDATA) {
Expand Down
3 changes: 3 additions & 0 deletions js/simulator-ui/fleet-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,9 @@ var UI_FLEETEDITOR = Vue.createApp({
updateCode: function() {
this.loadCode = JSON.stringify(CONVERT.uiToSaveFleet(this.fleet));
},
onclickSelectAll: function(event) {
event.target.select();
},

getStatTotal: function(ship,stat) {
if (stat == 'range') return Math.max(ship.statsBase.range,ship.statsEquip.range) + (ship.statsBonus.range || 0);
Expand Down
35 changes: 35 additions & 0 deletions js/simulator-ui/ui-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ var UI_MAIN = Vue.createApp({

lang: 'en',
canSave: false,

showNoticeCount: 0,
noticeTxt: '',
}),
mounted: function() {
this.$i18n.locale = localStorage.sim2_lang || 'en';
Expand Down Expand Up @@ -524,6 +527,33 @@ var UI_MAIN = Vue.createApp({
SIM.cancelRun = true;
},

onclickCopyResults: function(typeString) {
let t = this.$i18n.t;
let txt = '';
// txt += `${t('results.retreat_rate')}: ${Math.round(this.results.retreat*1000)/10}%, `;
if (typeString == 'S') {
txt += `${t('results.S_rate')}: ${Math.round(this.results.rankS*1000)/10}%
${t('results.avg_per_S')}
${t('results.fuel')}: ${this.results.fuelS}
${t('results.ammo')}: ${this.results.ammoS}
${t('results.steel')}: ${this.results.steelS}
${t('results.baux')}: ${this.results.bauxS}
${t('results.buckets')}: ${this.results.bucketS}`;
} else if (typeString == 'flagsunk') {
txt += `${t('results.flagsunk_rate')}: ${Math.round(this.results.flagSunk*1000)/10}%
${t('results.avg_per_flagsunk')}
${t('results.fuel')}: ${this.results.fuelSunk}
${t('results.ammo')}: ${this.results.ammoSunk}
${t('results.steel')}: ${this.results.steelSunk}
${t('results.baux')}: ${this.results.bauxSunk}
${t('results.buckets')}: ${this.results.bucketSunk}`;
}
navigator.clipboard.writeText(txt);
this.noticeTxt = 'Copied to Clipboard';
let n = ++this.showNoticeCount;
setTimeout(() => n == this.showNoticeCount && (this.showNoticeCount = 0), 1000);
},

onclickDeckbuilder: function() {
UI_DECKBUILDERIMPORTER.doOpen();
},
Expand Down Expand Up @@ -698,6 +728,8 @@ var UI_DECKBUILDERIMPORTER = Vue.createApp({
methods: {
doOpen: function() {
this.active = true;
let dataDb = this.getDataDb();
this.textExport = JSON.stringify(dataDb);
},

getDataDb: function() {
Expand Down Expand Up @@ -762,6 +794,9 @@ var UI_DECKBUILDERIMPORTER = Vue.createApp({
let dataDb = this.getDataDb();
window.open(CONST.urlLBASSim + encodeURI(JSON.stringify(dataDb)));
},
onclickSelectAll: function(event) {
event.target.select();
},
},
}).component('vmodal',COMMON.CMP_MODAL).mount('#divDeckbuilderImporter');

Expand Down
13 changes: 8 additions & 5 deletions simulator.html
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ <h3>Statistics</h3>
</table>
</div>
<div>
<div>Avg Resource Per <img src="assets/stats/S.png" alt="S"/>:</div>
<div>Avg Resource Per <img src="assets/stats/S.png" alt="S"/>:<img @click="onclickCopyResults('S')" src="assets/stats/content-copy-custom.png" class="copyIcons" title="Copy to Clipboard"></div>
<table>
<tr><th><img src="assets/stats/fuel.png" alt="Fuel"/></th><td><span class="resultBold">{{results.fuelS}}</span></td></tr>
<tr><th><img src="assets/stats/ammo.png" alt="Ammo"/></th><td><span class="resultBold">{{results.ammoS}}</span></td></tr>
Expand All @@ -419,7 +419,7 @@ <h3>Statistics</h3>
</table>
</div>
<div>
<div>Avg Resource Per <img src="assets/stats/flagsunk.png" alt="Flagship Sunk"/>:</div>
<div>Avg Resource Per <img src="assets/stats/flagsunk.png" alt="Flagship Sunk"/>:<img @click="onclickCopyResults('flagsunk')" src="assets/stats/content-copy-custom.png" class="copyIcons" title="Copy to Clipboard"></div>
<table>
<tr><th><img src="assets/stats/fuel.png" alt="Fuel"/></th><td><span class="resultBold">{{results.fuelSunk}}</span></td></tr>
<tr><th><img src="assets/stats/ammo.png" alt="Ammo"/></th><td><span class="resultBold">{{results.ammoSunk}}</span></td></tr>
Expand All @@ -439,11 +439,14 @@ <h3>Statistics</h3>
</div>

<hr>

<div id="divNotice" v-show="showNoticeCount">{{noticeTxt}}</div>
</div>

<div id="divOther">
<div id="divChangeLog">
<div><span class="header">Change Log:</span></div>
<div>2024-06-29 - Statistics: Copy text summary to clipboard buttons</div>
<div>2024-03-13 - Smoke activation rate provisional formula, see Show Advanced</div>
<div>2024-03-05 - Provisional Atoll node setting</div>
<div>2024-03-03 - Mark fleet preview ship banner if unknown or changed stats</div>
Expand Down Expand Up @@ -631,7 +634,7 @@ <h3>Statistics</h3>
<div class="headerImport">Load options:</div>
<div>
<div class="headerSubImport">From text:</div>
<div><textarea cols="20" rows="2" autocomplete="off" v-model="loadCode" @focus="onfocusCode" title="Can use: Simulator's default JSON, Deckbuilder JSON, KC3 Replay JSON"></textarea></div>
<div><textarea cols="20" rows="2" autocomplete="off" v-model="loadCode" @focus="onfocusCode" @click="onclickSelectAll" title="Can use: Simulator's default JSON, Deckbuilder JSON, KC3 Replay JSON"></textarea></div>
<div>
<input type="button" value="Load" @click="onclickLoadCode"/>
<span v-show="codeIsDeckbuilder"> Fleet: <select v-model.number="loadCodeFleet">
Expand Down Expand Up @@ -1079,7 +1082,7 @@ <h3>Statistics</h3>
</div>
<div class="sectionWrap">
<div class="sectionLeft">
<div><textarea ref="textImport" cols="30" rows="2" autocomplete="off" v-model="textImport"></textarea></div>
<div><textarea ref="textImport" cols="30" rows="2" autocomplete="off" v-model="textImport" @click="onclickSelectAll"></textarea></div>
<div>
<div><input type="button" value="Import" @click="onclickImport"/></div>
<div class="sectionWrap">
Expand All @@ -1095,7 +1098,7 @@ <h3>Statistics</h3>
</div>
</div>
<div>
<div><textarea ref="textExport" cols="30" rows="2" autocomplete="off" v-model="textExport"></textarea></div>
<div><textarea ref="textExport" cols="30" rows="2" autocomplete="off" v-model="textExport" @click="onclickSelectAll"></textarea></div>
<div><input type="button" value="Export Text" @click="onclickExport"/></div>
<div><input type="button" value="Open in DeckBuilder" @click="onclickOpenDb"/><input type="button" value="Open in LBAS Sim" @click="onclickOpenLBASSim"/></div>
</div>
Expand Down

0 comments on commit cc2d779

Please sign in to comment.