Skip to content

Commit 0e4885d

Browse files
author
Marc Robledo
committed
*add building option added
*fill catalog option added *custom pattern can be set to villagers houses and tshirts (bugfix)
1 parent 463d5f3 commit 0e4885d

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

acnl_editor.appcache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# last update: 20170728b
2+
# last update: 20170826
33
#CACHE:
44
index.html
55
help.html

data/acnl_editor.js

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/*
2-
Animal Crossing: New Leaf Save Editor v20170728
2+
Animal Crossing: New Leaf Save Editor v20170826
33
by Marc Robledo 2015-2017
44
55
A lot of thanks to:
66
* SciresM for breaking the numeric encryption used in the game
77
* Thulinma for Pattern structure (check out his editor pattern http://www.thulinma.com/acnl/ )
88
* NeoKamek for his work on LeafTools and other help
9+
* slattz for various contributions
910
* jexom for documenting grass deterioration
1011
* froggestspirit for extracting acre information and item list
1112
* sprungit/shokolad-town for compiling hair style and color thumbnails
@@ -69,7 +70,7 @@ var Offsets={
6970
PLAYER_TPCTEXT: 0x6b24,
7071
PLAYER_PLAYTIME: 0x6b90,
7172
PLAYER_POCKETS: 0x6bb0,
72-
PLAYER_ENCYCLOPEDIA: 0x6c00,
73+
PLAYER_CATALOG: 0x6c00, //starts with encyclopedia
7374
PLAYER_BANK: 0x6b6c,
7475
PLAYER_MEDALS: 0x6b7c,
7576
PLAYER_WALLET: 0x6e38,
@@ -174,7 +175,7 @@ const OffsetsPlus={
174175
PLAYER_TPCTEXT: 0x6b38,
175176
PLAYER_PLAYTIME: 0x6bb0,
176177
PLAYER_POCKETS: 0x6bd0,
177-
PLAYER_ENCYCLOPEDIA: 0x6c20,
178+
PLAYER_CATALOG: 0x6c20, //starts with encyclopedia
178179
PLAYER_BANK: 0x6b8c,
179180
PLAYER_MEDALS: 0x6b9c,
180181
PLAYER_WALLET: 0x6f08,
@@ -422,6 +423,8 @@ addEvent(window,'load',function(){
422423

423424

424425
function Town(){
426+
this.maxBuildings=savegame.readByte1(Offsets.MAP_BUILDINGS-4);
427+
425428
this.treeSize=savegame.readByte1(parseInt(Offsets.TOWN_TREESIZE)); //01-07
426429
this.grassType=savegame.readByte1(Offsets.TOWN_GRASSTYPE); //00-02
427430
this.grassTypeIsland=savegame.readByte1(Offsets.ISLAND_GRASSTYPE); //00-02
@@ -436,8 +439,6 @@ function Town(){
436439
this.nativeFruit=savegame.readByte1(Offsets.TOWN_NATIVEFRUIT);
437440

438441

439-
440-
441442
this.townId1=savegame.readByte1(Offsets.TOWN_ID1);
442443
this.townId2=savegame.readByte1(Offsets.TOWN_ID2);
443444
this.name=savegame.readU16String(Offsets.TOWN_NAME, 9);
@@ -535,7 +536,9 @@ Town.prototype.searchTownIdReferences=function(){
535536
Town.prototype.refreshIdSpans=function(){
536537
el('town-id').innerHTML='0x'+intToHex(this.townId2)+intToHex(this.townId1);
537538
}
538-
Town.prototype.save=function(){
539+
Town.prototype.save=function(){
540+
savegame.storeByte(Offsets.MAP_BUILDINGS-4, this.maxBuildings);
541+
539542
savegame.storeByte(Offsets.TOWN_NATIVEFRUIT, this.nativeFruit);
540543
savegame.storeByte(Offsets.TOWN_GRASSTYPE, this.grassType);
541544
savegame.storeByte(Offsets.ISLAND_GRASSTYPE, this.grassTypeIsland);
@@ -797,7 +800,11 @@ function click(evt,itemGridObj,firstClick){
797800
currentEditingItem=itemSlot;
798801

799802
if(mouseHeld==1){
800-
if(el('items').value>=itemGridObj.minItem && el('items').value<=itemGridObj.maxItem){
803+
if(
804+
(el('items').value>=itemGridObj.minItem && el('items').value<=itemGridObj.maxItem)
805+
||
806+
(el('items').value==0x33a7 && itemGridObj.nItems===1 && itemGridObj.minItem!==Offsets.MIN_SONG)
807+
){
801808
if(itemGridObj.inside && itemSlot.id==el('items').value && itemSlot.flag1==el('flag1').decimalValue && itemSlot.flag2==el('flag2').decimalValue){
802809
var rotation=itemSlot.flag2>>4;
803810

@@ -1369,10 +1376,10 @@ Building.prototype.set=function(newId){
13691376
this.y=0;
13701377

13711378
if(this.tr){
1372-
if(this.type==='island')
1373-
el('buildings-island').removeChild(this.tr);
1374-
else
1379+
if(this.type==='map'){
13751380
el('buildings').removeChild(this.tr);
1381+
town.maxBuildings--; //not tested yet
1382+
}
13761383
this.tr=null;
13771384
}
13781385
}else if(this.tr){
@@ -1544,6 +1551,7 @@ function addBuilding(){
15441551
for(var i=0; i<allBuildings.length; i++)
15451552
allBuildings[i].disabled=(allBuildings[i].group!==0);
15461553

1554+
town.maxBuildings++;
15471555
MarcDialogs.open('building')
15481556
}
15491557
slot--;
@@ -2213,12 +2221,21 @@ Player.prototype.unlockEmotions=function(){
22132221
}
22142222
Player.prototype.fillEncyclopedia=function(){
22152223
MarcDialogs.confirm('Do you want to fill encyclopedia up for this player?<br/>'+getWarningMessage(), function(){
2216-
var encyclopediaOffset=currentPlayer.offset+Offsets.PLAYER_ENCYCLOPEDIA;
2224+
var encyclopediaOffset=currentPlayer.offset+Offsets.PLAYER_CATALOG;
22172225
for(var i=0; i<Constants.FULL_ENCYCLOPEDIA.length; i++)
22182226
savegame.storeByte(encyclopediaOffset+i, Constants.FULL_ENCYCLOPEDIA[i]);
22192227
MarcDialogs.alert('Encyclopedia was filled for this player.');
22202228
});
22212229
}
2230+
Player.prototype.fillCatalog=function(){
2231+
MarcDialogs.confirm('Do you want to fill catalog up for this player?<br/>'+getWarningMessage(), function(){
2232+
var catalogOffset=currentPlayer.offset+Offsets.PLAYER_CATALOG;
2233+
var maxInts=plusMode?180:136;
2234+
for(var i=0; i<maxInts; i++)
2235+
savegame.storeByte4(catalogOffset+i*4, 0xffffffff);
2236+
MarcDialogs.alert('Catalog was filled for this player.');
2237+
});
2238+
}
22222239

22232240

22242241
function changeTPCPic(){

index.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<span class="logo"></span>
1919
<h1>Animal Crossing: New Leaf Save Editor</h1>
2020
<div class="author">
21-
by <a href="http://www.marcrobledo.com" target="_blank">Marc Robledo</a> <span class="last-update">(last updated on 28th Jul 2017)</span>
21+
by <a href="http://www.marcrobledo.com" target="_blank">Marc Robledo</a> <span class="last-update">(last updated on 26th Aug 2017)</span>
2222
</div>
2323

2424
<div id="help">
@@ -108,7 +108,10 @@ <h1>Animal Crossing: New Leaf Save Editor</h1>
108108
<div style="float:right;width:360px">
109109
<h3 class="no-separation">Buildings</h3>
110110
<ul id="buildings" class="building-list">
111-
<li id="buildings-sort-button" style="text-align:center"><input type="button" value="Sort by type" onclick="sortMapBuildings()"/></li>
111+
<li id="buildings-sort-button" style="text-align:center">
112+
<input type="button" value="Sort by type" onclick="sortMapBuildings()"/>
113+
<input type="button" value="Add building" onclick="addBuilding()"/>
114+
</li>
112115
</ul>
113116
</div>
114117
<div id="map-map" class="map"></div>
@@ -216,6 +219,7 @@ <h3 class="no-separation">Player info</h3>
216219
<td id="player-cheats">
217220
<input type="button" value="Encyclopedia" onclick="currentPlayer.fillEncyclopedia()"/>
218221
<input type="button" value="Emotions" onclick="currentPlayer.unlockEmotions()"/>
222+
<input type="button" value="Fill catalog" onclick="currentPlayer.fillCatalog()"/>
219223
<input type="button" value="Change TPC pic" onclick="changeTPCPic()"/>
220224
</td>
221225
</tr>
@@ -681,6 +685,7 @@ <h3>Museum Room 4</h3>
681685

682686
<div class="buttons">
683687
<input type="button" class="button-accept" value="Accept" onclick="acceptBuilding()"/>
688+
<!-- <input type="button" class="red" value="Remove" onclick="removeBuilding()"/> -->
684689
<input type="button" value="Cancel" onclick="MarcDialogs.close()"/>
685690
</div>
686691
</div>

0 commit comments

Comments
 (0)