Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Inferno Integration #46

Draft
wants to merge 21 commits into
base: feature/inferno
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion client/scripts/com/monsters/siege/SiegeBuildingPopup.as
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ package com.monsters.siege
{
this._videoStream.close();
this._currentVideoURL = this._currentWeapon.video;
this._videoStream.play(this._currentWeapon.video);
//added this so the game looks for the video hosted on the server and doesnt have to check locally
this._videoStream.play(GLOBAL._storageURL + this._currentWeapon.video);
}
}
else if(this._currentPreviewUrl != this._currentWeapon.videopreview)
Expand Down
3 changes: 2 additions & 1 deletion client/scripts/com/monsters/siege/weapons/SiegeWeapon.as
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ package com.monsters.siege.weapons
this._properties = {};
this.image = _IMAGE_FOLDER_URL + this.weaponID + ".png";
this.icon = _ICON_FOLDER_URL + "siege_icon_" + this.weaponID + ".png";
this.video = "assets/videos/" + this.weaponID + "400x175.flv";
// formerly "assets/videos/", changed to be simply "videos/" for the sake of consistency
this.video = "videos/" + this.weaponID + "400x175.flv";
this.videopreview = "videos/" + this.weaponID + "_preview" + ".png";
this.name = KEYS.Get("#w_" + this.weaponID + "#");
this.description = KEYS.Get("w_" + this.weaponID + "desc");
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added server/public/assets/buildings/iacademy/top.1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added server/public/assets/buildings/iacademy/top.2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified server/public/assets/buildings/imagmatower/top.1.v2.png
Diff not rendered.
Diff not rendered.
Binary file modified server/public/assets/buildings/iquaketower/top.1.destroyed.png
Binary file added server/public/assets/monsters/IC1-medium.jpg
Binary file added server/public/assets/monsters/IC1-portrait.jpg
Binary file added server/public/assets/monsters/IC2-medium.jpg
Binary file added server/public/assets/monsters/IC2-portrait.jpg
Binary file added server/public/assets/monsters/IC3-medium.jpg
Binary file added server/public/assets/monsters/IC3-portrait.jpg
Binary file added server/public/assets/monsters/IC4-medium.jpg
Binary file added server/public/assets/monsters/IC4-portrait.jpg
Binary file added server/public/assets/monsters/IC5-medium.jpg
Binary file added server/public/assets/monsters/IC5-portrait.jpg
Binary file added server/public/assets/monsters/IC6-medium.jpg
Binary file added server/public/assets/monsters/IC6-portrait.jpg
Binary file added server/public/assets/monsters/IC7-medium.jpg
Binary file added server/public/assets/monsters/IC7-portrait.jpg
Binary file added server/public/assets/monsters/IC8-medium.jpg
Binary file added server/public/assets/monsters/IC8-portrait.jpg
Binary file added server/public/assets/siegebuttons/decoy.png
Binary file added server/public/assets/siegebuttons/jars.png
Binary file added server/public/assets/siegebuttons/vacuum.png
Binary file added server/public/assets/ui/descent_maproom2.jpg
Binary file added server/public/assets/ui/lava1.png
Binary file added server/public/assets/ui/lava2.png
Binary file added server/public/assets/ui/lava3.png
Binary file added server/public/assets/ui/stonemenu2.png
Binary file added server/public/assets/videos/decoy400x175.flv
Binary file not shown.
Binary file added server/public/assets/videos/jars400x175.flv
Binary file not shown.
Binary file added server/public/assets/videos/vacuum400x175.flv
Binary file not shown.
1 change: 1 addition & 0 deletions server/src/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ router.post("/api/bm/yardplanner/savetemplate", auth, debugDataLog("Saving templ
router.post("/api/bm/base/load", auth, debugDataLog("Inferno load data"), baseLoad);
router.post("/api/bm/base/infernomonsters", auth, debugDataLog("Load inferno monsters"), infernoMonsters);
router.post("/api/bm/base/save", auth, debugDataLog("Inferno save data"), baseSave);
router.post("/api/bm/base/updatesaved", auth, debugDataLog("Inferno Updated Save"), updateSaved);

// Worldmap v2
router.post("/worldmapv2/getarea", auth, debugDataLog("MR2 get area"), getArea);
Expand Down
2 changes: 1 addition & 1 deletion server/src/config/DevSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const devConfig = {
skipTutorial: true,
unlockAllEventRewards: false,
maproom: true,
inferno: false,
inferno: true,
devSandbox: false,
debugSandbox: false,
};
49 changes: 44 additions & 5 deletions server/src/controllers/baseLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { generateID } from "../utils/generateID";
import { loadBuildBase, loadViewBase } from "../services/base/loadBase";
import { saveFailureErr } from "../errors/errorCodes.";
import { removeBaseProtection } from "../services/maproom/v2";
import { DescentStatus } from "../models/descentstatus.model";


interface BaseLoadRequest {
Expand All @@ -33,12 +34,18 @@ export const baseLoad: KoaController = async (ctx) => {
await ORMContext.em.populate(user, ["save"]);
const authSave = user.save;
let save: Save = null;
logging(requestBody.type);

if (requestBody.type === "build") {
save = await loadBuildBase(ctx, requestBody.baseid);
if(save && save.saveuserid !== user.userid) {
throw saveFailureErr;
}
} else if (requestBody.type === "ibuild") {
save = await loadBuildBase(ctx, authSave.baseid_inferno.toString());
if (save && save.saveuserid !== user.userid) {
throw saveFailureErr;
}
} else {
save = await loadViewBase(ctx, requestBody.baseid)
}
Copy link
Contributor

@EvenBiggerManGhark EvenBiggerManGhark Apr 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore the comment I left here and deleted - misread something

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this PR is looking to merge into feature/mr2 which is @sush1lemon code. It might be useful to sort out that PR before looking at this one, as we don't know what new changes have been added to this

Expand All @@ -48,21 +55,31 @@ export const baseLoad: KoaController = async (ctx) => {
);
if (save) {
if (process.env.ENV === "local") {
logging(`Base loaded:`, JSON.stringify(save, null, 2));
//logging(`Base loaded:`, JSON.stringify(save, null, 2));
}
} else if (requestBody.baseid && requestBody.baseid === "0") {
// There was no existing save, create one with some defaults
logging(`Base not found, creating a new save`);

save = ORMContext.em.create(Save, getDefaultBaseData(user));

if (requestBody.type === "ibuild") {
save.type = "inferno",
save.baseid = authSave.baseid_inferno.toString();
save.credits = authSave.credits;
save.resources = authSave.iresources;
authSave.stats["other"]["underhalLevel"] = 1;
await ORMContext.em.persistAndFlush(authSave);
}

// Add the save to the database
await ORMContext.em.persistAndFlush(save);

user.save = save;

// Update user base save
await ORMContext.em.persistAndFlush(user);
if (requestBody.type !== "ibuild") {
user.save = save;
// Update user base save || ONLY IF WE DIDNT JUST CREATE AN INFERNO BASE
await ORMContext.em.persistAndFlush(user);
}
}

if (!save) throw saveFailureErr;
Expand Down Expand Up @@ -93,6 +110,28 @@ export const baseLoad: KoaController = async (ctx) => {
await ORMContext.em.persistAndFlush(save);
}

if (requestBody.type == "iwmattack") {
//logging(JSON.stringify(save));
//await ORMContext.em.persistAndFlush(save);
}

if (requestBody.type === "idescent") {
//[201,202,203,204,205,206,207] - inferno base IDs
const descentBases = [[201,1,0],[202,2,0],[203,3,0],[204,4,0],[205,5,0],[206,6,0],[207,7,0]];
let descentStatus = await ORMContext.em.findOne(DescentStatus, {
userid: authSave.userid,
})
if (!descentStatus) {
descentStatus = ORMContext.em.create(DescentStatus, {
userid: authSave.userid,
wmstatus: descentBases,
})
await ORMContext.em.persistAndFlush(descentStatus);
}
save.wmstatus = descentStatus.wmstatus;
await ORMContext.em.persistAndFlush(save);
}

const filteredSave = FilterFrontendKeys(save);

const isTutorialEnabled = devConfig.skipTutorial ? 205 : 0;
Expand Down
Loading