Skip to content

Commit

Permalink
added final fantasy explorers editor
Browse files Browse the repository at this point in the history
  • Loading branch information
marcrobledo committed Jul 10, 2018
1 parent b7121a0 commit a6d5f23
Show file tree
Hide file tree
Showing 10 changed files with 3,211 additions and 15 deletions.
25 changes: 25 additions & 0 deletions final-fantasy-explorers/_cache_service_worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
Copyright 2016 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---
mod by marcrobledo, original from: https://github.com/GoogleChrome/samples/blob/gh-pages/service-worker/basic/service-worker.js
*/

const PRECACHE_ID='v20180710';
const PRECACHE_FILES=[
'index.html','./',
'final-fantasy-explorers.js',
'database.js',
'icons.png',
'favicon.png',
'../savegame-editor.js'
];

self.addEventListener('install',event=>{event.waitUntil(caches.open(PRECACHE_ID).then(cache=>cache.addAll(PRECACHE_FILES)).then(self.skipWaiting()))});self.addEventListener('activate',event=>{const currentCaches=[PRECACHE_ID,'runtime'];event.waitUntil(caches.keys().then(cacheNames=>{return cacheNames.filter(cacheName=>!currentCaches.includes(cacheName));}).then(cachesToDelete=>{return Promise.all(cachesToDelete.map(cacheToDelete=>{return caches.delete(cacheToDelete);}))}).then(()=>self.clients.claim()))});self.addEventListener('fetch',event=>{if(event.request.url.startsWith(self.location.origin))event.respondWith(caches.match(event.request).then(cachedResponse=>{if(cachedResponse)return cachedResponse;return caches.open('runtime').then(cache=>{return fetch(event.request).then(response=>{return cache.put(event.request,response.clone()).then(()=>{return response})})})}))})
2,940 changes: 2,940 additions & 0 deletions final-fantasy-explorers/database.js

Large diffs are not rendered by default.

Binary file added final-fantasy-explorers/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
132 changes: 132 additions & 0 deletions final-fantasy-explorers/final-fantasy-explorers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/*
Final Fantasy Explorers for HTML5 Save Editor v20180708
by Marc Robledo 2018
*/

SavegameEditor={
Name:'Final Fantasy Explorers',
Filename:'game0',

Offsets:{
GIL:0x031424,
CP:0x03142c,
ITEMS:0x023140,
MATERIALS:0x02ff98,
ATMALITHS:0x030128
},

/* check if savegame is valid */
checkValidSavegame:function(){
return (tempFile.fileSize==201816)
},


/* preload function */
preload:function(){
setNumericRange('gil', 0, 9999999);
setNumericRange('cp', 0, 9999999);

createInventoryTable('material', MATERIALS);
createInventoryTable('atmalith', ATMALITHS);
createInventoryTable('item', ITEMS);
},

/* load function */
load:function(){
tempFile.littleEndian=true;
tempFile.fileName='game0';

setValue('gil', tempFile.readThreeBytes(this.Offsets.GIL), 0, 9999999);
setValue('cp', tempFile.readThreeBytes(this.Offsets.CP), 0, 9999999);

readInventoryFromTable('material', MATERIALS, this.Offsets.MATERIALS);
readInventoryFromTable('atmalith', ATMALITHS, this.Offsets.ATMALITHS);
readInventoryFromTable('item', ITEMS, this.Offsets.ITEMS);
},


/* save function */
save:function(){
tempFile.writeThreeBytes(this.Offsets.GIL, getValue('gil'));
tempFile.writeThreeBytes(this.Offsets.CP, getValue('cp'));


writeToInventory('material', MATERIALS, this.Offsets.MATERIALS);
writeToInventory('atmalith', ATMALITHS, this.Offsets.ATMALITHS);
writeToInventory('item', ITEMS, this.Offsets.ITEMS);
}
}


/* Implement 3-byte reader/writer in MarcBinFile */
MarcBinFile.prototype.readThreeBytes=function(offset){return (this.readByte(offset+2) << 16)+(this.readByte(offset+1) << 8)+(this.readByte(offset+0))}
MarcBinFile.prototype.writeThreeBytes=function(offset,val){this.writeBytes(offset, [(val & 0x0000ff) >> 0, (val & 0x00ff00) >> 8, (val & 0xff0000) >> 16])}




function readInventoryFromTable(container, table, offset){
for(var i=0; i<table.length; i++){
setValue(container+table[i][0], tempFile.readByte(offset+table[i][0]));
checkQuantity(getField(container+table[i][0]));
}
}
function writeToInventory(container, table, offset){
for(var i=0; i<table.length; i++){
tempFile.writeByte(offset+table[i][0], getValue(container+table[i][0]))
}
}
function createInventoryTable(container, table){
for(var i=0; i<table.length; i++){
var input=inputNumber(container+table[i][0], 0, 99);
input.addEventListener('change', checkQuantityEvent, false);
get('container-'+container+'s').appendChild(row(
[11,1],
label('number-'+container+table[i][0], '<span class="fficon fficon'+table[i][1]+'"></span> '+table[i][2]),
input
));
}
}


function checkQuantity(el){
el.parentElement.parentElement.children[0].children[0].style.opacity=parseInt(el.value)?1:.2;
}
function checkQuantityEvent(){
return checkQuantity(this);
}

/*
function getWeaponName(i){return WEAPONS[i][2]}
function getWeaponType(i){return WEAPONS[i][0]}
function getWeaponPassiveTrait(i){return WEAPONS[i][1]}
function getArmorName(i){return ARMOR[i][1]}
function getArmorType(i){return ARMOR[i][0]}
function Weapon(offset){
this.offset=offset;
this.hash=tempFile.readInt(offset);
this.pAttack=tempFile.readShort(offset+4);
this.mAttack=tempFile.readShort(offset+6);
this.pAccuracy=tempFile.readShort(offset+8);
this.mAccuracy=tempFile.readShort(offset+10);
this.mRecovery=tempFile.readShort(offset+12);
this.trait=tempFile.readInt(offset+14);
this.traitValue=tempFile.readInt(offset+18);
}*/








window.addEventListener('load',function(){
/* service worker */
if(location.protocol==='http:')
location.href=window.location.href.replace('http:','https:');
if('serviceWorker' in navigator)
navigator.serviceWorker.register('_cache_service_worker.js');
}, false);
Binary file added final-fantasy-explorers/game0
Binary file not shown.
Binary file added final-fantasy-explorers/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions final-fantasy-explorers/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<!DOCTYPE html>
<html>
<head>
<title>Savegame Editor &ndash; Final Fantasy Explorers</title>
<meta http-equiv="content-Type" content="text/html; charset=UTF-8"/>
<meta name="description" content="A savegame editor for Final Fantasy Explorers. It can edit values for your coins, flow balls and onions."/>
<meta name="keywords" content="html5, savegame, save, editor, hack, exploit, 3ds, final, fantasy, explorers, gil, cp, materials"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="shortcut icon" href="favicon.png"/>
<link type="text/css" rel="stylesheet" href="../savegame-editor.css" media="all"/>
<script type="text/javascript" src="../savegame-editor.js"></script>
<script type="text/javascript" src="./final-fantasy-explorers.js"></script>
<script type="text/javascript" src="./database.js"></script>
<style type="text/css"><!--
.fficon{
display:inline-block;
vertical-align: middle;
width:16px;height:16px;
background-image:url(icons.png);
}
.fficon.fficon0{background-position: 0px -0px}
.fficon.fficon1{background-position: 0px -16px}
.fficon.fficon2{background-position: 0px -32px}
.fficon.fficon3{background-position: 0px -48px}
.fficon.fficon4{background-position: 0px -64px}
.fficon.fficon5{background-position: 0px -80px}
.fficon.fficon6{background-position: 0px -96px}
.fficon.fficon7{background-position: 0px -112px}
.fficon.fficon8{background-position: 0px -128px}
.fficon.fficon9{background-position: 0px -144px}
.fficon.fficon10{background-position: 0px -160px}
.fficon.fficon11{background-position: 0px -176px}
.fficon.fficon12{background-position: 0px -192px}
.fficon.fficon13{background-position: 0px -208px}
.fficon.fficon14{background-position: 0px -224px}
.fficon.fficon15{background-position: 0px -240px}
.fficon.fficon16{background-position: 0px -256px}
.fficon.fficon17{background-position: 0px -272px}
.fficon.fficon18{background-position: 0px -288px}
.fficon.fficon19{background-position: 0px -304px}
.fficon.fficon20{background-position: 0px -320px}
.fficon.fficon21{background-position: 0px -336px}
.fficon.fficon22{background-position: 0px -352px}
.fficon.fficon23{background-position: 0px -368px}
.fficon.fficon24{background-position: 0px -384px}
--></style>
</head>
<body>

