Skip to content

Commit 967c0c3

Browse files
committed
Prepare for 0.7 release - "the boilerplate update"
- Removed dev.devMode stuff, will probably be replaced by #44
1 parent d9f47ef commit 967c0c3

5 files changed

Lines changed: 11 additions & 69 deletions

File tree

public/index.html

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,6 @@ <h5 class="middle-subtitle">Miscellaneous:</h5>
127127
<button id="addModButton" class="data-button pointer" style="margin-top:3px;">Add Mod</button>
128128
<button id="listModsButton" class="data-button pointer" style="margin-top:3px; margin-left:0px;">List Mods</button>
129129
</div>
130-
<form class="no-display" id="devForm">
131-
<label for="devModeSelect" class="middle-label">Developer Mode: </label>
132-
<select class="pointer" id="devModeSelect">
133-
<option value="off" id="offSelectionDev">Off</option>
134-
<option value="on">On</option>
135-
</select>
136-
</form>
137130
</div>
138131
<div class="tooltip absolute no-display" id="tooltip">
139132
<div class="tooltip-content">

src/ts/changelogs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export const versionChangelogs: Changelog[] = [
233233
type: "minor",
234234
version: "0.7",
235235
note: "Hi. It's hard to explain in a simple changelog how much this update has done. See everything you're looking at? I can confidently say that what is happening behind the scenes for what you're looking at has changed drastically.",
236-
name: "tbd",
236+
name: "the boilerplate update",
237237
added: [
238238
"\"Cookies Per Click\" statistic.",
239239
"A button in Options to toggle auto-saving (#29)",

src/ts/clickercookie.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ export default class ClickerCookie extends Mod<ClickerCookieSaveData> {
579579
// ------------ All of ClickerCookie's SaveProvider stuff ------------
580580
getSaveData(): ClickerCookieSaveData {
581581
return {
582-
version: 0, // todo: this will be 1 when full release
582+
version: 1,
583583
cookies: this.cookies,
584584
totalCookies: this.totalCookies,
585585
cookiesPerClick: this.cookiesPerClick,

src/ts/main.ts

Lines changed: 8 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,6 @@ import { BuildingSave } from "./buildings.js";
1818

1919
import { NewMod } from "./exmod.js"; //* note: this import is intentionally left unused so tsc can find this file and compile it
2020

21-
// ------------------------------------
22-
// Version Constants
23-
// ------------------------------------
24-
const version: string = "0.7";
25-
26-
// temp dev variables
27-
const dev = {} as {
28-
devMode: boolean,
29-
30-
setDevMode(value: boolean | "on" | "off"): void
31-
};
32-
33-
dev.devMode = false;
34-
3521
// Global Events
3622
interface MousePosition {
3723
x: number;
@@ -41,7 +27,7 @@ const mousePos: MousePosition = {x: undefined, y: undefined};
4127
window.addEventListener("mousemove", (event) => {
4228
mousePos.x = event.clientX;
4329
mousePos.y = event.clientY;
44-
30+
4531
if (Game.IN_DEVELOPMENT && document.getElementById("mousePosDevText")) // in case dev text doesn't exist for some reason idk
4632
document.getElementById("mousePosDevText").innerText = `Mouse Pos: (${mousePos.x}, ${mousePos.y})`;
4733
});
@@ -65,6 +51,7 @@ export enum VersionBranch {
6551
type MiddleState = "none" | "stats" | "info" | "options";
6652

6753
export interface GameSaveData {
54+
version: number;
6855
cheated: boolean;
6956
modded: boolean;
7057
autoSavingAllowed: boolean;
@@ -78,8 +65,8 @@ export interface GameSaveData {
7865
}
7966

8067
export class Game implements SaveProvider<GameSaveData> {
81-
// Important game-wide constants
82-
public static readonly VERSION: string = version;
68+
// --- Important game-wide constants ---
69+
public static readonly VERSION: string = "0.7";
8370
public static readonly VERSION_BRANCH: VersionBranch = (location.pathname == "/develop/index.html" || location.pathname == "/develop") ? 2 : (location.pathname == "/beta/index.html" || location.pathname == "/beta") ? 1 : 0;
8471
public static readonly IN_DEVELOPMENT: boolean = (location.hostname === "localhost" || location.hostname === "127.0.0.1") ? true : false; // automatically toggles if hosted locally
8572
public static readonly GITHUB_REPO: string = "https://github.com/clickercookie/clickercookie.github.io";
@@ -188,7 +175,7 @@ export class Game implements SaveProvider<GameSaveData> {
188175
/* check for old saves (typically directly interacts with localStorage because using Savinator.getLocalStorageSave() will make it angry since localStorage doesn't have a Save it has some other data) */
189176
// wow that's old
190177
if (localStorage.cookies >= 0)
191-
new SimplePopup({x: 400, y: 200, text: "You are using an extremely outdated saving method. You will have issues with saving now that the new one is implimented. Clicking below will reset your save to the new format. Your old save cannot be restored.", func: () => { localStorage.clear() }, title: "Warning"});
178+
new SimplePopup({x: 400, y: 200, text: "You are using an extremely outdated saving method. You will have issues with saving now that the new one is implemented. Clicking below will reset your save to the new format. Your old save cannot be restored.", func: () => { localStorage.clear() }, title: "Warning"});
192179

193180
// 0.5 save
194181
if (localStorage.getItem(this.savinator5000.currentSaveName) && localStorage.getItem(this.savinator5000.currentSaveName)[0] === "[" && Game.VERSION_BRANCH === VersionBranch.MAIN) {
@@ -198,8 +185,6 @@ export class Game implements SaveProvider<GameSaveData> {
198185
}
199186

200187
// 0.6 save
201-
// todo: needs to be thoroughly playtested
202-
// todo: do these need to be nested or was this just 11:00 programming moment and i wasn't thinking
203188
const parsedCurrentSave = JSON.parse(localStorage.getItem(this.savinator5000.currentSaveName));
204189
if (typeof parsedCurrentSave === "object" && parsedCurrentSave !== null) {
205190
if (parsedCurrentSave["core.cookies"]) {
@@ -218,7 +203,6 @@ export class Game implements SaveProvider<GameSaveData> {
218203
}
219204
}
220205

221-
// todo before 0.7: does betaSave work here? it looks like it does but i need to thoroughly test it
222206
if (this.savinator5000.getLocalStorageSave() === null) {
223207
this.savinator5000.save();
224208
console.warn(`${this.savinator5000.currentSaveName} was null and was automatically reset, if this is your first time playing this is an intended behavior.`);
@@ -267,9 +251,6 @@ export class Game implements SaveProvider<GameSaveData> {
267251
devDiv.appendChild(mousePos);
268252

269253
document.getElementById("leftSide").insertBefore(devDiv, document.getElementById("leftSidePush"));
270-
271-
dev.setDevMode(true);
272-
document.getElementById("offSelectionDev").innerText = "Overwritten";
273254
}
274255

275256
// ------- Event Listeners (very long) -------
@@ -293,7 +274,6 @@ export class Game implements SaveProvider<GameSaveData> {
293274
document.getElementById("autoSavingToggleSelect").addEventListener("change", () => {this.autoSavingAllowed = ((document.getElementById("autoSavingToggleSelect") as HTMLFormElement).value === "on") ? true : false});;
294275
document.getElementById("addModButton").addEventListener("click", () => {ModHandler.addButtonClicked()});
295276
document.getElementById("listModsButton").addEventListener("click", () => {ModHandler.listButtonClicked()});
296-
document.getElementById("devModeSelect").addEventListener("change", () => {dev.setDevMode((document.getElementById("devModeSelect") as HTMLFormElement).value)})
297277
// upgrades holder
298278
document.getElementById("upgradesHolder").addEventListener("mouseover", () => {expandUpgradesHolder()});
299279
document.getElementById("upgradesHolder").addEventListener("mouseout", () => {expandUpgradesHolder(true)});
@@ -369,6 +349,7 @@ export class Game implements SaveProvider<GameSaveData> {
369349
const originalBuildingSave = (this.savinator5000.getLocalStorageSave()) ? (this.savinator5000.getLocalStorageSave().getData("game") as GameSaveData).buildingsSave : {};
370350

371351
return {
352+
version: 1,
372353
cheated: this.cheated,
373354
modded: this.modded,
374355
autoSavingAllowed: this.autoSavingAllowed,
@@ -408,28 +389,7 @@ export class Game implements SaveProvider<GameSaveData> {
408389
}
409390
}
410391

411-
// dev commands
412-
/**
413-
* Sets the developer mode status
414-
* @param value Can either be 1 or "on" to set to True | 0 or "off" to set to False. The "on" and "off" options are there because of the "devForm" submission
415-
*/
416-
dev.setDevMode = function(value: boolean | "on" | "off") {
417-
if (value === "on")
418-
dev.devMode = true;
419-
else if (value === "off")
420-
dev.devMode = false;
421-
else
422-
dev.devMode = value;
423-
424-
if (dev.devMode === true) {
425-
console.log("Developer Mode activated.");
426-
(document.getElementById("devModeSelect") as HTMLSelectElement).disabled = true;
427-
}
428-
}
429-
430-
// ------------------------------------
431392
// Random Functions
432-
// ------------------------------------
433393
function versionNumberMousedOver(undo=false) {
434394
if (!undo)
435395
document.getElementById("versionSwitchInfo").style.display = "block";
@@ -442,16 +402,12 @@ console.log(`you seem smart, how 'bout you contribute to the project? ${Game.GIT
442402
Handlers.SAVE.register("game", Game.getInstance());
443403
Handlers.MOD.register(Game.getInstance().clickercookie.NAMESPACE, Game.getInstance().clickercookie);
444404

445-
// todo: load saved mods here
405+
// todo: load saved mods here, see #67
446406

447407
Game.getInstance().init();
448408

449-
console.log("game:", Game.getInstance());
450-
console.log("mod handler:", Handlers.MOD);
451-
console.log("handlers:", Handlers);
452-
409+
// this is kind of a "dev" thing but is an obscure enough piece of very useful functionality that it should be in release
453410
declare global {
454411
interface Window { handlers: any; }
455412
}
456-
457413
window.handlers = Handlers;

src/ts/saving.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export class Savinator {
5757
if (save === undefined) {
5858
const newSave = new Save();
5959
const saveDump = this.saveHandler.dumpSaveData();
60-
if (this.preserveUnusedNamespacesInSaves && this.getLocalStorageSave() !== null) { // todo: too many localStorageSave.getNamespaces()
60+
if (this.preserveUnusedNamespacesInSaves && this.getLocalStorageSave() !== null) {
6161
const localStorageSave = this.getLocalStorageSave();
6262
for (const namespace of localStorageSave.getNamespaces()) {
6363
if (!(namespace in saveDump)) {
@@ -246,20 +246,13 @@ export class Save {
246246
}
247247
}
248248

249-
/*
250-
example 0.6 save:
251-
{"core.cookies":247199.30000003485,"core.totalCookies":251800.30000003646,"core.cookiesPerSecond":29.2,"keyboard.CPSGiven":0.2,"grandpa.CPSGiven":5,"ranch.CPSGiven":24,"television.CPSGiven":0,"worker.CPSGiven":0,"wallet.CPSGiven":0,"church.CPSGiven":0,"keyboard.bought":1,"grandpa.bought":5,"ranch.bought":3,"television.bought":0,"worker.bought":0,"wallet.bought":0,"church.bought":0,"keyboard.CPSGain":0.2,"grandpa.CPSGain":1,"ranch.CPSGain":8,"television.CPSGain":47,"worker.CPSGain":260,"wallet.CPSGain":1440,"church.CPSGain":7800,"keyboard.upgradeCost":17,"grandpa.upgradeCost":197,"ranch.upgradeCost":1672,"television.upgradeCost":12000,"worker.upgradeCost":130000,"wallet.upgradeCost":1400000,"church.upgradeCost":20000000,"upgrades.unlocked":[1,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"upgrades.bought":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"upgrades.upgradesBought":1,"core.cookiesPerClick":2,"core.cookieBeenClickedTimes":30,"core.buildingsOwned":9,"hasCheated":false,"won":0,"isModded":false,"versionBranch":0}
252-
*/
253-
254249
/**
255250
* Takes in a given 0.6 save and manually applies its data, then does a normal save and refreshes the page.
256251
* @param save The direct local storage key, i.e a stringified object
257252
*/
258253
export function convert06Save(save: string) {
259254
const parsedSave: Record<string, any> = JSON.parse(save);
260255

261-
// todo: should we do versionbranch shenanigans?
262-
263256
const game = Game.getInstance();
264257

265258
game.clickercookie.cookies = parsedSave["core.cookies"];

0 commit comments

Comments
 (0)