Skip to content

Instantly share code, notes, and snippets.

@afifabroory
Created April 2, 2023 08:27
Show Gist options
  • Save afifabroory/fd903f884edf014180a4bfa35bb82eed to your computer and use it in GitHub Desktop.
Save afifabroory/fd903f884edf014180a4bfa35bb82eed to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
(globalThis.webpackChunksup_frontend = globalThis.webpackChunksup_frontend || []).push([[886], {
53121: (e,t,i)=>{
i.d(t, {
v: ()=>g
});
i(29767);
var s = i(39513);
const r = 1
, n = 2;
s.IZ.model.alliances.AllianceMember = class {
constructor(e) {
this.details = e
}
getID() {
return this.details.userID
}
getName() {
return this.details.username
}
isModerator() {
return this.details.right == r
}
isLeader() {
return this.details.right == n
}
getRole() {
switch (this.details.right) {
case n:
return s.IZ.i18n.gettext("Leader");
case r:
return s.IZ.i18n.gettext("Officer");
default:
return s.IZ.i18n.gettext("Member")
}
}
hasModeratorRight() {
switch (this.details.right) {
case n:
case r:
return !0;
default:
return !1
}
}
getLevel() {
return this.details.level
}
isMe() {
return s.IZ.user.getId() == this.getID()
}
}
;
i(4629);
s.IZ.model.alliances.AllianceBattleStatsEntry = class {
constructor() {
this.details = null
}
getWinningAlliancePoints() {
return parseInt(this.details.winningAlliancePoints)
}
getLosingAlliancePoints() {
return parseInt(this.details.losingAlliancePoints)
}
getWinningAllianceId() {
return parseInt(this.details.winningAlliance)
}
getLoosingAllianceId() {
return parseInt(this.details.loosingAlliance)
}
getEloDiff() {
return parseInt(this.details.eloDiff)
}
getGameID() {
return parseInt(this.details.gameID)
}
getModID() {
return parseInt(this.details.modID)
}
}
;
var a = i(61809)
, o = i(22155)
, l = i(6266)
, u = i(77105)
, h = i(13775);
class g {
constructor(e) {
this.properties = e || {},
this.stats = {},
this.members = null,
this.invites = null
}
getMembers() {
return this.members
}
isMember(e) {
return e = Number(e),
this.members.some((t=>Number(t.getId()) === e))
}
isModerator(e) {
const t = this.getMember(e);
return t && (t.isModerator() || t.isLeader())
}
isLeader(e) {
const t = this.getMember(e);
return t && t.isLeader()
}
getMember(e) {
if (this.members) {
const t = this.getUser(e);
if (t && t.getAllianceMember())
return t.getAllianceMember()
}
return null
}
getUser(e) {
if (this.members)
for (let t = 0; t < this.members.length; t++)
if (this.members[t].getId() == e)
return this.members[t];
return null
}
isDeleted() {
return 1 == this.properties.deleted
}
getInvite(e) {
if (this.invites)
for (let t = 0; t < this.invites.length; t++) {
const i = this.invites[t];
if (i.user && i.user.getId() == e)
return i
}
return null
}
getInvites() {
return this.invites
}
getMemberCount() {
return this.properties.numMembers
}
getID() {
return Number(this.properties.uid)
}
getCountry() {
return this.properties.country || "INT"
}
getCountryName() {
for (let e = 0; e < u.M.length; e++)
if (u.M[e].key == this.properties.country)
return u.M[e].name;
return s.IZ.i18n.gettext("International")
}
setCountry(e) {
this.properties.country = e
}
getCreationDate() {
return this.properties.creationDate
}
getFormattedCreationDate() {
return h.Z.getFormattedDate(this.getCreationDate())
}
getName() {
return this.properties.name
}
setName(e) {
this.properties.name = e
}
getDescription() {
return this.properties.descriptionText
}
setDescription(e) {
this.properties.descriptionText = e
}
getDescriptionBR() {
return !this.brMessage && this.properties.descriptionText && (this.brMessage = nl2br(this.properties.descriptionText.replace(/</g, "&lt;").replace(/>/g, "&gt;"))),
this.brMessage
}
getExternalForumUrl() {
return this.properties.urlExternalForum
}
setForumUrl(e) {
this.properties.urlExternalForum = e
}
getExternalHomepageUrl() {
return this.properties.urlExternalHomepage
}
setHomepageUrl(e) {
this.properties.urlExternalHomepage = e
}
getTag() {
return this.properties.tag.replace(/[\[\]<>]/g, "")
}
getFullTag() {
return `‎[${this.getTag()}]`
}
setTag(e) {
this.properties.tag = e.replace(/[\[\]<>]/g, "")
}
getLogo() {
return this.properties.logo
}
hasLogo() {
const e = this.getLogo();
return e && "null" !== e
}
setLogo(e) {
this.properties.logo = e
}
getLogoUrl() {
return `${a.Ev() + s.IZ.config.staticServer}/${this.getLogo()}`
}
getSmallLogoUrl() {
return `${a.Ev() + s.IZ.config.staticServer}/${this.properties.logoSmall}`
}
getMemberSlotCount() {
return this.properties.memberSlots
}
setMemberSlotCount(e) {
this.properties.memberSlots = e
}
isOpenForChallenge() {
return 1 == parseInt(this.properties.openForChallenge, 10)
}
setOpenForChallenge(e) {
this.properties.openForChallenge = e ? "1" : "0"
}
getInviteText() {
return this.properties.pmInvitationText
}
setInviteText(e) {
this.properties.pmInvitationText = e
}
getWelcomeText() {
return this.properties.pmWelcomeText
}
setWelcomeText(e) {
this.properties.pmWelcomeText = e
}
getJoinMode() {
return this.properties.joinMode
}
setJoinMode(e) {
this.properties.joinMode = e
}
getJoinModeText() {
const e = this.getJoinModes();
for (let t = 0; t < e.length; t++)
if (e[t].value == this.getJoinMode())
return e[t].text;
return ""
}
getJoinModes() {
const e = [{
value: g.AllianceJoinModes.INVITE,
text: s.IZ.i18n.gettext("Invite only")
}, {
value: g.AllianceJoinModes.APPLICATION,
text: s.IZ.i18n.gettext("Application must be accepted")
}, {
value: g.AllianceJoinModes.JOIN_FREE,
text: s.IZ.i18n.gettext("Free to join")
}];
for (let t = 0; t < e.length; t++)
e[t].value == this.getJoinMode() && (e[t].selected = !0);
return e
}
getWinLoseRatio() {
return this.getLossCount() > 0 ? this.getWinCount() / this.getLossCount() : -1
}
getWinLosePercentage() {
const e = this.getWinCount() + this.getLossCount();
return e > 0 ? this.getWinCount() / e * 100 : -1
}
getWinCount() {
return this.stats.wins
}
getLossCount() {
return this.stats.losses
}
getEloPoints() {
return this.stats.elo
}
getEloRank() {
return this.stats.eloRank
}
getAverageLevel() {
return l.t.getRankForScore(this.getAveragePoints()).getLevel()
}
getAveragePoints() {
return this.stats.avgScore
}
getGlobalRank() {
return this.stats.globalRank
}
getRankChange() {
const e = Number(this.stats.globalRank) - Number(this.stats.globalPreviousDayRank);
return e < 0 ? "increased" : e > 0 ? "decreased" : "nochange"
}
getReceivedApplicationCount() {
let e = 0;
if (this.invites)
for (let t = 0; t < this.invites.length; t++)
this.invites[t].wasInvited() || (e += 1);
return e
}
setInventory(e) {
this.inventory = e
}
getInventory() {
return this.inventory || (this.inventory = new o.z,
this.inventory.inventory = {}),
this.inventory
}
isUsersAlliance() {
if (s.IZ.user) {
const e = s.IZ.user.getAlliance();
if (e instanceof g)
return e.getID() == this.getID()
}
return !1
}
}
g.AllianceJoinModes = {
INVITE: 0,
APPLICATION: 1,
JOIN_FREE: 2
},
s.IZ.model.alliances.Alliance = g
}
,
29767: (e,t,i)=>{
var s = i(39513);
s.IZ.model.alliances.AllianceApplication = class {
constructor() {
this.details = null,
this.user = null,
this.alliance = null
}
getAllianceId() {
return parseInt(this.details.allianceID)
}
getUserId() {
return parseInt(this.details.userID)
}
getTimeStamp() {
return parseInt(this.details.tstamp)
}
getAlliance() {
return this.alliance
}
getUser() {
return this.user
}
wasInvited() {
return 1 == parseInt(this.details.invitation)
}
isAllianceDeleted() {
return 1 == parseInt(this.details.allianceDeleted)
}
getMethod() {
return this.wasInvited() ? s.IZ.i18n.gettext("Invitation") : s.IZ.i18n.gettext("Application")
}
}
}
,
4629: (e,t,i)=>{
hup.model.alliances.AllianceBattleStats = class {
constructor() {
this.battleStats = null,
this.opponents = null,
this.games = null
}
getOpponents() {
return this.opponents
}
sortAggregatedStats(e, t) {
return t.eloDiff - e.eloDiff
}
getAggregatedBattleStats(e) {
const t = {};
for (const s of this.battleStats) {
const i = s.getWinningAllianceId() == e
, r = i ? s.getLoosingAllianceId() : s.getWinningAllianceId();
t[r] || (t[r] = {
opponent: this.opponents[r],
wins: 0,
losses: 0,
eloDiff: 0,
winLosePercentage: 0
}),
i ? (t[r].wins++,
t[r].eloDiff += s.getEloDiff()) : (t[r].losses++,
t[r].eloDiff -= s.getEloDiff())
}
const i = Object.values(t);
return i.forEach((e=>{
const t = e.wins + e.losses;
e.winLosePercentage = t > 0 ? e.wins / t * 100 : -1
}
)),
i.length > 1 && i.sort(this.sortAggregatedStats),
i
}
}
}
,
69280: (e,t,i)=>{
i.d(t, {
l: ()=>f
});
i(87477);
var s = i(55542)
, r = i(59978)
, n = i(28766)
, a = i(39513)
, o = i(36827)
, l = i(65112)
, u = i(55804)
, h = i(57361)
, g = i(97978)
, c = i(38530)
, d = i(72053)
, p = (i(23211),
i(83964))
, m = i(87928)
, I = i(66925)
, T = i(25567)
, A = i(13775)
, y = i(33558)
, S = i(4395);
class f {
constructor(e) {
this.properties = e,
this.logins = []
}
getTitle() {
return this.properties.title
}
getDayOfGame() {
return Number(this.properties.dayofgame)
}
getOpenSlots() {
return Number(this.properties.openSlots)
}
getScenarioID() {
return Number(this.properties.scenarioID)
}
setScenarioID(e) {
this.properties.scenarioID = e
}
getTimeCreated() {
return Number(this.getProperty("crdate"))
}
getScenarioVersionID() {
return parseInt(this.properties.scenarioVersionID, 10)
}
setWhenStartOption(e) {
this.properties.whenstart = e
}
setTeamSetting(e) {
this.properties.teamSettings = e
}
getTeamSetting() {
return this.properties.teamSettings
}
getNumberOfTeams() {
return Number(this.properties.numberOfTeams)
}
getNumberOfTeamsDuringCreation(e) {
return Number(this.properties[e])
}
setNumberOfTeamsDuringCreation(e, t) {
this.properties[e] = t
}
getScenario() {
return g.d.instance(this.getScenarioID())
}
hasOpenSlots() {
return Number(this.properties.openSlots) > 0
}
mayJoin() {
return !l.W.all.some((e=>!e.mayJoin(a.IZ.user, this)))
}
isJoinPossible() {
return !!this.hasOpenSlots() && (!!c.W.mayCreateJoinOnlyScenarios(a.IZ.user) || this.mayJoin() && !this.isTooLateToJoin())
}
getJoinFailReasons() {
const e = [];
return this.hasOpenSlots() || e.push(a.IZ.i18n.gettext("No Open Slots")),
this.isTooLateToJoin() && e.push(a.IZ.i18n.gettext("Too late to join")),
e.push(...this.getJoinFailReasonsForGameFeatures()),
e
}
getJoinFailReasonsForGameFeatures() {
return l.W.all.filter((e=>!e.mayJoin(a.IZ.user, this))).map((e=>e.getJoinFailReason(a.IZ.user, this))).filter(Boolean)
}
getGameId() {
return Number(this.properties.gameID)
}
isCurrentGame() {
return this.getGameId() === Number(a.IZ.config.userData.gameID)
}
getModId() {
return Number(this.properties.modID)
}
getModVersionId() {
return Number(this.properties.modVersionID)
}
getMod() {
return h.P.instance(this.getModId())
}
isForeignModGame() {
return this.getModId() !== Number(a.IZ.getMod(!1).getModID())
}
getComment() {
return this.properties.comment
}
isRanked() {
return 1 === Number(this.properties.ranked)
}
isBetaGame() {
return (new o.T).hasFeature(this)
}
shouldShowBetaLevel() {
return c.W.checkAdminUser(a.IZ.user) || this.isBetaGame()
}
getHRBetaLevel() {
const e = new o.T;
return 2 == e.getValue(this) ? "Beta" : e.getValueHR(this)
}
hasBecomeUnranked() {
return 2 === Number(this.properties.ranked)
}
getNrOfPlayers() {
return Number(this.properties.nrofplayers)
}
getPlayerSlotsDuringCreation() {
return Number(this.properties.numplayers)
}
getVictoryCondition() {
return Number(this.properties.victoryCondition)
}
setVictoryCondition(e) {
this.properties.victoryCondition = e
}
setProvinceConquerQuest(e) {
this.properties.questProvinceConquer = e
}
setPlayerSlotsDuringCreation(e) {
this.properties.numplayers = e
}
setAntiCheatLevel(e) {
this.properties.antiCheatLevel = e
}
setMinActivity(e) {
this.properties.minActivity = 86400 * e
}
getMinActivity() {
return Number(this.properties.minActivity) / 86400
}
getTimeScale() {
return Number(this.properties.timeScale ?? 1)
}
hasTimeScale() {
return 1 !== this.getTimeScale()
}
getTimeScaleAsMultiplier() {
return 1 / this.getTimeScale()
}
setAnonymousOption(e) {
this.properties.anonymousRound = e
}
isAnonymous() {
return 1 === Number(this.properties.anonymousRound)
}
getPeacePeriodDays() {
return this.properties.peacePeriod / 86400
}
getAIPeacePeriodDays() {
return this.properties.peacePeriodAI / 86400
}
setPeacePeriodDays(e) {
this.properties.peacePeriod = e
}
setAIPeacePeriodDays(e) {
this.properties.peacePeriodAI = e
}
isAntiCheatEnabled() {
return Number(this.properties.antiCheatLevel) > 0
}
isPasswordSet() {
return "no" !== this.properties.passwordset
}
getLogins() {
return this.logins
}
isPremium() {
var e;
return this.properties.hasOwnProperty("goldRound") ? Number(this.properties.goldRound) > 0 : !(Number(a.IZ.getMod().getOption("noGoldRounds")) > 0) && ((null === (e = this.getScenario()) || void 0 === e || !e.isEventScenario()) && l.W.all.some((e=>e.isPremium(this) && e.hasFeature(this))))
}
getAiLevel() {
return this.properties.aiLevel ?? r.q.NORMAL
}
setAiLevel(e) {
this.properties.aiLevel = e
}
setTitle(e) {
this.properties.title = e
}
setComment(e) {
this.properties.comment = e
}
setPassword(e) {
this.properties.password = e
}
getAllianceGame() {
return this.properties.allianceGame ? Number(this.properties.allianceGame) : n.m.NO_ALLIANCE_GAME
}
isAllianceGame() {
return this.getAllianceGame() !== n.m.NO_ALLIANCE_GAME
}
isInternalGame() {
return this.getAllianceGame() === n.m.INTERNAL_GAME
}
isChallengeGame() {
return this.getAllianceGame() === n.m.ALLIANCE_CHALLENGE
}
getOpponent() {
if (a.IZ.user.isAllianceMember()) {
if (Number(this.getAllianceAId()) === a.IZ.user.getAlliance().getID())
return this.getAllianceB();
if (Number(this.getAllianceBId()) === a.IZ.user.getAlliance().getID())
return this.getAllianceA()
}
return null
}
setAllianceGame(e) {
this.properties.allianceGame = e
}
getAllianceAId() {
return this.properties.allianceA
}
setAllianceAId(e) {
this.properties.allianceA = e
}
getAllianceA() {
return this.allianceA
}
setAllianceA(e) {
this.allianceA = e
}
getAllianceBId() {
return this.properties.allianceB
}
setAllianceBId(e) {
this.properties.allianceB = e
}
getAllianceB() {
return this.allianceB
}
setAllianceB(e) {
this.allianceB = e
}
getOpenChallenge() {
return this.properties.openChallenge
}
isOpenChallenge() {
return "1" == this.properties.openChallenge
}
setOpenChallenge(e) {
this.properties.openChallenge = e ? 1 : 0
}
isUserPartOfAllianceGame() {
const e = a.IZ.user.getAlliance()
, t = e ? e.getID() : -1
, i = this.getAllianceA().getID()
, s = this.getAllianceB().getID();
return t === i || t === s
}
canUserAcceptAllianceChallenge() {
if (a.IZ.user && a.IZ.user.isAllianceMember() && this.getAllianceBId() == a.IZ.user.getAlliance().getID()) {
const e = a.IZ.user.getAllianceMember();
return e.isLeader() || e.isModerator()
}
return !1
}
canUserCancelAllianceChallenge() {
if (a.IZ.user && a.IZ.user.isAllianceMember() && this.getAllianceAId() == a.IZ.user.getAlliance().getID()) {
const e = a.IZ.user.getAllianceMember();
return e.isLeader() || e.isModerator()
}
return !1
}
getSupportedFeatures() {
return l.W.supported(!0)
}
getFeatureIcons() {
return l.W.all.filter((e=>e.hasFeature(this) && e.hasIcon() && e.shouldBeVisible(this))).map((e=>e.getIcon(this)))
}
getUnrankedExplanation() {
const e = this.getScenario();
if (!e)
return y.w.getModdedText(y.w.MsgId.UNRANKED_REASON_WRONG_TITLE);
const t = Math.min(2, e.getMaxPlayers())
, i = Math.min(6, e.getMaxPlayers());
let s = ""
, r = !1;
if (this.isAntiCheatEnabled()) {
const e = this.getCurrentPlayerCount();
let n = 0;
const o = this.isPremium();
o && e < t ? n = t - e : !o && e < i && (n = i - e),
n > 0 ? (r = !0,
s = a.IZ.i18n.ngettext("Waiting for %s more player", "Waiting for %s more players", n)) : s = a.IZ.i18n.gettext("Ranked requirements not met.")
} else
s = a.IZ.i18n.gettext("Anti cheat is not enabled");
return r ? a.IZ.i18n.gettext("Soon ranked: %s", s) : a.IZ.i18n.gettext("Not ranked: %s", s)
}
open() {
this.isMyGame() ? f.openGame(this.getGameId()) : this.join()
}
isMyGame() {
return a.IZ.user.isMyGame(this.getGameId())
}
isArchived() {
return a.IZ.user.isArchivedGame(this.getGameId())
}
join(e) {
if (!this.isJoinPossible()) {
let e = a.IZ.i18n.gettext("Joining this round is not possible due to the following reason(s): ");
const t = this.getJoinFailReasons();
for (let i = 0; i < t.length; i++)
e += `\n- ${t[i]}`;
return void I.M.showMessage(e)
}
const t = `<span class="premium_dialog_game_entry_fee">${a.IZ.i18n.gettext("This is a premium round. Joining it will subtract %s from your inventory. Enjoy!", A.Z.formatPremiumCurrency(a.IZ.config.pcNeededForGoldround))}</span>`;
let i;
if ((!this.isPremium() || a.IZ.user.isPremium()) && !this.isPasswordSet())
e ? this.joinConfirmScenario("") : (this.isBetaGame() ? i = a.IZ.i18n.gettext("You are about to join a beta game. Beta games are meant for testing new features and finding bugs. Please report any problems with the bug report form. Thank you for testing!") : a.IZ.config.askForConfirmationOnGameJoin && (i = a.IZ.i18n.gettext("You are about to join this round. Enjoy!")),
i ? I.M.showConfirm("", i, "", {
confirmText: a.IZ.i18n.gettext("Join"),
showCancelButton: !0,
onConfirm: this.joinConfirmScenario.bind(this, "")
}) : this.joinConfirmScenario(""));
else if (this.isPasswordSet()) {
i = "",
this.isPremium() && !a.IZ.user.isPremium() && (i += t,
i += "<br/><br/>"),
i += a.IZ.i18n.gettext("Please enter the password:");
const e = this;
I.M.showInput("", i, "", {
onConfirm: e.joinConfirmScenario.bind(e),
inputType: T.a.password
})
} else {
const e = a.IZ.i18n.gettext("Premium round")
, i = a.IZ.i18n.gettext("Join");
I.M.showPremium(e, t, a.IZ.config.pcNeededForGoldround, this.joinConfirmScenario.bind(this, ""), i)
}
}
joinConfirmScenario(e) {
this.confirmScenario(this.joinConfirmed.bind(this, e))
}
confirmScenario(e) {
const t = this.getScenario();
null != t && t.getOption("isExperimentalOnMobile") && a.IZ.config.isMobileClient ? I.M.showConfirm(a.IZ.i18n.gettext("For the Brave!"), a.IZ.i18n.gettext("This is a very large map and its support on mobile is still experimental. It may be slow or even crash the app.\n If you experience problems, please consider playing this round with a PC on %s.", a.IZ.config.websiteURLNoProtocol), null, {
onConfirm: e,
skippableConfirmationID: `skipIsExperimentalOnMobileScen${t.getScenarioID()}`
}) : e()
}
joinConfirmed(e) {
a.IZ.hupwebapi.joinGame(a.IZ.config.userId, this.getGameId(), e, (e=>{
if (!a.IZ.hupwebapi.isWebAPIResponseOK(e))
return;
const t = e.result.gameID;
if (s.N.publish(m.q.UI_GAME_JOINED, {
gameID: t
}),
a.IZ.config.canLoadGamesWithoutRefresh) {
s.N.publish(m.q.UI_LOAD_GAME, {
gameID: t,
justJoined: !0
});
const e = d.n.getCurrentUser();
e.reloadMyGames(!0),
e.reloadInventory()
} else
a.IZ.gameServer.loadGame(t)
}
))
}
static openGame(e) {
if (a.IZ.user && a.IZ.user.games) {
const t = a.IZ.user.games.getGame(e);
if (t)
return void t.confirmScenario(f.privateLoadGame.bind(f, e))
}
this.privateLoadGame(e)
}
static privateLoadGame(e) {
a.IZ.config.canLoadGamesWithoutRefresh ? s.N.publish(m.q.UI_LOAD_GAME, {
gameID: e
}) : Number(e) === Number(a.IZ.config.userData.gameID) ? a.IZ.isGameLoaded() ? s.N.publish(m.q.UI_IN_GAME_UBER_CLOSE) : a.IZ.gameServer.loadGame(e, !1, !0) : a.IZ.gameServer.loadGame(e)
}
static joinGame(e, t) {
a.IZ.hupwebapi.joinGame(a.IZ.config.userId, e, t, (e=>{
if (!a.IZ.hupwebapi.isWebAPIResponseOK(e))
return;
const {gameID: t} = e.result;
s.N.publish(m.q.UI_GAME_JOINED, {
gameID: t
}),
f.openGame(t),
a.IZ.user.reloadMyGames(!0)
}
))
}
create(e) {
if (!this.isPremium() || a.IZ.user.isPremium() || this.isAllianceGame())
this.apiCreateGame(e);
else {
const t = a.IZ.i18n.gettext("Premium round")
, i = a.IZ.i18n.gettext("Create game")
, s = `<span class="premium_dialog_game_entry_fee">${a.IZ.i18n.gettext("This is a premium round. Joining it will subtract %s from your inventory. Enjoy!", A.Z.formatPremiumCurrency(a.IZ.config.pcNeededForGoldround))}</span>`;
I.M.showPremium(t, s, a.IZ.config.pcNeededForGoldround, this.apiCreateGame.bind(this, e), i)
}
}
getSimilarGames(e) {
this.apiGetSuggestedGame(e)
}
getStartTimeInSeconds() {
return Number(this.properties.startofgame2)
}
getEndTimeInSeconds() {
return Number(this.properties.endofgame2)
}
isFinished() {
const e = this.getEndTimeInSeconds()
, t = Date.now() / 1e3;
return e > 0 && e < t
}
apiCreateGame(e) {
this.properties.language = a.IZ.config.userDataLocal.lang,
a.IZ.hupwebapi.createGame(this.properties, (t=>{
a.IZ.hupwebapi.isWebAPIResponseOK(t) && (e(t.result),
d.n.getCurrentUser().reloadInventory())
}
))
}
apiGetSuggestedGame(e) {
a.IZ.hupwebapi.setAsync(!1),
this.properties.language = a.IZ.config.userDataLocal.lang;
const t = {
...this.properties
};
t.suggestGames = 1,
a.IZ.hupwebapi.createGame(t, (t=>{
if (!a.IZ.hupwebapi.isWebAPIResponseOK(t))
return;
let i = [];
t && t.result && Array.isArray(t.result.games) && (i = t.result.games),
e(i)
}
)),
a.IZ.hupwebapi.setAsync(!0)
}
static searchMyGames(e) {
a.IZ.hupwebapi.getMyGames(a.IZ.config.userData.siteUserID, (t=>{
e(t.result)
}
))
}
static searchGames(e, t) {
a.IZ.hupwebapi.getGlobalGames(e, (e=>f.onSearchGamesLoaded(e, t)))
}
static findQuickJoinGame(e, t) {
a.IZ.hupwebapi.getGames({
quickJoinGame: 1,
scenarioID: e,
lang: a.IZ.config.userDataLocal.lang
}, (e=>f.onSearchGamesLoaded(e, t)))
}
static onSearchGamesLoaded(e, t) {
if (a.IZ.hupwebapi.isWebAPIResponseOK(e)) {
let i = []
, s = !0;
e.result && e.result.games && (i = e.result.games.filter((e=>!!e.getScenario())),
s = !!e.result.lastPage),
t(i, s)
}
}
getFreeSlotsForTeam(e) {
if (!this.logins || this.getNumberOfTeams() < 1)
return this.getOpenSlots();
const t = Math.floor(this.getNrOfPlayers() / this.getNumberOfTeams())
, i = {};
for (let s = 0; s < this.logins.length; s++)
i[this.logins[s].teamID] = i[this.logins[s].teamID] + 1 || 1;
return i.hasOwnProperty(e) ? t - i[e] : t
}
isSystemGeneratedGame() {
return !!this.properties.isSystemGame
}
isSpecialGame() {
var e;
return (null === (e = this.getScenario()) || void 0 === e ? void 0 : e.canBeHighlighted()) && (this.isSystemGeneratedGame() || this.isEventGame())
}
getMinRank() {
return Number(this.properties.minRank) || 0
}
getMaxRank() {
return Number(this.properties.maxRank)
}
getUserLastLoginTimeInSeconds() {
const e = Number(this.properties.userLastLoggedin);
return Number.isNaN(e) ? 0 : e
}
getPlayerID() {
const e = Number(this.properties.playerID);
return Number.isNaN(e) ? 0 : Math.max(0, e)
}
getProperty(e) {
return this.properties[e]
}
getPlayerFlagURL() {
let e = null;
const t = this.getPlayerID();
if (t) {
e = `images/flags/${this.getScenario().getMapID()}/small_${t}.png`
}
return e
}
getTimeSinceLastLoginHR() {
const e = this.getUserLastLoginTimeInSeconds();
if (!e)
return "";
const t = Date.now() / 1e3 - e;
return A.Z.formatTimer(t, !0, 2)
}
getScenarioNameParts() {
const e = this.getScenario();
return e ? e.getScenarioNameParts() : []
}
getMaxPlayerCount() {
const e = this.getScenario();
return e ? e.getMaxPlayers() : 0
}
getCurrentPlayerCount() {
return this.getNrOfPlayers() - this.getOpenSlots()
}
isEventGame() {
const e = this.getScenario();
return e && e.isEventScenario()
}
isTooLateToJoin() {
if (!this.isAntiCheatEnabled() || this.isPasswordSet())
return !1;
const e = this.getScenario()
, t = e ? e.getMaxJoinDay() : 0;
return t > 0 && this.getDayOfGame() > t
}
static compareGamesGlobal(e, t) {
const i = e.isSpecialGame() ? (e.isSystemGeneratedGame() ? 1e3 : 0) + (e.isEventGame() ? 1e4 : 0) + (e.mayJoin() ? 1e3 : 0) : 0
, s = (t.isSpecialGame() ? (t.isSystemGeneratedGame() ? 1e3 : 0) + (t.isEventGame() ? 1e4 : 0) + (t.mayJoin() ? 1e3 : 0) : 0) - i
, r = e.getDayOfGame() - t.getDayOfGame();
return s || r
}
static compareUserGames(e, t) {
return t.getUserLastLoginTimeInSeconds() - e.getUserLastLoginTimeInSeconds()
}
static openMyGamesOrJoinNewOne() {
const e = a.IZ.hupwebapi.isAsync();
a.IZ.hupwebapi.setAsync(!1),
a.IZ.user.reloadMyGames(!1, (t=>{
t.getNumGames(u.G.Normal) > 2 ? S.W.openRunningGames() : f.joinGame(),
a.IZ.hupwebapi.setAsync(e)
}
))
}
static currentGame = null;
static requestCurrentGame() {
this.currentGame = null;
const {gameID: e} = a.IZ.config.userData;
e && a.IZ.hupwebapi.getGame(e, (e=>{
e.result instanceof f && (this.currentGame = e.result)
}
))
}
static getCurrentGame() {
var e;
return Number(null === (e = this.currentGame) || void 0 === e ? void 0 : e.getGameId()) !== a.IZ.config.userData.gameID && (this.currentGame = null),
this.currentGame
}
static checkGameCreationAllowed() {
const e = d.n.getCurrentUser();
return !!e.canCreateAGame() || (e.gameCreationRestrictedWithoutHighCommand() ? s.N.publish(p.f.UI_SHOW_HIGH_COMMAND_REQUIRED) : s.N.publish(p.f.UI_GAME_CREATION_NOT_ALLOWED),
!1)
}
}
a.IZ.model.games.Game = f
}
,
55804: (e,t,i)=>{
i.d(t, {
G: ()=>a,
c: ()=>o
});
var s = i(55542)
, r = i(39513)
, n = i(83964);
const a = {
Normal: 0,
Archived: 1,
Unknown: -1
};
class o {
constructor() {
this.normal = null,
this.archived = null
}
addGame(e, t) {
this.getGames(t)[e.getGameId()] = e
}
getGame(e) {
return this.normal[e] || this.archived[e]
}
getGameMode(e) {
return this.normal[e] ? a.Normal : a.Archived
}
isArchived(e) {
return null != this.archived[e]
}
isNormal(e) {
return null != this.normal[e]
}
setGames(e, t) {
e = e || [];
let i = null;
t == a.Archived ? i = this.archived = {} : t == a.Normal && (i = this.normal = {}),
e.forEach((function(e) {
i[e.getGameId()] = e
}
))
}
getGames(e) {
let t = [];
return e == a.Archived ? t = this.archived : e == a.Normal && (t = this.normal),
t
}
areAllGamesLoaded() {
return this.archived && this.normal
}
getNumGames(e) {
const t = this.getGames(e);
return t ? Object.keys(t).length : 0
}
getTotalNumGames() {
return (this.normal && Object.keys(this.normal).length || 0) + (this.archived && Object.keys(this.archived).length || 0)
}
move(e) {
const t = this.getGameMode(e)
, i = function() {
s.N.publish(n.f.UI_USER_GAME_MOVED, t)
}
, o = this.getGame(e);
t == a.Normal ? (this.addGame(o, a.Archived),
r.IZ.hupwebapi.moveGameToArchive(parseInt(e), i)) : t == a.Archived && (this.addGame(o, a.Normal),
r.IZ.hupwebapi.moveGameToMyGames(parseInt(e), i)),
delete this.getGames(t)[e]
}
}
}
,
48867: (e,t,i)=>{
i.d(t, {
r: ()=>n
});
var s = i(53121)
, r = i(29486);
i(60105);
class n extends r.v {
getKey() {
return "allianceGame"
}
mayJoin(e, t) {
return e = e || hup.user,
!this.hasFeature(t) || this.isPartOfGameAlliances(e, t) && this.hasOpenTeamSlotsForCurrentUser(t)
}
isPartOfGameAlliances(e, t) {
if (!e.isAllianceMember())
return !1;
const i = e.getAlliance().getID();
return i == t.getAllianceAId() || i == t.getAllianceBId()
}
hasOpenTeamSlotsForCurrentUser(e) {
const t = this.getCurrentUsersAlliancesTeam(e);
return e.getFreeSlotsForTeam(t) > 0
}
getJoinFailReason(e, t) {
return this.isPartOfGameAlliances(e, t) ? hup.i18n.gettext("No open slots for alliance game.") : hup.i18n.gettext("No alliance membership")
}
getCurrentUsersAlliancesTeam(e) {
const t = hup.user.getAlliance();
if (t instanceof s.v) {
const i = e.getLogins();
for (let e = 0; e < i.length; e++) {
if (null !== t.getUser(parseInt(i[e].siteUserID)))
return parseInt(i[e].teamID)
}
}
return 0
}
getFeatureCategory() {
return r.v.Category.Advanced
}
getName() {
return hup.i18n.gettext("Alliance game")
}
getDescription(e, t) {
return this.getName()
}
}
}
,
35944: (e,t,i)=>{
i.d(t, {
j: ()=>n
});
var s = i(39513)
, r = i(29486);
class n extends r.v {
getSearchModel() {
return {
featureKey: this.getKey(),
options: [{
value: -1,
text: s.IZ.i18n.gettext("All anonymous round options"),
selected: !0
}, {
value: 0,
text: s.IZ.i18n.gettext("No anonymous round")
}, {
value: 1,
text: s.IZ.i18n.gettext("Only anonymous rounds")
}]
}
}
getName() {
return s.IZ.i18n.gettext("Anonymous round")
}
getValueHR(e) {
return this.hasFeature(e) ? s.IZ.i18n.gettext("Yes") : s.IZ.i18n.gettext("No")
}
getKey() {
return "anonymousRound"
}
hasIcon() {
return !0
}
isPremium() {
return !0
}
getDescription(e, t) {
return e ? this.getName() : s.IZ.i18n.gettext("It will not be visible which character in the game is played by which user until the game ends.")
}
}
}
,
80107: (e,t,i)=>{
i.d(t, {
y: ()=>n
});
var s = i(39513)
, r = i(29486);
class n extends r.v {
constructor() {
super(),
this.advanced = !0
}
getSearchModel() {
let e = [{
value: -1,
text: s.IZ.i18n.gettext("All Anti-Cheat modes"),
selected: !0
}];
return e = e.concat(this.getFeatureOptions()),
{
featureKey: this.getKey(),
options: e
}
}
getFeatureOptions(e) {
return [{
value: 0,
text: e ? s.IZ.i18n.gettext("No") : s.IZ.i18n.gettext("No Anti-Cheat")
}, {
value: 1,
selected: e,
text: e ? s.IZ.i18n.gettext("Yes") : s.IZ.i18n.gettext("Only Anti-Cheat")
}]
}
getName() {
return s.IZ.i18n.gettext("Anti-Cheat")
}
getKey() {
return "antiCheatLevel"
}
getDescription(e, t) {
return e ? s.IZ.i18n.gettext("Enabled anti-cheat protection") : s.IZ.i18n.gettext("The anti-cheat system prohibits logins from multiple users that share the same PC or internet connection to more than one account in that round. Trying to do so will permanently ban those accounts from that round.\nGames with disabled anti-cheat system are not ranked.")
}
getValueHR(e) {
return parseInt(this.getValue(e), 10) ? s.IZ.i18n.gettext("Enabled") : s.IZ.i18n.gettext("Disabled")
}
getFeatureCategory() {
return r.v.Category.Advanced
}
}
}
,
36827: (e,t,i)=>{
i.d(t, {
T: ()=>o
});
i(87477);
var s = i(29486)
, r = i(38530)
, n = i(72053)
, a = i(33558);
class o extends s.v {
getSearchModel() {
if (!n.n.getCurrentUser().hasBetaRights())
return null;
let e = [{
value: -1,
text: a.w.getModdedText(a.w.MsgId.GF_ALCHEMIST_GAME_SEARCH_OPTION_ALL),
selected: !0
}];
return e = e.concat(this.getFeatureOptions()),
{
featureKey: this.getKey(),
options: e
}
}
getFeatureOptions(e) {
const t = [{
value: 0,
text: e ? hup.i18n.gettext("No") : a.w.getModdedText(a.w.MsgId.GF_ALCHEMIST_GAME_SEARCH_OPTION_NO)
}, {
value: 2,
text: e ? hup.i18n.gettext("Yes") : a.w.getModdedText(a.w.MsgId.GF_ALCHEMIST_GAME_SEARCH_OPTION_ONLY)
}];
return r.W.checkAdminUser(hup.user) && t.push({
value: 1,
text: "Release candidate only"
}),
t
}
getName() {
return a.w.getModdedText(a.w.MsgId.GF_ALCHEMIST_GAME_TITLE)
}
getValueHR(e) {
if (r.W.checkAdminUser(hup.user)) {
const t = parseInt(this.getValue(e), 10);
return t >= 3 ? "Alpha" : 2 === t ? "Beta" : 1 === t ? "RC" : "Live"
}
return this.hasFeature(e) ? hup.i18n.gettext("Yes") : hup.i18n.gettext("No")
}
hasIcon() {
return !0
}
hasFeature(e) {
return e.properties[this.getKey()] >= 2
}
getKey() {
return "betaGame"
}
getDescription(e) {
return e ? a.w.getModdedText(a.w.MsgId.GF_ALCHEMIST_GAME_TITLE) : a.w.getModdedText(a.w.MsgId.GF_ALCHEMIST_GAME_DESC)
}
}
}
,
13742: (e,t,i)=>{
i.d(t, {
G: ()=>a
});
var s = i(39513)
, r = i(29486)
, n = i(33558);
class a extends r.v {
getSearchModel() {
return {
featureKey: this.getKey(),
options: [{
value: -1,
text: n.w.getModdedText(n.w.MsgId.GF_COUNTRY_CHOOSER_ALL_MODES),
selected: !0
}, {
value: 0,
text: s.IZ.i18n.gettext("Only random")
}, {
value: 1,
text: s.IZ.i18n.gettext("Only free selection")
}]
}
}
getName() {
return n.w.getModdedText(n.w.MsgId.GF_COUNTRY_CHOOSER_TITLE)
}
getValueHR(e) {
return this.hasFeature(e) ? s.IZ.i18n.gettext("Free selection") : s.IZ.i18n.gettext("Random")
}
hasIcon() {
return !0
}
getKey() {
return "countrySelection"
}
getDescription(e, t) {
return e ? n.w.getModdedText(n.w.MsgId.GF_COUNTRY_CHOOSER_TITLE) : s.IZ.i18n.gettext("If free selection is enabled all players can select a starting position of their choice.")
}
}
}
,
29486: (e,t,i)=>{
i.d(t, {
v: ()=>s
});
class s {
constructor() {
this.advanced = !1
}
static Category = {
Mandatory: 0,
Main: 1,
Simple: 2,
Advanced: 3
};
getKey() {
return ""
}
hasFeature(e) {
return e.properties[this.getKey()] > 0
}
isPremium(e) {
return !1
}
getSearchModel() {
return {}
}
getDescription(e, t) {
return ""
}
hasIcon() {
return !1
}
getName() {
return ""
}
getValue(e) {
return e ? e.getProperty(this.getKey()) : null
}
getValueHR(e) {
return this.getDescription(!0, e)
}
mayJoin(e, t) {
return !0
}
getJoinFailReason(e, t) {
return ""
}
getFeatureCategory() {
return s.Category.Simple
}
getIcon(e) {
return this.hasIcon() ? {
key: this.getKey(),
description: this.getDescription(!0, e)
} : null
}
getIconIndex(e) {
return 0
}
shouldBeVisible(e) {
return !0
}
}
}
,
65112: (e,t,i)=>{
i.d(t, {
W: ()=>s
});
i(10711);
class s {
static supported(e) {
throw new Error("un-implemented by client-specific game feature config")
}
static all = []
}
}
,
58623: (e,t,i)=>{
i.d(t, {
y: ()=>n
});
var s = i(29486)
, r = i(6266);
class n extends s.v {
getKey() {
return "minRank"
}
mayJoin(e, t) {
if (e = e || hup.user,
this.hasFeature(t)) {
const i = r.t.instance(t.getMinRank());
if (i)
return e.getRank().getLevel() >= i.getLevel()
}
return !0
}
getJoinFailReason(e, t) {
return this.getDescription(!0, t)
}
getName() {
return hup.i18n.gettext("Minimum rank")
}
getDescription(e, t) {
if (t) {
const e = r.t.instance(t.getMinRank());
return e ? hup.i18n.gettext("Min. rank required: Lvl. %s", e.getLevel()) : ""
}
return e ? this.getName() : hup.i18n.gettext("Defines a minimum rank to join this game")
}
hasIcon() {
return !0
}
getIcon(e) {
return e ? this.hasIcon() ? {
key: `minRank_${this.getIconIndex(e)}`,
description: this.getDescription(!0, e)
} : null : this.hasIcon() ? {
key: "minRank_0",
description: this.getDescription()
} : null
}
getIconIndex(e) {
if (e) {
const t = r.t.instance(e.getMinRank());
if (t)
return t.getIconIndex()
}
return super.getIconIndex(e)
}
getFeatureCategory() {
return s.v.Category.Advanced
}
getValueHR(e) {
const t = parseInt(this.getValue(e), 10);
return t ? r.t.instance(t).getFullTitle() : hup.i18n.gettext("Not set")
}
}
}
,
42405: (e,t,i)=>{
i.d(t, {
d: ()=>l
});
var s = i(61809)
, r = i(39513)
, n = i(29486)
, a = i(81216)
, o = i(13775);
class l extends a.t {
constructor() {
super(),
this.advanced = !0
}
getSearchModel() {
const e = [{
value: -1,
text: r.IZ.i18n.gettext("All AI peace period options"),
selected: !0
}, {
value: 0,
text: r.IZ.i18n.gettext("No AI peace period")
}, {
value: 1,
text: r.IZ.i18n.gettext("AI Peace period")
}];
return {
featureKey: this.getKey(),
options: e
}
}
getName() {
return r.IZ.i18n.gettext("Peace period days for NPCs")
}
getKey() {
return "peacePeriodAI"
}
getDescription(e, t) {
if (e) {
if (t) {
return parseInt(this.getValue(t), 10) > 0 ? r.IZ.i18n.ngettext("%s day of AI player peace period", "%s days of AI player peace period", s.gV(t.getAIPeacePeriodDays())) : r.IZ.i18n.gettext("No NPC peace period")
}
return r.IZ.i18n.gettext("Contains non-player characters peace period.")
}
return r.IZ.i18n.gettext("Number of days that have to pass before non-player characters (NPCs) can be attacked.")
}
getValueName() {
return 0 == this.value ? this.valueName : o.Z.formatTimer(s.gV(this.value))
}
getFeatureCategory() {
return n.v.Category.Advanced
}
}
r.IZ.model.games.features.PeacePeriodAIFeature = l
}
,
81216: (e,t,i)=>{
i.d(t, {
t: ()=>o
});
var s = i(61809)
, r = i(39513)
, n = i(29486)
, a = i(13775);
class o extends n.v {
constructor() {
super(),
this.advanced = !0
}
getSearchModel() {
const e = [{
value: -1,
text: r.IZ.i18n.gettext("All peace period options"),
selected: !0
}, {
value: 0,
text: r.IZ.i18n.gettext("No peace period")
}, {
value: 1,
text: r.IZ.i18n.gettext("Peace period")
}];
return {
featureKey: this.getKey(),
options: e
}
}
getName() {
return r.IZ.i18n.gettext("Peace period days")
}
getKey() {
return "peacePeriod"
}
hasIcon() {
return !0
}
getDescription(e, t) {
if (e) {
if (t) {
return parseInt(this.getValue(t), 10) > 0 ? r.IZ.i18n.ngettext("%s day of human player peace period", "%s days of human player peace period", s.gV(t.getPeacePeriodDays())) : r.IZ.i18n.gettext("No peace period")
}
return r.IZ.i18n.gettext("Contains human player peace period.")
}
return r.IZ.i18n.gettext("Number of days that have to pass before human players can be attacked.")
}
getValueName() {
return 0 == this.value ? this.valueName : a.Z.formatTimer(s.gV(this.value))
}
getFeatureCategory() {
return n.v.Category.Advanced
}
}
r.IZ.model.games.features.PeacePeriodFeature = o
}
,
1877: (e,t,i)=>{
i.d(t, {
A: ()=>n
});
var s = i(39513)
, r = i(29486);
class n extends r.v {
getName() {
return s.IZ.i18n.gettext("Number of players")
}
getKey() {
return "numplayers"
}
getFeatureCategory() {
return r.v.Category.Simple
}
getDescription(e, t) {
let i = "";
return t && (i = s.IZ.i18n.gettext("Up to %s players", t.getMaxPlayerCount())),
i
}
}
}
,
94778: (e,t,i)=>{
i.d(t, {
u: ()=>n
});
var s = i(39513)
, r = i(29486);
class n extends r.v {
constructor() {
super(),
this.advanced = !0
}
getName() {
return s.IZ.i18n.gettext("Reinforcements")
}
getKey() {
return "questProvinceConquer"
}
hasIcon() {
return !0
}
getDescription(e, t) {
return e ? s.IZ.i18n.gettext("Enabled supply drops") : s.IZ.i18n.gettext("This option enables the possibility of supply drops appearing in this game. Supply drops can be conquered to receive rewards.")
}
getSearchModel() {
return {
featureKey: this.getKey(),
options: [{
value: -1,
text: s.IZ.i18n.gettext("All supply modes"),
selected: !0
}, {
value: 0,
text: s.IZ.i18n.gettext("No supplies")
}, {
value: 1,
text: s.IZ.i18n.gettext("With supplies")
}]
}
}
}
}
,
23158: (e,t,i)=>{
i.d(t, {
M: ()=>a
});
i(87477);
var s = i(39513)
, r = i(29486)
, n = i(97978);
class a extends r.v {
getName() {
return s.IZ.i18n.gettext("Scenario")
}
getSearchModel() {
const e = [{
value: -1,
text: s.IZ.i18n.gettext("All maps")
}].concat(this.getScenarioOptions());
return {
featureKey: this.getKey(),
options: e
}
}
getScenarioOptions(e) {
const t = n.d.getScenarios()
, i = [];
for (const s in t)
if (t.hasOwnProperty(s)) {
const r = t[s];
e && r.isJoinOnly() || !r.isAvailable() || !r.shouldUserSeeScenario() || i.push({
value: r.getScenarioID(),
text: `${r.getName()} (${r.getMaxPlayers()})`,
scenario: r
})
}
return i
}
getKey() {
return "scenarioID"
}
isPremium(e) {
return !(!e || !e.getScenario()) && e.getScenario().isGoldFeature()
}
getDescription(e, t) {
return null
}
getFeatureCategory() {
return r.v.Category.Mandatory
}
}
}
,
80896: (e,t,i)=>{
i.d(t, {
E: ()=>r
});
var s = i(29486);
class r extends s.v {
constructor() {
super(),
this.advanced = !0
}
hasFeature(e) {
return 0 == e.properties[this.getKey()]
}
getName() {
return hup.i18n.gettext("Start of game")
}
getKey() {
return "startofgame2"
}
hasIcon() {
return !0
}
getDescription(e, t) {
return e ? hup.i18n.gettext("Starts when full") : hup.i18n.gettext("If 'when full' is selected, game will start when all free slots are taken by players")
}
getValueHR(e) {
return this.hasFeature(e) ? hup.i18n.gettext("Starts when full") : hup.i18n.gettext("Starts right away")
}
getFeatureCategory() {
return s.v.Category.Simple
}
}
}
,
3332: (e,t,i)=>{
i.d(t, {
b: ()=>l
});
var s = i(28766)
, r = i(39513)
, n = i(29486)
, a = i(85665)
, o = i(60105);
r.IZ.model.games.features.TeamModes = {
NONE: "NONE",
FREE: "FREE",
SCENARIO: "SCENARIO",
DYNAMIC: "DYNAMIC"
},
r.IZ.model.games.features.TeamModeValues = {
[r.IZ.model.games.features.TeamModes.DYNAMIC]: 0,
[r.IZ.model.games.features.TeamModes.FREE]: 1,
[r.IZ.model.games.features.TeamModes.NONE]: 3
},
r.IZ.model.games.features.TeamModeCreationNumberIds = {
freeTeams: "freeTeams",
scenTeams: "scenTeams"
};
class l extends n.v {
getSearchModel() {
const e = r.IZ.model.games.features.TeamModeValues;
return {
featureKey: this.getKey(),
options: [{
value: -1,
text: r.IZ.i18n.gettext("All team modes"),
selected: !0
}, {
value: e[r.IZ.model.games.features.TeamModes.NONE],
text: r.IZ.i18n.gettext("No Coalitions")
}, {
value: e[r.IZ.model.games.features.TeamModes.DYNAMIC],
text: r.IZ.i18n.gettext("Coalitions")
}, {
value: e[r.IZ.model.games.features.TeamModes.FREE],
text: r.IZ.i18n.gettext("Free Teams")
}]
}
}
isPremium(e) {
if (r.IZ.getMod().getStringOption(a.f.OPTION_FREE_TEAM_MODE))
return !1;
if (e) {
const t = e.getTeamSetting();
return t === r.IZ.model.games.features.TeamModes.FREE || t === r.IZ.model.games.features.TeamModes.SCENARIO
}
return !e || e.getAllianceGame() === s.m.NO_ALLIANCE_GAME
}
getName() {
return r.IZ.i18n.gettext("Team Settings")
}
getKey() {
return "teamSettings"
}
hasIcon() {
return !0
}
getSecondaryKey() {
return "freeTeams"
}
getDescription(e, t) {
let i = null;
if (e) {
const e = t.properties[this.getKey()];
i = e === o.c.NONE ? r.IZ.i18n.gettext("No Coalitions") : e === o.c.DYNAMIC ? r.IZ.i18n.gettext("Coalitions") : e === o.c.SCENARIO ? r.IZ.i18n.gettext("Scenario teams") : r.IZ.i18n.gettext("Team game")
} else
i = r.IZ.i18n.gettext("With Coalitions enabled players can create or join Coalitions within the game. Members of the same Coalition can win the game together. A team fights together throughout the whole round. Backstabbing among team members is not possible. With 'Free Teams' selected everyone can choose their team freely at the start of the round.");
return i
}
hasFeature(e) {
return e.properties[this.getKey()] !== o.c.NONE
}
getIcon(e) {
const t = e.properties[this.getKey()];
let i = null;
return i = t === o.c.NONE ? "noCoalition" : t === o.c.DYNAMIC ? "coalition" : this.getKey(),
{
key: i,
description: this.getDescription(!0, e)
}
}
}
}
,
89180: (e,t,i)=>{
i.d(t, {
y: ()=>a
});
var s = i(39513)
, r = i(29486)
, n = i(13775);
class a extends r.v {
getName() {
return s.IZ.i18n.gettext("Speed")
}
getValueHR(e) {
const t = e.getTimeScaleAsMultiplier();
return `${n.Z.formatNumber(t)}x`
}
getKey() {
return "timeScale"
}
hasIcon() {
return !0
}
getDescription(e, t) {
return e ? s.IZ.i18n.gettext("%sx speed", n.Z.formatNumber(t.getTimeScaleAsMultiplier())) : this.getName()
}
shouldBeVisible(e) {
return 1 !== e.getTimeScaleAsMultiplier()
}
}
}
,
72568: (e,t,i)=>{
i.d(t, {
p: ()=>a
});
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.AILevel)
}
getName() {
return r.IZ.i18n.gettext("AI Level")
}
getDefaultValue() {
return 1
}
canBeChanged() {
return !1
}
}
}
,
2481: (e,t,i)=>{
i.d(t, {
Y: ()=>o
});
var s, r = i(52558), n = i(39513), a = i(21783);
!function(e) {
e[e.NoChallenge = 0] = "NoChallenge",
e[e.Challenge = 1] = "Challenge"
}(s || (s = {}));
class o extends a.Q {
allianceChallenge = !1;
constructor(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
super(e, r.n.AllianceChallenge),
this.allianceChallenge = t
}
getName() {
return n.IZ.i18n.gettext("Alliance challenge")
}
getDefaultValue() {
return this.allianceChallenge ? s.Challenge : s.NoChallenge
}
canBeChanged() {
return !1
}
}
}
,
18462: (e,t,i)=>{
i.d(t, {
z: ()=>a
});
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
allianceGameType = 0;
constructor(e, t) {
let i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0
, r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
super(e, s.n.AllianceGame),
this.allianceGameType = t,
this.game.setAllianceAId(i),
this.game.setAllianceBId(r)
}
getName() {
return r.IZ.i18n.gettext("Alliance game")
}
getDefaultValue() {
return this.allianceGameType
}
canBeChanged() {
return !1
}
}
}
,
83757: (e,t,i)=>{
i.d(t, {
o: ()=>o
});
var s, r = i(52558), n = i(39513), a = i(21783);
!function(e) {
e[e.Disabled = 0] = "Disabled",
e[e.Enabled = 1] = "Enabled"
}(s || (s = {}));
class o extends a.Q {
constructor(e) {
super(e, r.n.AnonymousRound)
}
getName() {
return n.IZ.i18n.gettext("Anonymous round")
}
getDescription() {
return n.IZ.i18n.gettext("It will not be visible which character in the game is played by which user until the game ends.")
}
getOptions() {
return [s.Enabled, s.Disabled]
}
getOptionName(e) {
return e === s.Enabled ? n.IZ.i18n.gettext("Yes") : n.IZ.i18n.gettext("No")
}
getDefaultValue() {
return s.Disabled
}
needsPremium() {
return this.getValue() === s.Enabled
}
}
}
,
11699: (e,t,i)=>{
i.d(t, {
S: ()=>o
});
var s, r = i(52558), n = i(39513), a = i(21783);
!function(e) {
e[e.Disabled = 0] = "Disabled",
e[e.Enabled = 1] = "Enabled"
}(s || (s = {}));
class o extends a.Q {
constructor(e) {
super(e, r.n.AntiCheatLevel)
}
getName() {
return n.IZ.i18n.gettext("Anti-Cheat")
}
getDescription() {
return n.IZ.i18n.gettext("The anti-cheat system prohibits logins from multiple users that share the same PC or internet connection to more than one account in that round. Trying to do so will permanently ban those accounts from that round.\nGames with disabled anti-cheat system are not ranked.")
}
getOptions() {
return [s.Disabled, s.Enabled]
}
getOptionName(e) {
return e === s.Enabled ? n.IZ.i18n.gettext("Yes") : n.IZ.i18n.gettext("No")
}
getDefaultValue() {
return s.Enabled
}
}
}
,
22055: (e,t,i)=>{
i.d(t, {
h: ()=>h
});
i(87477);
var s = i(57884)
, r = i(52558)
, n = i(39513)
, a = i(21783)
, o = i(38530)
, l = i(72053)
, u = i(33558);
class h extends a.Q {
constructor(e) {
super(e, r.n.BetaGameLevel)
}
getName() {
return u.w.getModdedText(u.w.MsgId.GF_ALCHEMIST_GAME_TITLE)
}
getDescription() {
return u.w.getModdedText(u.w.MsgId.GF_ALCHEMIST_GAME_DESC)
}
getOptions() {
const e = [s.Y.Live, s.Y.Beta];
return o.W.checkAdminUser(l.n.getCurrentUser()) && e.push(s.Y.RC),
e
}
getOptionName(e) {
return e === s.Y.Live ? n.IZ.i18n.gettext("No") : e === s.Y.Beta ? n.IZ.i18n.gettext("Yes") : e === s.Y.RC ? "RC" : "?"
}
getDefaultValue() {
return s.Y.Live
}
canBeChanged() {
return n.IZ.config.userDataLocal.betaUser
}
}
}
,
38873: (e,t,i)=>{
i.d(t, {
c: ()=>l
});
var s, r = i(52558), n = i(39513), a = i(21783), o = i(33558);
!function(e) {
e[e.Random = 0] = "Random",
e[e.CountryChooser = 1] = "CountryChooser"
}(s || (s = {}));
class l extends a.Q {
constructor(e) {
super(e, r.n.CountrySelection)
}
getName() {
return o.w.getModdedText(o.w.MsgId.GF_COUNTRY_CHOOSER_TITLE)
}
getDescription() {
return n.IZ.i18n.gettext("If free selection is enabled all players can select a starting position of their choice.")
}
getOptions() {
return [s.CountryChooser, s.Random]
}
getOptionName(e) {
return e === s.CountryChooser ? n.IZ.i18n.gettext("Free selection") : n.IZ.i18n.gettext("Random")
}
getDefaultValue() {
return s.Random
}
}
}
,
79194: (e,t,i)=>{
i.d(t, {
O: ()=>a
});
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.GameComment)
}
getName() {
return r.IZ.i18n.gettext("Comment")
}
getDefaultValue() {
return ""
}
}
}
,
88513: (e,t,i)=>{
i.d(t, {
w: ()=>a
});
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.GameLanguage)
}
getName() {
return r.IZ.i18n.gettext("Game language")
}
getDefaultValue() {
return r.IZ.config.userDataLocal.lang
}
canBeChanged() {
return !1
}
}
}
,
48723: (e,t,i)=>{
i.d(t, {
V: ()=>a
});
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.GamePassword)
}
getName() {
return r.IZ.i18n.gettext("Password")
}
getDefaultValue() {
return ""
}
}
}
,
21783: (e,t,i)=>{
i.d(t, {
Q: ()=>s
});
class s {
constructor(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
this.game = e,
this.propertyKey = t
}
getDescription() {
return this.getName()
}
initialize(e) {
this.onChangeCallback = e,
this.setValue(this.getDefaultValue())
}
reevaluate() {}
getPropertyKey() {
return this.propertyKey
}
getValue() {
return this.game.getProperty(this.propertyKey)
}
setValue(e) {
this.game.properties[this.propertyKey] = e
}
changeValue(e) {
var t;
this.setValue(e),
null === (t = this.onChangeCallback) || void 0 === t || t.call(this)
}
needsPremium() {
return !1
}
canBeChanged() {
return !0
}
getOptions() {
return null
}
getOptionName(e) {
return e
}
}
}
,
48009: (e,t,i)=>{
i.d(t, {
e: ()=>a
});
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.GameTitle)
}
getName() {
return r.IZ.i18n.gettext("Title")
}
getDefaultValue() {
return r.IZ.i18n.gettext("Game of %s", r.IZ.user.getName(!1))
}
}
}
,
39327: (e,t,i)=>{
i.d(t, {
z: ()=>a
});
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.MaxRank)
}
getName() {
return r.IZ.i18n.gettext("Maximum rank")
}
getDefaultValue() {
return 0
}
canBeChanged() {
return !1
}
}
}
,
75919: (e,t,i)=>{
i.d(t, {
e: ()=>a
});
i(87477);
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.MinActivity)
}
getName() {
return r.IZ.i18n.gettext("Max inactivity")
}
getDescription() {
return r.IZ.i18n.gettext("Number of days (in a row) that a user may stay inactive before the game admin can replace him.")
}
getOptions() {
const e = [];
for (let t = 2; t <= 5; t++)
e.push(86400 * t);
return e
}
getOptionName(e) {
return "" + e / 86400
}
getDefaultValue() {
return 432e3
}
}
}
,
87258: (e,t,i)=>{
i.d(t, {
R: ()=>l
});
var s = i(52558)
, r = i(39513)
, n = i(21783)
, a = i(90058)
, o = i(6266);
class l extends n.Q {
constructor(e) {
super(e, s.n.MinRank)
}
getName() {
return r.IZ.i18n.gettext("Minimum rank")
}
getDescription() {
return r.IZ.i18n.gettext("Defines a minimum rank to join this game")
}
getOptions() {
let e = Object.values(o.t.getRanks());
const t = this.getScenarioMinRank();
return t && (e = e.filter((e=>e.getLevel() >= t.getLevel()))),
e.map((e=>Number(e.getItemID())))
}
getRank(e) {
return o.t.getRanks()[e] ?? null
}
getDefaultValue() {
const e = this.getScenarioMinRank();
return e ? e.getItemID() : Object.values(o.t.getRanks()).sort(((e,t)=>e.getMinPoints() - t.getMinPoints()))[0].getItemID()
}
reevaluate() {
(arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null)instanceof a.D && this.changeValue(this.getDefaultValue())
}
getScenarioMinRank() {
return o.t.getRankByItemId(this.game.getScenario().getMinRank() ?? -1)
}
}
}
,
17227: (e,t,i)=>{
i.d(t, {
K: ()=>a
});
i(87477);
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.PeacePeriodAI)
}
getName() {
return r.IZ.i18n.gettext("Peace period days for NPCs")
}
getDescription() {
return r.IZ.i18n.gettext("Number of days that have to pass before non-player characters (NPCs) can be attacked.")
}
getOptions() {
const e = [];
for (let t = 0; t <= 14; t++)
e.push(t);
return e
}
getDefaultValue() {
return 0
}
}
}
,
21633: (e,t,i)=>{
i.d(t, {
W: ()=>a
});
i(87477);
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.PeacePeriod)
}
getName() {
return r.IZ.i18n.gettext("Peace period days")
}
getDescription() {
return r.IZ.i18n.gettext("Number of days that have to pass before human players can be attacked.")
}
getOptions() {
const e = [];
for (let t = 0; t <= 14; t++)
e.push(t);
return e
}
getDefaultValue() {
return 0
}
}
}
,
33197: (e,t,i)=>{
i.d(t, {
O: ()=>o
});
i(87477);
var s = i(52558)
, r = i(39513)
, n = i(21783)
, a = i(90058);
class o extends n.Q {
constructor(e) {
super(e, s.n.PlayerCount)
}
getName() {
return r.IZ.i18n.gettext("Number of players")
}
getMinPlayers() {
let e = this.game.getScenario().getMinPlayers();
return this.game.isChallengeGame() && e < 8 && (e = 8),
e
}
getMaxPlayers() {
return this.game.getScenario().getMaxPlayers()
}
getOptions() {
const e = [];
for (let t = this.getMinPlayers(); t <= this.getMaxPlayers(); t++)
this.game.isChallengeGame() && t % 2 != 0 || e.push(t);
return e
}
getDefaultValue() {
return this.game.getScenario().getSuggestedNumberOfPlayers()
}
reevaluate(e) {
e instanceof a.D && this.changeValue(this.getDefaultValue())
}
}
}
,
41985: (e,t,i)=>{
i.d(t, {
S: ()=>l
});
var s, r = i(52558), n = i(39513), a = i(21783), o = i(90058);
!function(e) {
e[e.Disabled = 0] = "Disabled",
e[e.Enabled = 1] = "Enabled"
}(s || (s = {}));
class l extends a.Q {
constructor(e) {
super(e, r.n.QuestProvinceConquer)
}
getName() {
return n.IZ.i18n.gettext("Reinforcements")
}
getDescription() {
return n.IZ.i18n.gettext("This option enables the possibility of supply drops appearing in this game. Supply drops can be conquered to receive rewards.")
}
getOptions() {
return [s.Enabled, s.Disabled]
}
getOptionName(e) {
return e === s.Enabled ? n.IZ.i18n.gettext("Yes") : n.IZ.i18n.gettext("No")
}
getDefaultValue() {
return this.canBeChanged() ? s.Enabled : s.Disabled
}
reevaluate(e) {
e instanceof o.D && (this.game.getScenario().isQuestProvinceConquerFeatureEnabled() ? this.setValue(this.getDefaultValue()) : this.setValue(s.Disabled))
}
canBeChanged() {
return !!this.supportsQuests() && this.game.getScenario().isQuestProvinceConquerFeatureEnabled()
}
supportsQuests() {
return n.IZ.getMod().hasQuests()
}
}
}
,
90058: (e,t,i)=>{
i.d(t, {
D: ()=>o
});
var s = i(52558)
, r = i(39513)
, n = i(21783)
, a = i(97978);
class o extends n.Q {
constructor(e) {
super(e, s.n.Scenario)
}
getName() {
return r.IZ.i18n.gettext("Scenario")
}
needsPremium() {
return this.game.getScenario().isGoldFeature()
}
getOptions() {
return Object.values(a.d.getScenarios()).filter((e=>!e.isJoinOnly() && e.isAvailable() && e.shouldUserSeeScenario())).map((e=>Number(e.getScenarioID())))
}
getScenario(e) {
return a.d.getScenarios()[e] ?? null
}
getDefaultValue() {
return this.getOptions()[0]
}
}
}
,
73984: (e,t,i)=>{
i.d(t, {
X: ()=>a
});
i(87477);
var s = i(52558)
, r = i(39513)
, n = i(21783);
class a extends n.Q {
constructor(e) {
super(e, s.n.TeamCount)
}
getName() {
return r.IZ.i18n.gettext("Number of teams")
}
getDescription() {
return ""
}
getOptions() {
if (this.game.isChallengeGame())
return [2];
const e = this.game.getScenario()
, t = e.getMinTeams()
, i = e.getMaxTeams()
, s = [];
for (let r = t; r <= i; r++)
s.push(r);
return s
}
getDefaultValue() {
return this.game.isChallengeGame() ? 2 : this.game.getScenario().getSuggestedNumberOfTeams()
}
reevaluate() {
this.getOptions().includes(this.getValue()) || this.setValue(this.getDefaultValue())
}
canBeChanged() {
if (this.game.getScenario().getMaxTeams() < 1)
return !1;
if (this.getOptions().length < 2)
return !1;
const e = this.game.getTeamSetting();
return [r.IZ.model.games.features.TeamModes.FREE, r.IZ.model.games.features.SCENARIO].includes(e)
}
}
}
,
813: (e,t,i)=>{
i.d(t, {
X: ()=>l
});
i(87477);
var s, r = i(52558), n = i(39513), a = i(21783), o = i(85665);
!function(e) {
e.NoTeams = "NONE",
e.OnlyTeams = "FREE",
e.OnlyScenarioTeams = "SCENARIO",
e.OnlyCoalitions = "DYNAMIC"
}(s || (s = {}));
class l extends a.Q {
constructor(e) {
super(e, r.n.TeamMode)
}
getName() {
return n.IZ.i18n.gettext("Team Settings")
}
getDescription() {
return n.IZ.i18n.gettext("With Coalitions enabled players can create or join Coalitions within the game. Members of the same Coalition can win the game together. A team fights together throughout the whole round. Backstabbing among team members is not possible. With 'Free Teams' selected everyone can choose their team freely at the start of the round.")
}
getDefaultValue() {
const e = this.getOptions();
return e.includes(s.OnlyCoalitions) ? s.OnlyCoalitions : e[0]
}
getOptions() {
if (this.game.isChallengeGame())
return [s.OnlyTeams];
if (this.isTeamScenarioOnly() || !this.canHaveCoalitions())
return [];
const e = [s.NoTeams, s.OnlyCoalitions];
return this.supportsScenarioTeamMode() && e.push(s.OnlyScenarioTeams),
this.getMaxScenarioTeams() > 0 && e.push(s.OnlyTeams),
e
}
getOptionName(e) {
return e === s.NoTeams ? n.IZ.i18n.gettext("No Coalitions") : e === s.OnlyTeams ? n.IZ.i18n.gettext("Free Teams") : e === s.OnlyScenarioTeams ? n.IZ.i18n.gettext("Scenario Teams") : e === s.OnlyCoalitions ? n.IZ.i18n.gettext("Coalitions") : ""
}
reevaluate() {
const e = this.getValue();
this.getOptions().includes(e) || this.setValue(this.getDefaultValue())
}
needsPremium() {
if (n.IZ.getMod().getStringOption(o.f.OPTION_FREE_TEAM_MODE))
return !1;
const e = this.game.getTeamSetting();
return e === s.OnlyTeams || e === s.OnlyScenarioTeams
}
canBeChanged() {
return !this.game.isChallengeGame()
}
isTeamScenarioOnly() {
return this.game.getScenario().isTeamScenarioOnly()
}
canHaveCoalitions() {
return !this.game.getScenario().hasNoCoalitions()
}
supportsScenarioTeamMode() {
return this.game.getScenario().supportsScenarioTeamMode()
}
getMaxScenarioTeams() {
return this.game.getScenario().getMaxTeams()
}
}
}
,
17292: (e,t,i)=>{
i.d(t, {
w: ()=>o
});
var s, r = i(52558), n = i(39513), a = i(21783);
!function(e) {
e[e.Standard = 0] = "Standard",
e[e.Supremacy = 1] = "Supremacy",
e[e.Domination = 2] = "Domination"
}(s || (s = {}));
class o extends a.Q {
constructor(e) {
super(e, r.n.VictoryCondition)
}
getName() {
return n.IZ.i18n.gettext("Victory conditions")
}
getDescription() {
return n.IZ.i18n.gettext("Decide when the game should end. (Thresholds are higher in team mode.)")
}
getOptions() {
return [s.Standard, s.Domination, s.Supremacy]
}
getOptionName(e) {
return e === s.Standard ? n.IZ.i18n.gettext("Standard (50%)") : e === s.Domination ? n.IZ.i18n.gettext("Domination (75%)") : n.IZ.i18n.gettext("Supremacy (100%)")
}
getDefaultValue() {
return s.Standard
}
needsPremium() {
return Number(this.getValue()) !== s.Standard
}
}
}
,
57106: (e,t,i)=>{
i.d(t, {
y: ()=>o
});
var s, r = i(52558), n = i(39513), a = i(21783);
!function(e) {
e.WhenFull = "FULL",
e.RightNow = "NOW"
}(s || (s = {}));
class o extends a.Q {
constructor(e) {
super(e, r.n.WhenToStartGameProperty)
}
getName() {
return n.IZ.i18n.gettext("Start of game")
}
getDescription() {
return n.IZ.i18n.gettext("If 'when full' is selected, game will start when all free slots are taken by players")
}
getOptions() {
return [s.WhenFull, s.RightNow]
}
getOptionName(e) {
return e === s.WhenFull ? n.IZ.i18n.gettext("When full") : n.IZ.i18n.gettext("Now")
}
getDefaultValue() {
return s.RightNow
}
}
}
,
18940: (e,t,i)=>{
i.d(t, {
p: ()=>r
});
var s = i(39513);
class r {
constructor() {
this.properties = {},
this.defendScript = ""
}
getName() {
return this.properties.name || r.defaultSpec().getName()
}
getDefendScript() {
let e = this.defendScript;
return e = `<script>${e}<\/script>`,
(new DOMParser).parseFromString(e, "text/html").head.textContent
}
getData() {
return this.properties.data || r.defaultSpec().getData()
}
static defaultSpec() {
const e = new r;
return e.properties.name = "rubicon",
e.properties.data = {
width: "160",
height: "728",
rpSite: "54116",
rpZoneSize: "250178-9",
rpVisitor: {}
},
e.defendScript = "",
e
}
}
s.IZ.model.AdProviderSpec = r
}
,
89149: (e,t,i)=>{
i.d(t, {
t: ()=>n
});
var s = i(39513)
, r = i(5127);
class n extends r.J {
constructor(e) {
super(e),
this.skipConstructionTime = e.skipConstructionTime
}
getConsumptionFeedbackText() {
return s.IZ.i18n.gettext("%s Construction time", this.getSkipTimeFormatted())
}
getAmount() {
return this.skipConstructionTime
}
}
}
,
80574: (e,t,i)=>{
i.d(t, {
P: ()=>n
});
var s = i(21773)
, r = i(13775);
class n extends s.L {
constructor(e) {
super(e),
this.hitpointBoost = e.hitpointBoost
}
getAmount() {
return this.hitpointBoost
}
getAmountFormatted() {
return r.Z.formatNumber(this.getAmount(), void 0, !0)
}
}
}
,
21773: (e,t,i)=>{
i.d(t, {
L: ()=>r
});
var s = i(31830);
class r extends s.y {
consuming = !1;
constructor(e) {
super(e),
this.description = e.description,
this.itemID = e.itemID
}
getConsumptionFeedbackText() {
return this.name
}
setConsuming(e) {
this.consuming = e
}
isConsuming() {
return this.consuming
}
}
}
,
43669: (e,t,i)=>{
i.d(t, {
V: ()=>n
});
var s = i(21773)
, r = i(13775);
class n extends s.L {
constructor(e) {
super(e),
this.moraleBoost = e.moraleBoost
}
getAmount() {
return this.moraleBoost
}
getAmountFormatted() {
return r.Z.formatPercentage(this.getAmount(), !0)
}
}
}
,
62887: (e,t,i)=>{
i.d(t, {
x: ()=>n
});
var s = i(39513)
, r = i(5127);
class n extends r.J {
constructor(e) {
super(e),
this.skipProductionTime = e.skipProductionTime
}
getConsumptionFeedbackText() {
return s.IZ.i18n.gettext("%s Production time", this.getSkipTimeFormatted())
}
getAmount() {
return this.skipProductionTime
}
}
}
,
97955: (e,t,i)=>{
i.d(t, {
G: ()=>n
});
var s = i(39513)
, r = i(5127);
class n extends r.J {
constructor(e) {
super(e),
this.skipResearchTime = e.skipResearchTime
}
getConsumptionFeedbackText() {
return s.IZ.i18n.gettext("%s Research time", this.getSkipTimeFormatted())
}
getAmount() {
return this.skipResearchTime
}
}
}
,
83206: (e,t,i)=>{
i.d(t, {
G: ()=>a
});
var s = i(21773)
, r = i(13775)
, n = i(33558);
class a extends s.L {
constructor(e) {
super(e),
this.resourceID = e.resourceID,
this.amount = e.amount
}
getAmount() {
return this.amount
}
getAmountFormatted() {
return r.Z.formatNumber(this.getAmount(), void 0, !0)
}
getShortName() {
return n.w.getModdedText(n.w.MsgId.RESOURCE_NAME, this.resourceID)
}
}
}
,
5127: (e,t,i)=>{
i.d(t, {
J: ()=>a
});
var s = i(39513)
, r = i(21773)
, n = i(13775);
class a extends r.L {
getSkipTime() {
var e, t;
let i = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
const r = this.getAmount();
return i ? r : r * ((null === (e = s.IZ.gameState) || void 0 === e || null === (t = e.getGameInfoState()) || void 0 === t ? void 0 : t.getTimeScale()) ?? 1)
}
getSkipTimeFormatted(e) {
return `-${n.Z.formatTimer(this.getSkipTime(e), !0)}`
}
getAmountFormatted() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
return this.getSkipTimeFormatted(e)
}
}
}
,
31830: (e,t,i)=>{
i.d(t, {
y: ()=>n
});
var s = i(39513)
, r = i(13775);
class n {
constructor(e) {
this.name = e.name,
this.itemCount = e.itemCount ?? 1,
this.priority = e.priority,
this.type = e.type,
this.group = e.group,
this.newItemCount = e.newItemCount ?? 0
}
getItemCount() {
return this.itemCount
}
setItemCount(e) {
this.itemCount = e
}
getShortName() {
return s.IZ.ModdableI18n.getInventorySystemItemNameByType(this.type) || this.name
}
getContentsHR() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
return `${r.Z.formatNumber(this.getItemCount())}x ${this.getShortName()} ${this.getAmountFormatted(e)}`
}
}
}
,
23293: (e,t,i)=>{
i.d(t, {
N: ()=>n
});
var s = i(31830)
, r = i(13775);
class n extends s.y {
constructor(e) {
super(e),
this.moraleBoost = e.moraleBoost
}
getAmount() {
return this.moraleBoost
}
getAmountFormatted() {
return r.Z.formatPercentage(this.getAmount(), !0)
}
}
}
,
47732: (e,t,i)=>{
i.d(t, {
b: ()=>a
});
var s = i(31830)
, r = i(13775)
, n = i(33558);
class a extends s.y {
constructor(e) {
super(e),
this.resourceID = e.resourceID,
this.amount = e.amount
}
getAmount() {
return this.amount
}
getAmountFormatted() {
return r.Z.formatNumber(this.getAmount(), void 0, !0)
}
getShortName() {
return n.w.getModdedText(n.w.MsgId.RESOURCE_NAME, this.resourceID)
}
}
}
,
91276: (e,t,i)=>{
i.d(t, {
L: ()=>n
});
var s = i(39513)
, r = i(13607);
class n extends r.t {
constructor(e) {
super(e),
this.skipConstructionTime = e.skipConstructionTime
}
getConsumptionFeedbackText() {
return s.IZ.i18n.gettext("%s Construction time", this.getSkipTimeFormatted())
}
getAmount() {
return this.skipConstructionTime
}
}
}
,
2889: (e,t,i)=>{
i.d(t, {
D: ()=>n
});
var s = i(39513)
, r = i(13607);
class n extends r.t {
constructor(e) {
super(e),
this.skipProductionTime = e.skipProductionTime
}
getConsumptionFeedbackText() {
return s.IZ.i18n.gettext("%s Production time", this.getSkipTimeFormatted())
}
getAmount() {
return this.skipProductionTime
}
}
}
,
35638: (e,t,i)=>{
i.d(t, {
H: ()=>n
});
var s = i(39513)
, r = i(13607);
class n extends r.t {
constructor(e) {
super(e),
this.skipResearchTime = e.skipResearchTime
}
getConsumptionFeedbackText() {
return s.IZ.i18n.gettext("%s Research time", this.getSkipTimeFormatted())
}
getAmount() {
return this.skipResearchTime
}
}
}
,
13607: (e,t,i)=>{
i.d(t, {
t: ()=>a
});
var s = i(39513)
, r = i(31830)
, n = i(13775);
class a extends r.y {
getSkipTime() {
var e, t;
let i = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
const r = this.getAmount();
return i ? r : r * ((null === (e = s.IZ.gameState) || void 0 === e || null === (t = e.getGameInfoState()) || void 0 === t ? void 0 : t.getTimeScale()) ?? 1)
}
getSkipTimeFormatted(e) {
return `-${n.Z.formatTimer(this.getSkipTime(e), !0)}`
}
getAmountFormatted() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
return this.getSkipTimeFormatted(e)
}
}
}
,
72683: (e,t,i)=>{
var s = i(39513)
, r = i(46435);
class n extends r.P {
constructor() {
super(),
this.targetTitleID = null,
this.ssoLink = null
}
getTargetTitleID() {
return this.targetTitleID
}
getSSOLink() {
return this.ssoLink
}
}
s.IZ.model.marketing.CrossTitlePromotionNotification = n
}
,
46435: (e,t,i)=>{
i.d(t, {
P: ()=>n
});
var s = i(39513)
, r = i(17490);
class n {
constructor() {
this.userAnswer = -1,
this.notificationPriority = 0
}
answerSurvey(e) {
this.getPopupCategory() == r.a.COW_POPUP_CAT_NEWS && -1 == this.userAnswer && (this.userAnswer = e,
s.IZ.hupwebapi.setSurveyAnswer(this.getId(), e))
}
getId() {
return this.surveyID
}
getImageUrl() {
return this.image
}
getImageEvent() {
return this.imgEvent
}
getText() {
return this.text
}
getPopupCategory() {
return this.popupCategory
}
getTargetedMarketingCampaign() {
return this.campaign
}
getRankItemId() {
return this.itemID
}
getAwardItemId() {
return this.itemID
}
getSuggestedGame() {
return this.game
}
getOKButtonText() {
return this.okButtonText
}
getOKButtonEvent() {
return this.okButtonEvent
}
getSurveyTitle() {
return this.surveyTitle
}
shouldRemoveAfterRead() {
return this.getPopupCategory() == r.a.POPUP_SHOP_TRANSACTION_COMPLETE
}
getRewardOffer() {
return this.rewardOffer
}
getPriority() {
return this.notificationPriority
}
isSameNotification(e) {
return this.getPopupCategory() === e.getPopupCategory() && (this.getPriority() === e.getPriority() && (this.getPopupCategory() !== r.a.COW_POPUP_CAT_TM || this.campaign.getId() === e.getTargetedMarketingCampaign().getId()))
}
}
s.IZ.model.marketing.Notification = n
}
,
21098: (e,t,i)=>{
i.d(t, {
r: ()=>a
});
var s = i(39513)
, r = i(40947)
, n = i(13775);
class a {
offerScaleFactor = 1;
constructor() {
this.browserStartTime = Math.round(Date.now() / 1e3)
}
showScaling() {
var e, t;
return Boolean(null === (e = this.extraSettings) || void 0 === e || null === (t = e.style) || void 0 === t ? void 0 : t.showScaling)
}
getStampStyleDefinition() {
var e, t;
return {
x: 0,
y: 0,
scale: 1,
...(null === (e = this.extraSettings) || void 0 === e || null === (t = e.style) || void 0 === t ? void 0 : t.stamp) || {}
}
}
getTimerStyleDefinition() {
var e, t;
return {
x: 0,
y: 0,
scale: 1,
...(null === (e = this.extraSettings) || void 0 === e || null === (t = e.style) || void 0 === t ? void 0 : t.timer) || {}
}
}
getRelativeBonus() {
return Math.round(100 * (this.getScaleFactor() - 1))
}
getRelativeBonusHR() {
return s.IZ.i18n.gettext("%s%%", this.getRelativeBonus())
}
getScaleFactor() {
return this.offerScaleFactor
}
hasEffectiveScalingFactor() {
return this.offerScaleFactor > 1
}
getCampaignType() {
return this.campaignType
}
getCategoryID() {
switch (this.getCampaignType()) {
case "egm":
return r.q.EarnGold.ID;
case "pa":
return r.q.PremiumAccount.ID;
default:
return r.q.PremiumCurrency.ID
}
}
isOfferwallCampaign() {
return "egm" === this.getCampaignType()
}
isInviteFriendCampaign() {
return "share" === this.getCampaignType()
}
getId() {
return this.id
}
shouldShowAgain(e) {
return e < Math.round(Date.now() / 1e3) - this.getReminderTime()
}
getReminderTime() {
return this.reminderTime
}
getUserStartTime() {
return this.userStartTime
}
getServerOffset() {
return this.serverTime - this.browserStartTime
}
getDuration() {
return this.duration
}
hasTimeLeft() {
return this.getTimeLeft() > 0
}
getTimeLeft() {
const e = Math.round(Date.now() / 1e3) - this.getUserStartTime() - this.getServerOffset();
return Math.max(0, this.getDuration() - e)
}
getTimeLeftHR() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]
, t = 2;
return this.getTimeLeft() > 86400 ? t = 4 : this.getTimeLeft() > 3600 && (t = 3),
e ? n.Z.formatTimer(this.getTimeLeft(), !!t) : n.Z.formatTimerTiny(this.getTimeLeft(), t)
}
getCustomTextMap() {
return this.customTextMap || {}
}
getCustomTitleTextMap() {
return this.getCustomTextMap().titleTextMap || {}
}
getCustomBodyTextMap() {
return this.getCustomTextMap().bodyTextMap || {}
}
getCustomAcceptTextMap() {
return this.getCustomTextMap().acceptTextMap || {}
}
getCustomDeclineTextMap() {
return this.getCustomTextMap().declineTextMap || {}
}
getCustomTitleText() {
const e = this.getCustomTitleTextMap();
return e[s.IZ.config.userDataLocal.lang] || e.en
}
getCustomBodyText() {
const e = this.getCustomBodyTextMap();
return e[s.IZ.config.userDataLocal.lang] || e.en
}
getCustomAcceptText() {
const e = this.getCustomAcceptTextMap();
return e[s.IZ.config.userDataLocal.lang] || e.en
}
getCustomDeclineText() {
const e = this.getCustomDeclineTextMap();
return e[s.IZ.config.userDataLocal.lang] || e.en
}
hasCustomImage() {
return !!this.getCustomImageURL()
}
hasCustomTitleText() {
return !!this.getCustomTitleText()
}
hasCustomBodyText() {
return !!this.getCustomBodyText()
}
hasCustomAcceptText() {
return !!this.getCustomAcceptText()
}
hasCustomDeclineText() {
return !!this.getCustomDeclineText()
}
getCustomImageURL() {
return (s.IZ.config.isMobileClient ? this.customMobileImageURL : this.customImageURL) ?? ""
}
getCustomTeaserTemplateId() {
var e;
return (null === (e = this.extraSettings) || void 0 === e ? void 0 : e.customTeaserTemplateId) ?? ""
}
isGlobalOffer() {
var e;
return (null === (e = this.extraSettings) || void 0 === e ? void 0 : e.isGlobalOffer) ?? !1
}
shouldHideTeaser() {
var e;
return !(null === (e = this.extraSettings) || void 0 === e || !e.hideTeaser)
}
shouldHideTimer() {
var e;
return !(null === (e = this.extraSettings) || void 0 === e || !e.hideTimer)
}
}
s.IZ.model.marketing.TargetedMarketingCampaign = a
}
,
4770: (e,t,i)=>{
i.d(t, {
v: ()=>a
});
var s = i(58834)
, r = i(32910)
, n = i(39513);
n.IZ.model.pm || (n.IZ.model.pm = {});
class a {
constructor(e) {
this.details = e || {},
this.date = this.details.crdate || 0
}
getID() {
return this.details.uid
}
getSender() {
return this.details.sender
}
getSenderID() {
return this.details.from_uid
}
getReceiver() {
return this.details.receiver
}
getReceiverID() {
return this.details.to_uid
}
getSubject() {
return this.details.subject
}
isUnread() {
return 1 !== Number(this.details.read_flg)
}
markAsRead() {
this.details.read_flg = 1
}
getDate() {
return this.details.crdate
}
getMessage() {
return this.details.message
}
getMessageDirection() {
return this.getSender() ? n.IZ.i18n.gettext("From") : n.IZ.i18n.gettext("To")
}
getMessageTarget() {
return this.getReceiver() || this.getSender()
}
getVisibility() {
return this.isSystemMessage() ? a.isMessageTypeFilterActive(r.K.SYSTEM) : a.isMessageTypeFilterActive(r.K.PLAYER)
}
getMessageTargetID() {
return this.getReceiver() ? this.getReceiverID() : this.getSenderID()
}
getAvatarURL() {
return this.details.senderAvatarURL || this.details.receiverAvatarURL
}
getMessageBR() {
if (this.isSystemMessage())
return nl2br(this.details.message);
const e = this.details.message || "";
return nl2br(e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"))
}
isSystemMessage() {
return n.IZ.config.systemMessageUIDs.system === Number(this.getSenderID())
}
isPaymentSupportMessage() {
return n.IZ.config.systemMessageUIDs.payment_support === Number(this.getSenderID())
}
isUserSystemMessage() {
return n.IZ.config.systemMessageUIDs.user_system === Number(this.getSenderID())
}
isUserSupportMessage() {
return n.IZ.config.systemMessageUIDs.user_support === Number(this.getSenderID())
}
canReply() {
const e = Number(this.details.from_uid)
, t = n.IZ.config.systemMessageUIDs;
return ![t.system, t.payment_support].includes(e)
}
static getFromApi(e, t) {
n.IZ.hupwebapi.getMessage(e, (e=>{
if (!n.IZ.hupwebapi.isWebAPIResponseOK(e))
return;
const i = new a(e.result);
t(i)
}
))
}
static sendMessage(e, t, i, s, r) {
n.IZ.hupwebapi.sendMessage(e, t, i, s, (e=>{
n.IZ.hupwebapi.isWebAPIResponseOK(e) && r(e)
}
))
}
static setRead(e, t) {
n.IZ.hupwebapi.updateMessage(e, "markRead", (e=>{
n.IZ.hupwebapi.isWebAPIResponseOK(e) && (t(e),
n.IZ.user.reloadUnreadMessages())
}
))
}
static setDelete(e, t) {
n.IZ.hupwebapi.updateMessage(e, "delete", (e=>{
n.IZ.hupwebapi.isWebAPIResponseOK(e) && t(e)
}
))
}
static setArchived(e, t) {
n.IZ.hupwebapi.updateMessage(e, "archive", (e=>{
n.IZ.hupwebapi.isWebAPIResponseOK(e) && t(e)
}
))
}
static isMessageTypeFilterActive(e) {
return !s.P.hasItem(`${e}MessageVisibility`) || s.P.getBool(`${e}MessageVisibility`)
}
static toggleMessageTypeFilter(e) {
const t = `${e}MessageVisibility`
, i = a.isMessageTypeFilterActive(e);
return s.P.set(t, !i),
!i
}
}
window.Message = a
}
,
68686: (e,t,i)=>{
i.d(t, {
Q: ()=>n
});
i(87477);
var s = i(39513)
, r = i(4770);
s.IZ.model.pm || (s.IZ.model.pm = {});
class n {
constructor(e) {
this.messages = [],
this.numberOfPages = 0,
e && (Array.isArray(e.entries) && this.setMessages(e.entries),
e.numPages && (this.numberOfPages = e.numPages))
}
getMessages() {
return this.messages
}
getNumberOfPages() {
return this.numberOfPages
}
setMessages(e) {
this.messages = [];
for (let t = 0; t < e.length; t++) {
const i = new r.v(e[t]);
this.messages.push(i)
}
}
static getFromApi(e, t, i, r, a, o) {
s.IZ.hupwebapi.getMessages(e, t, i, r, a, (function(e) {
if (!s.IZ.hupwebapi.isWebAPIResponseOK(e))
return;
const t = new n(e.result);
o(t)
}
))
}
}
}
,
41368: (e,t,i)=>{
i.d(t, {
T: ()=>r
});
var s = i(87874);
class r {
rewardedAdPlacement = "";
rewardedAdName = "gold";
status = s.Qn.LOCKED;
offerImageNameSuffix = 0;
constructor(e, t, i, s, r, n) {
this.updateModel(e, t, i, s, r, n)
}
shouldShowDoubledEvent() {
var e;
return !!this.offer && !("double" !== (null === (e = this.offer.extraSettings) || void 0 === e ? void 0 : e.event) || !this.offer.getInventoryIngameAmount())
}
updateModel(e, t, i, s, r, n) {
this.rewards = e,
this.rewardedAdPlacement = t,
this.status = s,
this.rewardedAdName = i.toLocaleLowerCase(),
this.offer = r,
this.offerImageNameSuffix = n
}
updateStatus(e) {
this.status = e
}
}
}
,
81346: (e,t,i)=>{
let s;
i.d(t, {
Z: ()=>s
}),
function(e) {
e.INGAME_WATCH_AD_BUTTON_CLICKED = "ingame_watch_ad_button_clicked",
e.OPENED = "opened",
e.CLOSED = "closed",
e.CLOSED_NO_REWARD = "closed_no_reward",
e.STARTED = "started",
e.ENDED = "ended",
e.REWARDED = "rewarded",
e.CLICKED = "clicked",
e.ERROR = "error"
}(s || (s = {}))
}
,
87874: (e,t,i)=>{
let s, r, n;
i.d(t, {
DB: ()=>r,
E2: ()=>n,
Qn: ()=>s
}),
function(e) {
e.CLAIMABLE = "claimable",
e.CLAIMED = "claimed",
e.LOCKED = "locked",
e.WAITING_S2S_CALLBACK = "waiting_s2s_callback"
}(s || (s = {})),
function(e) {
e.AVAILABLE = "0",
e.VIEWING = "1",
e.VIEWED = "2"
}(r || (r = {})),
function(e) {
e[e.IRON_SOURCE = 1] = "IRON_SOURCE",
e[e.QUALITY_MATCH = 2] = "QUALITY_MATCH"
}(n || (n = {}))
}
,
53065: (e,t,i)=>{
var s = i(39513)
, r = i(65814);
class n extends r.y {
amount = 1;
isPossible() {
return this.getPlayerAircraft().length >= this.amount
}
isFinished() {
return this.getPlayerAircraft().filter((e=>e.isPatrolling())).length >= this.amount
}
getPlayerAircraft() {
return s.IZ.gameState.getArmyState().getNationArmiesArray(s.IZ.config.userData.playerID).filter((e=>e.isAirplane() && !e.isRocket() && !e.isKamikaze()))
}
}
s.IZ.model.strategicadviser.AirplanePatrolAdvice = n
}
,
73671: (e,t,i)=>{
var s = i(64842)
, r = i(39513)
, n = i(65814)
, a = i(97879);
class o extends n.y {
constructor() {
super(),
this.attackConfigurationDomain = null,
this._attackConfiguration = null,
this.amount = 1
}
clearCache() {
this._attackConfiguration = null
}
getAllEnemyProvinces(e) {
const t = r.IZ.gameState.getMapState();
return Object.values(r.IZ.gameState.getPlayerState().getPlayers()).filter((e=>e.isPassiveAI() && e.isEnemy())).flatMap((e=>t.getProvincesForPlayer(e.getPlayerID()))).filter((t=>!e || !this.isProvinceUnderAttack(t)))
}
getAttackingArmyCount() {
return this.getAllEnemyProvinces(!1).filter((e=>this.isProvinceUnderAttack(e))).length
}
isPossible() {
if (this.getAttackingArmyCount() >= this.amount)
return !1;
if (null == this.getAttackConfiguration())
return !1;
const {targetProvince: e} = this.getAttackConfiguration()
, t = this.getAttackConfiguration().army;
return null != e && null != t && !this.isProvinceUnderAttack(e)
}
getAttackConfiguration() {
if (this._attackConfiguration)
return this._attackConfiguration;
if ("closest" === this.attackConfigurationDomain) {
const e = this.getAllEnemyProvinces(!0)
, t = Object.values(r.IZ.gameState.getArmyState().getNationArmies(r.IZ.config.userData.playerID)).filter((e=>!(e.isShip() || e.isAirplane())));
let i = -1
, n = -1
, a = Math.max(r.IZ.ui.mapWidget.mapSize.height, r.IZ.ui.mapWidget.mapSize.width);
for (let r = 0; r < t.length; r++) {
const o = t[r].getPosition();
for (let t = 0; t < e.length; t++) {
const l = e[t].getCapital()
, u = s.E.distance(o, l);
u < a && (a = u,
i = t,
n = r)
}
}
if (n >= 0 && i >= 0)
return this._attackConfiguration = {
army: t[n],
targetProvince: e[i]
},
this._attackConfiguration
}
return null
}
showHowTo() {
const e = this.getAttackConfiguration();
null != e.army && null != e.targetProvince && this.startAssistingTask(new a.R(e.army,e.targetProvince))
}
isProvinceUnderAttack(e) {
return Object.values(r.IZ.gameState.getArmyState().getNationArmies(r.IZ.config.userData.playerID)).find((t=>t.hasCommandForProvinceInvasion(e)))
}
isSuccessfulPreAdviserTask() {
return !0
}
getNextProvinces() {
return this._attackConfiguration && this._attackConfiguration.targetProvince ? [this._attackConfiguration.targetProvince] : []
}
getRemainingAmount() {
return 1
}
}
r.IZ.model.strategicadviser.AttackProvinceAdvice = o
}
,
65814: (e,t,i)=>{
i.d(t, {
y: ()=>p
});
i(87477);
var s = i(58834)
, r = i(55542)
, n = i(4432)
, a = i(39513)
, o = i(81777);
class l {
constructor(e) {
this.initializeDefaults(),
e && this.initializeFromAdvice(e)
}
initializeDefaults() {
this.adviser = "economic",
this.status = n.M.Available,
this.premiumRewardMap = {},
this.resourceRewardMap = {},
this.unitRewardMap = {},
this.inventoryRewards = [],
this.inventoryRewardIcon = o.K.None
}
initializeFromAdvice(e) {
this.adviceHandler = e,
this.adviseID = e.adviseID,
this.title = e.getFormattedTitle(),
this.windowTitle = e.getFormattedWindowTitle(),
this.imageURL = e.imageURL || null,
this.text = e.getFormattedText(),
this.tip = e.getFormattedTip(),
this.successText = e.getFormattedSuccessText(),
this.adviser = e.adviser || this.adviser,
this.avatarType = e.avatarType || this.adviser,
this.icon = e.getIcon(),
this.videoURL = e.videoURL,
this.adviceIndex = e.adviceIndex,
this.isPreAdviser = e.isPreAdviserTask() || !1,
this.unread = e.unread,
this.premiumRewardMap = e.getPremiumRewardMap() || this.premiumRewardMap,
this.resourceRewardMap = e.getResourceRewardMap() || this.resourceRewardMap,
this.unitRewardMap = e.getUnitRewardMap() || this.unitRewardMap,
this.inventoryRewards = e.getInventoryItemRewards() || this.inventoryRewards,
this.inventoryRewardIcon = e.getInventoryItemRewardIcon() || this.inventoryRewardIcon,
this.rewardCollected = e.isRewardCollected(),
this.hasGuidance = e.hasGuidance(),
this.status = e.getState(),
this.collecting = e.collecting
}
isDone() {
return this.status === n.M.Done
}
hasRewards() {
var e, t;
return null === (e = this.adviceHandler) || void 0 === e || null === (t = e.getAdviseReward()) || void 0 === t ? void 0 : t.hasReward()
}
canCollectRewards() {
return this.isDone() && this.hasRewards() && !this.adviceHandler.isRewardCollected()
}
}
a.IZ.model.strategicadviser.AdviceModel = l;
var u = i(87542)
, h = i(45051)
, g = i(36593)
, c = i(87928)
, d = i(78402);
class p {
constructor() {
this.adviseID = null,
this.title = "",
this.windowTitle = "",
this.text = "",
this.tip = "",
this.successText = "",
this.imageURL = null,
this.videoURL = null,
this.adviser = null,
this.avatarType = null,
this.validUntilDay = -1,
this.validAfterDay = -1,
this.adviceIndex = -1,
this.titleParameters = [],
this.windowTitleParameters = [],
this.textParameters = [],
this.tipParameters = [],
this.successParameters = [],
this.adviceIconClass = null,
this.adviceIconFile = null,
this.collecting = !1,
this.unread = !0,
this.state = null,
this.successEvaluationInterval = this.successEvaluationInterval || 0,
this.dependencyAdviseID = null,
this.subscribers = [],
r.N.subscribe(c.q.TUTORIAL_FINISHED, this.clearCache.bind(this))
}
getStorageKeyPrefix() {
return `a:${this.adviceIndex}g:${a.IZ.config.userData.gameID}p:${a.IZ.config.userData.playerID}u:${a.IZ.config.userData.siteUserID}`
}
setupSuccessEvaluationInterval() {
if (!this.isRewardCollected() && this.successEvaluationInterval && this.isPossible()) {
const e = setInterval((()=>{
this.isSuccessfulPreAdviserTask() && (this.onEvaluationSuccessful(),
clearInterval(e))
}
), this.successEvaluationInterval)
}
}
onEvaluationSuccessful() {}
restoreFromStoredState() {
const e = this.getStorageKeyPrefix();
this.setState(s.P.getString(`${e}_state`)),
this.unread = !s.P.getString(`${e}_read`)
}
clearCache() {}
markAsRead() {
this.unread = !1,
s.P.set(`${this.getStorageKeyPrefix()}_read`, !0)
}
getState() {
return this.state
}
setState(e) {
e !== this.state && (s.P.set(`${this.getStorageKeyPrefix()}_state`, e),
e === n.M.Available ? this.onAvailableState() : this.onNotAvailableState()),
this.state = e
}
isExecutable() {
return this.isValidDayOfGame() && this.isPossible() && this.isValidStrategyFocus()
}
isValidStrategyFocus() {
return !a.IZ.ui.strategicAdviserAvatarController.hasFocusSelection || !this.hasOwnProperty("focusType") || this.focusType[a.IZ.strategicAdviseManager.getSelectedFocus()] || this.focusType[0]
}
isValidDayOfGame() {
return !this.isExpired() && !this.isWaiting()
}
isWaiting() {
const e = a.IZ.gameState.getGameInfoState().getDayOfGame();
return this.validAfterDay >= 0 && e <= this.validAfterDay
}
isExpired() {
const e = a.IZ.gameState.getGameInfoState().getDayOfGame();
return this.validUntilDay >= 0 && e > this.validUntilDay
}
isPossible() {
return !0
}
static isPreAdviserAllowed() {
return !a.IZ.gameState.getPlayerState().getPlayer(a.IZ.config.userData.playerID).isTutorialGame()
}
processPreAdviserConstraints() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]
, t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
if (this.isPreAdviserTask()) {
if (!p.isPreAdviserAllowed())
return !1;
if (this.checkPreAdviserSuccess(e, t))
return !1
}
return !0
}
isPreAdviserTask() {
return this.focusType && this.focusType.hasOwnProperty("0") && this.focusType[0]
}
checkPreAdviserSuccess() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]
, t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
if (this.isPreAdviserTask()) {
if (a.IZ.strategicAdviseManager.alreadyCompletedPreadviserTask(this.adviceIndex))
return !0;
let i = !0;
this.isSuccessfulPreAdviserTask() || (i = !1),
a.IZ.tutorialController && !a.IZ.isTutorialFinished() && (i = !1),
i && a.IZ.strategicAdviseManager.postPreAdviserSuccess(this.adviceIndex, e, t)
}
return !1
}
isFinished() {
return !this.isPossible()
}
canBeIgnored() {
return !1
}
initAdviceModel() {
return new l(this)
}
applyParametersToText(e, t) {
const i = this.resolveParameters(t);
return i.length ? a.IZ.i18n.sprintf.apply(this, [e, ...i]) : e
}
getFormattedTip() {
return this.applyParametersToText(this.tip, this.tipParameters)
}
getFormattedTitle() {
return this.applyParametersToText(this.title, this.titleParameters)
}
getFormattedWindowTitle() {
return this.applyParametersToText(this.windowTitle, this.windowTitleParameters)
}
getFormattedSuccessText() {
return this.applyParametersToText(this.successText, this.successParameters)
}
getFormattedText() {
return this.applyParametersToText(this.text, this.textParameters)
}
resolveParameters(e) {
const t = [];
let i, s, r;
for (let n = 0; n < e.length; n++)
if ("amount" == e[n])
t.push(this.getRemainingAmount());
else if ("links" == e[n])
t.push(this.createLinks());
else if ("armyLinks" == e[n])
t.push(this.createArmyLinks());
else if ("nationLink" == e[n]) {
for (i = this.getNationsInDomain(),
s = "",
r = 0; r < i.length; r++)
this.isPreAdviserTask() ? s += a.IZ.ui.helper.createStartTaskLink(i[r].getNationName(), this.adviceIndex) : s += a.IZ.ui.helper.wrapAsCountryLink(i[r].getNationName(), i[r].getPlayerID()),
s += r == i.length - 1 ? " " : ", ";
t.push(s)
} else if ("lack" == e[n])
this.weakResEntry ? t.push(this.weakResEntry.getName()) : t.push("");
else if ("icon" == e[n])
t.push(this.getIcon());
else if ("nation" == e[n]) {
for (i = this.getNationsInDomain(),
s = "",
r = 0; r < i.length; r++)
s += i[r].getNationName(),
s += r == i.length - 1 ? " " : ", ";
t.push(s)
} else
"tradeName" == e[n] ? this.currentResEntry ? t.push(this.currentResEntry.getName()) : t.push("") : "tradeIcon" == e[n] ? this.currentResEntry ? t.push(a.IZ.ui.iconsHelper.getResourceIcon(this.currentResEntry.getResourceID(), null, !1, null, !0)) : t.push("") : e[n].indexOf("unit") >= 0 ? t.push(a.IZ.ui.iconsHelper.getUnitIcon(e[n].split("unit")[1])) : e[n].indexOf("res") >= 0 ? t.push(a.IZ.ui.iconsHelper.getResourceIcon(e[n].split("res")[1], null, !1, null, !0)) : e[n].indexOf("upgrade") >= 0 ? t.push(a.IZ.ui.iconsHelper.getUpgradeIcon(e[n].split("upgrade")[1])) : e[n].indexOf("relationIcon") >= 0 ? t.push(a.IZ.ui.iconsHelper.getRelationIcon(e[n].split("relationIcon")[1], d.k.RELATION_ICON_SIZE.normal)) : t.push(e[n]);
return t
}
createLinks() {
const e = this.getRemainingAmount()
, t = this.getNextProvinces();
let i = "";
for (let s = 0; s < e && s < t.length; s++)
s > 0 && (i += ", "),
this.isPreAdviserTask() ? i += a.IZ.ui.helper.createStartTaskLink(t[s].getName(), this.adviceIndex) : i += a.IZ.ui.helper.createProvinceLink(t[s], "func_adviser_video_windowed_mode_button");
return i
}
createArmyLinks() {
if (this.getArmy()) {
const e = a.IZ.gameState.getMapState().getLocation(this.getArmy().getLocationID());
if (e)
return this.isPreAdviserTask() ? a.IZ.ui.helper.createStartTaskLink(e.getName(), this.adviceIndex) : a.IZ.ui.helper.createProvinceLink(e, "func_adviser_video_windowed_mode_button")
}
return ""
}
getArmy() {
return null
}
getNextProvinces() {
return []
}
getNationsInDomain() {
return []
}
getIcon() {
return a.IZ.ui.iconsHelper.getIcon(`${this.domain}Icon`)
}
getRemainingAmount() {
return this.isFinished() ? 0 : 1
}
getRequiredAmount() {
return Number.isFinite(this.amount) ? this.amount : 1
}
getProgressAmount() {
return Math.max(0, this.getRequiredAmount() - this.getRemainingAmount())
}
getCompletionPercentage() {
return this.getProgressAmount() / (this.getRequiredAmount() ?? 1) * 100
}
exportAdvice() {
return this.initAdviceModel()
}
isNumeric(e) {
return !Number.isNaN(parseFloat(e)) && Number.isFinite(e)
}
getSuccessText() {
return this.successText
}
getAdviseReward() {
return a.IZ.strategicAdviseManager.getAdviseReward(this.adviseID)
}
getPremiumIdToRewardAmountMap() {
const e = this.getAdviseReward();
return e ? e.getPremiumIdToRewardAmountMap() : null
}
getResourceRewardMap() {
const e = this.getAdviseReward();
return e ? e.getResourceRewardMap() : null
}
getUnitRewardMap() {
const e = this.getAdviseReward();
return (null == e ? void 0 : e.getUnitRewardMap()) ?? null
}
getPremiumRewardMap() {
const e = this.getPremiumIdToRewardAmountMap();
if (!e)
return {};
const t = a.IZ.getMod();
return Object.fromEntries(Object.entries(e).filter((e=>{
let[i] = e;
return Number(i) === t.getPremiumCurrencyItemID() || Number(i) === t.getPremiumAccountItemID()
}
)))
}
getInventoryItemRewards() {
const e = this.getPremiumIdToRewardAmountMap();
if (!e)
return [];
return Object.entries(e).map((e=>{
let[t,i] = e;
return h.J.buildInventorySystemRewardItemFromPremiumId(t, i)
}
)).filter(Boolean)
}
getInventoryItemRewardIcon() {
const e = this.getInventoryItemRewards();
return g.a.getInventoryBundleSize(e)
}
isRewardCollected() {
return a.IZ.strategicAdviseManager.isAdviseRewardCollected(this.adviseID)
}
hasGuidance() {
return !!this.showHowTo
}
canGuide() {
return !0
}
getAdviceIndex() {
return this.adviceIndex
}
init() {}
subscribe(e, t) {
this.subscribers.push(r.N.subscribe(e, t))
}
unsubscribe() {
this.subscribers.forEach((e=>r.N.unsubscribe(e))),
this.subscribers.length = 0
}
onAvailableState() {}
onNotAvailableState() {}
startAssistingTask(e) {
a.IZ.strategicAdviseManager.startAssistingTask(e)
}
hasContextualTutorial() {
return !!this.contextualTutorialIDs
}
isContextualTutorialPossible() {
if (!this.hasContextualTutorial())
return !1;
const e = u.$.getInstance();
return !this.contextualTutorialIDs.map(e.getConceptByID).every(e.isConceptPossible)
}
}
a.IZ.model.strategicadviser.BaseAdvice = p
}
,
81357: (e,t,i)=>{
var s = i(39513)
, r = i(66589)
, n = i(87928);
class a extends r.t {
onAvailableState() {
this.subscribe(n.q.UI_CONTEXTUAL_TUTORIAL_LIST_OPENED.asOneTimeSubscription(), (()=>this.setCompletedNow(!0)))
}
}
s.IZ.model.strategicadviser.CheckContextualTutorialListAdvice = a
}
,
2886: (e,t,i)=>{
var s = i(39513)
, r = i(66589)
, n = i(55642)
, a = i(87928);
class o extends r.t {
constructor() {
super("coalition", new n.W)
}
onAvailableState() {
this.subscribe(a.q.UI_COALITION_CREATE_ACTION_REQUESTED, this.setCompletedNow.bind(this)),
this.subscribe(a.q.UI_COALITION_JOIN_ACTION_REQUESTED, this.setCompletedNow.bind(this))
}
isCompletedNow() {
return this.completedNow || !!s.IZ.inGameAllianceController.getCurrentPlayerAlliance()
}
}
s.IZ.model.strategicadviser.CoalitionAdvice = o
}
,
19037: (e,t,i)=>{
var s = i(58834)
, r = i(4432)
, n = i(39513)
, a = i(66589)
, o = i(87928);
class l extends a.t {
amount = 1;
userSettingKeyPrefix = "conquer_province";
provinceAmountSuffix = "advice_province_amount";
onAvailableState() {
this.subscribe(o.q.UI_PROVINCE_WON, this.incrementProvinceAmount.bind(this))
}
getRemainingAmount() {
return this.getState() === r.M.Done ? 0 : this.amount - this.getProvinceAmount()
}
onProvinceCaptured() {
this.incrementProvinceAmount()
}
incrementProvinceAmount() {
const e = this.getProgressAmount() + 1;
s.P.set(this.getProvinceAmountKey(), e),
e >= this.amount && this.setCompletedNow()
}
getProgressAmount() {
return s.P.getInt(this.getProvinceAmountKey()) ?? 0
}
getProvinceAmount() {
const e = this.getProvinceAmountKey();
return s.P.getInt(e)
}
getProvinceAmountKey() {
var e;
return `game${null === (e = n.IZ.config.userData) || void 0 === e ? void 0 : e.gameID}_${this.getUserSettingKey()}_${this.provinceAmountSuffix}`
}
init() {
this.userSettingKey = `${this.userSettingKeyPrefix}_${this.amount}`
}
}
n.IZ.model.strategicadviser.ConquerProvinceAdvice = l
}
,
75079: (e,t,i)=>{
i(87477);
var s = i(11080)
, r = i(4432)
, n = i(40897)
, a = i(39513)
, o = i(65814)
, l = i(4563)
, u = i(34545);
const h = ["moreRes", "lessMorale"];
class g extends o.y {
constructor() {
super(),
this.amount = "",
this.domain = "",
this.domains = [],
this.preferredDomain = "",
this.buildingID = "",
this.requiredBuildingCondition = "",
this.convertToBuyResource = !1,
this.weakResEntry = null,
this.waitUntilFinish = a.IZ.config.waitAdvicesUntilFinish,
this.replace = a.IZ.config.useAdviceReplacement,
this.hideOnNotStartableState = a.IZ.config.hideNotStartableAdvices,
this.strictMode = !1
}
isPossible() {
if (!this.processPreAdviserConstraints())
return !1;
if (!a.IZ.getMod().getUpgrade(this.buildingID))
return !1;
if (this.strictMode)
return !0;
if (this.hideOnNotStartableState && !this.canStartConstruction())
return !1;
return this.getProvinceCountHoldingCondition() < this.getNumericAmount() && !!this.getTargetProvince()
}
getRequiredAmount() {
return this.getNumericAmount()
}
checkForResources() {
return -1 != this.getLackedResourceID() && this.convertToBuyResource || -1 == this.getLackedResourceID()
}
haveAllResearchRequirements() {
const e = a.IZ.gameState.getResearchState();
if (e) {
const t = a.IZ.getMod().getUpgrade(this.buildingID).getRequiredResearches();
for (const i in t)
if (t.hasOwnProperty(i))
return e.hasResearch(i) || e.hasReplacedResearch(i)
}
return !0
}
isFinished() {
return this.strictMode ? 0 === this.getRemainingAmount() : a.IZ.getMod().getUpgrade(this.buildingID) && !this.isPossible() && this.getProvinceCountHoldingCondition() > 0
}
canBeIgnored() {
return !(this.strictMode && 0 === this.getRemainingAmount())
}
exportAdvice() {
if (this.replace) {
const e = this.getLackedResourceID();
if (-1 !== e) {
const t = a.IZ.gameState.getResourceState().getPlayerResourceEntry(e)
, i = a.IZ.getMod().getUpgrade(this.buildingID).getBuildCosts()
, s = Math.ceil(i[e] * this.getRemainingAmount() - t.getAmount0())
, r = a.IZ.strategicAdviseManager.getLackOfResourcesAdvice(s, t, this).exportAdvice();
return a.IZ.strategicAdviseManager.evaluateAdviseFirstTime(r.adviceHandler),
r.adviceHandler.adviceIndex = this.adviceIndex,
r.adviceIndex = this.adviceIndex,
r
}
if (!this.isEnoughBuildingSlotsAvailable() && a.IZ.strategicAdviseManager.getAdviceConfigurations().speedUpProductionAdvice) {
const e = a.IZ.strategicAdviseManager.getSpeedUpProductionAdvice();
return e.adviceIndex = this.adviceIndex,
e.status = r.M.Available,
e
}
}
return this.initAdviceModel()
}
getIcon() {
return this.buildingID ? a.IZ.ui.iconsHelper.getUpgradeIcon(this.buildingID, !1, !1, !1, null, "medium") : null
}
isEnoughBuildingSlotsAvailable() {
let e = 0;
const t = a.IZ.gameState.getMapState().getPlayerProvinces();
for (let i = 0; i < t.length; i++) {
const s = t[i];
this.filterDomains(s) && s.canBuildUpgrade(this.buildingID) && !s.isBuilding() && e++
}
return e >= this.getRemainingAmount()
}
getLackedResourceID() {
const e = a.IZ.getMod().getUpgrades()[this.buildingID].getBuildCosts();
for (const t in e)
if (e.hasOwnProperty(t)) {
const i = a.IZ.gameState.getResourceState().getPlayerResourceEntry(t)
, s = i && i.getAmount0() || 0;
if (e[t] * this.getRemainingAmount() > s)
return t
}
return -1
}
showHowTo() {
const e = this.getTargetProvince();
e && this.buildingID && this.startAssistingTask(new u.w(this.buildingID,e))
}
getTargetProvince() {
return this.getNextProvinces()[0] ?? null
}
isSuccessfulPreAdviserTask() {
return this.getProvinceCountHoldingCondition() >= this.getNumericAmount()
}
getRemainingAmount() {
if (this.strictMode) {
const e = a.IZ.gameState.getPlayerStatisticsState().getNumConstructedUpgrade(this.buildingID);
return Math.max(0, this.amount - e)
}
const e = this.getProvinceCountHoldingCondition()
, t = this.getNumericAmount();
return Math.max(0, t - e)
}
filterAmount(e) {
return this.isNumeric(this.amount) || "max" == this.amount || this.amount.includes("res") && e.getProductionType() == parseInt(this.amount.split("res")[1])
}
getNumericAmount() {
if (this.strictMode)
return this.amount;
const e = a.IZ.gameState.getMapState().getPlayerProvinces();
let t = 0;
for (let i = 0; i < e.length; i++) {
const s = e[i];
(s.getUpgradeCondition(parseInt(this.buildingID)) >= this.requiredBuildingCondition || s.canBuildUpgradeCondition(this.buildingID, this.requiredBuildingCondition) || this.isStillBuildingCurrentLevelOfUpgrade(s, this.buildingID, this.requiredBuildingCondition) || this.filterDomains(s)) && this.filterDomains(s) && this.filterAmount(s) && (this.isNumeric(this.amount) ? Number(this.amount) > t && t++ : t++)
}
return t
}
isStillBuildingCurrentLevelOfUpgrade(e, t, i) {
if (e.isBuildingUpgrade(t)) {
const s = a.IZ.getMod().getUpgrades()[t].getBuildCondition();
if (Math.floor(e.getUpgradeCondition(t) / s) + 1 == Math.ceil(i / s))
return !0
}
return !1
}
getNextProvinces() {
const e = []
, t = a.IZ.gameState.getMapState().getPlayerProvinces();
for (let i = 0; i < t.length; i++) {
const s = t[i];
this.filterDomains(s) && (s.getPossibleUpgrades().some((e=>e.itemID === this.buildingID)) || s.isBuildingUpgrade(this.buildingID)) && (this.hideOnNotStartableState && s.isBuilding(0) && s.isBuildingUpgrade(this.buildingID) || e.push(s))
}
if (this.preferredDomain) {
if (h.some((e=>this.preferredDomain.includes(e))))
if (this.preferredDomain.includes("moreRes")) {
const t = Number(this.preferredDomain.split("moreRes")[1]);
e.sort(((e,i)=>i.getProduction(t) - e.getProduction(t)))
} else
this.preferredDomain.includes("lessMorale") && e.sort(((e,t)=>e.getMorale() - t.getMorale()));
else
e.sort(((e,t)=>this.filterDomains(e, [this.preferredDomain]) && !this.filterDomains(t, [this.preferredDomain]) ? -1 : 1))
}
return e
}
filterDomains(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : this.domains;
const i = [];
return t.forEach((t=>{
switch (t) {
case "any":
i.push(!0);
break;
case "double":
i.push(e.isDoubleProduction());
break;
case "border":
i.push(e.isBorderProvince());
break;
case "coastal":
i.push(e.isCoastal());
break;
case "nonCapital":
i.push(a.IZ.gameState.getPlayerState().getPlayer(e.getOwnerID()).getCapitalID() !== e.getLocationID());
break;
case "lack":
i.push(this.isWeakResourceProvince(e));
break;
case "factory":
i.push(e.getFeatureValue(l.M.FACTORY_TECH) > 0);
break;
case "production":
i.push(0 !== e.getProductionType());
break;
case "noProductionBuildings":
i.push(!e.hasUpgradeWithCategory(n.$.UNIT_PRODUCTION));
break;
default:
"res" === this.domain.slice(0, 3) && i.push(e.getProductionType() === Number(this.domain.split("res")[1])),
i.push(!1)
}
}
)),
!i.includes(!1)
}
isWeakResourceProvince(e) {
const t = a.IZ.gameState.getMapState().getProvincesForPlayer(e.getOwnerID())
, i = a.IZ.getMod().getAllResourceIDs(!0, !0)
, s = {};
for (let a = 0; a < i.length; a++)
s[i[a]] = 0;
for (let a = 0; a < t.length; a++)
s[t[a].getProductionType()] += t[a].isDoubleProduction() ? 2 : 1;
let r = Number.MAX_VALUE
, n = -1;
for (const a in s)
s.hasOwnProperty(a) && s[a] < r && s[a] > 0 && (r = s[a],
n = a);
return this.weakResEntry = a.IZ.gameState.getResourceState().getPlayerResourceEntry(n),
n == e.getProductionType()
}
getProvinceCountHoldingCondition() {
const e = a.IZ.gameState.getMapState().getPlayerProvinces();
let t = 0;
for (let i = 0; i < e.length; i++) {
const s = e[i];
if (this.filterDomains(s)) {
const e = a.IZ.getMod().getUpgrade(this.buildingID).getBuildCondition()
, i = s.getUpgrade(this.buildingID);
(i && !i.isBuilding() && !i.isDamaged() && s.getUpgradeCondition(Number(this.buildingID)) >= Number(this.requiredBuildingCondition) || !this.waitUntilFinish && s.isBuildingUpgrade(this.buildingID) && s.getUpgradeCondition(this.buildingID) < this.requiredBuildingCondition && Math.floor(s.getUpgradeCondition(this.buildingID) / e) + 1 == Math.ceil(this.requiredBuildingCondition / e)) && t++
}
}
return t
}
getUpgradeType() {
return a.IZ.getMod().getUpgrade(this.buildingID)
}
init() {
"" !== this.domain && 0 === this.domains.length && (this.domains = [this.domain])
}
canGuide() {
return "" === this.getNotGuidableReason()
}
getNotGuidableReason() {
const e = this.getTargetProvince();
return e.isBuildingUpgrade(this.buildingID) ? s.q.IsAlreadyConstructing : e.hasFreeBuildSlot() ? "" : s.q.NoConstructionSlotAvailable
}
getNotGuidableReasonHR() {
switch (this.getNotGuidableReason()) {
case s.q.IsAlreadyConstructing:
return a.IZ.i18n.gettext("Construction is already in progress!");
case s.q.NoConstructionSlotAvailable:
return a.IZ.i18n.gettext("No available construction slot!");
default:
return ""
}
}
canStartConstruction() {
return this.isEnoughBuildingSlotsAvailable() && this.checkForResources() && this.haveAllResearchRequirements()
}
}
a.IZ.model.strategicadviser.ConstructionAdvice = g
}
,
59306: (e,t,i)=>{
var s = i(39513)
, r = i(66589)
, n = i(87928);
class a extends r.t {
countWarWarningConfirmation = !1;
constructor() {
super("declare_war")
}
onAvailableState() {
this.subscribe(n.q.UI_POSSIBLE_WAR_ACCEPTED, this.onPossibleWarAccepted.bind(this)),
this.subscribe(n.q.UI_WAR_DECLARED, this.setCompletedNow.bind(this)),
this.subscribe(n.q.UI_WAR_DECLARE_REQUEST, this.setCompletedNow.bind(this))
}
onPossibleWarAccepted() {
this.countWarWarningConfirmation && this.setCompletedNow()
}
}
s.IZ.model.strategicadviser.DeclareWarAdvice = a
}
,
39230: (e,t,i)=>{
i(87477);
var s = i(64842)
, r = i(23861)
, n = i(39513)
, a = i(65814)
, o = i(6422)
, l = i(50155)
, u = i(91939);
class h extends a.y {
constructor() {
super(),
this.minimumRelationType = o.N.WAR,
this.maximumRelationType = o.N.MILITARY_AUTHORITY,
this.relationType = "",
this.amount = "",
this.domain = ""
}
isPossible() {
if (!this.processPreAdviserConstraints())
return !1;
return this.getNumberOfOpponentsConditionHold() < this.getNumericAmount()
}
getRemainingAmount() {
const e = this.getNumberOfOpponentsConditionHold();
return this.getNumericAmount() - e
}
filterAmount(e) {
return "max" == this.amount || parseInt(this.amount) > e
}
getNumericAmount() {
let e = 0;
const t = n.IZ.gameState.getPlayerState().getPlayers()
, i = Object.keys(t);
for (let s = 0; s < i.length; s++) {
const r = t[i[s]];
if (n.IZ.config.userData.playerID != r.getPlayerID() && r.getPlayerID() > 0 && this.filterDomain(r, !0)) {
if (!this.filterAmount(e))
break;
e++
}
}
return e
}
getNationsInDomain() {
const e = []
, t = n.IZ.gameState.getPlayerState().getPlayers()
, i = []
, s = Object.keys(t);
let r, {length: a} = s;
for (r = 0; r < a; r++) {
const e = t[s[r]];
n.IZ.config.userData.playerID != e.getPlayerID() && e.getPlayerID() > 0 && this.filterDomain(e, !0) && e.getCapitalID() > -1 && i.push(e)
}
i.sort(this.compareDistanceAsc);
const o = this.getRemainingAmount();
let l = 0;
for (a = i.length,
r = 0; r < a && (e.push(i[r]),
l++,
l != o); r++)
;
return e
}
compareDistanceAsc(e, t) {
const i = n.IZ.gameState.getPlayerState().getPlayer(n.IZ.config.userData.playerID)
, r = n.IZ.gameState.getMapState().getProvince(e.getCapitalID())
, a = n.IZ.gameState.getMapState().getProvince(t.getCapitalID())
, o = n.IZ.gameState.getMapState().getProvince(i.getCapitalID());
if (o && a && r) {
return s.E.distance(o.getCapital(), r.getCapital()) - s.E.distance(o.getCapital(), a.getCapital())
}
return Number.MAX_VALUE
}
getNumberOfOpponentsConditionHold() {
const e = this.getSoonToBeAttackedPlayers()
, t = this.getShareMapOfferedPlayers()
, i = n.IZ.gameState.getPlayerState().getPlayers()
, s = n.IZ.gameState.getForeignAffairsState().getRelations();
let r = 0;
const a = Object.keys(i)
, {length: l} = a;
for (let u = 0; u < l; u++) {
const l = i[a[u]]
, h = l.getPlayerID();
if (n.IZ.config.userData.playerID != h && this.filterDomain(l, !0)) {
const i = s.getRelation(n.IZ.config.userData.playerID, h);
i == this.relationType ? r++ : this.relationType == o.N.WAR ? e.indexOf(h) >= 0 && r++ : this.relationType == o.N.VIEW_MILITARY_ACTIONS ? t.indexOf(h) >= 0 && r++ : this.relationType == o.N.RIGHT_OF_WAY && (t.indexOf(h) >= 0 || i >= this.relationType) && r++
}
}
return r
}
getIcon() {
return this.relationType ? n.IZ.ui.iconsHelper.getDiplomacyIcon() : null
}
getShareMapOfferedPlayers() {
const e = [];
if (this.relationType == o.N.VIEW_MILITARY_ACTIONS) {
const t = n.IZ.gameState.getPlayerState().getPlayers()
, i = Object.keys(t)
, {length: s} = i;
for (let a = 0; a < s; a++) {
const s = t[i[a]].getPlayerID()
, u = n.IZ.gameState.getResourceState().getTrading().getTradeOffersForPlayers(n.IZ.config.userData.playerID, s)
, h = u.length;
for (let t = 0; t < h; t++)
if (u[t]instanceof l.r) {
const i = u[t];
i.offersA[r.S.Relations] && i.offersB[r.S.Relations] && i.offersA[r.S.Relations] === o.N.VIEW_MILITARY_ACTIONS && i.offersB[r.S.Relations] === o.N.VIEW_MILITARY_ACTIONS && e.push(s)
}
}
}
return e
}
getSoonToBeAttackedPlayers() {
const e = []
, t = n.IZ.gameState.getArmyState().getArmies();
if (this.relationType == o.N.WAR) {
const i = n.IZ.gameState.getArmyState().getNationArmiesArray(n.IZ.config.userData.playerID);
for (let s = 0; s < i.length; s++) {
const r = i[s].getCommands();
for (let i = 0; i < r.length; i++)
if (r[i]instanceof u.l) {
const s = r[i].getTargetUnitID()
, a = r[i].getTargetPos();
if (0 != s)
t[s] && e.indexOf(t[s].getOwnerID()) < 0 && e.push(t[s].getOwnerID());
else {
const t = n.IZ.gameState.getMapState().getProvinceAt(a);
t && e.indexOf(t.ownerID) < 0 && e.push(t.ownerID)
}
}
}
}
return e
}
filterDomain(e, t) {
if (t) {
const t = n.IZ.gameState.getPlayerState().getPlayer(n.IZ.config.userData.playerID)
, i = n.IZ.gameState.getForeignAffairsState().getRelations().getRelation(t.getPlayerID(), e.getPlayerID())
, s = Number.isFinite(Number.parseFloat(this.maximumRelationType)) || o.N.MILITARY_AUTHORITY;
if (i < (Number.isFinite(Number.parseFloat(this.minimumRelationType)) || o.N.WAR) || i > s)
return !1
}
const i = n.IZ.gameState.getMapState().getProvincesForPlayer(e.getPlayerID()).length
, s = n.IZ.gameState.getMapState().getProvincesForPlayer(n.IZ.config.userData.playerID).length;
return "any" == this.domain || "allAI" == this.domain && e.isComputerPlayer() || "smallAI" == this.domain && e.isComputerPlayer() && i < s || "bigAI" == this.domain && !e.isPassiveAI() && e.isComputerPlayer() && i >= s || "human" == this.domain && !e.isComputerPlayer()
}
}
n.IZ.model.strategicadviser.DiplomaticAdvice = h
}
,
66589: (e,t,i)=>{
i.d(t, {
t: ()=>o
});
var s = i(55542)
, r = i(39513)
, n = i(65814)
, a = i(87928);
class o extends n.y {
completedNow = !1;
constructor(e, t) {
super(),
this.userSettingKey = e,
this.assistanceTask = t
}
isPossible() {
if (!this.processPreAdviserConstraints())
return !1;
if (!this.isCompletedBefore()) {
if (!this.isCompletedNow())
return !0;
this.setCompleted()
}
return !1
}
isCompletedNow() {
return this.completedNow
}
isCompletedBefore() {
return r.IZ.strategicAdviseManager.isAdvicePerformedBefore(this.userSettingKey)
}
setCompleted() {
r.IZ.strategicAdviseManager.setAdvicePerformedBeforeByName(this.userSettingKey)
}
setCompletedNow() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
this.completedNow = !0,
e && s.N.publish(a.q.UI_STRATEGIC_ADVISER_FEEDBACK_NEEDED)
}
getUserSettingKey() {
return this.userSettingKey
}
onNotAvailableState() {
this.unsubscribe()
}
showHowTo() {
r.IZ.strategicAdviseManager.startAssistingTask(this.assistanceTask)
}
hasGuidance() {
return !!this.assistanceTask
}
}
}
,
25926: (e,t,i)=>{
var s = i(39513)
, r = i(65814);
class n extends r.y {
constructor() {
super(),
this.type = ""
}
isPossible() {
return !!this.processPreAdviserConstraints() && ("buy_premium_currency" === this.type ? !s.IZ.user.isPayingUser() : "join_alliance" === this.type && !s.IZ.user.isAllianceMember())
}
getIcon() {
return "buy_premium_currency" === this.type ? s.IZ.ui.iconsHelper.getPremiumCurrencyIcon() : "join_alliance" === this.type ? s.IZ.ui.iconsHelper.getAlliancesIcon() : null
}
}
s.IZ.model.strategicadviser.GlobalAdvice = n
}
,
11965: (e,t,i)=>{
var s = i(39513)
, r = i(65814);
class n extends r.y {
constructor() {
super(),
this.amount = 1,
this.domain = ""
}
isPossible() {
return !!this.processPreAdviserConstraints() && (["diplomacy", "trade"].includes(this.domain) ? s.IZ.gameState.getPlayerState().getNumberOfHumanPlayers() > 1 : "chat" !== this.domain || null !== s.IZ.config.userData.rights)
}
getRemainingAmount() {
let e = 0;
if ("newspaper" === this.domain)
for (let t = 0; t <= this.validUntilDay; t++) {
e += (s.IZ.gameState.getNewspaperState().getArticles(t) || []).filter((e=>e.authorID == s.IZ.config.userData.playerID)).length
}
else
"diplomacy" === this.domain ? e = s.IZ.gameState.getForeignAffairsState().getMessages().filter((e=>e.authorID == s.IZ.config.userData.playerID)).length : "trade" === this.domain ? (e = s.IZ.gameState.getResourceState().getTrading().getTradeOffersForPlayers(s.IZ.config.userData.playerID, -3).filter((e=>e.getPartyA() == s.IZ.config.userData.playerID)).length,
e += s.IZ.gameState.getResourceState().getTrading().getPastTradeOffersForPlayers(s.IZ.config.userData.playerID, -3).filter((e=>e.getPartyA() == s.IZ.config.userData.playerID)).length) : "chat" === this.domain && s.IZ.strategicAdviseManager.didUserPostAChatMessageBefore() && (e = Number.MAX_VALUE);
return Math.max(0, this.amount - e)
}
isFinished() {
return 0 === this.getRemainingAmount()
}
getIcon() {
return "chat" === this.domain || "diplomacy" === this.domain ? s.IZ.ui.iconsHelper.getMailIcon() : "newspaper" === this.domain ? s.IZ.ui.iconsHelper.getNewspaperIcon() : null
}
clearCache() {
super.clearCache()
}
}
s.IZ.model.strategicadviser.MessagingAdvice = n
}
,
73696: (e,t,i)=>{
i(87477);
var s = i(39513)
, r = i(65814)
, n = i(13550);
class a extends r.y {
constructor() {
super(),
this.targetPosition = null,
this.provinceDomain = "",
this.armyDomain = ""
}
clearCache() {
this.targetLocation = null
}
isPossible() {
return !1
}
getTargetPosition() {
const e = this.getTargetLocation();
return e ? e.getCapital() : null
}
getTargetLocation() {
if (null == this.targetLocation && "occTarget" === this.provinceDomain) {
const e = s.IZ.gameState.getMapState().getProvincesForPlayer(s.IZ.config.userData.playerID)
, t = [];
for (let i = 0; i < e.length; i++) {
const s = e[i];
s && s.getProvinceStateID() == ultshared.map.UltProvinceStateID.OCCUPIED && t.push(s)
}
t.length > 0 && (this.targetLocation = t[0])
}
return this.targetLocation
}
showHowTo() {
this.getArmy() && this.getTargetPosition() && this.startAssistingTask(new n.k(this.getArmy(),this.getTargetPosition()))
}
getRemainingAmount() {
return this.amount
}
getNextProvinces() {
return [s.IZ.gameState.getMapState().getClosestLocationAt(this.getTargetPosition())]
}
isSuccessfulPreAdviserTask() {
return this.amount <= 0
}
getArmy() {
const e = this.getArmies(!0);
return e.length > 0 ? e[0] : null
}
}
s.IZ.model.strategicadviser.MoveArmyAdvice = a
}
,
19109: (e,t,i)=>{
var s = i(39513)
, r = i(66589)
, n = i(36002)
, a = i(87928);
class o extends r.t {
constructor() {
super("newspaper", new n.y)
}
onAvailableState() {
this.subscribe(a.q.UI_NEWSPAPER_OPENED, this.setCompletedNow.bind(this))
}
}
s.IZ.model.strategicadviser.NewspaperAdvice = o
}
,
35535: (e,t,i)=>{
var s = i(65814);
class r extends s.y {
constructor() {
super(),
this.moraleThreshold = .4
}
isPossible() {
return this.getRemainingAmount() > 0
}
getNextProvinces() {
return hup.gameState.getMapState().getProvincesForPlayer(hup.config.userData.playerID).filter((e=>e.getMorale() / 100 <= this.moraleThreshold))
}
getRemainingAmount() {
return this.getNextProvinces().length
}
}
hup.model.strategicadviser.PropagandaAdvice = r
}
,
28725: (e,t,i)=>{
var s = i(39513)
, r = i(65814)
, n = i(294);
class a extends r.y {
constructor() {
super(),
this.unitItemID = null,
this.unitTypeID = null,
this.unitType = null,
this.amount = 1
}
getUnitType() {
return null === this.unitType && (this.unitItemID ? this.unitType = s.IZ.getMod().getUnitTypeByItemID(this.unitItemID) : this.unitType = s.IZ.getMod().getUnitType(this.unitTypeID)),
this.unitType
}
isFinished() {
const e = this.getUnitType().getItemID();
return Object.values(s.IZ.gameState.getMapState().getPlayerProvinces()).flatMap((e=>n.$.getBuildQueueEntries([e.getLocationID()]))).filter((e=>e.isProduction())).filter((t=>parseInt(t.getSpecialUnit().getItemID(), 10) === e)).length >= this.amount
}
isPossible() {
return s.IZ.user.getPremiumAccountEndDateInSeconds() > Date.now() / 1e3
}
}
s.IZ.model.strategicadviser.QueueProductionAdvice = a
}
,
8923: (e,t,i)=>{
var s = i(4432)
, r = i(39513)
, n = i(66589);
class a extends n.t {
amount = 0;
userSettingKeyPrefix = "reach_victory_ponts";
isCompletedNow() {
return !!this.amount && 0 === this.getRemainingAmount()
}
getRemainingAmount() {
return this.getState() === s.M.Done ? 0 : Math.max(0, this.amount - this.getVictoryPoints())
}
getProgressAmount() {
return this.getVictoryPoints()
}
getVictoryPoints() {
const e = r.IZ.gameState;
return e.getNewspaperState().getRanking(e.getGameInfoState().getDayOfGame()).getPlayerPoints(r.IZ.config.userData.playerID)
}
init() {
this.userSettingKey = `${this.userSettingKeyPrefix}_${this.amount}`
}
}
r.IZ.model.strategicadviser.ReachVictoryPointsAdvice = a
}
,
43147: (e,t,i)=>{
var s = i(39513)
, r = i(66589)
, n = i(32585)
, a = i(87928);
class o extends r.t {
constructor() {
super("read_wiki", new n.w)
}
onAvailableState() {
this.subscribe(a.q.UI_WIKI_TOGGLE, this.setCompletedNow.bind(this))
}
}
s.IZ.model.strategicadviser.ReadWikiAdvice = o
}
,
21160: (e,t,i)=>{
var s = i(39513)
, r = i(65814);
class n extends r.y {
constructor() {
super(),
this.moraleThreshold = .8
}
isFinished() {
return !Object.values(s.IZ.gameState.getArmyState().getNationArmies(s.IZ.config.userData.playerID)).find((e=>e.getMorale() < this.moraleThreshold))
}
}
s.IZ.model.strategicadviser.ReinforceArmyAdvice = n
}
,
41300: (e,t,i)=>{
i(87477),
i(10711),
i(55542);
var s = i(11080)
, r = i(39513)
, n = i(65814)
, a = i(47152);
i(87542),
i(87928);
class o extends n.y {
constructor() {
super(),
this.amount = 1,
this.proposedResearches = [],
this.useProposalText = !0
}
isPossible() {
return !!this.processPreAdviserConstraints() && (!this.proposedResearches.some((e=>!r.IZ.getMod().getResearch(e))) && !this.isFinished())
}
isFinished() {
return 0 === this.getRemainingAmount()
}
getFormattedText() {
let e = this.text;
if (this.useProposalText) {
const t = this.getNextResearches();
let i = "";
if (t.length > 0) {
const e = t[0].getNameWithTier();
let s;
if (s = this.isPreAdviserTask() ? r.IZ.ui.helper.createStartTaskLink(e, this.adviceIndex) : r.IZ.ui.helper.createResearchLink(t[0], e, "func_adviser_video_windowed_mode_button"),
t.length > 1) {
const e = t[1].getNameWithTier();
let n;
n = this.isPreAdviserTask() ? r.IZ.ui.helper.createStartTaskLink(e, this.adviceIndex) : r.IZ.ui.helper.createResearchLink(t[1], e, "func_adviser_video_windowed_mode_button"),
i = r.IZ.i18n.gettext("I think we should research '%s' and '%s'.", s, n)
} else
i = r.IZ.i18n.gettext("I think we should research '%s'.", s)
} else
i = r.IZ.i18n.gettext("We should start researching a new technology.");
e += `<br/>${i}`
}
return e
}
getNextResearches() {
const e = r.IZ.gameState.getResearchState()
, t = e.getPossibleResearches()
, i = this.amount - e.getCurrentResearches().length
, s = [];
let n = 0;
for (; n < this.proposedResearches.length && s.length < i; ) {
const e = t[this.proposedResearches[n]];
e && s.push(e),
n++
}
return s
}
showHowTo() {
const e = r.IZ.gameState.getResearchState();
for (let t = 0; t < this.proposedResearches.length; t++) {
const i = this.proposedResearches[t];
if (!e.hasResearch(i) && !e.getCurrentResearch(i)) {
this.startAssistingTask(new a.s(i));
break
}
}
}
canGuide() {
return "" === this.getNotGuidableReason()
}
getNotGuidableReason() {
const e = r.IZ.getMod()
, t = r.IZ.gameState.getResearchState();
return t.hasFreeResearchSlot() ? this.proposedResearches.some((i=>t.getCurrentResearch(e.getResearch(i).getItemID()))) ? s.q.IsAlreadyResearching : this.proposedResearches.some((i=>e.getResearch(i).getRequiredResearchItems().map((e=>e.getItemID())).some((e=>!t.hasResearch(e))))) ? s.q.MissingRequiredResearch : "" : s.q.NoResarchSlotAvailable
}
getNotGuidableReasonHR() {
switch (this.getNotGuidableReason()) {
case s.q.NoResarchSlotAvailable:
return r.IZ.i18n.gettext("No available research slot!");
case s.q.IsAlreadyResearching:
return r.IZ.i18n.gettext("Research is already in progress!");
case s.q.MissingRequiredResearch:
return r.IZ.i18n.gettext("Has missing researches!");
default:
return ""
}
}
isSuccessfulPreAdviserTask() {
let e = !0;
for (let t = 0; t < this.proposedResearches.length; t++) {
let i = null != r.IZ.gameState.getResearchState().getCurrentResearch(this.proposedResearches[t]);
i = i || r.IZ.gameState.getResearchState().hasResearch(this.proposedResearches[t]),
i = i || r.IZ.gameState.getResearchState().hasReplacedResearch(this.proposedResearches[t]),
e = e && i
}
return e
}
init() {
const e = r.IZ.getMod();
e.hasFactionSpecificBalancing() && this.proposedResearches.forEach(((t,i)=>{
var s, r;
const n = null === (s = e.getResearch(t)) || void 0 === s || null === (r = s.getFactionSpecificResearch()) || void 0 === r ? void 0 : r.getItemID();
n || window.onException(new Error(`Faction specific research is not found for research ${t} for research advice '${this.adviseID}'`)),
this.proposedResearches[i] = n
}
))
}
getProgressAmount() {
const e = r.IZ.gameState.getResearchState();
return this.proposedResearches.filter((t=>e.hasResearch(t) || e.hasReplacedResearch(t))).length
}
getRemainingAmount() {
return Math.max(0, this.amount - this.getProgressAmount())
}
}
r.IZ.model.strategicadviser.ResearchAdvice = o
}
,
56790: (e,t,i)=>{
var s = i(39513)
, r = i(65814);
class n extends r.y {
constructor() {
super(),
this.amount = "",
this.domain = "",
this.resEntry = null
}
isPossible() {
if (!this.processPreAdviserConstraints())
return !1;
const e = s.IZ.getMod().getAllResourceIDs(!0, !0);
for (let t = 0; t < e.length; t++) {
const i = s.IZ.gameState.getResourceState().getPlayerResourceEntry(e[t]);
if (this.filterDomain(i) && !this.filterAmount(i))
return this.resEntry = i,
!0
}
return !1
}
getIcon() {
const e = this.getResourceID();
return s.IZ.ui.iconsHelper.getResourceIcon(e, null, !1, null, !0)
}
filterAmount(e) {
return "min" == this.amount && 0 == e.getPriority() || "max" == this.amount && 1 == e.getPriority() || "positive" == this.amount && this.checkPositivePossible(e) && e.getRate() >= 0 || "positive" == this.amount && !this.checkPositivePossible(e)
}
checkPositivePossible(e) {
return e.getCategory().getRate() > 0 && e.getMinConsumption() < e.getProduction()
}
filterDomain(e) {
return "any" == this.domain || this.domain.indexOf("res") >= 0 && e.getResourceID() == parseInt(this.domain.split("res")[1]) || this.domain.indexOf("cat") >= 0 && e.getCategoryID() == parseInt(this.domain.split("cat")[1])
}
getResourceID() {
return parseInt(this.domain.replace("res", ""), 10)
}
}
s.IZ.model.strategicadviser.ResourcePriorityManagementAdvice = n
}
,
25321: (e,t,i)=>{
var s = i(58834)
, r = i(4432)
, n = i(39513)
, a = i(66589)
, o = i(40753)
, l = i(87928);
class u extends a.t {
amount = 0;
constructor() {
super("resource_sell", new o.w)
}
onAvailableState() {
this.subscribe(l.q.UI_ORDER_ACTION_REQUESTED, this.onOrderActionRequested.bind(this))
}
onOrderActionRequested(e) {
const t = e.data.playerOrder;
if (!t.isBuy()) {
const e = t.getLimit();
if (!e)
return;
const i = t.getAmount()
, s = n.IZ.getMod().getMarketFeeFactor()
, r = Math.ceil(i * e * (1 - s));
this.addGainedMoney(r)
}
this.getGainedMoney() >= this.amount && this.setCompletedNow()
}
isCompletedBefore() {
return this.getGainedMoney() >= this.amount
}
getRemainingAmount() {
if (this.getState() === r.M.Done)
return 0;
const e = this.getGainedMoney();
return this.amount - e
}
addGainedMoney(e) {
const t = this.getGainedMoneyKey()
, i = s.P.getInt(t) || 0;
s.P.set(t, i + e)
}
getGainedMoney() {
const e = this.getGainedMoneyKey();
return s.P.getInt(e)
}
getGainedMoneyKey() {
var e;
return `game${null === (e = n.IZ.config.userData) || void 0 === e ? void 0 : e.gameID}_${this.getUserSettingKey()}_advice_gained_money`
}
}
n.IZ.model.strategicadviser.ResourceSellAdvice = u
}
,
79487: (e,t,i)=>{
var s = i(61809)
, r = i(39513)
, n = i(65814);
class a extends n.y {
constructor() {
super(),
this.amount = "",
this.domain = "",
this.currentResEntry = null,
this.neededAmount = 0
}
isPossible() {
if (!this.processPreAdviserConstraints())
return !1;
this.currentResEntry = null;
const e = r.IZ.getMod().getAllResourceIDs(!0, !0);
for (let t = 0; t < e.length; t++) {
const i = r.IZ.gameState.getResourceState().getPlayerResourceEntry(e[t]);
if (this.filterDomain(i) && !this.filterAmount(i))
return this.currentResEntry = i,
!0
}
return !1
}
getRemainingAmount() {
return this.neededAmount
}
filterAmount(e) {
if (this.isNumeric(this.amount)) {
if (e.getAmount0() < parseInt(this.amount))
return this.neededAmount = parseInt(this.amount) - e.getAmount0(),
!1
} else if (this.amount.indexOf("day") >= 0) {
const t = e.getRequiredAmountToPreventDepletion(s.$B() + 864e5 * parseInt(this.amount.split("day")[0]));
if (t > 0) {
let e = t + 1e3;
return e += 100 - e % 100,
this.neededAmount = e,
!1
}
}
return !0
}
filterDomain(e) {
return "any" == this.domain || this.domain.indexOf("res") >= 0 && e.getResourceID() == parseInt(this.domain.split("res")[1]) || this.domain.indexOf("cat") >= 0 && e.getCategoryID() == parseInt(this.domain.split("res")[1])
}
getIcon() {
return this.currentResEntry ? r.IZ.ui.iconsHelper.getResourceIcon(this.currentResEntry.getResourceID(), null, !1, null, !0) : null
}
getResourceID() {
return this.currentResEntry ? this.currentResEntry.getResourceID() : 0
}
}
r.IZ.model.strategicadviser.ResourceTradeAdvice = a
}
,
95268: (e,t,i)=>{
i(87477);
var s = i(65814);
class r extends s.y {
constructor() {
super(),
this.minRevoltChance = .6
}
isPossible() {
if (!this.processPreAdviserConstraints())
return !1;
return this.getUnprotectedProvinces().length > 0
}
getUnprotectedProvinces() {
const e = []
, t = hup.gameState.getMapState().getProvincesForPlayer(hup.config.userData.playerID);
for (let i = 0; i < t.length; i++) {
const s = t[i];
s.getProperties().getRevoltChance() > this.minRevoltChance && e.push(s)
}
return e
}
}
hup.model.strategicadviser.RevoltAdvice = r
}
,
74478: (e,t,i)=>{
var s = i(39513)
, r = i(66589)
, n = i(87928)
, a = i(72390);
let o;
!function(e) {
e.Army = "army",
e.Province = "province"
}(o || (o = {}));
class l extends r.t {
type = "";
minAmount = 2;
armySelection = null;
constructor(e, t) {
super(e, t),
(0,
a.S$)(this, "armySelection", "ArmySelectionModel")
}
onAvailableState() {
this.type === o.Province ? this.subscribe(n.q.UI_CONSTRUCTION_TRIGGERED, (e=>this.onConstructionStarted(e))) : this.type === o.Army && this.subscribe(n.q.UI_ARMY_COMMAND_GIVEN, (()=>this.onArmyCommandGiven()))
}
onConstructionStarted(e) {
var t, i;
(null == e || null === (t = e.data) || void 0 === t || null === (i = t.provinceIDs) || void 0 === i ? void 0 : i.length) >= this.minAmount && this.setCompletedNow(!0)
}
onArmyCommandGiven() {
var e;
((null === (e = this.armySelection) || void 0 === e ? void 0 : e.getNumberOfSelectedArmies()) ?? 0) >= this.minAmount && this.setCompletedNow(!0)
}
}
s.IZ.model.strategicadviser.SelectionAdvice = l
}
,
54695: (e,t,i)=>{
i.d(t, {
w: ()=>a
});
var s = i(39513)
, r = i(66589)
, n = i(87928);
let a;
!function(e) {
e.Construction = "construction",
e.Production = "production",
e.Research = "research"
}(a || (a = {}));
class o extends r.t {
userSettingKeyPrefix = "speedup";
onAvailableState() {
this.subscribe(n.q.UI_PREMIUM_ACTION_CONSTRUCTION_SPEED_UP, (()=>{
this.onSpeedup(a.Construction)
}
)),
this.subscribe(n.q.UI_PREMIUM_ACTION_PRODUCTION_SPEED_UP, (()=>{
this.onSpeedup(a.Production)
}
)),
this.subscribe(n.q.UI_PREMIUM_ACTION_RESEARCH_SPEED_UP, (()=>{
this.onSpeedup(a.Research)
}
))
}
onSpeedup(e) {
s.IZ.isTutorialMode() || this.type === e && this.setCompletedNow()
}
init() {
this.userSettingKey = `${this.userSettingKeyPrefix}_${this.type}`
}
}
s.IZ.model.strategicadviser.SpeedupAdvice = o
}
,
21203: (e,t,i)=>{
var s = i(92893)
, r = i.n(s)
, n = i(55542)
, a = i(39513)
, o = i(65814)
, l = i(72053)
, u = i(6670)
, h = i(87928)
, g = i(13775);
class c extends o.y {
constructor() {
super(),
this.successEvaluationInterval = 5e3,
this.adviserLoaded = Date.now()
}
onEvaluationSuccessful() {
var e;
if (a.IZ.config.isMobileClient)
return;
const t = (null === (e = this.getPremiumIdToRewardAmountMap()) || void 0 === e ? void 0 : e[a.IZ.getMod().getPremiumCurrencyItemID()]) ?? 0
, i = new u.A({
backgroundClose: !1,
showCloseButton: !1,
onPopupInitializedCallback: this.onRewardPopupInitialized.bind(this),
templateName: "adviser_reward",
templateModel: {
title: a.IZ.i18n.gettext("Congratulations! You played the PC version for more than 15 minutes. Here is your reward:"),
body: `+ ${g.Z.formatNumber(t)}`,
confirmButtonText: a.IZ.i18n.gettext("Collect")
}
});
n.N.publish(i)
}
onRewardPopupInitialized(e, t) {
r()(".func_confirm_dialog_accept", e).onLzrButtonClick((()=>{
a.IZ.strategicAdviseManager.collectAdviseReward(this.adviseID),
t.onClose()
}
))
}
isPossible() {
return a.IZ.user.playedMobileFirst()
}
isFinished() {
return this.getRemainingAmount() <= 0
}
showHowTo() {
n.N.publish(h.q.SHOW_CROSS_PLATFORM_TEASER, {
onlyLoginLink: !0
})
}
isSuccessfulPreAdviserTask() {
return !a.IZ.config.isMobileClient && this.getRemainingAmount() <= 0
}
getRemainingAmount() {
const e = l.n.getCurrentUser().getTotalDesktopPlaytime()
, t = 60 * this.amount;
return Math.ceil(Math.max(0, t - e) / 60)
}
}
a.IZ.model.strategicadviser.TryDesktopAdvice = c
}
,
99335: (e,t,i)=>{
var s = i(39513)
, r = i(65814);
class n extends r.y {
isPossible() {
return s.IZ.gameState.getTutorialState() && s.IZ.isTutorialMode()
}
}
s.IZ.model.strategicadviser.TutorialFinishedAdvice = n
}
,
37355: (e,t,i)=>{
i(55542);
var s = i(11080)
, r = i(39513)
, n = i(65814)
, a = i(25482);
i(87542),
i(68064),
i(87928);
class o extends n.y {
constructor() {
super(),
this.unitItemID = null,
this.unitID = -1,
this.unitType = null,
this.amount = 0,
this.ignoredAmount = 0,
this.countOnlyOngoingProductions = !1,
this.waitUntilFinish = r.IZ.config.waitAdvicesUntilFinish,
this.hideOnNotStartableState = r.IZ.config.hideNotStartableAdvices,
this.strictMode = !1
}
getUnitType() {
const e = r.IZ.getMod();
if (null === this.unitType && (this.unitItemID ? this.unitType = e.getUnitTypeByItemID(this.unitItemID) : this.unitType = e.getUnitType(this.unitID)),
this.unitType && e.hasFactionSpecificBalancing()) {
const t = this.unitType.getFactionBaseItemId();
this.unitType = Object.values(e.getFactionSpecificUnitTypes()).find((e=>e.getFactionBaseItemId() === t))
}
return this.unitType
}
isPossible() {
return !!this.processPreAdviserConstraints() && (!!this.getUnitType() && (!(this.hideOnNotStartableState && !this.canStartProduction()) && (this.getRemainingAmount() > 0 && this.getNextProvinces().length > 0)))
}
getProgressAmount() {
var e;
const t = this.strictMode ? this.amount : (null === (e = this.getNextProvinces()) || void 0 === e ? void 0 : e.length) ?? 0;
return Math.max(0, t - this.getRemainingAmount())
}
getRemainingAmount() {
let e = 0;
const t = this.getUnitType();
if (this.strictMode) {
const e = r.IZ.gameState.getPlayerStatisticsState().getNumProducedUnit(t.getStatsColumnID());
return Math.max(0, this.amount - (e - this.ignoredAmount))
}
if (!this.countOnlyOngoingProductions) {
const i = r.IZ.gameState.getArmyState().getNationArmiesArray(r.IZ.config.userData.playerID);
for (let s = 0; s < i.length; s++) {
let r = i[s].getUnitByStatsColumnID(t.getStatsColumnID());
r ? e += r.size : (r = i[s].getUnit(t.getItemID()),
r && (e += r.size))
}
}
const i = r.IZ.gameState.getMapState().getPlayerProvinces();
for (let s = 0; s < i.length; s++)
!this.waitUntilFinish && i[s].isProducingUnitByStatsColumnID(this.getUnitType().getStatsColumnID()) && e++;
return Math.max(0, this.amount - e - this.ignoredAmount)
}
isFinished() {
return !this.isUnitTypeSupportedByGame() || this.getRemainingAmount() <= 0
}
canBeIgnored() {
return !(this.strictMode && 0 === this.getRemainingAmount())
}
getNextProvinces() {
return r.IZ.gameState.getMapState().getPlayerProvinces().filter((e=>e.canProduceUnit(this.getUnitType().getItemID()) || e.isProducingUnitByStatsColumnID(this.getUnitType().getStatsColumnID())))
}
getTargetProvince() {
return this.getNextProvinces()[0] ?? null
}
getIcon() {
const e = this.getUnitType().getItemID();
return e ? r.IZ.ui.iconsHelper.getUnitIcon(e) : null
}
showHowTo() {
let e = null;
this.getNextProvinces().length > 0 && (e = this.getNextProvinces()[0]),
e && this.startAssistingTask(new a.y(this.getUnitType(),e))
}
isSuccessfulPreAdviserTask() {
return this.getRemainingAmount() <= 0
}
isUnitTypeSupportedByGame() {
return !!this.getUnitType()
}
canGuide() {
return "" === this.getNotGuidableReason()
}
getNotGuidableReason() {
const e = this.getTargetProvince();
return e && e.isProducingUnitByStatsColumnID(this.getUnitType().getStatsColumnID()) ? s.q.IsAlreadyProducing : ""
}
getNotGuidableReasonHR() {
return this.getNotGuidableReason() === s.q.IsAlreadyProducing ? r.IZ.i18n.gettext("Production is already in progress!") : ""
}
canStartProduction() {
return r.IZ.gameState.getMapState().getPlayerProvinces().some((e=>e.canProduceUnit(this.getUnitType().getItemID())))
}
}
r.IZ.model.strategicadviser.UnitProductionAdvice = o
}
,
60105: (e,t,i)=>{
i.d(t, {
c: ()=>s
});
const s = {
NONE: "NONE",
FREE: "FREE",
SCENARIO: "SCENARIO",
DYNAMIC: "DYNAMIC"
}
}
,
13524: (e,t,i)=>{
i.d(t, {
M: ()=>s
});
class s {
static lookupFullName(e) {
return s.JAVA_TYPES[e] || e
}
static arrayToLinkedList(e) {
return this.containsListTypeHint(e) ? e : ["java.util.LinkedList", e]
}
static linkedListToArray(e) {
return e[1]
}
static objectToHashMap(e) {
return e["@c"] = "java.util.HashMap",
e
}
static vectorToArray(e) {
return e[1]
}
static arrayToVector(e) {
return this.containsListTypeHint(e) ? e : ["java.util.Vector", e]
}
static hashSetToArray(e) {
return e[1]
}
static containsListTypeHint(e) {
let t = !1;
if (e && e[0]) {
const i = `${e[0]}`;
t = i.indexOf("Vector") > -1 || i.indexOf("List") > -1
}
return t
}
}
s.IGNORED_TYPES = {
"java.util.HashMap": !0,
HashMap: !0,
"java.util.LinkedHashMap": !0,
"java.util.concurrent.ConcurrentHashMap": !0,
"java.util.Collections$EmptyMap": !0,
"java.util.TreeMap": !0,
TreeMap: !0,
"java.util.Vector": !0,
"ultshared.UltActionFailedException": !0,
"ultshared.UltReportArticle": !0,
"ultshared.UltMap": !0,
"ultshared.spyjobs.UltRevealAllArmiesJob": !0,
"ultshared.spyjobs.UltDamageUpgradeJob": !0,
"ultshared.spyjobs.UltExtendProductionTimeJob": !0,
"ultshared.spyjobs.UltRevealProvinceArmiesJob": !0,
"ultshared.spyjobs.UltCountryInfoJob": !0,
"ultshared.spyjobs.UltDecreaseMoralJob": !0,
"ultshared.spyjobs.UltDestroyResourceJob": !0,
"ultshared.spyjobs.UltCatchJob": !0,
"ultshared.spyjobs.UltExtendBuildingTimeJob": !0,
"ultshared.spyjobs.UltDiplomacyInfoJob": !0,
"ultshared.spyjobs.UltFactoryInfoJob": !0,
"ultshared.spyjobs.UltResourceInfoJob": !0,
"ultshared.spyjobs.UltChangeArmyPrivilegeJob": !0,
"ultshared.spyjobs.UltRevealSpiesJob": !0,
"ultshared.spyjobs.UltStealTaxJob": !0,
"ultshared.spyjobs.UltInterceptJob": !0,
"ultshared.spyjobs.UltUeberlaufJob": !0,
"ultshared.warfare.UltUnitSpawnerConfig": !0,
"ultshared.warfare.FrontendRetreatSuppression": !0,
"ultshared.warfare.FrontendUnitMoraleDamageConfig": !0,
"ultshared.spyjobs.UltResearchInfoJob": !0,
"ultshared.gamefeatures.UltTestGameFeature": !0,
"ultshared.gamefeatures.UltHonorPeriodRule": !0,
"ultshared.gamefeatures.UltMinActivityRule": !0,
"ultshared.gamefeatures.UltAnonymousGameFeature": !0,
"ultshared.gamefeatures.UltGoldmarkLimitGameFeature": !0,
"ultshared.gamefeatures.UltTournamentGameFeature": !0,
"ultshared.gamefeatures.UltStartLevelGameFeature": !0,
"ultshared.gamefeatures.UltUnitPackGameFeature": !0,
"ultshared.gamefeatures.UltProvinceConquerQuestsFeature": !0,
"ultshared.tutorial.UltTutorialContext": !0,
"ultshared.UltSpyReports$UltDailySpyStates": !0,
"ultshared.modding.configuration.UltDefensiveAiConfig": !0,
"ultshared.modding.configuration.UltProbabilityDistribution": !0,
"ultshared.modding.ImmutableProvinceMoralConfig": !0,
PeacePeriodFeature: !0,
"ultshared.gamefeatures.UltPeacePeriodRule": !0,
PeacePeriodAIFeature: !0,
"ultshared.gamefeatures.UltPeacePeriodAiRule": !0,
"ultshared.tutorial.tasks.UltProvinceCapturedSetup": !0,
"ultshared.gamefeatures.UltEndDayOfGameRule": !0,
"ultshared.gamefeatures.UltPauseGameFeature": !0,
"ultshared.gamefeatures.UltXpBoostGameFeature": !0,
"ultshared.gamefeatures.UltTimeScaleGameFeature": !0,
"ultserver.UltServerResearchState": !0,
"ultserver.UltGameProperties": !0,
"ultserver.UltUserLogin": !0
},
s.JAVA_TYPES = {
a: ".UltArmy",
u: ".UltModableUnit",
gc: ".UltGotoCommand",
ac: ".UltAttackCommand",
pc: ".UltPatrolCommand",
wc: ".UltWaitCommand",
cc: ".UltConvertCommand",
uc: ".UltUpgradeCommand",
rec: ".UltReloadCommand",
duc: ".UltDeployUnitCommand",
dwc: ".UltDeployingWaitCommand",
ba: ".UltBattle",
spy: ".UltSpy",
ap: ".UltAirParameters",
mu: ".UltModableUpgrade",
su: ".UltSpecialUnit",
p: ".UltProvince",
sp: ".UltSeapoint",
c: ".UltConnection",
be: ".UltBuildQueueEntry",
im: ".UltImpact",
mf: ".UltMoraleFactors",
rc: ".UltResourceCategory",
re: ".UltResourceEntry",
ut: ".UltUpgradeType"
}
}
,
82673: (e,t,i)=>{
var s = i(81177)
, r = i(58202);
r.F.UltAIState = class {
constructor() {
this.stateType = s.V.STATE_TYPE_AI_STATE,
this.profiles = null
}
getGlobalApproval(e) {
let t = 0
, i = 0;
for (const s in this.profiles)
this.profiles.hasOwnProperty(s) && s != e && (t += this.profiles[s].getApprovalTowards(e),
i++);
return 0 == i ? 0 : t / i
}
getApproval(e, t) {
const i = this.getAIProfile(e);
return null != i ? i.getApprovalTowards(t) : -1
}
getAIProfile(e) {
return this.profiles[e]
}
}
}
,
29323: (e,t,i)=>{
i.d(t, {
B: ()=>r
});
var s = i(58202);
class r {
constructor() {
this.gameProperties = null,
this.userLogins = null,
this.logEntries = null,
this.userIDToMadEntryMap = null,
this.topSuspects = null,
this.madFormula = null,
this._caseMap = {},
this._userIDToMADRecordMap = {}
}
getUserLogins() {
return this.userLogins
}
getLogEntries() {
return this.logEntries
}
getMADMap() {
return this.userIDToMadEntryMap ? this.userIDToMadEntryMap : {}
}
getSuspects() {
return this.topSuspects ? this.topSuspects : []
}
getUserLogin(e) {
for (const t in this.userLogins)
if (this.userLogins.hasOwnProperty(t)) {
const i = this.userLogins[t];
if (i.siteUserID === e)
return i
}
return null
}
initialize(e) {
let t = null;
const i = this.getMADMap();
for (const r in i)
i.hasOwnProperty(r) && (t = i[r],
t.initialize());
const s = this.getSuspects();
for (let r = 0; r < s.length; r++)
t = s[r],
t.initialize();
e && (this._caseMap = e._caseMap,
this._userIDToMADRecordMap = e._userIDToMADRecordMap)
}
getUserMADData(e) {
let t = null;
const i = this.getMADMap();
return t = i.hasOwnProperty(e) ? i[e] : this.getSuspectDataByID(e),
t
}
getSuspectDataByID(e) {
let t = null;
for (let i = 0; i < this.topSuspects.length; i++) {
const s = this.topSuspects[i];
if (s.userID === e) {
t = s;
break
}
}
return t
}
getMADFormula() {
return this.madFormula || ""
}
requestUserMADRecord(e, t) {
const i = this._userIDToMADRecordMap[e];
if (i)
t(i);
else {
const i = this;
hup.adminActionController.executeActionByTypeName(hup.AdminActionTypes.MADRecordInquiry, [e], !0, (function(e) {
i.handleUserMADRecordResponse(e, t)
}
))
}
}
getUserMADRecord(e) {
return this._userIDToMADRecordMap[e]
}
handleUserMADRecordResponse(e, t) {
if (e = hup.messageResolver.resolveAll(e)) {
const i = e.caseIDToLogListMap
, s = {
madEntry: e.madEntry,
caseMap: e.caseIDToLogListMap
};
if (e.madEntry) {
e.madEntry.initialize();
for (const e in i)
if (i.hasOwnProperty(e)) {
this._caseMap[e] = i[e];
const t = i[e];
for (let e = 0; e < t.length; e++) {
t[e].getEntryInTime().initialize(t[e])
}
}
this.userIDToMadEntryMap[e.userID] = e.madEntry,
this._userIDToMADRecordMap[e.userID] = s,
t(s)
}
}
}
getCaseByID(e) {
return this._caseMap[e]
}
}
s.F.UltAdminState = r
}
,
81621: (e,t,i)=>{
i.d(t, {
Y: ()=>n
});
var s = i(54987)
, r = i(87235);
class n extends s.W {
constructor() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null
, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null
, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : e.getAirfieldPosition()
, s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : t.getAirfieldPosition().getClosestEquivalent(e.getAirfieldPosition())
, r = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : -1
, n = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0;
super({
x0: i.x,
y0: i.y,
x1: s.x,
y1: s.y,
locationId: r,
type: n
}),
this.startField = e,
this.targetField = t
}
getStartField() {
return this.startField
}
getTargetField() {
return this.targetField
}
isOnSea() {
return this.startField instanceof r.l
}
isAirConnection() {
return !0
}
}
}
,
60462: (e,t,i)=>{
i(10711),
i(87477);
var s = i(55824)
, r = i.n(s)
, n = i(55542)
, a = i(61809)
, o = i(39513)
, l = i(81177)
, u = i(58202)
, h = i(37887)
, g = i(87928);
u.F.UltArmyState = class {
constructor() {
this.stateType = l.V.STATE_TYPE_ARMY_STATE,
this.armies = {},
this.armiesWithSpyInfo = null,
this.bombardments = {},
this.useTstamp = !0,
this._armiesArray = null,
this._bombardmentsArray = null,
this._armiesWithSpyInfoArray = null,
this.bombardmentCache = {},
this._tmpArmies = [],
this.changedArmyNewlyCreated = {},
this.arrivingArmyTimout = 0
}
update(e) {
this.removeTemporaryArmies(),
this.resetCombinedArmies();
if (!!e.fullUpdate)
this.armies = {},
this.bombardments = {};
else if (e.removedVisibleArmies)
for (let t = 0; t < e.removedVisibleArmies.length; t++) {
const i = e.removedVisibleArmies[t];
delete this.armies[i],
delete this.bombardments[i]
}
this.changedArmyNewlyCreated = {};
for (const t in e.armies)
e.armies.hasOwnProperty(t) && (this.changedArmyNewlyCreated[t] = !this.armies.hasOwnProperty(t));
this.mergeArmies(this.armies, e.armies),
this.mergeArmies(this.bombardments, e.bombardments),
(e.armies || e.bombardments) && this.updateArmiesArray(),
this.stateID = e.stateID,
this.timeStamp = e.timeStamp,
setTimeout((()=>this.scheduleNextGamestateUpdate()), 10)
}
scheduleNextGamestateUpdate() {
const e = a.$B()
, t = this.getArmiesWithSpyInfoArray();
let i, s = Number.POSITIVE_INFINITY;
for (let r = 0; r < t.length; r++) {
const n = t[r];
i = n.isMoving() ? n.getEstimatedArrivalTime() - e : n.getNextAttackTime() - e,
i > 2e3 && i < s && (s = i)
}
clearTimeout(this.arrivingArmyTimout),
s < Number.POSITIVE_INFINITY && (this.arrivingArmyTimout = setTimeout((()=>n.N.publish(g.q.REQUEST_GAMESTATE_UPDATE)), s))
}
updateArmiesArray() {
this._armiesArray = null,
this._bombardmentsArray = null,
this.bombardmentCache = {},
this.nationArmies = null
}
mergeArmies(e, t) {
if (t)
for (const i in t)
if (t.hasOwnProperty(i)) {
const s = t[i];
s instanceof h.ne ? s.isRemoved() || 0 === s.getSize() && s.isOwnOrAllyArmy() && !s.isWithdrawing() || !s.getPosition() ? delete e[i] : e[i] = s : window.logError(new Error(`Non-army in newArmies map object received: \n${JSON.stringify(s)}`))
}
}
publishUpdate(e) {
n.N.publish(g.q.UI_ARMY_STATE_UPDATED, {
changedArmyIDs: Object.keys((null == e ? void 0 : e.armies) ?? {}).map((e=>Number(e)))
})
}
getArmies() {
return this.armies
}
getArmiesArray() {
return null == this._armiesArray && this.armies && (this._armiesArray = Object.values(this.armies)),
this._armiesArray
}
removeTemporaryArmies() {
let e, t = this._tmpArmies.length;
for (; t--; )
e = this._tmpArmies[t],
this.armies[e] && delete this.armies[e],
this.nationArmies[o.IZ.config.userData.playerID][e] && delete this.nationArmies[o.IZ.config.userData.playerID][e];
this._tmpArmies = []
}
resetCombinedArmies() {
this.armiesWithSpyInfo = null,
this._armiesWithSpyInfoArray = null,
this.lowFrequencyArmies = null,
this.highFrequencyArmies = null
}
getVisibleArmies() {
const {playerID: e} = o.IZ.config.userData
, t = o.IZ.gameState.getForeignAffairsState()
, i = []
, s = this.getArmiesArray();
for (let r = 0; r < s.length; r++) {
const n = s[r];
t.canSeeArmies(e, n.getOwnerID()) && i.push(n)
}
return i
}
getArmiesWithSpyInfo() {
if (!this.armiesWithSpyInfo) {
var e;
const i = null === (e = o.IZ.gameState.getSpyState().getSpyReport().getArmyState(o.IZ.gameState.getGameInfoState().getDayOfGame())) || void 0 === e ? void 0 : e.getArmies();
if (i) {
const e = {};
let s;
const {playerID: n} = o.IZ.config.userData
, a = new Set(Object.keys(i))
, l = Object.keys(this.armies);
for (const t of l) {
let o = this.armies[t];
o.getOwnerID() !== n && (s = i[t],
s && (0 === o.getSize() && (o = r()(o),
o.setUnits(s.getUnits(!1)),
o.setSpyRevealedTime(s.getSpyRevealedTime())),
a.delete(t))),
e[t] = o
}
const u = this.getArmiesArray()
, h = o.IZ.getMod().hasAirplanesWw2();
for (let t = u.length - 1; t >= 0; t--) {
const e = u[t];
if (e.getOwnerID() === n) {
let t = e.getViewWidth();
t *= t;
for (const r of a)
if (s = i[r],
s && !s.hasStealth) {
(h && e.getAirPosition().getDistance(s.getAirPosition(), !0) < t || !h && e.getPosition().getDistance(s.getPosition(), !0) < t) && a.delete(r)
}
}
}
for (const r of a) {
var t;
s = i[r],
null !== (t = s) && void 0 !== t && t.getPosition() && (e[r] = s)
}
this.armiesWithSpyInfo = e
} else
this.armiesWithSpyInfo = this.armies
}
return this.armiesWithSpyInfo
}
getArmiesWithSpyInfoArray() {
return null == this._armiesWithSpyInfoArray && (this._armiesWithSpyInfoArray = Object.values(this.getArmiesWithSpyInfo())),
this._armiesWithSpyInfoArray
}
getArmy(e) {
return this.armies[e] || null
}
getArmyWithSpyInfo(e) {
return this.getArmiesWithSpyInfo()[e] || null
}
getArmyName(e) {
const t = this.getArmy(e);
return t ? t.getName() : null
}
addArmy(e, t, i) {
return t = t || e.getArmyID(),
i && (t = this.getNextUnitUID(o.IZ.config.userData.playerID),
this._tmpArmies.push(t),
this.nationArmies[o.IZ.config.userData.playerID][t] = e,
e.unitUID = t,
this.resetCombinedArmies()),
this.armies[t] = e,
t
}
getNextUnitUID(e) {
const t = this.getNationArmies(e);
let i = 1e4 * e + 1;
for (; t[i]; )
++i;
return i
}
getBombardments() {
return this.bombardments
}
getBombardmentsArray() {
return null === this._bombardmentsArray && this.getBombardments() && (this._bombardmentsArray = Object.values(this.getBombardments())),
this._bombardmentsArray
}
getNationArmiesArray(e) {
return Object.values(this.getNationArmies(e))
}
getNationArmies(e) {
e = parseInt(e, 10),
this.nationArmies || (this.nationArmies = {});
let t = this.nationArmies[e];
if (!t) {
t = {};
for (const i in this.armies)
if (this.armies.hasOwnProperty(i)) {
const s = this.armies[i];
s.getOwnerID() === e && (t[i] = s)
}
this.nationArmies[e] = t
}
return t
}
getUnitCount(e) {
if (e <= 0)
return 0;
const t = this.getNationArmies(e);
let i = 0;
for (const s in t)
t.hasOwnProperty(s) && (i += t[s].getSize());
return i
}
getUnitCountAt(e, t, i) {
let s = 0;
const r = this.getArmiesAt(e, t, 5);
for (let n = 0; n < r.length; n++) {
const e = r[n].getUnitByTypeID(i);
e && (s += e.getSize())
}
return s
}
updateStateID() {
this.stateID = `1${this.stateID}`
}
getArmiesAt(e, t, i, s) {
const r = i * i
, n = a.$B()
, o = []
, l = this.getArmiesArray();
for (let a = l.length - 1; a >= 0; a--) {
const i = l[a];
if (this.shouldIncludeInArmies(i, t, s)) {
i.getPosition(n).getDistance(e, !0) <= r && o.push(i)
}
}
return o
}
shouldIncludeInArmies(e, t, i) {
return !e.isRemoved() && (t < 0 || (i ? !o.IZ.gameState.getForeignAffairsState().hasRightOfWay(t, e.getOwnerID()) : e.getOwnerID() === t))
}
getBombardmentsAt(e) {
if (!this.bombardmentCache[e]) {
const t = []
, i = this.getArmiesArray();
let s;
for (let n = i.length - 1; n >= 0; n--)
s = i[n],
s.isRemoved() || s.getAttackArmyID() === e && t.push(s);
const r = Object.values(this.bombardments);
for (let n = r.length - 1; n >= 0; n--)
s = r[n],
s.isRemoved() || s.getAttackArmyID() === e && t.push(s);
this.bombardmentCache[e] = t
}
return this.bombardmentCache[e]
}
searchArmy(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
return this.getArmiesArray().find((i=>[i.getName(), i.getFullName()].some((i=>i.normalize("NFD").replace(t, "").toLowerCase().includes(e)))))
}
getArmiesInCloseCombatRange(e) {
return this.getArmiesAt(e, -1, o.IZ.config.consts.ARMY_CLOSE_COMBAT_RANGE)
}
}
}
,
41048: (e,t,i)=>{
i.d(t, {
a: ()=>p
});
i(87477);
var s = i(61809)
, r = i(39513)
, n = i(73576)
, a = i(58202)
, o = i(13775)
, l = i(33558);
const u = {
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': "&quot;",
"'": "&#x27;",
"`": "&#x60;"
}
, h = /[&<>"'`]/g
, g = /[&<>"'`]/
, c = e=>u[e] ?? "&amp;"
, d = e=>g.test(e) ? e.replace(h, c) : e;
class p {
constructor() {
this.authorID = -1,
this.title = "",
this.day = 0,
this.receiverID = null,
this.senderID = null,
this.imageID = -1,
this.senderFlagID = -1,
this.receiverFlagID = -1,
this.author = "",
this.address = "",
this.time = null,
this.messageBody = "",
this.timeStamp = null,
this.reportCount = null,
this.extended = p.UltArticleOption.NONE,
this.allianceID = 0,
this["@c"] = "ultshared.UltArticle",
this._renderedTitle = null,
this._renderedMessageBody = null
}
getMessageBody(e) {
if (e)
return this.messageBody;
if ("string" != typeof this._renderedMessageBody) {
let e;
if (this.authorID >= -1)
e = d(this.messageBody);
else
try {
e = r.IZ.ui.helper.render(this.messageBody, {})
} catch (t) {
bl_print(`Error in UltArticle.getMessageBody(). Could not properly parse handlebars strings in template: ${this.messageBody}`),
e = this.messageBody
}
this._renderedMessageBody = s.hU(e)
}
return this._renderedMessageBody
}
setMessageBody(e) {
this.messageBody = e,
this._renderedMessageBody = null
}
getTitle() {
if ("string" != typeof this._renderedTitle)
if (this.authorID >= -1)
this._renderedTitle = d(this.title);
else
try {
this._renderedTitle = r.IZ.ui.helper.render(this.title, {})
} catch (e) {
bl_print(`Error in UltArticle.getTitle(). Could not properly parse handlebars strings in template: ${this.title}`),
this._renderedTitle = this.title
}
return this._renderedTitle
}
setTitle(e) {
this.title = e,
this._renderedTitle = null
}
getSenderID() {
return this.senderID
}
setSenderID(e) {
this.senderID = e
}
getSender() {
return r.IZ.gameState.getPlayerState().getPlayer(this.senderID)
}
getSenderNationName() {
return this.isAnonymous() ? "" : this.getSender().getNationName()
}
isSenderPassiveAI() {
return this.getSender().isPassiveAI()
}
getReceiverID() {
return this.receiverID
}
setReceiverID(e) {
this.receiverID = e
}
getReceiver() {
return r.IZ.gameState.getPlayerState().getPlayer(this.receiverID)
}
isReceiverPassiveAI() {
return this.getReceiver().isPassiveAI()
}
getReceiverName() {
return this.receiver
}
setReceiverName(e) {
this.receiver = e
}
getAuthorID() {
return this.authorID
}
setAuthorID(e) {
this.authorID = e
}
getAuthor() {
return this.author
}
setAuthor(e) {
this.author = e
}
getAddress() {
return this.address
}
setAddress(e) {
this.address = e
}
getDay() {
return this.day
}
getTime() {
return this.getDateObj().toLocaleTimeString()
}
getTimeStamp() {
return this.timeStamp
}
getDate() {
return this.getDateObj().toLocaleDateString()
}
getImageID() {
return this.imageID ? Number.isFinite(this.imageID.imageID) ? this.imageID.imageID : this.imageID : -1
}
hasImage() {
return this.imageID
}
setImageID(e) {
this.imageID = e
}
getReceiverFlagID() {
return this.receiverFlagID
}
getSenderFlagID() {
return this.senderFlagID
}
setSenderFlagID(e) {
this.senderFlagID = e
}
isSystemMessage() {
return this.authorID <= p.SYSTEM_MESSAGE
}
isSenderReceiver() {
return this.senderID == this.receiverID
}
isNewerThan(e) {
return this.getTimeStamp() > e
}
isNewPlayerArticle(e, t) {
return !this.isSystemMessage() && this.isNewerThan(e) && this.getSenderID() != t
}
getMessageUID() {
return this.messageUID
}
getExtended() {
return this.extended
}
hasRetirementOption() {
return this.extended === p.UltArticleOption.RETIREMENT
}
hasShareMapOption() {
return this.extended === p.UltArticleOption.SHARE_MAP && r.IZ.getMod().hasGrowthHacking()
}
hasInviteFriendOption() {
return this.extended === p.UltArticleOption.INVITE_FRIEND && r.IZ.getMod().hasGrowthHacking()
}
setDeletedBySender(e) {
this.deletedBySender = e
}
isDeletedBySender() {
return this.deletedBySender
}
setDeletedByReceiver(e) {
this.deletedByReceiver = e
}
isDeletedByReceiver() {
return this.deletedByReceiver
}
isReadByReceiver() {
return this.readByReceiver
}
isReadByPlayer() {
const {playerID: e} = r.IZ.config.userData;
return e == this.getAuthorID() || this.isReadByReceiver()
}
isAnonymous() {
return this.getAuthorID() == p.ANONYMOUS_AUTHOR_ID
}
isDeletedByPlayer() {
const {playerID: e} = r.IZ.config.userData;
return e == this.getAuthorID() && this.isDeletedBySender() || e == this.getReceiverID() && this.isDeletedByReceiver()
}
compareByDateObj(e) {
return this.getDateObj().getTime() - e.getDateObj().getTime()
}
setDateObj(e) {
this.dateObj = e
}
getDateObj() {
return this.dateObj || (this.dateObj = new Date(s._c(this.getTimeStamp()))),
this.dateObj
}
compareByDayTime(e) {
let t = e.getDay() - this.getDay();
return 0 === t && (t = this.compareByTime(e)),
t
}
sortByTime(e, t) {
return e.compareByTime(t)
}
compareByTime(e) {
const t = this.getTime()[1].split(":")
, i = e.getTime()[1].split(":");
let s;
return s = t[0] != i[0] ? t[0] > i[0] ? -1 : 1 : t[1] != i[1] ? t[1] > i[1] ? -1 : 1 : t[2] != i[2] ? t[2] > i[2] ? -1 : 1 : 0,
s
}
isReported() {
return this.reportCount && Number(this.reportCount) > 0
}
getArticleDateInRealTime() {
var e, t;
return (null === (e = r.IZ.gameState) || void 0 === e || null === (t = e.getGameInfoState()) || void 0 === t ? void 0 : t.getRealTime(this.timeStamp)) ?? 0
}
getArticleInfo() {
const e = r.IZ.gameState.getPlayerState()
, t = e.getPlayer(this.getSenderID());
let i = o.Z.getFormattedTime(this.getArticleDateInRealTime())
, s = "";
if ("" !== this.getAddress() && this.getAuthorID() > 0 && (s = r.IZ.i18n.gettext(", %s", this.getAddress())),
this.getAuthorID() <= p.SYSTEM_MESSAGE && "" !== this.getAuthor())
i = `${this.getAuthor()}, ${s}${i}`;
else if (this.isAnonymous())
i = r.IZ.i18n.gettext("Anonymous, %s", i);
else if (t.getName() && "" !== t.getName())
i = l.w.getModdedText(l.w.MsgId.NEWSPAPER_ARTICLE_INFO, "" !== s ? s : null, t, i);
else if (this.getSenderID() > n.M.guestPlayerID && (this.getAuthorID() > p.ANONYMOUS_AUTHOR_ID || "" === this.getAuthor())) {
const t = e.getPlayer(this.getSenderID());
if (this.getReceiverID() > 0 && this.getReceiverID() != this.getSenderID()) {
const s = e.getPlayer(this.getReceiverID());
i = r.IZ.i18n.gettext("%s/%s, %s", s.getNationName(), t.getNationName(), i)
} else
i = r.IZ.i18n.gettext("%s, %s", t.getNationName(), i)
}
return i
}
getArticleImage() {
if (!this.hasImage())
return "";
if (this.imageID && this.imageID.imageName) {
var e;
let t = null === (e = this.imageID.imageName.split(".")[0]) || void 0 === e ? void 0 : e.toLowerCase();
const i = []
, s = t.split("/");
2 === s.length && (i.push(s[0]),
t = s[1]),
i.length || i.push(r.IZ.config.newspaperImagesDirectory);
const n = r.IZ.imagePropertiesHelper.getPropertiesByFileNamePattern(t, i);
if (n && n.length) {
return `<img src="${`images/${n[this.getMessageUID() % n.length].imageURL}`}" class="news_image"/>`
}
return ""
}
const t = this.getImageID();
let i = "";
if (t >= 0) {
let e = -1
, s = 170;
this.imageID.width > 0 && ({width: e, height: s} = this.imageID);
const n = r.IZ.ui.helper.getImgUrl(t, "png");
i = e > 0 ? `<img src="${n}" width="${e}" height="${s}" class="news_image"/>` : `<img src="${n}" height="${s}" class="news_image"/>`
}
return i
}
getAllianceID() {
return this.allianceID
}
hasAllianceFlag() {
return this.senderID > 0 && !this.isAnonymous() && r.IZ.inGameAllianceController.getPlayerAlliance(this.senderID)
}
getSendersInGameAllianceID() {
if (this.senderID > 0) {
const e = r.IZ.gameState.getPlayerProfile(this.senderID);
if (r.IZ.inGameAllianceController.getAllianceByID(e.getTeamID()))
return e.getTeamID()
}
return -1
}
updateArticle(e, t, i, s) {
this.setTitle(t),
this.setMessageBody(i),
s ? this.setAnonymous() : this.updateSender(e)
}
updateSender(e) {
this.setAuthorID(e.getPlayerID()),
this.setSenderID(e.getPlayerID()),
this.setImageID(e.getPlayerImageID()),
this.getSenderFlagID() <= 0 && this.setSenderFlagID(e.getFlagImageID())
}
setAnonymous() {
this.setAuthorID(-1),
this.setSenderFlagID(-1),
this.setAddress(""),
this.setSenderID(-1)
}
canBeReported() {
return this.getSenderID() !== r.IZ.config.userData.playerID && !this.getSender().isComputerPlayer()
}
}
p.ANONYMOUS_AUTHOR_ID = -1,
p.SYSTEM_MESSAGE = -2,
p.SYSTEM_MESSAGE_STATS = -3,
p.UltArticleOption = {
NONE: 0,
RETIREMENT: 1,
INVITE_FRIEND: 2,
SHARE_MAP: 3
},
a.F.UltArticle = p
}
,
15372: (e,t,i)=>{
i.d(t, {
L: ()=>r
});
i(87477);
var s = i(13950);
class r extends Array {
constructor(e) {
super(),
e && e[1] && this.push(...e[1])
}
}
s.x.register("ultshared.UltAskList", (e=>new r(e)))
}
,
84593: (e,t,i)=>{
i.d(t, {
b: ()=>a
});
i(87477);
var s = i(39513)
, r = i(58202)
, n = i(13775);
class a {
constructor() {
this.itemID = -1,
this.set = -1,
this.setOrderID = -1,
this.fullTitle = "",
this.description = "",
this.collectibleRewardOfferID = null,
this.displayOrderID = 0,
this.rewardOffer = null,
this.type = null
}
static instance(e) {
return s.IZ.contentItems[e]instanceof a ? s.IZ.contentItems[e] : null
}
static getAwards() {
if (null == a.awards) {
const e = {}
, t = s.IZ.contentItems;
for (const i in t)
t.hasOwnProperty(i) && t[i]instanceof a && (e[i] = t[i]);
a.awards = e
}
return a.awards
}
static getAvailableAchievementTypes() {
if (!a.availableAchievementTypes) {
const e = new Set(Object.values(a.getAwards()).map((e=>e.getType())));
a.availableAchievementTypes = Array.from(e)
}
return a.availableAchievementTypes
}
static getSetProgress(e, t) {
const i = a.getAwardsInSet(e);
for (let s = i.length - 1; s >= 0; s--)
if (i[s].userIsFinished(t))
return s;
return -1
}
static getAwardsSets() {
if (null == a.awardSets) {
const e = {}
, t = a.getAwards();
for (const i in t)
t.hasOwnProperty(i) && (e[t[i].getSet()] || (e[t[i].getSet()] = []),
e[t[i].getSet()].push(t[i]));
for (const i in e)
e.hasOwnProperty(i) && e[i].sort((function(e, t) {
return e.getSetOrderId() > t.getSetOrderId() ? 1 : (e.getSetOrderId(),
t.getSetOrderId(),
0)
}
));
a.awardSets = e
}
return a.awardSets
}
static getAwardsInSet(e) {
return a.getAwardsSets()[e]
}
getId() {
return this.itemID
}
getFullTitle() {
return this.fullTitle[s.IZ.config.userDataLocal.lang]
}
getDescription() {
const e = this.description[s.IZ.config.userDataLocal.lang];
return e ? s.IZ.jed.sprintf(e, n.Z.formatNumber(this.getAmount())) : ""
}
getSet() {
return this.set
}
getSetOrderId() {
return this.setOrderID
}
userIsFinished(e) {
const t = e.getAwardProgress(this.getId());
return t && 1 == t.finished
}
getLastReceivedTstamp(e) {
const t = e.getAwardProgress(this.getId());
return t ? t.tstampLast : 0
}
getAmount() {
return this.amount
}
getCollectibleRewardOfferID() {
return this.collectibleRewardOfferID
}
setCollectibleRewardOffer(e) {
this.rewardOffer = e
}
hasCollectibleRewards() {
return this.collectibleRewardOfferID && this.getCollectibleRewardAmount() > 0
}
getCollectibleRewardAmount() {
return this.rewardOffer ? this.rewardOffer.getInventoryIngameAmount() : 0
}
getCollectibleRewardAmountFormatted() {
return n.Z.formatNumber(this.getCollectibleRewardAmount())
}
getCollectibleRewardAmountFormattedWithSign() {
return n.Z.formatNumber(this.getCollectibleRewardAmount(), 0, !0)
}
getDisplayOrderID() {
return this.displayOrderID
}
getType() {
return parseInt(this.type, 10)
}
}
a.awards = null,
a.availableAchievementTypes = null,
a.awardSets = null,
r.F.UltAward = a
}
,
71582: (e,t,i)=>{
i.d(t, {
F: ()=>r
});
i(87477);
var s = i(13950);
class r extends Array {
constructor(e) {
super(),
e && e[1] && this.push(...e[1])
}
}
s.x.register("ultshared.UltBidList", (e=>new r(e)))
}
,
82840: (e,t,i)=>{
i.d(t, {
ff: ()=>d,
zb: ()=>c
});
i(72287),
i(42074),
i(64974),
i(50481),
i(87477);
var s = i(34229)
, r = i(64842)
, n = i(61809)
, a = i(41788)
, o = i(58202)
, l = i(23794)
, u = i(71544);
function h(e) {
const t = (0,
n.NV)(e)
, {length: i} = t
, s = new Uint16Array(i / 2);
let r = 0;
for (let n = 0; n < i; n += 4)
s[r++] = t[n] << 8 ^ t[n + 1],
s[r++] = t[n + 2] << 8 ^ t[n + 3];
return s
}
function g() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
const t = []
, i = e.reduce(((e,t)=>e + t.length), 0);
if (i) {
const s = new Uint16Array(2 * i);
let r = 0
, n = 0;
for (const i of e) {
for (const e of i)
s[n++] = e.x,
s[n++] = e.y;
t.push(s.subarray(r, n)),
r = n
}
}
return t
}
class c extends a.j {
borders = [];
terrainType = l.Ky.UNDEFINED;
visualTerrainType = l.Ky.UNDEFINED;
terrainMarkerPositions = null;
coastal = !1;
borderSegments = [];
bounds = new Float32Array;
_neighbours = null;
isUltBorderedLocation() {}
applyData(e) {
if (super.applyData(e),
e.b && (this.borders = [h(e.b), ...g(e.xb)].filter((e=>e.length > 0))),
e.c) {
const t = r.E.toPoint(e.c);
t && (this.capital = t)
}
if (this.terrainType = e.tt ?? l.Ky.UNDEFINED,
this.visualTerrainType = this.terrainType,
e.vtt) {
const t = l.Ky[String(e.vtt).toUpperCase()];
t && (this.visualTerrainType = t)
}
if (this.terrainMarkerPositions = e.tmp ?? null,
this.coastal = e.co ?? !1,
e.bt && e.bn) {
const t = (0,
n.NV)(e.bt)
, i = e.bn;
this.borderSegments = function(e, t) {
const i = []
, s = e.length;
function r(e) {
const i = t[e]
, r = t[(e + 1) % s];
if (0 !== r.length)
for (let t = 0; t < i.length; ++t) {
const e = i[t];
for (let t = 0; t < r.length; ++t)
if (e === r[t])
return e
}
return -1
}
function n(t, i, s) {
let r = e[t];
-1 !== s && (r &= ~u.u.COAST);
for (let n = t + 1; n < i; ++n)
r &= e[n];
return r & u.u.STATIC_MASK
}
let a = 0
, o = r(a);
for (let u = 1; u < s; ++u) {
const e = r(u);
if (e !== o) {
const t = n(a, u, o);
i.push({
start: a,
end: u,
neighbour: o,
borderType: t
}),
a = u,
o = e
}
}
const l = i[0];
if (l && o === l.neighbour)
l.end += s,
l.start = a,
i.push(i.shift());
else {
const e = s
, t = n(a, e, o);
i.push({
start: a,
end: e,
neighbour: o,
borderType: t
})
}
return i
}(t, i)
}
}
getBorder() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
return this.borders[e]
}
getNeighbours() {
if (!this._neighbours) {
this._neighbours = new Set;
for (const e of this.getBorderSegments()) {
const t = e.neighbour;
-1 !== t && this._neighbours.add(t)
}
}
return this._neighbours
}
getBorderCount() {
return this.borders.length
}
getBorderSegments() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0;
return e ? this.borderSegments.filter((t=>0 != (t.borderType & e))) : this.borderSegments
}
getBoundsArray() {
return this.bounds
}
containsPoint(e, t) {
if (super.containsPoint(e, t))
for (const i of this.borders)
if ((0,
s.CL)(i, e, t))
return !0;
return !1
}
isBoxOccupied(e, t, i, r) {
if (!(0,
s.Bd)(...this.getBoundsArray(), e, t, i, r))
return !0;
const [n,a] = (0,
s.kA)(e, t, i, r)
, o = 1.44 * (i - e) / 2;
for (const l of this.getConnections()) {
const {x0: e, y0: t, x1: i, y1: r} = l
, [u,h] = (0,
s.qy)(n, a, e, t, i, r);
if ((0,
s.yL)(u, h, n, a) <= o)
return !0
}
return !1
}
getTerrainMarkerPositions(e) {
if (null === this.terrainMarkerPositions) {
const t = this.getConnections()
, i = [];
let n = 0
, a = 0
, o = 2
, l = 8;
const {x: u, y: h} = this.getCapital();
do {
const g = e + 2 * o
, c = e / 2 + o;
let d, p, m = n, I = a;
for (let T = 0; T < t.length; T++) {
const A = t[T];
let y = (0,
s.yL)(u, h, A.x0, A.y0);
const S = (0,
s.yL)(u, h, A.x1, A.y1);
let f, P;
if (y > S ? (f = A.x0,
P = A.y0) : (f = A.x1,
P = A.y1,
y = S),
n = u - .6 * (u - f),
a = h - .6 * (h - P),
(0,
s.yL)(n, a, u, h) > e) {
n -= c,
a -= c;
let t = 0
, u = .6 * e;
const h = Math.abs(A.x0 - A.x1) > Math.abs(A.y0 - A.y1);
do {
u *= -1.18,
h ? (m = n,
I = a + u - o) : (m = n + u - o,
I = a - o),
d = m + g,
p = I + g,
t++
} while (this.isBoxOccupied(m, I, d, p) && t < l);
t < l && i.push(new r.E(...(0,
s.kA)(m, I, d, p)))
}
}
o -= 5,
l += 4
} while (0 === i.length && o >= -10);
const [g,c,d,p] = this.getBoundsArray()
, m = Math.max(1, Math.floor((d - g) / 150) + Math.floor((p - c) / 150))
, I = [];
for (; I.length < m && i.length > 0; ) {
let t = 0
, s = 0;
for (let e = 0; e < i.length; e++) {
let r = I.length > 0 ? 1e4 : i[e].getDistance(this.getCapital());
for (let t = 0; t < I.length; t++)
r = Math.min(r, i[e].getDistance(I[t]));
r > t && (t = r,
s = e)
}
t > e && I.push(i[s]),
i.splice(s, 1)
}
0 === I.length && I.push(this.getCapital()),
this.terrainMarkerPositions = I
}
return this.terrainMarkerPositions
}
getTerrainType() {
return this.terrainType
}
getVisualTerrainType() {
return this.visualTerrainType
}
getTerrainName() {
return l.Ky.getText(this.getTerrainType(), "name")
}
isUrban() {
return this.terrainType === l.Ky.URBAN
}
isOnSea() {
return l.Ky.isOnSea(this.terrainType)
}
}
function d(e) {
return e && "object" == typeof e && "isUltBorderedLocation"in e
}
o.F.UltBorderedLocation = c
}
,
91102: (e,t,i)=>{
i.d(t, {
B: ()=>s
});
const s = {
TALK: "/talk",
WHISPER: "/whisper",
KICK: "/kick",
BAN: "/ban",
UNBAN: "/unban",
JOIN: "/join",
CREATE: "/create",
HELP: "/help",
PING: "/ping",
PONG: "/pong",
SPAM: "/spam",
POLITE: "/polite",
FORUM: "/forum",
MANUAL: "/manual",
CAPS: "/caps",
REPORT: "/report",
REPORT_SPAM: "/report_spam",
DELETE_MESSAGE: "/delete_message",
WARNING: "/warning",
SWEAR: "/swear",
BUG: "/bug",
HELPONLY: "/helponly",
MODS: "/mods",
AGE: "/age",
TOPIC: "/topic",
RULES: "/rules",
LANGUAGE: "/lang",
FREEDOM: "/freedom",
LINKS: "/links",
TEMP_BAN: "/temp_ban",
PERMA_BAN: "/perma_ban",
TEMP_BAN_USER: "/temp_ban_user",
PERMA_BAN_USER: "/perma_ban_user",
ERROR: "/error",
LEAVE: "/leave",
REDEEM: "/redeem",
PREMIUM_ACCOUNT: "/pa",
GOLD: "/gold",
USER_FIRST_JOINED: "/user_first_joined",
INVITE_TO_GAME: "/invite_to_game",
TOS: "/tos",
FAQ: "/faq",
PRIVACY: "/privacy",
WIKI: "/wiki",
RESOURCE: "/resource",
MORALE: "/morale",
MP: "/mp",
BANS: "/bans",
CHEAT: "/cheat",
NEW: "/new",
ARCHIVE: "/archive",
RALLY: "/rally",
GLOBAL: "/global",
TUTORIAL: "/tutorial",
EMBARK: "/embark",
WIN: "/win",
BUILDINGS: "/buildings",
SUGGESTION: "/suggestion",
BUNKERS: "/bunkers",
FORTS: "/forts",
SUBS: "/subs",
DISCORD: "/discord"
}
}
,
69118: (e,t,i)=>{
i.d(t, {
b: ()=>n
});
var s = i(81006)
, r = i(58202);
class n extends s.r {
constructor() {
super(),
this.gameID = 0,
this.inviteeUserID = null,
this.inviteeName = null,
this.scenarioID = null,
this["@c"] = "ultshared.action.UltBroadcastGameInvitationMessage"
}
}
r.F.UltBroadcastGameInvitationMessage = n
}
,
81006: (e,t,i)=>{
i.d(t, {
r: ()=>n
});
var s = i(91102)
, r = i(58202);
class n {
constructor() {
this.receivedTime = 0,
this.room = null,
this.author = null,
this.siteUserID = -1,
this.text = null,
this.type = null,
this.receivedTime = -1,
this.deletedByUser = !1,
this.deletedByAdmin = !1
}
getRoom() {
return this.room
}
getAuthor() {
return this.author
}
getText() {
return this.text
}
setText(e) {
this.text = e
}
getType() {
return this.type
}
getSiteUserID() {
return this.siteUserID
}
setReceivedTime(e) {
this.receivedTime = e
}
getReceivedTime() {
return this.receivedTime
}
getClientMessageID() {
return [this.getSiteUserID(), this.getReceivedTime()].join(".")
}
getCommand() {
return this.getTextPart(0)
}
getKickedOrBannedUserName() {
return this.getTextPart(1)
}
getAdminUserName() {
return this.getTextPart(2)
}
getKickDuration() {
const e = this.getTextPart(3);
return e ? parseInt(e) : 0
}
getTextPart(e) {
let t = "";
if (this.getText()) {
const i = this.getText().split("\n");
i && i[e] && (t = i[e])
}
return t
}
isBanMessage() {
return "PREDEFINED" === this.getType() && this.getCommand() === s.B.PERMA_BAN
}
isKickMessage() {
return "PREDEFINED" === this.getType() && this.getCommand() === s.B.TEMP_BAN
}
isDeletionNotificationMessage() {
return "PREDEFINED" === this.getType() && this.getCommand() === s.B.DELETE_MESSAGE
}
isDeleted() {
return this.deletedByAdmin || this.deletedByUser
}
markAsDeleted() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
this.deletedByAdmin = e,
this.deletedByUser = !e,
this.updateTextForDeleted()
}
updateTextForDeleted() {
this.isDeletedByAdmin() ? this.text = hup.i18n.gettext("This message has been removed by an admin") : this.text = hup.i18n.gettext("This message has been removed by the user")
}
isDeletedByAdmin() {
return this.deletedByAdmin
}
isDeletedByUser() {
return this.deletedByUser
}
isOwnMessage() {
return Number(this.getSiteUserID()) === Number(hup.config.userData.siteUserID)
}
}
r.F.UltBroadcastMessage = n
}
,
84097: (e,t,i)=>{
var s = i(55542)
, r = i(81177)
, n = i(58202)
, a = i(3577)
, o = i(16033)
, l = i(87928);
n.F.UltBuildQueueState = class {
constructor() {
this.stateType = r.V.STATE_TYPE_BUILD_QUEUE_STATE,
this.playerID = -1,
this.queue = null
}
getQueue() {
return this.queue
}
containsProvince(e, t, i) {
for (let s = this.queue.getSize() - 1; s >= 0; s--) {
const r = this.queue.getEntry(s);
if (r.getProvinceID() === e && (!t ^ i || t && r.getUpgrade()instanceof a.z || i && r.getUpgrade()instanceof o.U))
return !0
}
return !1
}
publishUpdate() {
s.N.publish(l.q.UI_BUILD_QUEUE_STATE_UPDATED)
}
}
}
,
54987: (e,t,i)=>{
i.d(t, {
W: ()=>l
});
var s = i(34229)
, r = i(64842)
, n = i(39513)
, a = i(23361)
, o = i(4563);
class l {
_cacheKey = null;
_targetCacheKey = null;
_harbour = null;
_railroad = null;
_airfield2 = null;
constructor(e) {
this.d = e;
const {x0: t, y0: i, x1: r, y1: n} = e;
this.length = (0,
s.yL)(t, i, r, n)
}
get x0() {
return this.d.x0
}
get y0() {
return this.d.y0
}
get x1() {
return this.d.x1
}
get y1() {
return this.d.y1
}
get locationId() {
return this.d.locationId
}
get type() {
return this.d.type
}
getProvinceID() {
return this.d.locationId
}
getType() {
return this.d.type
}
clearCache() {
this._harbour = null,
this._railroad = null,
this._airfield2 = null
}
getCacheKey() {
if (null === this._cacheKey) {
const e = this.isAirConnection() ? 1 : 0
, {x0: t, y0: i, x1: r, y1: n} = this.d;
this._cacheKey = (0,
s.$$)(e, t, i, r, n)
}
return this._cacheKey
}
getTargetCacheKey() {
if (null === this._targetCacheKey) {
const {x1: e, y1: t} = this.d;
this._targetCacheKey = (0,
s.wB)(e, t)
}
return this._targetCacheKey
}
getProvince(e) {
return e.getProvince(this.getProvinceID())
}
getOwnerID(e) {
var t;
return (null === (t = this.getProvince(e)) || void 0 === t ? void 0 : t.getOwnerID()) ?? -1
}
getLength() {
return this.length
}
getClosestPoint(e) {
const {x: t, y: i} = e
, {x0: n, y0: a, x1: o, y1: l} = this.d;
return new r.E(...(0,
s.qy)(t, i, n, a, o, l))
}
getDistance(e) {
const {x: t, y: i} = e
, {x0: r, y0: n, x1: a, y1: o} = this.d
, [l,u] = (0,
s.qy)(t, i, r, n, a, o);
return (0,
s.yL)(l, u, t, i)
}
containsPoint(e, t) {
const {x0: i, y0: r, x1: n, y1: a} = this.d;
return (0,
s.J0)(e, t, i, r, n, a) < .01
}
isAirConnection() {
return !1
}
getBoundsArray() {
return [Math.min(this.x0, this.x1), Math.min(this.y0, this.y1), Math.max(this.x0, this.x1), Math.max(this.y0, this.y1)]
}
getRect() {
const [e,t,i,r] = this.getBoundsArray();
return new s.UL(e,t,i - e,r - t)
}
intersects(e, t, i, r) {
const {x0: n, y0: a, x1: o, y1: l} = this.d;
return (0,
s.UP)(e, t, i, r, n, a, o, l)
}
isOnSea() {
const e = n.IZ.gameState.getMapState().getLocation(this.getProvinceID());
return !e || e.isOnSea()
}
getTerrainType(e) {
var t;
return (null === (t = e.getBorderedLocation(this.getProvinceID())) || void 0 === t ? void 0 : t.getTerrainType()) ?? 0
}
getRailValue(e, t) {
if (null === this._railroad && (this._railroad = 0,
t ?? (t = null == e ? void 0 : e.getProvince(this.getProvinceID())),
t && !t.isNeutral())) {
const e = o.M.RAILROAD;
this._railroad = t.getFeatureValue(e)
}
return this._railroad
}
getHarbourValue(e) {
if (null === this._harbour) {
this._harbour = 0;
const t = e.getProvince(this.getProvinceID());
if (t) {
let e = new r.E(this.x0 - t.getCapital().x,this.y0 - t.getCapital().y)
, i = t.getFeatureValueAt(o.M.HARBOUR, e);
i <= 0 && (e = new r.E(this.x1 - t.getCapital().x,this.y1 - t.getCapital().y),
i = t.getFeatureValueAt(o.M.HARBOUR, e)),
this._harbour = Math.min(1, i)
}
}
return this._harbour
}
hasAirfield(e) {
return this.getAirfieldValueP2(e) > 0
}
getAirfieldValueP2(e) {
if (null === this._airfield2) {
this._airfield2 = 0;
const {x1: t, y1: i} = this
, s = e.getProvinceAt(t, i);
if (s) {
const r = s.getCapital();
if (e.areCoordinatesInRange(t, i, r.x, r.y, 1) && s.hasAirfield()) {
const {playerID: e} = n.IZ.config.userData;
n.IZ.gameState.getForeignAffairsState().canUseAirfields(e, s.getOwnerID()) && (this._airfield2 = s.getFeatureValue(o.M.AIRFIELD))
}
}
}
return this._airfield2
}
static from(e, t) {
let i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1
, s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
return new l({
x0: e.x,
y0: e.y,
x1: t.x,
y1: t.y,
locationId: i,
type: s
})
}
cloneSwapped() {
const e = new l((0,
a.B)(this.d));
return e._cacheKey = this.getCacheKey(),
e
}
splitStartTo(e, t) {
const {x0: i, y0: s, locationId: r, type: n} = this.d;
return new l({
x0: i,
y0: s,
x1: e,
y1: t,
locationId: r,
type: n
})
}
}
}
,
23361: (e,t,i)=>{
i.d(t, {
B: ()=>n,
C: ()=>r
});
class s {
constructor(e, t) {
this.d = e,
this.positions = t
}
get x0() {
return this.positions[this.d.positions + 2]
}
get y0() {
return this.positions[this.d.positions + 3]
}
get x1() {
return this.positions[this.d.positions]
}
get y1() {
return this.positions[this.d.positions + 1]
}
get locationId() {
return this.d.locationId
}
get type() {
return this.d.type
}
}
class r {
constructor(e, t) {
this.d = e,
this.positions = t
}
get x0() {
return this.positions[this.d.positions]
}
get y0() {
return this.positions[this.d.positions + 1]
}
get x1() {
return this.positions[this.d.positions + 2]
}
get y1() {
return this.positions[this.d.positions + 3]
}
get locationId() {
return this.d.locationId
}
get type() {
return this.d.type
}
cloneSwapped() {
return new s(this.d,this.positions)
}
}
function n(e) {
if ("cloneSwapped"in e)
return e.cloneSwapped();
const {x0: t, y0: i, x1: s, y1: r, locationId: n, type: a} = e;
return {
x0: s,
y0: r,
x1: t,
y1: i,
locationId: n,
type: a
}
}
}
,
74303: (e,t,i)=>{
i.d(t, {
f: ()=>s
});
class s {
className = "";
detailMessage = "";
setClassName(e) {
this.className = e
}
isSilentException() {
return ["UltSwitchServerException", "UltClientVersionMismatchException"].includes(this.className)
}
isTutorialStuckException() {
return this.className.includes("UltTutorialStuckException")
}
isMADAccountLockedException() {
return this.className.includes("UltMADAccountLockedException")
}
static isNumericExceptionValue(e) {
return -1 === Math.sign(e)
}
}
}
,
6422: (e,t,i)=>{
i.d(t, {
N: ()=>o
});
var s = i(70776)
, r = i(84810)
, n = i(39513)
, a = i(58202);
class o {
static REVOLT = s._.Revolt;
static WAR = s._.War;
static CEASEFIRE = s._.Ceasefire;
static TRADE_EMBARGO = s._.TradeEmbargo;
static PEACE = s._.Peace;
static NON_AGRESSION_PACT = s._.NonAggressionPact;
static RIGHT_OF_WAY = s._.RightOfWay;
static VIEW_MILITARY_ACTIONS = s._.ViewMilitaryActions;
static MUTUAL_PROTECTION = s._.MutualProtection;
static SHARED_INTELLIGENCE = s._.SharedIntelligence;
static MILITARY_AUTHORITY = s._.MilitaryAuthority;
static ALL_RELATIONS = new Set([o.REVOLT, o.WAR, o.CEASEFIRE, o.TRADE_EMBARGO, o.PEACE, o.NON_AGRESSION_PACT, o.RIGHT_OF_WAY, o.VIEW_MILITARY_ACTIONS, o.MUTUAL_PROTECTION, o.SHARED_INTELLIGENCE, o.MILITARY_AUTHORITY]);
static RELATION_ICON_NAME_MAP = {
[o.REVOLT]: "relationship_state_war",
[o.WAR]: "relationship_state_war",
[o.CEASEFIRE]: "relationship_state_ceasefire",
[o.TRADE_EMBARGO]: "relationship_state_trade_embargo",
[o.PEACE]: "relationship_state_peace",
[o.NON_AGRESSION_PACT]: "relationship_state_non_aggression_pack",
[o.RIGHT_OF_WAY]: "relationship_state_right_of_way",
[o.VIEW_MILITARY_ACTIONS]: "relationship_state_view_military_actions",
[o.MUTUAL_PROTECTION]: "relationship_state_mutual_protection",
[o.SHARED_INTELLIGENCE]: "relationship_state_shared_intelligence",
[o.MILITARY_AUTHORITY]: "relationship_state_military_authority"
};
static MIN_TEAM_RELATION = o.VIEW_MILITARY_ACTIONS;
static AI_MAX_RELATION = o.SHARED_INTELLIGENCE;
constructor(e) {
this.players = e,
this.neighborRelations = {},
this.endOfHonorPeriod = {},
this.initialized = !1
}
static getArmyColor(e) {
const t = n.IZ.getMod().getRelation(e);
return t && t.armyColor
}
static getRelationsName(e) {
const {i18n: t} = n.IZ;
switch (e) {
case o.REVOLT:
return t.gettext("Revolt");
case o.WAR:
return t.gettext("War");
case o.CEASEFIRE:
return t.gettext("Ceasefire");
case o.TRADE_EMBARGO:
return t.gettext("Trade Embargo");
case o.PEACE:
return t.gettext("Peace");
case o.NON_AGRESSION_PACT:
return t.gettext("Non-Aggression Pact");
case o.RIGHT_OF_WAY:
return t.gettext("Right of Way");
case o.VIEW_MILITARY_ACTIONS:
return t.gettext("Share Map");
case o.MUTUAL_PROTECTION:
return t.gettext("Mutual Protection Pact");
case o.SHARED_INTELLIGENCE:
return t.gettext("Shared Intelligence");
case o.MILITARY_AUTHORITY:
return t.gettext("Army Command");
default:
return `Relation ${e}`
}
}
static getRelationsDescription(e) {
switch (e) {
case o.REVOLT:
case o.WAR:
return n.IZ.i18n.gettext("Your armies automatically initiate combat when in range of enemy units. Trading through the stock market is not possible.");
case o.CEASEFIRE:
case o.TRADE_EMBARGO:
return n.IZ.i18n.gettext("Only opposing armies that try to enter your territory will be fired upon. Trading through the stock market is not possible.");
case o.PEACE:
return n.IZ.i18n.gettext("It's the neutral state between 2 countries. Trade is possible but you cannot freely move through the other player’s territory.");
case o.RIGHT_OF_WAY:
return n.IZ.i18n.gettext("Allows your armies to move through the territory of the other player without being attacked (and vice versa). Also, you can jointly fight other players' armies.");
case o.VIEW_MILITARY_ACTIONS:
return n.IZ.i18n.gettext("Lets you share your view of the map and units with your ally and also grants right of way.");
case o.SHARED_INTELLIGENCE:
return n.IZ.i18n.gettext("Lets you share your view of the map and units with the additional benefit of sharing espionage information, for example enemy units reveal by spies.");
default:
return ""
}
}
canTrade(e, t) {
return e != t && this.getRelation(e, t) > o.TRADE_EMBARGO && this.getRelation(t, e) > o.TRADE_EMBARGO
}
getRelation(e, t) {
var i;
return e < 1 || t < 1 ? o.PEACE : (null === (i = this.neighborRelations[e]) || void 0 === i ? void 0 : i[t]) ?? o.PEACE
}
getEndOfHonorPeriod(e, t) {
var i;
return e < 1 || t < 1 ? 0 : (null === (i = this.endOfHonorPeriod[e]) || void 0 === i ? void 0 : i[t]) ?? 0
}
getNumberOfPlayers() {
return this.players
}
getWar(e, t) {
return e != t && this.getRelation(e, t) <= o.WAR
}
superficialRelationBetween(e, t) {
if (e === t)
return r.u.MINE;
const i = this.getRelation(e, t);
return i < o.CEASEFIRE ? r.u.ENEMY : i < o.RIGHT_OF_WAY ? r.u.NEUTRAL : r.u.FRIENDLY
}
}
a.F.UltForeignAffairRelations = o
}
,
34745: (e,t,i)=>{
i(87477);
var s = i(55542)
, r = i(39513)
, n = i(31362)
, a = i(6422)
, o = i(81177)
, l = i(73576)
, u = i(58202)
, h = i(87928);
u.F.UltForeignAffairsState = class {
constructor() {
this.stateType = o.V.STATE_TYPE_FOREIGN_AFFAIRS_STATE,
this.relations = {},
this.messages = [],
this.allianceMessages = null
}
publishUpdate() {
s.N.publish(h.q.UI_DIPLOMACY_STATE_UPDATED)
}
getRelations() {
return this.relations
}
isFriendlyPlayer(e, t) {
return e === t || this.getRelations().getRelation(t, e) >= a.N.PEACE
}
hasRightOfWay(e, t) {
return e === t || this.getRelations().getRelation(t, e) >= a.N.RIGHT_OF_WAY
}
canSeeArmies(e, t) {
return e === t || this.getRelations().getRelation(t, e) >= a.N.VIEW_MILITARY_ACTIONS
}
canSeeEachOthersArmies(e, t) {
return e === t || this.getRelations().getRelation(t, e) >= a.N.VIEW_MILITARY_ACTIONS && this.getRelations().getRelation(e, t) >= a.N.VIEW_MILITARY_ACTIONS
}
canCommandProvinces(e, t) {
return e === t || this.getRelations().getRelation(t, e) >= a.N.MILITARY_AUTHORITY
}
canUseAirfields(e, t) {
return e === t || this.getRelations().getRelation(t, e) >= a.N.RIGHT_OF_WAY
}
getMessages() {
return this.messages
}
getAllianceMessages() {
if (!this.allianceMessages) {
this.allianceMessages = [];
const e = this.messages ? this.messages : [];
for (let t = 0; t < e.length; t++) {
const i = e[t];
i && i.getAllianceID() > 0 && this.allianceMessages.push(i)
}
}
return this.allianceMessages
}
getMessage(e) {
return [...this.getMessages(), ...this.getAllianceMessages()].find((t=>t.getMessageUID() === parseInt(e, 10))) || null
}
getArticlesForPlayers(e, t, i, s) {
const r = [];
let n, a, o, l, u;
const h = this.getMessages();
for (i = !!i,
a = 0,
o = h.length; a < o; a++)
n = h[a],
l = n.getSenderID() == t && e == t || n.getAuthorID() == t,
u = n.getReceiverID() == t,
i && n.getReceiverID() != e || !l && !u || (n.getSenderID() != e || !s && n.isDeletedBySender()) && (n.getReceiverID() != e || !s && n.isDeletedByReceiver()) || r.push(n);
return r
}
getUnreadArticleNum(e, t) {
let i = 0;
const s = this.getReceivedArticles(e);
for (let r = 0; r < s.length; r++)
s[r].isReadByReceiver() || t && s[r].getAuthorID() != t || ++i;
return i
}
getCoalitionMessagesInEventQueue() {
if (!r.IZ.getMod().hasCoalitionFeature())
return [];
let e = [];
return r.IZ.gameState.getGameEventState() && r.IZ.gameState.getGameEventState().getEvents() && (e = r.IZ.gameState.getGameEventState().getEvents().filter((function(e) {
return n.E && e instanceof n.E && !e.isRead()
}
))),
e
}
getUnreadCoalitionMessagesCount(e) {
const t = this.getCoalitionMessagesInEventQueue()
, i = this.getAllianceMessages().filter((function(i) {
const s = u.F.UltForeignAffairsState.prototype.isMessageInEventQueue(i, t);
if (i.senderID != e && !s && !i.isReadByReceiver())
return i
}
));
return t.length + i.length
}
isMessageInEventQueue(e, t) {
let i = !1;
if (t.length > 0)
for (let s = 0; s < t.length; s++)
if (e.getMessageUID() === t[s].getMessageID()) {
i = !0;
break
}
return i
}
getUnreadCommunications(e, t) {
let i = this.getUnreadArticleNum(e, t);
return i += r.IZ.gameState.getResourceState().getTrading().getNewOfferCount(e, t),
t || (i += this.getUnreadCoalitionMessagesCount(e)),
i
}
getReceivedArticles(e) {
const t = []
, i = this.getMessages();
if (this.messages)
for (let s = 0; s < i.length; s++)
i[s].getReceiverID() != e || i[s].isDeletedByReceiver() || t.push(i[s]);
return t
}
getEnemies(e) {
const t = [];
for (let i = this.relations.getNumberOfPlayers() - 1; i > 0; i--)
i != e && (this.isAtWar(e, i) || this.isAtWar(i, e)) && t.push(i);
return t
}
getAllies(e, t) {
t = t || a.N.VIEW_MILITARY_ACTIONS;
const i = []
, s = this.getRelations();
for (let r = this.relations.getNumberOfPlayers() - 1; r > 0; r--)
r != e && s.getRelation(e, r) >= t && i.push(r);
return i
}
isAtWar(e, t) {
return e !== t && this.relations.getWar(t, e)
}
isRevolt(e, t) {
return e !== t && this.relations.getRelation(t, e) === a.N.REVOLT
}
canAttack(e, t) {
return !(r.IZ.gameState.getPlayerState().arePlayersATeam(e, t) || this.peacePeriodBetween(e, t))
}
canAttackHonorPeriod(e, t, i) {
if (r.IZ.gameState.getGameInfoState().hasHonorPeriod()) {
if (!this.isAtWar(e, t))
return !1;
const s = this.getRelations().getEndOfHonorPeriod(e, t);
if (0 == s || s > i)
return !1
}
return !0
}
peacePeriodTo(e) {
const t = r.IZ.gameState.getPlayerProfile().getPlayerProfile();
return this.peacePeriodBetween(t.getPlayerID(), e)
}
peacePeriodBetween(e, t) {
if (!e || !t || e === t || this.hasRightOfWay(e, t))
return !1;
const i = r.IZ.gameState.getPlayerState()
, s = r.IZ.gameState.getGameInfoState()
, n = i.getPlayer(e).getComputerPlayer()
, a = i.getPlayer(t).getComputerPlayer();
return !(!s.isPeacePeriod() || n || a) || s.isPeacePeriodAi() && (n || a)
}
isRestrictedByPeacePeriod(e, t, i) {
return e === a.N.WAR && this.peacePeriodBetween(t, i)
}
isRelationSelectable(e, t, i) {
let s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
if (e === t || e <= l.M.guestPlayerID || t <= l.M.guestPlayerID)
return !1;
const n = r.IZ.gameState
, o = n.getPlayerState()
, u = o.getPlayer(e);
if (u && u.isAIPlayer() && i > a.N.AI_MAX_RELATION)
return !1;
const h = n.getMod();
if (!a.N.ALL_RELATIONS.has(i) || h && !h.hasRelation(i))
return !1;
const g = n.getGameInfoState();
if (g.isTeamGame()) {
const e = n.getPlayerProfile(t)
, r = u ? u.getTeamID() : 0
, l = e ? e.getTeamID() : 0;
if (r > 0 && l > 0 && o.getTeam(r) && o.getTeam(l))
if (r === l) {
if (i < a.N.MIN_TEAM_RELATION)
return s.restrictedByFriendlyTeamSettings = !0,
!1
} else if (i > g.getScenario().getMaxEnemyTeamRelation())
return s.restrictedByEnemyTeamSettings = !0,
!1
}
const c = this.getRelations().getRelation(e, t);
if (c === i)
return !0;
if (c === a.N.REVOLT)
return !1;
switch (i) {
case a.N.PEACE:
case a.N.NON_AGRESSION_PACT:
case a.N.RIGHT_OF_WAY:
case a.N.VIEW_MILITARY_ACTIONS:
case a.N.MUTUAL_PROTECTION:
case a.N.MILITARY_AUTHORITY:
return !0;
case a.N.SHARED_INTELLIGENCE:
return u && u.isPremiumUser();
case a.N.TRADE_EMBARGO:
return c > a.N.TRADE_EMBARGO;
case a.N.CEASEFIRE:
return c === a.N.WAR;
case a.N.WAR:
{
const i = this.peacePeriodBetween(e, t);
return i && (s.restrictedByPeacePeriod = !0),
!i
}
case a.N.REVOLT:
default:
return !1
}
}
getMarkedRelationEntries(e, t) {
let i = arguments.length > 2 && void 0 !== arguments[2] && arguments[2];
const s = this.getRelations().getRelation(e, t);
return r.IZ.gameState.getMod().getRelations().filter((e=>!i || e !== s)).map((i=>{
const s = {};
return {
relation: i,
enabled: this.isRelationSelectable(e, t, i, s),
isRestrictedByPeacePeriod: !!s.restrictedByPeacePeriod,
isPossible: !s.restrictedByEnemyTeamSettings,
name: a.N.getRelationsName(i)
}
}
)).filter((e=>e.enabled || !e.isPossible || e.isRestrictedByPeacePeriod))
}
}
}
,
30619: (e,t,i)=>{
var s = i(55542)
, r = i(59978)
, n = i(32378)
, a = i(25312)
, o = i(39513)
, l = i(46707)
, u = i(60105)
, h = i(81177)
, g = i(58202)
, c = i(87928)
, d = i(13775);
g.F.MAX_POINTS = 2e3;
g.F.UltGameInfoState = class {
serverTimeOffset = 0;
lastUpdateTime = 0;
constructor() {
this.stateType = h.V.STATE_TYPE_GAME_INFO_STATE,
this.gameFeatures = null,
this.dayOfGame = 0,
this.startOfGame = 0,
this.endDate = 0,
this.nextDayTime = 0,
this.goldRound = !1,
this.endOfGame = !1,
this.password = null,
this.openSlots = 0,
this.victoryPoints = 0,
this.victoryPointsMod = 0,
this.teamVictoryPoints = 0,
this.teamVictoryPointsMod = 0,
this.doubleResourceProductionThreshold = 5e3,
this.teamSettings = u.c.NONE,
this.numberOfTeams = 0,
this.numberOfPlayers = 0,
this.aiLevel = r.q.NORMAL,
this.ranked = a.c.RANKED_VALUE_NO,
this.timeScale = 1,
this.researchDaysOffset = 0,
this.researchTimeScale = 1,
this.gameImagePath = null,
this.antiCheatLevel = null,
this.gsVersion = 0,
this.ecoScore = 0,
this.ecoBoostScore = 0,
this.milScore = 0,
this.milBoostScore = 0,
this.loginMessage = null,
this.adviserInfo = null,
this.endOfGameTimerStartTime = null
}
update(e) {
e.gameFeatures.initFeatures(),
Object.assign(this, e)
}
publishUpdate() {
s.N.publish(c.q.UI_INFO_STATE_UPDATED)
}
updateServerTime(e) {
this.lastUpdateTime = Date.now(),
this.serverTimeOffset = e - this.lastUpdateTime
}
getTimeScale() {
return this.timeScale
}
getTimeScaleAsMultiplier() {
return Math.round(1 / this.getTimeScale())
}
getTimeScaleHR() {
return d.Z.formatNumber(this.getTimeScaleAsMultiplier())
}
getClientTime() {
const {timeScale: e, lastUpdateTime: t, serverTimeOffset: i} = this;
return 1 !== e && 0 !== t ? t + i + (Date.now() - t) / e : Date.now() + i
}
getRealTime(e) {
const {timeScale: t, serverTimeOffset: i} = this;
if (1 !== t) {
const i = 1e3 * this.getStartOfGame()
, s = e - i;
return i + Math.round(s * t)
}
return e - i
}
getNextDayTime() {
return this.nextDayTime
}
getRemainingDayTimeHR() {
const e = this.convertScaledToRealTime((this.getNextDayTime() - this.getClientTime()) / 1e3);
return d.Z.formatTimer(e, !0, 2)
}
convertScaledToRealTime(e) {
return e * this.getTimeScale()
}
getGameDayTimeHR() {
return d.Z.formatTimer(this.convertScaledToRealTime(86400), !0, 2)
}
getDayOfGame() {
return this.dayOfGame
}
getPassword() {
return this.password
}
getOpenSlots() {
return this.openSlots
}
getVictoryPoints() {
return this.victoryPoints
}
getTeamVictoryPoints() {
return this.teamVictoryPoints
}
getVictoryPointsModSpecific() {
return this.victoryPointsMod
}
hasVictoryPointsModSpecific() {
return this.getVictoryPointsModSpecific() > 0
}
getDoubleResourceProductionThreshold() {
return this.doubleResourceProductionThreshold
}
getTeamVictoryPointsModSpecific() {
return this.teamVictoryPointsMod
}
getVictoryPercent(e) {
const t = e || this.victoryPoints;
return Math.round(t / g.F.MAX_POINTS * 100)
}
getTeamSettings() {
return this.teamSettings
}
isTeamGame() {
return o.IZ.config.supportsDynamicTeams ? this.teamSettings !== u.c.NONE : this.teamSettings !== u.c.NONE && this.teamSettings !== u.c.DYNAMIC
}
isStaticTeamGame() {
return this.teamSettings === u.c.FREE || this.teamSettings === u.c.SCENARIO
}
isDynamicTeamGame() {
return this.teamSettings == u.c.DYNAMIC && o.IZ.config.supportsDynamicTeams && o.IZ.getMod().hasCoalitionFeature()
}
getAiLevel() {
return this.aiLevel
}
getGameFeatures() {
return this.gameFeatures
}
isPeacePeriod() {
const e = this.getGameFeatures().getFeature(l.H.Ids.IR_PEACEPERIOD);
return e && e.isEnabled() && this.getClientTime() / 1e3 - this.startOfGame <= e.value
}
isPeacePeriodAi() {
const e = this.getGameFeatures().getFeature(l.H.Ids.IR_PEACEPERIOD_AI);
return e && e.isEnabled() && this.getClientTime() / 1e3 - this.startOfGame <= e.value
}
isFullPeacePeriod() {
return this.isPeacePeriod() && this.isPeacePeriodAi()
}
isAnyPeacePeriod() {
return this.isPeacePeriod() || this.isPeacePeriodAi()
}
hasHonorPeriod() {
const e = this.getGameFeatures().getFeature(l.H.Ids.IR_HONORPERIOD);
return e && e.isEnabled()
}
getGoldmarkLimitLevel() {
const e = this.gameFeatures.getFeature(l.H.Ids.FEATURE_GM_LIMITATION);
return null != e ? e.getValue() : n.E.NO_LIMIT
}
isTournamentGame() {
const e = this.gameFeatures.getFeature(l.H.Ids.FEATURE_TOURNAMENT);
return null != e && e.isEnabled()
}
isLastDayOfGame() {
const e = this.getLastDayOfGame();
return e > 0 && this.getDayOfGame() == e
}
getLastDayOfGame() {
const e = this.getGameFeatures().getFeature(l.H.Ids.FEATURE_ENDDAY);
return e ? e.getValue() : 0
}
hasGameStarted() {
return this.dayOfGame > 0
}
isPaused() {
return this.getGameFeatures().hasFeature(l.H.Ids.FEATURE_PAUSED)
}
getEndOfGame() {
return this.endOfGame
}
getTotalScore() {
return this.ecoScore + this.ecoBoostScore + this.milScore + this.milBoostScore
}
getStartOfGame() {
return this.startOfGame
}
isGoldRound() {
return this.goldRound
}
getNumberOfTeams() {
return this.numberOfTeams
}
getNumberOfPlayers() {
return this.numberOfPlayers
}
isBetaGame() {
return this.getBetaLevel() >= 2
}
isAlphaGame() {
return this.getBetaLevel() >= 3
}
isAnonymousGame() {
return this.gameFeatures.hasFeature(l.H.Ids.FEATURE_ANONYMOUS)
}
getBetaLevel() {
if (null == this.gameFeatures)
return !1;
const e = this.gameFeatures.getFeature(l.H.Ids.FEATURE_TESTGAME);
return e ? e.getValue() : 0
}
getResearchDaysOffset() {
return this.researchDaysOffset
}
getResearchTimeScale() {
return this.researchTimeScale
}
getScenario() {
return o.IZ.contentItems[this.getScenarioID()]
}
getScenarioID() {
return this.scenarioID
}
getGameImagePath() {
return this.gameImagePath
}
getMapID() {
return this.mapID
}
isUnranked() {
return this.ranked === a.c.RANKED_VALUE_NO
}
getAllianceGame() {
return this.allianceGame
}
getAllianceA() {
return parseInt(this.allianceA)
}
getAllianceB() {
return parseInt(this.allianceB)
}
getAdviserInfo() {
return this.adviserInfo
}
hasTutorialAdviserSupport() {
return !!this.getScenario() && this.getScenario().hasTutorialAdviserSupport()
}
isFreeOfChargePremiumCurrencyMode() {
return !!this.getScenario() && this.getScenario().isFreeOfChargePremiumCurrencyMode()
}
isTutorialSkippableGame() {
return !!this.getScenario() && !this.getScenario().hasPreventSkipTutorialOption()
}
isListAllPlayers() {
return !!this.getScenario() && this.getScenario().isListAllPlayers()
}
isDominionGame() {
return this.getDominionPOIWinningAmount() > 0
}
isFixedDurationGame() {
return this.getEndDate() > this.getClientTime() / 1e3
}
getEndDate() {
return this.endDate
}
getTimeLeftInSeconds() {
const e = 1e3 * this.getEndDate() - this.getClientTime();
return this.convertScaledToRealTime(e) / 1e3
}
getDominionPOITimer() {
var e;
return parseInt((null === (e = this.getScenario()) || void 0 === e ? void 0 : e.getOption("poiTimer")) ?? 0, 10)
}
getDominionPOITimerInSeconds() {
return 24 * this.getDominionPOITimer() * 60 * 60
}
getDominionPOIWinningAmount() {
var e;
return parseInt((null === (e = this.getScenario()) || void 0 === e ? void 0 : e.getOption("poiWinningAmount")) ?? 0, 10)
}
getPOICountdownTimeLeft() {
return this.endOfGameTimerStartTime || 0
}
getPeacePeriodEndTime(e) {
let t = this.getGameFeatures().getFeature(l.H.Ids.IR_PEACEPERIOD);
if (e && (t = this.getGameFeatures().getFeature(l.H.Ids.IR_PEACEPERIOD_AI)),
t && t.isEnabled())
return t.value - (this.getClientTime() / 1e3 - this.startOfGame)
}
isAntiCheatEnabled() {
return parseInt(this.antiCheatLevel)
}
isPasswordProtected() {
return !!this.password
}
isTooLateToJoin() {
if (!this.isAntiCheatEnabled() || this.isPasswordProtected())
return !1;
const e = this.getScenario()
, t = e ? e.getMaxJoinDay() : 0;
return t > 0 && this.getDayOfGame() > t
}
hasEliteAI() {
return this.aiLevel === r.q.HARDCORE
}
getGsVersion() {
return this.gsVersion
}
getMaxPlayersPerTeam() {
return 1 + this.getNumberOfPlayers() / this.getNumberOfTeams()
}
isSpeedRound() {
return this.timeScale < 1
}
hasSoloVictory() {
return !this.isStaticTeamGame()
}
hasTeamVictory() {
return this.teamSettings !== u.c.NONE
}
}
}
,
89392: (e,t,i)=>{
i.d(t, {
j: ()=>d
});
i(87477),
i(10072),
i(76020),
i(11195),
i(42907);
var s = i(13950);
class r {
constructor(e) {
this.checklistTitle = e.checklistTitle,
this.checklistCategory = e.checklistCategory,
this.index = e.index
}
}
s.x.register("tt", (e=>new r(e)));
var n = i(55542)
, a = i(58202)
, o = i(87928);
a.F.tutorial.UltTutorialState = class {
constructor() {
this.globalProgress = -1,
this.numTasks = 0,
this.currentTask = null,
this.tutorialType = -1,
this.tasks = []
}
prepareUpdate(e) {
const t = this.getCurrentTask();
t && t.isCompositeTask && (e.currentTask && e.currentTask.index == t.index ? this.trackCompositeProgress(t.taskList, e.currentTask.taskList) : this.trackCompositeProgress(t.taskList, null)),
t && t.cleanup && t.cleanup()
}
trackCompositeProgress(e, t) {
if (e)
for (let i = 0; i < e.length; i++)
this.trackTaskProgress(e[i].taskList, t && t[i].taskList || null)
}
trackTaskProgress(e, t) {
if (e)
for (let i = 0; i < e.length; i++) {
const s = e[i]
, r = t && t[i] || {
isFinished: !0
};
!s.isFinished && r.isFinished && hup.hupwebapi.logTutorialEvent(s, null, !0)
}
}
publishUpdate() {
n.N.publish(o.q.UI_TUTORIAL_STATE_UPDATED)
}
getCurrentTask() {
return this.currentTask
}
hasValidCurrentTask() {
return !!this.currentTask && !!this.currentTask.process
}
getGlobalProgress() {
return this.globalProgress
}
getNumTasks() {
return this.numTasks
}
getTutorialType() {
return this.tutorialType
}
isFinished() {
return !this.currentTask
}
getTasks() {
return this.tasks
}
}
;
i(82673),
i(60462),
i(84097),
i(34745),
i(30619),
i(57421),
i(57361),
i(74241),
i(34966),
i(93658),
i(76110),
i(43112),
i(5766),
i(62442),
i(74787),
i(26820);
var l = i(39513)
, u = i(60182);
class h extends u.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltOptionAction"
}
setOption(e, t) {
this.key = e,
this.value = t
}
setGlobalOption(e) {
this.globalOption = e
}
}
var g = i(81177)
, c = i(73576);
class d {
constructor() {
this.states = {},
this.actionResults = null
}
getActionResults() {
return this.actionResults
}
update(e) {
for (const t in g.V)
if (g.V.hasOwnProperty(t)) {
const i = g.V[t];
if (e.states[i]) {
const t = e.states[i];
if (t.update)
this.states[i] || (this.states[i] = new t.constructor),
this.states[i].update(t);
else {
const e = this.states[i];
e && e.prepareUpdate && e.prepareUpdate(t),
this.states[i] = t
}
}
}
n.N.publish(o.q.UI_GAMESTATE_CHANGED)
}
getState(e) {
return this.states[e]
}
getAIState() {
return this.getState(g.V.STATE_TYPE_AI_STATE)
}
getTutorialState() {
return this.getState(g.V.STATE_TYPE_TUTORIAL_STATE)
}
getArmyState() {
return this.getState(g.V.STATE_TYPE_ARMY_STATE)
}
getForeignAffairsState() {
return this.getState(g.V.STATE_TYPE_FOREIGN_AFFAIRS_STATE)
}
getInGameAllianceState() {
return this.getState(g.V.STATE_TYPE_IN_GAME_ALLIANCE)
}
getPlayerState() {
return this.getState(g.V.STATE_TYPE_PLAYER_STATE)
}
getQuestState() {
return this.getState(g.V.STATE_TYPE_QUEST_STATE)
}
getResourceState() {
return this.getState(g.V.STATE_TYPE_RESOURCE_STATE)
}
getResearchState() {
return this.getState(g.V.STATE_TYPE_RESEARCH_STATE)
}
getIngameInventoryState() {
return this.getState(g.V.STATE_TYPE_INGAME_INVENTORY_STATE)
}
getNewspaperState() {
return this.getState(g.V.STATE_TYPE_NEWSPAPER_STATE)
}
getMapState() {
return this.getState(g.V.STATE_TYPE_MAP_STATE)
}
getGameInfoState() {
return this.getState(g.V.STATE_TYPE_GAME_INFO_STATE)
}
getScenarioState() {
return this.getState(g.V.STATE_TYPE_SCENARIO_STATE)
}
getPremiumState() {
return this.getState(g.V.STATE_TYPE_PREMIUM_STATE)
}
getUserOptions() {
return this.getState(g.V.STATE_TYPE_USER_OPTIONS_STATE)
}
getGameEventState() {
return this.getState(g.V.STATE_TYPE_GAME_EVENT_STATE)
}
getPlayerStatisticsState() {
return this.getState(g.V.STATE_TYPE_PLAYER_STATISTICS_STATE)
}
setGameEventState(e) {
this.states[g.V.STATE_TYPE_GAME_EVENT_STATE] = e
}
getOption(e) {
var t;
return l.IZ.config.userData.adminLevel <= 0 ? (null === (t = this.getUserOptions()) || void 0 === t ? void 0 : t.getOptionValue(e)) ?? 0 : 0
}
setOption(e, t, i) {
if (l.IZ.isGameOperatorOrHigherAccess())
return;
if (this.getUserOptions().setOption(e, t) !== t) {
const s = new h;
s.setOption(e, t),
s.setGlobalOption(i),
l.IZ.userActionController.triggerAction(s)
}
}
getSpyState() {
return this.getState(g.V.STATE_TYPE_SPY_STATE)
}
setSpyState(e) {
this.states[g.V.STATE_TYPE_SPY_STATE] = e
}
getBuildQueueState() {
return this.states[g.V.STATE_TYPE_BUILD_QUEUE_STATE]
}
setBuildQueueState(e) {
this.states[g.V.STATE_TYPE_BUILD_QUEUE_STATE] = e
}
getInventory() {
return this.getState(g.V.STATE_TYPE_USER_INVENTORY_STATE)
}
getMod() {
return this.getState(g.V.STATE_TYPE_MOD_STATE)
}
getTimeStamp() {
return this.timeStamp
}
getResourceProfile(e) {
var t;
return null === (t = this.getResourceState()) || void 0 === t ? void 0 : t.getResourceProfile(e || l.IZ.config.userData.playerID)
}
getPlayerProfile(e) {
const t = this.getPlayerState();
return t ? t.getPlayer(e || l.IZ.config.userData.playerID) : null
}
isValidPlayer() {
return l.IZ.config.userData.playerID > c.M.guestPlayerID
}
getStatesList() {
let e, t, i;
const s = {};
for (t in this.states)
if (this.states.hasOwnProperty(t)) {
for (e in i = [],
this.states[t])
this.states[t].hasOwnProperty(e) && i.push(e);
s[t] = i
}
return s
}
}
a.F.UltGameState = d;
const p = l.IZ.gameState ? l.IZ.gameState : new d;
l.IZ.gameState || (l.IZ.gameState = p)
}
,
81177: (e,t,i)=>{
i.d(t, {
V: ()=>s
});
const s = {
STATE_TYPE_GAME_STATE: 0,
STATE_TYPE_PLAYER_STATE: 1,
STATE_TYPE_NEWSPAPER_STATE: 2,
STATE_TYPE_MAP_STATE: 3,
STATE_TYPE_RESOURCE_STATE: 4,
STATE_TYPE_FOREIGN_AFFAIRS_STATE: 5,
STATE_TYPE_ARMY_STATE: 6,
STATE_TYPE_SPY_STATE: 7,
STATE_TYPE_MAP_INFO_STATE: 8,
STATE_TYPE_ADMIN_STATE: 9,
STATE_TYPE_STATISTIC_STATE: 10,
STATE_TYPE_MOD_STATE: 11,
STATE_TYPE_GAME_INFO_STATE: 12,
STATE_TYPE_AI_STATE: 13,
STATE_TYPE_PREMIUM_STATE: 14,
STATE_TYPE_USER_OPTIONS_STATE: 15,
STATE_TYPE_USER_INVENTORY_STATE: 16,
STATE_TYPE_USER_SMS_OPTION_STATE: 17,
STATE_TYPE_TUTORIAL_STATE: 18,
STATE_TYPE_BUILD_QUEUE_STATE: 19,
STATE_TYPE_LOCATION_STATE: 20,
STATE_TYPE_TRIGGERED_TUTORIAL: 21,
STATE_TYPE_RESEARCH_STATE: 23,
STATE_TYPE_GAME_EVENT_STATE: 24,
STATE_TYPE_IN_GAME_ALLIANCE: 25,
STATE_TYPE_EXPLORATION_STATE: 26,
STATE_TYPE_QUEST_STATE: 27,
STATE_TYPE_INGAME_INVENTORY_STATE: 29,
STATE_TYPE_PLAYER_STATISTICS_STATE: 30,
STATE_TYPE_SCENARIO_STATE: 31
}
}
,
46082: (e,t,i)=>{
i.d(t, {
Y: ()=>g
});
i(10711);
var s = i(58202);
s.F.FrontendInGameAllianceInvitation = class {
invitingPlayerID = -1;
invitedPlayerID = -1;
timeStamp = -1
}
;
var r = i(80932)
, n = i(19725)
, a = i(85665)
, o = i(13775);
class l extends n.X {
constructor() {
super(),
this.allianceAction = n.H.PLAYER_LEAVES,
this.allianceID = null
}
setData(e) {
this.allianceID = e
}
getApprovalText() {
const e = 3600 * hup.getMod().getScenarioPriorityOption(a.f.OPTION_TEAM_JOIN_CD_AFTER_LEAVE, 0);
let t;
return t = e ? hup.i18n.gettext("After leaving a coalition you have to wait for %s until you can join or create another coalition.", o.Z.formatTimer(e)) : hup.i18n.gettext("Do you really want to leave this coalition?"),
t
}
}
class u extends n.X {
constructor() {
super(),
this.allianceAction = n.H.PLAYER_WITHDRAW_APPLICATION,
this.allianceID = null
}
setData(e) {
this.allianceID = e
}
getApprovalText() {
return hup.i18n.gettext("Are you sure that you would like to withdraw your application for this coalition?")
}
execute() {
hup.inGameAllianceController.executeAction(this)
}
getSuccessText() {
return hup.i18n.gettext("Your application has successfully been withdrawn.")
}
}
var h = i(95020);
class g {
constructor(e, t, i, s) {
this.members = {},
this.allianceID = e,
this.name = t,
this.description = i,
this.flag = s,
this.logMessages = [],
this.chatCode = null,
this.applicants = [],
this.invitations = [],
this.profile = null,
this._currentPlayerHasApplied = !1
}
setProfile(e) {
this.profile = e
}
getChatCode() {
return this.chatCode
}
getProfile() {
return this.profile
}
getID() {
return this.allianceID
}
getName() {
return this.profile.getTeamName()
}
getDescription() {
return this.profile.description
}
getFlag() {
return this.flag
}
getPlayerMap() {
return this.members
}
getLeaderID() {
return this.profile.getLeaderID()
}
getApplicants() {
return this.applicants ? this.applicants : []
}
getLogs() {
return this.logMessages
}
getProvinceCount() {
let e = 0;
for (const t in this.members)
this.members.hasOwnProperty(t) && (e += hup.gameState.getMapState().getProvincesForPlayer(parseInt(t)).length);
return e
}
getMemberCount() {
return Object.keys(this.members).length
}
getLeaderProfile() {
return hup.gameState.getPlayerProfile(this.profile.getLeaderID())
}
addMember(e) {
this.members[e] = new h.x(e)
}
getScore() {
return hup.gameState.getNewspaperState().getRanking(hup.gameState.getGameInfoState().getDayOfGame()).getTeamPoints(this.getID())
}
leave() {
const e = hup.inGameAllianceController.getCurrentPlayerAlliance();
if (!e || this.getID() != e.getID())
throw new Error("cannot leave alliance. player doesn't have one or this one is not his!");
{
const e = new l;
e.setData(this.getID()),
e.execute()
}
}
apply() {
if (hup.inGameAllianceController.getCurrentPlayerAlliance())
throw new Error("player already has an alliance!");
{
const e = new r.I;
e.setData(this.getID()),
e.execute()
}
}
withdrawApplication() {
const e = new u;
e.setData(this.getID()),
e.execute()
}
markAsHasAnApplication() {
this._currentPlayerHasApplied = !0
}
hasPendingApplicationFromCurrentPlayer() {
return this._currentPlayerHasApplied
}
isPlayerInAlliance(e) {
return !!this.members[e]
}
isMine() {
return !!this.members[hup.config.userData.playerID]
}
isMember(e) {
return Object.values(this.members || {}).some((t=>Number(t.playerID) === Number(e))) ?? !1
}
isCurrentPlayerLeader() {
return Number(this.getLeaderID()) === Number(hup.config.userData.playerID)
}
hasPendingInvitation(e) {
var t;
return (null === (t = this.invitations) || void 0 === t ? void 0 : t.some((t=>Number(t.invitedPlayerID) === Number(e)))) ?? !1
}
canCurrentPlayerManageInvitations() {
return this === hup.inGameAllianceController.getCurrentPlayerAlliance() && this.isCurrentPlayerLeader()
}
canInvitePlayer(e) {
var t;
return !!this.canCurrentPlayerManageInvitations() && (!this.isFull() && (!this.isMember(e) && ((null === (t = hup.gameState.getPlayerProfile(e)) || void 0 === t || !t.isAIPlayer()) && !this.hasPendingInvitation(e))))
}
isFull() {
var e;
const t = null === (e = hup.getMod().getCurrentScenario()) || void 0 === e ? void 0 : e.getCoalitionSize();
return this.getMemberCount() === t
}
canWithdrawInvitation(e) {
return !!this.canCurrentPlayerManageInvitations() && (!this.isMember(e) && this.hasPendingInvitation(e))
}
getMembers() {
return Object.values(this.members)
}
getMember(e) {
return this.members[e]
}
isCurrentPlayerInvitedToCoalition() {
var e;
const t = null === (e = hup.gameState.getInGameAllianceState()) || void 0 === e ? void 0 : e.getPlayerInvitationMap();
return !(null == t || !t[this.getID()])
}
}
s.F.UltInGameAlliance = g
}
,
95020: (e,t,i)=>{
i.d(t, {
H: ()=>r,
x: ()=>n
});
var s = i(58202);
const r = e=>class extends e {
constructor(e) {
super(...arguments),
this.playerID = e,
this.allianceLeader = !1
}
getPlayerID() {
return this.playerID
}
isMe() {
return parseInt(this.playerID) === hup.config.userData.playerID
}
setAsLeader() {
this.allianceLeader = !0
}
isLeader() {
return this.allianceLeader
}
getProfile() {
return hup.gameState.getPlayerProfile(this.playerID)
}
}
;
const n = r(class {
}
);
s.F.UltInGameAllianceMember = n
}
,
63912: (e,t,i)=>{
i.d(t, {
$: ()=>n
});
var s = i(81177)
, r = i(58202);
class n {
constructor() {
this.stateType = s.V.STATE_TYPE_IN_GAME_ALLIANCE,
this.idToAllianceMap = null,
this.playerApplications = null,
this.playerInvitations = null
}
update(e) {
this.idToAllianceMap = e.idToAllianceMap,
this.playerApplications = e.playerApplications,
this.playerInvitations = e.playerInvitations,
this.stateID = e.stateID
}
getAlliance() {
return this.idToAllianceMap[Object.keys(this.idToAllianceMap)[0]]
}
getPlayerApplications() {
return this.playerApplications
}
getPlayerInvitationMap() {
return this.playerInvitations ?? {}
}
}
r.F.UltInGameAllianceState = n
}
,
40102: (e,t,i)=>{
i.d(t, {
p: ()=>n
});
var s = i(67040)
, r = i(58202);
class n {
constructor() {
this.itemID = 0,
this.items = null,
this.itemsConfig = null
}
getItemID() {
return this.itemID
}
applyData(e) {
this.itemID = e.itemID,
this.itemsConfig = (0,
s.u)(e.items)
}
getItems() {
return this.items || this.resolveItems(),
this.items
}
resolveItems() {
const {itemsConfig: e} = this;
this.items = {},
e.forEach(((e,t)=>{
this.items[t] = hup.contentItems[t]
}
))
}
}
r.F.UltItemPack = n
}
,
41788: (e,t,i)=>{
i.d(t, {
j: ()=>n
});
i(87477);
var s = i(64842)
, r = i(69924);
class n {
connections = null;
regionIDs = null;
constructor() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0
, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ""
, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : s.E.ORIGIN;
this.locationID = e,
this.name = t,
this.capital = i
}
isUltLocation() {}
applyData(e) {
e.n && (this.name = e.n),
this.locationID = e.id,
e.c && (this.capital = s.E.toPoint(e.c) ?? this.capital)
}
getLocationID() {
return this.locationID
}
setLocationID(e) {
this.locationID = e
}
getName() {
return this.name
}
getCapital() {
return this.capital
}
isOnSea() {
return !1
}
isUrban() {
return !1
}
isCapital() {
return !1
}
isUrbanOrCapital() {
return this.isUrban() || this.isCapital()
}
getConnections() {
return this.connections ?? []
}
addConnection(e) {
this.connections || (this.connections = []),
this.connections.push(e)
}
getBoundsArray() {
const e = this.capital.x - 5
, t = this.capital.y - 5;
return [e, t, e + 10, t + 10]
}
containsPoint(e, t) {
const i = this.getBoundsArray();
return !(e < i[0] || e > i[2] || t < i[1] || t > i[3])
}
getRect() {
const [e,t,i,s] = this.getBoundsArray();
return new r.U(e,t,i - e,s - t)
}
intersects(e, t, i, s) {
const r = this.getBoundsArray();
return !(i < r[0] || e > r[2] || s < r[1] || t > r[3])
}
getRegionIDs() {
return this.regionIDs ?? []
}
getDefaultRegionId() {
var e;
return (null === (e = this.regionIDs) || void 0 === e ? void 0 : e[0]) ?? -1
}
isInRegion(e) {
return this.getRegionIDs().indexOf(e) >= 0
}
update(e) {}
isNeutral() {
return !0
}
}
}
,
48375: (e,t,i)=>{
i.d(t, {
K: ()=>s
});
const s = {
ADMIN_LEVEL_NONE: 0,
ADMIN_LEVEL_GAME_OP: 1,
ADMIN_LEVEL_ADMIN: 2,
ADMIN_LEVEL_BYTRO_ADMIN: 3,
ADMIN_LEVEL_DEVELOPER: 4
}
}
,
33773: (e,t,i)=>{
i.d(t, {
$: ()=>r
});
var s = i(58202);
class r {
constructor() {
this.timeStamp = null,
this.userID = null,
this.conflictingUserID = null,
this.whiteListed = null,
this.blackListed = null,
this.conflictLevel = null,
this.ip = null
}
}
r.ConflictLevel = {
NO_CONFLICT: 0,
IP_CONFLICT: 1,
SOFT_CONFLICT: 2,
HARD_CONFLICT: 3,
BLOCKED: 4
},
r.ConflictLevelText = ["None", "Ip", "Soft", "Hard", "Blocked"],
s.F.UltLoginLogEntry = r
}
,
55970: (e,t,i)=>{
i.d(t, {
G: ()=>r
});
i(87477);
var s = i(58202);
s.F.UltMadEntryStatus = ["Clean", "Locked", "Warned", "Banned", "Banned after Warning", "Ignored"];
class r {
constructor() {
this.userID = null,
this.commonUserIDs = null,
this.ipConflictUserIDs = null,
this.accusationUserIDs = null,
this.gameIDToGameInfoMap = null,
this.username = null,
this.email = null,
this.suspicionLevel = null,
this.parentUserID = null,
this._initialized = !1,
this._commonUsers = null,
this._languages = null,
this._titles = null,
this._totalLoginCount = null,
this._caseLog = null
}
initialize(e) {
if (!this._initialized) {
this._initialized = !0,
this._caseLog = e,
this._commonUsers = [],
this._titles = [],
this._languages = [],
this._totalLoginCount = 0;
let t = null;
const i = {}
, s = this.getGameMap();
for (const e in s)
if (s.hasOwnProperty(e)) {
const r = s[e]
, n = r.userIDToTradeInfoMap;
for (t in n)
if (n.hasOwnProperty(t)) {
i.hasOwnProperty(t) || (i[t] = {
gameCount: 0,
tradeCount: 0
});
const e = n[t].resourceToTradeCountMap;
let s = 0;
for (const t in e)
e.hasOwnProperty(t) && (s += parseInt(e[t]));
i[t].gameCount++,
i[t].tradeCount += s
}
const a = r.getLanguageName()
, o = r.getTitleName();
r.language && -1 === this._languages.indexOf(a) && this._languages.push(a),
r.titleID && -1 === this._titles.indexOf(o) && this._titles.push(o),
this._totalLoginCount += r.loginCount
}
for (t in i)
i.hasOwnProperty(t) && i[t].gameCount > 1 && this._commonUsers.push({
userID: t,
recurrenceCount: i[t].gameCount,
tradeCount: i[t].tradeCount
});
this._commonUsers.length > 0 && (this._commonUsers[this._commonUsers.length - 1].lastEntry = !0)
}
}
getCommonUserIDs() {
return this.commonUserIDs ? this.commonUserIDs : []
}
getCommonUserIDCount() {
return this.getCommonUserIDs().length
}
getIPConflictUserIDs() {
return this.ipConflictUserIDs ? this.ipConflictUserIDs : []
}
getIPConflictUserIDCount() {
return this.getIPConflictUserIDs().length
}
getAccusationUserIDs() {
return this.accusationUserIDs ? this.accusationUserIDs : []
}
getAccusationUserIDCount() {
return this.getAccusationUserIDs().length
}
getGameMap() {
return this.gameIDToGameInfoMap ? this.gameIDToGameInfoMap : {}
}
getInterGameCommonUsers() {
return this._commonUsers ? this._commonUsers : []
}
getTitles() {
return this._titles ? this._titles : []
}
getLanguages() {
return this._languages ? this._languages : []
}
getLanguagesAsString() {
const e = this.getLanguages();
let t = "";
for (let i = 0; i < e.length; i++)
t = `${e[i]} `;
return t || (t = "-"),
t
}
getTitlesAsString() {
const e = this.getTitles();
let t = "";
for (let i = 0; i < e.length; i++)
t += `${e[i]} `;
return t || (t = "-"),
t
}
getInterGameCommonUserTradeCount() {
return this.getInterGameCommonUsers().length
}
getGameCount() {
const e = this.getGameMap();
return Object.keys(e).length
}
getTotalLoginCount() {
return this._totalLoginCount
}
getGameByID(e) {
return this.getGameMap()[e]
}
getUsername() {
return this.username || "-"
}
getEmail() {
return this.email || "-"
}
getBaseSuspicionLevel() {
return this.suspicionLevel
}
getStatusText() {
return s.F.UltMadEntryStatus[this.status || 0] || "-"
}
getSearchableKeywordsAsString() {
const e = [this.userID, this.getTitlesAsString(), this.getLanguagesAsString(), this.getInterGameCommonUserTradeCount() > 0 ? "inter" : "", this.getUsername(), this.getStatusText(), this.getCommonUserIDCount() > 0 ? "computerConflict" : "", this.getAccusationUserIDCount() > 0 ? "accused" : ""];
return JSON.stringify(e)
}
isCaseEntry() {
return !!this._caseLog
}
}
s.F.UltMADEntry = r
}
,
57421: (e,t,i)=>{
i.d(t, {
J: ()=>_
});
i(87477),
i(10711);
var s = i(34229)
, r = i(30895)
, n = i(64842)
, a = i(69924)
, o = i(55542)
, l = i(79447)
, u = i(39513)
, h = (i(72287),
i(42074),
i(64974),
i(50481),
i(74926));
function g(e) {
return "isUltBorderedLocation"in e
}
const c = "function" == typeof SharedArrayBuffer && "undefined" != typeof window && !0 === window.crossOriginIsolated ? SharedArrayBuffer : ArrayBuffer;
function d(e, t) {
return t.borders.map((t=>{
let[i,s] = t;
return e.subarray(i, s)
}
))
}
function p(e) {
const [t,i,s] = function(e) {
const t = e.locations.filter(g)
, i = t.reduce(((e,t)=>e + t.borders.reduce(((e,t)=>e + t.length), 0)), 0)
, s = new c(i * Uint16Array.BYTES_PER_ELEMENT)
, r = new Uint16Array(s)
, n = new c(4 * t.length * Float32Array.BYTES_PER_ELEMENT)
, a = new Float32Array(n)
, o = new Map;
let l = 0
, u = 0;
for (const h of t) {
const e = h.getLocationID()
, t = h.getName()
, i = {
x: h.getCapital().x,
y: h.getCapital().y
}
, s = [];
for (const a of h.borders) {
const e = l;
for (const i of a)
r[l++] = i;
const t = l;
s.push([e, t])
}
const n = u
, [g,c,d,p] = h.getBoundsArray();
a[u++] = g,
a[u++] = c,
a[u++] = d,
a[u++] = p,
o.set(e, {
id: e,
name: t,
capital: i,
borders: s,
bounds: n
})
}
return [r, a, o]
}(e)
, [r,n] = function(e) {
if ("string" != typeof e.connections_v2)
throw new Error("Invalid connection data");
const t = new DataView((0,
h.J)(e.connections_v2));
if (t.byteLength % 24 != 0)
throw new Error("Unexpected connection data byte length");
const i = t.byteLength / 24
, s = new c(4 * i * Float32Array.BYTES_PER_ELEMENT)
, r = new Float32Array(s)
, n = []
, a = !1
, o = .01;
for (let l = 0, u = 0; l < t.byteLength; ) {
const e = t.getInt32(l, a)
, i = t.getInt32(l += 4, a)
, s = t.getInt32(l += 4, a) * o
, h = t.getInt32(l += 4, a) * o
, g = t.getInt32(l += 4, a) * o
, c = t.getInt32(l += 4, a) * o;
l += 4;
const d = u;
r[u++] = s,
r[u++] = h,
r[u++] = g,
r[u++] = c,
n.push({
locationId: e,
type: i,
positions: d
})
}
return [r, n]
}(e)
, {mapID: a, width: o, height: l, overlapX: u} = e;
return {
id: a,
width: o,
height: l,
wrapX: u > 0,
overlapX: u,
borderPosData: t,
borderBoundsData: i,
locations: s,
connectionPosData: r,
connections: n
}
}
var m = i(85665);
var I = i(81621)
, T = i(82840)
, A = i(54987)
, y = i(23361)
, S = i(81177);
class f {
constructor(e, t) {
this.locationId = e,
this.bounds = t
}
getLocationId() {
return this.locationId
}
getBoundsArray() {
return this.bounds
}
containsPoint(e, t) {
return (0,
s.M0)(this.bounds[0], this.bounds[1], this.bounds[2], this.bounds[3], e, t)
}
intersects(e, t, i, s) {
const r = this.bounds;
return !(i < r[0] || e > r[2] || s < r[1] || t > r[3])
}
}
var P = i(21778)
, D = i(83087)
, v = i(58202)
, R = i(61191)
, E = i(71544)
, C = i(87928);
const U = (e,t)=>(0,
s.wB)(e, t);
class _ {
stateType = S.V.STATE_TYPE_MAP_STATE;
map = null;
mapData = null;
triangulations = null;
locationsAsMap = new Map;
provincesAsMap = new Map;
locationsGrid = new l.D;
playerProvinceCache = new Map;
playerRegionsCache = new Map;
connectionsGrid = new l.D;
connectionsAtCache = new Map;
filteredConnectionCache = new Map;
timeStamp = 0;
useTstamp = !0;
updatedLocations = [];
updatedOwners = [];
regionProvinces = new Map;
playableProvinces = null;
playerNeighbours = new Map;
poiProvinces = [];
getWidth() {
return this.map.width
}
getHeight() {
return this.map.height
}
isContinuous() {
return this.map.overlapX > 0
}
createPointInOverlap(e, t) {
if (this.isContinuous()) {
[e,t] = n.E.flatten(e, t);
const i = this.getWidth();
if (e < this.map.overlapX)
return new n.E(e + i,t);
if (e >= i)
return new n.E(e - i,t)
}
return null
}
getAirDistanceSq(e, t, i, s) {
let r = e - i;
const n = t - s;
return this.isContinuous() && (r = Math.abs(r),
r > .5 * this.getWidth() && (r -= this.getWidth())),
r * r + n * n
}
getAirDistance(e, t, i, s) {
return Math.sqrt(this.getAirDistanceSq(e, t, i, s))
}
arePointsInRange(e, t, i) {
return !(!e || !t) && this.areCoordinatesInRange(e.x, e.y, t.x, t.y, i)
}
areCoordinatesInRange(e, t, i, s, r) {
return this.getAirDistanceSq(e, t, i, s) < r * r
}
updateRegions(e) {
this.map.regions = e
}
update(e) {
this.map ? (this.updateLocations(e.map.locations),
this.updateProperties(e.properties)) : this.initMap(e.map),
this.stateID = e.stateID,
this.timeStamp = e.timeStamp
}
updateInitial(e) {
this.updateLocationsFast(e.map.locations),
this.updateProperties(e.properties),
this.updateRegions(e.map.regions),
this.stateID = e.stateID,
this.timeStamp = e.timeStamp
}
updateLocationsFast(e) {
const t = []
, i = this.locationsAsMap;
for (let s = 0; s < e.length; s++) {
const r = e[s]
, n = r.getLocationID()
, a = i.get(n);
a ? a.update(r) : t.push(n)
}
t.length && window.onException(new Error(`map state instructs to update non-existent location(s) ${JSON.stringify(t)}`)),
this.scheduleNextGameStateUpdate()
}
initMap(e) {
if (this.map = {
width: e.width,
height: e.height,
overlapX: e.overlapX,
locations: e.locations,
mapID: e.mapID,
regions: e.regions,
populationFactor: e.populationFactor
},
this.locationsAsMap = new Map(this.map.locations.map((e=>[e.getLocationID(), e]))),
this.isContinuous() && n.E.enableContinuousMode(this.getWidth()),
e.triangulations) {
this.triangulations = function(e) {
const {borderTriangulations: t, provinceIds: i, precision: s, provinceBounds: r, ...n} = e
, a = 1 / e.precision
, {mapBounds: o} = n;
o && (n.mapBounds = {
minX: o.minX * a,
minY: o.minY * a,
maxX: o.maxX * a,
maxY: o.maxY * a
});
const {safeRegion: l} = n;
l && (n.safeRegion = {
minX: l.minX * a,
minY: l.minY * a,
maxX: l.maxX * a,
maxY: l.maxY * a
});
let u = 0
, h = 0
, g = 0
, c = 0
, d = 0;
const p = r.length;
for (let Z = 0; Z < t.length; ++Z)
for (const {t: e, ib: i, e: s, en: r, ei: n} of t[Z])
u += 5,
h += e.length,
c += i.length,
g += s.length,
s.length,
r.length,
d += (null == n ? void 0 : n.length) ?? 0,
s.length,
null == n || n.length;
const m = e=>4 * Math.floor((e + 3) / 4)
, I = m(u * Uint16Array.BYTES_PER_ELEMENT)
, T = m(h * Uint16Array.BYTES_PER_ELEMENT)
, A = m(c * Float32Array.BYTES_PER_ELEMENT)
, y = m(g * Float32Array.BYTES_PER_ELEMENT)
, S = m(g * Uint8Array.BYTES_PER_ELEMENT)
, f = m(d * Uint16Array.BYTES_PER_ELEMENT)
, P = m(p * Float32Array.BYTES_PER_ELEMENT)
, D = new ArrayBuffer(I + A + y + S + f)
, v = new ArrayBuffer(T + P);
let R = 0
, E = 0;
const C = new Uint16Array(D,R,u);
R += I;
const U = new Uint16Array(v,E,h);
E += T;
const _ = new Float32Array(D,R,c);
R += A;
const O = new Float32Array(D,R,g);
R += y;
const N = new Uint8Array(D,R,g);
R += S;
const M = new Uint16Array(D,R,d);
R += f;
let b = 0
, F = 0
, L = 0
, x = 0
, w = 0;
for (let Z = 0; Z < t.length; ++Z)
for (const {t: e, ib: s, e: r, en: n, ei: o} of t[Z]) {
C[b++] = i[Z],
C[b++] = e.length,
C[b++] = s.length,
C[b++] = r.length,
C[b++] = (null == o ? void 0 : o.length) ?? 0;
for (let t = 0; t < e.length; ++t,
++F)
U[F] = e[t];
for (let e = 0; e < s.length; ++e,
++x)
_[x] = s[e] * a;
for (let e = 0; e < r.length; ++e,
++L)
O[L] = r[e] * a,
N[L] = n[e];
if (o)
for (let e = 0; e < o.length; ++e,
++w)
M[w] = o[e]
}
const G = new Float32Array(v,E,p);
E += P;
for (let Z = 0; Z < p; ++Z)
G[Z] = r[Z] * a;
return {
...n,
provinceInfo: C,
indexData: U,
edgeData: O,
edgeNormalData: N,
innerPosData: _,
edgeIndexData: M,
provinceBoundsData: G
}
}(e.triangulations);
const {provinceInfo: t, provinceBoundsData: i} = this.triangulations;
let s = -1
, r = 0;
for (let e = 0; e < t.length; e += 5) {
const n = t[e];
if (n !== s) {
const e = this.locationsAsMap.get(n)
, t = r + 4;
(0,
T.ff)(e) && (e.bounds = i.subarray(r, t)),
r = t,
s = n
}
}
}
this.mapData = p(e);
const {borderPosData: t, borderBoundsData: i} = this.mapData;
for (const [s,r] of this.mapData.locations) {
const e = this.locationsAsMap.get(s);
void 0 !== e && (e.borders && (e.borders = d(t, r)),
e.bounds && (e.bounds = i.subarray(r.bounds, r.bounds + 4)))
}
this.initConnections(this.mapData)
}
initConnections(e) {
for (const t of e.connections) {
const i = new y.C(t,e.connectionPosData);
this.addConnection(new A.W(i))
}
}
getAllLocations() {
return this.map.locations
}
updateProperties(e) {
if (!e)
return;
const t = this.getProvinces();
for (const [i,s] of Object.entries(e))
t.get(Number(i)).setProperties(s)
}
getMapID() {
return this.map.mapID
}
getMapRegions() {
return this.map.regions
}
getMapRegionsForIds(e) {
const t = this.getMapRegions();
return t ? e.filter((e=>t[e])).map((e=>t[e])) : []
}
getPlayersForMapRegionId(e) {
const t = this.getProvincesForMapRegionId(e).map((e=>e.getOwnerID()));
return Array.from(new Set(t)).map((e=>u.IZ.gameState.getPlayerProfile(e)))
}
getProvincesForMapRegionId(e) {
return this.regionProvinces.has(e) || this.regionProvinces.set(e, this.getProvinceArray().filter((t=>t.isInRegion(e)))),
this.regionProvinces.get(e)
}
getPlayableProvinces(e) {
return 0 === this.playableProvinces.length && (this.playableProvinces = e.flatMap((e=>this.getProvincesForPlayer(e.getPlayerID())))),
this.playableProvinces
}
updateLocations(e) {
this.updatedLocations = [],
this.updatedOwners = [];
const t = this.locationsAsMap;
let i = new Set;
for (let s = 0; s < e.length; s++) {
const r = e[s]
, n = r.getLocationID()
, a = t.get(n);
a instanceof D.F && a.getOwnerID() !== r.getOwnerID() && (i.add(n),
a.getOwnerID() === u.IZ.config.userData.playerID && o.N.publish(C.q.UI_PROVINCE_LOST, n),
r.getOwnerID() === u.IZ.config.userData.playerID && o.N.publish(C.q.UI_PROVINCE_WON, n),
this.updatedOwners.push({
location: a,
oldOwner: a.getOwnerID(),
newOwner: r.getOwnerID()
})),
a.update(r),
this.resetConnectionCache(a),
this.updatedLocations.push(a)
}
i.size && (o.N.publish(C.q.PROVINCE_OWNER_CHANGED, i),
i = this.adjustBorderTypes(i, !0),
this.adjustBorderTypes(i, !1),
this.clearPlayerCaches()),
this.scheduleNextGameStateUpdate()
}
scheduleNextGameStateUpdate() {
let e = Number.MAX_VALUE;
this.getPlayerProvinces().forEach((t=>{
const i = t.getRemainingBuildTime() || Number.MAX_VALUE
, s = t.getRemainingProduceTime() || Number.MAX_VALUE;
e = Math.min(e, i, s)
}
)),
clearTimeout(this._scheduleNextGameStateUpdateHandle),
e < Number.MAX_VALUE && (this._scheduleNextGameStateUpdateHandle = setTimeout((()=>o.N.publish(C.q.REQUEST_GAMESTATE_UPDATE)), 1e3 * e))
}
clearPlayerCaches() {
this.playerProvinceCache.clear(),
this.playerRegionsCache.clear(),
this.playerNeighbours.clear()
}
initBorderTypes() {
this.adjustBorderTypes(this.getProvinces().keys(), !1)
}
adjustBorderTypes(e, t) {
const i = this.getProvinces()
, s = new Set
, r = u.IZ.gameState.getPlayerState()
, n = u.IZ.gameState.getForeignAffairsState();
for (const a of e) {
const e = i.get(a)
, o = e.getOwnerID()
, l = e.isImmutable()
, u = e.getBorderSegments();
for (const a of u) {
const e = a.neighbour
, u = i.get(e);
if (!u)
continue;
let h = a.borderType & E.u.STATIC_MASK;
const g = u.getOwnerID();
g === o ? l && !u.isImmutable() ? h |= E.u.IMMUTABLE_INNER : h |= E.u.INNER : r.arePlayersATeam(g, o) ? h |= E.u.INNER_ALLIANCE : n.isRevolt(g, o) ? h |= E.u.REVOLT : h |= E.u.INTER,
t && s.add(e),
a.borderType = h
}
}
return s
}
resetConnectionCache(e) {
const t = e.getConnections();
for (let i = 0; i < t.length; i++)
t[i].clearCache()
}
publishUpdate(e) {
var t;
o.N.publish(C.q.UI_MAP_STATE_UPDATED, {
changedLocationIDs: ((null === (t = e.map) || void 0 === t ? void 0 : t.locations) ?? []).map((e=>e.getLocationID()))
})
}
getLocation(e) {
return this.locationsAsMap.get(Number(e))
}
getPopulation(e) {
let t = this.getProvincesForPlayer(e).reduce(((e,t)=>e + t.getPopulation()), 0);
return t *= this.getPopulationFactor(),
t
}
getPopulationFactor() {
return this.map.populationFactor ?? 40
}
getAverageMorale(e) {
const t = this.getProvincesForPlayer(e);
let i = 0
, s = 0;
for (const r of t) {
const e = r.getPopulation();
i += r.getMorale() * e,
s += e
}
return s > 0 ? i / s : 0
}
getProvince(e) {
return this.getProvinces().get(Number(e))
}
getProvinces() {
return 0 === this.provincesAsMap.size && (this.provincesAsMap = new Map(this.getLocations().filter((e=>e instanceof D.F)).map((e=>[e.getLocationID(), e])))),
this.provincesAsMap
}
getProvinceArray() {
return this.provinceArray || (this.provinceArray = Array.from(this.getProvinces().values())),
this.provinceArray
}
getBorderedLocationsArray() {
return this.landLocationsArray || (this.landLocationsArray = this.getLocations(_.locationFilter.BORDERED_LOCATIONS)),
this.landLocationsArray
}
getNeighbourCountriesByPlayerID(e) {
let t = this.playerNeighbours.get(e);
return t || (t = this.discoverNeighbourCountriesForPlayer(e),
this.playerNeighbours.set(e, t)),
t
}
discoverNeighbourCountriesForPlayer(e) {
const t = new Set;
for (const s of this.getProvincesForPlayer(e))
for (const e of s.getNeighbours()) {
var i;
const s = (null === (i = this.getProvince(e)) || void 0 === i ? void 0 : i.getOwnerID()) ?? -1;
-1 !== s && t.add(s)
}
return t
}
getBorderedLocationAt(e, t) {
if ([e,t] = n.E.flatten(e, t),
!Number.isFinite(e) || !Number.isFinite(t))
return null;
e = r.kz(e, this.getWidth());
const i = this.getBorderedLocationsGrid().searchPoint(e, t);
if (i.length)
for (let s = i.length - 1; s >= 0; s--) {
const r = this.getLocation(i[s].getLocationId());
if (r.containsPoint(e, t))
return r
}
return null
}
getSeaProvinceAt(e, t) {
const i = this.getBorderedLocationAt(e, t);
return i && i.isOnSea() ? i : null
}
getProvinceAt(e, t) {
const i = this.getBorderedLocationAt(e, t);
return i instanceof D.F ? i : null
}
getNeutralProvinceAt(e, t) {
const i = this.getBorderedLocationAt(e, t);
return i instanceof P.h ? i : null
}
getLocationByName(e) {
return this.getLocations().find((t=>t.getName() === e))
}
getLocationNameByID(e) {
var t;
return (null === (t = this.getLocation(e)) || void 0 === t ? void 0 : t.getName()) ?? null
}
getLocationNameByPoint(e) {
var t;
return (null === (t = this.getLocationByPoint(e)) || void 0 === t ? void 0 : t.getName()) ?? null
}
getLocationByPoint(e) {
return e ? this.getClosestLocationAt(e) : null
}
getClosestLocationAt(e, t) {
[e,t] = n.E.flatten(e, t);
let i = this.getBorderedLocationAt(e, t);
if (!i) {
let r = Number.MAX_VALUE;
const n = this.getLocations();
for (let a = n.length - 1; a--; a >= 0) {
const o = n[a];
if ("isUltSeapoint"in o) {
const n = o.getCapital()
, a = (0,
s.yL)(n.x, n.y, e, t);
a < r && (r = a,
i = o)
}
}
}
return i
}
getFilteredConnectionsAt(e, t, i, r) {
let n = U(e, t);
i && (n = (0,
s.EE)(n, 65535)),
r && (n = (0,
s.EE)(n, 65536));
const a = this.filteredConnectionCache.get(n);
if (a)
return a;
let o = this.getConnectionsAt(e, t);
const l = !o;
if (l && (o = this.getConnectionsNear(e, t, 1)),
i || r || l) {
const s = this.filterConnections(o, e, t, i, r, l);
return l || this.filteredConnectionCache.set(n, s),
s
}
return o
}
filterConnections(e, t, i, r, n, a) {
const o = []
, l = R.C.maxToleranceSq
, u = a ? this.createPointInOverlap(t, i) : null;
for (let h = e.length - 1; h >= 0; --h) {
const g = e[h];
if ((!r || g.isOnSea()) && (!n || g.isOnSea() || g.getRailValue(this)))
if (a) {
const {x0: e, y0: r, x1: n, y1: a} = g;
let h, c;
if ((0,
s.J0)(t, i, e, r, n, a) <= l)
h = t,
c = i;
else {
if (!(u && (0,
s.J0)(u.x, u.y, e, r, n, a) <= l))
continue;
h = u.x,
c = u.y
}
const [d,p] = (0,
s.qy)(h, c, e, r, n, a);
if ((0,
s.qD)(d, p, e, r) <= l)
o.push(g);
else if ((0,
s.qD)(d, p, n, a) <= l)
o.push(g.cloneSwapped());
else {
const {locationId: t, type: i} = g;
o.push(new A.W({
x0: d,
y0: p,
x1: e,
y1: r,
locationId: t,
type: i
})),
o.push(new A.W({
x0: d,
y0: p,
x1: n,
y1: a,
locationId: t,
type: i
}))
}
} else
o.push(g)
}
return o
}
getAirConnectionsAt(e, t) {
const i = []
, s = u.IZ.gameState
, r = s.getForeignAffairsState()
, n = s.getMod().hasGameFeature(m.f.GF_ALLIED_FORTRESS)
, a = this.getProvinceCapitalAt(e)
, o = t.getOwnerID()
, l = t.getAirRange()
, h = this.getProvincesForPlayer(n ? -1 : o);
for (let u = 0; u < h.length; u++) {
const t = h[u];
if (t !== a && this.arePointsInRange(e, t.getCapital(), l) && t.hasAirfield() && (o === t.getOwnerID() || n && r.canUseAirfields(o, t.getOwnerID()))) {
const s = t.getCapital().getClosestEquivalent(e);
i.push(new I.Y(null,null,e,s))
}
}
return i
}
getBorderedLocationsGrid() {
if (0 === this.locationsGrid.size) {
const e = new l.D;
for (const t of this.getBorderedLocationsArray()) {
const i = t.getBoundsArray();
if (e.insert(new f(t.getLocationID(),i)),
this.isContinuous()) {
const [s,r,n,a] = i
, o = this.getWidth();
if (n > o) {
const i = [s - o, r, n - o, a];
e.insert(new f(t.getLocationID(),i))
} else if (s < 0) {
const i = [s + o, r, n + o, a];
e.insert(new f(t.getLocationID(),i))
}
}
}
this.locationsGrid = e
}
return this.locationsGrid
}
getBorderedLocation(e) {
const t = this.getLocation(e);
return t instanceof T.zb ? t : null
}
getNeutralProvince(e) {
const t = this.getLocation(e);
return t instanceof P.h ? t : null
}
getLocations(e) {
return e ? e.name ? (this.predefinedLocationFilterCache || (this.predefinedLocationFilterCache = {}),
this.predefinedLocationFilterCache[e.name] || (this.predefinedLocationFilterCache[e.name] = this.getAllLocations().filter(e.filter)),
this.predefinedLocationFilterCache[e.name]) : this.getAllLocations().filter(e) : this.getAllLocations()
}
static locationFilter = {
NOT_ON_SEA: {
name: "not_on_sea",
filter: e=>!e.isOnSea()
},
BORDERED_LOCATIONS: {
name: "bordered_locations",
filter: e=>e instanceof T.zb
},
NOT_ON_SEA_URBAN: {
name: "not_on_sea_urban",
filter: e=>e.isUrban()
}
};
getUpdatedLocations() {
return this.updatedLocations
}
getUpdatedPlayerProvinces() {
return this.updatedLocations.filter((e=>e.isPlayersProvince && e.isPlayersProvince()))
}
getOwnerUpdates() {
return this.updatedOwners
}
getProvincesForPlayer(e) {
let t = this.playerProvinceCache.get(e);
return t || (t = e < 0 ? this.getProvinceArray() : this.getProvinceArray().filter((t=>t.getOwnerID() === e)),
this.playerProvinceCache.set(e, t)),
t
}
getPlayerProvinces() {
return this.getProvincesForPlayer(u.IZ.config.userData.playerID)
}
getProvinceCountForPlayer(e) {
return this.getProvincesForPlayer(e).length
}
getMapRegionsForPlayer(e) {
if (!this.getMapRegions())
return null;
if (!this.playerRegionsCache.has(e)) {
const t = this.getProvincesForPlayer(e).flatMap((e=>e.getRegionIDs()));
this.playerRegionsCache.set(e, this.getMapRegionsForIds([...new Set(t)]))
}
return this.playerRegionsCache.get(e)
}
getVictoryPoints(e) {
return this.getProvincesForPlayer(e > 0 ? e : -1).reduce(((e,t)=>e + t.getTotalVictoryPoints()), 0)
}
addConnection(e) {
this.connectionsGrid.insert(e);
const t = this.getBorderedLocation(e.getProvinceID());
t && t.addConnection(e);
const i = e.cloneSwapped();
if (this.addToConnectionAtCache(e, e.x0, e.y0),
this.addToConnectionAtCache(i, i.x0, i.y0),
this.isContinuous()) {
let t = this.createPointInOverlap(e.x0, e.y0);
t && this.addToConnectionAtCache(e, t.x, t.y),
t = this.createPointInOverlap(i.x0, i.y0),
t && this.addToConnectionAtCache(i, t.x, t.y)
}
}
addToConnectionAtCache(e, t, i) {
const s = U(t, i);
let r = this.connectionsAtCache.get(s);
r || (r = [],
this.connectionsAtCache.set(s, r)),
r.push(e)
}
getConnectionsAt(e, t) {
const i = U(e, t);
return this.connectionsAtCache.get(i)
}
getConnectionsNear(e, t) {
let i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 25;
const s = []
, r = 2 * i;
let n = e - i
, a = t - i
, o = n + r
, l = a + r;
this.connectionsGrid.search(n, a, o, l, s);
const u = this.createPointInOverlap(e, t);
return u && (n = u.x - i,
a = u.y - i,
o = n + r,
l = a + r,
this.connectionsGrid.search(n, a, o, l, s)),
s
}
locationCapitalAt(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 5;
const i = t * t
, s = this.getLocations();
for (let r = s.length - 1; r >= 0; r--) {
const t = s[r].getCapital();
if (e.getDistanceSq(t.x, t.y) < i)
return s[r]
}
return null
}
getProvinceCapitalAt(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : .1;
const i = this.getProvinceAt(e);
return i && this.arePointsInRange(e, i.getCapital(), t) ? i : null
}
closestMapPoint(e, t, i) {
let s = Number.MAX_VALUE
, r = null;
const n = this.createPointInOverlap(e)
, a = this.getConnectionsNear(e.x, e.y);
for (let o = a.length - 1; o >= 0; o--) {
const l = a[o];
if ((!t || l.isOnSea()) && (!i || !l.isOnSea())) {
let t = l.getClosestPoint(e);
const i = e.getDistance(t, !0);
if (s > i && (r = t,
s = i),
n) {
t = l.getClosestPoint(n);
const e = n.getDistance(t, !0);
s > e && (r = t,
s = e)
}
}
}
return r
}
playerRect(e) {
const t = this.getPlayerCapital(e);
return this.provincesRect(t ? [t] : this.getProvincesForPlayer(e))
}
regionRect(e) {
const t = this.getProvincesForMapRegionId(e);
return this.provincesRect(t)
}
playableRect(e) {
const t = this.getPlayableProvinces(e);
return this.provincesRect(t)
}
provincesRect(e) {
if (!Array.isArray(e) || e.length <= 0)
return null;
let t = Number.MAX_VALUE
, i = Number.MAX_VALUE
, s = Number.MIN_VALUE
, r = Number.MIN_VALUE;
for (const n of e) {
const [e,a,o,l] = n.getBoundsArray();
t = Math.min(t, e),
i = Math.min(i, a),
s = Math.max(s, o),
r = Math.max(r, l)
}
return new a.U(t,i,s - t,r - i)
}
getAspectRatio() {
return this.map.width / this.map.height
}
updateStateID() {
this.timeStamp--
}
getPlayerCapital(e) {
return this.getProvince(u.IZ.gameState.getPlayerState().getPlayer(e).getCapitalID())
}
getPOIProvinces() {
return 0 === this.poiProvinces.length && (this.poiProvinces = this.getProvinceArray().filter((e=>e.isPOI()))),
this.poiProvinces
}
searchProvince(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ""
, i = -1;
for (const s of this.getProvinceArray()) {
const r = s.getName().normalize("NFD").replace(t, "").toLowerCase();
(r.indexOf(e) >= 0 && -1 === i || r.includes(e)) && (i = s.getLocationID())
}
return i
}
}
v.F.UltMapState = _
}
,
57361: (e,t,i)=>{
i.d(t, {
P: ()=>m
});
i(87477);
var s = i(61809)
, r = i(39513)
, n = i(1218)
, a = i(85665)
, o = i(24410)
, l = (i(20048),
i(81177))
, u = i(40102)
, h = i(67040)
, g = i(58202)
, c = i(4563)
, d = i(15357);
const p = (e,t)=>Number(e) > Number(t);
class m {
constructor() {
this.stateType = l.V.STATE_TYPE_MOD_STATE,
this.versionID = null,
this.upgrades = null,
this.units = null,
this.unitTypes = null,
this.allUnitTypes = null,
this.relations = null,
this.relationIDs = null,
this.agressionLevels = null,
this.gameFeatures = null,
this.resourceEntries = null,
this.resourceConsumption = null,
this.options = null,
this.stringOptions = null,
this.spyMissions = null,
this.replacedBy = null,
this.replacements = null,
this.premiums = null,
this.researchTypes = null,
this.damageTypes = null,
this.terrainTypes = null,
this.provinceStates = null,
this.provinceStateCount = 0,
this.levelUpgrades = null,
this.levelUpgradesArray = null,
this.jsonConfig = null,
this.provinceMoraleConfig = null,
this.adviserRewardConfig = null,
this.attackInterval = 0,
this.unitsPerUnitUpgradeGroupSorted = null,
this.unitsPerUnitUpgradeGroupSortedByTierDesc = null,
this.autoArmyWithdraw = null,
this.factionSpecificUnits = null,
this.factionSpecificResearches = null,
this.hadAdminAction = !1,
this.usesSeparateMoraleDamage = !1,
this.autoRecruitingUnitStatsId = null,
this.defaultInfantryUnitTypeStatsId = null,
this.defaultAirplaneTypeStatsId = null
}
getModID() {
return this.modID ?? this.itemID
}
getModVersion() {
return this.versionID
}
getUpgrades() {
return this.isUnresolved(this.upgrades) && (this.upgrades = this.resolveObjectsOrItemPacks(this.upgrades)),
this.upgrades
}
getBaseUpgrades() {
const e = {};
for (const t in this.upgrades)
this.upgrades.hasOwnProperty(t) && 0 === this.upgrades[t].replacedUpgrade && (e[t] = this.upgrades[t]);
return e
}
getUpgrade(e) {
return this.getUpgrades()[e]
}
getUpgradesWithFeature(e) {
const t = [];
for (const i in this.upgrades)
this.upgrades.hasOwnProperty(i) && this.upgrades[i].hasFeature(e) && t.push(this.upgrades[i]);
return t
}
getReplacedBy(e) {
return this.getReplacedByList()[e]
}
getReplacedByList() {
if (!this.replacedBy) {
const e = {};
for (const t in this.upgrades)
if (this.upgrades.hasOwnProperty(t)) {
const i = this.upgrades[t].getReplacedUpgrade();
let s = e[i];
s || (s = [],
e[i] = s),
s.push(t)
}
this.replacedBy = e
}
return this.replacedBy
}
getReplacements() {
return this.replacements
}
getProvinceLevelUpgrades() {
if (null === this.levelUpgrades) {
const e = this.getProvinceLevelUpgradesArray();
this.levelUpgrades = {};
for (let t = 0; t < e.length; t++) {
const i = e[t];
this.levelUpgrades[i.getItemID()] = i
}
}
return this.levelUpgrades
}
getProvinceLevelUpgradesArray() {
if (null === this.levelUpgradesArray) {
const e = this.getOption(a.f.OPTION_PROVINCE_LEVEL_ID)
, t = [];
let i = this.getUpgrade(e);
for (; i; )
t.push(i),
i = this.getUpgrade(i.getReplacingUpgrade());
this.levelUpgradesArray = t
}
return this.levelUpgradesArray
}
doesAutoUpgradeUnitsWithResearch() {
return this.getOption(a.f.OPTION_MOD_AUTO_UNIT_UPGRADE_WITH_RESEARCH) > 0
}
toggleProvincePerTerrainType() {
return this.getOption(a.f.OPTION_TOGGLE_PROVINCE_PER_TERRAIN_TYPE) > 0
}
getNumberOfProvinceLevelUpgrades() {
return this.getProvinceLevelUpgradesArray().length
}
getNumberOfProvinceStates() {
return 0 === this.provinceStateCount && this.provinceStates && (this.provinceStateCount = Object.keys(this.provinceStates).length),
this.provinceStateCount
}
getMaxProvinceLevel() {
const e = this.getProvinceLevelUpgrades();
let t = 0;
for (const i in e)
if (e.hasOwnProperty(i)) {
const s = e[i].getRequiredResearches();
let n = !0;
for (const e in s)
if (s.hasOwnProperty(e)) {
const t = r.IZ.gameState.getResearchState();
t.hasResearch(e) || t.hasReplacedResearch(e) || (n = !1)
}
n && t++
}
return t
}
getUnits() {
return this.resolveUnitsIfNecessary(),
this.units
}
resolveUnitsIfNecessary() {
this.isUnresolved(this.units) && (this.unitTypes = {},
this.allUnitTypes = this.resolveObjectsOrItemPacks(this.units),
this.units = {},
Object.values(this.allUnitTypes).forEach((e=>{
const t = new d.n
, i = e.getItemID();
t.setUnitTypeID(i),
this.units[i] = t;
const s = e.getStatsColumnID();
this.unitTypes[s] || (this.unitTypes[s] = e)
}
)))
}
getAutoRecruitingUnitStatsId() {
return !this.autoRecruitingUnitStatsId && this.hasGameFeature(a.f.GF_INFANTRY_RECRUITMENT) ? 2 : this.autoRecruitingUnitStatsId
}
getAutoRecruitableUnitType() {
return this.getUnitTypes()[this.getAutoRecruitingUnitStatsId()]
}
getUnit(e) {
return this.getUnits()[e]
}
getSpyMissions() {
return this.spyMissions
}
getUnitType(e) {
var t, i;
return (null === (t = this.unitTypes) || void 0 === t ? void 0 : t[e]) ?? (null === (i = this.allUnitTypes) || void 0 === i ? void 0 : i[e]) ?? this.getUnitTypeByItemID(e)
}
getUnitTypeByItemID(e) {
this.resolveUnitsIfNecessary();
return Object.values(this.allUnitTypes ?? this.unitTypes ?? {}).find((t=>Number(t.getItemID()) === Number(e)))
}
getUnitTypes() {
return this.resolveUnitsIfNecessary(),
this.unitTypes
}
getAllUnitTypes() {
return this.allUnitTypes ?? this.getUnitTypes()
}
getFactionSpecificUnitTypes() {
return this.hasFactionSpecificBalancing() ? (this.factionSpecificUnits || (this.factionSpecificUnits = this.resolveFactionSpecificItems(this.getAllUnitTypes())),
this.factionSpecificUnits) : this.getAllUnitTypes()
}
getFactionSpecificUnitType(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : r.IZ.getPlayerFaction();
if (!this.hasFactionSpecificBalancing())
return e;
const i = e.getFactionBaseItemId()
, s = e.getTier();
return Object.values(r.IZ.getMod().getAllUnitTypes()).filter((e=>e.getFactionBaseItemId() === i && e.getTier() === s)).find((e=>e.availableForFaction(t)))
}
getUnitsInUnitUpgradeGroupSortedByTierDesc(e) {
return this.getUnitsPerUnitUpgradeGroupSortedByTierDesc().get(e) ?? []
}
getUnitsByUpgradeGroup(e) {
if (this.unitsPerUnitUpgradeGroupSorted || (this.unitsPerUnitUpgradeGroupSorted = new Map),
!this.unitsPerUnitUpgradeGroupSorted.has(e)) {
const t = this.getUnitsPerUnitUpgradeGroupSortedByTierDesc().get(e);
t && this.unitsPerUnitUpgradeGroupSorted.set(e, [...t].reverse())
}
return this.unitsPerUnitUpgradeGroupSorted.get(e) ?? []
}
getUnitsPerUnitUpgradeGroupSortedByTierDesc() {
return this.unitsPerUnitUpgradeGroupSortedByTierDesc || (this.resolveUnitsIfNecessary(),
this.unitsPerUnitUpgradeGroupSortedByTierDesc = new Map,
Object.values(this.getFactionSpecificUnitTypes()).forEach((e=>{
const t = e.getUnitUpgradeGroup();
this.unitsPerUnitUpgradeGroupSortedByTierDesc.has(t) ? this.unitsPerUnitUpgradeGroupSortedByTierDesc.get(t).push(e) : this.unitsPerUnitUpgradeGroupSortedByTierDesc.set(t, [e])
}
)),
this.unitsPerUnitUpgradeGroupSortedByTierDesc.forEach((e=>e.sort(((e,t)=>t.getTier() - e.getTier()))))),
this.unitsPerUnitUpgradeGroupSortedByTierDesc
}
getUnitSetIDs() {
return this.unitSetIds || (this.unitSetIds = (0,
h.m)(this.getAllUnitTypes())),
this.unitSetIds
}
getResearchTypes() {
return this.researchTypes
}
getFactionSpecificResearchTypes() {
return this.hasFactionSpecificBalancing() ? (this.factionSpecificResearches || (this.factionSpecificResearches = this.resolveFactionSpecificItems(this.getResearchTypes())),
this.factionSpecificResearches || this.getResearchTypes()) : this.getResearchTypes()
}
getResearch(e) {
var t;
return (null === (t = this.researchTypes) || void 0 === t ? void 0 : t[e]) ?? null
}
getResearchesByBlueprintID(e) {
return Object.values(this.getResearchTypes()).filter((t=>Object.keys(t.getRequiredPlans()).includes(e)))
}
getRelations() {
return null === this.relationIDs && (this.relationIDs = Object.keys(this.relations).map((e=>parseInt(e, 10))).sort(((e,t)=>e - t))),
this.relationIDs
}
getRelation(e) {
return this.relations[e]
}
hasRelation(e) {
return null === this.relations || this.relations[e]
}
getAllResourceIDs(e, t) {
return Object.keys(this.resourceEntries).sort(p).filter((i=>{
const s = this.resourceEntries[i];
return s && !s.isHidden() && !(e && s.isCurrency()) && !(t && s.isManpower())
}
))
}
getTradeableResourceIDs() {
return Object.keys(this.resourceEntries).filter((e=>{
var t;
return null === (t = this.resourceEntries[e]) || void 0 === t ? void 0 : t.isTradeable()
}
))
}
getResourceEntries() {
return this.resourceEntries
}
getResourceEntry(e) {
var t;
return null === (t = this.resourceEntries) || void 0 === t ? void 0 : t[e]
}
getResourceName(e) {
const t = this.resourceEntries[e];
if (t)
return t.getName();
const i = this.getPremium(e);
return i ? i.getName() : r.IZ.i18n.gettext("none")
}
getPremium(e) {
return this.premiums && this.premiums[e] ? this.premiums[e] : r.IZ.contentItems && r.IZ.contentItems[e]instanceof o.e ? r.IZ.contentItems[e] : void 0
}
getPremiums() {
if (!this.premiums) {
const e = {}
, t = r.IZ.contentItems;
for (const i in t)
if (t.hasOwnProperty(i) && t[i]instanceof o.e) {
let s = t[i];
this.isUnresolved(s) && (s = this.resolveObjectsOrItemPacks(s)),
e[i] = s
}
this.premiums = e
}
return this.premiums
}
getOption(e) {
return this.options && Number.isFinite(Number.parseFloat(this.options[e])) ? this.options[e] : -1
}
getStringOption(e) {
return this.stringOptions && this.stringOptions[e] ? this.stringOptions[e] : null
}
getResourceConsumption(e) {
return this.resourceConsumption[e] || 0
}
hasGameFeature(e) {
return null === this.gameFeatures || this.gameFeatures.indexOf(e) >= 0
}
getPremiumAccountItemID() {
return this.options[a.f.OPTION_PREMIUM_ACCOUNT]
}
getPremiumCurrencyItemName() {
return this.getPremium(this.getPremiumCurrencyItemID()).getName()
}
getPremiumCurrencyItemID() {
return this.options[a.f.OPTION_PREMIUM_CURRENCY]
}
getTaxProductionFactor() {
return this.options.hasOwnProperty(a.f.OPTION_TAX_PRODUCTION_FACTOR) ? this.options[a.f.OPTION_TAX_PRODUCTION_FACTOR] / 100 : r.IZ.consts.TAX_PRODUCTION_FACTOR
}
getTaxPopulationFactor() {
return this.options.hasOwnProperty(a.f.OPTION_TAX_POPULATION_FACTOR) ? this.options[a.f.OPTION_TAX_POPULATION_FACTOR] / 1e3 : r.IZ.consts.TAX_POPULATION_FACTOR
}
getMarketFeePercent() {
return Math.max(this.getOption(a.f.OPTION_MOD_MARKET_FEE_PERCENTAGE), 0)
}
getMarketFeeFactor() {
return this.getMarketFeePercent() / 100
}
getConstructionSlotItemID() {
return this.options[a.f.OPTION_CONSTRUCTION_SLOT_ITEM]
}
getProductionSlotItemID() {
return this.options[a.f.OPTION_PRODUCTION_SLOT_ITEM]
}
getSpyCost() {
return this.options[a.f.OPTION_SPY_COST] || r.IZ.consts.SPY_COST
}
getManpowerResourceID() {
return this.options[a.f.OPTION_MANPOWER_RESOURCE]
}
getNonCoreProductionFactor() {
return this.options[a.f.OPTION_NONCORE_PRODUCTION]
}
getPatrolInterval() {
return this.getOption(a.f.OPTION_PATROL_INTERVAL)
}
getAchievementTitleItemID() {
return this.getOption(a.f.OPTION_ACHIEVEMENT_TITLE)
}
hasProvinceMoneySorter() {
return this.getOption(a.f.OPTION_HAS_PROVINCE_MONEY_SORTER) > 0
}
isProductionDisabledInNonUrbanProvinces() {
return this.getOption(a.f.OPTION_DISABLE_NON_URBAN_PRODUCTION) > 0
}
getValidPremiumSpyJobs(e) {
const t = r.IZ.gameState.getScenarioState().getPremiumSpyJobs() ?? []
, i = r.IZ.gameState.getGameInfoState().getGoldmarkLimitLevel()
, s = [];
for (let r = 0; r < t.length; r++)
if (t[r].getMaxGmLimitLevel() >= i) {
t[r].getSpyMission().isHostile() == e && s.push(t[r])
}
return s
}
getDamageTypes() {
return this.damageTypes
}
getTerrainTypes() {
return this.terrainTypes
}
hasTerrainTypes() {
return !!Object.values(this.getTerrainTypes()).length
}
getProvinceStates() {
return this.provinceStates
}
getProvinceStateUpgrades() {
const e = {}
, t = r.IZ.getMod().getUpgradesWithFeature(c.M.STATUS_CHANGE);
for (let i = 0; i < t.length; i++) {
const s = t[i];
e[s.getFeature(c.M.STATUS_CHANGE)] = s
}
return e
}
getProvinceState(e) {
return e >= 0 && null !== this.provinceStates && this.provinceStates[e] || null
}
getAggressionLevel(e) {
return this.agressionLevels[e]
}
getHarbourCosts() {
if (this.hasGameFeature(a.f.GF_CUSTOM_EMBARK_TIMES)) {
const e = this.options[a.f.OPTION_HARBOUR_COSTS];
if (null != e)
return e
}
return 10800
}
getRefuelCosts() {
if (this.hasAirplanesWw2) {
const e = this.options[a.f.OPTION_AIRPLANE_REFUEL_SECONDS];
if (null != e)
return e
}
return 0
}
getUprisingChancePerAggressionLevel() {
const e = this.getOption(a.f.OPTION_UPRISING_CHANCE_PER_AGGRESSION);
return e >= 0 ? e : 10
}
hasGarrisonFeature() {
return this.hasGarrison
}
getAdminAction() {
return null === this.hasAdminAction || void 0 === this.hasAdminAction || this.hasAdminAction
}
hasScalableOffers() {
return this.hasGameFeature(a.f.GF_SCALABLE_OFFERS)
}
hasCoreProvinces() {
return this.hasGameFeature(a.f.GF_CORE_PROVINCES)
}
hasManpower() {
return this.hasGameFeature(a.f.GF_MANPOWER)
}
hasGrowthHacking() {
return this.hasGameFeature(a.f.GF_GROWTH_HACKING)
}
hasStrategicAdviser() {
return this.hasGameFeature(a.f.GF_STRATEGIC_ADVISER)
}
hasAutoRecruitment() {
return !!this.getAutoRecruitingUnitStatsId()
}
hasVictoryPoints() {
return this.hasGameFeature(a.f.GF_VICTORY_POINTS)
}
hasResearch() {
return this.hasGameFeature(a.f.GF_RESEARCH)
}
hasAirplanesWw2() {
return this.hasGameFeature(a.f.GF_AIRPLANES_WW2)
}
hasInheritingUpgrades() {
return this.hasGameFeature(a.f.GF_UPGRADES_INHERIT)
}
hasEqualDamageDistribution() {
return this.hasGameFeature(a.f.GF_EQUAL_DAMAGE_DISTRIBUTION)
}
hasImpactMarkers() {
return this.hasGameFeature(a.f.GF_IMPACT_MARKERS)
}
hasIngameEvents() {
return this.hasGameFeature(a.f.GF_INGAME_EVENTS)
}
hasIngameInventoryFeature() {
return this.hasGameFeature(a.f.GF_INGAME_INVENTORY)
}
hasNeutralProvinceFeature() {
return this.hasGameFeature(a.f.GF_NEUTRAL_PROVINCES)
}
hasCoalitionFeature() {
return this.hasCoalition
}
hasQuests() {
return this.hasGameFeature(a.f.GF_PROVINCE_CONQUER_QUESTS)
}
canUsePointsAsRewardAmount() {
return this.hasGameFeature(a.f.GF_POINTS_AS_REWARD_AMOUNT)
}
usesEffectiveRankingRewardSystem() {
return this.hasGameFeature(a.f.GF_EFFECTIVE_RANKING_REWARD_SYSTEM)
}
hasFactionSpecificBalancing() {
return this.hasGameFeature(a.f.GF_FACTION_SPECIFIC_BALANCING)
}
hasScoutableProvinces() {
return this.hasGameFeature(a.f.GF_SCOUTABLE_PROVINCES)
}
hasImmutableProvinceFeature() {
return this.hasImmutableProvince
}
getEnabledDiplomaticTradeTypes() {
return this.enabledDiplomaticTradeTypes
}
getEnabledDiplomaticTradeResources() {
return this.enabledDiplomaticTradeResources
}
getMoraleBasedProductionTimeConfig() {
return this.jsonConfig.moraleBasedProductionTime
}
getMoraleBasedConstructionTimeConfig() {
return this.jsonConfig.moraleBasedConstructionTime
}
getMoraleBasedAutoRecruitmentTimeConfig() {
return this.jsonConfig.moraleBasedAutoRecruitmentTime
}
getMoraleBasedResourceProductionRateConfig() {
return this.jsonConfig.moraleBasedResourceProductionRate
}
getMoraleBasedDmgFactorConfig() {
return this.jsonConfig.moraleBasedDmgFactor
}
getMoraleBasedSpeedFactorConfig() {
return this.jsonConfig.moraleBasedSpeedFactor
}
getFloorSpacePenaltyConfig() {
return this.jsonConfig.floorSpacePenalty
}
getFloorSpaceUpperThreshold() {
var e;
return Math.floor(null === (e = this.getFloorSpacePenaltyConfig()) || void 0 === e ? void 0 : e.getUpperThreshold())
}
getRevoltMoraleThreshold() {
var e;
return (null === (e = this.provinceMoraleConfig) || void 0 === e ? void 0 : e.revoltMoraleThreshold) ?? 33
}
isUnresolved(e) {
return "string" == typeof e || e instanceof String
}
resolveObjectsOrItemPacks(e) {
const t = (0,
h.u)(e)
, i = {};
for (const [s] of t)
if (t.has(s)) {
const e = r.IZ.contentItems[s];
e && (e instanceof u.p ? Object.assign(i, e.getItems()) : i[s] = e)
}
return i
}
getAdviserRewardConfig() {
return this.adviserRewardConfig || (this.adviserRewardConfig = new n.d),
this.adviserRewardConfig
}
getAttackInterval() {
return this.attackInterval / 1e3
}
getCurrentScenarioId() {
var e, t, i;
return null === (e = r.IZ.gameState) || void 0 === e || null === (t = e.getGameInfoState) || void 0 === t || null === (i = t.call(e)) || void 0 === i ? void 0 : i.getScenarioID()
}
getCurrentScenario() {
const e = this.getCurrentScenarioId();
return e ? r.IZ.contentItems[e] : null
}
getScenarioByID(e) {
return r.IZ.contentItems[e]
}
getPremiumCurrencyItem() {
return this.premiumCurrencyItem || (this.premiumCurrencyItem = this.getPremium(this.getPremiumCurrencyItemID())),
this.premiumCurrencyItem
}
getPremiumAccountItem() {
return this.premiumAccountItem || (this.premiumAccountItem = this.getPremium(this.getPremiumAccountItemID())),
this.premiumAccountItem
}
getScenarioPriorityOption(e, t) {
const i = this.getCurrentScenario().getOption(e) || this.getOption(e);
return i >= 0 ? i : t
}
hasAutoRetreatingUnits() {
return !!this.autoArmyWithdraw
}
getEqualDamageDistribution() {
return this.jsonConfig.equalDamageDistribution
}
resolveFactionSpecificItems(e) {
if (!e || !this.hasFactionSpecificBalancing())
return e ?? {};
const t = r.IZ.getPlayerFaction()
, i = Object.values(e).reduce(((e,i)=>(i.availableForFaction(t) && (e[i.getItemID()] = i),
e)), {});
return (0,
s.Ew)(i) ? e : i
}
getProvinceMoraleConfig() {
return this.provinceMoraleConfig ?? {}
}
getBaseTargetMorale() {
var e;
return (null === (e = this.provinceMoraleConfig) || void 0 === e ? void 0 : e.baseTargetMorale) ?? 50
}
getSuppressRevoltArmyStrength() {
return this.suppressRevoltArmyStrength
}
getProvinceNeighbourMoraleThreshold() {
return this.options.provinceNeighbourMoraleThreshold ?? 80
}
hasSeparateMoraleDamage() {
return this.usesSeparateMoraleDamage
}
getDefaultInfantryUnitTypeStatsId() {
return this.defaultInfantryUnitTypeStatsId ?? 2
}
getDefaultAirplaneTypeStatsId() {
var e;
this.defaultAirplaneTypeStatsId || (this.defaultAirplaneTypeStatsId = null === (e = Object.values(this.getAllUnitTypes()).filter((e=>1 === e.getTier())).find((e=>e.isAirplane()))) || void 0 === e ? void 0 : e.getStatsColumnID());
return this.defaultAirplaneTypeStatsId
}
}
g.F.UltMod = m
}
,
67040: (e,t,i)=>{
function s(e) {
const t = /\s*a(\d+)(?:=([^\s]+))?\s*,?/g
, i = new Map;
let s = t.exec(e);
for (; null !== s; ) {
const [,r,n] = s;
s = t.exec(e),
i.set(Number(r), n ?? "1")
}
return i
}
function r(e) {
const t = [1, 7, 2, 3, 4, 5]
, i = new Set(Object.values(e).filter((e=>e.isProducible())).map((e=>e.getSetID())));
return Array.from(i).sort(((e,i)=>t.indexOf(e) - t.indexOf(i)))
}
i.d(t, {
m: ()=>r,
u: ()=>s
})
}
,
10072: (e,t,i)=>{
i(87477);
var s = i(58202);
s.F.UltMoraleFactors = class {
constructor() {
this.siegeArmyInfluence = 0,
this.capitalDistanceInfluence = 0,
this.dayDistance = 0,
this.hasCapital = !0,
this.radiationInfluence = 0,
this.neighbourInfluence = 0,
this.enemyArmyInfluence = 0,
this.warCountries = 0,
this.warInfluence = 0,
this.enemyNeighbourInfluence = 0,
this.resourceShortage = null,
this.buildingInfluence = null,
this.expansionPenalty = 0
}
applyData(e) {
this.siegeArmyInfluence = e.siegeArmyInfluence || 0,
this.capitalDistanceInfluence = e.capitalDistanceInfluence || 0,
this.dayDistance = e.dayDistance || 0,
this.hasCapital = !e.noCapital,
this.radiationInfluence = e.radiationInfluence || 0,
this.neighbourInfluence = e.neighbourInfluence || 0,
this.enemyArmyInfluence = e.enemyArmyInfluence || 0,
this.warCountries = e.warCountries || 0,
this.warInfluence = e.warInfluence || 0,
this.enemyNeighbourInfluence = e.enemyNeighbourInfluence || 0,
this.resourceShortage = this.toList(e.resourceShortage),
this.buildingInfluence = this.toList(e.buildingInfluence),
this.expansionPenalty = e.expansionPenalty || 0
}
toList(e) {
if (!e)
return null;
const t = [];
for (const i in e)
e.hasOwnProperty(i) && t.push({
key: i,
val: e[i]
});
return t
}
getTotalBuildingInfluence() {
var e;
return (null === (e = this.buildingInfluence) || void 0 === e ? void 0 : e.reduce(((e,t)=>e + t.val), 0)) ?? 0
}
getTotalResourceShortageInfluence() {
var e;
return (null === (e = this.resourceShortage) || void 0 === e ? void 0 : e.reduce(((e,t)=>e + t.val), 0)) ?? 0
}
getTotalInfluence() {
let e = 0;
return e += this.capitalDistanceInfluence,
e += this.radiationInfluence,
e += this.neighbourInfluence,
e += this.enemyArmyInfluence,
e += this.warInfluence,
e += this.enemyNeighbourInfluence,
e += this.expansionPenalty,
e += this.getTotalBuildingInfluence(),
e += this.getTotalResourceShortageInfluence(),
e
}
}
}
,
21778: (e,t,i)=>{
i.d(t, {
h: ()=>n
});
var s = i(82840)
, r = i(58202);
class n extends s.zb {
isNeutral() {
return !0
}
}
r.F.UltNeutralProvince = n
}
,
45782: (e,t,i)=>{
i.d(t, {
q: ()=>n
});
var s = i(58202)
, r = i(13775);
class n {
constructor() {
this.clientLayoutVersion = null,
this.category = null,
this.startDate = null,
this.expirationDate = null,
this.uid = null
}
static isMetaCategory(e) {
return e <= n.Categories.ALL
}
static getCategoriesByMetaKey(e) {
switch (e) {
case n.Categories.ALL:
return Object.values(n.Categories).filter((e=>!n.isMetaCategory(e)));
case n.Categories.NON_GENERAL:
return Object.values(n.Categories).filter((e=>!n.isMetaCategory(e) && e !== n.Categories.GENERAL));
default:
return []
}
}
static getTranslatedCategoryName(e) {
switch (e) {
case n.Categories.EVENT:
return hup.i18n.gettext("Event");
case n.Categories.SCENARIO_ROTATION:
return hup.i18n.gettext("Scenario Rotation");
default:
return hup.i18n.gettext("News")
}
}
getID() {
return this.uid
}
getDate() {
return this.crdate
}
getBodyText() {
return this.bodytext
}
getTitle() {
return this.title
}
getImageSrc() {
return this.image
}
getPreviewImageSrc() {
return this.imagePreview
}
getClientLayoutVersion() {
return parseInt(this.clientLayoutVersion, 10) || 1
}
isEventArticle() {
return parseInt(this.category) === n.Categories.EVENT
}
isEventStarted() {
return this.startDate < Date.now() / 1e3
}
getRemainingTimeToStart() {
const e = this.startDate - Date.now() / 1e3;
return r.Z.formatTimerTiny(e, 4)
}
getRemainingTimeToExpiration() {
const e = this.expirationDate - Date.now() / 1e3;
return r.Z.formatTimerTiny(e, 4)
}
getTitleParts() {
const e = this.getTitle().trim();
return e ? e.split(" - ") : []
}
}
n.Categories = {
GENERAL: 0,
EVENT: 1,
SCENARIO_ROTATION: 2,
ALL: -1,
NON_GENERAL: -2
},
s.F.UltNews = n
}
,
74241: (e,t,i)=>{
i.d(t, {
K: ()=>l
});
i(87477);
var s = i(55542)
, r = i(41048)
, n = i(81177)
, a = i(58202)
, o = i(87928);
class l {
constructor() {
this.stateType = n.V.STATE_TYPE_NEWSPAPER_STATE,
this.days = {}
}
update(e) {
const {day: t} = e;
this.hasDay(t) || (this.days[t] = {}),
this.days[t].articles = e.articles,
this.days[t].ranking = e.ranking,
this.days[t].mapInfo = e.mapInfo,
this.stateID = e.stateID,
s.N.publish(o.q.UI_NEWSPAPER_DAY_RECEIVED, t)
}
getArticles(e) {
const t = this.getDay(e);
return !!t && t.articles
}
getRanking(e) {
const t = this.getDay(e);
return !!t && t.ranking
}
getDay(e) {
return this.hasDay(e) ? this.days[e] : (this.requestDay(e),
!1)
}
requestDay(e) {
this.hasDay(e) || s.N.publish(o.q.REQUEST_GAMESTATE_UPDATE, {
state: this,
option: e
})
}
hasDay(e) {
return !!this.days[e]
}
getMapInfo(e) {
const t = this.getDay(e);
return !!t && t.mapInfo
}
getArticle(e, t) {
const i = this.getDay(e);
if (!i)
return !1;
const {articles: s} = i;
for (let r = 0; r < s.length; r++)
if (s[r].messageUID === parseInt(t, 10))
return s[r];
return !1
}
getArticlesSorted(e) {
let t = this.getArticles(e);
if (t) {
t = t.sort(((e,t)=>t.compareByDateObj && e.compareByDateObj ? t.compareByDateObj(e) : -1));
const e = []
, i = [];
let s;
for (let n = 0; n < t.length; n++)
s = t[n],
s instanceof r.a && (s.isSystemMessage() ? i.push(s) : e.push(s));
return e.concat(i)
}
return !1
}
getNewArticlesCount(e, t) {
let i = 0;
for (const s in this.days)
this.days.hasOwnProperty(s) && (i += this.getNewArticlesCountForDay(s, e, t));
return i
}
getNewArticlesCountForDay(e, t, i) {
let s = 0;
const n = this.getArticles(e);
if (n)
for (let a = 0; a < n.length; a++)
n[a]instanceof r.a && n[a].isNewPlayerArticle(i, t) && s++;
return s
}
}
a.F.UltNewspaperState = l
}
,
7905: (e,t,i)=>{
i.d(t, {
Z: ()=>n
});
var s = i(58202)
, r = i(13775);
class n {
constructor(e, t, i, s, r, n) {
this.orderID = e,
this.setBuy(t),
this.amount = Math.max(0, i),
this.setLimit(s),
this.resourceType = r,
this.playerID = n,
this["@c"] = "ultshared.UltOrder",
this.totalPrice = 0,
this.embargo = !1,
this.isOwner = !1,
this.buyable = !1
}
getOrderID() {
return this.orderID
}
setLimit(e) {
this.limit = Math.round(10 * Math.max(0, e)) / 10
}
getLimit() {
return this.limit
}
getLimitHR() {
let e = r.Z.formatNumber(this.limit, 1);
return e.length > 8 && (e = `${e.substr(0, 6)}...`),
e
}
getAmount() {
return this.amount
}
getAmountHR(e) {
return r.Z.formatNumber(this.amount, 0, e)
}
getAmountHRWithSign(e) {
const t = e ? this.hasSold : this.isBuy()
, i = this.amount * (t ? -1 : 1);
return r.Z.formatNumber(i, 0, !0)
}
isPremium() {
return this.premium
}
setPremium(e) {
this.premium = e
}
isBuy() {
return this.buy
}
setBuy(e) {
this.buy = !!e
}
getResourceType() {
return this.resourceType
}
getPlayerID() {
return this.playerID
}
setPlayerID(e) {
this.playerID = e
}
setAmount(e) {
this.amount = Math.floor(e)
}
getTotalPrice() {
return this.totalPrice || (this.totalPrice = Math.round(this.amount * this.limit)),
this.totalPrice
}
getIcon() {
return hup.ui.iconsHelper.getResourceIcon(this.resourceType)
}
getIconSmall() {
return hup.ui.iconsHelper.getResourceIconSmall(this.resourceType)
}
resolveForCurrentPlayer(e, t) {
this.playerID === e ? this.isOwner = !0 : t.canTrade(e, this.playerID) ? this.isPremium() || (this.buyable = !0) : this.embargo = !0,
this.hasSold = this.isBuy() && !this.isOwner || !this.isBuy() && this.isOwner
}
getUnitPrice() {
return this.limit
}
getTotalPriceWithFee() {
const e = this.getTotalPrice()
, t = hup.getMod().getMarketFeeFactor();
return t > 0 ? e + Math.ceil(e * t) : e
}
}
s.F.UltOrder = n
}
,
73576: (e,t,i)=>{
i.d(t, {
M: ()=>u
});
i(87477);
var s = i(84810)
, r = i(39513)
, n = i(85665)
, a = i(60105)
, o = i(58202)
, l = i(5238);
class u {
playerID;
playerImageID;
name;
title;
customName;
siteUserID;
banned;
computerPlayer;
flagImageID;
mail;
fullTitle;
teamID;
userName;
retired;
nationName;
nationLabelCoord;
nationLabelSize;
nationAdjective;
primaryColor;
capitalID;
noobBonus;
isGameCreator;
defeated;
premiumUser;
transportShipUnitTypeId;
lastLeftTeam;
lastKickedFromTeam;
poiTimer;
constructor() {
this["@c"] = "ultshared.UltPlayerProfile",
this.sortingPriorities = {
COMPUTER_PLAYER: 0,
INACTIVE_PLAYER: 1,
ACTIVE_PLAYER: 2
},
this.faction = null
}
getPlayerID() {
return this.playerID
}
getPlayerImageID() {
return this.playerImageID
}
getPlayerImageURL() {
return this.hasCustomPlayerImage() ? r.IZ.ui.helper.getImgUrl(this.playerImageID, "png") : r.IZ.config.hasCountrySpecificPlayerAvatars ? `images/player_avatars/${r.IZ.gameState.getGameInfoState().getMapID()}/${this.playerID}.jpg` : `images/faction_player_avatars/${this.faction}.png`
}
hasCustomPlayerImage() {
return -1 !== this.playerImageID
}
getNameLinked() {
return r.IZ.ui.helper.wrapAsCountryLink(this.name, this.getPlayerID())
}
getName() {
return this.name
}
setName(e) {
this.name = e
}
setTitle(e) {
this.title = e
}
setCustomPlayerName(e) {
this.customName = e
}
getFullName() {
return `${this.title} ${this.name}`
}
getSiteUserID() {
return this.siteUserID
}
getBanned() {
return this.banned
}
getComputerPlayer() {
return this.computerPlayer
}
getFlagImageID() {
return this.flagImageID
}
getFlagImageURL(e, t, i) {
if (this.hasCustomFlag())
return r.IZ.ui.helper.getImgUrl(this.getFlagImageID(), "png");
return i = i || "png",
`images/flags/${r.IZ.gameState.getGameInfoState().getMapID()}/${t = t || (e ? "big" : "small")}_${this.playerID}.${i}`
}
getSquareFlagImageURL() {
return this.getFlagImageURL(!1, "square")
}
hasCustomFlag() {
return -1 !== parseInt(this.getFlagImageID(), 10)
}
getBigFlagImageURL() {
return this.getFlagImageURL(!0)
}
getMail() {
return this.mail
}
getFullTitle() {
return this.fullTitle
}
getTeamID() {
return this.teamID
}
getTeam() {
return r.IZ.gameState.getPlayerState().getTeam(this.getTeamID())
}
getCoalition() {
return r.IZ.inGameAllianceController ? r.IZ.inGameAllianceController.getAllianceByID(this.getTeamID()) : null
}
getTitle() {
return this.title
}
getUserNameLinked() {
return r.IZ.ui.helper.wrapAsCountryLink(this.getUserName(), this.getPlayerID())
}
getUserName() {
return this.userName
}
getFaction() {
return !this.faction && r.IZ.config.defaultFaction ? r.IZ.config.defaultFaction : this.faction ?? l.a.ALLIES
}
getFactionName() {
return (0,
l.V)(this.faction)
}
getNationNameLinked() {
return r.IZ.ui.helper.wrapAsCountryLink(this.nationName, this.getPlayerID())
}
getNationName() {
return this.nationName
}
getNationLabelCoord() {
return this.nationLabelCoord
}
getNationLabelSize() {
return this.nationLabelSize
}
getNationAdjective() {
return this.nationAdjective
}
getPrimaryColor() {
return this.primaryColor
}
getAlphaFixedPrimaryColor() {
return this.getPrimaryColor().replace(/,\d+\)/, ",0.18)")
}
getCapitalID() {
return this.capitalID
}
hasCapital() {
return this.getCapitalID() >= 0
}
getNoobBonus() {
return this.noobBonus
}
getIsGameCreator() {
return this.isGameCreator
}
isDefeated() {
return this.defeated
}
isRetired() {
return this.retired
}
isPremiumUser() {
return this.premiumUser
}
getTransportShipUnitTypeId() {
if (!this.transportShipUnitTypeId) {
var e;
const t = null === (e = r.IZ.gameState.getResearchState()) || void 0 === e ? void 0 : e.getTransportShipUnitTypeId();
return t || r.IZ.getMod().getOption(n.f.OPTION_TRANSPORT_SHIP)
}
return this.transportShipUnitTypeId
}
getPremiumEndTime() {
if (this.getPlayerID() != r.IZ.config.userData.playerID)
return 0;
const e = r.IZ.user.getInventory().getItem(r.IZ.getMod().getPremiumAccountItemID());
return e ? e.getEndDate() : 0
}
hasAdditionalConstructionSlot() {
return this.getPlayerID() == r.IZ.config.userData.playerID && this.premiumBuildSlot
}
hasAdditionalProductionSlot() {
return this.getPlayerID() == r.IZ.config.userData.playerID && this.premiumProductionSlot
}
loadPlayerImage(e, t) {
this.playerImage || (this.playerImage = e.loadImage(this.getPlayerImageURL(), "playerImage", t)),
t && t(this.playerImage)
}
getFlagImageTag() {
return `<img src="${this.getFlagImageURL()}"/>`
}
getFlagImage(e, t) {
return !this.flagImage && e && (this.flagImage = e.loadImage(this.getFlagImageURL(), "flagImage", t, !0)),
this.flagImage
}
getSquareFlagImage(e, t) {
return this.quadFlagImage || (this.quadFlagImage = e.loadImage(this.getSquareFlagImageURL(), "flagImage", t, !0)),
this.quadFlagImage
}
isTutorialGame() {
return this.isTutorialGameFlag
}
isPlayableComputer() {
return (this.isComputerPlayer() || this.isReopenedPlayer()) && !this.isNativeComputer()
}
isMessagingAvailable() {
return this.getPlayerID() != r.IZ.config.userData.playerID
}
isTradeAvailable() {
return !this.computerPlayer && this.isMessagingAvailable()
}
isTakenCountry() {
return !this.isComputerPlayer() && !this.isReopenedPlayer()
}
isComputerPlayer() {
return this.computerPlayer
}
isReopenedPlayer() {
return !this.computerPlayer && this.siteUserID < 0
}
isNativeComputer() {
return this.nativeComputer
}
isPassiveAI() {
return this.passiveAI
}
isActivePlayer() {
return !this.computerPlayer && !this.isAIPlayer() && !this.isGuestPlayer()
}
isInactivePlayer() {
return !this.computerPlayer && this.isAIPlayer() && !this.isGuestPlayer()
}
isPlayable(e, t) {
return !(t && t >= 0 && e === a.c.SCENARIO && this.getTeamID() !== t) && r.IZ.gameState.getPlayerState().isPickablePlayerID(this.getPlayerID())
}
getPlayerIconImageURL() {
const e = "images/map/players/";
return this.isComputerPlayer() ? `${e}ai_ingame_icon.png` : this.isActivePlayer() ? `${e}real_player_ingame_icon.png` : `${e}inactive_player_ingame_icon.png`
}
getPlayerIconImage(e) {
return e = e || !1,
this.playerIconImage || (this.playerIconImage = new Image,
this.playerIconImage.crossOrigin = "Anonymous",
this.playerIconImage.src = this.getPlayerIconImageURL(),
e && (this.flagImage.onload = e)),
this.playerIconImage
}
isAIPlayer() {
return this.computerPlayer || this.lastLogin == u.LAST_LOGIN_INACTIVE
}
isGuestPlayer() {
return this.playerID <= u.guestPlayerID
}
getLastLoginAsFormattedDate() {
return this.lastLogin > 0 ? new Date(this.lastLogin).toLocaleDateString() : r.IZ.i18n.gettext("Inactive")
}
getLastLogin() {
return this.lastLogin || 0
}
isCurrentPlayer() {
return this.playerID == r.IZ.config.userData.playerID
}
getSortingPriority() {
return this.isInactivePlayer() ? this.sortingPriorities.INACTIVE_PLAYER : this.isActivePlayer() ? this.sortingPriorities.ACTIVE_PLAYER : this.sortingPriorities.COMPUTER_PLAYER
}
getCapitalCoords() {
const e = r.IZ.gameState.getMapState().getPlayerCapital(this.playerID);
return e ? e.getCapital() : null
}
isInSameTeamWithCurrentPlayer() {
if (!r.IZ.config.userData.playerID)
return !1;
const e = r.IZ.gameState.getPlayerProfile();
return this.getTeamID() === e.getTeamID()
}
isFriendly() {
return this.playerID == r.IZ.config.userData.playerID || r.IZ.gameState.getForeignAffairsState().canSeeEachOthersArmies(this.playerID, r.IZ.config.userData.playerID)
}
isEnemy() {
return r.IZ.gameState.getForeignAffairsState().isAtWar(this.playerID, r.IZ.config.userData.playerID)
}
isNeutral() {
return !(this.isFriendly() || this.isEnemy())
}
getRankingOrder(e) {
const t = r.IZ.gameState.getGameInfoState().getDayOfGame()
, i = r.IZ.gameState.getNewspaperState().getRanking(t)
, s = Object.values(i.getPlayerIDsRankSorted()).indexOf(this.playerID) + 1;
return e ? r.IZ.ui.helper.getNumberOrdinal(s) : s
}
getEnemyList() {
const e = []
, t = r.IZ.gameState.getForeignAffairsState()
, i = r.IZ.gameState.getPlayerState()
, s = t.getEnemies(this.playerID);
for (let r = 0; r < s.length; r++) {
const t = i.getPlayer(s[r]);
t.isDefeated() || t.isPassiveAI() || e.push(t)
}
return e
}
getLastLeftTeam() {
return this.lastLeftTeam
}
getLastKickedFromTeam() {
return this.lastKickedFromTeam
}
getPoiTimer() {
return this.poiTimer
}
isAdminPlayer() {
return r.IZ.getMod().hasAdminAction && this.getIsGameCreator()
}
getSuperficialRelationType() {
return this.isCurrentPlayer() ? s.u.MINE : this.isEnemy() ? s.u.ENEMY : this.isFriendly() ? s.u.FRIENDLY : s.u.NEUTRAL
}
}
u.guestPlayerID = -0,
u.LAST_LOGIN_INACTIVE = 0,
o.F.UltPlayerProfile = u
}
,
34966: (e,t,i)=>{
i(87477);
var s = i(55542)
, r = i(60105)
, n = i(81177)
, a = i(73576)
, o = i(58202)
, l = i(86226)
, u = i(87928);
class h {
constructor() {
this.stateType = n.V.STATE_TYPE_PLAYER_STATE,
this.players = {},
this.reducedPlayers = null,
this.visiblePlayers = null,
this.teams = {},
this.pickableSlots = []
}
getPlayers() {
return this.players
}
getPlayerIDs() {
const e = [];
for (const t in this.players)
this.players.hasOwnProperty(t) && e.push(this.players[t].playerID);
return e
}
getPlayer(e) {
const t = this.players[e];
return t instanceof a.M ? t : new a.M
}
getPlayerByUserID(e) {
e = parseInt(e, 10);
const t = Object.keys(this.players);
for (let i = 0; i < t.length; i++) {
const s = parseInt(t[i], 10);
if (s <= 0)
continue;
const r = this.players[s];
if (parseInt(r.getSiteUserID(), 10) === e)
return r
}
return null
}
getTeams() {
const e = {};
if (this.teams)
for (const t in this.teams)
if (this.teams.hasOwnProperty(t)) {
const i = this.teams[t];
i.isDisbanded() || (e[t] = i)
}
return e
}
getTeamMembers(e) {
const t = [];
for (const i in this.players)
this.players.hasOwnProperty(i) && this.players[i].getTeamID() == e && t.push(this.players[i]);
return t
}
getHumanTeamMembers(e) {
const t = [];
for (const i in this.players)
this.players.hasOwnProperty(i) && (this.players[i].getTeamID() != e || this.players[i].isComputerPlayer() || t.push(this.players[i]));
return t
}
getMaxPlayersPerTeam(e, t) {
return Math.floor((e + t - 1) / t)
}
getTeam(e) {
const t = this.teams[e];
return t instanceof l.f ? t : null
}
arePlayersATeam(e, t) {
return e == t || this.getPlayer(e).getTeamID() > 0 && this.getPlayer(e).getTeamID() === this.getPlayer(t).getTeamID()
}
hasTeamFreeSlot(e, t) {
if (t.getTeamSettings() != r.c.NONE && this.getHumanTeamMembers(e).length >= t.getMaxPlayersPerTeam())
return !1;
if (t.getTeamSettings() == r.c.SCENARIO) {
const t = this.getTeamMembers(e);
for (let e = 0; e < t.length; e++)
if (t[e].isComputerPlayer() || t[e].isReopenedPlayer())
return !0;
return !1
}
return !0
}
getNumberOfHumanPlayers() {
let e = 0;
for (const t in this.players)
if (this.players.hasOwnProperty(t)) {
const i = this.players[t];
i.isComputerPlayer() || 0 == i.getPlayerID() || ++e
}
return e
}
getNumberOfPlayers() {
let e = 0;
for (const t in this.players)
this.players.hasOwnProperty(t) && ++e;
return e
}
getFilteredPlayers(e, t, i) {
const s = [];
for (const r in this.players)
if (this.players.hasOwnProperty(r)) {
const n = this.players[r];
n.playerID !== i && n.playerID > -1 && (n.isAIPlayer() && e && !n.isDefeated() || !n.isAIPlayer() && t) && s.push(n)
}
return s
}
getPlayerByName(e) {
for (const t in this.players)
if (this.players.hasOwnProperty(t) && this.players[t].getName() === e)
return this.players[t];
return null
}
getPickableSlots() {
return this.pickableSlots
}
isPickablePlayerID(e) {
return this.pickableSlots.includes(e)
}
hasPickableSlot() {
return this.pickableSlots.length > 0
}
publishUpdate() {
s.N.publish(u.q.UI_PLAYER_STATE_UPDATED)
}
searchPlayer(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
const i = this.getPlayers();
let s = null;
for (const r in i)
if (i.hasOwnProperty(r)) {
const n = i[r].getName().normalize("NFD").replace(t, "").toLowerCase();
(n.indexOf(e) >= 0 && !s || n.includes(e)) && (s = i[r])
}
return s
}
searchPlayerByNationName(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
const i = hup.gameState.getPlayerState().getPlayers();
let s = null;
for (const r in i)
if (i.hasOwnProperty(r)) {
const n = i[r].getNationName().normalize("NFD").replace(t, "").toLowerCase();
(n.indexOf(e) >= 0 && !s || n.includes(e)) && (s = i[r])
}
return s
}
getPlayersArray() {
return Object.values(this.players)
}
}
h.VisibilityMode = {
ALL: 1,
ONLY_VISIBLE: 2,
ALL_REDUCED_INFORMATION: 3
},
o.F.UltPlayerState = h
}
,
93658: (e,t,i)=>{
i(10711);
var s = i(58202);
s.F.UltPlayerStatisticsState = class {
constructor() {
this.playerIDToDaysStatsMap = null
}
getNumKills(e) {
return this.getAccCount("unit[0-9]+kill", e)
}
getNumKillsOfType(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : hup.config.userData.playerID;
return this.getAccCount(`unit${e}kill`, t)
}
getNumDeaths(e) {
return this.getAccCount("unit[0-9]+lost", e)
}
getNumProvincesLost(e) {
return this.getAccCount("provincesLost", e)
}
getNumProvincesCaptured(e) {
return this.getAccCount("provincesCaptured", e)
}
getAccCount(e, t) {
if (!t)
throw new Error(`playerID is a necessity for player statistics >> ${t}`);
let i = 0;
const s = new RegExp(e)
, r = (this.playerIDToDaysStatsMap ?? {})[t];
return r && Object.values(r).forEach((e=>{
Object.keys(e).forEach((t=>{
s.test(t) && (i += Number(e[t]))
}
))
}
)),
i
}
getNumConstructed() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : hup.config.userData.playerID;
return this.getAccCount("upgrade[0-9]+built", e)
}
getNumConstructedUpgrade(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : hup.config.userData.playerID;
return this.getAccCount(`upgrade${e}built`, t)
}
getNumProducedUnit(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : hup.config.userData.playerID;
return this.getAccCount(`unit${e}built`, t)
}
getUnitStatsMap() {
return Object.values(hup.getMod().getUnitTypes()).map((e=>{
const t = e.getStatsColumnID();
return {
unitType: e,
killed: this.getNumKillsOfType(t),
produced: this.getNumProducedUnit(t)
}
}
))
}
}
}
,
76110: (e,t,i)=>{
i(87477);
var s = i(81177)
, r = i(58202);
r.F.UltPremiumState = class {
constructor() {
this.stateType = s.V.STATE_TYPE_PREMIUM_STATE,
this.offers = null
}
getOffers() {
return this.offers
}
getOfferByID(e) {
return this.offers[e]
}
getOfferForPremium(e) {
if (null != this.offers)
for (const t in this.offers)
if (this.offers[t].containsPremium(e))
return this.offers[t];
return null
}
getAllOffersForPremium(e) {
const t = [];
if (null != this.offers)
for (const i in this.offers)
this.offers[i].containsPremium(e) && t.push(this.offers[i]);
return t
}
getOffersForIDs(e) {
return Object.fromEntries(e.map((e=>[e, this.offers[e]])))
}
}
}
,
16281: (e,t,i)=>{
i.d(t, {
r: ()=>o
});
i(87477);
var s = i(71313)
, r = i(58202)
, n = i(50155)
, a = i(13775);
class o extends n.r {
getOfferBObjectsWithType() {
const e = [];
return e.push({
isPremium: !0,
value: a.Z.formatNumber(this.offerPrice * this.priceFactor)
}),
e
}
createPremiumOption() {
const e = new s.a;
return e.priceFactor = this.priceFactor,
e
}
}
r.F.UltPremiumTradeOffer = o
}
,
93045: (e,t,i)=>{
i.d(t, {
u: ()=>r
});
var s = i(13950);
class r {
constructor(e) {
this.entries = e && e[1] ? e[1] : []
}
get(e) {
return this.entries.length > e ? this.entries[e] : null
}
remove(e) {
return this.entries.length > e ? this.entries[e] = null : null
}
findSlotForUpgrade(e) {
if (this.entries.length)
for (let t = 0; t < this.entries.length; t++)
if (this.entries[t] && this.entries[t].getUpgrade().getItemID() == e)
return t;
return null
}
getEntries() {
return this.entries
}
clone() {
return new r([null, [...this.entries]])
}
}
s.x.register("ultshared.UltProductionList", (e=>new r(e)))
}
,
83087: (e,t,i)=>{
i.d(t, {
F: ()=>D
});
i(87477);
var s = i(64842)
, r = i(61809)
, n = i(51130)
, a = i(19288)
, o = i(39513)
, l = i(85665)
, u = i(82840)
, h = i(21778)
, g = i(93045)
, c = i(58202)
, d = i(3577)
, p = i(4563)
, m = i(70057)
, I = i(37887)
, T = i(61191)
, A = i(98111)
, y = i(15357)
, S = i(23794)
, f = i(71544)
, P = i(13775);
class D extends ((0,
m.G)(u.zb)) {
constructor() {
super(),
this.ownerID = -1,
this.legalOwnerID = -1,
this.morale = 70,
this.improvements = [],
this.unknownUpgradesCount = 0,
this.constructions = null,
this.productions = null,
this.constructionSlots = 1,
this.productionSlots = 1,
this.endArmyProductionTime = 0,
this.deploymentTarget = null,
this.lastBattle = 0,
this.stationaryArmyID = -1,
this.productionType = 0,
this.baseProduction = 3e3,
this.allResourceProductions = {},
this.population = 1e5,
this.deploymentArmy = null,
this.provinceStateID = 0,
this.provinceLevel = 0,
this.besieged = !1,
this.siegePossible = !1,
this.coreIDs = [],
this.impacts = null,
this._upgradePositions = {},
this.production = null,
this.maxProductionMap = null
}
isUltProvince() {}
applyData(e) {
super.applyData(e),
this.productionType = void 0 === e.r ? 0 : e.r,
this.setOwnerID(void 0 === e.o ? -1 : e.o),
this.legalOwnerID = e.lo || e.o,
this.setUpgrades(e.us),
this.morale = void 0 === e.m ? 70 : e.m,
this.population = void 0 === e.p ? 1e5 : e.p,
this.deploymentTarget = s.E.toPoint(e.dt),
this.endArmyProductionTime = void 0 === e.apt ? 0 : e.apt,
this.stationaryArmyID = void 0 === e.sa ? -1 : e.sa,
e.cos && (this.constructions = e.cos || null),
e.prs && (this.productions = e.prs || null),
e.cs && (this.constructionSlots = e.cs),
e.ps && (this.productionSlots = e.ps),
this.lastBattle = void 0 === e.lb ? 0 : e.lb,
this.besieged = void 0 !== e.ib && e.ib,
this.siegePossible = void 0 !== e.sp && e.sp,
this.production = void 0 === e.rp ? 0 : e.rp,
this.taxProduction = void 0 === e.tp ? 0 : e.tp,
this.baseProduction = void 0 === e.bp ? 3e3 : e.bp,
this.allResourceProductions = e.arp || {},
this.coreIDs = e.ci || [],
this.victoryPoints = void 0 === e.vp ? 0 : e.vp,
e.rg && (this.regionIDs = e.rg),
e.ims && (this.impacts = e.ims),
e.uuc && (this.unknownUpgradesCount = e.uuc),
this.provinceStateID = e.pst || 0,
this.provinceLevel = e.plv || 0,
this.isPoi = e.poi || !1,
this.maxProductionMap = e.mpm || this.maxProductionMap
}
update(e) {
this.setUpgrades(e.getUpgrades()),
this.setMorale(e.getMorale()),
this.setOwnerID(e.getOwnerID()),
this.setLegalOwnerID(e.getLegalOwnerID()),
this.coreIDs = e.getCoreIDs(),
this.setPopulation(e.getPopulation()),
this.setDeploymentTarget(e.getDeploymentTarget()),
this.setEndArmyProductionTime(e.getEndArmyProductionTime()),
this.stationaryArmyID = e.stationaryArmyID,
this.constructions = e.getConstructions(!0),
this.productions = e.getProductions(!0),
this.constructionSlots = e.constructionSlots,
this.productionSlots = e.productionSlots,
this.production = e.production,
this.taxProduction = e.taxProduction,
this.allResourceProductions = e.allResourceProductions,
this.specUnit = e.specUnit,
this.lastBattle = e.lastBattle,
this.besieged = e.besieged,
this.provinceStateID = e.provinceStateID,
this.provinceLevel = e.provinceLevel,
this.unknownUpgradesCount = e.unknownUpgradesCount,
this.maxProductionMap = e.maxProductionMap,
e.impacts && (this.impacts = e.impacts),
this.getConstructions() && this.setBuilding(this.getConstructions().getEntries()),
e.name && (this.name = e.name)
}
reducedClone() {
const e = new D;
return e.update(this),
e
}
getConstructionSlots() {
return this.constructionSlots
}
getProductionSlots() {
return this.productionSlots
}
getOwnerID() {
return this.ownerID
}
setOwnerID(e) {
this.ownerID = e
}
getOwnerProfile() {
return o.IZ.gameState.getPlayerProfile(this.getOwnerID())
}
getLegalOwnerID() {
return this.legalOwnerID
}
setLegalOwnerID(e) {
this.legalOwnerID = e
}
getMaxMorale() {
const e = this.getProvinceState();
return null !== e ? e.getMaxMorale() : 100
}
canIncreaseMorale() {
return !!this.isOwnOrAllyProvince() && this.getMorale() < this.getMaxMorale()
}
getMorale() {
return this.morale
}
setMorale(e) {
this.morale = Math.max(0, Math.min(100, e))
}
isBesieged() {
return this.besieged
}
isBuildingUpgrade(e) {
if (this.isBuildingInAnySlot()) {
return this.getConstructions().getEntries().some((t=>t && t.getUpgrade().getItemID() == e))
}
return !1
}
isBuildingSpecificUpgrade(e) {
let t = !1;
const i = this.getConstruction();
if (i) {
const {upgrade: s} = i;
t = s.getInternalUniqueID() === e
}
return t
}
_getUpgrade(e, t) {
let i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : -1;
if (e)
for (let s = 0, r = e.length; s < r; s++)
if (e[s].getUpgradeID() == t) {
if (-1 !== i) {
if (e[s].getTier() == i)
return e[s];
break
}
return e[s]
}
return null
}
getUpgradeByInternalID(e) {
return this._getUpgradeByInternalID(this.getUpgrades(), e)
}
getUpgrade(e, t) {
return this._getUpgrade(this.getUpgrades(), e, t)
}
getLatestBuiltUpgradeInSameTree(e) {
var t;
let i = arguments.length > 1 && void 0 !== arguments[1] && arguments[1];
const s = e=>{
var t, s;
const r = i ? null === (t = this.getConstruction()) || void 0 === t ? void 0 : t.upgrade : null;
return (null == r || null === (s = r.getItemID) || void 0 === s ? void 0 : s.call(r)) === e ? r.getUpgradeType() : this.getUpgrade(e)
}
;
return null === (t = o.IZ.getMod().getUpgrade(e)) || void 0 === t ? void 0 : t.getUpgradeGroupSorted().map((e=>s(e.getItemID()))).find(Boolean)
}
getImprovementsBuilt() {
const e = [];
let t;
const i = this.improvements.map((e=>e.itemID));
for (let s = 0; s < this.improvements.length; s++) {
t = this.improvements[s].getReplacedUpgradeTree(),
e.push(this.improvements[s]);
for (let s = 0; s < t.length; s++) {
if (i.includes(t[s]))
continue;
const r = new d.z;
r.initDummy(t[s], !0),
e.push(r)
}
}
return e
}
getUpgradeAt(e, t) {
const i = this.getUpgrades();
for (let r = 0; r < i.length; r++) {
const n = i[r];
if (n.getUpgradeID() == e)
if (null == t) {
if (null == n.getRelativePosition())
return this.initTransientUpgradeFields(n)
} else {
const e = new s.E(n.getRelativePosition().x,n.getRelativePosition().y);
if (null == n.getRelativePosition() || e.getDistance(t) < 3)
return this.initTransientUpgradeFields(n)
}
}
return null
}
initTransientUpgradeFields(e) {
return null !== e && e.setBuilding(this.isBuildingUpgrade(e.getUpgradeID())),
e
}
getUpgradeLevel(e) {
const t = this.getUpgrade(e);
return t ? t.getLevel() : 0
}
getUpgradeCondition(e) {
const t = this.getUpgrade(e);
let i = t ? t.getCondition() : 0;
if (null == t) {
this.hasUpgradeInChain(e) && (i = o.IZ.getMod().getUpgrade(e).getBuildCondition())
}
return i
}
hasAnyUpgrade() {
return this.hasUpgrades() || this.hasUnknownUpgradesCount()
}
hasUpgrades() {
return this.improvements.length > 0
}
getUpgrades() {
return this.improvements
}
getVisibleUpgrades() {
return this.getUpgrades().filter((e=>!e.hasInvisibleFeature()))
}
setUpgrades(e) {
this.improvements = e || []
}
addUpgrade(e) {
let t = 0;
const i = this.getUpgrades();
for (const s in i)
if (i.hasOwnProperty(s) && (t++,
i[s].getUpgradeID() == e.getUpgradeID()))
return void (i[s] = e);
i[t] = e
}
hasRequiredUpgrades(e, t, i) {
if (i = !!i,
!e)
return !0;
const s = [];
for (const n in e)
if (e.hasOwnProperty(n)) {
const t = e[n];
s.push(this.hasUpgradeInChain(n, t, i))
}
if (0 === s.length)
return !0;
let[r] = s;
for (let n = 1; n < s.length; n++) {
const e = s[n];
r = t ? r || e : r && e
}
return r
}
hasUpgradeInChain(e, t, i) {
i = !!i,
t = t || 0;
const s = this.getUpgrade(e);
if (s)
return s.getCondition() >= s.getUpgradeType().getConditionForLevel(t) && !s.isDamaged() && (!i || s.isEnabled());
const r = this.getReplacement(e);
return !!(r && r.getTier() >= t) && (!i || r.isEnabled())
}
isEnabled(e) {
const t = this.getUpgrade(e) || this.getReplacement(e, o.IZ.getMod().getUpgrades());
return t && t.isEnabled()
}
getReplacement(e, t) {
t = t || o.IZ.getMod().getUpgrades();
for (const i in this.improvements)
if (this.improvements.hasOwnProperty(i)) {
const s = this.improvements[i];
let r = s.getReplacedUpgrade();
for (; r; ) {
if (r == e)
return s;
const i = t[r];
r = null != i ? i.getReplacedUpgrade() : 0
}
}
return null
}
hasBeenReplaced(e, t) {
return t = t || o.IZ.getMod().getUpgrades(),
!!this.getReplacement(e, t)
}
getUpgradeWithFeature(e) {
const t = this.getUpgrades();
for (const i in t)
if (t.hasOwnProperty(i) && t[i].getUpgradeType().hasFeature(e))
return t[i];
return null
}
hasUnknownUpgradesCount() {
return this.unknownUpgradesCount > 0
}
getUnknownUpgradesCount() {
return this.unknownUpgradesCount
}
getFeatureValueAt(e, t) {
let i = 0;
const r = this.getUpgrades();
for (const n in r)
if (r.hasOwnProperty(n)) {
const a = r[n]
, o = a.getFeatureValue(e);
if (o > 0) {
const e = 3;
let r = !1;
null === t ? r = !0 : a.getRelativePosition() ? s.E.distance(a.getRelativePosition(), t) < e && (r = !0) : s.E.ORIGIN.getDistance(t) < e && (r = !0),
r && (i += o)
}
}
return i
}
getClosestNeighbour() {
const e = o.IZ.gameState.getMapState().getProvincesForPlayer(o.IZ.config.userData.playerID)
, t = this.getCapital()
, i = Number.MAX_VALUE;
let s = this;
for (const r of e) {
if (r === this)
continue;
const e = r.getCapital();
(t.x - e.x) ** 2 + (t.y - e.y) ** 2 < i && (s = r)
}
return s
}
canStartBuilding(e) {
const t = o.IZ.gameState.getPlayerProfile().hasAdditionalConstructionSlot();
return !!this.hasFreeBuildSlot(t) && (!!this.canBuildUpgrade(e.getUpgradeID()) && this.hasRequiredUpgrades(e.getRequiredUpgrades(), e.getUpgradeType().isSingleRequiredUpgradeNeeded()))
}
isBuilding(e) {
return null !== this.getConstruction(e)
}
hasFreeBuildSlot(e) {
let t = e ? this.getConstructionSlots() : 1;
for (; t--; )
if (!this.isBuilding(t))
return !0;
return !1
}
getConstructionCount() {
let e = 0
, t = this.getConstructionSlots();
for (; t--; )
this.isBuilding(t) && e++;
return e
}
isNotProducing() {
let e = this.getProductionSlots();
for (; e--; )
if (this.isProducing(e))
return !1;
return !0
}
isBuildingInAnySlot() {
let e = this.getConstructionSlots();
for (; e--; )
if (this.isBuilding(e))
return !0;
return !1
}
getBuilding() {
return this.getConstruction() ? this.initTransientUpgradeFields(this.getConstruction().getUpgrade()) : null
}
getConstruction(e) {
return e || (e = 0),
this.constructions ? this.constructions.get(e) : null
}
removeBuilding(e) {
e || (e = 0),
this.constructions && this.constructions.remove(e)
}
setBuilding(e) {
const t = this.getUpgrades();
for (let i = 0; i < t.length; i++) {
let s = !1;
for (let r = 0; r < e.length; r++)
if (e[r]) {
const n = e[r].getUpgrade();
s |= n && t[i].getUpgradeID() === n.getUpgradeID()
}
t[i].setBuilding(s)
}
}
getConstructionEntries() {
return this.constructions ? this.constructions.getEntries() : []
}
getConstructions(e) {
var t;
return e ? (null === (t = this.constructions) || void 0 === t ? void 0 : t.clone()) || new g.u : this.constructions
}
setConstructions(e) {
this.constructions = e
}
getAdditionalConstructions() {
return this.constructions ? this.constructions.getEntries().slice(1).filter((e=>!!e)) : null
}
getProductionEntries() {
return this.productions ? this.productions.getEntries() : []
}
getProductions(e) {
var t;
return e ? (null === (t = this.productions) || void 0 === t ? void 0 : t.clone()) ?? new g.u : this.productions
}
setProductions(e) {
this.productions = e
}
getAdditionalProductions() {
return this.productions ? this.productions.getEntries().slice(1).filter((e=>!!e)) : null
}
getProductionCount() {
let e = 0
, t = this.getProductionSlots();
for (; t--; )
this.isProducing(t) && e++;
return e
}
getProducing(e) {
return e || (e = 0),
this.productions ? this.productions.get(e) : null
}
removeProducing(e) {
null == e && (e = 0),
this.productions && this.productions.remove(e)
}
getAutoRecruitableUnitType() {
return o.IZ.getMod().getAutoRecruitableUnitType()
}
getArmyProductionTime() {
const e = this.getFeatureValue(p.M.RECRUIT)
, t = o.IZ.gameState.getGameInfoState().getScenario().getOption(c.F.ScenarioOptions.AUTO_RECRUITMENT_SPEED) || 0;
if (t > 0) {
const i = o.IZ.getMod()
, s = i.hasGameFeature(l.f.GF_MORALE_BASED_AUTO_RECRUITMENT_TIME) ? i.getMoraleBasedAutoRecruitmentTimeConfig().getValueAt(this.getMorale()) : 1
, r = 1 / (1 + e);
return Math.ceil(t * r * 1e3 / s)
}
if (e > 0) {
const t = o.IZ.consts.DAY_MILLIS
, i = this.getBaseProduction() * (this.getMorale() + 5) / 100 * this.getPopulation() / 1e5;
let s = t * f.v.ARMYCOST_BASEPRODUCTION / i;
s *= f.v.PRODFACTOR_PRIVILEDGEARMY,
s /= e;
const r = o.IZ.gameState.getPlayerProfile();
return null != r && r.getNoobBonus() > 0 && (s -= s * (f.v.NOOB_BONUS_RECRUITING * r.getNoobBonus() / o.IZ.consts.NOOB_BONUS_DAYS)),
s
}
return Math.MAX_VALUE / 2
}
getNextRecruitmentTimeScaled() {
let e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0]
, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 2;
if (this.canAutoRecruit()) {
const i = o.IZ.gameState.getGameInfoState().getTimeScale() ?? 1
, s = (this.getEndArmyProductionTime() - r.$B()) * i;
return e ? P.Z.formatTimer(s / 1e3, !1, t) : s
}
return null
}
getNextRecruitmentTimeScaledInSeconds() {
return (this.getNextRecruitmentTimeScaled(!1) ?? 0) / 1e3
}
canAutoRecruit() {
if (!!o.IZ.gameState.getGameInfoState().getScenario().getOption(c.F.ScenarioOptions.AUTO_RECRUITMENT_SPEED))
return !0;
const e = this.getUpgrades();
for (let t = 0; t < e.length; t++) {
if (0 !== e[t].getFeatureValue(p.M.RECRUIT))
return !0
}
return !1
}
getRecruitmentProgress() {
const e = o.IZ.gameState.getGameInfoState().getTimeScale() ?? 1
, t = this.getNextRecruitmentTimeScaled(!1) / e;
if (!Number.isFinite(Number.parseFloat(t)))
return 0;
const i = this.getArmyProductionTime();
return (i - t) / i * 100
}
isBorderProvince() {
return this.getBorderSegments().some((e=>0 != (e.borderType & f.u.INTER)))
}
isImmutable() {
return o.IZ.getMod().hasImmutableProvinceFeature() && !o.IZ.gameState.getPlayerState().getPlayer(this.ownerID).isNativeComputer() && Array.isArray(this.coreIDs) && this.coreIDs.indexOf(this.getOwnerID()) >= 0
}
getEndArmyProductionTime() {
return this.endArmyProductionTime
}
setEndArmyProductionTime(e) {
this.endArmyProductionTime = e
}
getMoraleFactorOnUnitProduction() {
const e = o.IZ.getMod();
return e.hasGameFeature(l.f.GF_MORALE_BASED_PRODUCTION_TIME) ? e.getMoraleBasedProductionTimeConfig().getValueAt(this.getMorale()) : 1
}
getMoraleProductionTimePenaltyPercentage() {
return 100 * (1 / this.getMoraleFactorOnUnitProduction() - 1)
}
getUnitProductionTime(e) {
const t = this.getUnitProductionFactor(e);
if (t <= 0)
return Number.MAX_VALUE;
return Math.floor(e.getBuildTime() / t) / this.getMoraleFactorOnUnitProduction()
}
getMoraleFactorOnBuildingConstruction() {
const e = o.IZ.getMod();
return e.hasGameFeature(l.f.GF_MORALE_BASED_CONSTRUCTION_TIME) ? e.getMoraleBasedConstructionTimeConfig().getValueAt(this.getMorale()) : 1
}
getMoraleBuildTimePenaltyPercentage() {
return 100 * (1 / this.getMoraleFactorOnBuildingConstruction() - 1)
}
getActualBuildTimeForUpgrade(e) {
return o.IZ.getMod().hasGameFeature(l.f.GF_MORALE_BASED_CONSTRUCTION_TIME) ? e.getBuildOrRepairTime() / this.getMoraleFactorOnBuildingConstruction() : e.getBuildOrRepairTime()
}
getMoraleBuildTimePenaltyForUpgrade(e) {
return this.getActualBuildTimeForUpgrade(e) - e.getBuildOrRepairTime()
}
getMoraleBuildTimePenaltyForUnit(e) {
let t;
return t = this.getUnitProductionFactor(e) > 0 ? this.getBuildTimeForUnitWithoutMoraleInfluence(e) : e.getBuildTime(),
t * (1 / this.getMoraleFactorOnUnitProduction(e) - 1)
}
getBuildTimeForUnitWithoutMoraleInfluence(e) {
return this.getUnitProductionTime(e) * this.getMoraleFactorOnUnitProduction()
}
isUpgradePossible(e, t) {
const i = this.getPossibleUpgrades();
for (let s = 0; s < i.length; s++)
if (i[s].getItemID() == parseInt(e)) {
const r = o.IZ.getMod().getUpgrades()[e].getBuildCondition();
let n = 0;
for (let e = 0; e < this.improvements.length; e++)
this.improvements[e].getUpgradeID() == i[s].getItemID() && (n = Math.ceil(this.improvements[e].getCondition() / r));
if (Math.ceil(t / r) - n == 1)
return !0
}
return !1
}
getUnitProductionFactor(e) {
let t = 1;
this.getFeatureValue(p.M.FACTORY_TECH) < e.getMinimumTechLevel() && (t = 0),
e.needsRail() && this.getFeatureValue(p.M.RAILROAD) <= 0 && (t = 0),
e.isShip() && this.getFeatureValue(p.M.HARBOUR) <= 0 && (t = 0);
let i = 0;
if (0 !== t)
if (e.useRequiredBuildingAsFactory()) {
const t = e.getRequiredUpgrades()
, s = o.IZ.getMod().getUpgrades();
Object.keys(t).forEach((e=>{
const t = this.getUpgrade(e) ?? this.getReplacement(e, s);
t && (i += t.getFeatureValue(p.M.FACTORY))
}
))
} else
i = this.getFeatureValue(p.M.FACTORY);
return t * i
}
getBaseRevoltChance() {
const e = o.IZ.getMod().getRevoltMoraleThreshold();
return 1 - Math.min(1, this.getMorale() / e)
}
getRevoltChance() {
return this.getProperties() ? 100 * this.getProperties().getRevoltChance() : null
}
getProvinceOrder() {
return o.IZ.getMod().getBaseTargetMorale() - this.morale
}
isRevolting() {
return !this.isImmutable() && this.getMorale() <= o.IZ.getMod().getRevoltMoraleThreshold()
}
getDeploymentTarget() {
return this.deploymentTarget
}
getDeploymentTargetAsLocation() {
return this.deploymentTarget ? o.IZ.gameState.getMapState().getClosestLocationAt(this.deploymentTarget) : null
}
resetDeploymentArmy() {
this.deploymentArmy = null
}
getDeploymentArmy() {
if (!this.deploymentArmy && this.getDeploymentTarget()) {
const e = this.getDeploymentTarget()
, t = this.getCapital()
, i = new I.ne;
i.unitUID = 5e6 + this.getLocationID(),
i.ownerID = o.IZ.config.userData.playerID,
i.position = t,
i.locationID = this.getLocationID();
const s = o.IZ.getMod().getUnitType(o.IZ.getMod().getDefaultInfantryUnitTypeStatsId())
, r = new y.n;
r.setUnitTypeID(s.getItemID()),
i.setUnits([r]);
const n = new T.C;
n.init(t, e, i, Date.now());
const a = n.getCmds();
if (!a.length) {
const e = new A.U;
e.setStartPos(this.getCapital()),
e.setTargetPos(this.getDeploymentTarget()),
a.push(e)
}
i.setCommands(a),
this.deploymentArmy = i
}
return this.deploymentArmy
}
setDeploymentTarget(e) {
this.deploymentTarget = e,
e && this.resetDeploymentArmy()
}
getStationaryArmyID() {
return this.stationaryArmyID
}
getStationaryArmy() {
return o.IZ.gameState.getArmyState().getArmy(parseInt(this.getStationaryArmyID(), 10))
}
getLastBattle() {
return this.lastBattle
}
getProductionType() {
return this.productionType - 1
}
getVictoryPoints() {
return this.victoryPoints || 0
}
getTotalVictoryPoints() {
return this.getVictoryPoints() + this.getBuildingVictoryPoints()
}
getBuildingVictoryPoints() {
return this.getFeatureValue(p.M.VICTORY_POINTS)
}
getSiegeDelay() {
return this.getFeatureValue(p.M.SIEGE_DELAY)
}
getMinimumSiege() {
return this.getFeatureValue(p.M.MINIMUM_SIEGE)
}
getDefenseLevel() {
return this.getFeatureValue(p.M.FORTRESS)
}
getProvinceLevel() {
const e = o.IZ.getMod().getProvinceLevelUpgradesArray()
, t = this.getUpgrades();
for (let i = 0; i < t.length; i++) {
const s = t[i];
for (let t = 0; t < e.length; t++) {
const i = e[t];
if (s.getItemID() == i.getItemID())
return i.getTier()
}
}
return this.provinceLevel
}
getCoreIDs() {
return this.coreIDs
}
isAnyonesCoreProvince() {
return Array.isArray(this.coreIDs) && this.coreIDs.length > 0 && 0 !== this.coreIDs[0] && !o.IZ.gameState.getPlayerProfile(this.coreIDs[0]).isPassiveAI()
}
getCoreOwnerCountryName() {
if (this.isAnyonesCoreProvince()) {
const [e] = this.getCoreIDs();
return o.IZ.gameState.getPlayerState().getPlayer(e).getNationName()
}
return null
}
isOwnersCoreProvince() {
return !o.IZ.getMod().hasCoreProvinces() || Array.isArray(this.coreIDs) && this.coreIDs.indexOf(this.getOwnerID()) >= 0
}
getCoreProductionFactor() {
return o.IZ.getMod().hasCoreProvinces() && !this.isOwnersCoreProvince() ? o.IZ.getMod().getNonCoreProductionFactor() / 100 : 1
}
isDoubleProduction() {
var e;
return this.baseProduction * this.getPopulationFactorOnProduction() >= ((null === (e = o.IZ.gameState.getScenarioState()) || void 0 === e ? void 0 : e.getDoubleResourceProductionThreshold()) ?? o.IZ.gameState.getGameInfoState().getDoubleResourceProductionThreshold())
}
getRawProduction() {
let e = this.baseProduction;
return e *= this.getMoraleFactorOnProduction(),
e *= this.getPopulationFactorOnProduction(),
e
}
getMoraleFactorOnProduction() {
return this.morale / 100 * .8 + .25
}
getPopulationFactorOnProduction() {
return this.population / 1e5
}
getProductionFactor(e) {
return e == o.IZ.consts.MONEY ? o.IZ.consts.TAX_PRODUCTION_FACTOR : 1
}
getCorruptionFactor() {
const e = o.IZ.gameState;
let t = 0;
if (null != e && e.getMod().hasGameFeature(l.f.GF_CORRUPTION)) {
const i = e.getResourceState().getResourceProfile(this.ownerID);
null != i && (t = i.getCorruptionValue())
}
return t
}
getNoobBonusFactorOnProduction() {
const e = o.IZ.gameState;
let t = 0;
const i = null != e ? e.getPlayerState().getPlayer(this.ownerID) : null;
return null != i && i.getNoobBonus() > 0 && (t = o.IZ.consts.NOOB_BONUS_RESOURCES * i.getNoobBonus() / o.IZ.consts.NOOB_BONUS_DAYS),
t
}
getProduction(e) {
return e in this.allResourceProductions ? this.allResourceProductions[e] : "number" == typeof this.production && e === this.getProductionType() ? this.production : e === o.IZ.getMod().getManpowerResourceID() ? this.getManpowerProduction() : 0
}
getMainProduction() {
return this.getProduction(this.getProductionType())
}
getManpowerProduction() {
const e = o.IZ.getMod()
, t = e.getManpowerResourceID();
if (!(e.hasManpower() && t > 0))
return 0;
let i = e.getOption(l.f.OPTION_MANPOWER_MAX_PROMILLE) * this.getDisplayedPopulation() / 1e3;
this.improvements.forEach((e=>{
e.getUpgradeType().isStackable() && (i *= e.getProductionBonus(t))
}
)),
this.improvements.forEach((e=>{
e.getUpgradeType().isStackable() && (i += e.getDailyProductions()[t])
}
));
let s = 1;
const r = this.getProvinceState();
null !== r && (s = r.getProductionFactor(),
i *= s);
const n = e.getResourceEntry(t);
let a, u;
n && (i *= n.getProductionFactor()),
e.hasCoreProvinces() && !this.isOwnersCoreProvince() && (i *= e.getNonCoreProductionFactor() / 100);
let h = 0;
this.improvements.forEach((e=>{
e.getUpgradeType().isStackable() || (h += i * e.getProductionBonus(t),
a = e.getDailyCosts()[t],
a < 0 && (h = -1 * a * s),
u = e.getDailyProductions()[t],
u > 0 && (h += u * s))
}
));
const g = this.getNoobBonusFactorOnProduction();
return 0 != g && (h += i * g),
i += h,
i *= 1 - this.getCorruptionFactor(),
Math.floor(i)
}
getProductionBonusOnTax() {
return Math.floor(this.getProduction(o.IZ.consts.MONEY) * o.IZ.consts.TAX_PRODUCTION_FACTOR)
}
getPopulationBonusOnTax() {
return Math.floor(this.getPopulation() * o.IZ.getMod().getTaxPopulationFactor())
}
getTaxProduction() {
return o.IZ.consts.MONEY in this.allResourceProductions ? this.allResourceProductions[o.IZ.consts.MONEY] : "number" == typeof this.taxProduction ? this.taxProduction : this.getPopulationBonusOnTax() + this.getProductionBonusOnTax()
}
getTaxProductionResourceId() {
return o.IZ.consts.MONEY
}
getBaseProduction() {
return this.baseProduction
}
setBaseProduction(e) {
this.baseProduction = e
}
getPopulation() {
return this.population
}
setPopulation(e) {
this.population = e
}
getDisplayedPopulation() {
let e = this.getPopulation();
const t = o.IZ.gameState.getMapState();
return t && (e *= t.getPopulationFactor()),
e
}
hasBattle() {
return this.lastBattle > 0
}
isProducing(e) {
return this.getProducing(e) && null != this.getProducing(e).getUpgrade()
}
isProducingUnitByStatsColumnID(e) {
var t, i;
return (null === (t = this.getProducing()) || void 0 === t || null === (i = t.getUnitType()) || void 0 === i ? void 0 : i.getStatsColumnID()) === e
}
isCoastal() {
return this.coastal
}
getConsumption(e) {
let t = 0;
const i = o.IZ.gameState.getMod();
if (i) {
t += Math.floor(this.population * i.getResourceConsumption(e));
const s = this.getProvinceState();
null !== s && (t *= s.getConsumptionFactor())
}
const s = this.getUpgrades();
let r;
for (let n = 0; n < s.length; n++)
r = s[n].getDailyCosts()[e],
r > 0 && (t += r);
return t
}
getAdministrationSortValue() {
const e = o.IZ.getMod().getNumberOfProvinceStates()
, t = o.IZ.getMod().getNumberOfProvinceLevelUpgrades();
return (e - this.getProvinceStateID()) * (t + 1) + this.getProvinceLevel()
}
getPositiveConsumption(e) {
let t = 0;
const i = this.getUpgrades();
let s, r;
for (let n = 0; n < i.length; n++)
s = i[n].getDailyCosts()[e],
s < 0 && (t -= s),
i[n].getUpgradeType().isStackable() || (r = i[n].getDailyProductions()[e],
r > 0 && (t += r));
return t
}
hasUpgrade(e) {
const t = this.getUpgrades();
for (let i = t.length - 1; i >= 0; i--) {
if (t[i].getUpgradeID() === e)
return !0
}
return !1
}
hasUpgradeFeature(e) {
const t = this.getUpgrades();
if (t)
for (let i = t.length - 1; i >= 0; i--) {
if (t[i].getFeatureValue(e) > 0)
return !0
}
return !1
}
getFeatureValue(e) {
return this.getFeatureValueAt(e, null)
}
hasRailroad() {
const e = p.M.RAILROAD;
return this.hasUpgradeFeature(e)
}
hasAirfield() {
const e = p.M.AIRFIELD;
return this.hasUpgradeFeature(e)
}
hasConstructionSlotFeature() {
if (!o.IZ.getMod().getConstructionSlotItemID())
return !1;
const e = p.M.CONSTRUCTION_SLOTS;
return this.hasUpgradeFeature(e)
}
hasProductionSlotFeature() {
if (!o.IZ.getMod().getProductionSlotItemID())
return !1;
const e = p.M.PRODUCTION_SLOTS;
return this.hasUpgradeFeature(e)
}
hasActiveQuests() {
return this.getActiveQuests().length > 0
}
getActiveQuests() {
const e = []
, t = o.IZ.gameState.getQuestState() && o.IZ.gameState.getQuestState().getActiveQuests() || []
, i = t.length;
for (let s = 0; s < i; s++)
t[s].getProvince() && t[s].getProvince().getLocationID() === this.locationID && e.push(t[s]);
return e
}
isCapital() {
const e = o.IZ.gameState.getPlayerState();
return !!(e && this.ownerID > 0 && e.getPlayer(this.ownerID).getCapitalID() === this.getLocationID())
}
getRemainingBuildTime(e) {
let t = 0;
if (this.isBuilding(e)) {
const i = r.$B();
t = Math.floor((this.getConstruction(e).getEventTime() - i) / 1e3)
}
return Math.max(0, t)
}
getRemainingBuildTimeScaled(e) {
var t, i;
return null === (t = o.IZ.gameState) || void 0 === t || null === (i = t.getGameInfoState()) || void 0 === i ? void 0 : i.convertScaledToRealTime(this.getRemainingBuildTime(e))
}
getRemainingBuildTimeHR(e) {
const t = this.getRemainingBuildTime(e);
return P.Z.formatTimer(r.gV(t), !1)
}
getRemainingBuildTimeForUpgradeHR(e) {
const t = this.getConstructionSlot(e);
return null !== t ? this.getRemainingBuildTimeHR(t) : ""
}
getConstructionSlot(e) {
return this.constructions ? this.constructions.findSlotForUpgrade(e) : null
}
getProductionTimeHR(e) {
const t = this.getProducing(e)
, i = t ? t.getEventTime() : 0;
return P.Z.getFormattedTime(r.gV(i))
}
getRemainingProduceTimeHR(e) {
return P.Z.formatTimer(r.gV(this.getRemainingProduceTime()), !1, e)
}
getProduceTimePercent(e) {
return 100 - this.getRemainingProduceTimePercent(e)
}
getRemainingProduceTimePercent(e) {
const t = this.getProduceTime(e) / 1e3
, i = Math.min(t, this.getRemainingProduceTime(e));
return Math.round(i / t * 100)
}
getBuildTimePercent(e) {
return 100 - this.getRemainingBuildTimePercent(e)
}
getRemainingBuildTimePercent(e) {
const t = this.getBuildTime(e) / 1e3
, i = Math.min(t, this.getRemainingBuildTime(e));
return Math.round(i / t * 100)
}
getRemainingProduceTime(e) {
let t = 0;
if (this.isProducing(e)) {
const i = r.$B();
t = Math.floor((this.getProducing(e).getEventTime() - i) / 1e3)
}
return Math.max(0, t)
}
getRemainingProduceTimeScaled(e) {
var t, i;
return null === (t = o.IZ.gameState) || void 0 === t || null === (i = t.getGameInfoState()) || void 0 === i ? void 0 : i.convertScaledToRealTime(this.getRemainingProduceTime(e))
}
getBuildTime(e) {
const t = this.getConstruction(e);
return t ? t.getEventTime() - t.getStartTime() : 0
}
getBuildTimeScaled(e) {
var t, i;
return null === (t = o.IZ.gameState) || void 0 === t || null === (i = t.getGameInfoState()) || void 0 === i ? void 0 : i.convertScaledToRealTime(this.getBuildTime(e))
}
getProduceTime(e) {
const t = this.getProducing(e);
return t ? t.getEventTime() - t.getStartTime() : 0
}
getProduceTimeScaled(e) {
var t, i;
return null === (t = o.IZ.gameState) || void 0 === t || null === (i = t.getGameInfoState()) || void 0 === i ? void 0 : i.convertScaledToRealTime(this.getProduceTime(e))
}
isProducingStalled(e) {
return this.isProducing(e) && this.getProducing(e).isStalled()
}
getReasonForStall(e) {
const t = {};
if (!this.isProducingStalled(e))
return t;
const i = this.getProducing(e).getUpgrade().getUnit().getUnitType().getRequiredUpgrades();
for (const s in i) {
if (!i.hasOwnProperty(s))
continue;
const e = o.IZ.getMod().getUpgrades()[s].getUpgradeName()
, r = this.getUpgrade(s) || this.getReplacement(s, o.IZ.getMod().getUpgrades());
if (t.upgradeName = e,
t.destroyed = !this.hasUpgradeInChain(s, i[s]),
t.damaged = !(!t.destroyed && null != r) || r.isDamaged(),
t.deactivated = !this.isEnabled(s),
t.reasonHR = null,
t.destroyed || t.damaged || t.deactivated) {
t.destroyed || t.damaged ? t.reasonHR = o.IZ.i18n.gettext("Stalled due to destroyed building: %s", e) : t.reasonHR = o.IZ.i18n.gettext("Stalled due to deactivated building: %s", e);
break
}
}
return t
}
getPossibleUpgrades() {
const e = this.properties;
return e ? e.getPossibleUpgrades() : []
}
getPossibleUpgrade(e, t) {
return this._getUpgrade(this.getPossibleUpgrades(), e, t)
}
getPossibleUpgradeByInternalID(e) {
return this._getUpgradeByInternalID(this.getPossibleUpgrades(), e)
}
getQueueableUpgradeByInternalID(e) {
return this._getUpgradeByInternalID(this.getQueueableUpgrades(), e)
}
_getUpgradeByInternalID(e, t) {
let i = null;
if (e)
for (let s = 0; s < e.length; s++) {
const r = e[s];
if (r.getInternalUniqueID() === t) {
i = r;
break
}
}
return i
}
canBuildUpgrade(e) {
return !!this.getPossibleUpgrade(e) && !this.isBuildingUpgrade(e)
}
canBuildUpgradesOfType(e) {
return Array.from(new Set([...this.getPossibleUpgrades(), ...this.getQueueableUpgrades() ?? []])).some((t=>t.getUpgradeType().getUpgradeName() === e))
}
canBuildUpgradeCondition(e, t) {
const i = o.IZ.getMod().getUpgrades()[e].getBuildCondition()
, s = Math.floor(this.getUpgradeCondition(e) / i) + 1 == Math.ceil(t / i);
return this.canBuildUpgrade(e) && s
}
getProperties() {
return this.properties
}
setProperties(e) {
this.properties = e
}
getPossibleProductions() {
var e;
return (null === (e = this.getProperties()) || void 0 === e ? void 0 : e.getPossibleProductions()) ?? []
}
getMissingUnitRequirements(e, t) {
t = Number.isFinite(Number.parseFloat(t)) ? t : this.getOwnerID();
const i = e.getUnitCosts()
, s = {};
let r = !1;
const n = o.IZ.gameState.getArmyState();
for (const a in i)
if (i.hasOwnProperty(a)) {
const e = o.IZ.getMod().getUnitType(a);
let l = i[a];
const u = n.getArmiesAt(this.getCapital(), t, o.IZ.config.consts.ARMY_CLOSE_COMBAT_RANGE);
for (let t = 0; t < u.length; t++) {
const i = u[t].getUnits();
for (let t = 0; t < i.length; t++)
if (i[t].getUnitType().getStatsColumnID() === e.getStatsColumnID()) {
l -= i[t].getSize();
break
}
if (l <= 0)
break
}
l > 0 && (s[e.getItemID()] = l,
r = !0)
}
return r ? s : null
}
getPossibleProduction(e) {
const t = this.getPossibleProductions();
for (let i = 0; i < t.length; i++)
if (t[i].getItemID() === e)
return t[i];
return null
}
canProduceUnit(e) {
const t = this.getPossibleProductions();
if (t.length > 0) {
const i = o.IZ.getMod().getUnitType(e);
if (i)
for (let e = 0; e < t.length; e++)
if (t[e].getUnit().getUnitType().getStatsColumnID() === i.getStatsColumnID())
return !0
}
return !1
}
canProduceAnyUnit() {
return this.getPossibleProductions().length > 0
}
canProduceUnits() {
return !(o.IZ.getMod().isProductionDisabledInNonUrbanProvinces() && !this.isUrban())
}
isPlayersProvince() {
return this.getOwnerID() == o.IZ.config.userData.playerID
}
canPlayerUpgradeProvince() {
if (this.isPlayersProvince())
return !0;
const e = this.getProvinceState();
return e && e.canAllPlayersBuild()
}
isAllyProvince() {
return o.IZ.gameState.getForeignAffairsState().canSeeEachOthersArmies(o.IZ.config.userData.playerID, this.getOwnerID())
}
isOwnOrAllyProvince() {
return this.isPlayersProvince() || this.isAllyProvince()
}
getQueueableUpgrades() {
const e = this.getProperties() && this.getProperties().getQueueableUpgrades();
return e && 0 === e.length ? null : e
}
isQueueableUpgrade(e) {
if (this.getQueueableUpgrades())
for (let t = 0; t < this.getQueueableUpgrades().length; t++) {
if (this.getQueueableUpgrades()[t].getUpgradeID() == e)
return !0
}
return !1
}
getQueueableUpgrade(e, t) {
return this._getUpgrade(this.getQueueableUpgrades(), e, t)
}
getQueueableProductions() {
const e = this.getProperties() && this.getProperties().getQueueableProductions();
return e && 0 === e.length ? null : e
}
getQueueableProduction(e) {
const t = this.getQueueableProductions();
if (t)
for (let i = 0; i < t.length; i++)
if (t[i].getItemID() == e)
return t[i];
return null
}
getDailyConsumption() {
const e = o.IZ.gameState.getResourceState().getResourceProfile(this.getOwnerID()).getCategories()
, t = {};
for (const i in e)
if (e.hasOwnProperty(i)) {
const s = e[i]
, r = this.getConsumption(i)
, n = s.getResourceEntries();
for (const e in n)
if (n.hasOwnProperty(e)) {
const i = n[e];
let s = r * i.getPriority();
if (s += this.getConsumption(i.getResourceID()),
s < 1)
continue;
t[e] = s
}
}
return t
}
getPlaceableUpgrades(e) {
return (this.getQueueableUpgrades() || this.getPossibleUpgrades() || []).filter((t=>t.getUpgradeID() === e))
}
getImpacts() {
return this.impacts
}
getProvinceStateID() {
return this.provinceStateID
}
getProvinceState() {
return o.IZ.getMod().getProvinceState(this.getProvinceStateID())
}
getProvinceStateName() {
const e = this.getProvinceState();
return null !== e ? e.getName() : ""
}
getNextProvinceStateUpgradeType(e) {
const t = o.IZ.provinceController.getNextProvinceStateUpgrade(e);
let i = null;
return t && (i = o.IZ.getMod().getUpgrade(t.getItemID())),
i
}
isNextProvStateUpgPossible() {
const e = this.getNextProvinceStateUpgradeType(this);
if (e) {
let t = null;
const i = this.getPossibleUpgrades();
for (let s = 0; s < i.length; s++) {
const r = i[s];
if (r.getItemID() === e.getItemID()) {
t = r;
break
}
}
if (t)
return this.canStartBuilding(t) && !this.getMissingUnitRequirements(t, o.IZ.config.userData.playerID)
}
return !1
}
canBeConquered() {
if (this.isImmutable())
return !1;
const e = this.getProvinceState();
return null === e || e.canBeConquered()
}
isPOI() {
return this.isPoi || !1
}
getAirfieldPosition() {
return this.getCapital()
}
getCapacity() {
return Number.MAX_VALUE
}
getFreeCapacity(e) {
return this.getCapacity()
}
isUsableAirfieldFor(e, t) {
const i = o.IZ.getMod().hasGameFeature(l.f.GF_ALLIED_FORTRESS);
return !!(e.getOwnerID() === this.ownerID || i && o.IZ.gameState.getForeignAffairsState().canUseAirfields(e.getOwnerID(), this.ownerID)) && this.getFeatureValueAt(p.M.AIRFIELD, s.E.ORIGIN) > 0
}
isAccessibleFromGround() {
return !0
}
getJsonString() {
return `p${this.getLocationID()}`
}
isUrban() {
return this.terrainType === S.Ky.URBAN
}
isSuburban() {
return !1
}
isNeutral() {
return !1
}
canProduceOrQueueAnyUpgrades() {
return (this.getQueueableUpgrades() || this.getPossibleUpgrades() || []).length > 0
}
canProduceOrQueueAnyUnits() {
return (this.getQueueableProductions() || this.getPossibleProductions() || []).length > 0
}
getSpyCount() {
return o.IZ.gameState.getSpyState().getNumSpiesInProvince(this.getLocationID())
}
getMoraleTrend() {
var e;
const t = null === (e = this.getProperties()) || void 0 === e ? void 0 : e.getTargetMorale();
if (!t)
return a.t.Unknown;
const i = this.getMorale();
return t > i + 3 ? a.t.Rising : t < i - 3 ? a.t.Falling : a.t.Stable
}
getMoraleTrendHR() {
switch (arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.getMoraleTrend()) {
case a.t.Rising:
return o.IZ.i18n.gettext("rising");
case a.t.Falling:
return o.IZ.i18n.gettext("falling");
case a.t.Stable:
return o.IZ.i18n.gettext("stable");
default:
return o.IZ.i18n.gettext("unknown")
}
}
getMaxProductionForResource(e) {
var t;
return (null === (t = this.maxProductionMap) || void 0 === t ? void 0 : t[e]) ?? 0
}
hasUpgradeWithCategory(e) {
return this.getUpgrades().some((t=>t.getUpgradeType().getUpgradeCategory() === e))
}
getUpgradeByTypeID(e) {
const t = o.IZ.getMod().getUpgrade(e);
if (o.IZ.getMod().hasInheritingUpgrades()) {
const i = this.getUpgrades()
, s = i.find((t=>t.getUpgradeType().getItemID() === e));
if (s)
return s;
const r = t.getUpgradeGroupSorted();
return i.find((e=>r.some((t=>t.getItemID() === e.getUpgradeType().getItemID()))))
}
}
static getProvinceTooltipModel(e) {
const t = e instanceof h.h
, i = {
province: e,
name: e.getName() ? e.getName() : "",
hasResourceProduction: !t && e.getMainProduction() > 0,
resourceIconString: e instanceof D ? o.IZ.ui.iconsHelper.getResourceProductionIcon(e) : "",
isNeutralProvince: t,
terrainTypeName: e instanceof u.zb ? S.Ky.getText(e.getTerrainType(), "name") : "",
terrainType: e.getTerrainType(),
profile: t ? null : o.IZ.gameState.getPlayerProfile(e.getOwnerID()),
hasTerrain: e.getTerrainType() > 0
};
return i.name || (i.name = i.terrainTypeName),
i
}
hasProvinceAttribute(e, t) {
switch (e) {
case n.Z.OwnerIds:
{
const e = null == t ? void 0 : t.ownerIds;
return !!e.length && !e.includes(Number(this.getOwnerID()))
}
case n.Z.ProvinceIds:
var i;
return !(null == t || null === (i = t.provinceIds) || void 0 === i || !i.includes(Number(this.getLocationID())));
case n.Z.Own:
return this.isPlayersProvince();
case n.Z.OwnOrAlly:
return this.isOwnOrAllyProvince();
case n.Z.Urban:
return this.isUrban();
case n.Z.NonUrban:
return !this.isUrban();
case n.Z.IsBuilding:
return this.isBuilding();
case n.Z.IsProducing:
return this.isProducing();
case n.Z.HasNoArmiesBeingAttacked:
return !this.hasArmiesInCloseCombatFight();
case n.Z.CanIncreaseMorale:
return this.canIncreaseMorale();
default:
return !0
}
}
hasArmiesInCloseCombatFight() {
return o.IZ.gameState.getArmyState().getArmiesInCloseCombatRange(this.getCapital()).some((e=>e.isFighting()))
}
}
c.F.UltProvince = D
}
,
73170: (e,t,i)=>{
i.d(t, {
o: ()=>o
});
var s = i(61809)
, r = i(70821)
, n = i(58202)
, a = i(13775);
class o extends r.y {
constructor() {
super(),
this.questType = "provinceConquer",
this.playerID = null,
this.provinceID = null,
this.timeLimit = null,
this.done = null,
this.reward = null
}
getProvince() {
return hup.gameState.getMapState().getLocation(this.provinceID)
}
getAdviserModel() {
return {
title: hup.i18n.gettext("Reinforcements have arrived"),
windowTitle: hup.i18n.gettext("Supply Drop"),
description: this.getFormattedDescription(),
tip: hup.i18n.gettext("Supply drops contain either resources or blueprints. Collect all blueprints of one type to unlock a new unit level in all of your games!"),
type: this.getQuestType(),
prov: this.getProvince()
}
}
getQuestID() {
return this.questID
}
getQuestType() {
return this.questType
}
getDescription() {
return hup.i18n.gettext("General, our enemies received a secret supply drop in the province of %s. Use your troops to conquer this province before time runs out to secure the supplies for yourself!")
}
getFormattedDescription() {
const e = hup.ui.helper.createProvinceLink(this.getProvince());
return hup.i18n.sprintf.apply(this, [this.getDescription(), e])
}
isDone() {
return this.done
}
getRemainingSeconds() {
const e = Math.floor((this.timeLimit - (0,
s.$B)()) / 1e3);
return (0,
s.gV)(e)
}
isTimeLeft() {
return this.getRemainingSeconds() > 0
}
isActive() {
return !this.isDone() && this.isTimeLeft()
}
getExpireTimeString() {
if (this.timeLimit > 0) {
const e = this.getRemainingSeconds();
return e > 0 ? a.Z.formatTimer(e, !0, 2) : hup.i18n.gettext("time is over")
}
return ""
}
getReward() {
return this.reward
}
hasProgress() {
return !1
}
}
n.F.UltProvinceConquerQuest = o
}
,
72285: (e,t,i)=>{
i.d(t, {
r: ()=>n
});
i(87477);
var s = i(39513)
, r = i(58202);
class n {
constructor(e) {
this.targetMorale = null,
this.revoltChance = 0,
this.uprisingChance = 0,
e && (this.possibleProductions = [],
this.possibleUpgrades = [],
this.queueableProductions = [],
this.queueableUpgrades = [])
}
getUprisingChance() {
return this.uprisingChance
}
getRevoltChance() {
return this.revoltChance
}
getRevoltDamageChance() {
return Math.min(1, 2 * this.revoltChance)
}
getRevoltChanceIcons(e, t) {
return e = e || 5,
t = t || .1 * e,
Math.ceil(Math.min(1, this.getRevoltChance() / t) * e)
}
getUprisingChanceIcons(e, t) {
return e = e || 5,
t = t || s.IZ.getMod().getUprisingChancePerAggressionLevel() / 100 * e,
Math.ceil(Math.min(1, this.getUprisingChance() / t) * e)
}
getMoraleFactors() {
return this.moraleFactors
}
getTargetMorale() {
return this.targetMorale
}
getPossibleUpgrades() {
return this.possibleUpgrades
}
setPossibleUpgrades(e) {
this.possibleUpgrades = e
}
getPossibleProductions() {
return this.possibleProductions
}
setPossibleProductions(e) {
this.possibleProductions = e
}
setQueueableProductions(e) {
this.queueableProductions = e
}
getQueueableProductions() {
return this.queueableProductions
}
setQueueableUpgrades(e) {
this.queueableUpgrades = e
}
getQueueableUpgrades() {
return this.queueableUpgrades
}
removePossibleUpgrade(e) {
const t = [];
for (let i = 0; i < this.possibleUpgrades.length; i++)
this.possibleUpgrades[i].getItemID() != e.getItemID() && t.push(this.possibleUpgrades[i]);
this.setPossibleUpgrades(t)
}
}
r.F.UltProvinceProperties = n
}
,
21420: (e,t,i)=>{
i.d(t, {
u: ()=>s
});
class s {
constructor() {
this.preferences = null
}
getPreferences() {
return this.preferences
}
changeValue(e, t, i, s) {
this.getPreferencesForContext(e)[t][i] = s
}
toggleCategoryPreferences(e, t) {
const i = this.getPreferencesForContext(e)[t]
, s = this.hasDisabledPreferenceInCategory(i);
for (const r in i)
i.hasOwnProperty(r) && (i[r] = s)
}
getPreferencesForContext(e) {
const t = s.CONTEXT_GLOBAL
, i = s.CONTEXT_GAME_SPECIFIC;
return e === t ? this.preferences[t] : this.preferences[i]
}
hasDisabledPreferenceInCategory(e) {
for (const t in e)
if (e.hasOwnProperty(t) && !e[t])
return !0;
return !1
}
hasDisabledPreferenceInContext(e) {
const t = this.getPreferencesForContext(e);
for (const i in t)
if (t.hasOwnProperty(i)) {
const e = t[i];
if (this.hasDisabledPreferenceInCategory(e))
return !0
}
return !1
}
getNotificationTexts() {
if (!s.NOTIFICATION_TEXTS) {
const e = s.PUSH_NOTIFICATION_TYPES;
s.NOTIFICATION_TEXTS = {},
s.NOTIFICATION_TEXTS[e.COALITION_MESSAGE_RECEIVED] = {
title: hup.i18n.gettext("Coalition message received"),
description: hup.i18n.gettext("When you receive a coalition message.")
},
s.NOTIFICATION_TEXTS[e.WAR_DECLARED] = {
title: hup.i18n.gettext("War declared"),
description: hup.i18n.gettext("When a player declares war on your country.")
},
s.NOTIFICATION_TEXTS[e.MESSAGE_RECEIVED] = {
title: hup.i18n.gettext("Message received"),
description: hup.i18n.gettext("When you receive a diplomacy message.")
},
s.NOTIFICATION_TEXTS[e.UNIT_PRODUCED] = {
title: hup.i18n.gettext("Unit produced"),
description: hup.i18n.gettext("When you produce a unit.")
},
s.NOTIFICATION_TEXTS[e.TRADE_PROCESSED] = {
title: hup.i18n.gettext("Trade processed"),
description: hup.i18n.gettext("When a player accepts or declines your trade offer.")
},
s.NOTIFICATION_TEXTS[e.ARMY_DESTROYED] = {
title: hup.i18n.gettext("Army destroyed"),
description: hup.i18n.gettext("When an army you control or you are in fight with gets destroyed.")
},
s.NOTIFICATION_TEXTS[e.PROVINCE_WON] = {
title: hup.i18n.gettext("Province conquered"),
description: hup.i18n.gettext("When you conquer a province.")
},
s.NOTIFICATION_TEXTS[e.PROVINCE_LOST] = {
title: hup.i18n.gettext("Province lost"),
description: hup.i18n.gettext("When you lose a province.")
},
s.NOTIFICATION_TEXTS[e.NUCLEAR_IMPACT] = {
title: hup.i18n.gettext("Nuclear impact"),
description: hup.i18n.gettext("When you get attacked with a nuclear bomb.")
},
s.NOTIFICATION_TEXTS[e.RESEARCH_COMPLETED] = {
title: hup.i18n.gettext("Research completed"),
description: hup.i18n.gettext("When a research you started is completed.")
},
s.NOTIFICATION_TEXTS[e.LOGIN_REWARD_AVAILABLE] = {
title: hup.i18n.gettext("Login reward available"),
description: hup.i18n.gettext("When a new login reward is waiting to be collected.")
}
}
return s.NOTIFICATION_TEXTS
}
getTextsForNotification(e) {
const t = this.getNotificationTexts()[e];
return t || {
title: "Unknown notification",
description: "Unknown notification"
}
}
toggleAllPreferences(e) {
const t = this.hasDisabledPreferenceInContext(e)
, i = this.getPreferencesForContext(e);
for (const s in i)
if (i.hasOwnProperty(s)) {
const e = i[s];
for (const i in e)
e.hasOwnProperty(i) && (e[i] = t)
}
}
}
s.CATEGORIES = {
DIPLOMATIC: "diplomatic",
MILITARY: "military",
ECONOMY: "economy",
QUESTS: "quests"
},
s.PUSH_NOTIFICATION_TYPES = {
COALITION_MESSAGE_RECEIVED: "CoalitionMessageReceived",
WAR_DECLARED: "WarDeclared",
MESSAGE_RECEIVED: "MessageReceived",
UNIT_PRODUCED: "UnitProduced",
TRADE_PROCESSED: "TradeProcessed",
ARMY_DESTROYED: "ArmyDestroyed",
PROVINCE_WON: "ProvinceWon",
PROVINCE_LOST: "ProvinceLost",
NUCLEAR_IMPACT: "NuclearImpact",
RESEARCH_COMPLETED: "ResearchCompleted",
LOGIN_REWARD_AVAILABLE: "LoginRewardAvailable"
},
s.CONTEXT_GLOBAL = "global",
s.CONTEXT_GAME_SPECIFIC = "gameSpecific",
s.NOTIFICATION_TEXTS = null
}
,
70821: (e,t,i)=>{
i.d(t, {
y: ()=>r
});
var s = i(58202);
class r {
getQuestType() {}
getProvince() {
return null
}
getQuestID() {
return this.questID
}
getExpireTimeString() {}
getAdviserModel() {}
isTimeLeft() {}
isDone() {}
isActive() {}
hasProgress() {
return !1
}
isPromoted() {
return !1
}
}
s.F.UltQuest = r
}
,
43112: (e,t,i)=>{
var s = i(55542)
, r = i(81177)
, n = i(58202)
, a = i(87928);
n.F.UltQuestState = class {
constructor() {
this.stateType = r.V.STATE_TYPE_QUEST_STATE,
this.quests = {}
}
update(e) {
this.quests = e.quests,
this.stateID = e.stateID,
this.timeStamp = e.timeStamp
}
publishUpdate() {
s.N.publish(a.q.UI_QUEST_STATE_UPDATED)
}
getQuestByQuestID(e) {
return this.quests[e]
}
getActiveQuests() {
return Object.values(this.quests).filter((e=>e.isActive()))
}
}
}
,
6266: (e,t,i)=>{
i.d(t, {
t: ()=>a
});
i(87477);
var s = i(61809)
, r = i(58202)
, n = i(13775);
class a {
static ranks = null;
static groupedRanksList = null;
static levelRankMap = null;
constructor() {
this.itemID = null,
this.isOfficer = null,
this.level = null,
this.minPoints = null,
this.fullTitle = null,
this.rankGroupID = null
}
static instance(e) {
return hup.contentItems[e]instanceof a ? hup.contentItems[e] : null
}
static getRanks() {
if (null == a.ranks || (0,
s.Ew)(a.ranks)) {
const e = {}
, t = hup.contentItems;
for (const i in t)
t.hasOwnProperty(i) && t[i]instanceof a && (e[i] = t[i]);
a.ranks = e
}
return a.ranks
}
static getRankForLevel(e) {
return e = e || 1,
a.getLevelRankMap()[e] || null
}
static getRankForUser(e) {
return a.getRankForScore(e.getOverallScore())
}
static getRankByItemId(e) {
return this.getRanks()[Number(e)] ?? null
}
static getRankForScore(e) {
const t = a.getLevelRankMap();
e = parseInt(e);
let i = a.getRankForLevel(1);
for (const s in t)
if (t.hasOwnProperty(s)) {
if (t[s].getMinPoints() > e)
return i;
i = t[s]
}
return i
}
getFullTitle() {
return this.fullTitle[hup.config.userDataLocal.lang]
}
getMinPoints() {
return this.minPoints
}
getMinPointsHR() {
return n.Z.formatNumber(this.getMinPoints())
}
getIconIndex() {
return hup.config.hasGroupedRanks ? (a.groupedRanksList || a.initializeGroupedRanksList(),
this.getRankGroupID()) : this.getLevel() - 1
}
getLevel() {
return this.level
}
getNextRank(e) {
const t = a.getLevelRankMap();
return t[this.getLevel() + 1] ? t[this.getLevel() + 1] : e ? this : null
}
getProgress(e) {
const t = e.getOverallScore()
, i = this.getNextRank(!1);
return i ? Math.min(100, Math.max(0, Math.round((t - this.getMinPoints()) / (i.getMinPoints() - this.getMinPoints()) * 100))) : 100
}
isOfficerRank() {
return "1" === this.isOfficer
}
static getLevelRankMap() {
if (null == a.levelRankMap || (0,
s.Ew)(a.levelRankMap)) {
a.levelRankMap = {};
const e = a.getRanks();
let t, i;
for (t in e)
e.hasOwnProperty(t) && (i = e[t],
a.levelRankMap[i.level] = i)
}
return a.levelRankMap
}
static getGroupedRanksList() {
return a.groupedRanksList || this.initializeGroupedRanksList(),
a.groupedRanksList
}
static initializeGroupedRanksList() {
const e = a.getRankForUser(hup.user)
, t = []
, i = {}
, s = a.getRanks();
let r, n, o;
for (r in s)
s.hasOwnProperty(r) && (n = s[r],
o = i[n.getFullTitle()],
o ? (o.count++,
n.getLevel() < o.rankItem.getLevel() && (o.rankItem = n)) : (o = {
rankItem: n,
count: 1,
ranks: []
},
t.push(o),
i[n.getFullTitle()] = o),
o.ranks.push(n),
e && Number(n.getLevel()) === Number(e.getLevel()) && (o.isUserRank = !0));
t.sort(((e,t)=>e.rankItem.getMinPoints() - t.rankItem.getMinPoints()));
for (let a = 0; a < t.length; a++)
n = t[a],
a < t.length - 1 ? (n.maxLevel = t[a + 1].rankItem.getLevel() - 1,
n.maxScore = t[a + 1].rankItem.getMinPoints()) : (n.maxLevel = n.rankItem.getLevel() + n.count - 1,
n.maxScore = 0),
n.ranks.forEach((e=>e.setRankGroupID(a)));
a.groupedRanksList = t
}
getRankProgressString(e) {
return null == e.getOverallScore() ? hup.i18n.gettext("currently unavailable") : hup.i18n.gettext("%1$s / %2$s", n.Z.formatNumber(e.getOverallScore()), n.Z.formatNumber(this.getNextRank(!0).getMinPoints()))
}
getItemID() {
return parseInt(this.itemID, 10)
}
setRankGroupID(e) {
this.rankGroupID = e
}
getRankGroupID() {
return this.rankGroupID
}
}
r.F.UltRank = a
}
,
8493: (e,t,i)=>{
i.d(t, {
f: ()=>n
});
var s = i(39513)
, r = i(58202);
class n {
constructor() {
this.ranking = [],
this.teamRanking = [],
this.playersRankSorted = [],
this.teamsRankSorted = [],
this.playerIDToRewardMap = null,
this.winnerTeam = -1
}
getRanking() {
return this.ranking
}
getPlayerIDsRankSorted() {
return this.playersRankSorted
}
getTeamIDsRankSorted() {
return this.teamsRankSorted
}
getPlayerPoints(e) {
return this.ranking[e] || 0
}
getTeamPoints(e) {
return this.teamRanking[e] || 0
}
getPlayerPercentage(e) {
const t = s.IZ.gameState.getGameInfoState().getVictoryPointsModSpecific() || 1;
return this.ranking[e] / t * 100
}
getTeamPercentage(e) {
const t = s.IZ.gameState.getGameInfoState().getTeamVictoryPointsModSpecific();
return this.teamRanking[e] / t * 100
}
getPlayerRankingPlace(e) {
const t = this.playersRankSorted.filter(this.isNotPassiveAI).indexOf(e);
return t > -1 ? t + 1 : t
}
isNotPassiveAI(e) {
return !s.IZ.gameState.getPlayerState().getPlayer(e).isPassiveAI()
}
getWinner() {
let e;
for (let t = 0; t < this.playersRankSorted.length; t++) {
const i = s.IZ.gameState.getPlayerState().getPlayer(this.playersRankSorted[t]);
if (!i.isPassiveAI()) {
e = i;
break
}
}
return e
}
getWinnerTeam() {
return this.winnerTeam
}
getPlayerReward(e) {
return this.playerIDToRewardMap ? this.playerIDToRewardMap[e] : 0
}
isCoalitionVictory() {
return -1 == this.winner && s.IZ.gameState.getGameInfoState().isDynamicTeamGame() && -1 != this.getWinnerTeam()
}
}
r.F.UltRanking = n
}
,
5766: (e,t,i)=>{
i(87477);
var s = i(55542)
, r = i(61809)
, n = i(39513)
, a = i(69453)
, o = i(58202)
, l = i(87928);
o.F.UltResearchState = class {
constructor() {
this.researchSlots = 0,
this.researchQueueMaxLength = 0,
this.currentResearches = [],
this.queuedResearches = [],
this.completedResearches = {},
this.possibleResearches = [],
this.queueableResearches = [],
this.transportShipUnitTypeId = 0
}
getNumResearchSlots() {
return this.researchSlots
}
getResearchQueueMaxLength() {
return this.researchQueueMaxLength
}
getItemAmountForResearchLevelItem(e) {
if (!n.IZ.getMod().hasIngameInventoryFeature())
return 1;
return n.IZ.gameState.getIngameInventoryState().getUnlockedItemAmount(e)
}
getCurrentResearches() {
return this.currentResearches
}
getQueuedResearches() {
return this.queuedResearches
}
getCompletedResearches() {
return Object.values(this.completedResearches)
}
getNumFreeResearchSlots() {
return this.researchSlots - this.currentResearches.length
}
getCurrentResearch(e) {
if (this.currentResearches)
for (let t = 0; t < this.currentResearches.length; t++)
if (this.currentResearches[t].getID() === e)
return this.currentResearches[t];
return null
}
getQueuedResearch(e) {
if (this.queuedResearches)
for (let t = 0; t < this.queuedResearches.length; t++)
if (this.queuedResearches[t].getID() === e)
return this.queuedResearches[t];
return null
}
getPossibleResearches() {
return this.possibleResearches
}
getQueueableResearches() {
return this.queueableResearches
}
hasResearch(e) {
return this.completedResearches.hasOwnProperty(e)
}
hasReplacedResearch(e) {
const t = n.IZ.getMod().getResearch(e);
return !(!t || !t.canBeReplaced()) && (this.hasResearch(t.getReplacingResearch()) || this.hasReplacedResearch(t.getReplacingResearch()))
}
getNextAvailableResearch(e) {
let t = -1;
for (const i in e)
if (e.hasOwnProperty(i) && this.canStartResearch(i) && !this.hasResearch(i) && !this.hasReplacedResearch(i)) {
t = i;
break
}
return t
}
getCurrentResearchDay() {
const e = n.IZ.gameState.getGameInfoState()
, t = n.IZ.gameState.getScenarioState();
return ((null == e ? void 0 : e.getDayOfGame()) ?? 0) + ((null == t ? void 0 : t.getResearchDaysOffset()) ?? (null == e ? void 0 : e.getResearchDaysOffset()) ?? 0)
}
isResearchTimeLocked(e) {
var t;
return (null === (t = n.IZ.getMod().getResearch(e)) || void 0 === t ? void 0 : t.getDayOfAvailability()) > this.getCurrentResearchDay()
}
canStartResearch(e) {
return this.getPossibleResearches().hasOwnProperty(e)
}
canQueueResearch(e) {
return this.getQueueableResearches().hasOwnProperty(e)
}
hasFreeResearchSlot() {
return this.currentResearches.length < this.getNumResearchSlots()
}
hasFreeQueueSlot() {
return this.queuedResearches.length < this.getResearchQueueMaxLength()
}
hasResearches(e) {
if (e)
for (const t in e)
if (e.hasOwnProperty(t) && !this.hasResearch(t))
return !1;
return !0
}
startResearch(e) {
if (this.canStartResearch(e.getItemID()) && this.hasFreeResearchSlot()) {
const t = new a.w(e.getItemID());
t.start(),
this.currentResearches.push(t),
delete this.possibleResearches[e.getItemID()],
this.publishUpdate()
}
}
queueResearch(e) {
if (this.canQueueResearch(e.getItemID()) && this.hasFreeQueueSlot()) {
const t = new a.w(e.getItemID());
this.queuedResearches.push(t),
delete this.possibleResearches[e.getItemID()],
delete this.queueableResearches[e.getItemID()],
this.publishUpdate()
}
}
stopResearch(e) {
this.removeFromCurrentResearches(e),
this.possibleResearches[e.getID()] = e.getResearchType(),
this.publishUpdate()
}
dequeueResearch(e) {
this.removeFromResearchQueue(e),
this.queueableResearches[e.getID()] = e.getResearchType(),
this.publishUpdate()
}
removeFromCurrentResearches(e) {
for (let t = 0; t < this.currentResearches.length; t++)
if (this.currentResearches[t].getID() === e.getID()) {
this.currentResearches.splice(t, 1);
break
}
}
removeFromResearchQueue(e) {
for (let t = 0; t < this.queuedResearches.length; t++)
if (this.queuedResearches[t].getID() === e.getID()) {
this.queuedResearches.splice(t, 1);
break
}
}
speedupResearchByMs(e, t) {
e.setSpeedUp(Math.floor(e.getSpeedUp() + 1)),
e.setEndTime(e.getEndTime() - t),
e.setStartTime(e.getStartTime() - t),
e.getEndTime() <= r.$B() && this.removeFromCurrentResearches(e),
this.publishUpdate()
}
publishUpdate() {
s.N.publish(l.q.UI_RESEARCH_STATE_UPDATED)
}
getTransportShipUnitTypeId() {
return this.transportShipUnitTypeId
}
}
}
,
62442: (e,t,i)=>{
i(87477);
var s = i(55542)
, r = i(39513)
, n = i(15372)
, a = i(71582)
, o = i(81177)
, l = i(58202)
, u = i(87928);
l.F.UltResourceState = class {
constructor() {
this.stateType = o.V.STATE_TYPE_RESOURCE_STATE,
this.resourceProfs = {},
this.bids = null,
this.asks = null,
this.prices = [],
this.mobilizationFactors = new Map
}
applyData(e) {
Object.assign(this, e),
r.IZ.config.sortedResourceIDs && Object.values(this.resourceProfs).forEach((e=>Object.values(e.getResources()).forEach((e=>e.setOrder(r.IZ.config.sortedResourceIDs.indexOf(e.getResourceID())))))),
this.mobilizationFactors = new Map(Object.entries(e.mobilizationFactors ?? {}).map((e=>[Number(e[0]), e[1]])))
}
update(e) {
this.resourceProfs = e.resourceProfs,
this.asks = e.asks,
this.bids = e.bids,
this.trading = e.trading,
this.stateID = e.stateID,
this.prices = e.prices,
this.mobilizationFactors = e.mobilizationFactors ?? new Map
}
getTrading() {
return this.trading
}
getAllAsks(e) {
const t = new n.L
, i = e=>t.push(...e);
return this.asks.forEach(i),
e && i(this.getResourceProfile(r.IZ.config.userData.playerID).getPersonalOrdersList(!1)),
t
}
getAllBids(e) {
const t = new a.F
, i = e=>t.push(...e);
return this.bids.forEach(i),
e && i(this.getResourceProfile(r.IZ.config.userData.playerID).getPersonalOrdersList(!0)),
t
}
getOrder(e) {
return this.searchOrder(this.bids, e) || this.searchOrder(this.asks, e)
}
searchOrder(e, t) {
for (let i = 0; i < e.length; i++)
for (let s = 0; s < e[i].length; s++)
if (e[i][s].getOrderID() == t)
return e[i][s];
return null
}
getPriceFor(e) {
return Number.isNaN(this.prices[e]) ? Number(e) === r.IZ.consts.MONEY ? 1 : -1 : this.prices[e]
}
getPlayerResourceCategories() {
const e = r.IZ.config.userData.playerID;
return this.resourceProfs[e] && this.resourceProfs[e].getCategories() || {}
}
getPlayerResourceEntry(e) {
return this.getResourceEntry(r.IZ.config.userData.playerID, e)
}
getResourceEntry(e, t) {
return this.resourceProfs[e] && this.resourceProfs[e].getResource(t) || null
}
getResourceName(e) {
return r.IZ.getMod().getResourceName(e)
}
getResourceClassName(e) {
let t = "";
switch (e) {
case r.IZ.consts.FOOD:
t = r.IZ.i18n.gettext("Food");
break;
case r.IZ.consts.MATERIAL:
t = r.IZ.i18n.gettext("Material");
break;
case r.IZ.consts.ENERGY:
t = r.IZ.i18n.gettext("Energy");
break;
case r.IZ.consts.CURRENCIES:
t = r.IZ.i18n.gettext("Money")
}
return t
}
getResourceProfile(e) {
return this.resourceProfs[e]
}
getMobilizationFactor(e) {
return this.mobilizationFactors.get(e)
}
updateStateID() {
this.stateID = `1${this.stateID}`
}
publishUpdate() {
s.N.publish(u.q.UI_RESOURCE_STATE_UPDATED)
}
getPlayerMoneyAmount() {
return this.getPlayerResourceCategories()[r.IZ.consts.CURRENCIES].getResourceEntry(r.IZ.consts.MONEY).getAmount()
}
}
}
,
97978: (e,t,i)=>{
i.d(t, {
d: ()=>u
});
i(87477);
var s = i(65112)
, r = i(6422)
, n = i(6266)
, a = i(58202)
, o = i(38530)
, l = i(13775);
a.F.ScenarioOptions = {
SCENARIO_TEAMMODE: "scenarioTeamMode",
FORCED_TEAMMODE: "forcedTeamMode",
QUEST_PROVINCE_CONQUER_FEATURE: "questProvinceConquerFeature",
USE_TUTORIAL_ADVISER: "useTutorialAdviser",
FREE_OF_CHARGE_PREMIUM_CURRENCY_MODE: "freeOfChargePremiumCurrencyMode",
PREVENT_TUTORIAL_SKIP: "preventTutorialSkip",
LIST_ALL_PLAYERS: "listAllPlayers",
COALITION_MEMBER_LIMIT: "coalitionMemberLimit",
EVENT_SCENARIO: "eventScenario",
MAX_JOIN_DAY: "maxJoinDay",
EXCLUDE_FROM_HIGHLIGHTED_GAMES: "excludeFromHighlightedGames",
IMMUTABLE_PROVINCE: "immutableProvince",
MAX_ENEMY_TEAM_RELATION: "maxEnemyTeamRelation",
AUTO_RECRUITMENT_SPEED: "autoRecruitmentSpeed",
QUICK_JOIN_COOLDOWN_IN_SECONDS: "quickJoinCooldownTimeInSeconds",
USE_FACTION_ICONS_FOR_PLAYER_AVATARS: "useFactionIconsForPlayerAvatars",
SHOW_MAP_BRIEFING: "showMapBriefing",
LIST_ORDER: "listOrder"
},
a.F.ScenarioStatus = {
PUBLISHED: 1,
JOIN_ONLY: 4,
UNPUBLISHED: 5
};
class u {
constructor() {
this.ingameDesc = null,
this.ingameName = null,
this.itemID = null,
this.versionID = null,
this.mapID = null,
this.maxPlayers = null,
this.minPlayers = null,
this.maxTeams = null,
this.minRank = null,
this.minRankLevel = 0,
this.maxRank = null,
this.sugTeam = null,
this.sugPlayers = null,
this.teamVictoryAwards = null,
this.teamVictoryPoints = null,
this.victoryAwards = null,
this.victoryPoints = null,
this.createPropertiesCache = null,
this.status = null,
this.goldFeature = 0,
this.modVersion = 0
}
getName() {
return this.ingameName
}
getScenarioNameParts() {
return this.getName().split(" - ")
}
getMinPlayers() {
return parseInt(this.minPlayers)
}
getMaxPlayers() {
return parseInt(this.maxPlayers)
}
getSuggestedNumberOfPlayers() {
return parseInt(this.sugPlayers)
}
getMinTeams() {
return this.minTeams ? parseInt(this.minTeams) : 2
}
getMaxTeams() {
return parseInt(this.maxTeams)
}
getSuggestedNumberOfTeams() {
return parseInt(this.sugTeams)
}
getDescription() {
return nl2br(this.ingameDesc)
}
getScenarioID() {
return parseInt(this.itemID, 10)
}
getMapID() {
return parseInt(this.mapID)
}
getVersionID() {
return parseInt(this.versionID, 10)
}
isGoldFeature() {
return 1 === parseInt(this.goldFeature)
}
getCreatePropertiesHR() {
if (!this.createPropertiesCache) {
const e = [];
if (e.push(hup.i18n.gettext("%1$s - %2$s players ", this.minPlayers, this.maxPlayers)),
this.minRank > 0) {
const t = n.t.getRanks()[this.minRank];
e.push(hup.i18n.gettext("Min. required rank: Lvl. %s", t ? t.getLevel() : this.minRank))
}
if (this.maxRank > 0) {
const t = n.t.getRanks()[this.maxRank];
e.push(hup.i18n.gettext("Max. allowed rank: Lvl. %s", t ? t.getLevel() : this.maxRank))
}
this.isTeamScenarioOnly() && e.push(hup.i18n.ngettext("team map for %s team", "team map for %s teams", this.getSuggestedNumberOfTeams())),
this.isGoldFeature() && e.push(hup.i18n.gettext("Gold feature")),
this.createPropertiesCache = e
}
return this.createPropertiesCache
}
getOption(e) {
return this.options[e]
}
isTeamScenarioOnly() {
return 2 == this.getOption(a.F.ScenarioOptions.FORCED_TEAMMODE)
}
supportsScenarioTeamMode() {
return 1 === parseInt(this.getOption(a.F.ScenarioOptions.SCENARIO_TEAMMODE), 10)
}
getQuickJoinCooldownTimeInSeconds() {
return parseInt(this.getOption(a.F.ScenarioOptions.QUICK_JOIN_COOLDOWN_IN_SECONDS), 10) || 86400
}
getListOrder() {
return parseInt(this.getOption(a.F.ScenarioOptions.LIST_ORDER), 10) || 100
}
isQuestProvinceConquerFeatureEnabled() {
return 1 == this.getOption(a.F.ScenarioOptions.QUEST_PROVINCE_CONQUER_FEATURE)
}
hasTutorialAdviserSupport() {
return 1 == this.getOption(a.F.ScenarioOptions.USE_TUTORIAL_ADVISER)
}
isFreeOfChargePremiumCurrencyMode() {
return 1 == this.getOption(a.F.ScenarioOptions.FREE_OF_CHARGE_PREMIUM_CURRENCY_MODE)
}
hasPreventSkipTutorialOption() {
return 1 == this.getOption(a.F.ScenarioOptions.PREVENT_TUTORIAL_SKIP)
}
hasNoCoalitions() {
return 3 == this.getOption(a.F.ScenarioOptions.FORCED_TEAMMODE)
}
hasImmutableProvince() {
return 1 == this.getOption(a.F.ScenarioOptions.IMMUTABLE_PROVINCE)
}
hasShowMapBriefing() {
return this.getShowMapBriefing() > 0
}
getShowMapBriefing() {
return Number(this.getOption(a.F.ScenarioOptions.SHOW_MAP_BRIEFING) ?? 0)
}
getCoalitionSize() {
return Number(this.getOption(a.F.ScenarioOptions.COALITION_MEMBER_LIMIT) || 2)
}
isListAllPlayers() {
return 1 == this.getOption(a.F.ScenarioOptions.LIST_ALL_PLAYERS)
}
isJoinOnly() {
return this.status == a.F.ScenarioStatus.JOIN_ONLY && !o.W.mayCreateJoinOnlyScenarios(hup.user)
}
isAvailable() {
return this.status == a.F.ScenarioStatus.PUBLISHED || this.status == a.F.ScenarioStatus.JOIN_ONLY
}
getMinRank() {
return this.minRank
}
getMinRankLevel() {
return this.minRankLevel
}
hasSpeedUpFactor() {
return 1 !== this.getSpeedFactor()
}
getSpeedFactor() {
return Number(this.getOption("scenarioSpeedUpFactor") ?? 1)
}
isEventScenario() {
return parseInt(this.getOption(a.F.ScenarioOptions.EVENT_SCENARIO) || 0) > 0
}
canBeHighlighted() {
return 1 !== parseInt(this.getOption(a.F.ScenarioOptions.EXCLUDE_FROM_HIGHLIGHTED_GAMES), 10)
}
getMaxEnemyTeamRelation() {
const e = Number(this.getOption(a.F.ScenarioOptions.MAX_ENEMY_TEAM_RELATION));
return Number.isFinite(Number.parseFloat(e)) ? e : r.N.PEACE
}
getVictoryRewardBoostGoldmarkAmount(e) {
return (this.getOption("victoryRewardBoosts") || "").split(":")[e] || 0
}
getVictoryRewardsBoostsFormatted() {
const e = this.getOption("victoryRewardBoosts") || "";
return e ? e.split(":").map((e=>e ? l.Z.formatNumber(e) : null)) : null
}
getTeamVictoryRewardBoostsFormatted() {
const e = this.getOption("teamVictoryRewardBoosts") || "";
return e ? e.split(":").map((e=>e ? l.Z.formatNumber(e) : null)) : null
}
getTeamVictoryGoldRewardFormatted() {
let e = this.getOption("teamVictoryGoldReward");
return e || (e = this.getOption("coalitionGoldReward")),
e ? l.Z.formatNumber(e) : null
}
getMaxJoinDay() {
return parseInt(this.getOption(a.F.ScenarioOptions.MAX_JOIN_DAY)) || 0
}
getRequiredVictoryPointsPercentageToWin() {
return Math.round(this.victoryPoints / a.F.MAX_POINTS * 100)
}
getRequiredTeamVictoryPointsPercentageToWin() {
return Math.round(this.teamVictoryPoints / a.F.MAX_POINTS * 100)
}
getDummyGame() {
if (!this._dummyGame) {
const e = {};
s.W.all.forEach((t=>{
const i = t.getKey();
e[i] = this[i] || 0
}
)),
this._dummyGame = new hup.model.games.Game(e)
}
return this._dummyGame
}
canPlay() {
return this.getDummyGame().mayJoin()
}
getCannotPlayReason() {
let e = hup.i18n.gettext("You are not eligible to play this scenario because of the following reason(s): ");
const t = this.getDummyGame().getJoinFailReasonsForGameFeatures();
for (let i = 0; i < t.length; i++)
e += `\n- ${t[i]}`;
return e
}
shouldUserSeeScenario() {
return !this.isModVersionExlusivelyDefined() || hup.user.getMinModVersion() <= this.modVersion
}
isModVersionExlusivelyDefined() {
return this.modVersion >= 1
}
getTimeLimitedScenarioStartTime() {
return Number(this.getOption("timeLimitedScenarioStartDate") ?? 0)
}
getTimeLimitedScenarioDuration() {
return Number(this.getOption("timeLimitedScenarioDuration") ?? 0)
}
getTimeLimitedScenarioTeaseDuration() {
return Number(this.getOption("timeLimitedScenarioTeaseDuration") ?? 0)
}
getTimeLimitedScenarioRemainingTime() {
if (!this.isTimeLimitedScenario())
return 0;
return this.getTimeLimitedScenarioStartTime() + this.getTimeLimitedScenarioDuration() - Date.now() / 1e3
}
getTimeLimitedScenarioRemainingTimeToStart() {
return this.isTimeLimitedScenario() ? Math.max(this.getTimeLimitedScenarioStartTime() - Date.now() / 1e3, 0) : 0
}
isTimeLimitedScenarioStarted() {
return Date.now() / 1e3 > this.getTimeLimitedScenarioStartTime()
}
isTimeLimitedScenario() {
return this.getTimeLimitedScenarioDuration() > 0 && this.getTimeLimitedScenarioStartTime() > 0
}
canTeaseTimeLimitedScenario() {
if (this.getTimeLimitedScenarioTeaseDuration() <= 0)
return !1;
const e = this.getTimeLimitedScenarioRemainingTimeToStart();
return !(e <= 0) && e < this.getTimeLimitedScenarioTeaseDuration()
}
isTimeLimitedScenarioExpired() {
return this.getTimeLimitedScenarioRemainingTime() <= 0
}
canShowTimeLimitedScenario() {
return this.isTimeLimitedScenarioStarted() ? !this.isTimeLimitedScenarioExpired() : this.canTeaseTimeLimitedScenario()
}
isInternationalScenario() {
return 1 === Number(this.getOption("international"))
}
static instance(e) {
return u.getScenarios()[e]
}
static getScenarios() {
if (null == u.scenarios) {
const e = {}
, t = hup.contentItems;
for (const i in t)
t.hasOwnProperty(i) && t[i]instanceof u && (e[i] = t[i]);
u.scenarios = e
}
return u.scenarios
}
}
u.scenarios = null,
a.F.UltScenario = u
}
,
54753: (e,t,i)=>{
i.d(t, {
F: ()=>n
});
var s = i(41788)
, r = i(58202);
class n extends s.j {
isUltSeapoint() {}
update(e) {
this.name = e.name
}
isOnSea() {
return !0
}
}
r.F.UltSeapoint = n
}
,
74787: (e,t,i)=>{
i.d(t, {
e: ()=>h
});
i(87477);
var s = i(36068)
, r = i(55542)
, n = i(39513)
, a = i(81177)
, o = i(58202)
, l = i(63593)
, u = i(87928);
class h {
constructor() {
this.spies = [],
this.spyReport = null,
this.stateType = a.V.STATE_TYPE_SPY_STATE,
this.firstStateReceived = !1
}
getSpyReport() {
return this.spyReport
}
removeSpy() {
for (let e = 0; e < this.spies.length; ++e)
if (this.spies[e].getMissionType() == l.$.MissionTypes.NO_MISSION)
return this.spies.splice(e, 1),
!0;
return !1
}
getSpies() {
return this.spies
}
getNumAllSpies() {
return this.spies.length
}
getNumSpiesOnMission(e) {
let t = 0;
for (let i = 0; i < this.spies.length; ++i)
this.spies[i].getMissionType() == e && t++;
return t
}
getNumSpiesInProvince(e) {
let t = 0;
const i = this.getSpies();
for (let s = 0; s < i.length; ++s)
i[s].getLocationID() === e && ++t;
return t
}
getNumSpiesOnMissionInProvince(e, t) {
let i = 0;
for (let s = 0; s < this.spies.length; ++s)
this.spies[s].getMissionType() == e && this.spies[s].getLocationID() == t && i++;
return i
}
getSpyOnMissionInProvince(e, t) {
for (let i = 0; i < this.spies.length; ++i)
if (this.spies[i].getMissionType() == e && this.spies[i].getLocationID() == t)
return this.spies[i];
return null
}
removeSpyOnMissionInProvince(e, t) {
for (let i = 0; i < this.spies.length; ++i)
if (this.spies[i].getMissionType() == e && this.spies[i].getLocationID() == t) {
this.spies.splice(i, 1);
break
}
}
getDailyCosts() {
let e = 0;
for (let t = 0; t < this.spies.length; ++t)
e += this.spies[t].getDailyCosts();
return e
}
getDailyCostsOnMission(e) {
let t = 0;
for (let i = 0; i < this.spies.length; ++i)
this.spies[i].getMissionType() == e && (t += this.spies[i].getDailyCosts());
return t
}
getDailyCostsFor(e, t) {
return t * n.IZ.gameState.getMod().getSpyMissions()[e].getDailyCosts()
}
publishUpdate() {
r.N.publish(u.q.espionage.UI_SPY_STATE_UPDATED)
}
getUnassignedSpy() {
for (let e = 0; e < this.spies.length; ++e)
if (this.spies[e].getMissionType() == l.$.MissionTypes.NO_MISSION)
return this.spies[e];
return null
}
update(e) {
if (n.IZ.gameState.getArmyState() && n.IZ.gameState.getArmyState().resetCombinedArmies(),
this.firstStateReceived) {
e.firstStateReceived = !0;
const t = []
, i = this.spyReport.dailyStates;
if (e.spyReport.dailyStates)
for (let s = 0; s < e.spyReport.dailyStates.length; ++s)
null !== e.spyReport.dailyStates[s] && (i[s] = e.spyReport.dailyStates[s],
t.push(s));
e.spyReport.dailyStates = i,
n.IZ.gameState.setSpyState(e);
for (let s = 0; s < t.length; s++)
h.resolveSpyJobs(e, t[s]),
r.N.publish(u.q.espionage.UI_SPY_DAY_RECEIVED, t[s])
} else
e.firstStateReceived = !0,
e.spyReport.dailyStates ? h.resolveSpyJobs(e, e.spyReport.dailyStates.length - 1) : e.spyReport.dailyStates = [],
n.IZ.gameState.setSpyState(e)
}
getNameForMission(e) {
const t = n.IZ.gameState.getMod().getSpyMissions();
for (const i in t)
if (t.hasOwnProperty(i) && t[i].getMissionType() == e)
return t[i].getName();
return ""
}
static resolveSpyJobs(e, t) {
const {detailedStates: i} = e.spyReport.dailyStates[t];
for (let s = 0; s < i.length; ++s)
null !== i[s] && i[s].initSpyJobs()
}
addIdleSpy() {
this.spies.push(new l.$)
}
getNumOfIdleSpies() {
return this.getNumSpiesOnMission(l.$.MissionTypes.NO_MISSION)
}
updateSpyStateID(e, t, i, r) {
let a = 0;
const o = new s.t(n.IZ.gameState.getSpyState().stateID);
null != t && (a -= l.$.getSpyStateFor(e, t)),
null != r && (a += l.$.getSpyStateFor(i, r)),
0 !== a && (o.add(a),
this.stateID = o.toString())
}
}
o.F.UltSpyState = h
}
,
71634: (e,t,i)=>{
i.d(t, {
W: ()=>n
});
var s = i(41048)
, r = i(58202);
class n extends s.a {
}
r.F.UltStatisticsArticle = n
}
,
86226: (e,t,i)=>{
i.d(t, {
f: ()=>r
});
var s = i(58202);
class r {
constructor() {
this.primaryColorCanvas = null
}
getTeamID() {
return this.teamID
}
getTeamName() {
return (this.name ?? "").replace(/</g, "&lt;").replace(/>/g, "&gt;")
}
getDescription() {
return this.description
}
getPrimaryColor() {
return this.primaryColor
}
getInGameAlliance() {
return hup.inGameAllianceController.getAllianceByID(this.teamID)
}
getFlagImageURL() {
const e = this.getFlagImageID();
if (e > -1 && hup.gameState.getGameInfoState().isDynamicTeamGame())
return hup.ui.helper.getImgUrl(e, "png");
if (!this.primaryColorCanvas) {
const e = document.createElement("canvas");
e.width = 1,
e.height = 1;
const t = e.getContext("2d");
t.fillStyle = this.getPrimaryColor(),
t.fillRect(0, 0, 1, 1),
this.primaryColorCanvas = e
}
return this.primaryColorCanvas.toDataURL()
}
getFlagImageTag() {
return `<img src="${this.getFlagImageURL()}"/>`
}
getFlagImageID() {
return this.flagImageID
}
getLeaderID() {
return this.leaderID
}
isDisbanded() {
return this.disbanded
}
getFlagImage(e, t) {
return this.getFlagImageID() < 0 ? null : (this.flagImage || (this.flagImage = e.loadImage(this.getFlagImageURL(), "flagImage", t)),
this.flagImage)
}
getTeamPoints() {
const e = hup.gameState.getGameInfoState().getDayOfGame()
, t = hup.gameState.getNewspaperState();
if (!t.hasDay(e))
return 0;
return t.getRanking(e).getTeamPoints(this.playerID)
}
}
s.F.UltTeamProfile = r
}
,
50155: (e,t,i)=>{
i.d(t, {
r: ()=>c
});
i(87477);
var s = i(67929)
, r = i.n(s)
, n = i(61809)
, a = i(23861)
, o = i(39513)
, l = i(13524)
, u = i(6422)
, h = i(58202)
, g = i(13775);
class c {
constructor(e, t, i, s, r, n, a) {
this.partyA = e,
this.partyB = t,
this.offersA = i,
this.offersB = s,
this.message = r,
this.timeStamp = n,
this.successful = a,
this.tradeID = -1,
this["@c"] = "ultshared.UltTradeOffer",
this.readByReceiver = null
}
getTradeID() {
return this.tradeId
}
setTradeID(e) {
this.tradeId = e
}
getPartyA() {
return this.partyA
}
getPartyB() {
return this.partyB
}
getSenderID() {
return this.getPartyA()
}
getReceiverID() {
return this.getPartyB()
}
isDeletedBySender() {
return this.delBySender
}
isDeletedByReceiver() {
return this.delByReceiver
}
isDeleted() {
return this.isDeletedByReceiver() || this.isDeletedBySender()
}
isProcessed() {
return this.processed
}
setProcessed(e) {
this.processed = e
}
getTime() {
return this.getDateObj().toLocaleTimeString()
}
getDate() {
return this.getDateObj().toLocaleDateString()
}
getOfferAObjectsWithType() {
return this.getOfferObjectsWithType(this.offersA, this.partyA)
}
getOfferBObjectsWithType() {
return this.getOfferObjectsWithType(this.offersB, this.partyB)
}
getOfferObjectsWithType(e, t) {
const i = []
, s = o.IZ.gameState.getPlayerProfile(t);
for (const r in e)
e.hasOwnProperty(r) && i.push({
isProvince: this.isProvinceObject(Number(r)),
isRelation: this.isRelationsObject(Number(r)),
isMilitaries: this.isMilitariesObject(Number(r)),
isResource: this.isResourceObject(Number(r)),
tradeItemID: r,
value: g.Z.formatNumber(e[r]),
rawValue: e[r],
unitID: this.getUnitItemID(),
unitType: this.getTradedUnitType(r, e[r]),
faction: s.getFaction(),
stringValue: this.getOfferObjectAsString(r, e[r]),
innerID: e[r]
});
return i
}
getUnitItemID() {
if (this.unitType) {
const e = o.IZ.getMod().getUnitType(this.unitType);
if (e)
return e.getItemID()
}
return null
}
getTradedUnitType(e, t) {
if (this.isMilitariesObject(e)) {
let e = o.IZ.getMod().getUnitType(this.unitType);
if (!e) {
const i = this.getTradedArmy(t);
i && (e = i.getPaintedUnitType())
}
return e
}
return null
}
getOfferObjectAsString(e, t) {
let i = "";
switch (t = parseInt(t, 10),
e = parseInt(e, 10)) {
case a.S.Provinces:
const s = o.IZ.gameState.getMapState().getProvince(t);
null != s && (i = s.getName());
break;
case a.S.Relations:
i = u.N.getRelationsName(t);
break;
case a.S.Militaries:
const r = this.getTradedArmy(t);
null != r && (i = r.getName());
break;
default:
i = `${t} ${o.IZ.getMod().getResourceName(e)}`
}
return i
}
getTradedArmy(e) {
let t = o.IZ.gameState.getArmyState().getArmy(e);
if (null == t) {
const i = o.IZ.gameState.getSpyState().getSpyReport().getArmyState(o.IZ.gameState.getGameInfoState().getDayOfGame());
null != i && (t = i.getArmies()[e])
}
return t
}
isProvinceObject(e) {
return e === a.S.Provinces
}
isRelationsObject(e) {
return e === a.S.Relations
}
isMilitariesObject(e) {
return e === a.S.Militaries
}
isResourceObject(e) {
return e !== a.S.Militaries && e !== a.S.Relations && e !== a.S.Provinces
}
compareByDateObj(e) {
return this.getDateObj().getTime() - e.getDateObj().getTime()
}
getDateObj() {
return this.dateObj || (this.dateObj = new Date(n._c(this.timeStamp))),
this.dateObj
}
toSendable() {
const e = r()({}, this);
return e.offersA = l.M.objectToHashMap(e.offersA),
e.offersB = l.M.objectToHashMap(e.offersB),
e
}
isDeletedByCurrentPlayer() {
const {playerID: e} = o.IZ.config.userData;
return this.partyA == e && this.isDeletedBySender() || this.partyB == e && this.isDeletedByReceiver()
}
isReadByPlayer() {
const {playerID: e} = o.IZ.config.userData;
return e == this.partyA || this.isReadByReceiver()
}
isReadByReceiver() {
return this.readByReceiver
}
getOffersAAsString() {
return Object.entries(this.offersA).map((e=>{
let[t,i] = e;
return this.getOfferObjectAsString(t, i)
}
))
}
getOffersBAsString() {
return Object.entries(this.offersB).map((e=>{
let[t,i] = e;
return this.getOfferObjectAsString(t, i)
}
))
}
isSuccessful() {
return this.successful
}
}
c.SUCCEDED = !0,
c.FAILED = !1,
h.F.UltTradeOffer = c
}
,
26820: (e,t,i)=>{
i.d(t, {
s: ()=>n
});
var s = i(81177)
, r = i(58202);
class n {
constructor() {
this.stateType = s.V.STATE_TYPE_USER_OPTIONS_STATE,
this.options = {}
}
getOptionValue(e) {
return this.options[e] ?? 0
}
setOption(e, t) {
const i = this.getOptionValue(e);
return 0 == t ? delete this.options[e] : this.options[e] = t,
i
}
}
n.optionKeys = {
DONT_SHOW_SPLASH: "dontShowSplash",
TUTORIAL: "tutorial",
TUTORIAL_BETA: "tutorialBeta",
SLIM_DESIGN: "noSlimDesign",
OFFERSET: "premiumOfferSet",
NEWSPAPER_TIME: "newsTime",
ARMIES_REVEALED_TIME: "armiesRevealed",
SEEN_PROVINCE_CONQUER_QUEST_VIDEO: "seenProvinceConquerQuestVideo"
},
r.F.UltUserOptions = n
}
,
4325: (e,t,i)=>{
i.d(t, {
Y: ()=>a
});
var s = i(7686)
, r = i(32194)
, n = i(60182);
class a extends n.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltActivateGameAction",
this.selectedPlayerID = -1,
this.selectedTeamID = -1,
this.randomTeamAndCountrySelection = !1,
this.os = r.h.getOSNameAndMajorVersion(),
this.device = s.yn.getDeviceType(),
this.isMobileClient = hup.config.isMobileClient
}
static resultCodes = {
USER_NOT_FOUND: -3,
GAME_NOT_FOUND: -4,
USER_EXISTED: -5,
COUNTRY_SELECTION_REQUESTED: -6,
COUNTRY_SELECTION_IMPOSSIBLE: -7,
VACATION_MODE_ACTIVE: -8,
GAME_FULL: -9,
GAME_CREATION_IN_PROGRESS: -12
};
setSelectedPlayerID(e) {
this.selectedPlayerID = e
}
setSelectedTeamID(e) {
this.selectedTeamID = e
}
setRandomTeamAndCountrySelection(e) {
this.randomTeamAndCountrySelection = e
}
isRequestGameStateUpdate() {
return !1
}
}
}
,
98083: (e,t,i)=>{
i.d(t, {
D: ()=>n
});
var s = i(60182)
, r = i(13524);
class n extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltArmyAction"
}
setArmies(e) {
this.armies = r.M.arrayToLinkedList(e)
}
getArmies() {
return r.M.linkedListToArray(this.armies)
}
}
}
,
6126: (e,t,i)=>{
i.d(t, {
t: ()=>r
});
var s = i(60182);
class r extends s.A {
static MAX_MESSAGE_LENGTH = 400;
constructor(e, t) {
super(),
this["@c"] = "ultshared.action.UltBroadcastAction",
this.command = e,
this.arguments = t,
this.modID = hup.getMod(!1).getModID(),
this.lastMessageTimeInMilliseconds = null
}
isRequestGameStateUpdate() {
return !1
}
setLastMessageTimeInMilliseconds(e) {
this.lastMessageTimeInMilliseconds = e
}
}
}
,
99704: (e,t,i)=>{
i.d(t, {
W: ()=>n
});
var s = i(60182)
, r = i(13524);
class n extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltBuildQueueAction",
this.operation = 0,
this.sourceIndices = null,
this.targetOffset = 0,
this.entries = null,
this.requestGameStateUpdate = !0,
this.asynchronous = !0
}
setNewEntries(e) {
this.entries = r.M.arrayToVector(e),
this.operation = n.operations.OP_ADD_ENTRY
}
setMovedEntries(e, t) {
this.sourceIndices = r.M.arrayToVector(e),
this.targetOffset = t,
this.operation = n.operations.OP_MOV_ENTRY
}
setRemovedEntries(e) {
this.sourceIndices = r.M.arrayToVector(e),
this.operation = n.operations.OP_REM_ENTRY
}
setRemoveAllEntries() {
this.operation = n.operations.OP_REM_ALL_ENTRIES
}
}
n.operations = {
OP_ADD_ENTRY: 0,
OP_REM_ENTRY: 1,
OP_MOV_ENTRY: 2,
OP_REM_ALL_ENTRIES: 3
}
}
,
7308: (e,t,i)=>{
i.d(t, {
Z: ()=>r
});
i(72287),
i(42074),
i(64974),
i(50481),
i(69121);
var s = i(60182);
class r extends s.A {
constructor(e, t) {
super(),
this["@c"] = "ultshared.action.UltChangeRelationAction",
this.playerB = e,
this.relationType = t;
const i = new Uint8Array(this.relationType);
this.relationType = btoa(String.fromCharCode(i[0]))
}
}
}
,
26813: (e,t,i)=>{
i.d(t, {
V: ()=>n
});
var s = i(60182);
class r extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltCollectRewardAction"
}
}
class n extends r {
constructor(e) {
super(),
this["@c"] = "ultshared.action.UltCollectAdviserRewardAction",
this.adviseID = e
}
}
}
,
51894: (e,t,i)=>{
i.d(t, {
y: ()=>n
});
var s = i(60182)
, r = i(13524);
class n extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltGameEventsReadUserAction",
this.eventIds = r.M.arrayToLinkedList([])
}
setEventIds(e) {
this.eventIds = r.M.arrayToLinkedList(e)
}
}
}
,
19725: (e,t,i)=>{
i.d(t, {
H: ()=>n,
X: ()=>r
});
var s = i(60182);
class r extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltInGameAllianceAction"
}
execute() {
hup.inGameAllianceController.executeAction(this)
}
getSuccessText() {}
getApprovalText() {}
}
const n = {
NONE: -1,
ALLIANCE_CREATE: 0,
PLAYER_ACCEPTED: 1,
PLAYER_LEAVES: 2,
PLAYER_KICKED: 3,
PLAYER_APPLIES: 4,
LEADER_CHANGED: 5,
MODIFY: 6,
PLAYER_DECLINED: 9,
ALLIANCE_DISBAND: 10,
PLAYER_WITHDRAW_APPLICATION: 11,
INVITATION: 12,
INVITATION_ACCEPT: 13,
INVITATION_DECLINE: 14,
INVITATION_WITHDRAW: 15
}
}
,
6686: (e,t,i)=>{
i.d(t, {
Y: ()=>u
});
var s = i(60102)
, r = i(7686)
, n = i(32194)
, a = i(72390);
class o {
constructor() {
const e = {
renderQuality: void 0
};
(0,
a.S$)(e, "renderQuality", "RenderQuality"),
this["@c"] = "ultshared.action.UltSystemInfos",
this.os = n.h.getOSNameAndMajorVersion(),
this.device = r.yn.getDeviceType(),
this.browser = s.S.getBrowser(),
this.isMobileClient = hup.config.isMobileClient ?? !1,
this.deviceIdentifier = s.S.getDeviceIdentifier();
const {renderQuality: t} = e;
this.assetQuality = null == t ? void 0 : t.getAssetQualityLevel(),
this.mapQuality = null == t ? void 0 : t.getMapQualityLevel(),
this.gpuQuality = null == t ? void 0 : t.getGPULevel(),
this.memoryQuality = null == t ? void 0 : t.getMemoryLevel(),
this.source = hup.config.trackingSource
}
}
var l = i(60182);
class u extends l.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltLoginAction",
this.resolution = `${window.screen.width}x${window.screen.height}`,
this.sysInfos = new o
}
isRequestGameStateUpdate() {
return !1
}
}
}
,
93580: (e,t,i)=>{
i.d(t, {
k: ()=>n
});
var s = i(60182)
, r = i(13524);
class n extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltMessageAction",
this.newArticles = null,
this.updateArticles = null,
this.deleteArticles = null
}
setNewArticles(e) {
this.newArticles = r.M.arrayToVector(e)
}
setUpdateArticles(e) {
this.updateArticles = r.M.arrayToVector(e)
}
setDeleteArticles(e) {
this.deleteArticles = r.M.arrayToVector(e)
}
}
}
,
76789: (e,t,i)=>{
i.d(t, {
P: ()=>n
});
var s = i(60182)
, r = i(13524);
class n extends s.A {
constructor(e, t) {
let i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null;
super(),
this["@c"] = "ultshared.action.UltNewArticleAction",
this.rawArticle = e,
this.imageData = t,
this.imageName = i,
this.rawArticle.intercepted && (this.rawArticle.intercepted = r.M.arrayToVector(this.rawArticle.intercepted))
}
}
}
,
46544: (e,t,i)=>{
i.d(t, {
v: ()=>n
});
var s = i(60182)
, r = i(48375);
class n extends s.A {
constructor(e) {
super(),
this["@c"] = "ultshared.action.UltNextDayAction",
this.timejump = e
}
setData(e) {
this.timejump = e
}
getApprovalText() {
return "Are you sure that you want to start next day manually?"
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
isUseRealSiteUserInGuestMode() {
return !0
}
}
}
,
60315: (e,t,i)=>{
i.d(t, {
B: ()=>r
});
var s = i(60182);
class r extends s.A {
constructor(e) {
super(),
this["@c"] = "ultshared.action.UltOpenPlayerSlotAction",
this.removedPlayerID = e
}
}
}
,
80385: (e,t,i)=>{
i.d(t, {
F: ()=>r
});
var s = i(60182);
class r extends s.A {
constructor(e, t) {
super(),
this["@c"] = "ultshared.action.UltOrderAction",
this.order = e,
this.cancel = t
}
}
}
,
44581: (e,t,i)=>{
i.d(t, {
F: ()=>a
});
var s = i(7686)
, r = i(32194)
, n = i(60182);
class a extends n.A {
constructor(e, t, i) {
if (super(),
this["@c"] = "ultshared.action.UltPremiumAction",
this.premiumID = e,
this.option = t,
this.provinceID = -1,
this.slotID = 0,
this.offerID = i,
this.siteUserID = hup.config.userData.siteUserID,
!this.offerID) {
const e = hup.gameState.getPremiumState().getOfferForPremium(this.premiumID);
this.offerID = e.getItemID()
}
this.isInternal = !1,
this.os = r.h.getOSNameAndMajorVersion(),
this.device = s.yn.getDeviceType(),
this.source = hup.config.trackingSource
}
setProvinceID(e) {
this.provinceID = e
}
getProvinceID() {
return this.provinceID
}
setSlotID(e) {
this.slotID = e
}
getSlotID() {
return this.slotID
}
getPremiumID() {
return this.premiumID
}
getOption() {
return this.option
}
setOption(e) {
this.option = e
}
setOfferID(e) {
this.offerID = e
}
getOfferID() {
return this.offerID
}
setInternal(e) {
this.isInternal = e
}
}
}
,
63971: (e,t,i)=>{
i.d(t, {
H: ()=>r
});
var s = i(60182);
class r extends s.A {
constructor(e) {
super(),
this["@c"] = "ultshared.action.UltResearchAction",
this.researchID = e,
this.cancel = !1
}
setCancel(e) {
this.cancel = !!e
}
}
}
,
92787: (e,t,i)=>{
i.d(t, {
s: ()=>r
});
var s = i(60182);
class r extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltRetireAction"
}
}
}
,
99829: (e,t,i)=>{
i.d(t, {
B: ()=>n
});
var s = i(60182)
, r = i(13524);
class n extends s.A {
constructor(e, t) {
super(),
this["@c"] = "ultshared.action.UltSpyAction",
this.updatedSpies = null !== e ? r.M.arrayToVector(e) : null,
this.numRecruit = t
}
}
}
,
68339: (e,t,i)=>{
i.d(t, {
n: ()=>r
});
var s = i(60182);
class r extends s.A {
static CREATE_OFFER = 0;
static ACCEPT_OFFER = 1;
static REFUSE_OFFER = 2;
static DELETE_OFFER = 3;
static READ_OFFER = 4;
constructor() {
super(),
this["@c"] = "ultshared.action.UltTradeOfferAction"
}
initNewOffer(e) {
this.flag = r.CREATE_OFFER,
this.tradeOfferID = -1,
this.tradeOffer = e
}
initResponse(e, t) {
this.flag = t,
this.tradeOfferID = e,
this.tradeOffer = null
}
}
}
,
3883: (e,t,i)=>{
i.d(t, {
e: ()=>n
});
i(10711);
var s = i(60182)
, r = i(13524);
class n extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltUpdateGameStateAction",
this.stateType = 0,
this.stateID = "0",
this.addStateIDsOnSent = !1,
this.option = null,
this.actions = null,
this.lastCallDuration = 0
}
setAutoPolling(e) {
this.autoPolling = !!e
}
isAutoPolling() {
return !!this.autoPolling
}
setLastCallDuration(e) {
this.lastCallDuration = e
}
setActions(e) {
if (!(e && e instanceof Array))
throw new Error("UltUpdateGameStateAction.prototype.setActions expects an array of actions.");
this.actions = r.M.arrayToLinkedList(e)
}
getActions() {
return this.actions ? r.M.linkedListToArray(this.actions) : []
}
addUpdateStateIDs() {
this.addStateIDsOnSent = !0
}
isAddUpdateStateIDs() {
return this.addStateIDsOnSent
}
initStateIDs() {
const e = {}
, t = {}
, i = hup.gameState.states;
let s = !1
, n = !1;
for (const r in i)
if (i.hasOwnProperty(r)) {
const a = i[r]
, {stateType: o} = a;
a.stateID && o && (s = !0,
e[o] = a.stateID,
a.useTstamp && (t[o] = a.timeStamp,
n = !0))
}
s && (this.stateIDs = r.M.objectToHashMap(e)),
n && (this.tstamps = r.M.objectToHashMap(t)),
delete this.addStateIDsOnSent,
delete this.autoPolling,
delete this.stateType,
delete this.stateID,
this.option || delete this.option,
this.actions || delete this.actions
}
static wrapActions(e) {
const t = new this;
return t.setActions(e),
t
}
isRequestGameStateUpdate() {
return !1
}
getClassNameForLogging() {
let e = "";
const t = this.getActions();
return e = t && t.length ? t.length > 1 ? "CombinedAction" : this.getActions()[0]["@c"] : this["@c"],
e
}
isUseRealSiteUserInGuestMode() {
return this.getActions().some((e=>{
var t;
return null === (t = e.isUseRealSiteUserInGuestMode) || void 0 === t ? void 0 : t.call(e)
}
))
}
}
}
,
6366: (e,t,i)=>{
i.d(t, {
l: ()=>r
});
var s = i(60182);
class r extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltUpdateProfileAction",
this.imageData = null,
this.flagImageData = null,
this.useSquareSizeForPlayerImage = hup.config.useSquareSizeForPlayerImage,
this.profile = hup.gameState.getPlayerState().getPlayer(hup.config.userData.playerID),
this.profile.flagImage = null,
this.profile.playerImage = null
}
}
}
,
1205: (e,t,i)=>{
i.d(t, {
r: ()=>n
});
var s = i(60182)
, r = i(13524);
class n extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.UltUpdateProvinceAction",
this.provinceIDs = [],
this.slot = 0
}
setMode(e) {
this.mode = e
}
setUpgrade(e) {
this.upgrade = e
}
setSlot(e) {
this.slot = e
}
setProvinceIDs(e) {
this.provinceIDs = r.M.arrayToVector(e)
}
setDeploymentTarget(e) {
this.deploymentTarget = e
}
}
n.modes = {
PROVINCE: 0,
UPGRADE: 1,
SPECIAL_UNIT: 2,
CANCEL_PRODUCING: 3,
CANCEL_BUILDING: 4,
DEPLOYMENT_TARGET: 5
}
}
,
60182: (e,t,i)=>{
i.d(t, {
A: ()=>s
});
class s {
constructor() {
this.requestID = ""
}
setRequestID(e) {
this.requestID = e
}
getRequestID() {
return this.requestID
}
isRequestGameStateUpdate() {
return !0
}
isUseRealSiteUserInGuestMode() {
return !1
}
}
}
,
71158: (e,t,i)=>{
i.d(t, {
f: ()=>r
});
var s = i(60182);
class r extends s.A {
provinces = [];
armies = [];
researches = [];
constructor(e, t) {
let i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
super(),
this["@c"] = "UsePremiumAction",
this.premiumID = e,
this.amount = t ?? 1,
this.setOptions(i)
}
setOptions(e) {
e && (this.armies = e.armies ?? [],
this.provinces = e.provinces ?? [],
this.researches = e.researches ?? [])
}
}
}
,
54190: (e,t,i)=>{
i.d(t, {
L: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
timeScale = 1;
constructor() {
super(),
Object.assign(this, {
"@c": "ultshared.action.admin.ChangeTimeScaleAdminAction"
})
}
setData(e) {
this.timeScale = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_BYTRO_ADMIN
}
}
}
,
31265: (e,t,i)=>{
i.d(t, {
N: ()=>l
});
i(87477);
var s = i(39513)
, r = i(70875)
, n = i(48375)
, a = i(66925)
, o = i(25567);
class l extends r.f {
researchId = void 0;
playerId = void 0;
constructor() {
super(),
this["@c"] = "ultshared.action.admin.GrantResearchToPlayerAdminAction"
}
setData(e) {
this.setSelectedPlayerID(e),
this.playerId = e
}
interact() {
this._showChoosePlayerDialog()
}
_showChoosePlayerDialog() {
const e = s.IZ.getMod()
, t = s.IZ.gameState.getPlayerState().getPlayer(this.playerId).getFaction()
, i = Object.values(e.getResearchTypes()).filter((i=>(e.hasFactionSpecificBalancing() && i.getFactions().includes(t)) ?? !0)).map((e=>({
text: `${e.getName()}-${e.getTier()}`,
value: e.getItemID(),
obj: e
})));
i.push({
text: " All"
}),
a.M.showInput("Grant Research", "Select Research", "null", {
onConfirm: e=>{
this.researchId = e,
s.IZ.adminActionController.trigger(this)
}
,
inputType: o.a.combo,
inputData: i
})
}
getMinimumAdminLevel() {
return n.K.ADMIN_LEVEL_BYTRO_ADMIN
}
}
}
,
73027: (e,t,i)=>{
i.d(t, {
L: ()=>n
});
var s = i(45816)
, r = i(48375);
class n extends s.w {
playerGroup = null;
constructor() {
super(),
this["@c"] = "ultshared.action.admin.GrantResearchToPlayersGroupAdminAction"
}
setData(e) {
this.playerGroup = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_BYTRO_ADMIN
}
}
}
,
98356: (e,t,i)=>{
i.d(t, {
x: ()=>l
});
i(87477);
var s = i(39513)
, r = i(70875)
, n = i(48375)
, a = i(66925)
, o = i(25567);
class l extends r.f {
locationID = 0;
enemyID = void 0;
constructor() {
super(),
this["@c"] = "ultshared.action.admin.InvadeAdminAction"
}
setData(e, t, i) {
this.setSelectedPlayerID(e),
this.locationID = t,
this.enemyID = i
}
interact() {
this._showChoosePlayerDialog()
}
_showChoosePlayerDialog() {
const e = Object.values(s.IZ.gameState.getPlayerState().getPlayers()).filter((e=>!e.isDefeated() && e.getPlayerID() > 0)).map((e=>({
text: `${e.getNationName()} | ${e.getName()}`,
value: e.getPlayerID()
})));
e.push({
text: " All"
}),
a.M.showInput("Invade countries", "Select country to be invaded", "null", {
onConfirm: e=>{
this.enemyID = e,
s.IZ.adminActionController.trigger(this)
}
,
inputType: o.a.combo,
inputData: e
})
}
getMinimumAdminLevel() {
return n.K.ADMIN_LEVEL_BYTRO_ADMIN
}
}
}
,
45816: (e,t,i)=>{
i.d(t, {
w: ()=>r
});
var s = i(60182);
class r extends s.A {
static Type = {
KILL_SERVER: 0,
ADMIN_VERIFICATION: 2,
VIEW_INTERNALS: 3,
START_NEXT_DAY: 4,
CHANGE_ANTI_CHEAT: 5,
EXECUTE_ADMIN_ACTION: 6
};
constructor() {
super(),
this.task = null,
this.playerName = null,
this.ticketID = null,
this.playerID = null,
this.task = r.Type.EXECUTE_ADMIN_ACTION,
this.sendMailToUsers = !1
}
getMinimumAdminLevel() {}
isRequestGameStateUpdate() {
return !1
}
setPlayerName(e) {
this.playerName = e
}
validateInteger(e) {
return (e += "").match(new RegExp("^-?[0-9]+$"))
}
getApprovalText() {
return ""
}
}
}
,
62010: (e,t,i)=>{
i.d(t, {
g: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltAdminMADRecordInquiryAction",
this.userIDToSearch = null
}
setData(e) {
this.userIDToSearch = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
79766: (e,t,i)=>{
i(70875)
}
,
30281: (e,t,i)=>{
i.d(t, {
n: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltAdminWhiteListPairInquiryAction",
this.siteUserID1 = null,
this.siteUserID2 = null
}
setData(e, t) {
this.siteUserID1 = e,
this.siteUserID2 = t
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
12146: (e,t,i)=>{
i.d(t, {
M: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltAlterCoalitionAdminAction",
this.allianceID = null,
this.name = null,
this.description = null,
this.flag = null,
this.capImageToMaxSize = hup.config.canCreateCoalitionImages
}
setData(e, t, i, s) {
this.allianceID = e,
this.name = t,
this.description = i,
(!s || s && (s.indexOf("http://") > -1 || s.indexOf("https://") > -1)) && (s = ""),
this.flag = s
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
6854: (e,t,i)=>{
i.d(t, {
H: ()=>a
});
var s = i(70875)
, r = i(48375)
, n = i(66925);
class a extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltBanPlayerAdminAction"
}
setData(e, t) {
this.setSelectedPlayerID(e),
this.setReason(t)
}
interact() {
const e = this;
hup.gameState.getPlayerState().getPlayer(this.selectedPlayerID).getBanned() ? hup.adminActionController.trigger(this) : n.M.showInput("Why do you want to BAN this player?", "Enter the reason", "", {
onConfirm(t) {
e.setReason(t),
hup.adminActionController.trigger(e)
}
})
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
87401: (e,t,i)=>{
i.d(t, {
z: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltChangeAntiCheatAdminAction",
this.newAntiCheatLevel = null
}
setData(e) {
this.newAntiCheatLevel = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
40073: (e,t,i)=>{
i.d(t, {
s: ()=>u
});
i(87477);
var s = i(39513)
, r = i(70875)
, n = i(13524)
, a = i(48375)
, o = i(66925)
, l = i(25567);
class u extends r.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltChangeArmyAdminAction",
this.deleteMode = null,
this.armyID = null,
this.locationID = null,
this.unitChangeSet = null
}
setData(e, t, i, s, r) {
this.setSelectedPlayerID(e),
this.deleteMode = t,
this.armyID = i,
this.locationID = s,
this.unitChangeSet = r
}
interact() {
this._showArmySelection()
}
_showArmySelection() {
const e = s.IZ.gameState.getArmyState().getNationArmies(this.selectedPlayerID)
, t = [];
this.deleteMode || t.push({
text: "Create New Army",
value: -1
});
for (const i in e)
if (e.hasOwnProperty(i)) {
const r = e[i];
let n = r.getGroupName();
if (r.isStationary()) {
n += ` (${s.IZ.gameState.getMapState().getLocation(r.getLocationID()).getName()})`
}
t.push({
text: n,
value: r.getArmyID()
})
}
o.M.showInput(this.deleteMode ? "Delete Army" : "Add Unit", "Select an army", null, {
onConfirm: this.deleteMode ? this._setDeletionData.bind(this) : this._handleArmySelected.bind(this),
inputType: l.a.combo,
inputData: t
})
}
_handleArmySelected(e) {
if (-1 == e) {
const e = []
, t = s.IZ.gameState.getMapState().getPlayerProvinces();
for (let i = 0; i < t.length; i++) {
const s = t[i];
e.push({
text: s.name,
value: s.getLocationID()
})
}
o.M.showInput("Location", "Select a location for army creation", null, {
onConfirm: this._setLocationData.bind(this),
inputType: l.a.combo,
inputData: e
})
} else
this.armyID = e,
this._showAddUnitDialog()
}
_showAddUnitDialog() {
const e = s.IZ.gameState.getPlayerProfile(this.selectedPlayerID).getFaction()
, t = s.IZ.getMod()
, i = {
comboText: "Select a unit type",
comboValues: Object.values(t.getUnitTypes()).map((i=>t.getFactionSpecificUnitType(i, e))).map((e=>({
text: e.getTypeName(),
value: e.getStatsColumnID()
})))
};
o.M.showInput("Add Unit", "Select unit type to add", "0", {
onConfirm: e=>{
this.unitChangeSet = n.M.objectToHashMap({}),
this.unitChangeSet[Number(e.selection)] = Number(e.value),
s.IZ.adminActionController.trigger(this)
}
,
inputType: l.a.textWithCombo,
inputData: i
})
}
_setLocationData(e) {
this.locationID = e,
this._showAddUnitDialog()
}
_setDeletionData(e) {
this.armyID = e,
s.IZ.adminActionController.trigger(this)
}
getMinimumAdminLevel() {
return a.K.ADMIN_LEVEL_ADMIN
}
}
}
,
30010: (e,t,i)=>{
i.d(t, {
z: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltChangeCommentAdminAction",
this.newComment = null
}
setData(e) {
this.newComment = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
84048: (e,t,i)=>{
i.d(t, {
t: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltChangeGameAdminAction",
this.newAdminsPlayerID = null
}
setData(e) {
this.newAdminsPlayerID = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
32010: (e,t,i)=>{
i.d(t, {
J: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltChangeOpenSlotsAdminAction",
this.newOpenSlots = null
}
setData(e) {
this.newOpenSlots = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_ADMIN
}
}
}
,
37027: (e,t,i)=>{
i.d(t, {
Q: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltChangePasswordAdminAction",
this.newPassword = null
}
setData(e) {
this.newPassword = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
66460: (e,t,i)=>{
i.d(t, {
Y: ()=>u
});
i(87477);
var s = i(39513)
, r = i(70875)
, n = i(48375)
, a = i(4563)
, o = i(66925)
, l = i(25567);
class u extends r.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltChangeProvinceAdminAction",
this.provinceID = null,
this.upgradeID = null,
this.newUpgradeCondition = null,
this.chargeResources = null,
this._targetProvince = null,
this._targetUpgrade = null
}
setData(e, t, i, s, r) {
this.setSelectedPlayerID(e),
this.provinceID = t,
this.upgradeID = i,
this.newUpgradeCondition = s,
this.chargeResources = r
}
interact() {
this._showProvinceDialog()
}
_showProvinceDialog() {
const e = []
, t = s.IZ.gameState.getMapState().getProvincesForPlayer(this.selectedPlayerID);
for (let i = 0; i < t.length; i++) {
const s = t[i];
e.push({
text: `${s.getName()} (LID: ${s.getLocationID()})`,
value: s.getLocationID()
})
}
o.M.showInput("Select a Province", "Select a province to modify", "0", {
onConfirm: this._showUpgradeDialog.bind(this),
inputType: l.a.combo,
inputData: e
})
}
_showUpgradeDialog(e) {
this.provinceID = e;
const t = []
, i = s.IZ.gameState.getMapState().getProvince(e);
this._targetProvince = i.reducedClone();
const r = this._targetProvince
, n = []
, u = s.IZ.getMod().getUpgrades();
for (const s in u)
if (u.hasOwnProperty(s)) {
const e = u[s].getItemID();
let i = r.getUpgrade(e);
if (i || (i = new ultshared.upgrades.UltModableUpgrade,
i.initDummy(e, !1),
i.setCondition(0)),
i.hasFeature(a.M.STATUS_CHANGE))
continue;
n.push(i),
t.push({
text: `${i.getName()} (tier ${i.getTier()})`,
value: i.getUpgradeID()
})
}
this._targetProvince.setUpgrades(n),
o.M.showInput("Modify Upgrade", "Select an upgrade to modify", "0", {
onConfirm: this._showModifyUpgradeDialog.bind(this),
inputType: l.a.combo,
inputData: t
})
}
_showModifyUpgradeDialog(e) {
this.upgradeID = e;
const t = this._targetProvince.getUpgrade(e);
this._targetUpgrade = t,
o.M.showInput("Modify Condition", `Condition of ${t.getName()} (${t.getUpgradeType().getBuildCondition()} per level, max ${t.getUpgradeType().getMaxCondition()}, 0 to remove):`, `${t.getCondition()}`, {
onConfirm: this._setUpgradeCondition.bind(this),
inputType: l.a.text
})
}
_setUpgradeCondition(e) {
this.newUpgradeCondition = e;
this._targetUpgrade.setCondition(e),
o.M.showConfirm("One last thing...", "Charge/Refund resources?", "", {
confirmText: "Yes",
showCancelButton: !0,
onConfirm: this._finalize.bind(this, !0),
allowClose: !1,
onCancel: this._finalize.bind(this, !1),
cancelText: "No"
})
}
_finalize(e) {
this.chargeResources = e,
this._targetProvince = null,
this._targetUpgrade = null,
s.IZ.adminActionController.trigger(this)
}
getMinimumAdminLevel() {
return n.K.ADMIN_LEVEL_ADMIN
}
}
}
,
5472: (e,t,i)=>{
i.d(t, {
q: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltChangeTitleAdminAction",
this.newTitle = null
}
setData(e) {
this.newTitle = e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
19665: (e,t,i)=>{
i.d(t, {
U: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltDeleteArticleAdminAction",
this.articleDay = null,
this.articleID = null
}
setData(e, t) {
this.articleDay = e,
this.articleID = t
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
34552: (e,t,i)=>{
i.d(t, {
k: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltForceEndOfGameAdminAction"
}
getApprovalText() {
return "Are you sure that you want to end the game?"
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
56861: (e,t,i)=>{
i.d(t, {
R: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltKillServerAdminAction"
}
setData() {}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_ADMIN
}
getApprovalText() {
return "Are you sure that you would like to delete this game? IT CANNOT BE REVERTED!"
}
}
}
,
43552: (e,t,i)=>{
i.d(t, {
y: ()=>l
});
var s = i(70875);
class r extends s.f {
constructor() {
super(),
this.targetSiteUserID = -1
}
setTargetUserID(e) {
this.targetSiteUserID = e
}
}
var n = i(48375)
, a = i(66925)
, o = i(25567);
class l extends r {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltMADOverrideStatusAdminAction",
this.newStatus = null,
this.enableIfDisabled = null
}
setData(e, t, i) {
this.setTargetUserID(e),
this.newStatus = t,
this.enableIfDisabled = i
}
interact() {
const e = [{
text: "Reset",
value: ultshared.UltMadEntryStatus.indexOf("Clean")
}, {
text: "Reset & Ignore",
value: ultshared.UltMadEntryStatus.indexOf("Ignored")
}]
, t = this;
a.M.showConfirm("Hello", "You can change the MAD status of this user. Here are the options: <br>- Reset: Resets the entry contents of the user and marks it as 'Clean'<br>- Reset & Ignore: Resets the entry contents, prevents this user from getting banned again by MAD and marks it as 'Ignored'<br><br> No matter what you chose, this user will be enabled (unbanned) and <b>entry contents will be reset.</b>", null, {
confirmText: "Continue",
showCancelButton: !0,
onConfirm() {
a.M.showInput("Select Operation", "", hup.config.userData.siteUserID, {
onConfirm(e) {
t.newStatus = e,
t.enableIfDisabled = !0,
hup.adminActionController.trigger(t)
},
inputType: o.a.combo,
inputData: e
})
},
allowClose: !0
})
}
getMinimumAdminLevel() {
return n.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
44540: (e,t,i)=>{
i.d(t, {
N: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltPauseAdminAction",
this.allGames = !1,
this.mode = 0
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_DEVELOPER
}
}
}
,
70875: (e,t,i)=>{
i.d(t, {
f: ()=>r
});
var s = i(45816);
class r extends s.w {
selectedPlayerID = -1;
reason = null;
setSelectedPlayerID(e) {
this.selectedPlayerID = e
}
setReason(e) {
this.reason = e
}
getSelectedPlayerID() {
return this.selectedPlayerID
}
}
}
,
17384: (e,t,i)=>{
i.d(t, {
V: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltReinitServerFromDBAdminAction"
}
getApprovalText() {
return "Server will reinitialize itself from the database? Is that OK ?"
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
16986: (e,t,i)=>{
i.d(t, {
l: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltRemoveShipsFromLandAdminAction"
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
getApprovalText() {
return "Checks and fixes if units are on land or if airfield status is incorrect. Continue?"
}
}
}
,
10009: (e,t,i)=>{
i.d(t, {
q: ()=>a
});
var s = i(70875)
, r = i(48375)
, n = i(66925);
class a extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltReplacePlayerAdminAction",
this.refund = null,
this.newSiteUserID = null,
this.newLoginName = null
}
setData(e, t, i, s) {
this.setSelectedPlayerID(e),
this.refund = t,
this.newSiteUserID = i,
this.newLoginName = s
}
interact() {
this._askSiteUserID()
}
_askSiteUserID() {
const e = this;
n.M.showInput("Specify new player", "The new player's siteuser ID (leave blank to just open the slot):", "", {
onConfirm(t) {
t.length > 0 ? (e.newSiteUserID = Number(t),
e._askPlayerName()) : e._askGoldRound()
}
})
}
_askPlayerName() {
const e = this;
n.M.showInput("Specify new player", "The new player's login name (can be left blank):", "", {
onConfirm(t) {
e.newLogiName = t,
e._askGoldRound()
}
})
}
_askGoldRound() {
if (hup.gameState.getGameInfoState().isGoldRound()) {
const e = this;
e.refund = !1,
n.M.showConfirm("Money Refund", "Refund Gold Round start money?", null, {
showCancelButton: !0,
onConfirm() {
e.refund = !0,
hup.adminActionController.trigger(e)
},
allowClose: !1,
onCancel() {
hup.adminActionController.trigger(e)
},
cancelText: "No"
})
} else
hup.adminActionController.trigger(this)
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
98753: (e,t,i)=>{
i.d(t, {
x: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltResetArmiesAdminAction"
}
getApprovalText() {
return "This will remove all land units back into the player's territory. Do you want to go ahead?"
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_DEVELOPER
}
}
}
,
11529: (e,t,i)=>{
i.d(t, {
w: ()=>a
});
var s = i(45816)
, r = i(48375)
, n = i(66925);
class a extends s.w {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltResetGameAdminAction",
this.newStartTimeSecs = Date.now() / 1e3 - 300,
this.newEndTimeSecs = 0,
this.resetCountries = !0
}
setData() {}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_DEVELOPER
}
isRequestGameStateUpdate() {
return !0
}
getApprovalText() {
return "Are you sure that you would like to restart this game?\nTHIS CANNOT BE REVERTED!"
}
handleSuccess() {
n.M.showMessage("Game has been reset. Will reload in 3 seconds", "Well Done!"),
setTimeout((()=>window.location.reload()), 3e3)
}
}
}
,
10490: (e,t,i)=>{
i.d(t, {
c: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltResetPlayerAdminAction",
this.resetMessages = !1,
this.resetProfile = !1
}
setData(e, t, i) {
this.setSelectedPlayerID(e),
this.resetMessages = t,
this.resetProfile = i
}
getApprovalText() {
return "Are you sure that you want to reset this player's messages/articles/customizations?"
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
23864: (e,t,i)=>{
i.d(t, {
o: ()=>l
});
i(87477);
var s = i(70875)
, r = i(46707)
, n = i(48375)
, a = i(66925)
, o = i(25567);
class l extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltSetBetaLevelAction",
this.betaLevel = null
}
setData(e) {
this.betaLevel = e
}
interact() {
const e = []
, t = r.H.GameLevels;
for (const i in t)
if (t.hasOwnProperty(i)) {
const s = t[i];
e.push({
text: i.toString(),
value: s
})
}
a.M.showInput("Set Beta Level", "Select a level to set: ", "0", {
onConfirm: this.handleLevelSelected.bind(this),
inputType: o.a.combo,
inputData: e
})
}
getApprovalText() {
return "Are you sure that you want to change this game's level ?"
}
handleLevelSelected(e) {
this.betaLevel = e,
hup.adminActionController.trigger(this)
}
getMinimumAdminLevel() {
return n.K.ADMIN_LEVEL_BYTRO_ADMIN
}
}
}
,
79225: (e,t,i)=>{
i.d(t, {
R: ()=>l
});
i(87477);
var s = i(61809)
, r = i(70875)
, n = i(48375)
, a = i(66925)
, o = i(25567);
class l extends r.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltSetCountryAndTeamAdminAction",
this.newPlayerID = null,
this.newTeamID = null
}
setData(e, t, i) {
this.setSelectedPlayerID(e),
this.newPlayerID = t,
this.newTeamID = i
}
interact() {
const e = hup.gameState.getPlayerState().getFilteredPlayers(!0, !0, 0)
, t = [];
for (let i = 0; i < e.length; i++) {
const s = e[i];
s.isTaken || t.push({
value: s.playerID,
text: `${s.getNationName()} (PID: ${s.playerID})`,
selected: s.playerID == this.selectedPlayerID
})
}
a.M.showInput("Change Country", "Select county to assign", "0", {
onConfirm: this.handleCountrySelected.bind(this),
inputType: o.a.combo,
inputData: t
})
}
handleCountrySelected(e) {
this.newPlayerID = e;
const t = hup.gameState.getPlayerState().getTeams()
, i = hup.gameState.getPlayerProfile(this.selectedPlayerID).getTeamID();
if (hup.gameState.getGameInfoState().isDynamicTeamGame() || (0,
s.Ew)(t))
this.handleTeamSelected(-2147483648);
else {
const e = [];
for (const s in t)
if (t.hasOwnProperty(s)) {
const r = t[s];
e.push({
value: s,
text: `${r.getTeamName()} (TID: ${s})`,
selected: s == i
})
}
a.M.showInput("Change Team", "Select team to assign", "0", {
onConfirm: this.handleTeamSelected.bind(this),
inputType: o.a.combo,
inputData: e
})
}
}
handleTeamSelected(e) {
this.newTeamID = e,
hup.adminActionController.trigger(this)
}
getMinimumAdminLevel() {
return n.K.ADMIN_LEVEL_ADMIN
}
}
}
,
50439: (e,t,i)=>{
i.d(t, {
M: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltSetRankedAdminAction",
this.ranked = null
}
setData(e) {
this.ranked = "true" == e
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
6191: (e,t,i)=>{
i.d(t, {
v: ()=>l
});
i(87477);
var s = i(70875)
, r = i(13524)
, n = i(48375)
, a = i(66925)
, o = i(25567);
class l extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltSetResourceProfileAction"
}
setData(e) {
this.setSelectedPlayerID(e),
this.resourceChangeSet = null
}
interact() {
const e = this
, t = []
, i = hup.getMod().getResourceEntries();
for (const r in i)
if (i.hasOwnProperty(r)) {
const e = i[r];
t.push({
text: e.getName(),
value: e.getResourceID()
})
}
const s = {
comboText: "Select a resource",
comboValues: t
};
a.M.showInput("Modify Resource", "Select resource type to modify", "0", {
onConfirm(t) {
e.resourceChangeSet = r.M.objectToHashMap({}),
e.resourceChangeSet[parseInt(t.selection)] = parseInt(t.value),
hup.adminActionController.trigger(e)
},
inputType: o.a.textWithCombo,
inputData: s
})
}
getMinimumAdminLevel() {
return n.K.ADMIN_LEVEL_ADMIN
}
}
}
,
52746: (e,t,i)=>{
i.d(t, {
a: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltStartGameAdminAction"
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
68239: (e,t,i)=>{
i.d(t, {
o: ()=>n
});
var s = i(70875)
, r = i(48375);
class n extends s.f {
constructor() {
super(),
this["@c"] = "ultshared.action.admin.UltWhitelistPlayerAdminAction",
this.whitelistLevel = 0,
this.siteUserID1 = null,
this.siteUserID2 = null
}
setData(e, t, i) {
this.whitelistLevel = e,
this.siteUserID1 = t,
this.siteUserID2 = i
}
getApprovalText() {
let e = "whitelisted";
return -1 === this.whitelistLevel ? e = "blacklisted" : 0 === this.whitelistLevel && (e = "neutral"),
`Are you sure that you would like to make these two players ${e} for future events?`
}
getMinimumAdminLevel() {
return r.K.ADMIN_LEVEL_GAME_OP
}
}
}
,
80748: (e,t,i)=>{
i.d(t, {
n: ()=>r
});
var s = i(19725);
class r extends s.X {
constructor() {
super(),
this.allianceAction = s.H.PLAYER_ACCEPTED,
this.targetPlayerID = null
}
setData(e, t) {
this.allianceID = e,
this.targetPlayerID = t
}
getApprovalText() {
return hup.i18n.gettext("Are you sure that you would like to accept this player to your coalition?")
}
}
}
,
80932: (e,t,i)=>{
i.d(t, {
I: ()=>r
});
var s = i(19725);
class r extends s.X {
constructor() {
super(),
this.allianceAction = s.H.PLAYER_APPLIES,
this.allianceID = null
}
setData(e) {
this.allianceID = e
}
getApprovalText() {
return hup.i18n.gettext("Are you sure that you want to apply to this coalition?")
}
getSuccessText() {
return hup.i18n.gettext("You have successfully applied for this coalition.")
}
}
}
,
54986: (e,t,i)=>{
i.d(t, {
Z: ()=>r
});
var s = i(19725);
class r extends s.X {
constructor() {
super(),
this.allianceAction = s.H.LEADER_CHANGED,
this.allianceID = null,
this.targetPlayerID = null
}
setData(e, t) {
this.allianceID = e,
this.targetPlayerID = t
}
getApprovalText() {
return hup.i18n.gettext("Are you sure that you want to change the leader of this coalition?")
}
}
}
,
20536: (e,t,i)=>{
i.d(t, {
v: ()=>r
});
var s = i(19725);
class r extends s.X {
constructor() {
super(),
this.allianceAction = s.H.ALLIANCE_CREATE,
this.allianceName = null,
this.allianceDescription = null,
this.allianceFlagBase64 = null,
this.capImageToMaxSize = hup.config.canCreateCoalitionImages
}
setData(e, t, i) {
this.allianceName = e,
this.allianceDescription = t,
this.allianceFlagBase64 = i
}
getApprovalText() {
return hup.i18n.gettext("Do you really want to create this coalition?")
}
}
}
,
71796: (e,t,i)=>{
i.d(t, {
N: ()=>r
});
var s = i(19725);
class r extends s.X {
constructor() {
super(),
this.allianceAction = s.H.PLAYER_DECLINED,
this.allianceID = null,
this.targetPlayerID = null,
this.reason = null
}
setData(e, t, i) {
this.allianceID = e,
this.targetPlayerID = t,
this.reason = i
}
getApprovalText() {
return hup.i18n.gettext("Do you really want to decline this application?")
}
}
}
,
3746: (e,t,i)=>{
i.d(t, {
D: ()=>r
});
var s = i(19725);
class r extends s.X {
constructor() {
super(),
this.allianceAction = s.H.ALLIANCE_DISBAND,
this.allianceID = null
}
setData(e) {
this.allianceID = e
}
getApprovalText() {
return hup.i18n.gettext("Are you sure that you want to disband this coalition? This action CANNOT BE REVERTED.")
}
}
}
,
24190: (e,t,i)=>{
i.d(t, {
G: ()=>n
});
var s = i(39513)
, r = i(19725);
class n extends r.X {
allianceAction = r.H.INVITATION_ACCEPT;
allianceID = 0;
setData(e) {
this.allianceID = e
}
getApprovalText() {
return s.IZ.i18n.gettext("Are you sure that you want to accept the invitation?")
}
getSuccessText() {
return s.IZ.i18n.gettext("Invitation accepted.")
}
}
}
,
59931: (e,t,i)=>{
i.d(t, {
p: ()=>n
});
var s = i(39513)
, r = i(19725);
class n extends r.X {
allianceAction = r.H.INVITATION_DECLINE;
allianceID = 0;
setData(e) {
this.allianceID = e
}
getApprovalText() {
return s.IZ.i18n.gettext("Are you sure that you want to decline the invitation?")
}
getSuccessText() {
return s.IZ.i18n.gettext("Invitation declined.")
}
}
}
,
73604: (e,t,i)=>{
i.d(t, {
q: ()=>n
});
var s = i(39513)
, r = i(19725);
class n extends r.X {
allianceAction = r.H.INVITATION;
allianceID = 0;
setData(e, t) {
this.allianceID = e,
this.targetPlayerID = t
}
getApprovalText() {
return s.IZ.i18n.gettext("Are you sure that you want to invite this player to the coalition?")
}
getSuccessText() {
return s.IZ.i18n.gettext("Invitation has been sent.")
}
}
}
,
9595: (e,t,i)=>{
i.d(t, {
b: ()=>n
});
var s = i(39513)
, r = i(19725);
class n extends r.X {
allianceAction = r.H.INVITATION_WITHDRAW;
allianceID = 0;
setData(e, t) {
this.allianceID = e,
this.targetPlayerID = t
}
getApprovalText() {
return s.IZ.i18n.gettext("Are you sure that you want to withdraw the invitation?")
}
getSuccessText() {
return s.IZ.i18n.gettext("Invitation withdrawn.")
}
}
}
,
25666: (e,t,i)=>{
i.d(t, {
y: ()=>r
});
var s = i(19725);
class r extends s.X {
constructor() {
super(),
this.allianceAction = s.H.PLAYER_KICKED,
this.allianceID = null,
this.targetPlayerID = null
}
setData(e, t) {
this.allianceID = e,
this.targetPlayerID = t
}
getApprovalText() {
return hup.i18n.gettext("Are you sure that you want to kick this player from the coalition?")
}
}
}
,
38853: (e,t,i)=>{
i.d(t, {
p: ()=>r
});
var s = i(19725);
class r extends s.X {
constructor() {
super(),
this.allianceAction = s.H.MODIFY,
this.allianceID = null,
this.allianceName = null,
this.allianceDescription = null,
this.allianceFlagBase64 = null,
this.capImageToMaxSize = hup.config.canCreateCoalitionImages
}
setData(e, t, i, s) {
this.allianceID = e,
this.allianceName = t,
this.allianceDescription = i,
this.allianceFlagBase64 = s
}
getApprovalText() {
return hup.i18n.gettext("Do want to apply these changes?")
}
}
}
,
51637: (e,t,i)=>{
i.d(t, {
B: ()=>r
});
var s = i(60182);
class r extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.mad.UltMADAccountSelectionAction",
this.selectedUserID = null
}
setData(e) {
this.selectedUserID = e
}
}
}
,
22937: (e,t,i)=>{
i.d(t, {
z: ()=>r
});
var s = i(60182);
class r extends s.A {
constructor() {
super(),
this["@c"] = "ultshared.action.mad.UltMADLoginAction",
this.userIDs = null
}
setData(e) {
this.userIDs = e
}
}
}
,
1218: (e,t,i)=>{
i.d(t, {
d: ()=>r
});
var s = i(58202);
class r {
constructor() {
this.rewardTrackerInventoryItemID = null,
this.adviseIDToRewardMap = {}
}
getAdviseReward(e) {
return this.adviseIDToRewardMap[e]
}
getRewardTrackerInventoryItemID() {
return this.rewardTrackerInventoryItemID
}
}
s.F.adviser.UltAdviserRewardConfig = r
}
,
23469: (e,t,i)=>{
i.d(t, {
h: ()=>r
});
i(87477);
var s = i(58202);
class r {
constructor() {
this.collectedAdviseIDs = []
}
isRewardCollected(e) {
return (Object.values(this.collectedAdviseIDs) || []).indexOf(e) > -1
}
markRewardAsCollected(e) {
this.collectedAdviseIDs.push(e)
}
}
s.F.adviser.UltCollectedAdviserRewardTracker = r
}
,
31362: (e,t,i)=>{
i.d(t, {
E: ()=>n
});
var s = i(97477)
, r = i(58202);
class n extends s.w3 {
getMessageID() {
return this.messageID
}
}
r.F.gameevents.UltCoalitionMessageGameEvent = n
}
,
97477: (e,t,i)=>{
i.d(t, {
NZ: ()=>h,
TT: ()=>c,
pP: ()=>u,
t7: ()=>d,
w3: ()=>g
});
var s = i(55542)
, r = i(61809)
, n = i(14778)
, a = i(6422)
, o = i(58202)
, l = i(87928);
const u = {
Diplomatic: 1,
Military: 2,
Economy: 3,
Quests: 4
}
, h = {
WarDeclared: "WarDeclared",
SurpriseAttack: "SurpriseAttack",
ProvinceWon: "ProvinceWon",
ProvinceLost: "ProvinceLost",
UnitProduced: "UnitProduced",
UpgradeBuilt: "UpgradeBuilt",
UnitTrained: "UnitTrained",
ArmyDestroyed: "ArmyDestroyed",
ArmyAttacked: "ArmyAttacked",
ProvinceEntered: "ProvinceEntered",
ResearchCompleted: "ResearchCompleted",
QuestDone: "QuestDone",
RelationChange: "RelationChange",
TradeOffer: "TradeOffer",
TradeProcessed: "TradeProcessed",
NuclearImpact: "NuclearImpact",
MessageReceived: "MessageReceived",
CoalitionInvitation: "CoalitionInvitation"
};
class g {
constructor() {
this.filterID = 0,
this.time = 0,
this.iconUrl = null,
this.type = 0,
this.status = null,
this.key = null,
this.senders = null,
this.gameID = null,
this.mapID = null,
this.eventID = null,
this.spu = null,
this.unitTypeId = null,
this.hasVictoryPoints = !1
}
static selectProvince(e) {
const t = hup.gameState.getMapState().getProvince(e);
t && hup.provinceSelection.setSelected([t], !1, !1, !1, !0)
}
getSenders() {
return "string" == typeof this.senders && this.resolveSenders(),
this.senders
}
getFilterID() {
return this.filterID
}
getProvince() {
return Number.isFinite(Number.parseFloat(this.filterID)) ? hup.gameState.getMapState().getProvince(this.filterID) : null
}
getTime() {
return this.time
}
getRealTime() {
return r._c(this.getTime())
}
getName() {
return this.name
}
getDescription() {
return this.description
}
getIconUrlForEvent() {
return this.iconUrl || this.getIconUrlForEventType()
}
getIconUrlForEventType() {
const e = u;
switch (parseInt(this.type, 10)) {
case e.Diplomatic:
return "group";
case e.Military:
return "relationship_state_war";
case e.Economy:
return "trade";
case e.Quests:
return "resource";
default:
return ""
}
}
markAsRead() {
this.status = g.STATUS.STATUS_READ
}
isRead() {
return this.status === g.STATUS.STATUS_READ
}
setDescription(e) {
this.description = e
}
setName(e) {
this.name = e
}
setIconUrl(e) {
this.iconUrl = e
}
setTime(e) {
this.time = e
}
getKey() {
return this.key
}
getMapIDWithoutVersion() {
return this.mapID ? this.mapID.split("_")[0] : null
}
resolveSenders() {
this.senders = JSON.parse(this.senders);
for (let e = 0; e < this.senders.length; e++)
this.senders[e] = hup.messageResolver.resolveAll(this.senders[e])
}
getSenderID() {
const e = this.getSenders();
return Array.isArray(e) && e.length ? e[0].getSenderID() : 0
}
getSenderPlayerProfile() {
const e = this.getSenderID();
return e ? hup.gameState.getPlayerProfile(e) : null
}
getGameID() {
return this.gameID
}
getEventID() {
return this.eventID
}
getVictoryPoints() {
var e, t;
if (!this.hasVictoryPoints)
return 0;
const i = null === (e = hup.gameState) || void 0 === e || null === (t = e.getMapState()) || void 0 === t ? void 0 : t.getProvince(this.filterID);
return i ? i.getVictoryPoints() : 0
}
}
g.STATUS = {
STATUS_UNPROCESSED: 0,
STATUS_SMS_SEND: 1,
STATUS_CLIENT_MSG_SEND: 2,
STATUS_REJECTED: 3,
STATUS_READ: 4
},
o.F.gameevents.UltGameEvent = g;
o.F.gameevents.UltArmyAttackedGameEvent = class extends g {
}
;
o.F.gameevents.UltAirCrashGameEvent = class extends g {
}
;
o.F.gameevents.UltMessageReceivedGameEvent = class extends g {
onClick() {
this.filterID >= 0 && s.N.publish(l.q.UI_DIPLOMACY_MESSAGES_OPEN, this.filterID)
}
}
;
o.F.gameevents.UltNewspaperArticleGameEvent = class extends g {
onClick() {
const e = n.S.ARTICLES;
s.N.publish(l.q.UI_NEWSPAPER_TOGGLE, e)
}
}
;
o.F.gameevents.UltProvinceAttackedGameEvent = class extends g {
onClick() {
g.selectProvince(this.filterID)
}
}
;
o.F.gameevents.UltProvinceEnteredGameEvent = class extends g {
onClick() {
g.selectProvince(this.filterID)
}
}
;
o.F.gameevents.UltProvinceLostGameEvent = class extends g {
constructor() {
super(),
this.hasVictoryPoints = !0,
this.wasRevolt = !1
}
onClick() {
g.selectProvince(this.filterID)
}
}
;
o.F.gameevents.UltProvinceWonGameEvent = class extends g {
constructor() {
super(),
this.hasVictoryPoints = !0,
this.wasRevolt = !1,
this.gainedResourceMap = null
}
onClick() {
g.selectProvince(this.filterID)
}
}
;
class c extends g {
onClick() {
s.N.publish(l.q.UI_DIPLOMACY_PLAYERS_OPEN, {
selectedPlayerID: this.filterID
})
}
getOldRelationName() {
return a.N.getRelationsName(this.oldRelation)
}
getNewRelationName() {
return a.N.getRelationsName(this.newRelation)
}
}
o.F.gameevents.UltRelationChangeGameEvent = c;
o.F.gameevents.UltResourceShortageGameEvent = class extends g {
}
;
o.F.gameevents.UltSpyInfoGameEvent = class extends g {
}
;
o.F.gameevents.UltTradeOfferGameEvent = class extends g {
onClick() {
s.N.publish(l.q.UI_DIPLOMACY_MESSAGES_OPEN, this.filterID)
}
}
;
o.F.gameevents.UltTradeProcessedGameEvent = class extends g {
onClick() {
s.N.publish(l.q.UI_DIPLOMACY_MESSAGES_OPEN, this.filterID)
}
}
;
o.F.gameevents.UltUnitProducedGameEvent = class extends g {
onClick() {
g.selectProvince(this.filterID)
}
getUnitType() {
var e;
return (null === (e = this.spu) || void 0 === e ? void 0 : e.getUnitType()) ?? hup.getMod().getUnitTypeByItemID(this.unitTypeId)
}
}
;
o.F.gameevents.UltUnitTrainedGameEvent = class extends g {
getUnitType() {
return hup.getMod().getUnitTypeByItemID(this.unitTypeId)
}
}
;
o.F.gameevents.UltUpgradeBuiltGameEvent = class extends g {
onClick() {
g.selectProvince(this.filterID)
}
}
;
o.F.gameevents.UltWarDeclaredGameEvent = class extends g {
onClick() {
s.N.publish(l.q.UI_DIPLOMACY_PLAYERS_OPEN, {
selectedPlayerID: this.filterID
})
}
}
;
o.F.gameevents.CoalitionInvitationGameEvent = class extends g {
constructor() {
super(),
this.teamID = null
}
onClick() {
s.N.publish(l.q.UI_IN_GAME_ALLIANCE_DETAIL_TOGGLE, this.teamID)
}
}
;
o.F.gameevents.UltResearchCompletedGameEvent = class extends g {
onClick() {
var e;
const t = this.researchID ?? (null === (e = this.researchType) || void 0 === e ? void 0 : e.getItemID());
t && s.N.publish(l.q.UI_RESEARCH_OPEN_CERTAIN_RESEARCH, {
researchID: t
})
}
getResearchType() {
return this.researchType ?? hup.getMod().getResearch(this.researchID)
}
}
;
o.F.gameevents.UltSurpriseAttackGameEvent = class extends g {
onClick() {
s.N.publish(l.q.UI_DIPLOMACY_PLAYERS_OPEN, {
selectedPlayerID: this.filterID
})
}
}
;
class d extends g {
constructor() {
super(),
this.army = null,
this.enemyArmy = null
}
getArmy() {
return this.army
}
getEnemyArmy() {
return this.enemyArmy
}
onClick() {
s.N.publish(l.q.UI_GAME_EVENT_DETAILS_TOGGLE, {
onlyOpen: !0,
gameEvent: this
})
}
}
o.F.gameevents.UltArmyDestroyedGameEvent = d
}
,
76020: (e,t,i)=>{
var s = i(55542)
, r = i(97477)
, n = i(58202)
, a = i(87928);
n.F.gameevents.UltGameEventState = class {
constructor() {
this.gameEvents = []
}
getEvents() {
return this.gameEvents
}
publishUpdate() {
s.N.publish(a.q.UI_GAME_EVENTS_UPDATED)
}
update(e) {
Object.assign(this, e),
this.gameEvents.filter((e=>e instanceof r.t7)).forEach((e=>e.getArmy().setupAsDeadArmy()))
}
}
}
,
55153: (e,t,i)=>{
i.d(t, {
b: ()=>r
});
var s = i(97477);
class r extends s.w3 {
getQuestID() {
return this.filterID
}
}
ultshared.gameevents.UltQuestDoneGameEvent = r
}
,
46707: (e,t,i)=>{
i.d(t, {
H: ()=>n
});
class s {
constructor() {
this.enabled = !0,
this.featureID = -1,
this.value = null,
this.name = "",
this.description = "",
this.valueName = "",
this.published = !1
}
getFeatureID() {
return this.featureID
}
isEnabled() {
return this.enabled
}
getValue() {
return this.value
}
getName() {
return this.name
}
getDescription() {
return this.description
}
getValueName() {
return this.valueName
}
isPublished() {
return this.published
}
}
var r = i(58202);
class n {
constructor() {
this.idFeatures = {}
}
initFeatures() {
for (const e in this.idFeatures)
if (this.idFeatures.hasOwnProperty(e)) {
const t = this.getFeature(e);
if (!(t instanceof s)) {
const i = new s;
Object.assign(i, t),
this.idFeatures[e] = i
}
}
}
hasFeature(e) {
const t = this.getFeature(e);
return t && t.isEnabled()
}
getFeature(e) {
return this.idFeatures[e]
}
}
n.Ids = {
FEATURE_TESTGAME: 1,
IR_PEACEPERIOD: 2,
IR_PEACEPERIOD_AI: 3,
IR_HONORPERIOD: 4,
IR_MIN_ACIVITIY: 5,
FEATURE_ANONYMOUS: 6,
FEATURE_GM_LIMITATION: 7,
FEATURE_TOURNAMENT: 8,
FEATURE_STARTLEVEL: 9,
FEATURE_ENDDAY: 10,
FEATURE_PAUSED: 11,
FEATURE_UNITPACK: 12,
FEATURE_XP_BOOST: 13
},
n.GameLevels = {
None: 0,
ReleaseCandidate: 1,
Beta: 2,
Alpha: 3
},
r.F.gamefeatures.UltGameFeatures = n
}
,
11195: (e,t,i)=>{
i(55542),
i(81177),
i(87928)
}
,
85665: (e,t,i)=>{
let s;
i.d(t, {
f: ()=>s
}),
function(e) {
e[e.GF_RESOURCES = 1] = "GF_RESOURCES",
e[e.GF_PROVINCE_MORALE = 2] = "GF_PROVINCE_MORALE",
e[e.GF_STOCK_MARKET = 3] = "GF_STOCK_MARKET",
e[e.GF_NEWSPAPER = 4] = "GF_NEWSPAPER",
e[e.GF_SPIES = 5] = "GF_SPIES",
e[e.GF_BUILD_AND_PRODUCE = 6] = "GF_BUILD_AND_PRODUCE",
e[e.GF_INCREMENTAL_TECHTREE = 7] = "GF_INCREMENTAL_TECHTREE",
e[e.GF_CAPITAL = 8] = "GF_CAPITAL",
e[e.GF_PROVINCE_VIEW = 9] = "GF_PROVINCE_VIEW",
e[e.GF_FOW = 10] = "GF_FOW",
e[e.GF_PROVINCE_FOW = 11] = "GF_PROVINCE_FOW",
e[e.GF_INFANTRY_RECRUITMENT = 12] = "GF_INFANTRY_RECRUITMENT",
e[e.GF_AUTO_REPEAT_PRODUCTION = 13] = "GF_AUTO_REPEAT_PRODUCTION",
e[e.GF_GAMES_LEAVABLE = 14] = "GF_GAMES_LEAVABLE",
e[e.GF_TUTORIAL = 15] = "GF_TUTORIAL",
e[e.GF_PREMIUM_RESOURCE_OFFERS = 16] = "GF_PREMIUM_RESOURCE_OFFERS",
e[e.GF_IMPULSE_TRADE_OFFERS = 17] = "GF_IMPULSE_TRADE_OFFERS",
e[e.GF_CORRUPTION = 18] = "GF_CORRUPTION",
e[e.GF_REPETITION_SLOTS = 19] = "GF_REPETITION_SLOTS",
e[e.GF_XP_BOOSTS = 20] = "GF_XP_BOOSTS",
e[e.GF_MODABLE_UNITS = 21] = "GF_MODABLE_UNITS",
e[e.GF_ALLIED_FORTRESS = 22] = "GF_ALLIED_FORTRESS",
e[e.GF_CUSTOM_LOCALIZATION = 23] = "GF_CUSTOM_LOCALIZATION",
e[e.GF_KEEP_INACTIVE_NEW_PLAYERS = 24] = "GF_KEEP_INACTIVE_NEW_PLAYERS",
e[e.GF_PREMIUM_IN_COMBAT = 25] = "GF_PREMIUM_IN_COMBAT",
e[e.GF_CUSTOM_EMBARK_TIMES = 26] = "GF_CUSTOM_EMBARK_TIMES",
e[e.GF_SIEGE = 28] = "GF_SIEGE",
e[e.GF_RETREAT = 29] = "GF_RETREAT",
e[e.GF_DAMAGE_AREA = 30] = "GF_DAMAGE_AREA",
e[e.GF_MOBILIZATION = 31] = "GF_MOBILIZATION",
e[e.GF_PREMIUM_VIDEOS = 32] = "GF_PREMIUM_VIDEOS",
e[e.GF_SOFT_IP_CONFLICT_WARNING = 33] = "GF_SOFT_IP_CONFLICT_WARNING",
e[e.GF_STOCK_SIZE = 35] = "GF_STOCK_SIZE",
e[e.GF_IN_GAME_ADS = 36] = "GF_IN_GAME_ADS",
e[e.GF_TARGETED_MARKETING = 37] = "GF_TARGETED_MARKETING",
e[e.GF_SCALABLE_OFFERS = 38] = "GF_SCALABLE_OFFERS",
e[e.GF_VICTORY_POINTS = 39] = "GF_VICTORY_POINTS",
e[e.GF_CORE_PROVINCES = 40] = "GF_CORE_PROVINCES",
e[e.GF_RESEARCH = 41] = "GF_RESEARCH",
e[e.GF_FACTIONS = 42] = "GF_FACTIONS",
e[e.GF_MANPOWER = 43] = "GF_MANPOWER",
e[e.GF_GARRISON = 44] = "GF_GARRISON",
e[e.GF_ACHIEVEMENT_TITLES = 45] = "GF_ACHIEVEMENT_TITLES",
e[e.GF_UPGRADES_INHERIT = 46] = "GF_UPGRADES_INHERIT",
e[e.GF_STRATEGIC_ADVISER = 47] = "GF_STRATEGIC_ADVISER",
e[e.GF_AIRPLANES_WW2 = 48] = "GF_AIRPLANES_WW2",
e[e.GF_PASSIVE_AI = 49] = "GF_PASSIVE_AI",
e[e.GF_REPORT_ALL_UNIT_LOSSES = 50] = "GF_REPORT_ALL_UNIT_LOSSES",
e[e.GF_GROWTH_HACKING = 51] = "GF_GROWTH_HACKING",
e[e.GF_IMPACT_MARKERS = 52] = "GF_IMPACT_MARKERS",
e[e.GF_INGAME_EVENTS = 53] = "GF_INGAME_EVENTS",
e[e.GF_LESS_VARIANCE_BATTLE_SYSTEM = 54] = "GF_LESS_VARIANCE_BATTLE_SYSTEM",
e[e.GF_BATTLE_ORDER = 58] = "GF_BATTLE_ORDER",
e[e.GF_FRONT_WIDTH = 59] = "GF_FRONT_WIDTH",
e[e.GF_PROVINCE_CONQUER_QUESTS = 60] = "GF_PROVINCE_CONQUER_QUESTS",
e[e.GF_PROVINCE_CENTER_DEFENSE_BONUS = 62] = "GF_PROVINCE_CENTER_DEFENSE_BONUS",
e[e.GF_MORALE_BASED_CONSTRUCTION_TIME = 63] = "GF_MORALE_BASED_CONSTRUCTION_TIME",
e[e.GF_HEAL_ARMIES_BY_TERRAIN = 64] = "GF_HEAL_ARMIES_BY_TERRAIN",
e[e.GF_RANDOMIZED_RESOURCES = 65] = "GF_RANDOMIZED_RESOURCES",
e[e.GF_INGAME_INVENTORY = 66] = "GF_INGAME_INVENTORY",
e[e.GF_COALITION = 67] = "GF_COALITION",
e[e.GF_MORALE_BASED_PRODUCTION_TIME = 68] = "GF_MORALE_BASED_PRODUCTION_TIME",
e[e.GF_DAMAGE_SENSITIVE_MORALE = 69] = "GF_DAMAGE_SENSITIVE_MORALE",
e[e.GF_ADVANCED_RADAR_SYSTEM = 70] = "GF_ADVANCED_RADAR_SYSTEM",
e[e.GF_NEUTRAL_PROVINCES = 85] = "GF_NEUTRAL_PROVINCES",
e[e.GF_EQUAL_DAMAGE_DISTRIBUTION = 87] = "GF_EQUAL_DAMAGE_DISTRIBUTION",
e[e.GF_MORALE_BASED_AUTO_RECRUITMENT_TIME = 88] = "GF_MORALE_BASED_AUTO_RECRUITMENT_TIME",
e[e.GF_MORALE_BASED_RESOURCE_PRODUCTION_RATE = 89] = "GF_MORALE_BASED_RESOURCE_PRODUCTION_RATE",
e[e.GF_FREE_FIRE_CONTROL = 90] = "GF_FREE_FIRE_CONTROL",
e[e.GF_MORALE_BASED_DMG_FACTOR = 92] = "GF_MORALE_BASED_DMG_FACTOR",
e[e.GF_MORALE_BASED_SPEED_FACTOR = 93] = "GF_MORALE_BASED_SPEED_FACTOR",
e[e.GF_FLOOR_SPACE_PENALTY = 94] = "GF_FLOOR_SPACE_PENALTY",
e[e.GF_CONFIGURED_DEFENSIVE_AI = 95] = "GF_CONFIGURED_DEFENSIVE_AI",
e[e.GF_RESET_MINIMAL_PLAYER_RESOURCES_ON_JOIN = 96] = "GF_RESET_MINIMAL_PLAYER_RESOURCES_ON_JOIN",
e[e.GF_BLOCK_ATTACKED_AI_SLOTS_FOR_PLAYERS = 97] = "GF_BLOCK_ATTACKED_AI_SLOTS_FOR_PLAYERS",
e[e.GF_NATIVE_AI_NOT_PICKABLE_IN_TEAM_MODE = 98] = "GF_NATIVE_AI_NOT_PICKABLE_IN_TEAM_MODE",
e[e.GF_EFFECTIVE_RANKING_REWARD_SYSTEM = 101] = "GF_EFFECTIVE_RANKING_REWARD_SYSTEM",
e[e.GF_POINTS_AS_REWARD_AMOUNT = 102] = "GF_POINTS_AS_REWARD_AMOUNT",
e[e.GF_SQUARE_MAP_LABELS = 110] = "GF_SQUARE_MAP_LABELS",
e[e.GF_FACTION_SPECIFIC_BALANCING = 111] = "GF_FACTION_SPECIFIC_BALANCING",
e[e.GF_SCOUTABLE_PROVINCES = 113] = "GF_SCOUTABLE_PROVINCES",
e.OPTION_PREMIUM_ACCOUNT = "premiumAccountItem",
e.OPTION_PREMIUM_CURRENCY = "premiumCurrencyItem",
e.OPTION_MIN_AI_LEVEL = "minAiLevel",
e.OPTION_HARBOUR_COSTS = "harbourCosts",
e.OPTION_CONSTRUCTION_SLOT_ITEM = "constructionSlotItemID",
e.OPTION_PRODUCTION_SLOT_ITEM = "productionSlotItemID",
e.OPTION_SPY_COST = "spyCost",
e.OPTION_MANPOWER_RESOURCE = "manpowerResource",
e.OPTION_MANPOWER_MAX_PROMILLE = "manpowerMaxPromille",
e.OPTION_ACHIEVEMENT_TITLE = "achievementTitles",
e.OPTION_NONCORE_PRODUCTION = "noncoreProductionPercent",
e.OPTION_TRANSPORT_SHIP = "transportShipID",
e.OPTION_PLANE_TRAIN = "planeTrainID",
e.OPTION_AIRPLANE_REFUEL_SECONDS = "refuelSeconds",
e.OPTION_AIR_CORRIDOR_DEGREES = "airCorridorDegrees",
e.OPTION_FREE_TEAM_MODE = "freeTeamMode",
e.OPTION_MAX_HOSTILITY_LEVEL = "colDifCount",
e.OPTION_HOSTILITY_LEVEL_TIME = "colDif",
e.OPTION_PROVINCE_LEVEL_ID = "provinceLevelBuildingID",
e.OPTION_UPRISING_CHANCE_PER_AGGRESSION = "uprisingChancePerAggression",
e.OPTION_TAX_PRODUCTION_FACTOR = "tax_production_factor",
e.OPTION_TAX_POPULATION_FACTOR = "tax_population_factor",
e.OPTION_RANKING_SERVICE = "rankingService",
e.OPTION_CORE_PROVINCE_DEFENCE_FACTOR = "coreProvinceDefenceFactor",
e.OPTION_STARTING_UNIT_TYPE_ID = "startingUnitTypeID",
e.OPTION_MOD_AUTO_UNIT_UPGRADE_WITH_RESEARCH = "autoUnitUpgradeWithResearch",
e.OPTION_MOD_MARKET_FEE_PERCENTAGE = "marketFeePercentage",
e.OPTION_TEAM_JOIN_CD_AFTER_LEAVE = "teamJoinCDAfterLeave",
e.OPTION_TEAM_JOIN_CD_AFTER_KICK = "teamJoinCDAfterKick",
e.OPTION_URBAN_PROVINCE_LIST_MODE = "urbanProvinceListMode",
e.OPTION_HAS_PROVINCE_MONEY_SORTER = "hasProvinceMoneySorter",
e.OPTION_DISABLE_NON_URBAN_PRODUCTION = "disableNonUrbanProduction",
e.OPTION_TOGGLE_PROVINCE_PER_TERRAIN_TYPE = "toggleProvincePerTerrainType",
e.OPTION_PATROL_INTERVAL = "patrolInterval",
e.OPTION_QUICK_JOIN_SCENARIOS = "quickJoinScenarios"
}(s || (s = {}))
}
,
22155: (e,t,i)=>{
i.d(t, {
z: ()=>o
});
var s = i(55542)
, r = i(42907)
, n = i(58202)
, a = i(87928);
class o extends r.J {
publishUpdate() {
s.N.publish(a.q.UI_ALLIANCE_INVENTORY_UPDATED)
}
}
o.className = "ultshared.premium.UltAllianceInventory",
n.F.premium.UltAllianceInventory = o
}
,
17076: (e,t,i)=>{
i.d(t, {
g: ()=>r
});
var s = i(58202);
class r {
constructor() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0
, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
this["@c"] = "ultshared.premium.UltInventoryItem",
this.gameID = 0,
this.amount = t,
this.itemID = e,
this.item = null,
this.endDate = null
}
applyData(e) {
null != e.itemAmount ? this.amount = e.itemAmount : this.amount = e.amount,
Object.assign(this, e)
}
getAmount() {
return this.amount
}
setAmount(e) {
this.amount = e
}
getEndDate() {
return this.endDate
}
getJsonItem() {
return this.item
}
getDecodedJsonItem() {
return this._decodedJsonItem || (this._decodedJsonItem = hup.messageResolver.resolveAll(JSON.parse(this.item))),
this._decodedJsonItem
}
getItemID() {
return this.itemID
}
getItems(e) {
return hup.getMod().getPremium(this.itemID).getItems(e)
}
}
s.F.premium.UltInventoryItem = r
}
,
24410: (e,t,i)=>{
i.d(t, {
e: ()=>n
});
var s = i(61809)
, r = i(58202);
class n {
amountFactor;
description;
extraSettings;
isGlobalItem;
isInventoryItem;
itemID;
maxQuantity;
name;
icon;
constructor() {
this["@c"] = "ultshared.premium.UltPremium"
}
getItemID() {
return Number(this.itemID)
}
getAmountFactor() {
return this.amountFactor
}
getName() {
return this.name
}
getDescription(e) {
let t = this.description;
if (t) {
let i, r;
return t.indexOf("{amount}") >= 0 ? (i = `${Math.floor(this.getAmountFactor())}`,
t = t.replace("{amount}", i)) : t.indexOf("5%") >= 0 && (i = `${Math.floor(this.getAmountFactor())}%`,
t = t.replace("5%", i)),
e && (r = `${Math.floor(s.gV(e.getDuration()) / 3600)}`,
t.indexOf("{duration}") >= 0 ? t = t.replace("{duration}", r) : t.indexOf("12") >= 0 && (t = t.replace("12", r))),
t = s.ko(t, "&lt;", "<"),
t = s.ko(t, "&gt;", ">"),
t
}
return ""
}
getIcon() {
return this.icon
}
getExtraSettings() {
return this.extraSettings = this.json || this.extraSettings || {},
"string" == typeof this.extraSettings && (this.extraSettings = JSON.parse(this.extraSettings || "{}"),
this.json = this.extraSettings),
this.extraSettings
}
getUnitID() {
return this.getExtraSettings().unitID ?? 0
}
getUnitType() {
return hup.getMod().getUnitTypeByItemID(this.getUnitID())
}
getOfferID() {
return this.getExtraSettings().offerID ?? 0
}
getResourceID() {
return this.getExtraSettings().resourceID ?? 0
}
getHitpointBoost() {
return this.getExtraSettings().hitpointBoost * this.getAmountFactor()
}
getMoraleBoost() {
return this.getExtraSettings().moraleBoost * this.getAmountFactor()
}
getProductionTimeToSkip() {
return this.getExtraSettings().productionTimeToSkip * this.getAmountFactor()
}
getSkipConstructionTime() {
return this.getExtraSettings().constructionTimeToSkip * this.getAmountFactor()
}
getResearchTimeToSkip() {
return this.getExtraSettings().researchTimeToSkip * this.getAmountFactor()
}
getInventorySystemItem() {
return this.getExtraSettings().inventorySystemItem
}
hasInventorySystemItem() {
return !!this.getInventorySystemItem()
}
isHidden() {
return !!this.getExtraSettings().hidden
}
isPremiumCurrency() {
return Number(this.getItemID()) === Number(hup.getMod().getPremiumCurrencyItemID())
}
isPremiumAccount() {
return Number(this.getItemID()) === Number(hup.getMod().getPremiumAccountItemID())
}
getOffer(e) {
var t, i;
const s = this.getOfferID();
if (s)
return (e = e ?? (null === (t = hup.gameState) || void 0 === t || null === (i = t.getPremiumState()) || void 0 === i ? void 0 : i.getOffers()))[s]
}
getItems(e) {
const t = this.getOffer(e);
return t ? t.getItems() : []
}
static getPremiumItems() {
if (null == r.F.premium.premiumItems) {
const e = {}
, t = hup.contentItems;
for (const i in t)
t.hasOwnProperty(i) && t[i]instanceof n && (e[i] = t[i]);
r.F.premium.premiumItems = e
}
return r.F.premium.premiumItems
}
applyData(e) {
Object.assign(this, e),
this.amountFactor = Number(e.amountFactor)
}
}
n.premiumItemOptions = {
REVEAL_PROVINCE_ARMIES: "RevealProvinceArmies",
COUNTRY_INFO: "CountryInfo",
DECREASE_MORAL: "DecreaseMoral",
DESTROY_RESOURCE: "DestroyResource",
DAMAGE_UPGRADE: "DamageUpgrade"
},
r.F.premium.UltPremium = n
}
,
43334: (e,t,i)=>{
i.d(t, {
R: ()=>h
});
i(87477);
var s = i(61809)
, r = i(39513)
, n = i(17076)
, a = i(13950)
, o = i(40947)
, l = i(13775)
, u = i(24405);
class h {
constructor() {
this["@c"] = "ultshared.premium.UltPremiumOffer",
this.premiums = null,
this.itemID = null,
this.description = null,
this.displayPrice = null,
this.price = null,
this.offerCategory = null,
this.restrictToMethods = null,
this.currency = null,
this.originalCurrency = null,
this.timeRemaining = 0,
this.starterOffer = null,
this.inventoryAmount = null,
this.shopDefault = null,
this.earningsPercentage = null,
this.bestOffer = !1,
this.preBonusInventoryIngameAmount = 0,
this.inventoryItemIds = [],
this.initializationTime = 0,
this.extraSettings = {},
this.ggsItemId = null,
this.providerType = null
}
toJSON() {
return {
"@c": "po",
id: this.itemID,
pm: this.premiums,
pr: this.price,
ps: this.priceStep,
mp: this.minPrice,
c: this.currency,
oc: this.offerCategory,
d: this.duration,
de: this.description,
dp: this.displayPrice,
a: this.itemAmount,
sd: this.startDate,
ed: this.endDate,
f: this.featured,
q: this.quantity,
co: this.country,
pf: this.priceFunction,
rm: this.restrictToMethods,
gi: this.ggsItemId,
pt: this.providerType
}
}
getItemID() {
return this.itemID
}
getName() {
return this.name
}
getDuration() {
return this.duration
}
getDurationInDays() {
return parseInt(this.duration / 86400, 10)
}
getDurationString() {
return u.V.getUserShopPlatformId() === u.V.SHOP_PLATFORMS.SHOP_GGS.id ? r.IZ.i18n.ngettext("%s Day", "%s Days", this.getDurationInDays()) : r.IZ.i18n.ngettext("%s Month", "%s Months", this.getDurationInMonths())
}
getRewardedValuetoString() {
return 0 !== this.inventoryAmount ? l.Z.formatNumber(this.inventoryAmount) : l.Z.formatTimer(this.duration)
}
getPriceStep() {
return this.priceStep
}
getPrice() {
return this.price
}
getPriceFunction() {
return this.priceFunction
}
isScalable(e) {
return e.hasScalableOffers() && this.hasPriceFunction()
}
hasPriceFunction() {
return !(0,
s.Ew)(this.getPriceFunction())
}
getScaledPrice(e) {
let t = 0;
return this.hasPriceFunction() && (t = this.calculatePrice(e)),
t
}
calculatePrice(e) {
e = Math.min(e, this.getDuration());
const t = this.getPriceFunction()
, i = Object.keys(t);
i.sort(((e,t)=>e - t));
let s = i[0]
, r = t[s];
if (s >= e)
return Math.round(r);
let n = 0
, a = 0;
for (let o = 1; o < i.length; o++) {
if (a = s,
n = r,
s = i[o],
r = t[s],
parseFloat(s) === e)
return Math.round(r);
if (s >= e)
return Math.round((r - n) * (e - a) / (s - a) + n)
}
return Math.round(r)
}
getFormattedPrice() {
return l.Z.formatNumber(this.price)
}
getMinPrice() {
return this.minPrice
}
containsPremium(e) {
return null != this.getPremium(e)
}
getPremium(e) {
return null != this.premiums ? this.premiums[e] : null
}
getPremiums() {
return this.premiums
}
getInventoryPremiums() {
if (!this._inventoryPremiums) {
this._inventoryPremiums = [];
for (let e = 0; e < this.inventoryItemIds.length; e++) {
const t = this.inventoryItemIds[e]
, i = r.IZ.getMod(!1).getPremium(t);
i && this._inventoryPremiums.push(i)
}
}
return this._inventoryPremiums
}
getCurrencyAndAccountPremiums() {
return this.getInventoryPremiums().filter((e=>e.isPremiumCurrency() || e.isPremiumAccount()))
}
getDescription() {
return this.description
}
getDisplayPrice() {
return "JPY" === this.currency && (this.displayPrice = this.displayPrice.split(".")[0]),
`${this.displayPrice} ${this.currency}`
}
getInventoryIngameAmount() {
return this.inventoryAmount
}
setPreBonusInventoryIngameAmount(e) {
this.preBonusInventoryIngameAmount = e
}
getPreBonusInventoryIngameAmount() {
return this.preBonusInventoryIngameAmount
}
getCategoryID() {
return this.offerCategory
}
getCurrency() {
return this.currency
}
getOriginalCurrency() {
return this.originalCurrency
}
getFeatured() {
return this.featured
}
getEarningsPercentage() {
return this.earningsPercentage
}
setEarningsPercentage(e) {
this.earningsPercentage = e
}
markAsBestOffer() {
this.bestOffer = !0
}
isBestOffer() {
return this.bestOffer
}
isShopDefault() {
return Number(this.shopDefault) > 0
}
getDurationInMonths() {
return parseInt(this.duration / 2592e3, 10)
}
getImageNameSuffix() {
const e = this.getSpecialImageNameSuffix();
if (Number.isFinite(Number.parseFloat(e)))
return e;
if (this.isStarterOffer())
return 0;
let t = 0;
return this.getInventoryIngameAmount() ? t = this.getPremiumCurrencyIconIndex() : this.getDuration() && (t = this.getPremiumAccountIconIndex()),
t
}
getOfferType() {
return this.isSpecialOffer() ? "starter" : this.isFreeOffer() ? "free" : "gold"
}
getSpecialImageNameSuffix() {
var e;
return Number(null === (e = this.extraSettings) || void 0 === e ? void 0 : e.offerImageIndex)
}
getOrderId() {
var e;
return Number(null === (e = this.extraSettings) || void 0 === e ? void 0 : e.orderId)
}
getPremiumCurrencyIconIndex() {
const e = this.preBonusInventoryIngameAmount || this.getInventoryIngameAmount();
return e <= 5e3 ? 0 : e <= 2e4 ? 1 : e <= 3e4 ? 2 : e <= 64e3 ? 3 : e <= 1e5 ? 4 : e <= 17e4 ? 5 : e <= 36e4 ? 6 : 7
}
getPremiumAccountIconIndex() {
const e = this.getDurationInMonths();
return e <= 3 ? 0 : e <= 6 ? 1 : 2
}
getInventoryItemOfferPremiums() {
if (!this._inventoryItemOfferPremiums) {
var e;
const t = r.IZ.getMod(!1).getPremium(this.inventoryItemIds[0])
, i = null === (e = r.IZ.gameState.getPremiumState()) || void 0 === e ? void 0 : e.getOfferByID(t.getOfferID());
this._inventoryItemOfferPremiums = i ? Object.values(i.getPremiums()) : []
}
return this._inventoryItemOfferPremiums
}
getRatio() {
let e = 1;
return this.getCategoryID() === o.q.PremiumCurrency.ID ? e = this.getInventoryIngameAmount() / this.getPrice() : this.getCategoryID() === o.q.PremiumAccount.ID && (e = this.getDuration() / this.getPrice()),
e
}
getOfferPriceReduction(e, t) {
const i = e.getRatio();
let s = this.getRatio();
if (this.getCategoryID() === o.q.PremiumCurrency.ID && this.getDuration() > 0 && t) {
const e = t.getPrice() * i * (this.getDuration() / t.getDuration());
s = (this.getInventoryIngameAmount() + e) / this.getPrice()
}
const r = s / i * 100 - 100;
return Math.round(r <= 0 ? 0 : r)
}
setPreBonusValue(e) {
if (this.getCategoryID() === o.q.PremiumCurrency.ID) {
const t = this.getInventoryIngameAmount() / e;
this.setPreBonusInventoryIngameAmount(t)
}
}
isStarterOffer() {
return this.starterOffer
}
isSpecialOffer() {
return this.isStarterOffer() || this.getFeatured() > 0
}
isFreeOffer() {
return 0 === this.getPrice()
}
getTimeRemaining() {
const e = Date.now() - this.initializationTime;
return this.timeRemaining - e / 1e3
}
getTimeRemainingHR() {
return l.Z.formatTimerTiny(this.getTimeRemaining(), 2)
}
getTimeRemainingHRShort() {
return l.Z.formatTimerSmartDesign(this.getTimeRemaining())
}
hasPremiumAccount() {
return this.getDuration() > 0
}
hasPremiumCurrency() {
return this.getInventoryIngameAmount() > 0
}
isPremiumAccountAndCurrencyBundle() {
return this.hasPremiumCurrency() && this.hasPremiumAccount()
}
setOriginalCurrency(e) {
this.originalCurrency = e
}
getCustomName() {
if (this.extraSettings && this.extraSettings.customName) {
const e = this.extraSettings.customName
, t = r.IZ.i18n.language;
return e[t] ? e[t] : e.en ? e.en : e
}
return null
}
getGgsItemId() {
return this.ggsItemId
}
isSmsOffer() {
return "sms" === this.providerType
}
getItems() {
return Object.values(this.getPremiums()).map((e=>new n.g(e.getItemID(),e.getAmountFactor())))
}
hasInventorySystemItem() {
return Object.values(this.premiums).some((e=>e.hasInventorySystemItem()))
}
static parse(e) {
const t = new this;
return t.itemID = e.id ?? e.itemID ?? -1,
t.premiums = e.pm ?? null,
t.price = e.pr ?? 1e3,
t.priceStep = e.ps ?? 0,
t.minPrice = e.mp ?? 0,
t.currency = e.c ?? "",
t.offerCategory = Number(e.oc ?? 2),
t.duration = e.d ?? 0,
t.description = e.de ?? "",
t.displayPrice = e.dp ?? "",
t.itemAmount = e.a ?? 1,
t.startDate = e.sd ?? 0,
t.endDate = e.ed ?? 0,
t.featured = e.f ?? 0,
t.quantity = e.q ?? 0,
t.country = e.co ?? "",
t.priceFunction = e.pf ?? null,
t.name = e.name ?? "",
t.restrictToMethods = e.rm ?? null,
t.shopDefault = e.sd ?? 0,
t.inventoryAmount = parseInt(e.ia ?? 0, 10),
t.inventoryItemIds = e.ii ?? null,
t.starterOffer = e.so ?? !1,
t.timeRemaining = e.tr ?? 0,
t.extraSettings = e.es ?? {},
t.ggsItemId = e.gi ?? "0",
t.providerType = e.pt ?? null,
t.initializationTime = Date.now(),
t
}
}
a.x.register(["po", ".UltPremiumOffer", "ultshared.premium.UltPremiumOffer"], (e=>h.parse(e)))
}
,
71313: (e,t,i)=>{
i.d(t, {
a: ()=>r
});
var s = i(58202);
class r {
constructor() {
this["@c"] = "ultshared.premium.UltPremiumOption",
this.priceFactor = 1
}
setOptionID(e) {
this.optionID = e
}
setPremiumID(e) {
this.premiumID = e
}
setPriceFactor(e) {
this.priceFactor = e
}
getPriceFactor() {
return this.priceFactor
}
setOptionKey(e) {
this.optionKey = e
}
getOptionKey() {
return this.optionKey
}
}
s.F.premium.UltPremiumOption = r
}
,
20002: (e,t,i)=>{
i.d(t, {
D: ()=>a
});
i(24410);
var s = i(71313)
, r = i(7905)
, n = i(58202);
class a extends r.Z {
premiums = [];
toJSON() {
return {
"@c": "ultshared.UltPremiumOrder",
amount: this.amount,
limit: this.limit,
resourceType: this.resourceType,
playerID: this.playerID
}
}
createPremiumOption(e) {
const t = e || this.getAmount()
, i = new s.a;
return i.setPriceFactor(this.getLimit() * t / a.BASE_AMOUNT),
i.setOptionKey(this),
i.setPremiumID(hup.getPremiumItemIds().ITEMID_RESOURCE_TRADE),
i.setOptionID(this.resourceType),
i
}
isPremium() {
return !0
}
getUnitPrice() {
return this.unitPrice ? this.unitPrice : this.limit
}
getTotalPrice() {
if (!this.totalPrice) {
let e = this.limit;
this.unitPrice && (e = this.unitPrice),
this.totalPrice = Math.round(this.amount * e)
}
return this.totalPrice
}
}
a.START_PRICE = .5,
a.DEFAULT_AMOUNT = 5e3,
a.BASE_AMOUNT = 1e3,
n.F.UltPremiumOrder = a
}
,
79741: (e,t,i)=>{
i.d(t, {
l: ()=>a
});
var s = i(58202)
, r = i(40947)
, n = i(24405);
class a {
constructor() {
this.uid = null,
this.currency = null,
this.method = null,
this.minValue = null,
this.maxValue = null,
this.priority = null,
this.displayName = null,
this.isOfferWall = null,
this.countryCode = null,
this.paymentAllowed = !0,
this.isDefaultProvider = !1
}
getMethodID() {
return Number(this.uid)
}
getName() {
return this.method || ""
}
getIsDefaultProvider() {
return this.isDefaultProvider
}
canServeForCategory(e) {
return e === r.q.EarnGold.ID ? Number(this.isOfferWall) > 0 : 0 === Number(this.isOfferWall)
}
getIsPaymentAllowedForOffer(e) {
const t = parseFloat(e.getPrice())
, i = t >= parseFloat(this.minValue)
, s = t <= parseFloat(this.maxValue) || 0 == this.maxValue
, r = e.getCurrency() == this.currency || e.getOriginalCurrency() == this.currency;
return i && s && r
}
setPaymentAllowed(e) {
this.paymentAllowed = e
}
getPaymentAllowed() {
return this.paymentAllowed
}
getDisplayName() {
return this.displayName || ""
}
getIconURL() {
var e;
return n.V.isUsingGGSShop() ? "images/" + (null === (e = hup.imagePropertiesHelper.getPropertiesForImage("payment-providers/sprite-provider.png")) || void 0 === e ? void 0 : e.imageURL) : this.getIconURLShop2017()
}
getProviderImageClassName() {
const e = n.V.getUserShopPlatformId();
return n.V.isUsingGGSShop() ? `pay${this.uid} ${e}` : e
}
getIconURLShop2017() {
let e = this.method;
return this.method.endsWith("_sms") || -1 !== this.displayName.indexOf("SMS") ? e = "sms" : this.method.endsWith("_tel") && (e = "phone"),
`${hup.config.websiteURL}/fileadmin/templates/supremacy_1914/images/201_newShop/shop_payment_method_icon_${e}.gif`
}
getUid() {
return this.uid
}
isSmsMethod() {
return "sms" === this.method
}
}
s.F.premium.UltShopMethod = a
}
,
42907: (e,t,i)=>{
i.d(t, {
J: ()=>l
});
var s = i(55542)
, r = i(81177)
, n = i(58202)
, a = i(72053)
, o = i(87928);
class l {
constructor() {
this.stateType = r.V.STATE_TYPE_USER_INVENTORY_STATE,
this["@c"] = "ultshared.premium.UltUserInventory",
this.inventory = {},
this.newItemsState = []
}
getAmount(e) {
return this.inventory && this.inventory[e] ? this.inventory[e].getAmount() : 0
}
getPremiumCurrencyAmount() {
return this.getAmount(hup.getMod().getPremiumCurrencyItemID())
}
setAmount(e, t) {
this.inventory && this.inventory[e] && (this.inventory[e].setAmount(t),
this.invalidateStateID())
}
getEndDate(e) {
var t;
return null !== (t = this.inventory) && void 0 !== t && t[e] ? this.inventory[e].getEndDate() : 0
}
getItem(e) {
return this.inventory && this.inventory[e] ? this.inventory[e] : null
}
setItem(e, t) {
this.inventory[e] = t
}
invalidateStateID() {
let e = 0;
for (const t in this.inventory)
if (this.inventory.hasOwnProperty(t)) {
const i = this.getItem(t);
e += t * i.getAmount(),
e += t * i.getEndDate()
}
this.stateID = `${e}`
}
publishUpdate() {
s.N.publish(o.q.UI_RAW_USER_INVENTORY_UPDATED)
}
applyPartialInventory(e) {
Object.assign(this.inventory, e.inventory),
Object.assign(this.newItemsState, e.newItemsState)
}
update(e) {
this.stateID = e.stateID,
a.n.getCurrentUser().applyPartialInventory(e)
}
getNewItemsState() {
return this.newItemsState
}
getNewItemsStateMap() {
return new Map(this.newItemsState.map((e=>[e.itemID, e.newItemAmount])))
}
}
n.F.premium.UltUserInventory = l
}
,
69453: (e,t,i)=>{
i.d(t, {
w: ()=>a
});
var s = i(61809)
, r = i(58202)
, n = i(13775);
class a {
constructor(e) {
this.researchTypeID = e || 0,
this.startTime = 0,
this.endTime = 0,
this.speedUp = 0
}
getID() {
return this.researchTypeID
}
getResearchType() {
return hup.getMod().getResearch(this.researchTypeID)
}
getStartTime() {
return this.startTime
}
setStartTime(e) {
this.startTime = e
}
getEndTime() {
return this.endTime
}
setEndTime(e) {
this.endTime = e
}
getRemainingTime() {
var e, t;
return null === (e = hup.gameState) || void 0 === e || null === (t = e.getGameInfoState()) || void 0 === t ? void 0 : t.convertScaledToRealTime(this.getRemainingTimeNotScaled())
}
getRemainingTimeNotScaled() {
return Math.floor((this.getEndTime() - s.$B()) / 1e3)
}
getTotalTime() {
return this.getResearchType().getBuildTime()
}
getTotalTimeScaled() {
return this.getResearchType().getBuildTimeScaled()
}
start() {
this.startTime = s.$B(),
this.endTime = this.startTime + 1e3 * this.getResearchType().getBuildTime()
}
getRemainingTimeHR() {
return n.Z.formatTimer(this.getRemainingTime(), !0, 2)
}
getProgress() {
const e = s.gV(this.getResearchType().getBuildTime())
, t = this.getRemainingTime();
return Math.min(100, Math.max(0, 100 / e * (e - t)))
}
isFinished() {
return this.getRemainingTime() <= 0
}
getSpeedUp() {
return this.speedUp
}
setSpeedUp(e) {
this.speedUp = e
}
getUniqueProgressID() {
return `${this.researchTypeID}_${this.startTime}_${this.endTime}`
}
}
r.F.research.UltResearch = a
}
,
59928: (e,t,i)=>{
i.d(t, {
U: ()=>g
});
i(87477),
i(10711);
var s = i(34229)
, r = i(61809)
, n = i(39513)
, a = i(42236)
, o = i(58202)
, l = i(26574)
, u = i(50910)
, h = i(33558);
class g {
constructor() {
this.itemID = 0,
this.set = 0,
this.identifier = "",
this.name = "",
this.desc = "",
this.buildTime = 0,
this.dayAvailable = 0,
this.costs = {},
this.requiredResearches = {},
this.replacedResearch = 0,
this.requiredPlans = {},
this.replacingResearchId = null,
this.firstReplacedResaerchId = null,
this.unlockedItems = {},
this.unlocks = null,
this.stringOptions = null,
this.factionBaseItemID = null,
this.factions = null,
this.minResearchSpeedUpTime = null,
this.tier = null
}
getItemID() {
return this.itemID
}
getName() {
return this.name
}
setName(e) {
this.name = e
}
getNameWithTier() {
return this.hasTiers() ? `${this.name} ${n.IZ.i18n.gettext("Lvl. %s", this.getTier())}` : this.name
}
getDesc() {
let e = h.w.getModdedText(h.w.MsgId.RESEARCH_TYPE_DESC, this);
return this.desc && (e += this.desc),
e
}
getIdentifier() {
return this.identifier
}
getSet() {
return this.set
}
getSetOrderId() {
return this.setOrderID
}
getBuildTime() {
return this.buildTime
}
getBuildTimeScaled() {
return this.buildTime * (0,
r.Sq)()
}
getDayOfAvailability() {
return this.dayAvailable
}
getDaysSinceReplacedResearch() {
const e = this.getReplacedResearchItem();
return e ? this.getDayOfAvailability() - e.getDayOfAvailability() : this.getDayOfAvailability()
}
getDaysSinceFirstReplacedResearch() {
const e = this.getFirstReplacedResearchItem();
return e ? this.getDayOfAvailability() - e.getDayOfAvailability() : this.getDayOfAvailability()
}
getDaysTillReplacingResearch() {
const e = this.getReplacingResearchItem();
return e ? e.getDayOfAvailability() - this.getDayOfAvailability() : 0
}
getCosts() {
return this.costs
}
getRequiredResearches() {
return this.requiredResearches
}
getRequiredResearchItems() {
const e = [];
if (this.requiredResearches) {
const t = Object.keys(this.requiredResearches);
if (t)
for (let i = 0; i < t.length; i++)
e.push(n.IZ.getMod().getResearch(t[i]))
}
return e
}
getRequiredPlans() {
if ("string" == typeof this.requiredPlans) {
const e = this.requiredPlans.split("=");
2 === e.length ? (this.requiredPlans = {},
this.requiredPlans[n.IZ.getIdFromNotation(e[0])] = parseInt(e[1], 10)) : this.requiredPlans = null
}
return this.requiredPlans
}
getRequiredPlansAmount() {
return this.getRequiredPlans()[this.getRequiredPlansID()] || 0
}
getCurrentPlansAmount() {
return n.IZ.user.getInventory().getAmount(this.getRequiredPlansID())
}
getRequiredPlansID() {
return Object.keys(this.getRequiredPlans())[0]
}
isElite() {
return !(0,
r.Ew)(this.getRequiredPlans())
}
getReplacedResearch() {
return this.replacedResearch
}
getReplacedResearchItem() {
let e = null;
const t = this.getReplacedResearch();
return t > 0 && (e = n.IZ.getMod().getResearch(t)),
e
}
getFirstReplacedResearchItem() {
return n.IZ.getMod().getResearch(this.getFirstReplacedResearch())
}
getFirstReplacedResearch() {
if (null === this.firstReplacedResaerchId) {
const e = this.getReplacedResearch();
if (e > 0) {
const t = n.IZ.getMod().getResearch(e);
t && t.getDayOfAvailability() > 0 ? this.firstReplacedResaerchId = t.getFirstReplacedResearch() : this.firstReplacedResaerchId = this.getItemID()
} else
this.firstReplacedResaerchId = this.getItemID()
}
return this.firstReplacedResaerchId
}
isReplacingResearch() {
return this.getFirstReplacedResearch() != this.getItemID()
}
canBeReplaced() {
return this.getReplacingResearch() > 0
}
getReplacingResearch() {
if (null === this.replacingResearchId) {
const e = n.IZ.getMod().getResearchTypes();
this.replacingResearchId = 0;
for (const t in e)
if (e.hasOwnProperty(t) && e[t].getReplacedResearch() == this.getItemID()) {
this.replacingResearchId = e[t].getItemID();
break
}
}
return this.replacingResearchId
}
getReplacingResearchItem() {
let e = null;
const t = this.getReplacingResearch();
return t > 0 && (e = n.IZ.getMod().getResearch(t)),
e
}
getTier() {
if (!Number.isFinite(Number.parseFloat(this.tier))) {
const e = this.getReplacedResearch();
if (e > 0) {
const t = n.IZ.gameState.getMod().getResearch(e);
if (!t)
throw this.tier = 0,
new Error(`Expected research ${e} does not exist in mod ${n.IZ.getMod().getModID()}`);
this.tier = t.getTier() + 1
} else
this.canBeReplaced() ? this.tier = 1 : this.tier = 0
}
return this.tier
}
hasTiers() {
return this.getTier() >= 1
}
getMaxTier() {
const e = this.getReplacingResearchItem();
return e ? e.getMaxTier() : this.getTier()
}
getUnlocks() {
let e = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
if (null === this.unlocks) {
let t;
this.unlocks = [];
const i = n.IZ.getMod()
, s = e ? i.getFactionSpecificUnitTypes() : i.getAllUnitTypes()
, r = e ? i.getFactionSpecificResearchTypes() : i.getResearchTypes()
, o = i.getUpgrades()
, l = [...Object.values(s), ...Object.values(o), ...Object.values(r)];
for (let e = 0; e < l.length; e++) {
const i = l[e];
t = i.getRequiredResearches(),
t && 0 === t[this.getItemID()] && this.unlocks.push(i)
}
if (this.unlockedItems)
for (const e in this.unlockedItems)
this.unlockedItems.hasOwnProperty(e) && this.unlocks.push(new a.g(e,this.unlockedItems[e]))
}
return this.unlocks.length > 0 ? this.unlocks : null
}
getUnitTypesToBeUnlocked() {
return (this.getUnlocks() ?? []).filter((e=>e instanceof u.V))
}
getUnitTypeToBeUnlocked() {
return this.getUnitTypesToBeUnlocked()[0]
}
getUnitTypeFeaturesToBeUnlocked() {
var e;
return Object.keys((null === (e = this.getUnitTypeToBeUnlocked()) || void 0 === e ? void 0 : e.getNewUnitFeatures()) ?? {})
}
getUpgradeTypesToBeUnlocked() {
return (this.getUnlocks() ?? []).filter((e=>e instanceof l.y))
}
getDamageTypeForEffectiveTerrain() {
const e = this.getUnlocks();
if (e && e.length) {
const t = e[0];
if (t instanceof u.V)
return t.getDamageTypeForEffectiveTerrain()
}
return null
}
getFirstNonResearchTypeUnlock() {
let e = null;
const t = this.getUnlocks();
if (t && t.length)
for (let i = 0; i < t.length; i++)
if (!(t[i]instanceof g)) {
e = t[i];
break
}
return e
}
getStringOption(e) {
return this.stringOptions && this.stringOptions[e] ? this.stringOptions[e] : null
}
getDefinedConnections() {
const e = this.getStringOption(g.UltResearchTypeOption.CONNECTIONS);
return null !== e ? e.split(":") : []
}
getBaseResearchID() {
return 0 === this.getReplacedResearch() ? this.getItemID() : this.getReplacedResearchItem().getBaseResearchID()
}
getBaseResearchItem() {
return null === this.getReplacedResearchItem() ? this : this.getReplacedResearchItem().getBaseResearchItem()
}
getTiers() {
let e = this.getBaseResearchItem();
const t = [];
for (; e; )
t.push(e),
e = e.getReplacingResearchItem();
return t
}
getFactionBaseItemId() {
return this.factionBaseItemID
}
getFactions() {
return this.factions
}
availableForFaction(e) {
var t;
return null === (t = this.getFactions()) || void 0 === t ? void 0 : t.includes(e)
}
getFactionSpecificResearch() {
const e = n.IZ.getMod().getFactionSpecificResearchTypes();
return Object.values(e).find((e=>{
var t;
return (null === (t = e.getFactionBaseItemId()) || void 0 === t ? void 0 : t.identifier) === this.getItemID()
}
))
}
canBeSpeedUp() {
if (!this.minResearchSpeedUpTime)
return !0;
const e = n.IZ.gameState.getGameInfoState()
, t = n.IZ.gameState.getResearchState().getCurrentResearchDay()
, i = (0,
s.uZ)(e.getNextDayTime() - (0,
r.$B)(), 0, 864e5);
return this.minResearchSpeedUpTime + i < 864e5 * (t + 1)
}
isInProgress() {
return !!n.IZ.gameState.getResearchState().getCurrentResearch(this.getItemID())
}
}
g.UltResearchTypeOption = {
X_COORD: "x",
Y_COORD: "y",
CONNECTIONS: "connections"
},
o.F.research.UltResearchType = g
}
,
42236: (e,t,i)=>{
i.d(t, {
g: ()=>r
});
var s = i(33558);
class r {
constructor(e, t) {
this.key = e,
this.value = t
}
getKey() {
return this.key
}
getKeyHr() {
return s.w.getModdedText(this.getKey())
}
getValue(e) {
return e ? this.value >= 0 ? hup.i18n.gettext("+%s", this.value) : hup.i18n.gettext("-%s", Math.abs(this.value)) : this.value
}
}
}
,
29764: (e,t,i)=>{
i.d(t, {
w: ()=>o
});
var s = i(61809)
, r = i(39513)
, n = i(58202)
, a = i(13775);
n.F.resources.UltBuildQueueStatus = {
PROCESSING_IMMEDIATE: 0,
PROCESSING_WAITING_PROVINCE: 1,
PROCESSING_WAITING_RESOURCES: 2,
PROCESSING_RESOURCE_MISSING: 3,
PROCESSING_IMPOSSIBLE: 4,
PROCESSING_WAITING_TECHLEVEL: 5
};
class o {
constructor(e, t) {
this.provinceID = e,
this.upgrade = t || null,
this["@c"] = "be"
}
getProvinceID() {
return this.provinceID
}
setProvinceID(e) {
this.provinceID = e
}
getUpgrade() {
return this.upgrade
}
getSpecialUnit() {
return this.upgrade instanceof n.F.upgrades.UltSpecialUnit ? this.upgrade : null
}
getUnitType() {
const e = this.getSpecialUnit();
return e ? e.getUnitType() : null
}
setUpgrade(e) {
this.upgrade = e
}
getProcessingStatus() {
return this.processingStatus
}
isWaitingForProvince() {
return this.getProcessingStatus() == n.F.resources.UltBuildQueueStatus.PROCESSING_WAITING_PROVINCE
}
isWaitingForResource() {
return this.getProcessingStatus() == n.F.resources.UltBuildQueueStatus.PROCESSING_WAITING_RESOURCES
}
hasMissingResource() {
return this.getProcessingStatus() == n.F.resources.UltBuildQueueStatus.PROCESSING_RESOURCE_MISSING
}
canStartImmediately() {
return this.getProcessingStatus() == n.F.resources.UltBuildQueueStatus.PROCESSING_IMMEDIATE
}
isImpossible() {
return this.getProcessingStatus() == n.F.resources.UltBuildQueueStatus.PROCESSING_IMPOSSIBLE
}
isWaitingForTechLevel() {
return this.getProcessingStatus() == n.F.resources.UltBuildQueueStatus.PROCESSING_WAITING_TECHLEVEL
}
isStuck() {
const e = n.F.resources.UltBuildQueueStatus;
return [e.PROCESSING_RESOURCE_MISSING, e.PROCESSING_WAITING_TECHLEVEL, e.PROCESSING_IMPOSSIBLE].includes(this.getProcessingStatus())
}
getStatusColor() {
return this.statusColor
}
getIndex() {
return this.index
}
getStartTime() {
return this.startTime
}
getRemainingTimeHR() {
const e = s.gV(this.getCompletionTime() - s.$B());
return a.Z.formatTimer(e / 1e3, !1, 2)
}
getCompletionTime() {
return this.completionTime
}
getSlowestResourceID() {
return this.slowestResourceID
}
isConstruction() {
return this.upgrade && this.upgrade instanceof n.F.upgrades.UltModableUpgrade
}
isProduction() {
return this.upgrade && this.upgrade instanceof n.F.upgrades.UltSpecialUnit
}
getDisplayedIndex() {
return this.index + 1
}
getHelp(e) {
const {i18n: t} = r.IZ
, i = s.$B()
, o = r.IZ.gameState.getBuildQueueState().getQueue()
, l = r.IZ.gameState.getMapState()
, u = this.getUpgrade()
, h = l.getProvince(this.getProvinceID())
, g = this.getStartTime()
, c = o
, d = c.indexOf(this)
, p = r.IZ.getMod().getUpgrade(this.upgrade.getItemID());
let m, I = "";
m = t.gettext("#%1$d: %2$s in %3$s", this.getIndex() + 1, u.getName(), h.getName());
let T = null
, A = null
, y = 0;
switch (this.getProcessingStatus()) {
case n.F.resources.UltBuildQueueStatus.PROCESSING_IMMEDIATE:
0 == this.getIndex() ? I = t.gettext("Starts immediately.") : d > 0 && (T = c.getEntry(d - 1),
A = l.getProvince(T.getProvinceID()),
I = t.gettext("Waiting for %2$s in %3$s (#%1$d) to be started.", this.getIndex(), T.getUpgrade().getName(), A.getName()));
break;
case n.F.resources.UltBuildQueueStatus.PROCESSING_WAITING_PROVINCE:
{
let e = null;
for (T = null,
y = d; null == e && y > 0; )
y--,
T = c.getEntry(y),
T.getProvinceID() == this.getProvinceID() && T.getCompletionTime() === g && (e = T.getUpgrade());
null == e && (h.isBuilding() && h.getConstruction().getEventTime() === g ? e = h.getConstruction().getUpgrade() : h.isProducing() && h.getProducing().getEventTime() === g && (e = h.getProducing().getUpgrade()),
y = -1),
null != e && (I = y >= 0 ? t.gettext("Waiting for %2$s in %3$s (#%1$d) to be completed.", T.getIndex() + 1, e.getName(), h.getName()) : t.gettext("Waiting for %2$s in %3$s to be completed.", 0, e.getName(), h.getName()));
break
}
case n.F.resources.UltBuildQueueStatus.PROCESSING_WAITING_TECHLEVEL:
{
const e = r.IZ.getMod().hasInheritingUpgrades() ? p.getDayOfAvailability() : p.getTechAvailableDay(this.upgrade.getTier());
I = t.gettext("Waiting for required techlevel."),
I += `<br>${t.gettext("Available on day %s", e)}</br>`;
break
}
case n.F.resources.UltBuildQueueStatus.PROCESSING_WAITING_RESOURCES:
I = t.gettext("Waiting for %s.", r.IZ.getMod().getResourceName(this.getSlowestResourceID()));
break;
case n.F.resources.UltBuildQueueStatus.PROCESSING_RESOURCE_MISSING:
for (T = null,
y = 0; null == T && y < this.getIndex(); ) {
const e = o.getEntry(y);
e.getProcessingStatus() === n.F.resources.UltBuildQueueStatus.PROCESSING_RESOURCE_MISSING && (T = e),
y++
}
null != T ? (A = l.getProvince(T.getProvinceID()),
I = `<b>${t.gettext("Uncertain production start!")}</b><br/>`,
I += t.gettext("The resources needed to start the production of %2$s in %3$s (#%1$d) are currently not produced.", y, T.getUpgrade().getName(), A.getName())) : I = `<b>${t.gettext("Uncertain production start!")}</b><br/>${t.gettext("The %1$s needed for the %2$s is missing and is currently not produced.", r.IZ.getMod().getResourceName(this.getSlowestResourceID()), u.getName())}`;
break;
case n.F.resources.UltBuildQueueStatus.PROCESSING_IMPOSSIBLE:
I = `<b>${t.gettext("Will be skipped.")}</b><br/>${t.gettext("This order can not be executed in %s. Prerequisites are missing.", h.getName())}`
}
if (g > 0) {
const e = s.gV(g - i)
, r = s.gV(this.getCompletionTime() - i);
I += `<ul class="ul_list_disc"><li>${t.gettext("Starts in about %s", a.Z.formatTimer(Math.max(0, e) / 1e3, !1, 2))}</li><li>${t.gettext("Completed in about %s", a.Z.formatTimer(r / 1e3, !1, 2))}</li></ul>`
}
return e && (I += `<div><b>${t.gettext("Click to remove from build queue.")}</b></div>`),
{
title: m,
text: I,
image: null
}
}
}
n.F.resources.UltBuildQueueEntry = o
}
,
16808: (e,t,i)=>{
i.d(t, {
t: ()=>u
});
var s = i(67929)
, r = i.n(s)
, n = i(61809)
, a = i(13524)
, o = i(58202)
, l = i(13775);
class u {
constructor() {
this.resourceEntries = {},
this.categoryID = 0,
this.dailyUnitConsumption = 0,
this.dailyUpgradeConsumption = 0,
this.dailyPopulationConsumption = 0
}
toJSON() {
const e = a.M.objectToHashMap(r()({}, this.resourceEntries));
return {
"@c": "rc",
categoryID: this.categoryID,
resourceEntries: e
}
}
getCategoryID() {
return this.categoryID
}
getResourceEntriesAsArray() {
return Object.values(this.resourceEntries)
}
containsResourceEntry(e) {
return void 0 !== this.resourceEntries[e]
}
getResourceEntry(e) {
return this.resourceEntries[e]
}
getResourceEntries() {
return this.resourceEntries
}
getName() {
return this.name || hup.gameState.getResourceState().getResourceClassName(this.categoryID)
}
getAmount(e) {
void 0 === e && (e = n.$B());
let t = 0;
for (const i in this.resourceEntries)
this.resourceEntries.hasOwnProperty(i) && (t += this.resourceEntries[i].getAmount(e));
return t
}
getPriority() {
let e = 0;
const t = this.getResourceEntriesAsArray();
for (let i = 0; i < t.length; i++)
e += t[i].getPriority();
return e
}
getPercentMet(e) {
void 0 === e && (e = n.$B());
let t = 0;
const i = this.getResourceEntriesAsArray();
for (let s = 0; s < i.length; s++)
t += i[s].getPercentMet(e) * i[s].getPriority();
return t
}
getPercentMetHR(e) {
return Math.round(100 * this.getPercentMet(e))
}
getRateHR() {
const e = hup.i18n.gettext("/h");
return `${l.Z.formatNumber(3600 * this.getRate())} ${e}`
}
getRate() {
let e = 0;
const t = this.getResourceEntriesAsArray();
for (let i = 0; i < t.length; i++)
e += t[i].getRate();
return e
}
isRatePositive() {
return this.getRate() > 0
}
getMinConsumption() {
return this.minConsumption
}
getAmountHR() {
return l.Z.formatNumber(this.getAmount(n.$B()))
}
getConsumption() {
let e = 0;
const t = this.getResourceEntriesAsArray();
for (let i = 0; i < t.length; i++)
e += t[i].getConsumption();
return e
}
getConsumptionHR() {
return l.Z.formatNumber(this.getConsumption())
}
static getCategoryForResourceID(e) {
const t = hup.gameState.getResourceState().getPlayerResourceCategories();
for (const i in t)
if (t.hasOwnProperty(i) && t[i].containsResourceEntry(e))
return t[i];
return null
}
getDailyUnitConsumption() {
return this.dailyUnitConsumption
}
getDailyUpgradeConsumption() {
return this.dailyUpgradeConsumption
}
getDailyPopulationConsumption() {
return this.dailyPopulationConsumption
}
}
o.F.resources.UltResourceCategory = u
}
,
37289: (e,t,i)=>{
i.d(t, {
Z: ()=>l
});
i(10711);
var s = i(61809)
, r = i(39513)
, n = i(16808)
, a = i(58202)
, o = i(13775);
class l {
constructor() {
this.maxAmount = -1,
this.minConsumption = 0,
this.dailyUnitConsumption = 0,
this.dailyUpgradeConsumption = 0,
this.dailyPopulationConsumption = 0,
this.categoryID = -1,
this.resourceID = 0,
this.order = -1
}
getResourceID() {
return this.resourceID
}
getCategory() {
if (n.t && n.t.getCategoryForResourceID)
return n.t.getCategoryForResourceID(this.getResourceID());
throw new Error("UltResourceCategory was not loaded before usage in UltResourceEntry")
}
getCategoryID() {
if (-1 === this.categoryID) {
const e = this.getCategory();
this.categoryID = e ? e.getCategoryID() : 0
}
return this.categoryID
}
getName() {
return r.IZ.ModdableI18n.getModdedText(r.IZ.ModdableI18n.MsgId.RESOURCE_NAME, this.resourceID) || this.name
}
canBuyWithPremium() {
return !!this.getPremiumOrder()
}
getPremiumOrder() {
return r.IZ.gameState.getResourceProfile().getPremiumOrder(this.resourceID)
}
getAmount0() {
return this.amount0
}
getRequiredAmountToPreventDepletion(e) {
if (e > this.getTime0()) {
const t = this.getRate() * (e - this.getTime0()) / 1e3;
return this.getAmount0() + t > 0 ? 0 : -(this.getAmount0() + t)
}
return 0
}
getAmount(e) {
if (void 0 === e && (e = s.$B()),
e > this.getTime0()) {
let t = this.getRate() * (e - this.getTime0()) / 1e3;
return this.hasLimitedStorage() && this.amount0 + t > this.maxAmount && (t = this.maxAmount <= this.amount0 ? 0 : this.maxAmount - this.amount0),
Math.floor(Math.max(0, this.getAmount0() + t))
}
return Math.floor(Math.max(0, this.getAmount0()))
}
getAmountHR() {
return o.Z.formatNumber(this.getAmount())
}
getMinConsumption() {
return this.minConsumption
}
getConsumption() {
return this.minConsumption + this.getCategory().getMinConsumption() * this.getPriority()
}
getPriority() {
return this.priority
}
updatePriorityAndNormalize(e, t) {
if (this.priority != t) {
const i = Math.min(1, Math.max(0, t));
this.updatePriority(e, i);
let s = 1 - this.getCategory().getPriority();
const r = this.getCategory();
for (const t in r.resourceEntries)
if (r.resourceEntries.hasOwnProperty(t)) {
const i = r.resourceEntries[t];
if (i.getResourceID() !== this.getResourceID()) {
let t;
t = s >= 0 ? Math.min(s, 1 - i.getPriority()) : Math.max(s, -i.getPriority()),
i.updatePriority(e, i.getPriority() + t),
s -= t
}
}
}
}
updatePriority(e, t) {
if (t < 0 || t > 1)
throw new Error(`Production priority is out of bounds: ${t}`);
const i = t - this.priority;
Math.abs(i) > 0 && (this.priority = t,
this.updateCalculatedRate(e))
}
getProduction() {
return this.production
}
getDailyUnitConsumption() {
return this.dailyUnitConsumption + this.getCategory().getDailyUnitConsumption() * this.getPriority()
}
getDailyUpgradeConsumption() {
return this.dailyUpgradeConsumption + this.getCategory().getDailyUpgradeConsumption() * this.getPriority()
}
getDailyPopulationConsumption() {
return this.dailyPopulationConsumption + this.getCategory().getDailyPopulationConsumption() * this.getPriority()
}
getRate() {
return this.rate
}
updateCalculatedRate(e) {
const t = (this.getProduction() - this.getConsumption()) / (r.IZ.consts.DAY_MILLIS / 1e3);
this.updateRate(e, t)
}
updateRate(e, t) {
this.rate = t
}
updateAmount(e, t, i) {
let s = 0;
return this.update(e),
this.amount0 += t,
this.amount0 < 0 && (s = -this.amount0,
this.amount0 = 0),
this.maxAmount > 0 && this.amount0 > this.maxAmount && !i && (s = this.maxAmount - this.amount0,
this.amount0 = this.maxAmount),
r.IZ.gameState.getResourceState().updateStateID(),
s
}
update(e) {
const t = this.getAmount(e);
this.lack0 += this.getLack(e),
this.produced0 += this.getProduced(e),
this.consumed0 += this.getConsumed(e),
this.amount0 = t,
this.time0 = e
}
getLack(e) {
let t = 0;
return this.updating && this.rate < 0 && (t = this.rate * (e - this.time0) / 1e3),
-Math.min(0, this.amount0 + t)
}
getProduced(e) {
const t = (e - this.time0) / r.IZ.config.consts.DAY_MILLIS;
return this.production * t
}
getConsumed(e) {
const t = (e - this.time0) / r.IZ.config.consts.DAY_MILLIS;
return this.getConsumption() * t
}
getRateHR() {
const e = r.IZ.i18n.gettext("/h");
return `${o.Z.formatNumber(3600 * this.getRate())} ${e}`
}
getUnitName(e) {
return this.resourceID == r.IZ.consts.MONEY ? r.IZ.consts.POUNDS : r.IZ.i18n.ngettextNoCache("ton", "tons", e)
}
isRatePositive() {
return this.getRate() >= 0
}
isRateCritical() {
return !this.isRatePositive() && 0 == this.getAmount() || this.hasLimitedStorage() && this.getAmount() >= this.getMaximumAmount() && this.isRatePositive()
}
getPercentMet(e) {
const t = this.getConsumption()
, i = this.getAmount(e);
return this.production + i - t < 0 ? (this.production + i) / t : 1
}
getTime0() {
return this.time0
}
getProductionFactor() {
return this.productionFactor > 0 ? this.productionFactor : 1
}
isHidden() {
return this.getCategoryID() <= 0
}
isCurrency() {
return this.getResourceID() == r.IZ.consts.MONEY
}
isManpower() {
return r.IZ.getMod().hasManpower() && r.IZ.getMod().getManpowerResourceID() == this.getResourceID()
}
isTradeable() {
return !this.isHidden() && !this.isCurrency() && !this.isManpower()
}
hasLimitedStorage() {
return this.maxAmount > 0
}
getMaximumAmount() {
return this.maxAmount
}
isEnoughForADay() {
if (this.getProduction() < this.getConsumption()) {
if (this.getAmount() <= 0)
return !1;
if (this.getRemainingSeconds() / 3600 <= 24)
return !1
}
return !0
}
needsNotMet() {
return this.getProduction() < this.getConsumption() && this.getAmount() <= 0
}
getRemainingSeconds() {
return Math.floor(24 * this.getRemainingDays() * 60 * 60)
}
getRemainingDays() {
const e = Math.abs(this.getProduction() - this.getConsumption());
return this.getAmount() / e
}
getIconSmall() {
return r.IZ.ui.iconsHelper.getResourceIconSmall(this.getResourceID())
}
setOrder(e) {
this.order = e
}
getOrder() {
return this.order
}
}
a.F.resources.UltResourceEntry = l
}
,
12596: (e,t,i)=>{
i(29323);
var s = i(58202);
s.F.UltAIProfile = class {
getApprovalTowards(e) {
const t = this.relations[e];
return t ? (t.getPositiveActions() + 1) / (t.getPositiveActions() + t.getNegativeActions() + 2) : 0
}
}
;
i(81621);
s.F.UltAIRelation = class {
constructor() {
this.bias = 0
}
getPositiveActions() {
return Number.isNaN(this.positiveActions) && (this.positiveActions = 2),
this.positiveActions + this.bias
}
getNegativeActions() {
return Number.isNaN(this.negativeActions) && (this.negativeActions = 2),
this.negativeActions + this.bias
}
}
;
i(82673),
i(60462);
var r = i(41048);
class n extends r.a {
}
s.F.UltReportArticleItem = n;
var a = i(15372)
, o = i(89392);
class l extends o.j {
}
s.F.UltAutoGameState = l;
i(84593),
i(71582),
i(82840),
i(81006),
i(84097),
i(54987),
i(87477);
var u = i(20048);
s.F.UltDetailedSpyState = class {
constructor() {
this.map = null,
this.faState = null,
this.rState = null,
this.rsState = null,
this.jobs = null,
this.armyState = null
}
getMap() {
return this.map
}
getSpyJobs() {
return this.jobs
}
getSpyJobsForNameAndOpponent(e, t) {
const i = [];
for (let s = 0; s < this.jobs.length; s++)
this.jobs[s].getJobName() == e && this.jobs[s].getOpponentID() == t && i.push(this.jobs[s]);
return i
}
getResourceState() {
return this.rState
}
getResearchState() {
return this.rsState
}
getForeignAffairsState() {
return this.faState
}
getArmyState() {
return this.armyState
}
initSpyJobs() {
this.jobs || (this.jobs = []);
for (let e = 0; e < this.jobs.length; e++)
if (!(this.jobs[e]instanceof u.B)) {
const t = new u.B;
this.jobs[e] = Object.assign(t, this.jobs[e])
}
}
getPlayerIDs() {
const e = [];
if (this.getMap()) {
const t = this.getMap().locations;
for (let i = 0; i < t.length; i++)
e.includes(t[i].getOwnerID()) || e.push(t[i].getOwnerID())
}
return e
}
getPlayerProvinces(e) {
const t = [];
if (this.getMap()) {
const i = this.getMap().locations;
for (let s = 0; s < i.length; s++)
i[s].getOwnerID() === e && t.push(i[s])
}
return t
}
getSpyJobsForProvince(e) {
const t = []
, i = this.getSpyJobs();
for (let s = 0; s < i.length; s++)
i[s].getProvinceID() == e && t.push(i[s]);
return t
}
getProvince(e) {
if (this.getMap()) {
const t = this.getMap().locations;
for (let i = 0; i < t.length; i++)
if (t[i].getLocationID() == e)
return t[i]
}
return null
}
}
;
i(6422),
i(34745),
i(30619);
s.F.UltGameProperties = class {
constructor() {
this.gameID = null,
this.gameserver = null,
this.gamedb = null,
this.engine = null,
this.modID = null,
this.modVersionID = null,
this.scenarioID = null,
this.startOfGame2 = null,
this.endOfGame2 = null,
this.nrOfPlayers = null,
this.openSlots = null,
this.dayOfGame = null,
this.creatorID = null,
this.title = null,
this.comment = null,
this.antiCheatLevel = null,
this.password = null,
this.minRank = null,
this.managedGame = null,
this.lastLoginTime = null,
this.language = null,
this.demoGame = null,
this.autoUpdateInterval = null,
this.aiLevel = null,
this.victoryPoints = null,
this.victoryCondition = null,
this.countrySelection = null,
this.teamSettings = null,
this.numberOfTeams = null,
this.allianceA = null,
this.allianceB = null,
this.allianceGame = null,
this.ranked = null,
this.goldRound = null,
this.distributeProvincesToHumanPlayers = null,
this.timeScale = null,
this.questProvinceConquer = null
}
}
;
i(81177);
s.F.ImpactType = {
NORMAL: 0,
DAMAGE_AIR: 1,
SEA: 2,
BUILDING: 3,
ATOMIC: 4
};
s.F.UltImpact = class {
constructor() {
this.type = 0,
this.position = null,
this.time = 0,
this.count = 0
}
applyData(e) {
this.type = e.type,
this.position = e.pos,
this.time = e.t,
this.count = e.c
}
getType() {
return this.type
}
getPosition() {
return this.position
}
getCount() {
return this.count
}
isNormal() {
return this.type === s.F.ImpactType.NORMAL
}
isNuclear() {
return this.type === s.F.ImpactType.ATOMIC
}
getExpirationPeriod() {
return this.type === s.F.ImpactType.ATOMIC ? 3 * hup.config.consts.DAY_MILLIS : 2 * hup.config.consts.DAY_MILLIS
}
hasExpired(e) {
return this.time + this.getExpirationPeriod() < e
}
}
;
i(46082);
s.F.UltInGameAllianceApplicant = class {
constructor() {
this.playerID = null,
this.timeStamp = null
}
getPlayerID() {
return this.playerID
}
getApplicationDateInFormat() {
return `${new Date(this.timeStamp).toLocaleDateString()} - ${new Date(this.timeStamp).toLocaleTimeString()}`
}
}
;
var h = i(19725);
s.F.UltInGameAllianceLogMessage = class {
constructor() {
this.logDate = null,
this.playerID = null,
this.targetPlayerID = null,
this.inGameAllianceAction = null,
this._generatedMessage = null
}
getDate() {
return new Date(this.logDate).toLocaleDateString()
}
getMessage() {
return this._generatedMessage ? this._generatedMessage : this._generateMessage()
}
_generateMessage() {
let e = "";
const t = h.H
, i = this.playerID ? hup.gameState.getPlayerState().getPlayer(this.playerID) : null
, s = this.targetPlayerID ? hup.gameState.getPlayerState().getPlayer(this.targetPlayerID) : null;
switch (this.inGameAllianceAction) {
case t.PLAYER_ACCEPTED:
e = hup.i18n.gettext("%s has joined the coalition", s.getName());
break;
case t.PLAYER_KICKED:
e = hup.i18n.gettext("%s has been kicked by %s", s.getName(), i.getName());
break;
case t.PLAYER_LEAVES:
e = hup.i18n.gettext("%s has left the coalition", i.getName());
break;
case t.LEADER_CHANGED:
i && s && (e = hup.i18n.gettext("%s has come to the power of this coalition after %s", s.getName(), i.getName()))
}
return this._generatedMessage = e
}
}
;
i(95020),
i(63912),
i(40102),
i(41788),
i(48375),
i(33773);
s.F.UltLoginMessage = class {
constructor(e, t) {
this.title = e,
this.content = t
}
}
;
i(55970);
s.F.UltMADGameInfo = class {
constructor() {
this.loginCount = 0,
this.titleID = 0,
this.language = "",
this.userIDToTradeInfoMap = null,
this.loginDateInMilliseconds = null
}
getLoginCount() {
return this.loginCount
}
getTradeMap() {
return this.userIDToTradeInfoMap ? this.userIDToTradeInfoMap : {}
}
getTradeInfoByUserID(e) {
return this.getTradeMap()[e]
}
getLanguageName() {
let e = "";
return this.language && (e = this.language.indexOf("default") > -1 ? "en" : this.language),
e
}
getTitleName() {
let e = "";
if (this.titleID) {
const t = parseInt(this.titleID);
1 === t ? e = "SUP" : 511 === t ? e = "COW" : 283 === t && (e = "30K")
}
return e
}
getFirstLoginDate() {
return this.loginDateInMilliseconds ? new Date(parseInt(this.loginDateInMilliseconds)).toLocaleString() : "-"
}
}
;
ultshared.UltMADHammerLog = class {
constructor() {
this.caseID = null,
this.entryInTime = null,
this.time = null,
this.responsible = null
}
getEntryInTime() {
return this.entryInTime
}
getFormattedTime() {
return new Date(this.time).toLocaleString()
}
getResponsibleName() {
let e = null;
return e = -1 === this.responsible.indexOf("system") ? `${this.responsible} [Admin]` : this.responsible.indexOf("system /") > -1 ? `${this.responsible} [User]` : this.responsible,
e
}
}
;
ultshared.UltMADTradeInfo = class {
constructor() {
this.resourceToTradeCountMap = null
}
getTradeCountMap() {
return this.resourceToTradeCountMap ? this.resourceToTradeCountMap : {}
}
}
;
i(69121);
var g = i(39513);
s.F.UltMapInfo = class {
constructor() {
this.dayOfGame = 0,
this.owner = [],
this.properties = null,
this.initialized = !1,
this.ownerMap = null,
this.propertiesMap = null
}
init() {
this.ownerMap = {},
this.propertiesMap = {};
const e = this.owner
, t = window.atob(this.properties);
let i = 0;
const s = g.IZ.gameState.getMapState().getProvinceArray();
for (let r = 0; r < s.length; r++) {
const n = s[r];
this.ownerMap[n.getLocationID()] = e[i];
const a = t.charCodeAt(i);
this.propertiesMap[n.getLocationID()] = {
hasCapital: this.bitTest(a, 0),
hasRailroad: this.bitTest(a, 1),
hasBattle: this.bitTest(a, 2),
hasFortress: this.bitTest(a, 3),
hasFactory: this.bitTest(a, 4),
hasHarbour: this.bitTest(a, 5)
},
i++
}
this.initialized = !0
}
bitTest(e, t) {
return 0 != (e >> t & 1)
}
getDayOfGame() {
return this.dayOfGame
}
getProvinceOwner(e) {
return this.initialized || this.init(),
this.ownerMap[e]
}
hasBattle(e) {
return this.initialized || this.init(),
this.propertiesMap[e].hasBattle
}
hasRailroad(e) {
return this.initialized || this.init(),
this.propertiesMap[e].hasRailroad
}
}
;
i(57421),
i(57361),
i(10072),
i(21778),
i(45782),
i(74241);
var c = i(7905);
i(73576),
i(34966),
i(93658),
i(76110),
i(16281),
i(93045),
i(83087);
s.F.ScenarioState = class {
researchDaysOffset = 0;
doubleResourceProductionThreshold = 5e3;
poiShowIcon = !1;
premiumSpyJobs = [];
getResearchDaysOffset() {
return this.researchDaysOffset
}
getDoubleResourceProductionThreshold() {
return this.doubleResourceProductionThreshold
}
isPoiShowIcon() {
return this.poiShowIcon
}
applyData(e) {
var t;
Object.assign(this, e),
this.premiumSpyJobs = null === (t = e.premiumSpyJobs) || void 0 === t ? void 0 : t.map((e=>Object.assign(new u.B, e)))
}
getPremiumSpyJobs() {
return this.premiumSpyJobs
}
getPremiumSpyJob(e) {
return this.getPremiumSpyJobs().find((t=>t.getJobName() === e))
}
}
;
i(73170);
var d = i(61809)
, p = (i(3577),
i(16033))
, m = (i(4563),
i(13775));
s.F.UltProvinceProduction = class {
constructor() {
this.upgrade = null,
this.time = 0,
this.startTime = 0,
this.speedUp = 0
}
applyData(e) {
this.time = e.t,
this.startTime = e.s,
this.upgrade = e.u || null
}
getEventTime() {
return this.time
}
setEventTime(e) {
this.time = e
}
getStartTime() {
return this.startTime
}
setStartTime(e) {
this.startTime = e
}
getUnitType() {
return this.upgrade instanceof p.U ? this.upgrade.getUnit().getUnitType() : null
}
getUpgrade() {
return this.upgrade
}
setUpgrade(e) {
this.upgrade = e
}
getSpeedUp() {
return this.speedUp
}
setSpeedUp(e) {
this.speedUp = e
}
getRemainingBuildTime() {
const e = d.$B();
return Math.floor((this.getEventTime() - e) / 1e3)
}
getRemainingBuildTimeHR(e) {
e = !!e;
let t = this.getRemainingBuildTime();
return t < 0 && (t = 0),
m.Z.formatTimer(t, e)
}
isStalled() {
const e = d.$B();
return this.getStartTime() - e > 1e10
}
}
;
i(72285),
i(21420),
i(70821);
class I {
getModel() {
return {}
}
}
s.F.UltQuestReward = I;
var T = i(13950);
class A extends I {
constructor(e, t) {
super(),
this.planRewardMap = e,
t && (this.planRewardMap = {},
this.planRewardMap[t] = 1)
}
getModel() {
const e = hup.gameState.getPlayerProfile().getFaction()
, t = {
type: "blueprint",
blueprint: !0,
rewardEntries: Object.keys(this.planRewardMap).map((t=>{
let i = hup.getMod().getResearch(t);
i || (i = hup.getMod().getResearchesByBlueprintID(t)[0]);
const s = this.planRewardMap[t]
, r = i.getUnlocks(!1)
, n = r.find((t=>t.availableForFaction(e))) ?? r[0]
, a = i.getCurrentPlansAmount()
, o = i.getRequiredPlansAmount()
, l = 100 * a / o;
return {
name: n.getTypeName(),
currentBlueprints: a,
neededBlueprints: o,
percent: l,
unitType: n,
rewardAmount: s
}
}
))
};
return Object.seal(t),
t
}
}
T.x.register("QuestPlansReward", (e=>new A(e.planRewardMap,e.researchID)));
s.F.UltQuestResourcesReward = class extends I {
constructor(e) {
super(),
this.resources = e
}
getResources() {
return this.resources
}
getModel() {
return {
type: "resources",
group: this.getResources()
}
}
}
;
i(43112),
i(6266),
i(8493);
s.F.map.UltRegion = class {
getIndex() {
return this.index
}
getName() {
return this.name
}
}
;
i(5766);
var y = i(85665);
function S(e) {
return new c.Z(e.orderID,e.buy,e.amount,e.limit,e.resourceType,-1)
}
s.F.UltResourceProfile = class {
constructor() {
this.categories = {},
this.entries = null,
this.mobilizationValue = 10,
this.corruptionValue = 0,
this.premiumOrders = {},
this.personalOrders = {}
}
getCorruptionValue() {
return this.corruptionValue
}
getCategories() {
return this.categories
}
getResources() {
return null == this.entries && this.initResourceEntries(),
this.entries
}
initResourceEntries() {
this.entries = {};
const e = this.getCategories();
for (const t in e)
if (e.hasOwnProperty(t)) {
const i = e[t].getResourceEntries();
for (const e in i)
if (i.hasOwnProperty(e)) {
const t = i[e];
this.entries[t.getResourceID()] = t
}
}
}
getResource(e) {
return this.getResources()[e]
}
getPremiumOrdersList() {
const e = new a.L;
for (const t in this.premiumOrders)
this.premiumOrders.hasOwnProperty(t) && (this.premiumOrders[t].setPremium(!0),
e.push(this.premiumOrders[t]));
return e
}
getPremiumOrder(e) {
return this.premiumOrders ? this.premiumOrders[e] : null
}
getPersonalOrdersList(e) {
return Object.values(this.personalOrders).flatMap((e=>e)).filter((t=>t.buy === e)).map(S)
}
getPersonalOrder(e) {
for (const t of Object.keys(this.personalOrders))
for (const i of this.personalOrders[t])
if (i.orderID === e)
return S(i);
return null
}
getExecutedOrders() {
return this.executedOrders
}
getMobilizationFactor() {
return hup.gameState.getMod().hasGameFeature(y.f.GF_MOBILIZATION) ? this.mobilizationValue / 10 : 1
}
}
;
i(62442),
i(97978),
i(54753);
var f = i(55542)
, P = i(87928);
s.F.UltSpyReports = class {
getDetailedSpyState(e, t) {
if (0 == e)
return null;
const i = this.getDailyState(e, t);
return i && i.detailedStates[g.IZ.config.userData.playerID - 1] || null
}
getDailyState(e, t) {
if (null === this.dailyStates[e]) {
if (t)
return null;
f.N.publish(P.q.REQUEST_GAMESTATE_UPDATE, {
state: g.IZ.gameState.getSpyState(),
option: e
})
}
return this.dailyStates[e]
}
getDailyStates() {
return this.dailyStates
}
getArmyState(e) {
const t = this.getDetailedSpyState(e, !0);
return t ? t.armyState : null
}
getPlayerIDsForDay(e) {
let t = [];
const i = this.getDailyState(e).detailedStates;
if (null !== i)
for (let s = 0; s < i.length; s++)
null !== i[s] && (t = t.concat(i[s].getPlayerIDs()));
return t = [...new Set(t)],
t.sort()
}
getNumJobsForProvince(e, t) {
let i = 0;
const s = this.getDailyState(t);
if (s) {
const t = s.detailedStates;
if (null !== t)
for (let s = 0; s < t.length; s++)
null !== t[s] && (i += t[s].getSpyJobsForProvince(e).length)
}
return i
}
}
;
i(74787),
i(71634);
class D extends r.a {
}
s.F.UltEOGArticle = D;
i(86226),
i(50155);
s.F.UltTrading = class {
constructor() {
this.nextTradeID = 1,
this.tradingOffers = []
}
offerTrade(e) {
return e.setTradeID(this.nextTradeID),
this.nextTradeID++,
e
}
getOffer(e) {
let t;
for (let i = 0, s = this.tradingOffers.length; i < s; i++)
if (t = this.tradingOffers[i],
t.getTradeID() === e)
return t;
return null
}
getTradeOffersForPlayers(e, t, i) {
const s = [];
let r;
for (let n = 0, a = this.tradingOffers.length; n < a; n++)
r = this.tradingOffers[n],
i && r.getPartyB() != e || r.getPartyA() !== e && r.getPartyB() !== e || -3 !== t && r.getPartyA() !== t && r.getPartyB() !== t || s.push(r);
return s
}
getPastOffer(e) {
let t;
for (let i = 0, s = this.pastTrades.length; i < s; i++)
if (t = this.pastTrades[i],
t.getTradeID() === e)
return t;
return null
}
getPastTradeOffersForPlayers(e, t, i) {
const s = [];
if (this.pastTrades)
for (let r = 0, n = this.pastTrades.length; r < n; r++) {
const n = this.pastTrades[r]
, a = n.getPartyA() === e
, o = n.getPartyB() === e;
if (a || o) {
const e = a ? n.isDeletedBySender() : n.isDeletedByReceiver();
!i && e || -3 !== t && n.getPartyA() !== t && n.getPartyB() !== t || (n.isProcessed() || n.setProcessed(!0),
s.push(n))
}
}
return s
}
getPastTrades() {
return this.pastTrades
}
getNewOfferCount(e, t) {
let i = 0;
for (let s = 0; s < this.tradingOffers.length; s++)
this.tradingOffers[s].getPartyB() != e || t && this.tradingOffers[s].getPartyA() != t || this.tradingOffers[s].isProcessed() || i++;
return i
}
}
;
s.F.UltUserLogin = class {
constructor() {
this.gameID = null,
this.playerID = null,
this.teamID = null,
this.login = null,
this.state = null,
this.email = null,
this.password = null,
this.siteUserID = null,
this.lastIP = null,
this.lastLocalIP = null,
this.lastResolution = null,
this.hostName = null,
this.numLogins = null,
this.IPConflicts = null,
this.softIPConflicts = null,
this.lastAccessTime = null,
this.banned = null,
this.active = null,
this.allianceID = null
}
}
;
i(26820);
s.F.adviser.UltAdviseReward = class {
constructor() {
this.premiumIDToRewardAmountMap = null,
this.resourceIDToRewardAmountMap = null,
this.unitTypeIDToRewardAmountMap = null
}
getPremiumIdToRewardAmountMap() {
return this.premiumIDToRewardAmountMap
}
hasPremiumRewards() {
return !(0,
d.Ew)(this.premiumIDToRewardAmountMap)
}
getResourceRewardMap() {
return this.resourceIDToRewardAmountMap
}
hasResourceRewards() {
return !(0,
d.Ew)(this.resourceIDToRewardAmountMap)
}
getUnitRewardMap() {
return this.unitTypeIDToRewardAmountMap
}
hasUnitRewards() {
return !(0,
d.Ew)(this.unitTypeIDToRewardAmountMap)
}
hasReward() {
return this.hasUnitRewards() || this.hasResourceRewards() || this.hasPremiumRewards()
}
}
;
i(1218),
i(23469);
s.F.diplomacy.UltRelation = class {
constructor() {
this.relation = -1,
this.name = null,
this.desc = null,
this.helpText = null,
this.color = null,
this.armyColor = null
}
getRelation() {
return this.relation
}
getName() {
return this.name
}
getDescription() {
return this.desc
}
getHelpText() {
return this.helpText
}
getColor() {
return this.color
}
getArmyColor() {
return this.armyColor
}
}
;
i(31362);
var v = i(97477);
i(76020);
class R extends v.w3 {
getProvinceID() {
return this.filterID
}
onClick() {
v.w3.selectProvince(this.filterID)
}
}
ultshared.gameevents.UltNuclearImpactGameEvent = R;
i(55153);
s.F.gameevents.UltSender = class {
constructor() {
this.senderID = 0,
this.nationName = null
}
getSenderID() {
return this.senderID
}
getNationName() {
return this.nationName
}
}
;
class E extends v.w3 {
getModelID() {
return this.filterID
}
}
ultshared.gameevents.UltShowPopupGameEvent = E;
i(46707),
i(11195);
s.F.map.UltProvinceStateFeature = {
ALL_PLAYERS_CAN_BUILD: 0,
CHANGE_OWNER: 1,
MAKE_LEGAL: 2,
MAKE_CORE: 3,
NON_CONQUERABLE: 4
},
s.F.map.UltProvinceBarVisibility = {
HOSTILITY_INFO: 1,
SEND_SPIES: 2,
NATIVE_AGGRESSION_LEVEL: 3,
UPRISING_CHANCE_INFO: 4,
REVOLT_CHANCE_INFO: 5,
FORTRESS_INFO: 6,
CHANGE_MORALE: 7,
CONSTRUCTION: 8,
PRODUCTION: 9,
STATUS_UPGRADE: 10
},
s.F.map.UltProvinceStateID = {
CORE: 0,
NON_CORE: 1,
COLONY: 2,
OCCUPIED: 3,
UNINHABITED: 4
};
class C {
constructor(e) {
this.curveX1 = e.curveX1,
this.curveX2 = e.curveX2,
this.curveY1 = e.curveY1,
this.curveY2 = e.curveY2
}
getLowerThreshold() {
return this.curveX1
}
getUpperThreshold() {
return this.curveX2
}
getValueAt(e) {
return e < this.curveX1 ? this.curveY1 : e > this.curveX2 ? this.curveY2 : this.curveY1 + (e - this.curveX1) * this.getSlope()
}
getSlope() {
return this.curveX2 - this.curveX1 == 0 ? 0 : (this.curveY2 - this.curveY1) / (this.curveX2 - this.curveX1)
}
getIntegral(e, t) {
return this.getIndefiniteIntegral(t) - this.getIndefiniteIntegral(e)
}
getIndefiniteIntegral(e) {
const t = Math.min(this.curveX1, e)
, i = t * this.curveY1
, s = Math.min(this.curveX2, e) - t;
return i + (this.getSlope() * s * s / 2 + s * this.curveY1) + (Math.max(this.curveX2, e) - this.curveX2) * this.curveY2
}
}
T.x.register("ultshared.modding.configuration.UltSlopedStepFunctionConfig", (e=>new C(e)));
i(10711);
class U {
constructor(e) {
this.entries = [...e].map((e=>{
let[t,i] = e;
return {
x: t,
y: i
}
}
)).sort(((e,t)=>e.x - t.x))
}
getLowerThreshold() {
return this.entries[0].x
}
getUpperThreshold() {
return this.entries[this.entries.length - 1].x
}
getValueAt(e) {
let t = null
, i = null;
if (0 === this.entries.length)
throw new Error("no points defined");
for (const r of this.entries)
r.x <= e && (!t || r.x > t.x) && (t = r),
r.x > e && (!i || r.x < i.x) && (i = r);
if (!t)
return this.entries[0].y;
if (!i)
return this.entries[this.entries.length - 1].y;
const s = (e - t.x) * (i.y - t.y) / (i.x - t.x);
return t.y + s
}
getIntegral(e, t) {
return e === t ? 0 : e > t ? -this.getIntegral2(t, e) : this.getIntegral2(e, t)
}
getIntegral2(e, t) {
const i = Math.min(e, t)
, s = Math.max(e, t)
, r = this.entries.filter((e=>e.x > i && e.x < s));
r.push({
x: t,
y: this.getValueAt(t)
});
let n = 0
, a = {
x: e,
y: this.getValueAt(e)
};
return r.forEach((e=>{
n += (e.y + a.y) * (e.x - a.x),
a = e
}
)),
n / 2
}
}
T.x.register("nplf", (function(e) {
return new U(Object.entries(e).map((e=>{
let[t,i] = e;
return [Number(t), Number(i)]
}
)).filter((e=>{
let[t,i] = e;
return Number.isFinite(t) && Number.isFinite(i)
}
)))
}
));
i(22155),
i(17076),
i(24410),
i(43334),
i(71313),
i(20002),
i(79741),
i(42907),
i(69453),
i(59928),
i(42236);
s.F.resources.UltBuildQueue = class {
constructor() {
this.queue = [],
this.reports = [],
this["@c"] = "ultshared.resources.UltBuildQueue"
}
getEntry(e) {
return this.queue[e]
}
getEntries() {
return this.queue
}
size() {
return this.queue.length
}
indexOf(e) {
return this.queue.indexOf(e)
}
getReports() {
return this.reports
}
}
;
i(29764),
i(16808),
i(37289),
i(74515),
i(26574),
i(70057),
i(30600),
i(37887),
i(8161),
i(91939),
i(87235),
i(11452),
i(18789),
i(23449),
i(17358),
i(82623),
i(98111),
i(74619),
i(15357),
i(87572),
i(7903),
i(13822),
i(63593),
i(23794),
i(67350),
i(50910),
i(77938),
i(9704),
i(14141);
window.UnitTypeRatingEntry = class {
value = 0;
order = 0;
exceptional = !1;
ratingGroup = 0;
type = "";
getValue() {
return this.value
}
getRatingGroup() {
return this.ratingGroup
}
setType(e) {
this.type = e
}
isExceptional() {
return this.exceptional
}
getName() {
return g.IZ.ModdableI18n.getUnitRatingTypeName(this.type) ?? ""
}
getOrder() {
return this.order
}
getType() {
return this.type
}
}
,
T.x.initializeShortcuts()
}
,
20048: (e,t,i)=>{
i.d(t, {
B: ()=>n
});
var s = i(41389)
, r = i(58202);
class n {
constructor() {
this["@c"] = "ultshared.spyjobs.UltSpyJob"
}
isCountryWide() {
return this.countrywide
}
isInFlagranti() {
return this.inFlagranti
}
getProvinceID() {
return this.provinceID
}
getPremiumID() {
return this.premiumID
}
getJobName() {
return this.jobName
}
getName() {
return this.name
}
getDescription() {
return this.description
}
getOpponentID() {
return this.opponentID
}
getSpyOwnerID() {
return this.spyOwnerID
}
getAmount() {
return this.amount
}
getTime() {
return this.time
}
getDay() {
return this.day
}
isPremium() {
return this.premium
}
getMaxGmLimitLevel() {
return this.maxGmLimitLevel
}
getMission() {
return this.mission
}
getSpyMission() {
return s.Z.getForType(this.getMission())
}
isShowFromWhom() {
return this.show_from_whom
}
getDamagedUpgrade() {
return this.damagedUpgrade
}
getRevealedSpies() {
return this.revealedSpies ? this.revealedSpies : []
}
}
r.F.spyjobs.UltSpyJob = n
}
,
41389: (e,t,i)=>{
i.d(t, {
Z: ()=>s
});
class s {
constructor() {
this["@c"] = "ultshared.spyjobs.UltSpyMission",
this.hostile = !1,
this.friendly = !1,
this.helpTitle = !1
}
getName() {
return this.name
}
getHelpTitle() {
return this.helpTitle
}
getHelpText() {
return this.helpText
}
isFriendly() {
return this.friendly
}
isHostile() {
return this.hostile
}
getMissionType() {
return this.missionType
}
getDailyCosts() {
return this.dailyCosts
}
static getForType(e) {
const t = hup.getMod().getSpyMissions();
for (const i in t)
if (t.hasOwnProperty(i) && t[i].getMissionType() == e)
return t[i];
return null
}
}
}
,
86654: (e,t,i)=>{
i.d(t, {
Q: ()=>n
});
var s = i(39513)
, r = i(58202);
class n {
unitTypeIDToRewardAmountMap = null;
getRewardableUnitTypes() {
return Object.keys(this.unitTypeIDToRewardAmountMap ?? {}).map((e=>s.IZ.getMod().getUnitTypeByItemID(Number(e))))
}
}
r.F.tutorial.ChoosableRewardConfig = n
}
,
24841: (e,t,i)=>{
i.d(t, {
v: ()=>n
});
var s = i(60182)
, r = i(58202);
class n extends s.A {
constructor() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : n.TUTORIAL_PROGRESS;
super(),
this.action = e,
this["@c"] = "ultshared.tutorial.UltTutorialAction",
this.taskID = 0
}
setAction(e) {
this.action = e
}
getAction() {
return this.action
}
setTaskID(e) {
this.taskID = e
}
}
n.TUTORIAL_PROGRESS = 1,
n.TUTORIAL_CANCEL = 2,
n.TUTORIAL_CUSTOM = 3,
r.F.tutorial.UltTutorialAction = n
}
,
54557: (e,t,i)=>{
i.d(t, {
T: ()=>u
});
var s = i(55542)
, r = i(24841)
, n = i(58202);
class a extends r.v {
pickedRewardIndex = 0;
constructor(e) {
super(a.TUTORIAL_CUSTOM),
this.pickedRewardIndex = e,
this["@c"] = "ultshared.tutorial.ChooseRewardTutorialAction"
}
}
n.F.tutorial.ChooseRewardTutorialAction = a;
var o = i(15833)
, l = i(87928);
class u extends o.Z {
rewards = [];
popupModel = null;
rewardClaimed = !1;
getPopupModel() {
return this.popupModel || (this.popupModel = {
selectedRewardIndex: -1,
getTask: ()=>this
}),
this.popupModel
}
onSelectReward(e) {
this.popupModel.selectedRewardIndex = e
}
onCollectReward() {
if (this.rewardClaimed)
return;
const {selectedRewardIndex: e} = this.popupModel;
if (e < 0)
return;
const t = new a(e);
t.setTaskID(this.taskID),
s.N.publish(l.q.UI_USER_ACTION_TRIGGER, {
action: t
}),
this.rewardClaimed = !0,
s.N.publish(l.q.UI_TUTORIAL_REWARD_COLLECTED)
}
sendProgress() {}
cleanup() {
var e;
super.cleanup(),
null === (e = this.popupWindow) || void 0 === e || e.onClose()
}
getDialogID() {
return "reward_tutorial_choosable"
}
}
}
,
16866: (e,t,i)=>{
i.d(t, {
d: ()=>o
});
var s = i(55542)
, r = i(20325)
, n = i(14410)
, a = i(87928);
class o extends r.D {
process() {
super.process();
const {mapWidget: e} = this;
e && (e.togglePaintOption(n.q.ARMIES),
e.zoomToScale(hup.config.tutorial.guidance.provinceConceptTaskZoomScale),
e.showPlayerRect(hup.config.userData.playerID)),
this.startAnimation()
}
cleanup() {
this.stopAnimation = !0,
super.cleanup(),
s.N.publish(a.q.UI_DISPLAY_ARMIES)
}
startAnimation() {
this.addTimeout(this.toggleArmies.bind(this), 500)
}
toggleArmies() {
var e;
this.stopAnimation || (null === (e = this.mapWidget) || void 0 === e || e.togglePaintOption(n.q.ARMIES),
this.startAnimation())
}
}
}
,
20325: (e,t,i)=>{
i.d(t, {
D: ()=>o
});
var s = i(92893)
, r = i.n(s)
, n = i(61809)
, a = i(7799);
class o extends a.X {
constructor() {
super(),
this.headlineText = "",
this.asSubtitle = !0,
this.asFullscreen = !1
}
getHeadlineText() {
return n.hU(this.headlineText)
}
addActions() {
r()("#basicTextTutorialTaskContainer").onLzrButtonClick(this.onSkip.bind(this))
}
}
}
,
16322: (e,t,i)=>{
i.d(t, {
q: ()=>c
});
var s = i(92893)
, r = i.n(s)
, n = i(55542)
, a = i(8597)
, o = i(39513)
, l = i(15833)
, u = i(50009)
, h = i(80872)
, g = i(87928);
class c extends l.Z {
constructor() {
super(),
this.nextProvinceID = -1,
this.upgradeType = -1,
this.setPreventArmySelection(!0),
this.provinceDeselected = !1,
this.dontClosePanel = !1,
this.isAllowInstantSpeedup = !1,
this.dontAutoSelectProvinces = null,
this.unlockedUnitTypeItemId = -1
}
process() {
var e;
this.provinceDeselected || this.dontAutoSelectProvinces || (o.IZ.provinceSelection.setSelected([]),
this.provinceDeselected = !0,
this.focusOnProvince()),
o.IZ.config.tutorial.guidance.useRapidProductionPanel || o.IZ.dialogController.closeAllDialogs(),
o.IZ.tutorialGUI.hideSlides();
let t = 0;
const i = o.IZ.gameState.getMapState().getProvincesForPlayer(o.IZ.config.userData.playerID);
for (let s = 0; s < i.length; s++) {
const e = i[s];
(e.isBuildingUpgrade(this.upgradeType) || e.hasUpgrade(this.upgradeType)) && t++
}
super.process(t > 0),
null === (e = this.mapWidget) || void 0 === e || e.zoomToScale(2),
this.addSubscriber(n.N.subscribe(g.q.UI_PROVINCE_CONSTRUCTION_TOGGLE, this.update.bind(this))),
this.addSubscriber(n.N.subscribe(g.q.UI_PRODUCTIONS_TAB_SELECTED, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(g.q.UI_MAP_STATE_UPDATED, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(g.q.UI_PRODUCTIONS_SCROLLBAR_POSITION_CHANGED, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(g.q.UI_VIEW_SHOWN, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(g.q.UI_PRODUCTION_ITEM_SELECTED, this.updateTask.bind(this))),
this.addActions(),
this.updateTask()
}
onViewOpened() {
o.IZ.ui.provinceProductionsController.isOpen() && r()(".func_tab", o.IZ.ui.provinceProductionsController.sandbox.getBox()).onLzrButtonClick(this.updateTask.bind(this)),
this.updateTask()
}
cleanup() {
super.cleanup(),
this.removeActions(),
this.dontClosePanel || o.IZ.ui.provinceProductionsController.onClose()
}
allowsWindow(e) {
const t = this.dontAutoSelectProvinces && !o.IZ.provinceSelection.isSelected(this.nextProvinceID);
return (e == o.IZ.ui.provinceProductionsController.dialogID || e == o.IZ.ui.buildPlaceableWidget.dialogID) && !t
}
afterPopup() {
this.focusOnProvince(),
this.updateTask()
}
update() {
if (this.removeAllGlows(),
o.IZ.tutorialGUI.clearAllPointers(),
o.IZ.config.tutorial.guidance.useRapidProductionPanel) {
const e = o.IZ.getMod().getUnitTypeByItemID(this.unlockedUnitTypeItemId);
this.focusOnProvince(),
this.executeGuidance([()=>this.guideToRapidProductionPanel(), ()=>this.guideToProductionPanelTab(e.getSetID()), ()=>this.guideToProductionMissingRequirements(e, !0), ()=>this.guideToStartMissingRequirementsEntry(this.getUpgradeId(), !0), ()=>this.guideToProductionProvinceSelectorProvince(this.getProvince()), ()=>this.guideToProductionProvinceSelectorStart()])
} else
this.executeGuidance([()=>this.guideToProvince(), ()=>this.guideToConstructionPanel(), ()=>this.guideToConstructionPanelBuildingTab(), ()=>this.guideToConstructionPanelEntry(this.getUpgradeId()), ()=>this.guideToConstructButton(this.getUpgradeId()), ()=>this.guideToPickConstructionLocation()])
}
pointToUpgradeButton() {
const e = h.O.getUpgradeButtonInfo(this.getUpgradeId(), null, !0);
this.guideToConstructButton(this.getUpgradeId()),
this.disableOtherUpgradeButtons(e.element)
}
pointConstructionSpeedUpButton(e) {
const t = r()(".func_building_speedup");
this.pointButton(t, !0, u.J.directionTypes.B2T, e)
}
getUpgradeId() {
return this.upgradeType
}
getUpgradeType() {
return o.IZ.getMod().getUpgrade(this.getUpgradeId())
}
disableOtherUpgradeButtons(e) {
const t = e.parent().parent().parent();
for (let i = 0; i < t.children().length; i++) {
const e = t.children().eq(i).children().eq(4).children().eq(0);
e.attr("constructid") != this.getUpgradeId() && e.hasClass("func_prov_construct") && e.removeClass("func_prov_construct")
}
}
addActions() {
this.updateCallback = this.clickWrapper.bind(this, this.updateTask),
this.clickHandlersRegistered || (o.IZ.getGameContainer().on("click.tutorial touchend.tutorial", this.updateCallback),
o.IZ.getGameContainer().on("wheel.tutorial", this.updateCallback),
this.clickHandlersRegistered = !0),
this.addSubscriber(n.N.subscribe(a.N.ENGINE_WINDOW_RESIZE, this.updateCallback)),
this.addSubscriber(n.N.subscribe(g.q.UI_WINDOW_REFRESHED, (e=>{
this.allowsWindow(e.data) && e.data === h.O.getUnitProductionsPanelController().dialogID && this.updateTask()
}
)))
}
removeActions() {
o.IZ.getGameContainer().off("click.tutorial touchend.tutorial"),
o.IZ.getGameContainer().off("wheel.tutorial")
}
getProvinceID() {
return this.nextProvinceID
}
getProvince() {
const e = this.getProvinceID();
return o.IZ.gameState.getMapState().getProvince(e)
}
generateBalloonTextModel() {
super.generateBalloonTextModel();
const e = this.getUpgradeType();
this.balloonTextModel.additionalData = {
provinceName: this.getProvince().getName(),
constructionsTabId: o.IZ.ui.provinceProductionsController.isInitialized() ? o.IZ.ui.provinceProductionsController.getBuildingTabID() : -1,
upgradeName: e.getUpgradeName(),
upgradeType: e
}
}
}
}
,
43733: (e,t,i)=>{
i.d(t, {
G: ()=>a
});
i(87477);
var s = i(92893)
, r = i.n(s)
, n = i(15833);
class a extends n.Z {
constructor() {
super(),
this.texts = null,
this.titles = null,
this.imageFilePaths = null,
this.model = null,
this.showCloseButton = !0
}
process(e) {
hup.tutorialGUI.hideSlides(),
super.process(e)
}
getPopupModel() {
if (!this.model) {
const e = [];
for (let t = 0; t < this.imageFilePaths.length; t++)
e.push({
image: this.imageFilePaths[t],
title: this.titles[t],
text: this.texts[t]
});
this.model = {
articles: e,
title: this.getTitle()
}
}
return hup.config.isMobileClient || (this.model.articleIndex = 0,
this.model.currentTranslation = 0),
this.model
}
addActions() {
const e = this;
r()(".func_carousel_next", e.popupWindow.view.getBox()).onLzrButtonClick(this.onNavClicked.bind(this, !0)),
r()(".func_carousel_prev", e.popupWindow.view.getBox()).onLzrButtonClick(this.onNavClicked.bind(this, !1)),
r()(".dot_element", e.popupWindow.view.getBox()).onLzrButtonClick((function() {
e.onDotClicked.call(e, r()(this))
}
))
}
onNavClicked(e, t) {
isNaN(t) ? this.model.articleIndex = e ? Math.min(this.model.articles.length - 1, this.model.articleIndex + 1) : Math.max(0, this.model.articleIndex - 1) : this.model.articleIndex = t,
this.model.isLastArticle = this.model.articleIndex === this.model.articles.length - 1,
this.popupWindow.view.update(this.model),
this.addTimeout((()=>{
this.model.currentTranslation = -100 * this.model.articleIndex,
r()(".carousel_main_container", this.popupWindow.view.getBox()).css("transform", `translate3d(${this.model.currentTranslation}%,0,0)`)
}
), 0)
}
onDotClicked(e) {
this.onNavClicked(!1, e.data("index"))
}
}
}
,
70983: (e,t,i)=>{
i.d(t, {
Z: ()=>r
});
var s = i(15833);
class r extends s.Z {
process() {
hup.config.userDataLocal.betaUser ? this.sendProgress() : super.process()
}
}
}
,
19853: (e,t,i)=>{
i.d(t, {
N: ()=>l
});
i(87477);
var s = i(55542)
, r = i(39513)
, n = i(94243)
, a = i(14410)
, o = i(87928);
class l extends n.F {
isFinished = !1;
description = null;
title = null;
templateFileName = null;
imageName = "";
popupOnProgress = !0;
firstTimeOpen = !0;
asSubtitle = !1;
asAvatar = !1;
asFullscreen = !1;
eventFunnelID = null;
highlightsProvince = !1;
preventArmySelection = !1;
uiCleaned = !1;
currentProgressValue = null;
targetProgressValue = null;
canHideHints = !1;
isBackgroundTask = !1;
dontUseLimitedInterface = null;
taskID = null;
isCompositeTask = !1;
autoHideTutorialAdviser = !1;
ignoreScrollChangedEvent = !1;
onWindowClosedNotificationDelay = 0;
isDisplayVideoInstruction = !0;
soundId = null;
soundChannel = null;
imageConfig = null;
subscribedToEvents = !1;
process() {
this.subscribeToEvents(),
this.checkHideArmies(),
this.toggleGameUI()
}
cleanup() {
if (super.cleanup(),
this.showArmies(),
this.subscribers) {
for (let e = 0; e < this.subscribers.length; e++)
s.N.unsubscribe(this.subscribers[e]);
this.subscribers = []
}
this.removeAllGlows(),
r.IZ.tutorialGUI.clearAllPointers(),
this.uiCleaned = !0,
this.processArmyAndProvinceSelection()
}
isUICleaned() {
return this.uiCleaned
}
setFirstTime(e) {
this.firstTimeOpen = e
}
getTitle() {
return this.title ?? ""
}
getTemplateFileName() {
return this.templateFileName
}
getDescription() {
return this.description ?? ""
}
getImageName() {
return this.imageName
}
getPopupOnProgress() {
return this.popupOnProgress
}
isSubtitle() {
return this.asSubtitle
}
isAvatar() {
return this.asAvatar
}
canDisableHints() {
return this.canHideHints
}
isFullscreen() {
return this.asFullscreen
}
getFunnelEventID() {
return this.eventFunnelID ? this.eventFunnelID : 0
}
getTaskIdentifier() {
return this.taskIdentifier ?? ""
}
subscribeToEvents() {
if (this.updateTask) {
const e = this.updateTask.bind(this);
this.ignoreScrollChangedEvent || document.addEventListener("scrollbarchanged", (()=>{
this.isUICleaned() || this.updateTask()
}
)),
this.subscribedToEvents || (this.addSubscriber(s.N.subscribe(o.q.UI_WINDOW_CLOSED, e)),
this.addSubscriber(s.N.subscribe(o.q.UI_PROVINCE_UPGRADE_TOGGLE, e)),
this.addSubscriber(s.N.subscribe(o.q.UI_ARMY_SELECTED, this.onArmySelected.bind(this))),
this.subscribedToEvents = !0)
}
}
addSubscriber(e) {
this.subscribers || (this.subscribers = []),
this.subscribers.push(e)
}
onProvinceSelected(e) {}
setPreventArmySelection(e) {
this.preventArmySelection = e
}
onArmySelected(e) {
this.preventArmySelection && e.getArmyID() && (r.IZ.isTutorialFinished() ? (this.isFinished = !0,
this.cleanup()) : r.IZ.ui.helper.showFloatingTip(this.getArmyClickText()))
}
getTaskID() {
return this.taskID ?? 0
}
getStateID() {
return this.stateID ?? 0
}
getCurrentProgressValue() {
return this.isFinished ? this.getTargetProgressValue() : this.currentProgressValue ?? 0
}
getTargetProgressValue() {
return this.targetProgressValue ?? 1
}
getProgressRatio() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
const t = this.getCurrentProgressValue() / this.getTargetProgressValue();
return e ? (100 * t).toFixed(2) : t
}
isLocked() {
return "LOCKED" === this.status
}
isPending() {
return "PENDING" === this.status
}
isReady() {
return !this.status || "READY" === this.status
}
getIsBackgroundTask() {
return !!this.isBackgroundTask
}
shouldUseLimitedInterface() {
return !0 !== this.dontUseLimitedInterface
}
processArmyAndProvinceSelection() {
var e;
null !== (e = r.IZ.tutorialWidget.tutorialDeselectArmyProvinceClasses) && void 0 !== e && e.includes(this.constructor) && (r.IZ.armySelection.setSelected([]),
r.IZ.provinceSelection.setSelected([]))
}
getArmyClickText() {
return r.IZ.config.isMobileClient ? r.IZ.i18n.gettext("Please tap on province") : r.IZ.i18n.gettext("Please click on the province, not on the army!")
}
checkHideArmies() {
var e;
var t;
(null === (e = r.IZ.tutorialWidget.tutorialHiddenArmyTasks) || void 0 === e ? void 0 : e.includes(this.constructor)) && (null === (t = this.mapWidget) || void 0 === t || t.setPaintOptionValue(a.q.ARMIES, !1))
}
showArmies() {
var e;
null === (e = this.mapWidget) || void 0 === e || e.setPaintOptionValue(a.q.ARMIES, !0)
}
toggleGameUI() {
this.isSubtitle() || this.isAvatar() ? s.N.publish(o.q.UI_HIDE_GAME_UI) : s.N.publish(o.q.UI_SHOW_GAME_UI)
}
getDialogID() {
return "default_tutorial"
}
getImage() {
return this.imageConfig ? this.imageConfig[r.IZ.i18n.getLanguage()] ?? this.imageConfig.default : this.imageName
}
getSoundChannel() {
return this.soundChannel
}
getSoundId() {
return this.soundId
}
}
}
,
65677: (e,t,i)=>{
i.d(t, {
U: ()=>o
});
var s = i(55542)
, r = i(20325)
, n = i(37887)
, a = i(87928);
class o extends r.D {
constructor() {
super(),
this.counterArmyID = -1,
this.shouldProgressAfterWaitingTime = !0
}
process() {
super.process(),
this.setupArmy(),
this.model && (this.model.shouldShowNext = !1)
}
getCounterArmyID() {
return this.counterArmyID
}
afterWaiting() {
super.afterWaiting(),
hup.armySelection.setSelected([]),
s.N.publish(a.q.UI_ARMY_BAR_ENABLE)
}
setupArmy() {
const e = hup.gameState.getArmyState().getArmy(this.counterArmyID)
, t = hup.gameState.getArmyState().getArmy(e.getAttackArmyID());
if (!e || !t)
return;
hup.gameState.getMapState().getProvince(t.getLocationID()).stationaryArmyID = "spass",
this.setupAttacker(e),
this.setupDefender(t),
this.mapWidget && (this.mapWidget.mapRenderer.updateAllArmies = !0)
}
setupAttacker(e) {
e.fightStatus = n.hN.FIGHTING,
e.setTutorial(!0)
}
setupDefender(e) {
e.setSize(1),
e.fightStatus = n.hN.FIGHTING,
e.setTutorial(!0)
}
}
}
,
54659: (e,t,i)=>{
i.d(t, {
M: ()=>l
});
var s = i(92893)
, r = i.n(s)
, n = i(55542)
, a = i(15833)
, o = i(87928);
class l extends a.Z {
constructor() {
super(!1),
this.setPreventArmySelection(!0)
}
process() {
var e;
super.process(),
null === (e = this.mapWidget) || void 0 === e || e.zoomToScale(2),
this.addSubscriber(n.N.subscribe(o.q.UI_MAP_STATE_UPDATED, (()=>this.updateTask()))),
this.addSubscriber(n.N.subscribe(o.q.UI_PROVINCE_SELECTED, (()=>this.updateTask()))),
this.addSubscriber(n.N.subscribe(o.q.UI_PROVINCE_BAR_OPENED, (()=>this.lateUpdate()))),
this.addSubscriber(n.N.subscribe(o.q.UI_VIEW_SHOWN, (()=>this.updateTask()))),
hup.provinceSelection.setSelected([])
}
cleanup() {
super.cleanup(),
this.removeActions(),
hup.dialogController.closeAllDialogs()
}
afterPopup() {
hup.tutorialGUI.hideSlides(),
this.focusOnProvince(),
this.addActions(),
this.updateTask()
}
update() {
hup.tutorialController.getGUI().clearAllArrows(),
this.removeAllGlows(),
this.guideToProvince() && this.guideToProvinceBarMoraleButton() && this.guideToInventorySystemItemOrPremiumButton()
}
getProvinceID() {
return this.provinceID
}
getProvince() {
const e = this.getProvinceID();
return hup.gameState.getMapState().getProvince(e)
}
addActions() {
r()(document).on("click.tutorial touchend.tutorial", this.clickWrapper.bind(this, this.updateTask))
}
removeActions() {
r()(document).off("click.tutorial touchend.tutorial")
}
generateBalloonTextModel() {
super.generateBalloonTextModel(),
this.balloonTextModel.additionalData = {
provinceName: this.getProvince().getName(),
forProvinceMorale: !0
}
}
isIncreaseMoraleTask() {
return !0
}
}
}
,
13393: (e,t,i)=>{
i.d(t, {
_: ()=>l
});
var s = i(55542)
, r = i(39513)
, n = i(22609)
, a = i(45051)
, o = i(87928);
class l extends n.m {
popupModel = null;
rewardClaimed = !1;
premiumItemID = 0;
getPopupModel() {
return this.popupModel || (this.popupModel = {
rewards: this.getRewards(),
popupIconTag: this.getPopupIconTag(),
popupText: nl2br(this.getPopupText()),
collectRewardStep: n.V.CHEST_CLOSED,
collectRewardSteps: n.V,
imageName: this.getImageName(),
taskIdentifier: this.getTaskIdentifier()
}),
this.popupModel
}
onCollectReward() {
this.rewardClaimed || (this.rewardClaimed = !0,
this.openChestAndScheduleShowReward(),
s.N.publish(o.q.UI_TUTORIAL_REWARD_COLLECTED))
}
getRewards() {
var e;
const t = null === (e = r.IZ.getMod().getPremium(this.premiumItemID)) || void 0 === e ? void 0 : e.getOffer();
return a.J.getItemsFromOffer(t)
}
}
}
,
68050: (e,t,i)=>{
i.d(t, {
$: ()=>h
});
i(87477),
i(10711);
var s = i(55542)
, r = i(85350)
, n = i(19853)
, a = i(50009)
, o = i(80872)
, l = i(97586)
, u = i(87928);
class h extends n.N {
constructor() {
super(),
this.customSubscriptions = [],
this.customSubscriptions.push(s.N.subscribe(u.q.UI_STRATEGIC_ADVISE_AVATAR_UPDATED, this.onAdviserAvatarUpdated.bind(this))),
this.customSubscriptions.push(s.N.subscribe(u.q.UI_STRATEGIC_ADVISER_LIST_TOGGLE, this.onAdviserOpened.bind(this))),
this.customSubscriptions.push(s.N.subscribe(u.q.UI_STRATEGIC_ADVISER_TOGGLE, this.onAdviserOpened.bind(this))),
this.avatarUpdateTimeoutHandle = null
}
onAdviserOpened() {
this.sendProgress(),
this.customSubscriptions.forEach((e=>s.N.unsubscribe(e))),
this.customSubscriptions.length = 0
}
process() {
super.process(),
hup.tutorialGUI.hideSlides()
}
onAdviserAvatarUpdated() {
this.avatarUpdateTimeoutHandle = this.addTimeout(this.updateTask.bind(this), 500)
}
allowsWindow(e) {
return ["strategic_adviser_popup", l.q.STRATEGIC_ADVISER_LIST].includes(e)
}
update() {
if (!this.customSubscriptions.length)
return;
if (!hup.isTutorialMode())
return void window.onException(new Error("UltOpenAdviserTask::update: Still receiving updates although tutorial is finished"), !0);
const e = o.O.getStrategicAdviserAvatarButton();
if (e) {
var t, i;
this.resetUIState();
const s = hup.config.isMobileClient ? null : a.J.directionTypes.L2R;
this.pointButton(e, !1, s, null, null === (t = hup.config.tutorial) || void 0 === t || null === (i = t.guidance) || void 0 === i ? void 0 : i.hasRoundAdviserAvatar),
this.updateBalloonText(r.N.OPEN_ADVISER, !0)
} else
this.sendProgress()
}
cleanup() {
clearTimeout(this.avatarUpdateTimeoutHandle),
super.cleanup()
}
}
}
,
73312: (e,t,i)=>{
i.d(t, {
G: ()=>p
});
i(87477);
var s = i(92893)
, r = i.n(s)
, n = i(55542)
, a = i(8597)
, o = i(85350)
, l = i(15833)
, u = i(50009)
, h = i(80872)
, g = i(97586)
, c = i(87928)
, d = i(208);
class p extends l.Z {
constructor() {
super(!1),
this.alreadyOpened = !1,
this.initialized = !1,
this.subscribedEvents = [],
this.setPreventArmySelection(!0),
this.toggleSubscriber = null,
n.N.makeSilent(c.q.UI_RESEARCH_TOGGLE),
n.N.makeSilent(c.q.UI_PLAYER_PROFILE_TOGGLE),
n.N.makeSilent(c.q.UI_ARMY_SELECTED),
n.N.makeSilent(c.q.UI_PROVINCE_SELECTED)
}
process() {
this.addActions(),
super.process(),
this.lateUpdate()
}
updateTask() {
this.isAdviserListOpen() ? (this.alreadyOpened = !0,
hup.ui.strategicAdviserAvatarController.hasFocusSelection && (this.sendProgress(),
this.cleanup()),
hup.tutorialController.getGUI().clearAllPointers()) : this.alreadyOpened ? (hup.tutorialController && hup.tutorialController.getGUI().clearAllPointers(),
this.sendProgress(),
this.cleanup()) : (hup.ui.strategicAdviserAvatarController.isOpen() || hup.ui.strategicAdviserAvatarController.onOpen(),
this.pointButton(h.O.getStrategicAdviserAvatarButton(), null, u.J.directionTypes.L2R),
this.updateBalloonText(o.N.OPEN_ADVISER))
}
onAdviserToggled() {
this.sendProgress()
}
isAdviserListOpen() {
return d.Y.getInstance().isDialogOpen(g.q.STRATEGIC_ADVISER_LIST)
}
allowsWindow(e) {
return "strategic_adviser_popup" === e || e === g.q.STRATEGIC_ADVISER_LIST || "strategic_adviser_focus_selection_popup" === e || "adviser_intro_popup" === e
}
cleanup() {
super.cleanup(),
this.removeAllGlows(),
this.removeActions(),
n.N.makeNoisy(c.q.UI_RESEARCH_TOGGLE),
n.N.makeNoisy(c.q.UI_PLAYER_PROFILE_TOGGLE),
n.N.makeNoisy(c.q.UI_ARMY_SELECTED),
n.N.makeNoisy(c.q.UI_PROVINCE_SELECTED),
n.N.unsubscribe(this.toggleSubscriber)
}
addActions() {
this.initialized || (this.initialized = !0,
r()(document).on("click.tutorial touchend.tutorial", this.clickWrapper.bind(this, this.updateTask)),
this.subscribedEvents.push(n.N.subscribe(c.q.UI_STRATEGIC_ADVISER_TOGGLE, this.process.bind(this))),
this.subscribedEvents.push(n.N.subscribe(a.N.ENGINE_WINDOW_RESIZE, this.process.bind(this))),
this.toggleSubscriber = n.N.subscribe(c.q.UI_STRATEGIC_ADVISER_LIST_TOGGLE, this.onAdviserToggled.bind(this)),
this.subscribedEvents.push(n.N.subscribe(c.q.UI_STRATEGIC_ADVISE_AVATAR_UPDATED, this.process.bind(this))),
this.subscribedEvents.push(n.N.subscribe(c.q.UI_INITIALIZED, this.process.bind(this))))
}
removeActions() {
r()(document).off("click.tutorial touchend.tutorial");
for (let e = 0; e < this.subscribedEvents.length; e++)
n.N.unsubscribe(this.subscribedEvents[e])
}
}
}
,
15833: (e,t,i)=>{
i.d(t, {
Z: ()=>o
});
var s = i(61809)
, r = i(39513)
, n = i(19853)
, a = i(82236);
class o extends n.N {
constructor(e) {
super(),
this.popupText = "",
this.popupIconName = null,
this.isConfirmation = !1,
this.popupWindow,
this.isPassive = !!e,
this.asPopup = !0,
this.useSmallContainer = !1,
this.showCloseButton = !1,
this.isPopupConfirmed = !1,
this.hidePopup = !1
}
process() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
this.hidePopup = e,
this.firstTimeOpen && this.subscribeToEvents(),
this.checkHideArmies(),
this.toggleGameUI(),
!1 !== this.asPopup && (this.getPopupOnProgress() || this.firstTimeOpen) ? e || (r.IZ.armySelection.setSelected([]),
r.IZ.provinceSelection.setSelected([]),
r.IZ.tutorialGUI.showPopup(this)) : this.onConfirm()
}
getPopupText() {
return this.popupText
}
getPopupIconTag() {
let e = this.getImage();
return e || (e = this.getPopupIconName()),
e || (e = this.getImageName()),
e ? (-1 !== e.indexOf(".") && (e = e.substring(0, e.indexOf("."))),
`<div class="tutorial_popup_icon tutorial-${e} big_avatar_${e}"></div>`) : null
}
getPopupIconName() {
return this.popupIconName
}
isConfirmation() {
return this.isConfirmation
}
cleanup() {
super.cleanup(),
this.popupWindow instanceof a.y && this.popupWindow.close()
}
afterPopup() {
this.sendProgress()
}
onConfirm() {
this.isPopupConfirmed = !0,
this.popupWindow && this.popupWindow.isOpen() && this.popupWindow.onClose(),
this.afterPopup()
}
onConfirmButtonClick() {
this.popupWindow && this.popupWindow.isOpen() && this.popupWindow.onClose()
}
shouldUpdate() {
if (!this.hidePopup && this.asPopup && !this.isPopupConfirmed) {
if (this.popupWindow) {
if (this.popupWindow.isDialogOpen)
return !this.popupWindow.isDialogOpen();
if (this.popupWindow.isOpen)
return !this.popupWindow.isOpen()
}
return !1
}
return !0
}
setPopupWindow(e) {
this.popupWindow = e
}
allowsWindow(e) {
return !0
}
getContainerSelector() {
return this.useSmallContainer ? "#tutorialPopupContainer_small" : "#tutorialPopupContainer"
}
getPopupModel() {
const e = this.getPopupText()
, t = this.getDescription();
return {
isImagePNG: "png" === this.imageName.substr(-3),
popupImage: this.getImage(),
popupIconTag: this.getPopupIconTag(),
popupText: e ? (0,
s.oZ)(e) : "",
description: t ? (0,
s.oZ)(t) : "",
getTask: ()=>this
}
}
addActions() {}
}
}
,
27009: (e,t,i)=>{
i.d(t, {
E: ()=>h
});
var s = i(92893)
, r = i.n(s)
, n = i(55542)
, a = i(39513)
, o = i(15833)
, l = i(80872)
, u = i(87928);
class h extends o.Z {
constructor() {
super(!1),
this.nextProvinceID = -1,
this.unitTypeId = -1,
this.setPreventArmySelection(!0),
this.isDisposePanel = !1,
this.upgradeIDsToPoint = null,
this.supportSpeedUp = !1,
this.deselectProvinceOnStart = !1,
this.centerProvinceOnStart = !1,
this.processingUpdate = !1
}
process() {
this.deselectProvinceOnStart && a.IZ.provinceSelection.setSelected([]),
a.IZ.tutorialGUI.hideSlides(),
super.process(),
this.addSubscriber(n.N.subscribe(u.q.UI_PROVINCE_CONSTRUCTION_TOGGLE, this.onViewOpened.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_PRODUCTIONS_TAB_SELECTED, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_MAP_STATE_UPDATED, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_PRODUCTIONS_SCROLLBAR_POSITION_CHANGED, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_PROVINCE_SELECTED, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_VIEW_SHOWN, this.updateTask.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_PRODUCTION_ITEM_SELECTED, this.lateUpdate.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_PRODUCTION_PROVINCE_SELECTION_UPDATED, (()=>this.updateTask()))),
this.centerProvinceOnStart && this.focusOnProvince(),
a.IZ.config.isMobileClient ? this.afterPopup() : this.updateTask()
}
onViewOpened() {
this.getUnitProductionsPanelController().isOpen() && r()(".func_tab", this.getUnitProductionsPanelController().sandbox.getBox()).onLzrButtonClick(this.updateTask.bind(this)),
this.updateTask()
}
cleanup() {
super.cleanup(),
this.removeActions(),
this.isDisposePanel && this.getUnitProductionsPanelController().onClose()
}
allowsWindow(e) {
return e === this.getUnitProductionsPanelController().dialogID && a.IZ.provinceSelection.isSelected(this.getProvinceID())
}
afterPopup() {
this.focusOnProvince(),
this.updateTask(),
this.addActions()
}
update() {
this.processingUpdate || (this.removeAllGlows(),
a.IZ.tutorialGUI.clearAllPointers(),
this.processingUpdate = !0,
a.IZ.config.tutorial.guidance.useRapidProductionPanel ? this.executeGuidance([()=>this.guideToRapidProductionPanel(), ()=>this.guideToProductionPanelTab(this.getUnitType().getSetID()), ()=>this.guideToProductionProvinceSelector(this.getUnitType()), ()=>this.guideToProductionProvinceSelectorProvince(this.getProvince()), ()=>this.guideToProductionProvinceSelectorStart()]) : (this.focusOnProvince(),
this.executeGuidance([()=>this.guideToProvince(), ()=>this.guideToProductionPanel(), ()=>this.guideToProductionPanelTab(this.getUnitType().getSetID()), ()=>this.guideToProductionPanelEntry(this.getUnitType().getItemID()), ()=>this.guideToProduceButton(this.getUnitType())])),
this.processingUpdate = !1)
}
isProducingUnit() {
const e = this.getProvince().getProducing();
if (e) {
const t = e.getUpgrade().getUpgradeID();
for (let e = 0; e < this.unitTypeIds.length; e++)
if (t == this.unitTypeIds[e])
return !0
}
return !1
}
getUnitTypeID() {
return this.unitTypeId
}
getUnitType() {
return a.IZ.getMod().getUnitType(this.getUnitTypeID())
}
getProvinceID() {
return this.nextProvinceID || (this.nextProvinceID = this.provinceIDs[0]),
this.nextProvinceID
}
getProvince() {
const e = this.getProvinceID();
return a.IZ.gameState.getMapState().getProvince(e)
}
addActions() {
r()(document).on("click.tutorial touchend.tutorial", this.clickWrapper.bind(this, this.updateTask)),
this.addSubscriber(n.N.subscribe(u.q.UI_WINDOW_REFRESHED, (e=>{
e.data === this.getUnitProductionsPanelController().dialogID && this.updateTask()
}
)))
}
sortProvinceListIfNecessary() {
if (this.upgradeIDsToPoint && this.upgradeIDsToPoint.length) {
const e = this.upgradeIDsToPoint[0];
a.IZ.ui.provinceListController.isSortedByUpgrade(e) || a.IZ.ui.provinceListController.toggleSortByUpgradeID(e)
}
}
removeActions() {
r()(document).off("click.tutorial touchend.tutorial")
}
generateBalloonTextModel() {
super.generateBalloonTextModel();
const e = this.getUnitType();
this.balloonTextModel.additionalData = {
provinceName: this.getProvince().getName(),
unitName: e.getName(),
unitTabID: e.getSetID(),
unitType: e
}
}
getUnitProductionsPanelController() {
return l.O.getUnitProductionsPanelController()
}
}
}
,
6626: (e,t,i)=>{
i.d(t, {
k: ()=>r
});
var s = i(15833);
class r extends s.Z {
process() {
super.process()
}
cleanup() {
super.cleanup()
}
getPopupText() {
var e;
let t = super.getPopupText() ?? "";
const i = hup.gameState.getMapState().getProvince(null === (e = this.provSetup) || void 0 === e ? void 0 : e.provinceID);
return i && (t = t.replace(/{capturedProvinceName}/g, i.getName())),
t
}
}
}
,
87988: (e,t,i)=>{
i.d(t, {
h: ()=>o
});
i(87477),
i(64842);
var s = i(55542)
, r = i(39513)
, n = i(20325)
, a = i(87928);
class o extends n.D {
constructor() {
super(),
this.blinkEnabled = !0,
this.blinkState = !0,
this.provinceIds = [],
this.useEnemyProvinces = null,
this.useFriendlyProvinces = null,
this.useNeutralsProvinces = null,
this.capitalPosition = null,
this.timeoutHandle = null
}
process() {
var e;
super.process(),
s.N.makeNoisy(a.q.UI_PROVINCE_BAR_DISABLE),
s.N.publish(a.q.UI_PROVINCE_BAR_DISABLE),
this.blink(),
1 === this.provinceIds.length && this.pointProvince(),
null === (e = this.mapWidget) || void 0 === e || e.zoomToScale(r.IZ.config.tutorial.guidance.provinceConceptTaskZoomScale)
}
getProvince() {
return this.getProvinces()[0] || null
}
getProvinces(e) {
let t = [];
const i = r.IZ.gameState.getMapState();
if (this.provinceIds.length > 0)
this.provinceIds.forEach((e=>{
t.push(i.getProvince(e))
}
));
else if (this.useFriendlyProvinces || this.useEnemyProvinces || this.useNeutralsProvinces) {
const e = r.IZ.gameState.getPlayerState();
Object.values(e.getPlayers()).forEach((e=>{
const s = e.getPlayerID();
if (s <= 0 || s == this.playerID)
return;
let r = !1;
r = this.useNeutralsProvinces ? e.isNeutral() : this.useFriendlyProvinces ? e.isFriendly() : e.isEnemy(),
r && i.getProvincesForPlayer(s).forEach((e=>{
t.push(e)
}
))
}
))
} else
e && (t = r.IZ.gameState.getMapState().getProvincesForPlayer(this.playerID));
return t || []
}
blink() {
if (this.blinkEnabled) {
var e;
let t = [];
this.blinkState && (t = this.getProvinces(!0)),
r.IZ.provinceSelection.setSelected(t),
null === (e = this.mapWidget) || void 0 === e || e.showPlayerRect(r.IZ.config.userData.playerID),
this.blinkState = !this.blinkState,
this.timeoutHandle = this.addTimeout(this.blink.bind(this), 500)
}
}
afterWaiting() {
this.blinkEnabled = !1,
super.afterWaiting();
r.IZ.provinceSelection.setSelected([]),
s.N.makeSilent(a.q.UI_PROVINCE_BAR_DISABLE),
s.N.publish(a.q.UI_PROVINCE_BAR_ENABLE),
this.cleanup()
}
cleanup() {
super.cleanup(),
clearInterval(this.timeoutHandle)
}
getHeadlineText() {
var e;
return null === (e = super.getHeadlineText()) || void 0 === e ? void 0 : e.replace("{nationName}", r.IZ.gameState.getPlayerProfile().getNationName())
}
}
}
,
54708: (e,t,i)=>{
i.d(t, {
p: ()=>T
});
i(10711);
var s = i(92893)
, r = i.n(s)
, n = i(64842)
, a = i(55542)
, o = i(85350)
, l = i(39513)
, u = i(15833)
, h = i(91939)
, g = i(98111)
, c = i(7903)
, d = i(97938)
, p = i(41428)
, m = i(83389)
, I = (i(21805),
i(87928));
class T extends u.Z {
constructor() {
super(!1),
this.explanationPopup = null,
this.provinceID = -1,
this.counterArmyID = -1,
this.preSelectArmy = !0,
this.paintArrows = !l.IZ.config.isMobileClient,
this.zoomScale = l.IZ.config.isMobileClient ? 2 : 4,
this.isUsingMobileClientUpdateLogic = !1,
this.centerIndividually = !0
}
process() {
super.process(),
this.addActions();
const e = l.IZ.config.tutorial.guidance.recaptureProvinceZoomScale;
var t;
e && (null === (t = this.mapWidget) || void 0 === t || t.zoomToScale(e))
}
cleanup() {
super.cleanup(),
this.removeExplanationPopup(),
this.removeActions()
}
onZoom() {
this.isUsingMobileClientUpdateLogic || this.repaintArrows()
}
onDragStart() {
l.IZ.tutorialController.getGUI().clearAllPointers()
}
getCounterArmyID() {
return this.counterArmyID
}
getProvinceID() {
return this.provinceID
}
afterPopup() {
a.N.publish(I.q.UI_DISPLAY_ARMIES),
l.IZ.provinceSelection.setSelected([]),
this.getPreSelectArmy() && this.selectArmy(),
this.centerOnAction(),
this.addSubscriber(a.N.subscribe(I.q.UI_ARMY_STATE_UPDATED, this.updateTask.bind(this))),
this.addSubscriber(a.N.subscribe(I.q.UI_VIEW_SHOWN, this.updateTask.bind(this))),
this.addSubscriber(a.N.subscribe(I.q.ARMY_COMMAND_MODE_CHANGED, this.updateTask.bind(this))),
this.addSubscriber(a.N.subscribe(I.q.UI_USER_ACTION_SENT_ARMY_COMMAND, this.onArmyCommandSent.bind(this))),
this.addSubscriber(a.N.subscribe(I.q.UI_ARMY_COMMAND_PLAN_CHANGED, this.updateTask.bind(this))),
this.isUsingMobileClientUpdateLogic || this.repaintArrows(),
l.IZ.tutorialGUI.hideSlides(),
this.updateTask()
}
onArmyCommandSent(e) {
var t;
if (null != e && null !== (t = e.data) && void 0 !== t && t.armyEntries) {
e.data.armyEntries.some((e=>{
var t, i;
return (null === (t = e.commands) || void 0 === t ? void 0 : t[(null === (i = e.commands) || void 0 === i ? void 0 : i.length) - 1])instanceof h.l
}
)) && (this.waitingForCommandResponse = !0,
setTimeout((()=>{
this.waitingForCommandResponse && (this.clearScene(),
l.IZ.armySelection.setSelected([]))
}
), 0),
e.data.addResponseCallback((()=>{
this.waitingForCommandResponse = !1
}
)))
}
}
showExplanationPopup() {
const e = r()("#commandAttackVideo", this.explanationPopup)[0];
e.onended = ()=>{
this.addTimeout((()=>e.play()), 2e3)
}
,
l.IZ.ui.helper.resizeTextLines(this.explanationPopup),
m.f.fadeIn(this.explanationPopup),
this.addTimeout((()=>e.play()), 1e3)
}
removeExplanationPopup() {
this.explanationPopup && this.explanationPopup.remove()
}
repaintArrows() {
l.IZ.tutorialController.getGUI().clearAllPointers(),
this.createArrows()
}
createArrows() {
if (this.popupWindow && this.popupWindow.isDialogOpen() || !this.paintArrows)
return;
const e = this.getArmy()
, t = this.getProvince();
if (e && t) {
const i = e.getDrawPosition()
, s = t.getCapital();
l.IZ.tutorialController.getGUI().addArrowToMapSafe(i, s, d.D.TYPE.ATTACK, !1);
const r = {
startPos: i,
endPos: s
}
, n = d.D.AnimationProperties();
l.IZ.tutorialController.getGUI().addArrowToMapSafe(null, i, d.D.TYPE.TARGET, r, n)
}
}
centerOnAction() {
if (!this.mapWidget)
return;
const e = this.getArmy()
, t = this.getProvince();
if (e && t) {
const i = e.getPosition()
, s = t.getCapital()
, r = new n.E((i.x + s.x) / 2,(i.y + s.y) / 2);
this.mapWidget.centerOnPosition(r, this.zoomScale)
}
}
selectArmy() {
const e = this.getArmy();
e && l.IZ.armySelection.setSelected([e])
}
update() {
if (this.waitingForCommandResponse)
return;
if (this.isUsingMobileClientUpdateLogic)
return void this.updateForMobile();
let e = -1;
const t = l.IZ.gameState.getArmyState().getArmy(this.counterArmyID);
if (t) {
const i = t.getCommands();
if (i.length > 0) {
const t = i[i.length - 1];
if (t instanceof h.l || t instanceof g.U) {
const i = t.getTargetPos()
, s = l.IZ.gameState.getMapState().getProvinceAt(i);
s && (e = s.getLocationID())
} else
t instanceof c.j && (e = t.getBesiegedProvinceID());
e == this.provinceID ? l.IZ.tutorialController.getGUI().clearAllPointers() : this.repaintArrows()
} else
this.repaintArrows()
}
}
updateForMobile() {
if (this.waitingForCommandResponse)
return;
let e = null;
l.IZ.tutorialController.getGUI().clearAllArrows(),
this.removeAllGlows();
const t = this.getArmy();
if (0 === parseInt(t.getArmyID(), 10)) {
try {
throw new Error("UltRecaptureProvinceTask: counter army's ID is not set!!!11")
} catch (s) {
window.onException(s)
}
t.unitUID = this.counterArmyID
}
if (l.IZ.armySelection.isSelected(t.getArmyID()))
this.guideToCommand(p.OC.ATTACK) && this.guideToMapTarget(this.getProvince().getCapital(), this.useOverlayHighlight, this.emulateAttackTargetSelection.bind(this), this.backgroundClicked.bind(this), this.centerIndividually) && this.guideToAttackTargetValidation();
else {
var i;
if (this.centerIndividually)
null === (i = this.mapWidget) || void 0 === i || i.centerOnArmy(this.getArmy());
if (e = o.N.TAP_ON_ARMY,
t) {
const e = t.getPosition()
, i = new n.E(e.x,e.y - 80)
, s = new n.E(e.x,e.y);
l.IZ.tutorialController.getGUI().addArrowToMapSafe(i, s, d.D.TYPE.ATTACK, !1, null, null, this.useOverlayHighlight, this.selectTargetArmy.bind(this), this.backgroundClicked.bind(this))
}
}
e && this.updateBalloonText(e)
}
selectTargetArmy() {
l.IZ.armySelection.setSelected([this.getArmy()], !1, !1, !1, !0, !0)
}
emulateAttackTargetSelection() {
const {mapWidget: e} = l.IZ.ui
, t = e.viewport.fromMapPos(this.getProvince().getCapital())
, i = {
pageX: t.x,
pageY: t.y
};
if (l.IZ.armyController.setDragTarget(this.getProvince().getCapital()),
e.mouseController.onMouseDrag(null, t, !0),
l.IZ.config.isMobileClient) {
const t = r().Event("touchstart", i);
t.targetTouches = [i],
t.touches = [];
const s = r().Event("touchend", i);
s.targetTouches = [i],
s.touches = [],
e.touchController.onTouchStart(t),
e.touchController.onTouchEnd(s)
} else {
const t = {
clientX: i.pageX,
clientY: i.pageY
}
, s = new MouseEvent("mousedown",t)
, r = new MouseEvent("mouseup",t);
e.container.dispatchEvent(s),
l.IZ.getGameContainer()[0].dispatchEvent(r)
}
}
onClick() {
const e = l.IZ.armySelection.isSelected(this.getArmy().getArmyID());
l.IZ.provinceSelection.setSelected([]),
e || l.IZ.config.isMobileClient || l.IZ.ui.helper.showFloatingTip(l.IZ.i18n.gettext("Drag army %s to the province capital.", this.getArmy().getName()));
const t = this.getArmy();
this.addTimeout((()=>l.IZ.armySelection.setSelected([t])), 200)
}
getArmy() {
const e = this.getCounterArmyID();
return l.IZ.gameState.getArmyState().getArmy(e)
}
getProvince() {
const e = this.getProvinceID();
return l.IZ.gameState.getMapState().getProvince(e)
}
addActions() {
this.useOverlayHighlight || r()(document).on("click.tutorial touchend.tutorial", this.clickWrapper.bind(this, this.onClick))
}
onDragEnd() {
this.updateTask()
}
removeActions() {
r()(document).off("click.tutorial touchend.tutorial")
}
getPreSelectArmy() {
return this.preSelectArmy
}
generateBalloonTextModel() {
super.generateBalloonTextModel(),
this.balloonTextModel.additionalData = {
provinceName: this.getProvince().getName(),
constructionsTabId: l.IZ.ui.provinceProductionsController.getBuildingTabID()
}
}
getAttackButton() {
var e, t;
let i = null;
const s = null === (e = l.IZ.config.tutorialElementClasses) || void 0 === e ? void 0 : e.attackCommandButton;
return s && (i = r()(s)),
null !== (t = i) && void 0 !== t && t.length ? i : r()(".func_army_command_attack, .func-attack-button")
}
}
}
,
22609: (e,t,i)=>{
i.d(t, {
V: ()=>h,
m: ()=>g
});
var s = i(92893)
, r = i.n(s)
, n = i(55542)
, a = i(61809)
, o = i(15833)
, l = i(87928)
, u = i(13775);
const h = {
CHEST_CLOSED: 0,
CHEST_OPEN: 1,
REWARD_SHOWN: 2
};
class g extends o.Z {
constructor() {
super(),
this.autoHideTutorialAdviser = !0,
this.popupModel = null,
this.rewardClaimed = !1
}
getPopupModel() {
return this.popupModel || (this.popupModel = {
rewardAmount: u.Z.formatNumber(this.rewardAmount),
popupIconTag: this.getPopupIconTag(),
popupText: a.hU(this.getPopupText()),
collectRewardStep: h.CHEST_CLOSED,
collectRewardSteps: h,
imageName: this.getImageName(),
taskIdentifier: this.getTaskIdentifier()
}),
this.popupModel
}
onCollectReward() {
this.rewardClaimed || (this.rewardClaimed = !0,
this.openChestAndScheduleShowReward(),
n.N.publish(l.q.UI_TUTORIAL_REWARD_COLLECTED))
}
openChestAndScheduleShowReward() {
this.popupModel.collectRewardStep = h.CHEST_OPEN,
this.addTimeout(this.showReward.bind(this), 800),
this.updateContent()
}
showReward() {
this.popupModel.collectRewardStep = h.REWARD_SHOWN,
this.updateContent()
}
updateContent() {
hup.config.isMobileClient || (this.popupWindow.updateContent(),
this.addActions())
}
addActions() {
if (this.popupWindow.sandbox) {
const e = this.popupWindow.sandbox.getBox();
r()("#func_collect_reward", e).onLzrButtonClick(this.onCollectReward.bind(this)),
r()("#func_close_popup", e).onLzrButtonClick(this.onConfirmButtonClick.bind(this))
}
}
getDialogID() {
return "reward_tutorial"
}
getPopupText() {
return super.getPopupText().replace("{premiumAmount}", u.Z.formatNumber(this.rewardAmount))
}
}
}
,
42756: (e,t,i)=>{
i.d(t, {
r: ()=>h
});
var s = i(92893)
, r = i.n(s)
, n = i(55542)
, a = i(39513)
, o = i(19853)
, l = i(80872)
, u = i(87928);
class h extends o.N {
constructor() {
super(),
this.provinceIndex = -1
}
process() {
super.process(),
a.IZ.tutorialGUI.hideSlides(),
this.setPreventArmySelection(!0),
this.addSubscriber(n.N.subscribe(u.q.UI_DIALOG_OPENED, this.lateUpdate.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_DIALOG_CLOSED, this.lateUpdate.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_VIEW_SHOWN, this.lateUpdate.bind(this))),
this.addSubscriber(n.N.subscribe(u.q.UI_VIEW_HIDDEN, this.lateUpdate.bind(this))),
this.provinceIndex = -1,
this.provinceId = this.getNextProvinceId(),
this.addActions(),
this.focusOnProvince(),
a.IZ.config.isMobileClient ? this.lateUpdate() : this.updateTask()
}
cleanup() {
super.cleanup(),
this.removeActions(),
a.IZ.config.tutorial.guidance.useRapidProductionPanel || a.IZ.dialogController.closeAllDialogs(),
n.N.publish(u.q.UI_TOGGLE_PRODUCTION_LIST, {
onlyClose: !0
})
}
allowsWindow(e) {
return "production" === e || e === l.O.getUnitProductionsPanelController().dialogID || (null == e ? void 0 : e.includes("tutorial"))
}
update() {
this.removeAllGlows(),
a.IZ.tutorialGUI.clearAllPointers(),
a.IZ.config.tutorial.guidance.useRapidProductionPanel ? this.executeGuidance([()=>this.guideToRapidProductionPanel(), ()=>this.guideToRapidProductionListPanel(), ()=>this.guideToSpeedUpProductionListEntry(this.getProvince().getLocationID()), ()=>this.guideToInventorySystemItemOrPremiumButton()]) : this.executeGuidance([()=>this.guideToProvince(), ()=>this.guideToConstructionPanel(), ()=>this.guideToConstructionSpeedupButton(), ()=>this.guideToInventorySystemItemOrPremiumButton()])
}
getNextProvinceId() {
const e = this.getProvinceIds();
return this.provinceIndex++,
this.provinceIndex < e.length ? e[this.provinceIndex] : null
}
isBuilding() {
return this.getProvince() && this.getProvince().isBuilding()
}
getProvince() {
const e = this.getProvinceIds();
return a.IZ.gameState.getMapState().getProvince(e[this.provinceIndex])
}
getProvinceIds() {
return this.provinceIds
}
getSpeedUpButton() {
const e = a.IZ.config.tutorialElementClasses && r()(a.IZ.config.tutorialElementClasses.provinceBarSpeedUpConstruction);
return e && e[0] ? e : r()("#func_provbar_building_speedup")
}
getConstructionWidgetSpeedUpButton() {
const e = a.IZ.config.tutorialElementClasses;
let t;
return e && (t = e.provinceConstruction ? document.querySelector(`${e.provinceConstruction} ${e.provinceConstructionSpeedUpConstruction}`) : document.querySelector(e.provinceConstructionSpeedUpConstruction)),
t || document.querySelector(".func_building_speedup")
}
addActions() {
r()(document).on("click.tutorial touchend.tutorial", this.clickWrapper.bind(this, this.updateTask))
}
removeActions() {
r()(document).off("click.tutorial touchend.tutorial")
}
generateBalloonTextModel() {
super.generateBalloonTextModel(),
this.balloonTextModel.additionalData = {
provinceName: this.getProvince().getName(),
forUpgrade: !0
}
}
processArmyAndProvinceSelection() {
a.IZ.config.tutorial.guidance.useRapidProductionPanel || super.processArmyAndProvinceSelection()
}
}
}
,
59939: (e,t,i)=>{
i.d(t, {
f: ()=>u
});
var s = i(55542)
, r = i(85350)
, n = i(39513)
, a = i(19853)
, o = i(80872)
, l = i(87928);
class u extends a.N {
constructor() {
super(),
this.autoOpenResearch = null,
this.closeResearchDialog = !0
}
getResearchId() {
return this.researchID
}
getUnitTypeToBeUnlocked() {
return this.getResearchType().getUnitTypeToBeUnlocked()
}
getResearchType() {
return n.IZ.getMod().getResearch(this.getResearchId())
}
process() {
n.IZ.tutorialGUI.hideSlides(),
super.process(),
!n.IZ.researchController.isOpen() && this.autoOpenResearch && s.N.publish(l.q.UI_RESEARCH_TOGGLE),
this.addSubscriber(s.N.subscribe(l.q.UI_RESEARCH_TOGGLE, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(l.q.UI_RESEARCH_STATE_UPDATED, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(l.q.UI_VIEW_SHOWN, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(l.q.UI_RESEARCH_TAB_SELECTED, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(l.q.UI_RESEARCH_STATE_CHANGED_ON_UI, this.updateTask.bind(this))),
n.IZ.researchController.setSkipAutoSelectResearchDuringTutorial(!0),
n.IZ.researchController.setSelectedResearchId(-1),
this.updateTask()
}
cleanup() {
super.cleanup(),
n.IZ.researchController.setSkipAutoSelectResearchDuringTutorial(!1),
this.closeResearchDialog && n.IZ.researchController.onClose(),
s.N.publish(l.q.UI_INVENTORY_SYSTEM_SKIP_RESEARCH_TIME_ITEM_CONSUMPTION_TOGGLE, {
onlyClose: !0
})
}
allowsWindow(e) {
return e == n.IZ.researchController.dialogID
}
update() {
this.removeAllGlows(),
n.IZ.gameState.getResearchState().currentResearches.length ? this.guideToResearchViewButton() && this.guideToResearchSpeedUpButton(this.getResearchId()) && this.guideToInventorySystemItemOrPremiumButton() : this.sendProgress()
}
updateForMobile() {
if (this.removeAllGlows(),
n.IZ.gameState.getResearchState().currentResearches.length)
if (n.IZ.config.tutorial.guidance.useRapidProductionPanel) {
const e = this.getUnitTypeToBeUnlocked();
this.executeGuidance([()=>this.guideToRapidProductionPanel(), ()=>this.guideToProductionPanelTab(e.getSetID()), ()=>this.guideToProductionMissingRequirements(e), ()=>this.guideToSpeedUpMissingRequirementsEntry(this.getResearchType().getItemID()), ()=>this.guideToInventorySystemItemOrPremiumButton()])
} else
this.executeGuidance([()=>this.guideToResearchViewButton(), ()=>this.guideToResearchBackButton(), ()=>this.guideToResearchSpeedUpButton(), ()=>this.guideToInventorySystemItemOrPremiumButton()]);
else
this.sendProgress()
}
guideToResearchBackButton() {
const {researchController: e} = n.IZ;
return e.getSelectedResearchId() <= 0 || e.getSelectedResearchSet() <= 0 || (this.highlightBackButton(),
this.updateBalloonText(r.N.CLICK_BACK),
!1)
}
guideToResearchViewButton() {
const {researchController: e} = n.IZ;
return !!e.isOpen() || (this.highlightTutorialMenuButton(o.O.getResearchViewButton()),
this.updateBalloonText(r.N.OPEN_RESEARCH_WINDOW),
!1)
}
getElementsToUnhide() {
return [o.O.getResearchViewButton()]
}
generateBalloonTextModel() {
super.generateBalloonTextModel(),
this.balloonTextModel.additionalData = {
researchType: this.getResearchType()
}
}
}
}
,
4748: (e,t,i)=>{
i.d(t, {
O: ()=>l
});
var s = i(55542)
, r = i(39513)
, n = i(15833)
, a = i(80872)
, o = i(87928);
class l extends n.Z {
constructor() {
super(),
this.closeResearchDialog = !0
}
getResearchId() {
return this.researchID
}
getResearchType() {
return r.IZ.getMod().getResearch(this.getResearchId())
}
getUnitTypeToBeUnlocked() {
return this.getResearchType().getUnitTypeToBeUnlocked()
}
process() {
r.IZ.tutorialGUI.hideSlides(),
super.process(),
this.addSubscriber(s.N.subscribe(o.q.UI_RESEARCH_OPENED, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(o.q.UI_RESEARCH_TAB_CHANGED, this.lateUpdate.bind(this, 1))),
this.addSubscriber(s.N.subscribe(o.q.UI_RESEARCH_TOGGLE, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(o.q.UI_RESEARCH_TAB_SELECTED, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(o.q.UI_RESEARCH_STATE_UPDATED, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(o.q.UI_RESEARCH_ITEM_SELECTED, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(o.q.UI_AREA_DRAG_STARTED, this.onAreaDragStarted.bind(this))),
this.addSubscriber(s.N.subscribe(o.q.UI_AREA_DRAG_FINISHED, this.updateTask.bind(this))),
this.addSubscriber(s.N.subscribe(o.q.UI_VIEW_SHOWN, this.updateTask.bind(this))),
r.IZ.researchController.setSkipAutoSelectResearchDuringTutorial(!0),
this.updateTask()
}
onAreaDragStarted() {
r.IZ.tutorialGUI.clearAllPointers()
}
cleanup() {
super.cleanup(),
this.closeResearchDialog && (r.IZ.researchController.onClose(),
r.IZ.researchController.setCurrentResearchSet(-1)),
r.IZ.researchController.setSkipAutoSelectResearchDuringTutorial(!1)
}
allowsWindow(e) {
return e == r.IZ.researchController.dialogID
}
update() {
if (this.removeAllGlows(),
r.IZ.config.tutorial.guidance.useRapidProductionPanel) {
const e = this.getUnitTypeToBeUnlocked();
this.executeGuidance([()=>this.guideToRapidProductionPanel(), ()=>this.guideToProductionPanelTab(e.getSetID()), ()=>this.guideToProductionMissingRequirements(e), ()=>this.guideToStartMissingRequirementsEntry(this.getResearchType().getItemID())])
} else
this.executeGuidance([()=>this.guideToResearchPanel(), ()=>this.guideToResearchPanelRootMenuIfTabNotSelected(this.getResearchType().getSet()), ()=>this.guideToResearchPanelTab(this.getResearchType()), ()=>this.guideToResearchEntry(this.getResearchId()), ()=>this.guideToResearchTierTab(this.getResearchType().getTier()), ()=>this.guideToResearchStartButton()])
}
generateBalloonTextModel() {
super.generateBalloonTextModel();
const e = this.getResearchType();
this.balloonTextModel.additionalData = {
researchTab: r.IZ.researchController.getResearchTabModel(e.getSet()),
researchName: this.getResearchType().getName(),
researchType: e,
unitType: this.getUnitTypeToBeUnlocked()
}
}
getTaskContext() {
return {
researchSet: this.getResearchType().getSet()
}
}
getElementsToUnhide() {
return [a.O.getResearchViewButton()]
}
}
}
,
41273: (e,t,i)=>{
i.d(t, {
j: ()=>r
});
var s = i(15833);
class r extends s.Z {
constructor() {
super(),
this.autoSkipTime = 0,
this.autoSkipTimerHandle = null,
this.isStartTutorialTask = !0
}
process() {
super.process(),
this.autoSkipTime && !this.autoSkipTimerHandle && (this.autoSkipTimerHandle = this.addTimeout((()=>this.onConfirmButtonClick()), 1e3 * this.autoSkipTime))
}
cleanup() {
super.cleanup(),
hup.config.isMobileClient && hup.dialogController.closeAllDialogs(),
clearTimeout(this.autoSkipTimerHandle)
}
}
}
,
94243: (e,t,i)=>{
i.d(t, {
F: ()=>A
});
i(87477);
var s = i(92893)
, r = i.n(s)
, n = i(21854)
, a = i(55542)
, o = i(85350)
, l = i(50009)
, u = i(24841)
, h = i(97938)
, g = i(80838)
, c = i(97586)
, d = i(6670)
, p = i(84277)
, m = i(83389)
, I = i(21805)
, T = i(87928);
class A extends g.e {
constructor() {
super(),
this.tutorialGUI = null,
this.ignoreDragEvents = !1,
this.balloonTextMap = null,
this.balloonTextModel = null,
this.balloonTemplateFileName = null,
this.balloonTextDialog = null,
this.balloonTextLastCloseTime = 0,
this.useOverlayHighlight = !1,
this.overlayBackgroundClicks = 0,
this.glowClasses = hup.config.tutorialGlowClasses ? hup.config.tutorialGlowClasses : ["tutorial_glow_button"],
this.clickWrapperCallbackTimeoutHandle = null,
this.taskIdentifier = null,
this.index = 0,
this.checklistTitle = null,
this.checklistCategory = null,
this.timeoutHandles = [],
this.playedBalloonTextSounds = new Set
}
process() {}
cleanup() {
this.balloonTextDialog && this.balloonTextDialog.dialogID && this.balloonTextDialog.onClose(),
clearTimeout(this.clickWrapperCallbackTimeoutHandle),
this.timeoutHandles.forEach((e=>clearTimeout(e)))
}
onZoomStart() {
this.getGUI().clearAllPointers()
}
onZoomEnd() {
this.redrawArrows()
}
onDragStart() {
this.ignoreDragEvents || this.getGUI().clearAllPointers()
}
onDragEnd() {
this.ignoreDragEvents || this.redrawArrows()
}
allowsWindow(e) {
return !1
}
getDescription() {
return ""
}
getTitle() {
return ""
}
getFunnelEventID() {}
getIndex() {
return this.index
}
sendProgress() {
const e = new u.v;
e.setTaskID(this.taskID),
hup.userActionController.triggerAction(e)
}
pointProvince(e, t, i) {
e = e || !1;
const s = this.getProvince();
if (s) {
this.highlightsProvince && this.highlightProvince(s);
const r = s.getCapital()
, n = {
x: r.x,
y: r.y - l.J.BUTTON_POINT_ARROW_START_OFFSET
};
this.getGUI().clearAllPointers();
const a = h.D.AnimationProperties()
, o = (e ? h.D.TYPE.CLICK : null) || i || null;
this.getGUI().addArrowToMapSafe(n, r, o, !1, a, t, this.useOverlayHighlight, this.selectTargetProvince.bind(this), this.backgroundClicked.bind(this))
}
}
selectTargetProvince() {
hup.armySelection.getSelectedArmy() && hup.armySelection.setSelected([]),
hup.provinceSelection.setSelected([this.getProvince()], !1, !1, !1, !1, !0, !1, !0)
}
selectArmy(e) {
hup.provinceSelection.getSelectedProvince() && hup.provinceSelection.setSelected([]);
const t = hup.gameState.getArmyState().getArmy(e);
hup.armySelection.setSelected([t], !1, !1, !0)
}
clickWrapper(e) {
n.J.wasDrag() || (clearTimeout(this.clickWrapperCallbackTimeoutHandle),
this.clickWrapperCallbackTimeoutHandle = this.addTimeout(e.bind(this), 0))
}
addTimeout(e, t) {
const i = setTimeout(e, t);
return this.timeoutHandles.push(i),
i
}
pointTargetProvince(e, t, i, s, r) {
t = t || !1;
const n = hup.gameState.getMapState().getProvince(e);
if (n) {
const e = n.getCapital()
, a = {
x: e.x,
y: e.y - l.J.BUTTON_POINT_ARROW_START_OFFSET
};
r || this.getGUI().clearAllPointers();
const o = h.D.AnimationProperties()
, u = (t ? h.D.TYPE.CLICK : null) || s || null;
this.getGUI().addArrowToMapSafe(a, e, u, !1, o, i)
}
}
pointArmy(e, t, i, s) {
const r = hup.gameState.getArmyState().getArmy(e) || hup.gameState.getArmyState().getArmyWithSpyInfo(e);
if (r) {
const n = r.getDrawPosition()
, a = {
x: n.x,
y: n.y - l.J.BUTTON_POINT_ARROW_START_OFFSET
};
s || this.getGUI().clearAllPointers();
const o = i || h.D.TYPE.CLICK
, u = h.D.AnimationProperties();
this.getGUI().addArrowToMapSafe(a, n, o, !1, u, t, this.useOverlayHighlight, this.selectArmy.bind(this, e), this.backgroundClicked.bind(this))
}
}
highlightProvince(e) {
hup.provinceSelection.setProvinceHighlightedOnMap(e)
}
focusOnProvince() {
if (!hup.areTutorialHintsEnabled())
return;
const e = this.getProvince();
var t;
e && (null === (t = this.mapWidget) || void 0 === t || t.centerOnProvince(e, 2))
}
focusOnArmy(e) {
if (!hup.areTutorialHintsEnabled())
return;
const t = hup.gameState.getArmyState().getArmy(e);
var i;
t && (null === (i = this.mapWidget) || void 0 === i || i.centerOnArmy(t, 2))
}
redrawArrows() {
this.updateTask ? this.updateTask() : this.pointProvince()
}
addGlow(e, t, i) {
if (!hup.areTutorialHintsEnabled())
return;
const s = (t ? "tutorial_glow_button_concept" : null) || e.data("glow-class-name") || "tutorial_glow_button";
this.highlightButton(e, s, i)
}
removeGlow(e) {
for (let t = 0; t < this.glowClasses.length; t++)
r()(e).removeClass(this.glowClasses[t])
}
removeAllGlows() {
for (let e = 0; e < this.glowClasses.length; e++)
r()(`.${this.glowClasses[e]}`).removeClass(this.glowClasses[e])
}
getPositionOfButton(e, t) {
if (!e.offset())
return null;
let i = e.offset().left + e.outerWidth() / 2
, s = e.offset().top + e.outerHeight() / 2;
switch (t = t || l.J.directionTypes.T2B) {
case l.J.directionTypes.L2R:
i -= e.outerWidth() / 2;
break;
case l.J.directionTypes.R2L:
i += e.outerWidth() / 2;
break;
case l.J.directionTypes.T2B:
s -= e.outerHeight() / 2;
break;
case l.J.directionTypes.B2T:
s += e.outerHeight() / 2
}
return {
x: i,
y: s
}
}
pointButton(e, t, i, s, n) {
this.useOverlayHighlight ? this.highlightButton(e, "", n) : (i = i || l.J.directionTypes.T2B,
e = r()(e),
this.addGlow(e, !1, n),
t && r()(e).one("click touchend", (()=>this.removeGlow(e))),
this.pointArrowTo(e, !0, i, null, null, s))
}
highlightButton(e, t, i) {
this.useOverlayHighlight ? a.N.publish(T.q.UI_SHOW_OVERLAY_HIGHLIGHTER, {
targetElement: e,
taskIdentifier: this.taskIdentifier,
isRoundButton: i,
backgroundClickCallback: this.backgroundClicked.bind(this)
}) : e && r()(e).addClass(t)
}
highlightTutorialMenuButton(e) {
this.highlightButton(e, "tutorial_menu_button_highlight")
}
highlightTutorialButton(e) {
this.highlightButton(e, "tutorial_button_highlight")
}
highlightListEntry(e) {
this.highlightButton(e, "tutorial_list_entry_highlight")
}
highlightRoundButton(e) {
this.highlightButton(e, "tutorial_round_button_highlight", !0)
}
highlightBackButton() {
this.highlightButton(".back_button", "tutorial_back_button_highlight")
}
highlightCloseButton() {
this.highlightButton(".close_button", "tutorial_back_button_highlight")
}
pointArrowTo(e, t, i, s, r) {
let n = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : ""
, a = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : ""
, o = arguments.length > 7 && void 0 !== arguments[7] && arguments[7]
, u = null;
i = i || l.J.directionTypes.T2B,
s = s || {
x: 0,
y: 0
},
r = r || h.D.TYPE.CLICK;
const g = this.getPositionOfButton(e, i);
if (g) {
g.x += s.x,
g.y += s.y;
let c = g.x
, d = g.y;
switch (i) {
case l.J.directionTypes.L2R:
c -= l.J.BUTTON_POINT_ARROW_START_OFFSET;
break;
case l.J.directionTypes.R2L:
c += l.J.BUTTON_POINT_ARROW_START_OFFSET;
break;
case l.J.directionTypes.T2B:
d -= l.J.BUTTON_POINT_ARROW_START_OFFSET;
break;
case l.J.directionTypes.B2T:
d += l.J.BUTTON_POINT_ARROW_START_OFFSET
}
const p = {
x: c,
y: d
};
o || this.getGUI().clearAllPointers();
const m = !!t && h.D.AnimationProperties();
u = this.getGUI().arrowPainter.addArrow(p, g, r, null, !0, m, n, a, void 0, 0 === e.width() && 0 === e.height())
}
return u
}
getGUI() {
return this.tutorialGUI || hup.tutorialController.getGUI()
}
setGUI(e) {
this.tutorialGUI = e
}
updateTask() {
this.hasForbiddenWindows() ? this.balloonTextMap && this.updateBalloonText(o.N.CLOSE_DIALOG) : this.shouldUpdate() && (hup.config.isMobileClient && this.updateForMobile ? this.updateForMobile() : this.update())
}
hasForbiddenWindows() {
return !!hup.tutorialController.openForbiddenWindows.length
}
shouldUpdate() {
return !0
}
toggleInteraction(e) {
a.N.publish(T.q.UI_TOGGLE_INTERACTIONS, e)
}
update() {
return !0
}
lateUpdate(e) {
this.addTimeout(this.updateTask.bind(this), e || 100)
}
clearScene() {
this.removeAllGlows(),
hup.tutorialGUI.clearAllPointers(),
hup.tutorialGUI.clearAllGlows()
}
getProvinceById(e) {
return hup.gameState.getMapState().getProvince(e)
}
createVideoPopup(e, t, i) {
i = i || 2e3;
const s = p.t4(e);
if (!s)
return null;
const n = r()(hup.ui.helper.renderHTMLElement(s, {
videoName: t
}));
(0,
I.$)(n[0]);
const a = this.showExplanationPopup.bind(this, n);
return r()(".func_close_button", n).onLzrButtonClick((()=>{
n.hide(),
this.addTimeout(a, i)
}
)),
this.addTimeout(a, i),
hup.getGameContainer().append(n),
n
}
showExplanationPopup(e) {
const t = r()("#explanationVideo", e)[0];
t && t.play(),
hup.ui.helper.resizeTextLines(e),
m.f.fadeIn(e)
}
removeExplanationPopup(e) {
e && e.remove()
}
updateBalloonText(e, t) {
e && (this.balloonTextLastCloseTime && this.balloonTextLastCloseTime + l.J.BALLOON_TEXT_CLOSED_PERIOD > Date.now() || (this.balloonTextModel || this.generateBalloonTextModel(),
this.balloonTextModel.currentTextId = e,
this.balloonTextModel.elevated = t,
this.balloonTextDialog ? this.balloonTextDialog.view && this.balloonTextDialog.view.updateDOM() : this.showBalloonTextDialog(),
a.N.publish(T.q.UI_TUTORIAL_BALLOON_TEXT_UPDATED, {
balloonTextModel: this.balloonTextModel
}),
this.playBalloonTextSound(e)))
}
playBalloonTextSound(e) {
this.playedBalloonTextSounds.has(e) || (a.N.publish(T.q.UI_TUTORIAL_BALLOON_TEXT_PLAY_SOUND, {
textID: e
}),
this.playedBalloonTextSounds.add(e))
}
showBalloonTextDialog() {
if (!this.balloonTemplateFileName)
return;
const e = this
, t = new d.A({
onPopupInitializedCallback: function(t, i) {
e.balloonTextDialog = i
},
container: hup.getGameContainer(),
dialogID: c.q.TUTORIAL_BALLOON_TEXT,
popupName: "tutorial_balloon_text_popup",
templateName: this.balloonTemplateFileName,
templateModel: this.balloonTextModel,
callingController: this,
skipHistory: !0,
showCloseButton: !1,
backgroundClose: !1,
showDialogBackground: !1,
useDefaultClasses: !1,
moduleConfig: {
config: {
allowMapAnimations: !0
},
viewConfig: {
nonDialog: !0
}
}
});
this.balloonTextDialog = {},
a.N.publish(t)
}
refreshBalloonTextZIndex() {
this.balloonTextDialog && this.balloonTextDialog.dialogID && hup.ui.zIndexController.addInFront(this.balloonTextDialog.view.getBox())
}
onBalloonTextClosePressed() {
this.balloonTextLastCloseTime = Date.now(),
this.balloonTextDialog.onClose(),
this.balloonTextDialog = null
}
generateBalloonTextModel() {
this.balloonTextModel = {},
this.balloonTextModel.balloonTextMap = this.balloonTextMap,
this.balloonTextModel.taskIdentifier = this.taskIdentifier,
this.balloonTextModel.taskDescription = this.getDescription(),
this.balloonTextModel.additionalData = {}
}
getBalloonText(e) {
return this.balloonTextMap && this.balloonTextMap[e] || ""
}
getTaskContext() {
return {}
}
getTaskIdentifier() {
return this.taskIdentifier
}
backgroundClicked() {
this.useOverlayHighlight && (++this.overlayBackgroundClicks,
this.overlayBackgroundClicks > 7 && a.N.publish(T.q.TUTORIAL_STUCK_EVENT))
}
resetUIState() {
hup.dialogController.closeAllDialogs(),
hup.provinceSelection.setSelected([]),
hup.armySelection.setSelected([])
}
getElementsToUnhide() {
return []
}
isAvailable() {
return !0
}
applyTaskConfig(e) {
Object.assign(this, e)
}
}
}
,
50009: (e,t,i)=>{
i.d(t, {
J: ()=>s
});
class s {
static BUTTON_POINT_ARROW_START_OFFSET = 160;
static ZOOM_RECT_SIZE = 600;
static BALLOON_TEXT_CLOSED_PERIOD = 5e3;
static directionTypes = {
L2R: 1,
R2L: 2,
T2B: 3,
B2T: 4
}
}
}
,
7799: (e,t,i)=>{
i.d(t, {
X: ()=>h
});
var s = i(55542)
, r = i(61809)
, n = i(39513)
, a = i(19853)
, o = i(97586)
, l = i(6670)
, u = i(87928);
class h extends a.N {
constructor() {
super(),
this.waitingTime = 0,
this.model = null,
this.popupDialog = null,
this.updateTextTimeout = null,
this.alreadySkipped = !1,
this.shouldProgressAfterWaitingTime = !0,
this.taskStarted = 0,
this.defaultAvatarCSSClass = "avatar tutorial-preload-avatar",
this.texts = null,
this.updateHighlights = null
}
process() {
let e;
super.process(),
this.taskStarted || (this.taskStarted = Date.now()),
this.isAvatar() ? this.scheduleAvatar() : this.isSubtitle() ? (e = this.getHeadlineText(),
n.IZ.tutorialGUI.showTextSlideShow([e], this.afterWaiting.bind(this), this.waitingTime)) : this.isFullscreen() ? (e = this.getHeadlineText(),
n.IZ.tutorialGUI.showFullscreenText(e, this.afterWaiting.bind(this), this.waitingTime)) : this.addTimeout(this.afterWaiting.bind(this), 1e3 * this.waitingTime)
}
scheduleAvatar() {
if (s.N.publish(u.q.UI_TUTORIAL_THEATER_GUI_OPENED),
this.texts || this.headlineText) {
if (this.texts)
for (let i = 0; i < this.texts.length; i++)
this.texts[i] = r.hU(this.texts[i]);
this.headlineText && (this.headlineText = r.hU(this.headlineText));
const e = this;
this.initializeModel();
const t = new l.A({
onPopupInitializedCallback: function(t, i) {
e.popupDialog = i,
e.model.currentIndex = 0,
e.updateHighlights && e.updateHighlights()
},
container: n.IZ.getGameContainer(),
dialogID: o.q.TUTORIAL_WAIT_TASK,
popupName: "tutorial_wait_task_popup",
templateName: "tutorial_basic_text",
templateModel: this.model,
callingController: this,
skipHistory: !0,
showCloseButton: !1,
backgroundClose: !1,
showDialogBackground: !1,
moduleConfig: {
config: {
allowMapAnimations: !0
},
viewConfig: {
nonDialog: !0
}
}
});
this.addTimeout((()=>{
s.N.publish(t),
n.IZ.config.isMobileClient || this.addActions()
}
), 300)
}
this.shouldProgressAfterWaitingTime && (this.updateTextTimeout = this.addTimeout(this.updateText.bind(this), 1e3 * this.waitingTime))
}
initializeModel() {
this.model || (this.model = {
taskIdentifier: this.taskIdentifier,
texts: this.texts || [this.getHeadlineText()],
animationName: this.getAnimationName(),
animationKey: this.taskID,
animationDuration: this.waitingTime - .5 + "s",
getCurrentText() {
return this.texts[this.currentIndex]
},
getAvatarCSSClass: this.getAvatarCSSClass.bind(this),
getTask: ()=>this
},
this.model.currentIndex = n.IZ.config.isMobileClient ? -1 : 0)
}
getAvatarCSSClass() {
return n.IZ.config.supportsLanguageSpecificTutorialAvatars && "ja" === n.IZ.i18n.getLanguage() ? "avatar tutorial-preload-avatar_ja" : this.defaultAvatarCSSClass
}
getHeadlineText() {
return this.description
}
afterWaiting() {
this.updateTextTimeout && clearInterval(this.updateTextTimeout),
this.sendProgress()
}
canSkipNow() {
return Date.now() >= this.taskStarted + 1e3
}
cleanup() {
this.canSkipNow() && (super.cleanup(),
this.isFullscreen() && n.IZ.tutorialGUI.hideFullscreenText(),
this.removePopup())
}
removePopup() {
this.popupDialog && this.popupDialog.isOpen() && (n.IZ.config.isMobileClient ? this.popupDialog.view.setVisible(!1) : this.popupDialog.onClose())
}
updateText() {
this.afterWaiting()
}
addActions() {}
getAnimationName() {
const {animationNames: e} = h;
return this.isIntroTask ? e.SLIDE_IN_FROM_BOTTOM : e.FADE
}
onSkip() {
Date.now() > this.taskStarted + 1e3 && !this.alreadySkipped && (this.alreadySkipped = !0,
this.afterWaiting())
}
}
h.animationNames = {
FADE: "fade",
SLIDE_IN_FROM_BOTTOM: "slideInFromBottomSlow"
}
}
,
16388: (e,t,i)=>{
i.d(t, {
a: ()=>h
});
var s = i(55542)
, r = i(39513)
, n = i(20325)
, a = i(50009)
, o = i(98111)
, l = i(97938)
, u = i(87928);
class h extends n.D {
constructor() {
super(),
this.army = null,
this.startTime = -1,
this.totalDist = 0,
this.intervall = null,
this.counterArmyID = -1,
this.shouldProgressAfterWaitingTime = !0
}
process() {
super.process(),
s.N.publish(u.q.UI_ARMY_BAR_DISABLE),
this.setupArmy(),
this.army && this.startAnimation(),
this.model && (this.model.shouldShowNext = !1)
}
getCounterArmyID() {
return this.counterArmyID
}
afterWaiting() {
super.afterWaiting(),
this.intervall && clearInterval(this.intervall)
}
startAnimation() {
this.intervall = setInterval(this.animate.bind(this), 50)
}
updateAnimation() {
const e = (Date.now() - this.startTime) / (1e3 * this.waitingTime);
if (e > 1)
return;
let t = this.totalDist * e;
const i = this.army.getCommands();
for (let s = 0; s < i.length; s++)
if (i[s]instanceof o.U) {
const e = i[s]
, r = e.getLength();
if (t - r < 0) {
const i = t / r * (e.targetPos.x - e.startPos.x)
, s = t / r * (e.targetPos.y - e.startPos.y)
, n = e.startPos.x + i
, a = e.startPos.y + s;
this.army.position.x = n,
this.army.position.y = a,
this.mapWidget && (this.mapWidget.mapRenderer.updateAllArmies = !0)
} else
t -= r
}
}
setupArmy() {
const e = r.IZ.gameState.getArmyState().getArmy(this.counterArmyID);
if (!e)
return;
e.setTutorial(!0);
const t = e.getCommands();
let i = 0;
for (let s = 0; s < t.length; s++)
if (t[s]instanceof o.U) {
i += t[s].getLength()
}
if (t[0]instanceof o.U && (e.position = t[0].getStartPos().clone()),
this.army = e,
this.startTime = Date.now(),
this.totalDist = i,
this.provinceID && this.provinceID >= 0) {
const e = r.IZ.gameState.getMapState().getProvince(this.provinceID);
if (null != e) {
const t = e.getCapital()
, i = {
x: t.x + a.J.BUTTON_POINT_ARROW_START_OFFSET,
y: t.y
};
this.getGUI().clearAllPointers();
const s = l.D.AnimationProperties();
this.getGUI().addArrowToMapSafe(i, t, l.D.TYPE.SHOW, !1, s, this.getBalloonText("provincePointer"))
}
}
}
animate() {
this.army ? this.updateAnimation() : this.setupArmy()
}
}
}
,
58202: (e,t,i)=>{
i.d(t, {
F: ()=>H
});
class s {
constructor() {
this.deathThreshold = 0,
this.xFactor = {
stdDev: 0,
limit: 0
}
}
getDeathThreshold() {
return this.deathThreshold
}
getXFactor() {
return this.xFactor
}
}
var r = i(41389)
, n = i(54987)
, a = i(21420);
class o {
titleKey;
rootMod;
jsonConfig;
premiumItemIds;
getTitleKey() {
return this.titleKey
}
getRootMod() {
return this.rootMod
}
getJsonConfig() {
return this.jsonConfig ? ("string" == typeof this.jsonConfig && (this.jsonConfig = JSON.parse(this.jsonConfig)),
this.jsonConfig) : null
}
getMaxGameCreationCountPerPA() {
const e = this.getJsonConfig();
return null != e && e.gameCreationConfig ? e.gameCreationConfig.maxGameCreationCountPerPA : 5
}
getDefaultPremiumItemIds() {
var e;
return null === (e = this.getJsonConfig()) || void 0 === e ? void 0 : e.defaultPremiumItemIDs
}
getHighPricePremiumItemIds() {
var e;
return null === (e = this.getJsonConfig()) || void 0 === e ? void 0 : e.highPricePremiumItemIDs
}
}
class l {
constructor() {
this.level = null,
this.name = "",
this.desc = "",
this.tooltip = null
}
getLevel() {
return this.level
}
getName() {
return this.name
}
getDesc() {
return this.desc
}
getTooltipHtml() {
return this.tooltip || (this.tooltip = `<h3>${this.getName()}</h3>${this.getDesc()}`),
this.tooltip
}
}
var u = i(70057)
, h = i(30600)
, g = i(37887)
, c = i(68135)
, d = i(8161)
, p = i(91939);
class m {
constructor() {
this.attackerUIDs = []
}
applyData(e) {
this.attackerUIDs = e.a
}
getAttackers() {
return this.attackerUIDs
}
getAttackerCount() {
return this.getAttackers() ? this.getAttackers().length : 0
}
listAttackers() {
if (this.getAttackers()) {
let e = null;
const t = hup.gameState.getArmyState();
return this.getAttackers().forEach((i=>{
const s = t.getArmy(i);
if (s) {
const t = s.getName();
null === e ? e = `${t}` : e += `, ${t}`
}
}
)),
e
}
return ""
}
getFirstAttackerName() {
const e = this.getAttackers();
if (e && e.length) {
const e = this.attackerUIDs[0];
if (e) {
const t = hup.gameState.getArmyState().getArmy(e);
if (t)
return t.getName()
}
}
return "unknown"
}
}
var I = i(87235)
, T = i(11452)
, A = i(18789)
, y = i(23449)
, S = i(17358)
, f = i(82623);
class P {
constructor() {
this.unit = null
}
getUnit() {
return this.unit
}
setUnit(e) {
this.unit = e
}
merge(e) {}
}
class D extends P {
constructor() {
super(),
this.ammunition = 0
}
getMaxAmmunition() {
return this.getConfig().maxAmmunition * this.getUnit().getSize()
}
getDeployCost() {
const e = {
...this.getConfig().deployCost
};
for (const t in e)
e[t] *= this.unit.getSize();
return e
}
getConfig() {
return this.getUnit().getUnitType().getDeployUnitConfig()
}
calcReloadCost() {
const e = {}
, t = Math.min(this.getUnit().getSize(), this.getMaxAmmunition() - this.ammunition)
, {ammunitionCost: i} = this.getConfig();
for (const s in i) {
if (!i.hasOwnProperty(s))
continue;
const r = i[s] * t;
e[s] = e[s] ? e[s] + r : r
}
return e
}
merge(e) {
this.ammunition += e.ammunition
}
}
class v {
constructor() {
this.lifespanInSeconds = null
}
}
var R = i(98111)
, E = i(74619)
, C = i(39513);
class U {
constructor() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0
, t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : 0;
this.costFactor = e,
this.timeFactor = t
}
getSpawnedUnitTypeId(e) {
var t;
return (null === (t = this.getSpawnedUnitType(e)) || void 0 === t ? void 0 : t.getItemID()) ?? null
}
getSpawnedUnitType(e) {
const t = C.IZ.getMod()
, i = C.IZ.gameState.getResearchState()
, s = t.getUnitType(e)
, r = t.getUnitsInUnitUpgradeGroupSortedByTierDesc(s.getUnitUpgradeGroup())
, n = s.getTier();
for (const a of r) {
if (a.getTier() <= n)
return null;
if (i.hasResearches(a.getRequiredResearches()))
return a
}
return null
}
getResourceCost(e) {
const t = this.getSpawnedUnitType(e);
return t ? Object.fromEntries(Object.entries(t.getCosts()).map((e=>{
let[t,i] = e;
return [t, Math.round(i * this.costFactor)]
}
))) : {}
}
getTimeCost(e) {
const t = this.getSpawnedUnitType(e);
if (t) {
const e = t.getMinProductionTime() > 0 ? t.getMinProductionTime() : t.getBuildTime();
return Math.round(e * this.timeFactor)
}
return -1
}
}
var _ = i(15357)
, O = i(87572)
, N = i(65651)
, M = i(7903)
, b = i(13822)
, F = i(63593)
, L = i(23794)
, x = i(67350);
class w {
}
var G = i(50910)
, Z = i(62503)
, B = i(77938)
, k = i(9704)
, V = i(72390);
class W {
constructor() {
this.UltPushNotificationPreferences = a.u,
this.UltTitle = o,
this.action = {},
this.diplomacy = {},
this.gameevents = {},
this.gamefeatures = {},
this.graphics = {},
this.map = {},
this.modding = {
types: {},
configuration: {
UltEqualDamageDistributionConfig: s
}
},
this.premium = {},
this.resources = {},
this.research = {},
this.spyjobs = {
UltSpyMission: r.Z
},
this.stats = {},
this.tutorial = {
tasks: {}
},
this.UltConnection = n.W,
this.upgrades = {},
this.warfare = {
UltAggressionLevel: l,
UltAirfield: u.G,
UltAirParameters: h.R,
UltArmy: g.ne,
UltArmyCommand: c.X,
UltArmySizes: d.xd,
UltAttackCommand: p.l,
UltBattle: m,
UltCarrierFeature: I.l,
UltConvertCommand: T._,
UltDamageAuraConfig: A.i,
UltDeployingWaitCommand: y.v,
UltDeployUnitCommand: S.N,
UltDeployUnitConfig: f.w,
UltDeployUnitFeature: D,
UltExpirableUnitConfig: v,
UltGotoCommand: R.U,
UltManualConverterConfig: E.O,
UltManualUpgradeConfig: U,
UltUnitSpawnerConfig: w,
UltModableUnit: _.n,
UltPatrolCommand: O.f,
UltReloadCommand: N.o,
UltSiegeCommand: M.j,
UltSplitArmyCommand: b.p,
UltSpy: F.$,
UltTerrainType: L.Ky,
UltUnit: x.e,
UltUnitFeature: P,
UltWaitCommand: k.V,
UltUsableAirfields: B.d,
UltUnitType: G.V,
UltUpgradeCommand: Z.O
},
this.wof = {},
this.ingameinventory = {},
this.models = {},
this.adviser = {}
}
static instance = new W
}
const H = W.instance;
window.ultshared = window.ultshared ? window.ultshared : H,
(0,
V.zr)("UltShared", H)
}
,
3577: (e,t,i)=>{
i.d(t, {
z: ()=>l
});
i(10711),
i(87477);
var s = i(61809)
, r = i(85665)
, n = i(74515)
, a = i(4563)
, o = i(26134);
class l extends n.A {
constructor() {
super(),
this.condition = -1,
this.enabled = !0,
this.relativePosition = null,
this.itemID = 0,
this.premiumLevel = 0
}
initDummy(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]
, i = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2];
this.itemID = e,
this.enabled = i,
this.condition = t ? this.getMaxCondition() : this.getBuildCondition()
}
applyData(e) {
this.condition = void 0 === e.c ? 0 : e.c,
this.enabled = void 0 !== e.e && e.e,
this.relativePosition = e.rp || null,
this.itemID = void 0 === e.id ? 0 : e.id,
this.premiumLevel = void 0 === e.pl ? 0 : e.pl
}
toJSON() {
return {
"@c": "mu",
c: this.condition,
e: this.enabled,
rp: this.relativePosition,
id: this.itemID,
pl: this.premiumLevel
}
}
getItemID() {
return this.itemID
}
getUpgradeID() {
return this.itemID
}
getUpgradeType() {
let e = hup.getMod().getUpgrade(this.itemID);
return e || (e = hup.getMod(!1).getUpgrade(this.itemID)),
e
}
getRelativePosition() {
return this.relativePosition
}
getPremiumLevel() {
return this.premiumLevel
}
getCondition() {
return hup.getMod() && this.condition > this.getMaxCondition() ? this.getMaxCondition() : this.condition
}
getNameWithTier(e) {
return e = !!e,
this.getUpgradeType().hasTiers() ? `${this.getName()} ${hup.i18n.gettext("Lvl. %s", this.getTier(e))}` : this.getName()
}
getNameWithLevel(e) {
if (this.getUpgradeType().hasLevels()) {
const t = e ? this.getNextLevel() : this.getLevel();
return `${this.getName()} ${hup.i18n.gettext("Lvl. %s", t)}`
}
return this.getName()
}
getDayOfAvailability() {
return this.getUpgradeType().getDayOfAvailability()
}
isEnabled() {
return this.isEnabledByPlayer()
}
isEnabledByPlayer() {
return this.enabled || !this.getUpgradeType().isEnableable()
}
setEnabled(e) {
this.enabled = e
}
isEnableable() {
return this.getUpgradeType().isEnableable()
}
getRequiredUpgrades() {
return this.getUpgradeType().getRequiredUpgrades()
}
getRequiredUpgradeCount() {
return this.getUpgradeType().getRequiredUpgradeCount()
}
setCondition(e) {
this.condition = e
}
getLevel() {
return this.getUpgradeType().getLevel(this.getCondition())
}
getMaxLevel() {
return this.getUpgradeType().getMaxLevel()
}
getConditionForNextLevel() {
const e = this.condition ? this.getLevel() + 1 : 1;
return this.getUpgradeType().getConditionForLevel(e)
}
getMaxCondition() {
return this.getUpgradeType().getMaxCondition()
}
isConditionUnknown() {
return this.getCondition() < 0
}
isIntact() {
return this.getUpgradeType().isIntact(this.getCondition())
}
isIntactOrNextLevel() {
return !!this.getUpgradeType().hasReplacedUpgrade() || this.isIntact()
}
canDrawOnMap() {
return !this.hasInvisibleFeature() && (!!this.isConditionUnknown() || this.isIntactOrNextLevel())
}
hasCapitalFeature() {
return this.hasFeature(a.M.CAPITAL)
}
hasFeature(e) {
return this.getUpgradeType().hasFeature(e)
}
isProvLevelUpgrade() {
return this.getUpgradeType().isProvLevelUpgrade()
}
hasInvisibleFeature() {
return this.getUpgradeType().hasInvisibleFeature()
}
getFeatureValue(e) {
return !this.isEnabled() && this.isIntact() ? 0 : this.getUpgradeType().getFeatureValue(e, this.getCondition())
}
getHarbourBonus() {
return .5 * Math.min(1, this.getFeatureValue(a.M.HARBOUR))
}
getSpeedBonus() {
const e = hup.getMod()
, t = e.getDefaultInfantryUnitTypeStatsId()
, i = e.getUnitType(t);
i || window.onException(new Error(`Infantry Unit Type ID ${t} is not found for building ${this.getName()}.`));
const s = (null == i ? void 0 : i.getSpeed(o.ly.T_RAIL)) / (null == i ? void 0 : i.getSpeed(o.ly.T_LAND)) - 1;
return this.getFeatureValue(a.M.RAILROAD) * s
}
getProductionTime(e, t) {
if (t = !1 !== t,
e = e || !1)
return Math.floor(this.getBuildFactor() * this.getProductionTime() * this.getProductionFactor(e));
const i = t ? Math.floor(1 + (this.getNextBuildCondition() - 1) / this.getBuildCondition()) : this.getLevel();
return Math.floor(this.getUpgradeType().getBuildTime(i))
}
getUnitProductionSpeedBonus() {
return this.getUpgradeType().getUnitProductionSpeedBonus(this.getCondition())
}
getBuildFactor() {
return (1 * this.getNextBuildCondition() - this.getCondition()) / this.getBuildCondition()
}
getProductionFactor(e) {
return 1
}
getRepairTime() {
return this.getProductionTime() * (1 - this.getConditionPercent() / 100)
}
getBuildCondition() {
return this.getUpgradeType().getBuildCondition()
}
getBuildOrRepairTime() {
return this.isDamaged() ? this.getRepairTime() : this.getProductionTime()
}
getReplacedUpgradeType() {
return this.getUpgradeType().getReplacedUpgradeType()
}
getProductionBonus(e) {
return !this.enabled && this.isEnableable() ? 0 : this.getUpgradeType().getProductionBonus(e, this.getCondition())
}
getStepTimeMs() {
return Math.floor(1e3 * this.getProductionTime() / this.getBuildCondition())
}
hasDailyCosts() {
return this.isEnabled() && this.getUpgradeType().hasDailyCosts()
}
getDailyCosts() {
return this.isEnabled() ? this.getUpgradeType().getDailyCosts(this.getCondition()) : {}
}
getDailyProductions() {
return this.isEnabled() ? this.getUpgradeType().getDailyProductions(this.getCondition()) : {}
}
getFeatureImageName() {
return this.getUpgradeType().getFeatureImageName(this.getCondition())
}
getReplacedUpgrade() {
return this.getUpgradeType().getReplacedUpgrade()
}
getHelpImageUrl() {
let e = this.getIdentifier();
return this.hasLevels() && (e += `_${this.getLevel() ? this.getLevel() : 1}`),
`images/help/image_upgrade_${e.replace(" ", "_")}.png`
}
getHelpImageClass() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 0
, t = this.getIdentifier();
return this.hasLevels() && (e = e || this.getLevel() || 1,
t += `_${e}`),
`upgrades-${t.replace(" ", "_")}`
}
getIdentifier() {
return this.getUpgradeType().upgrIdentifier
}
isDamaged() {
return !this.isBuilding() && (!(this.getCondition() <= 0) && this.getCondition() % this.getUpgradeType().getBuildCondition() != 0)
}
isLevelUnfinished() {
return this.isDamaged() || this.isBuilding()
}
hasLevels() {
return this.getUpgradeType().hasLevels()
}
getNextLevel() {
if (!this.hasLevels())
return 0;
let e = this.getLevel() + 1;
return (this.isLevelUnfinished() || 0 === this.getCondition()) && e--,
Math.min(this.getMaxLevel(), e)
}
getMinPossibleProvinceStateID() {
return this.getUpgradeType().getMinPossibleProvinceStateID()
}
getMinPossibleProvinceState() {
return this.getUpgradeType().getMinPossibleProvinceState()
}
getMinProvinceLevel() {
const e = this.getRequiredUpgrades()
, t = hup.getMod().getOption(r.f.OPTION_PROVINCE_LEVEL_ID);
return t >= 0 && e.hasOwnProperty(t) ? this.getLevelOfRequiredUpgrade(t) : null
}
getLevelOfRequiredUpgrade(e) {
return this.getRequiredUpgrades()[e]
}
getTier(e) {
const t = this.getUpgradeType().getTier() - this.getMaxLevel() + this.getLevel();
if (e) {
if (this.isLevelUnfinished() || 0 === this.getCondition())
return t;
const e = this.getUpgradeType().getMaxTier();
return Math.min(t + 1, e)
}
return t
}
getVictoryPoints() {
return this.getUpgradeType().getVictoryPoints()
}
hasTiers() {
return this.getUpgradeType().hasTiers()
}
getBuildCosts() {
const e = this.getNextBuildCondition() - this.getCondition();
return this.getUpgradeType().getBuildCosts(e)
}
getUnitCosts() {
return this.getUpgradeType().getUnitCosts()
}
getFortressValue() {
const e = this.getFeatureValue(a.M.FORTRESS);
return e && e > 0 ? Math.round(100 * (1 - 1 / (1 + e))) : 0
}
hasRefuelingTime() {
return 0 !== this.getFeatureValue(a.M.AIRFIELD)
}
getRefuelingTime() {
if (!this.hasRefuelingTime())
return 0;
const e = this.getFeatureValue(a.M.AIRFIELD)
, t = hup.getMod().getRefuelCosts();
return s.gV(t / e)
}
getName() {
return this.getUpgradeType().getUpgradeName()
}
getIcon() {
return hup.ui.iconsHelper.getUpgradeIcon(this)
}
getLevelCurrentlyBuilding() {
return this.getUpgradeType().getLevel(this.getNextBuildCondition())
}
isPlaceable() {
const e = this.getRelativePosition();
return e && (0 != e.x || 0 != e.y)
}
getResourceAndTaxContributionModel(e) {
return {
buildingFactorOnProduction: this.getProductionBonus(e),
buildingFactorOnTax: this.getProductionBonus(hup.consts.MONEY)
}
}
getReplacedUpgradeTree(e) {
const t = ultshared.upgrades.UltModableUpgrade;
return t.upgradeTree || (t.upgradeTree = {}),
e = !!e,
t.upgradeTree[`${this.itemID}_${e}`] || (t.upgradeTree[`${this.itemID}_${e}`] = u(this, e)),
t.upgradeTree[`${this.itemID}_${e}`]
}
getInternalUniqueID() {
return this.cachedTierName || (this.cachedTierName = this.getNameWithTier(!0)),
this.cachedTierName
}
getArticlePrefix() {
return this.getUpgradeType().getArticlePrefix()
}
getArticlePrefixWithLevel() {
let e = this.getArticlePrefix().replace(" ", "_");
return this.hasLevels() ? e += `_${this.getLevel() || 1}` : this.hasTiers() && (e += `_${this.getTier() || 1}`),
e
}
}
function u(e, t) {
let i = [];
if (t || i.push(e.itemID),
e.getReplacedUpgrade()) {
const t = new l;
t.initDummy(e.getReplacedUpgrade(), !0),
i = i.concat(u(t)),
i = [...new Set(i)]
}
return i
}
l.sortBasedOnLevel = function(e, t) {
return e.getReplacedUpgradeTree().length - t.getReplacedUpgradeTree().length
}
,
ultshared.upgrades.UltModableUpgrade = l
}
,
74515: (e,t,i)=>{
i.d(t, {
A: ()=>a
});
var s = i(61809)
, r = i(58202)
, n = i(96974);
class a {
getProductionBonus() {
return 1
}
isEnabled() {
return this.isEnabled()
}
isIntact() {
return this.getCondition() == this.getMaxCondition()
}
isBuilding() {
return this.building || !1
}
getProductionTime() {}
getMaxCondition() {
return Math.floor(this.getProductionTime() / (hup.consts.DAY_MILLIS / 1e3) * 2)
}
getReplacedUpgrade() {
return this.replacedUpgrade
}
getNextBuildCondition() {
let e = this.getCondition() + this.getBuildCondition() - this.getCondition() % this.getBuildCondition();
return e = Math.min(this.getMaxCondition(), e),
e
}
getConditionPercent() {
const e = this.getBuildCondition()
, t = this.getCondition()
, i = t % e;
return 0 === i ? 0 === t ? 0 : 100 : Math.round(i / e * 100)
}
getCondition() {
return 0
}
getBuildCondition() {
return 0
}
setBuilding(e) {
this.building = e
}
getConditionLevel(e) {
const t = void 0 !== e ? e : this.getConditionPercent();
return n.ow(t)
}
getName() {
return ""
}
hasUnitCosts() {
return !(0,
s.Ew)(this.getUnitCosts())
}
getUnitCosts() {
return null
}
isQueueable() {
return !this.hasUnitCosts()
}
}
r.F.upgrades.UltProvinceUpgrade = a
}
,
16033: (e,t,i)=>{
i.d(t, {
U: ()=>n
});
var s = i(58202)
, r = i(74515);
class n extends r.A {
constructor() {
super(),
this["@c"] = "su"
}
getUnit() {
return this.unit
}
getUnitType() {
return this.unit.getUnitType()
}
getUpgradeID() {
return this.getUnitTypeID()
}
getUnitTypeID() {
return this.getUnit().getUnitTypeID()
}
getItemID() {
return this.getUnit().getItemID()
}
getName() {
return this.getUnit().getUnitType().getTypeName()
}
getIdentifier() {
return this.getUnit().getUnitType().getIdentifier()
}
isElite() {
return this.getUnit().isElite()
}
getLevelMarker() {
return `${this.getUnitType().getLevelMarker()}`
}
}
s.F.upgrades.UltSpecialUnit = n
}
,
4563: (e,t,i)=>{
var s, r;
i.d(t, {
M: ()=>s,
_: ()=>r
}),
function(e) {
e[e.FORTRESS = 0] = "FORTRESS",
e[e.HARBOUR = 1] = "HARBOUR",
e[e.RAILROAD = 2] = "RAILROAD",
e[e.FACTORY = 3] = "FACTORY",
e[e.CAPITAL = 4] = "CAPITAL",
e[e.MORALE_BONUS = 5] = "MORALE_BONUS",
e[e.RECRUIT = 6] = "RECRUIT",
e[e.FACTORY_TECH = 7] = "FACTORY_TECH",
e[e.AIRFIELD = 8] = "AIRFIELD",
e[e.INDESTRUCTIBLE = 9] = "INDESTRUCTIBLE",
e[e.PUBLIC = 10] = "PUBLIC",
e[e.LIMITED = 11] = "LIMITED",
e[e.CONSTRUCTION_SLOTS = 12] = "CONSTRUCTION_SLOTS",
e[e.PRODUCTION_SLOTS = 13] = "PRODUCTION_SLOTS",
e[e.INVISIBLE = 14] = "INVISIBLE",
e[e.NO_SPEED_UP = 15] = "NO_SPEED_UP",
e[e.INDESTRUCTABLE = 16] = "INDESTRUCTABLE",
e[e.STATUS_CHANGE = 17] = "STATUS_CHANGE",
e[e.REPORT_PROGRESS = 18] = "REPORT_PROGRESS",
e[e.VICTORY_POINTS = 19] = "VICTORY_POINTS",
e[e.SIEGE_DELAY = 20] = "SIEGE_DELAY",
e[e.MINIMUM_SIEGE = 21] = "MINIMUM_SIEGE",
e[e.RESEARCH_LIMIT_LEVEL = 23] = "RESEARCH_LIMIT_LEVEL",
e[e.MAX_MANPOWER = 24] = "MAX_MANPOWER",
e[e.STACKABLE = 25] = "STACKABLE",
e[e.BUILDING_PLOTS = 27] = "BUILDING_PLOTS",
e[e.USED_BUILDING_PLOTS = 28] = "USED_BUILDING_PLOTS",
e[e.DESTROYED_ON_OWNER_CHANGE = 33] = "DESTROYED_ON_OWNER_CHANGE",
e[e.ADDITIONAL_UNIT_CAP = 35] = "ADDITIONAL_UNIT_CAP",
e[e.CONSTRUCTION_SPEEDUP_COST_FACTOR = 42] = "CONSTRUCTION_SPEEDUP_COST_FACTOR"
}(s || (s = {})),
function(e) {
e[e.VALUE_FUNCTION_LINEAR = 0] = "VALUE_FUNCTION_LINEAR",
e[e.VALUE_FUNCTION_SQRT = 1] = "VALUE_FUNCTION_SQRT",
e[e.VALUE_FUNCTION_PANZERWARS = 2] = "VALUE_FUNCTION_PANZERWARS",
e[e.VALUE_FUNCTION_STEP = 3] = "VALUE_FUNCTION_STEP"
}(r || (r = {}))
}
,
26574: (e,t,i)=>{
i.d(t, {
y: ()=>u
});
i(87477);
var s = i(61809)
, r = i(40897)
, n = i(39513)
, a = i(58202)
, o = i(4563)
, l = i(33558);
class u {
constructor() {
this.itemID = 0,
this.buildTime = 0,
this.buildCondition = 0,
this.maxCondition = 0,
this.minCondition = 0,
this.dayOfAvailability = 0,
this.enableable = 0,
this.articlePrefix = "",
this.costs = {},
this.unitCosts = {},
this.buildTimeFunction = {},
this.dailyCosts = {},
this.prodBonus = {},
this.features = {},
this.featureFunctions = {},
this.replacedUpgrade = 0,
this.requiredUpgrades = 0,
this.requiredResearches = 0,
this.possibleProvinceStates = {},
this.upgrName = "",
this.upgrDesc = "",
this.upgrIdentifier = "",
this.sortOrders = "",
this.icon = null,
this.featureIconPrefix = null,
this.replacingUpgradeId = null,
this.removedUpgrades = 0,
this.upgradeCategory = r.$.UNIT_PRODUCTION
}
getItemID() {
return this.itemID
}
getUpgradeName() {
return this.upgrName || this.upgrIdentifier
}
applyData(e) {
if (e.itemID) {
Object.assign(this, e);
const {lang: t} = n.IZ.config.userDataLocal;
return this.upgrName = e.upgrName[t],
void (this.upgrDesc = e.upgrDesc[t])
}
this.itemID = e.id ?? -1,
this.buildTime = e.bt ?? 0,
this.buildCondition = e.bc ?? 2,
this.maxCondition = e.mxc ?? 4,
this.minCondition = e.mnc ?? 2,
this.dayOfAvailability = e.doa ?? 1,
this.enableable = e.ie ?? 0,
this.articlePrefix = e.ap ?? "",
this.costs = e.c ?? [],
this.unitCosts = e.uc ?? {},
this.dailyCosts = e.dc ?? [],
this.dailyProductions = e.dp ?? [],
this.prodBonus = e.pb ?? [],
this.features = e.f ?? [],
this.featureFunctions = e.ff ?? [],
this.buildTimeFunction = e.btf ?? [],
this.replacedUpgrade = e.ru ?? 0,
this.removedUpgrades = e.rmu ?? 0,
this.requiredUpgrades = e.rqu ?? [],
this.requiredResearches = e.rqr ?? [],
this.possibleProvinceStates = e.pps ?? {},
this.featureIconPrefix = e.fip ?? "",
this.rankingFactor = e.rnf ?? 1,
this.upgrName = e.upn ?? "",
this.upgrDesc = e.upd ?? "",
this.upgrIdentifier = e.uid ?? "",
this.sortOrders = e.so ?? "",
this.upgradeCategory = e.uct ?? r.$.UNIT_PRODUCTION
}
getUpgradeNameWithTier(e, t) {
if (!this.hasTiers() && !t)
return this.getUpgradeName();
let i = this.getTier();
return Number.isFinite(Number.parseFloat(e)) && (i = Math.max(1, i - this.getMaxLevel() + e)),
`${this.getUpgradeName()} ${n.IZ.i18n.gettext("Lvl. %s", i)}`
}
getUpgradeDesc() {
let e = l.w.getModdedText(l.w.MsgId.UPGRADE_TYPE_DESC, this);
return this.upgrDesc && (e += this.upgrDesc),
e
}
getUpgradeListSortOrder() {
return Number.isFinite(Number.parseFloat(this.upgradeListSortOrder)) || (this.upgradeListSortOrder = this.getSortOrder(0)),
this.upgradeListSortOrder
}
getProvinceListSortOrder() {
return Number.isFinite(Number.parseFloat(this.provinceListSortOrder)) || (this.provinceListSortOrder = this.getSortOrder(1)),
this.provinceListSortOrder
}
getMapSortOrder() {
return Number.isFinite(Number.parseFloat(this.mapSortOrder)) || (this.mapSortOrder = this.getSortOrder(2)),
this.mapSortOrder
}
getSortOrder(e) {
if ("string" == typeof this.sortOrders) {
const t = this.sortOrders.split(",");
return e = Math.min(t.length - 1, e),
parseInt(t[e], 10)
}
return 0
}
getSortOrders() {
return this.sortOrders
}
getBuildCondition() {
return this.buildCondition
}
getMaxCondition() {
return this.maxCondition
}
getMaxLevel() {
return this.maxCondition / this.buildCondition
}
getLevel(e) {
return e > 0 ? 1 + Math.floor((e - 1) / this.buildCondition) : 1
}
getConditionForLevel(e) {
return Math.min(e * this.buildCondition, this.getMaxCondition())
}
getMinCondition() {
return this.minCondition
}
getReplacedUpgrade() {
return this.replacedUpgrade
}
hasReplacedUpgrade() {
return !!this.replacedUpgrade
}
getReplacedUpgradeType() {
return n.IZ.getMod().getUpgrade(this.getReplacedUpgrade())
}
getRemovedUpgrades() {
const e = [];
for (const t in this.removedUpgrades)
this.removedUpgrades.hasOwnProperty(t) && e.push(t);
return e
}
getProductionBonus(e, t) {
let i = this.getProdBonus(e)
, s = 0;
if (t > 0 && this.getReplacedUpgrade() > 0)
if (n.IZ.getMod().hasInheritingUpgrades())
s = this.getReplacedProductionBonus(e);
else if (t < this.getBuildCondition()) {
const t = this.getReplacedUpgradeType();
t && (s = t.getProdBonus(e),
i -= s)
}
return s + i * (t / this.getMaxCondition())
}
getUnitProductionSpeedBonus(e) {
let t = this.getFeatureValue(o.M.FACTORY, e);
return t < 1 && (t += 1),
1 - 1 / t
}
getReplacedProductionBonus(e) {
const t = this.getReplacedUpgradeType();
return t ? t.getProdBonus(e) + t.getReplacedProductionBonus(e) : 0
}
canBeReplaced() {
return this.getReplacingUpgrade() > 0
}
getReplacingUpgrade() {
if (null === this.replacingUpgradeId) {
const e = n.IZ.getMod().getUpgrades();
this.replacingUpgradeId = 0;
for (const t in e)
if (e.hasOwnProperty(t) && e[t].getReplacedUpgrade() == this.getItemID()) {
this.replacingUpgradeId = e[t].getItemID();
break
}
}
return this.replacingUpgradeId
}
getReplacingUpgradeType() {
const e = this.getReplacingUpgrade();
return e ? n.IZ.getMod().getUpgrade(e) : null
}
getLastReplacingUpgrade() {
let e, t = this.getReplacingUpgrade();
for (; t > 0; )
e = n.IZ.getMod().getUpgrade(t),
t = e.getReplacingUpgrade();
return e ? e.getItemID() : 0
}
getTier() {
if (void 0 === this.tier) {
const e = this.getReplacedUpgrade();
if (e > 0 && n.IZ.config.useTiersToRepresentUpgradeLevels) {
const t = n.IZ.getMod().getUpgrade(e);
this.tier = t.getTier() + this.getMaxLevel()
} else
this.tier = this.getMaxLevel()
}
return this.tier
}
getMaxTier() {
const e = this.getLastReplacingUpgrade();
return e ? n.IZ.getMod().getUpgrade(e).getTier() : this.getTier()
}
getVictoryPoints() {
return this.getFeatureValue(o.M.VICTORY_POINTS)
}
hasTiers() {
return this.getTier() > 1 || this.getReplacingUpgrade() > 0
}
hasLevels() {
return this.getMaxCondition() !== this.getBuildCondition()
}
getBaseUpgrade() {
let e = this
, t = n.IZ.getMod().getUpgrades();
for (t.hasOwnProperty(this.getItemID()) || (t = n.IZ.contentItems); e.replacedUpgrade > 0; )
e = t[e.replacedUpgrade];
return e.itemID
}
getReplacedCondition() {
let e = 0
, t = this;
for (; t.replacedUpgrade > 0; )
t = n.IZ.getMod().getUpgrade(t.replacedUpgrade),
t && (e += t.getMaxCondition());
return e
}
getRequiredUpgrades() {
return this.requiredUpgrades
}
getRequiredResearches() {
return this.requiredResearches
}
isRequiredResearchPossible() {
return -1 !== n.IZ.gameState.getResearchState().getNextAvailableResearch(this.requiredResearches)
}
getPossibleProvinceStates() {
return this.possibleProvinceStates
}
getMinPossibleProvinceStateID() {
const e = this.getPossibleProvinceStates();
let t = a.F.map.UltProvinceStateID.CORE;
for (const i in e)
e.hasOwnProperty(i) && (t = Math.max(t, parseInt(i, 0)));
return t
}
getMinPossibleProvinceState() {
return n.IZ.getMod().getProvinceState(this.getMinPossibleProvinceStateID())
}
canBeBuildInProvinceState(e) {
const t = this.getPossibleProvinceStates();
return !(t && !(0,
s.Ew)(t)) || t.hasOwnProperty(e)
}
getDayOfAvailability() {
return this.dayOfAvailability
}
getTechAvailableDay() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.getTier();
return Math.floor(this.getTechAvailableTime(e) / n.IZ.consts.DAY_MILLIS) + 1
}
getTechAvailableTime(e) {
return e > this.getMaxLevel() ? -1 : this.dayOfAvailability < 1 ? 0 : (this.dayOfAvailability - 1) * n.IZ.consts.DAY_MILLIS + (e - 1) * this.getBuildTime() * 1e3
}
getBuildTime() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 1;
if (null === this.buildTimeFunction)
return this.buildTime;
let t, i = 0, s = 0, r = this.buildTime, n = r;
for (t = e; t >= 0; t--)
if (void 0 !== this.buildTimeFunction[t]) {
i = t,
r = this.buildTimeFunction[t],
s = t,
n = r;
break
}
for (t = e; t <= this.getMaxLevel(); t++)
if (void 0 !== this.buildTimeFunction[t]) {
s = t,
n = this.buildTimeFunction[t];
break
}
if (i === s)
return Math.floor(r);
const a = e - i;
return Math.floor(r + a / (s - i) * (n - r))
}
static _scaleMapValues(e, t) {
const i = {};
if (e)
for (const s in e)
e.hasOwnProperty(s) && (i[s] = e[s] * t);
return i
}
static _sumMapValues(e, t) {
const i = {};
if (e)
for (const s in e)
e.hasOwnProperty(s) && (i[s] = e[s]);
if (t)
for (const s in t)
t.hasOwnProperty(s) && (i.hasOwnProperty(s) ? i[s] += t[s] : i[s] = t[s]);
return i
}
getBuildCosts() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : this.buildCondition;
e = e || this.buildCondition;
const t = e / this.buildCondition;
return u._scaleMapValues(this.costs, t)
}
getUnitCosts() {
return this.unitCosts
}
hasDailyCosts() {
for (const e in this.dailyCosts)
if (this.dailyCosts.hasOwnProperty(e))
return !0;
return !1
}
getDailyCosts() {
let e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : null;
return this.getDailyDeltaFor("dailyCosts", e)
}
getDailyProductions(e) {
return this.getDailyDeltaFor("dailyProductions", e)
}
getDailyDeltaFor(e, t) {
if (!this.hasOwnProperty(e))
return {};
if (t = isNaN(t) ? this.buildCondition : t,
n.IZ.getMod().hasInheritingUpgrades()) {
const i = t / this.getMaxCondition()
, s = u._scaleMapValues(this[e], i)
, r = this.getReplacedDailyDeltaFor(e);
return u._sumMapValues(s, r)
}
const i = this.getLevel(t) / this.getMaxLevel();
return u._scaleMapValues(this[e], i)
}
getReplacedDailyDeltaFor(e) {
const t = this.getReplacedUpgrade();
if (0 === t)
return {};
const i = n.IZ.getMod().getUpgrade(t);
return u._sumMapValues(i.getReplacedDailyDeltaFor(e), i.hasOwnProperty(e) ? i[e] : {})
}
hasUnitCosts() {
for (const e in this.unitCosts)
if (this.unitCosts.hasOwnProperty(e))
return !0;
return !1
}
isEnableable() {
return this.enableable > 0
}
isDestroyedOnOwnerChange() {
return this.hasFeature(o.M.DESTROYED_ON_OWNER_CHANGE) || this.hasFeature(o.M.CAPITAL)
}
isUnique() {
return 1 === this.getFeature(o.M.LIMITED)
}
isStackable() {
return this.hasFeature(o.M.STACKABLE)
}
hasFeature(e) {
return void 0 !== this.features[e]
}
isProvLevelUpgrade() {
const e = n.IZ.getMod().getProvinceLevelUpgrades();
return e && e.hasOwnProperty(this.getItemID())
}
getRequiredProvinceLevel() {
const e = this.getRequiredUpgrades();
for (const t in e)
if (e.hasOwnProperty(t)) {
const e = n.IZ.getMod().getUpgrade(t);
if (e.isProvLevelUpgrade())
return e.getTier()
}
return null
}
hasInvisibleFeature() {
return this.hasFeature(o.M.INVISIBLE)
}
getFeature(e) {
return this.features[e] || 0
}
getArticlePrefix() {
return this.articlePrefix.toLowerCase()
}
isIntact(e) {
return e >= this.getMinCondition()
}
getFeatureValue(e, t) {
t = t || this.getBuildCondition();
let i = 0;
this.isIntact(t) && (i = this.getFeatureFactor(e, t));
const s = this.getFeature(e);
if (isNaN(s))
return 0;
let r = 0;
if (t > 0)
if (n.IZ.getMod().hasInheritingUpgrades())
r = this.getReplacedFeatureValue(e);
else if (t < this.getBuildCondition()) {
const i = this.getReplacedUpgradeType();
if (i) {
r = i.getFeature(e);
return r + (s * this.getFeatureFactor(e, this.getBuildCondition()) - r) * (t / this.getBuildCondition())
}
}
return r + s * i
}
getReplacedFeatureValue(e) {
const t = this.getReplacedUpgradeType();
return t ? t.getFeature(e) + t.getReplacedFeatureValue(e) : 0
}
getFeatureFactor(e, t) {
let i = 0;
if (t >= this.minCondition) {
let s = this.featureFunctions[e];
switch (s || (s = o._.VALUE_FUNCTION_LINEAR),
s) {
case o._.VALUE_FUNCTION_SQRT:
i = Math.sqrt(1 * t / this.getMaxCondition());
break;
case o._.VALUE_FUNCTION_PANZERWARS:
i = .96 * 12 ** (1.5 * (t - 1) / this.getMaxCondition());
break;
case o._.VALUE_FUNCTION_STEP:
i = t >= this.getMinCondition() ? 1 : 0;
break;
case o._.VALUE_FUNCTION_LINEAR:
default:
i = t / this.getMaxCondition()
}
}
return i
}
getProdBonus(e) {
const t = this.prodBonus[e];
return null != t ? t : 0
}
getFeatureImageName(e) {
var t;
if (null === (t = this.featureIconPrefix) || void 0 === t || !t.length)
return null;
let i;
return i = n.IZ.config.useUpgradeLevelsForMapFeatureIcons ? e >= 0 ? this.getLevel(e) : 1 : this.getTier(),
this.featureIconPrefix + i
}
getIcon(e, t) {
if (!this.icon) {
const i = n.IZ.config.useArticlePrefixForUpgradeIcons ? this.getArticlePrefix() : this.itemID;
this.icon = e.loadImage(`images/upgrades/item_${i}_icon.png`, [], t)
}
return this.icon
}
getRequiredUpgradeCount() {
if (!this.requiredUpgradeCount) {
const e = [];
e.concat(this.getRequiredUpgrades());
const t = Object.keys(e);
for (; t.length > 0; ) {
const i = t.shift();
e[i] = 1;
const s = n.IZ.getMod().getUpgrade(i);
t.concat(Object.keys(s.getRequiredUpgrades()))
}
this.requiredUpgradeCount = Object.keys(e).length
}
return this.requiredUpgradeCount
}
getUnlockedUnits(e) {
e = !1 !== e;
const t = {}
, i = n.IZ.getMod().getFactionSpecificUnitTypes();
for (const s in i)
if (i.hasOwnProperty(s)) {
const r = i[s]
, n = r.getRequiredUpgrades();
n && n[this.itemID] && (t[e ? r.getStatsColumnID() : s] = r)
}
return t
}
getUnlockedUnitsForOtherTiers(e, t) {
if (!n.IZ.getMod().hasInheritingUpgrades())
return {};
const i = t=>e ? t.getReplacingUpgrade() : t.getReplacedUpgrade()
, s = {};
let r = this;
for (; i(r) > 0; ) {
r = n.IZ.getMod().getUpgrade(i(r));
const e = r.getUnlockedUnits(t);
Object.assign(s, e)
}
return s
}
getRankingFactor() {
return this.rankingFactor
}
isSingleRequiredUpgradeNeeded() {
return !1
}
getUpgradeTypeID() {
return this.getArticlePrefix()
}
getUpgradeCategory() {
return this.upgradeCategory
}
getUpgradeGroupSorted() {
if (!n.IZ.getMod().hasInheritingUpgrades())
return [];
let e = n.IZ.getMod().getUpgrade(this.getLastReplacingUpgrade()) ?? this;
const t = [];
for (; e; )
t.push(e),
e = e.getReplacedUpgradeType();
return t
}
getUpgradeCategoryName() {
return (0,
r.R)(this.upgradeCategory)
}
}
a.F.upgrades.UltUpgradeType = u
}
,
61191: (e,t,i)=>{
i.d(t, {
C: ()=>D
});
i(87477);
var s = i(34229)
, r = i(64842)
, n = i(53979)
, a = i(39513)
, o = i(85665)
, l = i(81621)
, u = i(54987)
, h = i(6422);
let g;
!function(e) {
e.FriendlyEmbarkmentTime = "friendlyEmbarkmentTime",
e.EnemyEmbarkmentTime = "enemyEmbarkmentTime"
}(g || (g = {}));
var c = i(37887)
, d = i(91939)
, p = i(98111)
, m = i(87572)
, I = i(7903);
class T {
constructor(e) {
let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null
, i = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0
, s = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0;
this.connection = e,
this.predecessor = t,
this.costs = i,
this.g = s
}
getPredecessor() {
return this.predecessor
}
getCon() {
return this.connection
}
setCosts(e) {
this.costs = e
}
getCosts() {
return this.costs
}
getPosX() {
return this.connection.x1
}
getPosY() {
return this.connection.y1
}
getG() {
return this.g
}
setG(e) {
this.g = e
}
}
var A = i(77938)
, y = i(9704)
, S = i(31135)
, f = i(96974)
, P = i(41428);
class D {
constructor() {
this.maxDistance = D.minDistance,
this.airTarget = !1,
this.targetReached = !1,
this.costs = new Map,
this.stack = [],
this.tm = new n.L,
this.gCache = new Map,
this.startPos = null,
this.targetPos = null,
this.usableAirfields = new A.d,
this.map = null,
this.gamestate = null,
this.cmds = []
}
static ENEMYCAPITALCOST = 36e7;
static minDistance = .1;
static maxToleranceSq = 1;
static attackRangeSavetyWhenTruncating = .1;
init(e, t, i, s, o) {
this.stack = [],
this.tm = new n.L,
this.cmds = [],
this.costs.clear(),
this.army = i,
this.startTime = s,
this.gamestate = a.IZ.gameState,
this.map = this.gamestate.getMapState(),
this.fa = this.gamestate.getForeignAffairsState(),
this.maxDistance = D.minDistance,
this.playerID = i.getOwnerID(),
this.targetReached = !1,
this.airTarget = !1,
this.usableAirfields.init(i),
this.mobilization = this.gamestate.getResourceProfile().getMobilizationFactor(),
this.bestSpeed = i.getMaxSpeed(this.mobilization);
const l = void 0 !== o ? o : i.isOnSea();
e = r.E.toPoint(e),
t = r.E.toPoint(t);
let u = this.map.closestMapPoint(e, l, !l);
u || (u = this.map.closestMapPoint(e));
const h = this.map.closestMapPoint(t);
this.isReverseAStarAvailable() ? (this.startPos = h,
this.targetPos = u) : (this.startPos = u,
this.targetPos = h)
}
reset() {
this.army = null,
this.startTime = -1,
this.gamestate = null,
this.map = null,
this.fa = null,
this.playerID = -1
}
getArmy() {
return this.army
}
getMovementCost() {
return this.getCmds(!0)
}
getCmds() {
let e = arguments.length > 0 && void 0 !== arguments[0] && arguments[0];
this.cmds = [];
const {startPos: t, targetPos: i} = this;
if (t && !this.map.arePointsInRange(t, i, this.maxDistance)) {
const s = this.map.getBorderedLocationAt(t);
let r;
if (this.getArmy().isAirplane() && this.getArmy().getAirParams().getAirfield()) {
const e = this.getArmy().getAirParams().getAirfield();
r = new l.Y(e,e,t,t,null == s ? void 0 : s.getLocationID())
} else
r = u.W.from(t, t, null == s ? void 0 : s.getLocationID());
const n = this.h(t.x, t.y, i.x, i.y)
, a = new T(r,null,n);
this._addTreeEntry(a);
const o = this.aStar();
if (e)
return o;
this.loadCmdList(),
this._clearStack()
} else if (e)
return Number.MAX_VALUE;
if (this.isReverseAStarAvailable()) {
const e = [];
for (let t = this.cmds.length - 1; t >= 0; t--)
e.push(this.cmds[t]);
return e
}
return this.cmds
}
_addTreeEntry(e) {
this.tm.push(e)
}
_clearStack() {
this.stack.length = 0
}
isReverseAStarAvailable() {
return !!a.IZ.config.enableReverseAStar && (!!this.army && (!this.airTarget && !this.army.isAirplane() && (!this.army.needsRail && (!this.army.armyNeedsWater() && (!this.army.canDeployUnit() && (this.army.range <= c.ne.CLOSE_COMBAT_RANGE || a.IZ.armyController.getCommandMode() !== P.OC.ATTACK))))))
}
calculateMaxDistance(e) {
return this.airTarget && this.isPlaneAtAirfield(e.getCon()) ? this.army.getAirRange() : !this.army.isShip() && e.getCon().isOnSea() ? D.minDistance : this.maxDistance
}
isWithinTargetDistance(e) {
return this.map.areCoordinatesInRange(e.getPosX(), e.getPosY(), this.targetPos.x, this.targetPos.y, this.calculateMaxDistance(e))
}
aStar() {
let e, t, i = !0, s = this.tm.pop(), r = 0, n = 0, a = 0;
const {x: o, y: l} = this.targetPos;
for (; !this.isWithinTargetDistance(s); ) {
let u;
if (s.getCon().isAirConnection() && !s.getCon().getTargetField().isAccessibleFromGround())
u = [];
else {
const e = s.getPosX()
, t = s.getPosY();
u = this.map.getFilteredConnectionsAt(e, t, this.army.armyNeedsWater(), this.army.needsRail)
}
if (this.army.canAirRelocate() && this.isPlaneAtAirfield(s.getCon())) {
const e = this.usableAirfields.getAirConnectionsAt(s.getCon());
e.length > 0 && (u = u.concat(e))
}
for (let i = u.length - 1; i >= 0; --i) {
if (t = u[i],
t.getLength() <= 0)
continue;
!t.isAirConnection() && t.containsPoint(o, l) && (t = t.splitStartTo(o, l)),
e = new T(t,s),
n = this.g(e) + s.getG();
const h = t.getTargetCacheKey();
this.costs.get(h) <= n || (r = this.h(t.x1, t.y1, o, l),
a = n + r,
Number.isFinite(n) && (e.setG(n),
e.setCosts(a),
this.costs.set(h, n),
this._addTreeEntry(e)))
}
if (!(this.tm.size() > 0)) {
i = !1;
break
}
s = this.tm.pop()
}
if (this.targetReached = i,
i) {
let e = 0;
for (; s.getPredecessor(); )
this.stack.push(s.getCon()),
s = s.getPredecessor(),
e += s.g;
return this.stack.push(s.getCon()),
e += s.g,
e
}
return Number.MAX_VALUE
}
isPlaneAtAirfield(e) {
return e.isAirConnection() || e.hasAirfield(this.map)
}
isTargetReached() {
return this.targetReached
}
loadCmdList() {
if (0 === this.stack.length)
return;
let e, t = this.stack.pop(), i = null, s = t.isOnSea();
const r = a.IZ.getMod().hasAirplanesWw2();
for (this.addGotoCmd(t); this.stack.length > 0; ) {
if (i = t,
t = this.stack.pop(),
e = s,
s = t.isOnSea(),
e !== s && !this.army.armyNeedsWater()) {
const r = this.calcHarbourCostsSec(i, t, s)
, n = new y.V;
if (n.waitSeconds = r,
n.cancelable = !1,
e = this.isReverseAStarAvailable() ? !e : e,
n.direction = e ? S.q.DISEMBARKING : S.q.EMBARKING,
this.army.needsRail && this.cmds.length > 0) {
const e = this.cmds[this.cmds.length - 1];
if (e instanceof p.U) {
const t = this.map.getProvinceAt(e.getTargetPos());
(null == t || t.hasRailroad()) && this.cmds.push(n)
}
} else
this.cmds.push(n)
}
this.addGotoCmd(t),
r && t.isAirConnection() && this.addRefuelCmd(t)
}
}
addRefuelCmd(e) {
const t = this.calcRefuelCostsSec(e);
if (t > 0) {
const e = new y.V;
e.waitSeconds = t,
e.cancelable = !1,
e.direction = S.q.REFUELING,
this.cmds.push(e)
}
}
addGotoCmd(e) {
if (e.getLength() >= D.minDistance) {
if (e.isAirConnection()) {
const t = new m.f;
this.isReverseAStarAvailable() ? t.setTargetAirfield(e.getStartField()) : t.setTargetAirfield(e.getTargetField()),
t.setRelocation(!0),
this.cmds.push(t)
} else {
const t = new p.U;
this.isReverseAStarAvailable() ? (t.setStartPos(e.x1, e.y1),
t.setTargetPos(e.x0, e.y0)) : (t.setStartPos(e.x0, e.y0),
t.setTargetPos(e.x1, e.y1)),
t.setSpeed(this.calculateSpeed(e)),
t.setOnWater(e.isOnSea()),
t.setProvinceID(e.getProvinceID()),
this.cmds.push(t)
}
return !0
}
return !1
}
setMaxDistance(e) {
this.maxDistance = Math.max(e, D.minDistance)
}
setAirTarget(e) {
e ? (this.targetPos = e,
this.airTarget = !0) : this.airTarget = !1
}
calculateSpeed(e) {
return this.army.getSpeedOnConnection(e)
}
calcHarbourCostsSec(e, t, i) {
const {map: s} = this;
let r;
var n, a;
if (i) {
if (r = (null === (n = s.getProvince(e.getProvinceID())) || void 0 === n ? void 0 : n.getOwnerID()) ?? -1,
r < 0) {
const t = s.getC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment