Skip to content

Commit

Permalink
finished first version, commented out unessecary logs
Browse files Browse the repository at this point in the history
  • Loading branch information
josef-stips committed Feb 7, 2024
1 parent 6b7fec8 commit 9f7b775
Show file tree
Hide file tree
Showing 19 changed files with 94 additions and 112 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ const createWindow = () => {
height: 800,
fullscreen: true,
// icon: "/src/script/public/assets/images/icons/win/icon.ico",
autoHideMenuBar: false,
autoHideMenuBar: true,
nodeIntegration: true,
contextIsolation: true,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
devTools: true,
devTools: false,
},
});

Expand All @@ -26,10 +26,10 @@ const createWindow = () => {
// load content
mainWindow.loadFile(path.join(__dirname, 'script/public/index.html'));
// Open the DevTools.
mainWindow.webContents.openDevTools();
// mainWindow.webContents.openDevTools();
};

// Menu.setApplicationMenu(null);
Menu.setApplicationMenu(null);

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
Expand Down
4 changes: 2 additions & 2 deletions src/script/public/App/features/Achievements.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Achievements {

AchievementLockState = () => {
let storage = localStorage.getItem("AchievementLockState");
console.log(storage);
// console.log(storage);
if (!storage) {
localStorage.setItem("AchievementLockState", JSON.stringify(this.unlocked));

Expand Down Expand Up @@ -239,7 +239,7 @@ class Achievements {
new = (index) => {
// Get all achievements which are not unlocked
let requirements = Object.keys(this.unlocked).filter(idx => this.unlocked[idx] !== true).map(Number);
console.log(requirements);
// console.log(requirements);

// this achievement is already done
if (!requirements.includes(index)) return;
Expand Down
28 changes: 12 additions & 16 deletions src/script/public/App/features/AdvantureMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,58 +12,58 @@ let mapLevels = {
], 3, InnerGameModes[1], false, {},
40
], // level 1 is unlocked by default
2: [true, 10, "extinct happiness", 30, 20, "fa-solid fa-skull", ["dia2", "vert"],
2: [false, 10, "extinct happiness", 30, 20, "fa-solid fa-skull", ["dia2", "vert"],
["Congrats on winning the first level in this deadly journey. But this is still only the beginning... The unknown is going to show his face soon but for now you must remember to stay focused!",
"To conquer this level you have to score 5 points against the unknown. The unknown can beat you in less moves. As you know, in some rare cases your win combination will be not accepted and you don't get the point!"
], 5, InnerGameModes[3], false, { 'keys': 10 },
40
],
3: [true, 15, "villain steps", 35, 25, "fa-solid fa-skull", ["diamond", "branch1"],
3: [false, 15, "villain steps", 35, 25, "fa-solid fa-skull", ["diamond", "branch1"],
["Some thoughts on becoming a Discord mod?", "Do not let your focus wander through the fog of the darkness", "With every level it gets more serious now. Keep your eyes open and your mouth closed!",
"The winning patterns that require five moves yield 3 more points than regular ones.",
"To conquer this level you have to score 7 points against the unknown. The unknown can beat you in less moves. In rare cases your win combination will be not accepted and you don't get the point!"
], 7, InnerGameModes[1], false, { 'keys': 15, 'ores': 400, 'minerals': 200 },
30
],
4: [true, 20, "traces of the eye", 55, 25, "fa-solid fa-skull", ["diamond"],
4: [false, 20, "traces of the eye", 55, 25, "fa-solid fa-skull", ["diamond"],
["The first three levels where too boring huh?",
"You entered the really dangerous side of this journey now. Will you survive?",
"To conquer this level you have to score 5 points against the unknown and defeat Oculum Solis. The unknown can beat you in less moves. In rare cases your win combination will be not accepted and you don't get the point!"
], 5, InnerGameModes[2], true, { 'keys': 20, 'ores': 1000, 'minerals': 400 },
60
],
5: [true, 35, "bloodbath", 55, 25, "fa-solid fa-skull", ["hor", "vert", "dia"],
5: [false, 35, "bloodbath", 55, 25, "fa-solid fa-skull", ["hor", "vert", "dia"],
["Are you winning servant?", "Congrats on winning the previous boss fight.", "Are you struggling? You have survived half of the journey. You can see the blood of the previous players who tried this level. ",
"To conquer this level you have to score 7 points against the unknown. The unknown can beat you in less moves. In rare cases your win combination will be not accepted and you don't get the point!"
], 7, InnerGameModes[3], false, { 'keys': 35, 'ores': 1200, 'minerals': 400, 'diamonds': 4 },
55
],
6: [true, 30, "wide forest", 65, 25, "fa-solid fa-skull", ["L1", "L2"],
6: [false, 30, "wide forest", 65, 25, "fa-solid fa-skull", ["L1", "L2"],
["What is wider?", "The forest or the field of skeletons of the previous player you're going to play on now?",
"Most of the players here have already given up or lost their way. Do you really want to continue or give up?", "btw. are you a discord mod?", "Anyway...",
"To conquer this level you have to score 7 points against the unknown. The unknown can beat you in less moves. In rare cases your win combination will be not accepted and you don't get the point!"
], 7, InnerGameModes[1], false, { 'keys': 30, 'ores': 2400, 'asteroids': 1, 'diamonds': 40 },
30
],
7: [true, 40, "silent cave", 75, 30, "fa-solid fa-skull", ["branch4", "star"],
7: [false, 40, "silent cave", 75, 30, "fa-solid fa-skull", ["branch4", "star"],
["I hear steps behind me!", "Or just my fart", "...", "The playing field has become larger. More room for your frustration to spread.",
"To conquer this level you have to score 9 points against the unknown. The unknown can beat you in less moves. In rare cases your win combination will be not accepted and you don't get the point."
], 9, InnerGameModes[1], false, { 'keys': 40, 'ores': 3500, 'asteroids': 1, 'minerals': 4000 },
50
],
8: [true, 45, "unknown dungeon", 85, 30, "fa-solid fa-skull", ["branch2", "hor"],
8: [false, 45, "unknown dungeon", 85, 30, "fa-solid fa-skull", ["branch2", "hor"],
["Arrg", "Only the top players reached this level. Congratulations! But don't be too optimistic..",
"To conquer this level you have to score 7 points against the unknown. The unknown can beat you in less moves. In rare cases your win combination will be not accepted and will not get the point."
], 7, InnerGameModes[2], false, { 'keys': 45, 'ores': 4000, 'asteroids': 2, 'encrypted writings': 4 },
45
],
9: [true, 50, "Last step before death", 90, 30, "fa-solid fa-skull", ["W2", "star"],
9: [false, 50, "Last step before death", 90, 30, "fa-solid fa-skull", ["W2", "star"],
["hihihi... ", "This is the last step before you are never seen again. No one knows if you can do that.",
"To conquer this level you have to score 21 points against the unknown and defeat Solara Zephyra. The unknown can beat you in less moves. In rare cases your win combination will be not accepted and you don't get the point!"
], 21, InnerGameModes[1], true, { 'keys': 50, 'asteroids': 3, 'encrypted writings': 5 },
110
],
10: [true, 55, "The eye", 100, 30, "fa-solid fa-skull", ["vert", "W4"],
10: [false, 55, "The eye", 100, 30, "fa-solid fa-skull", ["vert", "W4"],

[`Welcome, wanderer, who has forsaken the paths of light and ventured into darkness.`,

Expand Down Expand Up @@ -448,11 +448,11 @@ startMapLevelBtn.addEventListener('click', () => {
// Epic Dialog before level start
const StartAdvantureLevelDialog = (level_index, beat_advantureMap) => {
let index = 0;
console.log(mapLevels[level_index][7][index], index, beat_advantureMap);
// console.log(mapLevels[level_index][7][index], index, beat_advantureMap);

// check wether user is allowed to play the level
let user_fulfills_requirements = UserFulfill_RequirementsForLevel();
console.log(user_fulfills_requirements);
// console.log(user_fulfills_requirements);
if (user_fulfills_requirements) {
CloseOnlinePopUps();
playMysticalTheme();
Expand Down Expand Up @@ -709,7 +709,6 @@ function level_startSpeechBubbles(beat_advantureMap) {
`Many have paid the price for this path, and you are among the few who have survived the fateful dance with darkness. Your bravery has defeated the terrors of darkness, yet in the quiet of the epilogue, it becomes clear that every victory demands its toll.`,
];

console.log("kek", beat_advantureMap);
// animation
animatedPopUp.style.display = 'block';
animatedPopUp.style.animation = "popUp-POP 1s ease";
Expand All @@ -718,8 +717,6 @@ function level_startSpeechBubbles(beat_advantureMap) {
level_text = !beat_advantureMap ? unlocked_mapLevels[current_selected_level][7] : Epilogue;
TextIsEpilogue = beat_advantureMap ? true : false;

console.log(level_text, beat_advantureMap);

// new ini text
let TextHead = document.createElement("h2");
let newText = document.createTextNode(level_text[0]);
Expand All @@ -734,7 +731,7 @@ function level_startSpeechBubbles(beat_advantureMap) {
function UserWon_AdvantureLevel(won_levelIndex) {
let nextLevel;

console.log(won_levelIndex, localStorage.getItem(`completed_mapLevel${won_levelIndex}`));
// console.log(won_levelIndex, localStorage.getItem(`completed_mapLevel${won_levelIndex}`));

switch (won_levelIndex) {
default: // default: normal level
Expand Down Expand Up @@ -845,7 +842,6 @@ exploreditem_wrapper.forEach((item_wrapper, i) => {
item_wrapper.index = i;
item_wrapper.addEventListener("click", function() {
let i = item_wrapper.index;
console.log(i);
switch (i) {
case 0:
exploredItemTitle.textContent = "Ore";
Expand Down
3 changes: 1 addition & 2 deletions src/script/public/App/features/OnlineSocialUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const RequestPlayer = () => {

// Player clicks on other player when he searched him or he is in his lobby f.e
const ClickedOnPlayerInfo = (player_name, player_id, player_icon, playerInfoClass, playerInfoColor, quote, onlineGamesWon, XP, currentUsedSkin, last_connection) => {
console.log(player_name, player_id);
// console.log(player_name, player_id);

// check if player is friends with searched and displayed player
try {
Expand Down Expand Up @@ -467,7 +467,6 @@ const CheckForMessages = () => {
Messages_InnerWrapper.textContent = "There are no messages for you yet."

} else { // messages are availible
console.log(cb);
let messagesArray = JSON.parse(cb);
let AmountOfMessages = messagesArray.length;
// global scope variable
Expand Down
4 changes: 2 additions & 2 deletions src/script/public/App/features/XPJourney.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const CheckIfUserCanGetReward = () => {
RewardAt_PointValue = pointVal;
};
// if the user clicks now on the given btn, he collect's the reward and pop up does not open
console.log(Reward_WhichIsAvailible, RewardAt_PointValue)
// console.log(Reward_WhichIsAvailible, RewardAt_PointValue)

nothingThere = false;
return;
Expand Down Expand Up @@ -219,7 +219,7 @@ const UserGetsJourneyItems = (Items) => {
for (let key in Items) {
const element = Items[key]; // Amount of item , key is element name

console.log(key, element);
// console.log(key, element);

if (key == "gems") {
Get_XPReward_Animation(IconsForItems[key][0], IconsForItems[key][1], element / 10, key);
Expand Down
2 changes: 0 additions & 2 deletions src/script/public/App/features/bosses/BossClass.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ class Boss {
removeAccessToAnything();

bossIMG.addEventListener("animationend", bossIMG.fn = (e) => {
console.log(e);

this.delete();
addAccessToAnything();
});
Expand Down
2 changes: 1 addition & 1 deletion src/script/public/App/features/bosses/eye.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function init_eye() {
// start interval for attacking
EyeAttackInterval();
} else {
console.log("The server starts the eye attack interval in the databas as an event scheduler");
// console.log("The server starts the eye attack interval in the databas as an event scheduler");
};
// HP
eyeLifeCounter.textContent = `${eye_HP}/${eye_HP} HP`;
Expand Down
10 changes: 0 additions & 10 deletions src/script/public/App/features/itemDropPropability.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ function UserFoundItems() {

// Amount of different items the user gets
function UserGets_N_Items(n) {
console.log(n)
let exploredItems = JSON.parse(localStorage.getItem("ExploredItems"));

let items = {
Expand Down Expand Up @@ -218,15 +217,12 @@ function UserGets_N_Items(n) {
let rare4 = isInRange(rarityForItems2, 9001, 30000); // propability for rare
let common4 = isInRange(rarityForItems2, 30001, 100000); // propability for common

console.log(i);
if (legendary4) {
foundItem_imgs[i].src = "assets/game/crystal-eye.svg";
foundItem_titles[i].textContent = items["legendary"];
FoundItemCount_Displays[i].textContent = 1;

exploredItems["abandonedEye"] = exploredItems["abandonedEye"] + 1;

console.log("legendary", legendary4)
};

if (mystique4) {
Expand All @@ -247,8 +243,6 @@ function UserGets_N_Items(n) {
exploredItems["encryptedWriting"] = exploredItems["encryptedWriting"] + 1;

};

console.log("mystiqu4", mystique4)
};

if (rare4) {
Expand All @@ -259,8 +253,6 @@ function UserGets_N_Items(n) {
FoundItemCount_Displays[i].textContent = amount;

exploredItems["diamonds"] = exploredItems["diamonds"] + amount;

console.log("rare4", rare4)
};

if (common4) {
Expand All @@ -281,8 +273,6 @@ function UserGets_N_Items(n) {

exploredItems["ore"] = exploredItems["ore"] + amount;
};

console.log("comomn4", common4)
};
};
break;
Expand Down
28 changes: 16 additions & 12 deletions src/script/public/App/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1061,10 +1061,14 @@ const loadingScreenFunc = () => { // starting value of progress is 10 because he

// try to connect to server
try {
socket = io("http://localhost:3000", {
// path: "http://localhost:3000",
socket = io("http://139.144.180.23", {
// path: "http://139.144.180.23",
// transports: ['websocket'],
});
// socket = io("http://localhost:3000", {
// // path: "http://localhost:3000",
// // transports: ['websocket'],
// });
window.socket = socket;

socket.on('connect', () => {
Expand Down Expand Up @@ -1567,7 +1571,7 @@ const InitFullscreen = () => {
InitFullscreen();

settFullscreenBtn.addEventListener('click', () => {
console.log(localStorage.getItem('Fullscreen'))
// console.log(localStorage.getItem('Fullscreen'))
if (localStorage.getItem('Fullscreen') == "false") {
localStorage.setItem("Fullscreen", true);
window.App.ToggleFullScreen(true);
Expand Down Expand Up @@ -1934,7 +1938,7 @@ function Click_NxN(f) {

if (curr_mode == GameMode[2].opponent) { // Online Game mode

console.log(target, target.getAttribute("field"))
// console.log(target, target.getAttribute("field"))

if (target.getAttribute('field') == "25x25" && localStorage.getItem('onlineMatches-won') >= 5 ||
target.getAttribute('field') == "30x30" && localStorage.getItem('onlineMatches-won') >= 10 ||
Expand Down Expand Up @@ -1963,7 +1967,7 @@ const InitGameDataForPopUp = (DisplayIniPopUp) => {
Player1_IconInput.value = localStorage.getItem('UserIcon');
};

console.log(curr_field_ele);
// console.log(curr_field_ele);

// User shouldn't play 40x40 field with 5 second player clock
if (curr_field_ele.getAttribute("field") == "40x40") {
Expand Down Expand Up @@ -2204,7 +2208,7 @@ function UserCreateRoom(readOnlyLevel, Data1, Data2, UserName, thirdplayerRequir
if (patterns) allowedPatternsFromUser = patterns;
if (PlayingInCreatedLevel) Check[2] = NewCreativeLevel.Settings["playertimer"][NewCreativeLevel.selectedLevel[3]];

console.log(UserSetPointsToWinGameInput.value, PointsToWinGame)
// console.log(UserSetPointsToWinGameInput.value, PointsToWinGame)

// GameData: Sends PlayerClock, InnerGameMode and xyCellAmount ; PlayerData: sends player name and icon => requests room id
socket.emit('create_room', [Check[2], Check[3], xyCell_Amount, Player1_NameInput.value, curr_form1, fieldIndex, fieldTitle, localStorage.getItem('userInfoClass'),
Expand Down Expand Up @@ -2292,7 +2296,7 @@ const UserTriesToEnterOnlineGame = () => {
if (Player1_IconInput.value != "" && Player1_NameInput.value != "" && personal_GameData.role == "user" ||
// or second condition: user joins as blocker so he only needs to pass his name
Player1_NameInput.value != "" && personal_GameData.role == "blocker") {
console.log(personal_GameData.role)
// console.log(personal_GameData.role)

socket.emit('CONFIRM_enter_room', [personal_GameData.currGameID, Player1_NameInput.value.trim(), Player1_IconInput.value.trim(),
localStorage.getItem('userInfoClass'), localStorage.getItem('userInfoColor'), personal_GameData.role
Expand Down Expand Up @@ -2365,7 +2369,7 @@ function SetPlayerData_ConfirmEvent() {
if (curr_mode == GameMode[2].opponent) { // online mode
// if user wants to enter an online game
if (personal_GameData.EnterOnlineGame) {
console.log(personal_GameData.EnterOnlineGame)
// console.log(personal_GameData.EnterOnlineGame)
UserTriesToEnterOnlineGame();

} else { // user wants to create an online game
Expand Down Expand Up @@ -3014,7 +3018,7 @@ animatedPopConBtn.addEventListener('click', animatedPopConBtn.fn = () => {
const AdvantureModeLevelIntro = () => {
if (ContBtnCount == 2) ClickedOnLastText = false;

console.log(ContBtnCount, level_text);
// console.log(ContBtnCount, level_text);

if (ContBtnCount < level_text.length && level_text[ContBtnCount] != undefined) {
animatedPopMain.querySelector('.newText').textContent = level_text[ContBtnCount];
Expand All @@ -3036,7 +3040,7 @@ const AdvantureModeLevelIntro = () => {
locked_30x30();
locked_40x40();

console.log(document.querySelector(".DialogEye"));
// console.log(document.querySelector(".DialogEye"));

// fade out animation to epic dialog
animatedPopUp.style.opacity = "0";
Expand Down Expand Up @@ -3175,7 +3179,7 @@ const CloseUserPopUpOfOtherPlayer = () => {
SearchUser_Btn.style.display = "flex";
GetMessage_Btn.style.display = "flex";

console.log(running, personal_GameData.role);
// console.log(running, personal_GameData.role);
if (!running) {
if (personal_GameData.currGameID != null) {
DarkLayer.style.display = "block";
Expand Down Expand Up @@ -3223,7 +3227,7 @@ const TryToCloseUserInfoPopUp = () => {
if (userInfoName.textContent != "" && userInfoIcon.textContent !== "" || userInfoName.textContent != "" && localStorage.getItem('UserIcon') != "" ||
localStorage.getItem('UserIcon') == null) {

console.log(running, personal_GameData.role);
// console.log(running, personal_GameData.role);
if (!running) {
if (personal_GameData.currGameID != null) {
DarkLayer.style.display = "block";
Expand Down
2 changes: 1 addition & 1 deletion src/script/public/Game/2MovesAheadInnerField.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class TMA_InnerField {
};

create = () => {
console.log(this.origin_index, this.cell_amount);
// console.log(this.origin_index, this.cell_amount);

// calculate indexes for big field. type: Array
let indexesBigField = this.calculate_boundaries(this.origin_index);
Expand Down
Loading

0 comments on commit 9f7b775

Please sign in to comment.