<!-- HEADER -->
<div id="header">
<div id="header-top">
<div class="row wrapper">
<h1 class="six columns text-left"><img src="favicon.png" /> Savegame Editor <small>for Final Fantasy Explorers</small></h1>
<div class="six columns header-buttons text-right">
by <a href="/">Marc Robledo</a>
<i class="icon github"></i> <a href="https://github.com/marcrobledo/savegame-editors/tree/master/final-fantasy-explorers" target="_blank">See on GitHub</a>
<i class="icon heart"></i> <a href="https://www.paypal.me/marcrobledo/5" target="_blank" rel="nofollow">Donate</a>
</div>
</div>
<div class="hidden row wrapper" id="toolbar">
<div class="twelve columns text-center">
<button class="close" onclick="closeFile()"><i class="icon close"></i> Close file</button>
<button class="colored" onclick="saveChanges()"><i class="icon accept"></i> Save changes</button>
</div>
</div>
</div>
</div>


<!-- THE EDITOR -->
<div id="the-editor" class="wrapper hidden">
<!-- BASIC -->
<h3 class="orange">Basic</h3>
<div class="container">
<div class="row">
<div class="ten columns"><label for="number-gil"><span class="fficon fficon23"></span> Gil</label></div>
<div class="two columns"><input id="number-gil" type="text" class="fw" /></div>
<div class="ten columns"><label for="number-cp"><span class="fficon fficon24"></span> CP</label></div>
<div class="two columns"><input id="number-cp" type="text" class="fw" /></div>
</div>
</div>

<!-- WEAPONS -->
<!-- <h3 class="blue"><span class="fficon fficon2"></span> Weapons</h3> -->

<!-- SHIELDS -->
<!-- <h3 class="green"><span class="fficon fficon3"></span> Shields</h3> -->

<!-- HEAD -->
<!-- <h3 class="red"><span class="fficon fficon4"></span> Head</h3> -->

<!-- ARMOR -->
<!-- <h3 class="orange"><span class="fficon fficon5"></span> Armor</h3> -->

<!-- MATERIALS -->
<h3 class="blue"><span class="fficon fficon1"></span> Materials</h3>
<div class="container" id="container-materials"></div>

<!-- ATMATLITHS -->
<h3 class="green"><span class="fficon fficon1"></span> Atmatliths</h3>
<div class="container" id="container-atmaliths"></div>

<!-- ITEMS -->
<h3 class="red"><span class="fficon fficon0"></span> Items</h3>
<div class="container" id="container-items"></div>

</div>

</body>
</html>
Binary file added final-fantasy-explorers/thumb.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 3 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html manifest="savegame-editors.appcache">
<html>
<head>
<title>HTML5 Savegame Editors</title>
<meta http-equiv="content-Type" content="text/html; charset=UTF-8"/>
Expand Down Expand Up @@ -99,16 +99,13 @@ <h1>HTML5 Savegame Editors</h1>
<a class="four columns game" href="kirbys-blowout-blast/"><img src="thumb.png" id="thumb-kirbys-blowout-blast" /><div>Kirby's Blowout Blast</div></a>
<a class="four columns game" href="picross-3d-round-2/"><img src="thumb.png" id="thumb-picross-3d-round-2" /><div>Picross 3D: Round 2</div></a>
<a class="four columns game" href="pokemon-picross/"><img src="thumb.png" id="thumb-pokemon-picross" /><div>Pokémon Picross</div></a>
<a class="four columns game" href="zelda-botw-master/"><img src="thumb.png" id="thumb-zelda-botw-master" /><div>The legend of Zelda: Breath of the wild (Master editor)</div></a>
<a class="four columns game" href="final-fantasy-explorers/"><img src="thumb.png" id="thumb-final-fantasy-explorers" /><div>Final Fantasy Explorers <b>NEW!</b></div></a>
</div>
<div class="row">
<a class="four columns game" href="zelda-botw-master/"><img src="thumb.png" id="thumb-zelda-botw-master" /><div>The legend of Zelda: Breath of the wild (Master editor)</div></a>
<a class="four columns game" href="rhythm-paradise-megamix/"><img src="thumb.png" id="thumb-rhythm-paradise-megamix" /><div>Rhythm Paradise Megamix</div></a>
<a class="four columns game" href="streetpass-mii-plaza/"><img src="thumb.png" id="thumb-streetpass-mii-plaza" /><div>StreetPass Mii Plaza</div></a>
<div class="four columns game"></div>
<div class="four columns game"></div>
</div>
<div class="row">
<a class="four columns game" href="zelda-botw-master/"><img src="thumb.png" id="thumb-zelda-botw-master" /><div>The legend of Zelda: Breath of the wild (Master editor)</div></a>
</div>

<hr/>
Expand Down
9 changes: 0 additions & 9 deletions savegame-editors.appcache

This file was deleted.

0 comments on commit a6d5f23

Please sign in to comment.