Skip to content

Commit 309cb77

Browse files
committed
idk
0 parents  commit 309cb77

24 files changed

Lines changed: 2314 additions & 0 deletions

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Robert Zhao
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SSTimer
2+
3+
Helps you track champion's summoner spells. :D
4+
5+
Low memory (compared to porofessor) usage. ~100mb of RAM needed. And 260 mb disk size.
6+
7+
# Status
8+
9+
🟢 - Done! - Bugfixes will still happen!
10+
11+
# Installation
12+
13+
1. Download from releases (latest)
14+
2. Unzip the folder
15+
3. Run the application called ```SSTimerV2```
16+
17+
# Usage
18+
19+
```Right Click``` to change spells
20+
21+
```Left Click``` to start the timer
22+
23+
Use the move tool to move the application around your screen.
24+
25+
Open settings menu and change any of the settings inside there. (Settings will save!)
26+
27+
Use the trash tool to clear everything
28+
29+
Use the exit tool to exit the application
30+
31+
There is an auto-match finder you can disable in settings.
32+
33+
34+
# Run into any issues?
35+
36+
Go to the issues tab on github and create an issue with the bug name as the title and description describing the bug and how to replicate it.
37+
38+
# Changelog
39+
40+
```5/24/24 - v1.0.0 - RELEASE```
41+
42+
```5/24/24 - v1.1.0 - FEATURES (Added exit, and update checker)```
43+
44+
```5/25/24 - v1.1.1 - BUGFIX (Application Minimize after Fullscreen)```
45+
46+
```5/26/24 - v1.1.2 - BUGFIX + FEATURE (Fixed height because it was blocking the minimap, Fixed height and width for spell selector, Added a trash tool to clear all items```
47+
48+
```8/11/24 - v2.0.0 - NEW VERSION, NEW FEATURES!```
49+
- Auto match detect
50+
- Lowered amount of screen usage
51+
- A ton more!
52+
53+
```8/12/24 - v2.0.1 - BUGFIX (If you spawned top side, the app will fill in you and your teammates' spells rather than the enemies lol)```
54+
```10-5-24 - v2.0.3 - BUGFIX + FEATURE (Fixed top/bot side glitch and fixed the unleashed teleport bug. Added mac support)```

main.js

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
const path = require('path')
2+
const fs = require('fs');
3+
const {app, ipcMain, BrowserWindow, Menu} = require('electron/main');
4+
5+
var matchDetect;
6+
7+
8+
const isMac = process.platform === "darwin";
9+
// Default 270x360
10+
const mainWidth = 700;
11+
const mainHeight = 360;
12+
13+
var data = {
14+
"zoomLevel": 1,
15+
"matchDetect": true,
16+
"message:flashBorder": false,
17+
"message:fillMatchData": false,
18+
"message:matchDetect": "none",
19+
"message:saveSettings": "none",
20+
};
21+
22+
var settingsWindow;
23+
24+
app.commandLine.appendSwitch("ignore-certificate-errors")
25+
26+
// Main Window
27+
function createMainWindow(width, height, dev) {
28+
const mainWindow = new BrowserWindow({
29+
title: "SSTimer (v2)",
30+
//Normal is 270x460
31+
width: width,
32+
height: height,
33+
resizable: false,
34+
frame: dev,
35+
transparent: !dev,
36+
webPreferences: {
37+
nodeIntegration: true,
38+
contextIsolation: true,
39+
devTools: dev,
40+
preload: path.join(__dirname, "./preload.js")
41+
}
42+
});
43+
mainWindow.setFocusable(true);
44+
mainWindow.setVisibleOnAllWorkspaces(true, {visibleOnFullScreen: true});
45+
mainWindow.setAlwaysOnTop(true, 'screen-saver', 1);
46+
mainWindow.loadFile(path.join(__dirname, './renderer/main/index.html'));
47+
setInterval(async () => {
48+
// Send data from main to the main window
49+
mainWindow.webContents.send("message", data);
50+
//console.log("Sending packet of data to main window...")
51+
}, 100)
52+
mainWindow.webContents.openDevTools()
53+
mainWindow.on("closed", () => {
54+
app.quit();
55+
})
56+
}
57+
58+
// Settings Window
59+
function createSettingsWindow(width, height, dev) {
60+
// Creating window next to main window
61+
sel_win = BrowserWindow.getFocusedWindow();
62+
sel_win_pos = sel_win.getPosition();
63+
settingsWindow = new BrowserWindow({
64+
title: "SSTimer (v2) Settings",
65+
//Normal is 270x400
66+
width: width,
67+
height: height,
68+
x: sel_win_pos[0] - 500,
69+
y: sel_win_pos[1],
70+
resizable: false,
71+
frame: true,
72+
transparent: false,
73+
webPreferences: {
74+
nodeIntegration: true,
75+
contextIsolation: true,
76+
devTools: dev,
77+
preload: path.join(__dirname, "./preload.js")
78+
}
79+
})
80+
settingsWindow.setFocusable(true);
81+
settingsWindow.focus();
82+
settingsWindow.setVisibleOnAllWorkspaces(true, {visibleOnFullScreen: true});
83+
settingsWindow.setAlwaysOnTop(true, 'screen-saver', 1);
84+
settingsWindow.loadFile(path.join(__dirname, './renderer/settings/settings.html'));
85+
settingsdatatransfer = setInterval(async () => {
86+
// Send data from main to the settings window
87+
settingsWindow.webContents.send("message", data);
88+
//console.log("Sending packet of data to main window...")
89+
}, 1000)
90+
settingsWindow.on("closed", () => {
91+
clearInterval(settingsdatatransfer)
92+
})
93+
return settingsWindow
94+
}
95+
96+
// Load settings function
97+
function loadSettings() {
98+
console.log("Attempting to load settings file!")
99+
if(fs.existsSync("./settings.json")) {
100+
console.log("Data file exists.. overwriting default settings.")
101+
try {
102+
data = JSON.parse(fs.readFileSync("./settings.json"))
103+
} catch(err) {
104+
console.log("Error has occursed while reading file: ")
105+
console.error(err);
106+
return "errReadingFile"
107+
}
108+
} else {
109+
console.log("File doesn't exist, creating data file...")
110+
try {
111+
fs.writeFileSync("./settings.json", JSON.stringify(data))
112+
} catch(err) {
113+
console.log("Error while creating settings: ")
114+
console.error(err)
115+
return "errorCreatingSettings";
116+
}
117+
}
118+
return "success"
119+
}
120+
121+
var saveSettingsFlag = false;
122+
function saveSettings() {
123+
if(saveSettingsFlag) {
124+
return;
125+
}
126+
saveSettingsFlag = true;
127+
console.log("Attempting to save settings...");
128+
try {
129+
fs.writeFileSync("./settings.json", JSON.stringify(data));
130+
data['message:saveSettings'] = "success";
131+
console.log("Saved settings successfully!")
132+
setTimeout(async () => {
133+
saveSettingsFlag = false;
134+
data['message:saveSettings'] = "none";
135+
}, 100)
136+
} catch(err) {
137+
console.log("Error while saving settings: ")
138+
console.error(err)
139+
data['message:saveSettings'] = "error";
140+
setTimeout(async () => {
141+
saveSettingsFlag = false;
142+
data['message:saveSettings'] = "none";
143+
}, 100)
144+
}
145+
}
146+
147+
// When ready, create the window
148+
app.whenReady().then(() => {
149+
// Load the settings
150+
loadSettings();
151+
// Fix message settings (in case user saved during a message)
152+
data['message:fillMatchData'] = false;
153+
data['message:flashBorder'] = false;
154+
data['message:matchDetect'] = "none";
155+
data['message:saveSettings'] = "none";
156+
// Create the main window (where the summoner spells will be)
157+
createMainWindow(mainWidth, mainHeight, true);
158+
159+
// Remove ugly menu for windows
160+
Menu.setApplicationMenu(null);
161+
162+
163+
// Close application on ipc
164+
ipcMain.handle("exitApp", () => {
165+
app.quit();
166+
});
167+
168+
// Create settings window
169+
ipcMain.handle("settingsWindow", () => {
170+
if(BrowserWindow.getAllWindows().length < 2) {
171+
createSettingsWindow(500, 500, false);
172+
console.log("Created a settings window!")
173+
} else {
174+
console.warn("User attempted to create another settings window but a settings window is already open.");
175+
console.log("Going to focus the settings window for the user!");
176+
if(settingsWindow.isMinimized()) {
177+
console.log("-_- user minimized the window. can't do anything about that")
178+
}
179+
settingsWindow.focus();
180+
}
181+
182+
});
183+
184+
// Flashing main border
185+
ipcMain.on("flashMainWindowBorder", () => {
186+
console.log("Flashing the main window's border")
187+
data['message:flashBorder'] = true;
188+
setTimeout(() => {
189+
data['message:flashBorder'] = false;
190+
}, 100)
191+
});
192+
193+
// Zooming in and out
194+
ipcMain.on("zoomIn", () => {
195+
console.log("Zooming in main window")
196+
data.zoomLevel = data.zoomLevel + 0.05;
197+
})
198+
ipcMain.on("zoomOut", () => {
199+
console.log("Zooming out main window")
200+
data.zoomLevel = data.zoomLevel - 0.05;
201+
})
202+
203+
// Match detector
204+
ipcMain.on("matchDetect", (event, enable) => {
205+
console.log("Changing match detect to: " + enable)
206+
setTimeout(() => {
207+
data['message:matchDetect'] = "none";
208+
}, 100)
209+
if(enable == "true") {
210+
data['message:matchDetect'] = "on";
211+
} else if(enable == "false") {
212+
data['message:matchDetect'] = "off";
213+
}
214+
data.matchDetect = enable == "true"
215+
})
216+
217+
// Match data fill in manual
218+
ipcMain.on("fillMatchData", () => {
219+
console.log("Sending a request to fill in match data!");
220+
data['message:fillMatchData'] = true;
221+
setTimeout(() => {
222+
data['message:fillMatchData'] = false;
223+
}, 100)
224+
})
225+
226+
// Save setting data
227+
ipcMain.on("saveData", () => {
228+
saveSettings();
229+
})
230+
231+
//create just in case :)
232+
app.on('activate', () => {
233+
if (BrowserWindow.getAllWindows().length === 0) {
234+
createMainWindow(270, 460, false);
235+
}
236+
});
237+
238+
//Check for mac
239+
app.on('window-all-closed', () => {
240+
if (!isMac) {
241+
app.quit();
242+
}
243+
});
244+
});

0 commit comments

Comments
 (0)