forked from MouseyPounds/stardew-checkup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stardew-checkup.js
5072 lines (4869 loc) · 185 KB
/
stardew-checkup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* stardew-checkup.js
* https://mouseypounds.github.io/stardew-checkup/
*/
/*jslint indent: 4, maxerr: 50, passfail: false, browser: true, regexp: true, plusplus: true */
/*global $, FileReader */
$( document ).ready(function () {
"use strict";
// Check for required File API support.
if (!(window.File && window.FileReader)) {
document.getElementById('out').innerHTML = '<span class="error">Fatal Error: Could not load the File & FileReader APIs</span>';
return;
}
// Show input field immediately
$(document.getElementById('input-container')).show();
// Utility functions
function addCommas(x) {
// Jamie Taylor @ https://stackoverflow.com/questions/3883342/add-commas-to-a-number-in-jquery
return x.toString().replace(/\B(?=(?:\d{3})+(?!\d))/g, ",");
}
function capitalize(s) {
// joelvh @ https://stackoverflow.com/questions/1026069/how-do-i-make-the-first-letter-of-a-string-uppercase-in-javascript
return s && s[0].toUpperCase() + s.slice(1);
}
function compareSemVer(a, b) {
// semver-compare by James Halliday ("substack") @ https://github.com/substack/semver-compare
var pa = a.split('.');
var pb = b.split('.');
for (var i = 0; i < 3; i++) {
var na = Number(pa[i]);
var nb = Number(pb[i]);
if (na > nb) return 1;
if (nb > na) return -1;
if (!isNaN(na) && isNaN(nb)) return 1;
if (isNaN(na) && !isNaN(nb)) return -1;
}
return 0;
}
function getAchieveString(name, desc, yes) {
if (desc.length > 0) {
desc = '(' + desc + ') ';
}
return (yes) ? '<span class="ach_yes"><span class="ach">' + name + '</span> ' + desc + ' done</span>' :
'<span class="ach_no"><span class="ach">' + name + '</span> ' + desc + '</span> -- need ';
}
function getAchieveImpossibleString(name, desc) {
if (desc.length > 0) {
desc = '(' + desc + ') ';
}
return '<span class="ach_imp"><span class="ach">' + name + '</span> ' + desc + ' impossible</span>';
}
function getMilestoneString(desc, yes) {
return (yes) ? '<span class="ms_yes">' + desc + '</span>' :
'<span class="ms_no">' + desc + '</span> -- need ';
}
function getPointString(pts, desc, cum, yes) {
var c = (cum) ? ' more' : '';
return (yes) ? '<span class="pt_yes"><span class="pts">+' + pts + c + '</span> earned (' + desc + ')</span>' :
'<span class="pt_no"><span class="pts"> (' + pts + c + ')</span> possible (' + desc + ')</span>';
}
function getPointImpossibleString(pts, desc) {
return '<span class="pt_imp"><span class="pts">+' + pts + '</span> impossible (' + desc + ')</span>';
}
function getPerfectionPctString(pct, max, desc, yes) {
var pts = max * pct;
var places = 2;
if (pct < .0001 || pct > .9999) { places = 0 };
pts = pts.toFixed(places);
var pretty_pct = 100*pct;
pretty_pct = pretty_pct.toFixed(Math.max(0, places-1));
return (yes) ? '<span class="pt_yes"><span class="pts">' + pts + '%</span> from completion of ' + desc + '</span>' :
'<span class="pt_no"><span class="pts"> ' + pts + '%</span> (of ' + max + '% possible) from ' + desc +
' (' + pretty_pct + '%)</span>';
}
function getPerfectionNumString(num, max, desc, yes) {
var pts = num;
var pretty_pct = num + "/" + max;
return (yes) ? '<span class="pt_yes"><span class="pts">' + pts + '%</span> from completion of ' + desc + '</span>' :
'<span class="pt_no"><span class="pts"> ' + pts + '%</span> (of ' + max + '% possible) from ' + desc +
' (' + pretty_pct + ')</span>';
}
function getPerfectionPctNumString(pct, max, count, desc, yes) {
var pts = max * pct;
var places = 2;
if (pct < .0001 || pct > .9999) { places = 0 };
pts = pts.toFixed(places);
var pretty_pct = Math.round(count * pct) + "/" + count + " or " + Number(100*pct).toFixed(Math.max(0, places-1)) + "%";
return (yes) ? '<span class="pt_yes"><span class="pts">' + pts + '%</span> from completion of ' + desc + '</span>' :
'<span class="pt_no"><span class="pts"> ' + pts + '%</span> (of ' + max + '% possible) from ' + desc +
' (' + pretty_pct + ')</span>';
}
function getPerfectionBoolString(max, desc, yes) {
return (yes) ? ('<span class="pt_yes"><span class="pts">' + max + '%</span> from completion of ' + desc + '</span>') :
('<span class="pt_no"><span class="pts"> 0%</span> (of ' + max + '% possible) from ' + desc + '</span>');
}
function wikify(item, page, no_anchor) {
// removing egg colors & changing spaces to underscores
var trimmed = item.replace(' (White)', '');
trimmed = trimmed.replace(' (Brown)', '');
trimmed = trimmed.replace(/#/g, '.23');
trimmed = trimmed.replace(/ /g, '_');
if (page) {
return (no_anchor) ? ('<a href="http://stardewvalleywiki.com/' + page + '">' + item + '</a>') :
('<a href="http://stardewvalleywiki.com/' + page + '#' + trimmed + '">' + item + '</a>');
} else {
return ('<a href="http://stardewvalleywiki.com/' + trimmed + '">' + item + '</a>');
}
}
function wikimap(item, index, arr) {
// Wrapper to allow wikify to be used within an array map without misinterpreting the 2nd and 3rd arguments.
return wikify(item);
}
function printTranspose(table) {
var output = '<table class="output">',
id;
for (var r = 0; r < table[0].length; r++) {
output += '<tr>';
for (var c = 0; c < table.length; c++) {
id = 'PL_' + (c+1);
output += '<td class="' + id + '">' + table[c][r] + '</td>';
}
output += '</tr>';
}
output += '</table>';
return output;
}
function isValidFarmhand(player) {
// Had been using a blank userID field to determine that a farmhand slot is empty
// until a user sent a save where a valid farmhand had no ID. Now using both a blank
// userID and name field and hoping that it's enough.
if (($(player).children('userID').text() === '') && ($(player).children('name').text() === '')) {
return false;
}
return true;
}
function getSummaryClass(saveInfo, version) {
// Relatively simple conditional checks that need to be done a whole lot
var prefs = (compareSemVer(version, "1.5") < 0) ? saveInfo.outputPrefOld : saveInfo.outputPrefNew;
var sum_class = "initial_hide";
if (prefs === 'show_all' || prefs === 'hide_details') {
sum_class = "initial_show";
}
return sum_class;
}
function getDetailsClass(saveInfo, version) {
// Relatively simple conditional checks that need to be done a whole lot
var prefs = (compareSemVer(version, "1.5") < 0) ? saveInfo.outputPrefOld : saveInfo.outputPrefNew;
var det_class = "initial_show";
if (prefs === 'hide_all' || prefs === 'hide_details') {
det_class = "initial_hide";
}
return det_class;
}
function getPTLink(input, isPct) {
// Makes link to Perfection Tracker from given info
// If 'isPct' is true, will convert to a percentage rounded to 1 decimal
if (isPct) {
var places = (input === 1) ? 0 : 1;
var n = Number(100*input).toFixed(places);
input = n + '%';
}
return ' (<a href="#sec_Perfection_Tracker">PT: ' + input + '</a>)';
}
function getSectionWrapper(saveInfo, title, anchor, showDetailsButton, version) {
// Sets up title and buttons which control the collapsible output
// showDetailsButton is a bool so that we don't have a control for empty details
// version is when that section was added and is used for old vs new interpretation
// version 1.2 is the baseline value for most original sections
// "old" currently means before version 1.5 and "new" is 1.5 & later
let prefs = (compareSemVer(version, "1.5") < 0) ? saveInfo.outputPrefOld : saveInfo.outputPrefNew;
let wrapper = '<div class="collapsible" id="wrap_' + anchor + '"><h3>' + title + '</h3>';
let sum_button, sum_class, det_button, det_class;
if (prefs === 'show_all' || prefs === 'hide_details') {
sum_button = "Hide Summary";
} else {
sum_button = "Show Summary";
}
if (prefs === 'hide_all' || prefs === 'hide_details') {
det_button = "Show Details";
} else {
det_button = "Hide Details";
}
// Supporting sections that don't have details also should not have the button. We'll leave the empty div alone
var button_element = "(No Details)";
if (showDetailsButton) {
button_element = '<button id="toggle_' + anchor + '_details" type="button" data-target="' + anchor + '_details">' + det_button + '</button>';
}
wrapper += ' <button id="toggle_' + anchor + '_summary" type="button" data-target="' + anchor + '_summary">' + sum_button + '</button> ' + button_element;
wrapper += '</div>';
return $( wrapper );
}
function collapsibleWrap(saveInfo, title, output, version) { return "<h4>PLACEHOLDER</h4>" + output; }
function makeAnchor(text) {
// forces lower-case and converts non-alpha characters to underscore for simple ID attributes
var id = text;
id.toLowerCase();
return id.replace(/[^\w*]/g, '_');
}
// Individual chunks of save parsing.
// Each receives the xmlDoc object to parse & the saveInfo information structure and returns HTML to output.
// Most also create a meta object which is passed to the per-player info subroutine primarily to find out if
// there are any details so that we know whether to show a button later.
function parseSummary(xmlDoc, saveInfo) {
var title = "Summary",
anchor = makeAnchor(title),
version = "1.2",
sum_class = getSummaryClass(saveInfo, version),
details = '',
farmTypes = ['Standard', 'Riverland', 'Forest', 'Hill-top', 'Wilderness', 'Four Corners', 'Beach'],
playTime = Number($(xmlDoc).find('player > millisecondsPlayed').text()),
playHr = Math.floor(playTime / 36e5),
playMin = Math.floor((playTime % 36e5) / 6e4),
id = "0",
name = $(xmlDoc).find('player > name').html(),
farmer = name,
farmhands = [];
// Versioning has changed from bools to numers, to now a semver string.
saveInfo.version = $(xmlDoc).find('gameVersion').first().text();
if (saveInfo.version === "") {
saveInfo.version = "1.2";
if ($(xmlDoc).find('hasApplied1_4_UpdateChanges').text() === 'true') {
saveInfo.version = "1.4";
} else if ($(xmlDoc).find('hasApplied1_3_UpdateChanges').text() === 'true') {
saveInfo.version = "1.3";
}
}
// Namespace prefix varies by platform; iOS saves seem to use 'p3' and PC saves use 'xsi'.
saveInfo.ns_prefix = ($(xmlDoc).find('SaveGame[xmlns\\:xsi]').length > 0) ? 'xsi': 'p3';
// Farmer, farm, and child names are read as html() because they come from user input and might contain characters
// which must be escaped.
saveInfo.players = {};
saveInfo.children = {};
if (compareSemVer(saveInfo.version, "1.3") >= 0) {
id = $(xmlDoc).find('player > UniqueMultiplayerID').text();
}
saveInfo.players[id] = name;
saveInfo.children[id] = [];
$(xmlDoc).find("[" + saveInfo.ns_prefix + "\\:type='FarmHouse'] NPC[" + saveInfo.ns_prefix + "\\:type='Child']").each(function () {
saveInfo.children[id].push($(this).find('name').html());
});
saveInfo.numPlayers = 1;
// Initializing structures needed for perfectionTracker since a lot of it builds on other milestones
saveInfo.perfectionTracker = { 'global': {
'Gold Clock': false,
'Earth Obelisk': false,
'Water Obelisk': false,
'Desert Obelisk': false,
'Island Obelisk': false,
'Walnuts': { 'count': 0, 'total': 130 },
} };
saveInfo.perfectionTracker[id] = {};
let output = '<div class="' + anchor + '_summary ' + sum_class + '">';
output += '<span class="result">' + $(xmlDoc).find('player > farmName').html() + ' Farm (' +
farmTypes[$(xmlDoc).find('whichFarm').text()] + ')</span><br />';
output += '<span class="result">Farmer ' + name ;
$(xmlDoc).find('farmhand').each(function() {
if (isValidFarmhand(this)) {
saveInfo.numPlayers++;
id = $(this).children('UniqueMultiplayerID').text();
name = $(this).children('name').html();
farmhands.push(name);
saveInfo.players[id] = name;
saveInfo.children[id] = [];
$(this).parent('indoors[' + saveInfo.ns_prefix + '\\:type="Cabin"]').find("NPC[" + saveInfo.ns_prefix + "\\:type='Child']").each(function () {
saveInfo.children[id].push($(this).find('name').html());
});
saveInfo.perfectionTracker[id] = {};
}
});
if (saveInfo.numPlayers > 1) {
output += ' and Farmhand(s) ' + farmhands.join(', ');
createPlayerList(saveInfo.numPlayers, farmer, farmhands);
}
output += '</span><br />';
// Searching for marriage between players & their children
saveInfo.partners = {};
$(xmlDoc).find('farmerFriendships > item').each(function() {
var item = this;
if ($(this).find('value > Friendship > Status').text() === 'Married') {
var id1 = $(item).find('key > FarmerPair > Farmer1').text();
var id2 = $(item).find('key > FarmerPair > Farmer2').text();
saveInfo.partners[id1] = id2;
saveInfo.partners[id2] = id1;
}
});
// Dump of most items in ObjectInformation, needed for Bundle processing.
saveInfo.objects = {
16: "Wild Horseradish",
18: "Daffodil",
20: "Leek",
22: "Dandelion",
24: "Parsnip",
60: "Emerald",
62: "Aquamarine",
64: "Ruby",
66: "Amethyst",
68: "Topaz",
69: "Banana Sapling",
70: "Jade",
72: "Diamond",
74: "Prismatic Shard",
78: "Cave Carrot",
80: "Quartz",
82: "Fire Quartz",
84: "Frozen Tear",
86: "Earth Crystal",
88: "Coconut",
90: "Cactus Fruit",
91: "Banana",
92: "Sap",
93: "Torch",
96: "Dwarf Scroll I",
97: "Dwarf Scroll II",
98: "Dwarf Scroll III",
99: "Dwarf Scroll IV",
100: "Chipped Amphora",
101: "Arrowhead",
103: "Ancient Doll",
104: "Elvish Jewelry",
105: "Chewing Stick",
106: "Ornamental Fan",
107: "Dinosaur Egg",
108: "Rare Disc",
109: "Ancient Sword",
110: "Rusty Spoon",
111: "Rusty Spur",
112: "Rusty Cog",
113: "Chicken Statue",
114: "Ancient Seed",
115: "Prehistoric Tool",
116: "Dried Starfish",
117: "Anchor",
118: "Glass Shards",
119: "Bone Flute",
120: "Prehistoric Handaxe",
121: "Dwarvish Helm",
122: "Dwarf Gadget",
123: "Ancient Drum",
124: "Golden Mask",
125: "Golden Relic",
126: "Strange Doll (Green)",
127: "Strange Doll (Yellow)",
128: "Pufferfish",
129: "Anchovy",
130: "Tuna",
131: "Sardine",
132: "Bream",
136: "Largemouth Bass",
137: "Smallmouth Bass",
138: "Rainbow Trout",
139: "Salmon",
140: "Walleye",
141: "Perch",
142: "Carp",
143: "Catfish",
144: "Pike",
145: "Sunfish",
146: "Red Mullet",
147: "Herring",
148: "Eel",
149: "Octopus",
150: "Red Snapper",
151: "Squid",
152: "Seaweed",
153: "Green Algae",
154: "Sea Cucumber",
155: "Super Cucumber",
156: "Ghostfish",
157: "White Algae",
158: "Stonefish",
159: "Crimsonfish",
160: "Angler",
161: "Ice Pip",
162: "Lava Eel",
163: "Legend",
164: "Sandfish",
165: "Scorpion Carp",
166: "Treasure Chest",
167: "Joja Cola",
168: "Trash",
169: "Driftwood",
170: "Broken Glasses",
171: "Broken CD",
172: "Soggy Newspaper",
174: "Large Egg (White)",
176: "Egg (White)",
178: "Hay",
180: "Egg (Brown)",
182: "Large Egg (Brown)",
184: "Milk",
186: "Large Milk",
188: "Green Bean",
190: "Cauliflower",
192: "Potato",
194: "Fried Egg",
195: "Omelet",
196: "Salad",
197: "Cheese Cauliflower",
198: "Baked Fish",
199: "Parsnip Soup",
200: "Vegetable Medley",
201: "Complete Breakfast",
202: "Fried Calamari",
203: "Strange Bun",
204: "Lucky Lunch",
205: "Fried Mushroom",
206: "Pizza",
207: "Bean Hotpot",
208: "Glazed Yams",
209: "Carp Surprise",
210: "Hashbrowns",
211: "Pancakes",
212: "Salmon Dinner",
213: "Fish Taco",
214: "Crispy Bass",
215: "Pepper Poppers",
216: "Bread",
218: "Tom Kha Soup",
219: "Trout Soup",
220: "Chocolate Cake",
221: "Pink Cake",
222: "Rhubarb Pie",
223: "Cookie",
224: "Spaghetti",
225: "Fried Eel",
226: "Spicy Eel",
227: "Sashimi",
228: "Maki Roll",
229: "Tortilla",
230: "Red Plate",
231: "Eggplant Parmesan",
232: "Rice Pudding",
233: "Ice Cream",
234: "Blueberry Tart",
235: "Autumn's Bounty",
236: "Pumpkin Soup",
237: "Super Meal",
238: "Cranberry Sauce",
239: "Stuffing",
240: "Farmer's Lunch",
241: "Survival Burger",
242: "Dish O' The Sea",
243: "Miner's Treat",
244: "Roots Platter",
245: "Sugar",
246: "Wheat Flour",
247: "Oil",
248: "Garlic",
250: "Kale",
251: "Tea Sapling",
252: "Rhubarb",
253: "Triple Shot Espresso",
254: "Melon",
256: "Tomato",
257: "Morel",
258: "Blueberry",
259: "Fiddlehead Fern",
260: "Hot Pepper",
261: "Warp Totem: Desert",
262: "Wheat",
264: "Radish",
265: "Seafoam Pudding",
266: "Red Cabbage",
267: "Flounder",
268: "Starfruit",
269: "Midnight Carp",
270: "Corn",
271: "Unmilled Rice",
272: "Eggplant",
273: "Rice Shoot",
274: "Artichoke",
275: "Artifact Trove",
276: "Pumpkin",
278: "Bok Choy",
279: "Magic Rock Candy",
280: "Yam",
281: "Chanterelle",
282: "Cranberries",
283: "Holly",
284: "Beet",
286: "Cherry Bomb",
287: "Bomb",
288: "Mega Bomb",
289: "Ostrich Egg",
292: "Mahogany Seed",
293: "Brick Floor",
296: "Salmonberry",
297: "Grass Starter",
298: "Hardwood Fence",
299: "Amaranth Seeds",
300: "Amaranth",
301: "Grape Starter",
302: "Hops Starter",
303: "Pale Ale",
304: "Hops",
305: "Void Egg",
306: "Mayonnaise",
307: "Duck Mayonnaise",
308: "Void Mayonnaise",
309: "Acorn",
310: "Maple Seed",
311: "Pine Cone",
322: "Wood Fence",
323: "Stone Fence",
324: "Iron Fence",
325: "Gate",
328: "Wood Floor",
329: "Stone Floor",
330: "Clay",
331: "Weathered Floor",
333: "Crystal Floor",
334: "Copper Bar",
335: "Iron Bar",
336: "Gold Bar",
337: "Iridium Bar",
338: "Refined Quartz",
340: "Honey",
341: "Tea Set",
342: "Pickles",
344: "Jelly",
346: "Beer",
347: "Rare Seed",
348: "Wine",
349: "Energy Tonic",
350: "Juice",
351: "Muscle Remedy",
368: "Basic Fertilizer",
369: "Quality Fertilizer",
370: "Basic Retaining Soil",
371: "Quality Retaining Soil",
372: "Clam",
373: "Golden Pumpkin",
376: "Poppy",
378: "Copper Ore",
380: "Iron Ore",
382: "Coal",
384: "Gold Ore",
386: "Iridium Ore",
388: "Wood",
390: "Stone",
392: "Nautilus Shell",
393: "Coral",
394: "Rainbow Shell",
395: "Coffee",
396: "Spice Berry",
397: "Sea Urchin",
398: "Grape",
399: "Spring Onion",
400: "Strawberry",
401: "Straw Floor",
402: "Sweet Pea",
403: "Field Snack",
404: "Common Mushroom",
405: "Wood Path",
406: "Wild Plum",
407: "Gravel Path",
408: "Hazelnut",
409: "Crystal Path",
410: "Blackberry",
411: "Cobblestone Path",
412: "Winter Root",
413: "Blue Slime Egg",
414: "Crystal Fruit",
415: "Stepping Stone Path",
416: "Snow Yam",
417: "Sweet Gem Berry",
418: "Crocus",
419: "Vinegar",
420: "Red Mushroom",
421: "Sunflower",
422: "Purple Mushroom",
423: "Rice",
424: "Cheese",
425: "Fairy Seeds",
426: "Goat Cheese",
427: "Tulip Bulb",
428: "Cloth",
429: "Jazz Seeds",
430: "Truffle",
431: "Sunflower Seeds",
432: "Truffle Oil",
433: "Coffee Bean",
436: "Goat Milk",
437: "Red Slime Egg",
438: "L. Goat Milk",
439: "Purple Slime Egg",
440: "Wool",
441: "Explosive Ammo",
442: "Duck Egg",
444: "Duck Feather",
445: "Caviar",
446: "Rabbit's Foot",
447: "Aged Roe",
453: "Poppy Seeds",
454: "Ancient Fruit",
455: "Spangle Seeds",
456: "Algae Soup",
457: "Pale Broth",
459: "Mead",
463: "Drum Block",
464: "Flute Block",
465: "Speed-Gro",
466: "Deluxe Speed-Gro",
472: "Parsnip Seeds",
473: "Bean Starter",
474: "Cauliflower Seeds",
475: "Potato Seeds",
476: "Garlic Seeds",
477: "Kale Seeds",
478: "Rhubarb Seeds",
479: "Melon Seeds",
480: "Tomato Seeds",
481: "Blueberry Seeds",
482: "Pepper Seeds",
483: "Wheat Seeds",
484: "Radish Seeds",
485: "Red Cabbage Seeds",
486: "Starfruit Seeds",
487: "Corn Seeds",
488: "Eggplant Seeds",
489: "Artichoke Seeds",
490: "Pumpkin Seeds",
491: "Bok Choy Seeds",
492: "Yam Seeds",
493: "Cranberry Seeds",
494: "Beet Seeds",
495: "Spring Seeds",
496: "Summer Seeds",
497: "Fall Seeds",
498: "Winter Seeds",
499: "Ancient Seeds",
535: "Geode",
536: "Frozen Geode",
537: "Magma Geode",
538: "Alamite",
539: "Bixite",
540: "Baryte",
541: "Aerinite",
542: "Calcite",
543: "Dolomite",
544: "Esperite",
545: "Fluorapatite",
546: "Geminite",
547: "Helvite",
548: "Jamborite",
549: "Jagoite",
550: "Kyanite",
551: "Lunarite",
552: "Malachite",
553: "Neptunite",
554: "Lemon Stone",
555: "Nekoite",
556: "Orpiment",
557: "Petrified Slime",
558: "Thunder Egg",
559: "Pyrite",
560: "Ocean Stone",
561: "Ghost Crystal",
562: "Tigerseye",
563: "Jasper",
564: "Opal",
565: "Fire Opal",
566: "Celestine",
567: "Marble",
568: "Sandstone",
569: "Granite",
570: "Basalt",
571: "Limestone",
572: "Soapstone",
573: "Hematite",
574: "Mudstone",
575: "Obsidian",
576: "Slate",
577: "Fairy Stone",
578: "Star Shards",
579: "Prehistoric Scapula",
580: "Prehistoric Tibia",
581: "Prehistoric Skull",
582: "Skeletal Hand",
583: "Prehistoric Rib",
584: "Prehistoric Vertebra",
585: "Skeletal Tail",
586: "Nautilus Fossil",
587: "Amphibian Fossil",
588: "Palm Fossil",
589: "Trilobite",
591: "Tulip",
593: "Summer Spangle",
595: "Fairy Rose",
597: "Blue Jazz",
599: "Sprinkler",
604: "Plum Pudding",
605: "Artichoke Dip",
606: "Stir Fry",
607: "Roasted Hazelnuts",
608: "Pumpkin Pie",
609: "Radish Salad",
610: "Fruit Salad",
611: "Blackberry Cobbler",
612: "Cranberry Candy",
613: "Apple",
614: "Green Tea",
618: "Bruschetta",
621: "Quality Sprinkler",
628: "Cherry Sapling",
629: "Apricot Sapling",
630: "Orange Sapling",
631: "Peach Sapling",
632: "Pomegranate Sapling",
633: "Apple Sapling",
634: "Apricot",
635: "Orange",
636: "Peach",
637: "Pomegranate",
638: "Cherry",
645: "Iridium Sprinkler",
648: "Coleslaw",
649: "Fiddlehead Risotto",
651: "Poppyseed Muffin",
680: "Green Slime Egg",
681: "Rain Totem",
682: "Mutant Carp",
684: "Bug Meat",
685: "Bait",
686: "Spinner",
687: "Dressed Spinner",
688: "Warp Totem: Farm",
689: "Warp Totem: Mountains",
690: "Warp Totem: Beach",
691: "Barbed Hook",
692: "Lead Bobber",
693: "Treasure Hunter",
694: "Trap Bobber",
695: "Cork Bobber",
698: "Sturgeon",
699: "Tiger Trout",
700: "Bullhead",
701: "Tilapia",
702: "Chub",
703: "Magnet",
704: "Dorado",
705: "Albacore",
706: "Shad",
707: "Lingcod",
708: "Halibut",
709: "Hardwood",
710: "Crab Pot",
715: "Lobster",
716: "Crayfish",
717: "Crab",
718: "Cockle",
719: "Mussel",
720: "Shrimp",
721: "Snail",
722: "Periwinkle",
723: "Oyster",
724: "Maple Syrup",
725: "Oak Resin",
726: "Pine Tar",
727: "Chowder",
728: "Fish Stew",
729: "Escargot",
730: "Lobster Bisque",
731: "Maple Bar",
732: "Crab Cakes",
733: "Shrimp Cocktail",
734: "Woodskip",
745: "Strawberry Seeds",
746: "Jack-O-Lantern",
747: "Rotten Plant",
748: "Rotten Plant",
749: "Omni Geode",
766: "Slime",
767: "Bat Wing",
768: "Solar Essence",
769: "Void Essence",
770: "Mixed Seeds",
771: "Fiber",
772: "Oil of Garlic",
773: "Life Elixir",
774: "Wild Bait",
775: "Glacierfish",
787: "Battery Pack",
795: "Void Salmon",
796: "Slimejack",
797: "Pearl",
798: "Midnight Squid",
799: "Spook Fish",
800: "Blobfish",
802: "Cactus Seeds",
805: "Tree Fertilizer",
807: "Dinosaur Mayonnaise",
812: "Roe",
814: "Squid Ink",
815: "Tea Leaves",
820: "Fossilized Skull",
821: "Fossilized Spine",
822: "Fossilized Tail",
823: "Fossilized Leg",
824: "Fossilized Ribs",
825: "Snake Skull",
826: "Snake Vertebrae",
827: "Mummified Bat",
828: "Mummified Frog",
829: "Ginger",
830: "Taro Root",
831: "Taro Tuber",
832: "Pineapple",
833: "Pineapple Seeds",
834: "Mango",
835: "Mango Sapling",
836: "Stingray",
837: "Lionfish",
838: "Blue Discus",
840: "Rustic Plank Floor",
841: "Stone Walkway Floor",
848: "Cinder Shard",
851: "Magma Cap",
852: "Dragon Tooth",
856: "Curiosity Lure",
857: "Tiger Slime Egg",
872: "Fairy Dust",
873: "Piña Colada",
874: "Bug Steak",
877: "Quality Bobber",
879: "Monster Musk",
881: "Bone Fragment",
885: "Fiber Seeds",
886: "Warp Totem: Island",
889: "Qi Fruit",
890: "Qi Bean",
891: "Mushroom Tree Seed",
892: "Warp Totem: Qi's Arena",
893: "Fireworks (Red)",
894: "Fireworks (Purple)",
895: "Fireworks (Green)",
896: "Galaxy Soul",
898: "Son of Crimsonfish",
899: "Ms. Angler",
900: "Legend II",
901: "Radioactive Carp",
902: "Glacierfish Jr.",
903: "Ginger Ale",
904: "Banana Pudding",
905: "Mango Sticky Rice",
906: "Poi",
907: "Tropical Curry",
908: "Magic Bait",
909: "Radioactive Ore",
910: "Radioactive Bar",
911: "Horse Flute",
913: "Enricher",
915: "Pressure Nozzle",
917: "Qi Seasoning",
918: "Hyper Speed-Gro",
919: "Deluxe Fertilizer",
920: "Deluxe Retaining Soil",
921: "Squid Ink Ravioli",
926: "Cookout Kit",
928: "Golden Egg",
}
// Date originally used XXForSaveGame elements, but those were not always present on saves downloaded from upload.farm
output += '<span class="result">Day ' + Number($(xmlDoc).find('dayOfMonth').text()) + ' of ' +
capitalize($(xmlDoc).find('currentSeason').html()) + ', Year ' + Number($(xmlDoc).find('year').text()) + '</span><br />';
output += '<span class="result">Played for ';
if (playHr === 0 && playMin === 0) {
output += "less than 1 minute";
} else {
if (playHr > 0) {
output += playHr + ' hr ';
}
if (playMin > 0) {
output += playMin + ' min ';
}
}
output += '</span><br />';
var version_num = saveInfo.version;
output += '<span class="result">Save is from version ' + version_num + '</span><br /></div>';
output = getSectionWrapper(saveInfo, title, anchor, false, version).append(output);
return output;
}
function parseMoney(xmlDoc, saveInfo) {
var title = 'Money',
anchor = makeAnchor(title),
version = "1.2",
sum_class = getSummaryClass(saveInfo, version),
det_class = getDetailsClass(saveInfo, version),
output = '',
playerOutput = '',
meta = { "hasDetails": false, "anchor": anchor, "sum_class": sum_class, "det_class": det_class },
table = [];
// This is pretty pointless with shared gold, but I separate everything else for multiplayer...
table[0] = parsePlayerMoney($(xmlDoc).find('SaveGame > player'), saveInfo, meta);
if (saveInfo.numPlayers > 1) {
$(xmlDoc).find('farmhand').each(function () {
if (isValidFarmhand(this)) {
table.push(parsePlayerMoney(this, saveInfo, meta));
}
});
}
playerOutput += printTranspose(table);
output = getSectionWrapper(saveInfo, title, anchor, meta.hasDetails, version).append(playerOutput);
return output;
}
function parsePlayerMoney(player, saveInfo, meta) {
var output = '',
money = Number($(player).children('totalMoneyEarned').text());
output += '<div class="' + meta.anchor + '_summary ' + meta.sum_class + '">';
output += '<span class="result">' + $(player).children('name').html() + ' has earned ' +
addCommas(money) + 'g.</span><br />\n';
output += '<ul class="ach_list"><li>';
output += (money >= 15e3) ? getAchieveString('Greenhorn', 'earn 15,000g', 1) :
getAchieveString('Greenhorn', 'earn 15,000g', 0) + addCommas(15e3 - money) + 'g more';
output += '</li>\n<li>';
output += (money >= 5e4) ? getAchieveString('Cowpoke', 'earn 50,000g', 1) :
getAchieveString('Cowpoke', 'earn 50,000g', 0) + addCommas(5e4 - money) + 'g more';
output += '</li>\n<li>';
output += (money >= 25e4) ? getAchieveString('Homesteader', 'earn 250,000g', 1) :
getAchieveString('Homesteader', 'earn 250,000g', 0) + addCommas(25e4 - money) + 'g more';
output += '</li>\n<li>';
output += (money >= 1e6) ? getAchieveString('Millionaire', 'earn 1,000,000g', 1) :
getAchieveString('Millionaire', 'earn 1,000,000g', 0) + addCommas(1e6 - money) + 'g more';
output += '</li>\n<li>';
output += (money >= 1e7) ? getAchieveString('Legend', 'earn 10,000,000g', 1) :
getAchieveString('Legend', 'earn 10,000,000g', 0) + addCommas(1e7 - money) + 'g more';
output += '</li></ul></div>';
return [output];
}
function parseSocial(xmlDoc, saveInfo) {
var title = 'Social',
anchor = makeAnchor(title),
version = "1.2",
sum_class = getSummaryClass(saveInfo, version),
det_class = getDetailsClass(saveInfo, version),
output = '',
playerOutput = '',
meta = { "hasDetails": false, "anchor": anchor, "sum_class": sum_class, "det_class": det_class },
table = [],
spouse = $(xmlDoc).find('player > spouse').text(); // only used for 1.2 engagement checking
meta.countdown = Number($(xmlDoc).find('countdownToWedding').text());
meta.daysPlayed = Number($(xmlDoc).find('stats > daysPlayed').first().text());
// NPCs and NPC Types we are ignoring either in location data or friendship data
meta.ignore = {
'Horse': 1,
'Cat': 1,
'Dog': 1,
'Fly': 1,
'Grub': 1,
'GreenSlime': 1,
'Gunther': 1,
'Marlon': 1,
'Bouncer': 1,
'Mister Qi': 1,
'Henchman': 1,
'Birdie': 1,
};
meta.npc = {};
// <NPC>: [ [<numHearts>, <id>], ... ]
meta.eventList = {
'Abigail': [ [2, 1], [4, 2], [6, 4], [8, 3], [10, 901756] ],
'Alex': [ [2, 20], [4, 2481135], [5, 21], [6, 2119820], [8, 288847], [10, 911526] ],