Skip to content

Commit

Permalink
Javascript updated to match server
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanpmartell committed Aug 14, 2024
1 parent 92bc426 commit fb4c90b
Showing 1 changed file with 21 additions and 71 deletions.
92 changes: 21 additions & 71 deletions LittleWarGameClient/js/lwg-5.0.0.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var globalLWGDebug = false;
var globalLWGDebug = false;
(function () { function r(e, n, t) { function o(i, f) { if (!n[i]) { if (!e[i]) { var c = "function" == typeof require && require; if (!f && c) return c(i, !0); if (u) return u(i, !0); var a = new Error("Cannot find module '" + i + "'"); throw a.code = "MODULE_NOT_FOUND", a } var p = n[i] = { exports: {} }; e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r) }, p, p.exports, r, e, n, t) } return n[i].exports } for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)o(t[i]); return o } return r })()({
1: [function (require, module, exports) {
function assert(bool) {
Expand Down Expand Up @@ -1280,7 +1280,7 @@

async function init() {
try {
aiCommit = await httpGet('https://sockets.littlewargame.com:8084/ai_commit');
aiCommit = await httpGet('https://sockets.littlewargame.com:9004/ai_commit');
await WorkerClient.call('set-ai-commit', { aiCommit: aiCommit });

const manifest = await loadManifest(aiCommit);
Expand All @@ -1292,7 +1292,7 @@
}));
} catch (e) {
console.log(`Failed to load AIs: ${e}`);
return;
// return;
}

// We got the manifest and commit
Expand Down Expand Up @@ -1481,7 +1481,7 @@
return new HTMLBuilder()
.add(`
<p class='hotkeyEntry' id='${textID}'>${this.name}
<input type='text' id='${inputID}' class='hotkeyInput' style="width: 80px;" readonly></input>
<input type='text' id='${inputID}' class='hotkeyInput' readonly></input>
</p>`)
.addHook(() => this.text = $(`#${textID}`))
.addHook(() => this.input = $(`#${inputID}`))
Expand Down Expand Up @@ -3889,7 +3889,7 @@
// var SERVER_ADRESS = "ws://108.61.78.37:8083";
// var SERVER_ADRESS = "wss://us1.littlewargame.com:8083";
// var SERVER_ADRESS = "wss://us1-dev.littlewargame.com:8083";
// var SERVER_ADRESS = 'ws://localhost:8083';
// var SERVER_ADRESS = 'wss://localhost:8083';

// The server and special event placeholders will be filled out by the gulp build
var SERVER_ADRESS = 'wss://sockets.littlewargame.com:9000';
Expand All @@ -3909,7 +3909,7 @@
var show_fps = false;
var frameTimes = []; // to calculate fps from weighted average of last three frame times
var mspfCap = 25; // "ms per frame cap" = inverse fps cap: 25ms per frame = 40 frames per second (1000/x), varies adaptively between 25 and 40 for more consistent performance under high load
var show_unit_details = true;
var show_unit_details = false;
var fps = 0;
var ticksCounter = 0;
var percentageOfCurrentTickPassed = 0;
Expand Down Expand Up @@ -19026,11 +19026,12 @@

c.globalAlpha = 1;

//debugs
if (globalLWGDebug && show_unit_details && !network_game) {
// debugs
if(globalLWGDebug && !network_game)
{
c.fillStyle = "rgba(0, 0, 0, 1)";
c.fillText(this.order.name, this.drawPos.px * FIELD_SIZE - game.cameraX - FIELD_SIZE / 3, (this.drawPos.py - this.type.healthbarOffset) * FIELD_SIZE - game.cameraY - 12);

// show detailed path to next target
/*if(this.path)
{
Expand Down Expand Up @@ -28994,67 +28995,12 @@

this.menuMusic = [
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu.ogg'),
new Audio('music/menu2.ogg'),
];

this.menuMusicAlt = [
new Audio('music/menu2.ogg'),
]

this.ambient = [
new Audio('sounds/ambient/ambient1.ogg'),
];
Expand All @@ -29071,7 +29017,7 @@
};

MusicManager.prototype.bindEvents = function () {
_.each([this.ingameMusic, this.defeatMusic, this.menuMusic], function (musics) {
_.each([this.ingameMusic, this.defeatMusic, this.menuMusic, this.menuMusicAlt], function (musics) {
for (var i = 0; i < musics.length; i++) {
musics[i].addEventListener('ended', function () {
setTimeout(function () {
Expand All @@ -29094,7 +29040,7 @@
};

MusicManager.prototype.setMusicVolume = function (volume) {
_.each([this.ingameMusic, this.defeatMusic, this.menuMusic, this.victoryMusic], function (musics) {
_.each([this.ingameMusic, this.defeatMusic, this.menuMusic, this.menuMusicAlt, this.victoryMusic], function (musics) {
for (var i = 0; i < musics.length; i++) {
musics[i].volume = 0.7 * volume;
}
Expand All @@ -29119,7 +29065,11 @@

var rand = Math.floor(Math.random() * 1000) % music.length;
for (var i = 0; i < music.length; i++) {
var musicPiece = music[(rand + i) % music.length];
if (music == this.menuMusic) {
var musicPiece = Math.floor(Math.random() * 1000) % 50 == 1 ? this.menuMusicAlt[0] : music[(rand + i) % music.length];
} else {
var musicPiece = music[(rand + i) % music.length];
}
if (musicPiece.readyState == 4) {
musicPiece.currentTime = 0;
const playAndRetry = () => {
Expand Down

0 comments on commit fb4c90b

Please sign in to comment.