Fix for game update v2.13.0
parent
2e5daab81e
commit
94a7b08673
|
@ -11,6 +11,27 @@ export default (/** @type {ModUtils} */ modUtils) => {
|
|||
return alert("Error:\\n" + e.filename + " " + e.lineno + " " + e.colno + " " + e.message);`
|
||||
)
|
||||
|
||||
// Render win count
|
||||
modUtils.insertCode(`var s = Math.floor((Device.a1.largeUIEnabled() ? 0.018 : 0.0137) * h___.hz);
|
||||
ctx.font = Util.qd.sS(0, Math.max(5, s));
|
||||
Util.qd.textBaseline(ctx, 0);
|
||||
Util.qd.textAlign(ctx, 2);
|
||||
ctx.fillStyle = Colors.nl;
|
||||
ctx.fillText(clientInfo.gameVersion, h___.w, 0);
|
||||
/* here */`,
|
||||
`const text = "Win count: " + __fx.wins.count;
|
||||
const textLength = ctx.measureText(text).width;
|
||||
const size = Math.max(5, s);
|
||||
ctx.textAlign = "left";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, ctx.canvas.width - textLength - size / 2, size * 2);`)
|
||||
|
||||
// Make the main canvas context have an alpha channel if a custom background is being used
|
||||
modUtils.insertCode(`mainCanvasElement = document.getElementById("canvasA");
|
||||
if (Device.id === 2) { mainCanvasElement.style.webkitUserSelect = "none"; }
|
||||
mainCanvas = mainCanvasElement.getContext("2d", { alpha: /* here */ false });`,
|
||||
`__fx.makeMainMenuTransparent ? true :`)
|
||||
|
||||
modUtils.waitForMinification(() => applyPatches(modUtils))
|
||||
}
|
||||
//export const requiredVariables = ["game", "playerId", "playerData", "rawPlayerNames", "gIsSingleplayer", "playerTerritories"];
|
||||
|
@ -66,7 +87,7 @@ function applyPatches(/** @type {ModUtils} */ { replace, replaceOne, replaceRawC
|
|||
a8.gD[sE]&&(o.ha(sE,2),b.h9<100?xD(0,__L([a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0):xD(0,__L([a8.jx[sE]]),3,sE,ad.gN,ad.kl,-1,!0))`);
|
||||
|
||||
|
||||
{ // Add settings button, custom lobby button and win count
|
||||
{ // Add settings button and custom lobby button
|
||||
// add buttons
|
||||
replaceRawCode(`,new nQ("☰<br>"+__L(),function(){aD6(3)},aa.ks),new nQ("",function(){at.d5(12)},aa.kg,!1)]`,
|
||||
`,new nQ("☰<br>"+__L(),function(){aD6(3)},aa.ks),new nQ("",function(){at.d5(12)},aa.kg,!1),
|
||||
|
@ -77,38 +98,6 @@ function applyPatches(/** @type {ModUtils} */ { replace, replaceOne, replaceRawC
|
|||
`aZ.g5.vO(aD3[3].button,x+a0S+gap,a3X+h+gap,a0S,h);
|
||||
aZ.g5.vO(aD3[5].button, x, a3X + h * 2 + gap * 2, a0S * 2 + gap, h / 3);
|
||||
aZ.g5.vO(aD3[6].button, x, a3X + h * 2.33 + gap * 3, a0S * 2 + gap, h / 3);`);
|
||||
// render win count
|
||||
replaceRawCode(`if(_y.a4l(),_r.gI(),_m.gI(),aw.gI(),a0.g8()){ctx.imageSmoothingEnabled=!1;var iQ=a0.a4o("territorial.io"),kL=.84*aD4.gA/iQ.width;`,
|
||||
`if(_y.a4l(),_r.gI(),_m.gI(),aw.gI(),a0.g8()){
|
||||
if (__fx.settings.displayWinCounter) {
|
||||
const size = Math.floor(aD4.gA * 0.03);
|
||||
ctx.font = ${dict.fontGeneratorFunction}(1, size);
|
||||
ctx.fillStyle = "#ffffff";
|
||||
const text = "Win count: " + __fx.wins.count;
|
||||
const textLength = ctx.measureText(text).width;
|
||||
ctx.textAlign = "left";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, ctx.canvas.width - textLength - size / 2, size);
|
||||
};
|
||||
ctx.imageSmoothingEnabled=!1;var iQ=a0.a4o("territorial.io"),kL=.84*aD4.gA/iQ.width;`)
|
||||
/*// render gear icon and win count
|
||||
replaceRawCode(`,fy=aV.nU[80],fontSize=.65*height,canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6)",canvas.fillRect(x,y,width,height),`,
|
||||
`,fy=aV.nU[80],fontSize=.65*height,
|
||||
canvas.imageSmoothingEnabled = true,
|
||||
canvas.drawImage(settingsGearIcon, x - width / 2, y, height, height),
|
||||
canvas.imageSmoothingEnabled = false,
|
||||
(settings.displayWinCounter && (
|
||||
canvas.font = aY.g0.g1(1, Math.floor(height * 0.4)),
|
||||
canvas.fillStyle = "#ffffff",
|
||||
canvas.fillText("Win count: " + wins_counter, Math.floor(x + width / 2), Math.floor((y + height / 2) * 2))
|
||||
)),
|
||||
canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6)",canvas.fillRect(x,y,width,height),`);
|
||||
|
||||
// handle settings button click
|
||||
replaceRawCode(`(q6=Math.floor((b7.cv.fv()?.145:.09)*aK.fw),gap=Math.floor(.065*(b7.cv.fv()?.53:.36)*aK.fw),gap=aK.g5-q6-gap,jd=b0.gap,q6=Math.floor(.35*q6),gap<=mouseX&&mouseY<jd+q6&&ar.v2(1))`,
|
||||
`(q6=Math.floor((b7.cv.fv()?.145:.09)*aK.fw),gap=Math.floor(.065*(b7.cv.fv()?.53:.36)*aK.fw),gap=aK.g5-q6-gap,jd=b0.gap,q6=Math.floor(.35*q6),
|
||||
(gap <= mouseX && mouseY < jd + q6 && (ar.v2(1), true)) || (mouseX >= gap - q6 / 0.7 && mouseY < jd + q6 && WindowManager.openWindow("settings"))
|
||||
)`);*/
|
||||
}
|
||||
|
||||
{ // Keybinds
|
||||
|
@ -136,8 +125,6 @@ canvas.font=aY.g0.g1(1,fontSize),canvas.fillStyle="rgba("+gR+","+tD+","+hj+",0.6
|
|||
//replaceOne(/(this\.\w+=function\(\){)((\w+\.\w+)\[2\]=\3\[3\]=\3\[4\]=(?<linksHidden>!this\.\w+\.\w+),)/g,
|
||||
//"$1 if (settings.hideAllLinks) $3[0] = $3[1] = $<linksHidden>; else $3[0] = $3[1] = true; $2")
|
||||
|
||||
// Make the main canvas context have an alpha channel if a custom background is being used
|
||||
replaceOne(/(document\.getElementById\("canvasA"\),\(\w+=\w+\.getContext\("2d",){alpha:!1}/g, "$1 {alpha: __fx.makeMainMenuTransparent}")
|
||||
// Clear canvas background if a custom background is being used
|
||||
replaceRawCode(`,this.qk=function(){var a4n,a4m;aq.pd?(a4m=aL.gA/aq.eE,a4n=aL.gF/aq.eF,canvas.setTransform(a4m=a4n<a4m?a4m:a4n,0,0,a4m,`,
|
||||
`,this.qk=function(){var a4n,a4m;
|
||||
|
|
Loading…
Reference in New Issue