0
0
mirror of https://github.com/marcrobledo/savegame-editors.git synced 2025-04-24 16:35:10 +00:00

BOTW: restored functionality from cutecryptid's PR

This commit is contained in:
Marc Robledo 2023-09-02 21:45:06 +02:00
parent c02843ec3d
commit e346c79357
5 changed files with 155 additions and 10 deletions

View File

@ -30,7 +30,7 @@ caches.keys().then(function(cacheNames){
});
var PRECACHE_ID='zelda-botw-editor';
var PRECACHE_VERSION='v5c';
var PRECACHE_VERSION='v6';
var PRECACHE_URLS=[
//is hashes file too big for cacheing?
'/savegame-editors/zelda-botw/','/savegame-editors/zelda-botw/index.html',
@ -39,6 +39,7 @@ var PRECACHE_URLS=[
'/savegame-editors/zelda-botw/zelda-botw.data.js',
'/savegame-editors/zelda-botw/zelda-botw.icons.js',
'/savegame-editors/zelda-botw/zelda-botw.locations.js',
'/savegame-editors/zelda-botw/zelda-botw.score.js',
'/savegame-editors/zelda-botw/zelda-botw.master.js',
'/savegame-editors/zelda-botw/favicon.png',
'/savegame-editors/zelda-botw/assets/_blank.png',

View File

@ -14,6 +14,7 @@
<script type="text/javascript" src="./zelda-botw.locations.js"></script>
<script type="text/javascript" src="./zelda-botw.icons.js"></script>
<script type="text/javascript" src="./zelda-botw.master.js"></script>
<script type="text/javascript" src="./zelda-botw.score.js"></script>
<script type="text/javascript"><!--
/* service worker */
var FORCE_HTTPS=true;
@ -154,6 +155,13 @@
</select>
</div>
</div>
<div class="row" style="margin-top:10px">
<div class="ten columns">Scale score</div>
<div class="two columns text-right">
<span id="span-scale-score"></span>
<a target="_blank" href="https://www.reddit.com/r/Breath_of_the_Wild/comments/8fchiq/about_difficulty_scaling_for_enemies_and_weapons/" class="external-link-help help">?</a>
</div>
</div>
<!-- Coordinates (Requires a memory editor) -->
<h3 class="border-green">Coordinates</h3>

View File

@ -1,4 +1,4 @@
/* Zelda BOTW Savegame editor by Marc Robledo v20200215 */
/* Zelda BOTW Savegame editor by Marc Robledo v20230902 */
/* minify at https://cssminifier.com/ + https://www.base64-image.de/ (sprites */
/* @FONT-FACES */
@ -476,6 +476,22 @@ button.no-text.with-icon:before{margin-right:0px}
}
.external-link-help{
background-color:#f9f5da;
color:black;
padding: 0px 8px;
font-size:80%;
font-weight:bold;
border-radius:3px;
text-decoration:none;
}
.external-link-help:hover{
background-color:white;
}
/* MarcDragAndDrop */
#dragzone{

View File

@ -1,5 +1,5 @@
/*
The legend of Zelda: Breath of the wild v20200218
The legend of Zelda: Breath of the wild v20230902
by Marc Robledo 2017-2020
*/
var currentEditingItem=0;
@ -7,7 +7,7 @@ var currentEditingItem=0;
SavegameEditor={
Name:'The legend of Zelda: Breath of the wild',
Filename:'game_data.sav',
Version:20200218,
Version:20230902,
/* Constants */
Constants:{
@ -617,11 +617,10 @@ SavegameEditor={
}
showTab('home');
/* scale score */
setValue('scale-score', BOTWScoreCalculator.calculate());
},
/* save function */
@ -1038,12 +1037,12 @@ function onScroll(){
}
window.addEventListener('scroll', onScroll, false);
if(typeof String.endsWith==='undefined'){
if(typeof String.prototype.endsWith==='undefined'){
String.prototype.endsWith=function(search){
return (new RegExp(search+'$')).test(this)
};
}
if(typeof String.startsWith==='undefined'){
if(typeof String.prototype.startsWith==='undefined'){
String.prototype.startsWith=function(search){
return (new RegExp('^'+search)).test(this)
};

View File

@ -0,0 +1,121 @@
/*
The legend of Zelda: Breath of the wild Savegame Editor (Experience/score calculation) v20230708
by cutecryptid 2019
based on https://www.reddit.com/r/Breath_of_the_Wild/comments/8fchiq/about_difficulty_scaling_for_enemies_and_weapons/
*/
var BOTWScoreCalculator=(function(){
const ENEMY_POINTS={
Defeated_Enemy_Wizzrobe_Electric_Num: 5.0,
Defeated_Enemy_Wizzrobe_Fire_Num: 5.0,
Defeated_Enemy_Wizzrobe_Ice_Num: 5.0,
Defeated_Enemy_Guardian_A_Fixed_Moss_Num: 12.0,
Defeated_Enemy_Golem_Junior_Num: 15.0,
Defeated_Enemy_Giant_Junior_Num: 15.0,
Defeated_Enemy_Assassin_Middle_Num: 15.0,
Defeated_Enemy_Bokoblin_Senior_Num: 15.0,
Defeated_Enemy_Wizzrobe_Ice_Senior_Num: 15.0,
Defeated_Enemy_Wizzrobe_Fire_Senior_Num: 15.0,
Defeated_Enemy_Wizzrobe_Electric_Senior_Num: 15.0,
Defeated_RemainsFire_Drone_A_01_Num: 15.0,
Defeated_Enemy_Moriblin_Senior_Num: 18.0,
Defeated_Enemy_Guardian_Mini_Middle_Num: 20.0,
Defeated_Enemy_Lizalfos_Electric_Num: 20.0,
Defeated_Enemy_Lizalfos_Ice_Num: 20.0,
Defeated_Enemy_Lizalfos_Senior_Num: 20.0,
Defeated_Enemy_Lizalfos_Fire_Num: 20.0,
Defeated_Enemy_Bokoblin_Gold_Num: 25.0,
Defeated_Enemy_Giant_Bone_Num: 25.0,
Defeated_Enemy_Bokoblin_Dark_Num: 25.0,
Defeated_Enemy_Golem_Middle_Num: 25.0,
Defeated_Enemy_Giant_Middle_Num: 25.0,
Defeated_Enemy_Golem_Senior_Num: 30.0,
Defeated_Enemy_Golem_Fire_Num: 35.0,
Defeated_Enemy_Moriblin_Gold_Num: 35.0,
Defeated_Enemy_Guardian_Mini_Senior_Num: 35.0,
Defeated_Enemy_Guardian_B_Num: 35.0,
Defeated_Enemy_Golem_Ice_Num: 35.0,
Defeated_Enemy_Moriblin_Dark_Num: 35.0,
Defeated_Enemy_Golem_Fire_R_Num: 35.0,
Defeated_Enemy_Giant_Senior_Num: 35.0,
Defeated_Enemy_Lizalfos_Dark_Num: 40.0,
Defeated_Enemy_Lizalfos_Gold_Num: 40.0,
Defeated_Enemy_SandwormR_Num: 50.0,
Defeated_Enemy_Guardian_A_Num: 50.0,
Defeated_Enemy_Guardian_C_Num: 50.0,
Defeated_Enemy_Sandworm_Num: 50.0,
Defeated_Enemy_Lynel_Junior_Num: 50.0,
Defeated_Enemy_Lynel_Middle_Num: 60.0,
Defeated_Enemy_Lynel_Senior_Num: 80.0,
Defeated_Enemy_Assassin_Senior_Num: 100.0,
Defeated_Enemy_Lynel_Gold_Num: 120.0,
Defeated_Enemy_Lynel_Dark_Num: 120.0,
Defeated_Enemy_SiteBoss_Lsword_Num: 300.0,
Defeated_Enemy_SiteBoss_Spear_Num: 300.0,
Defeated_Enemy_SiteBoss_Sword_Num: 300.0,
Defeated_Enemy_SiteBoss_Bow_Num: 300.0,
Defeated_Priest_Boss_Normal_Num: 500.0,
Defeated_Enemy_GanonBeast_Num: 800.0
};
/* crc32 from https://stackoverflow.com/a/18639999 */
const CRC32_TABLE=(function(){
var c;
var crcTable = [];
for(var n =0; n < 256; n++){
c = n;
for(var k =0; k < 8; k++){
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
crcTable[n] = c;
}
return crcTable;
}());
var crc32=function(str){
var crc = 0 ^ (-1);
for (var i = 0; i < str.length; i++ ) {
crc = (crc >>> 8) ^ CRC32_TABLE[(crc ^ str.charCodeAt(i)) & 0xFF];
}
return (crc ^ (-1)) >>> 0;
};
var findHashesIn;
return {
calculate:function(){
if(!findHashesIn){
findHashesIn=[];
Object.keys(ENEMY_POINTS).forEach(function(hashId){
findHashesIn[crc32(hashId)]=ENEMY_POINTS[hashId];
});
}
var scaleScore = 0
var previousHashValue=0;
for(var i=0x0c; i<tempFile.fileSize-4; i+=8){
var hashValue=tempFile.readU32(i);
if(hashValue===previousHashValue)
continue;
previousHashValue=hashValue;
if(findHashesIn[hashValue]){
defeated = tempFile.readU32(i+4);
enepoints = findHashesIn[hashValue];
scaleScore += enepoints*defeated;
}
}
return scaleScore;
}
}
}());