1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-25 18:00:10 +00:00
The-Modding-Tree/js/technical/systemComponents.js

220 lines
11 KiB
JavaScript
Raw Normal View History

2020-10-30 17:27:23 +00:00
var systemComponents = {
'tab-buttons': {
props: ['layer', 'data', 'name'],
template: `
<div class="upgRow">
<div v-for="tab in Object.keys(data)">
2021-05-07 23:24:32 +00:00
<button v-if="data[tab].unlocked == undefined || data[tab].unlocked" v-bind:class="{tabButton: true, notify: subtabShouldNotify(layer, name, tab), resetNotify: subtabResetNotify(layer, name, tab)}"
v-bind:style="[{'border-color': tmp[layer].color}, (data[tab].glowColor && subtabShouldNotify(layer, name, tab) ? {'box-shadow': 'var(--hqProperty2a), 0 0 20px ' + data[tab].glowColor} : {}), tmp[layer].componentStyles['tab-button'], data[tab].buttonStyle]"
2021-05-10 01:39:15 +00:00
v-on:click="function(){player.subtabs[layer][name] = tab; updateTabFormats(); needCanvasUpdate = true;}">{{tab}}</button>
2020-10-30 17:27:23 +00:00
</div>
</div>
`
},
'tree-node': {
2021-05-26 05:44:12 +00:00
props: ['layer', 'abb', 'size', 'prev'],
2020-10-30 17:27:23 +00:00
template: `
<button v-if="nodeShown(layer)"
2020-10-30 17:27:23 +00:00
v-bind:id="layer"
v-on:click="function() {
2021-04-27 05:26:07 +00:00
if (shiftDown) player[layer].forceTooltip = !player[layer].forceTooltip
2021-05-26 05:44:12 +00:00
else if(tmp[layer].isLayer) {
if (tmp[layer].leftTab) {
showNavTab(layer, prev)
showTab('none')
}
else
showTab(layer, prev)
}
2020-12-13 04:32:55 +00:00
else {run(layers[layer].onClick, layers[layer])}
2020-10-30 17:27:23 +00:00
}"
2021-04-27 05:26:07 +00:00
2020-10-30 17:27:23 +00:00
v-bind:class="{
treeNode: tmp[layer].isLayer,
treeButton: !tmp[layer].isLayer,
2020-10-30 17:27:23 +00:00
smallNode: size == 'small',
[layer]: true,
2021-04-27 05:26:07 +00:00
tooltipBox: true,
forceTooltip: player[layer].forceTooltip,
2020-10-30 17:27:23 +00:00
ghost: tmp[layer].layerShown == 'ghost',
hidden: !tmp[layer].layerShown,
locked: tmp[layer].isLayer ? !(player[layer].unlocked || tmp[layer].canReset) : !(tmp[layer].canClick),
notify: tmp[layer].notify && player[layer].unlocked,
2020-11-08 04:34:53 +00:00
resetNotify: tmp[layer].prestigeNotify,
2021-05-26 05:44:12 +00:00
can: ((player[layer].unlocked || tmp[layer].canReset) && tmp[layer].isLayer) || (!tmp[layer].isLayer && tmp[layer].canClick),
2021-05-24 15:41:30 +00:00
front: !tmp.scrolled,
2020-10-30 17:27:23 +00:00
}"
2021-05-03 02:39:38 +00:00
v-bind:style="constructNodeStyle(layer)">
<span v-html="(abb !== '' && tmp[layer].image === undefined) ? abb : '&nbsp;'"></span>
2021-04-27 05:26:07 +00:00
<tooltip
v-if="tmp[layer].tooltip != ''"
:text="(tmp[layer].isLayer) ? (
2021-04-27 05:26:07 +00:00
player[layer].unlocked ? (tmp[layer].tooltip ? tmp[layer].tooltip : formatWhole(player[layer].points) + ' ' + tmp[layer].resource)
: (tmp[layer].tooltipLocked ? tmp[layer].tooltipLocked : 'Reach ' + formatWhole(tmp[layer].requires) + ' ' + tmp[layer].baseResource + ' to unlock (You have ' + formatWhole(tmp[layer].baseAmount) + ' ' + tmp[layer].baseResource + ')')
)
: (
tmp[layer].canClick ? (tmp[layer].tooltip ? tmp[layer].tooltip : 'I am a button!')
: (tmp[layer].tooltipLocked ? tmp[layer].tooltipLocked : 'I am a button!')
)"></tooltip>
2021-05-12 03:04:59 +00:00
<node-mark :layer='layer' :data='layers[layer].marked'></node-mark></span>
2020-10-30 17:27:23 +00:00
</button>
`
},
2020-10-30 17:27:23 +00:00
'layer-tab': {
2020-12-05 19:52:29 +00:00
props: ['layer', 'back', 'spacing', 'embedded'],
2021-06-02 22:51:33 +00:00
template: `<div v-bind:style="[tmp[layer].style ? tmp[layer].style : {}, (tmp[layer].tabFormat && !Array.isArray(tmp[layer].tabFormat)) ? tmp[layer].tabFormat[player.subtabs[layer].mainTabs].style : {}, {'background-color': 'transparent !important', '--background': 'transparent !important'}]">
2021-05-26 05:44:12 +00:00
<div v-if="back"><button v-bind:class="back == 'big' ? 'other-back' : 'back'" v-on:click="goBack(layer)"></button></div>
2020-10-30 17:27:23 +00:00
<div v-if="!tmp[layer].tabFormat">
<div v-if="spacing" v-bind:style="{'height': spacing}" :key="this.$vnode.key + '-spacing'"></div>
2021-05-25 02:28:13 +00:00
<infobox v-if="tmp[layer].infoboxes" :layer="layer" :data="Object.keys(tmp[layer].infoboxes)[0]":key="this.$vnode.key + '-info'"></infobox>
2020-10-30 17:27:23 +00:00
<main-display v-bind:style="tmp[layer].componentStyles['main-display']" :layer="layer"></main-display>
<div v-if="tmp[layer].type !== 'none'">
<prestige-button v-bind:style="tmp[layer].componentStyles['prestige-button']" :layer="layer"></prestige-button>
</div>
<resource-display v-bind:style="tmp[layer].componentStyles['resource-display']" :layer="layer"></resource-display>
<milestones v-bind:style="tmp[layer].componentStyles.milestones" :layer="layer"></milestones>
<div v-if="Array.isArray(tmp[layer].midsection)">
<column :layer="layer" :data="tmp[layer].midsection" :key="this.$vnode.key + '-mid'"></column>
2020-10-30 17:27:23 +00:00
</div>
<clickables v-bind:style="tmp[layer].componentStyles['clickables']" :layer="layer"></clickables>
<buyables v-bind:style="tmp[layer].componentStyles.buyables" :layer="layer"></buyables>
<upgrades v-bind:style="tmp[layer].componentStyles['upgrades']" :layer="layer"></upgrades>
<challenges v-bind:style="tmp[layer].componentStyles['challenges']" :layer="layer"></challenges>
<achievements v-bind:style="tmp[layer].componentStyles.achievements" :layer="layer"></achievements>
2020-10-30 17:27:23 +00:00
<br><br>
</div>
<div v-if="tmp[layer].tabFormat">
<div v-if="Array.isArray(tmp[layer].tabFormat)"><div v-if="spacing" v-bind:style="{'height': spacing}"></div>
<column :layer="layer" :data="tmp[layer].tabFormat" :key="this.$vnode.key + '-col'"></column>
2020-10-30 17:27:23 +00:00
</div>
<div v-else>
2020-12-05 19:52:29 +00:00
<div class="upgTable" v-bind:style="{'padding-top': (embedded ? '0' : '25px'), 'margin-top': (embedded ? '-10px' : '0'), 'margin-bottom': '24px'}">
2020-10-30 17:27:23 +00:00
<tab-buttons v-bind:style="tmp[layer].componentStyles['tab-buttons']" :layer="layer" :data="tmp[layer].tabFormat" :name="'mainTabs'"></tab-buttons>
</div>
<layer-tab v-if="tmp[layer].tabFormat[player.subtabs[layer].mainTabs].embedLayer" :layer="tmp[layer].tabFormat[player.subtabs[layer].mainTabs].embedLayer" :embedded="true" :key="this.$vnode.key + '-' + layer"></layer-tab>
<column v-else :layer="layer" :data="tmp[layer].tabFormat[player.subtabs[layer].mainTabs].content" :key="this.$vnode.key + '-col'"></column>
2020-10-30 17:27:23 +00:00
</div>
</div></div>
`
},
'overlay-head': {
template: `
<div class="overlayThing" style="padding-bottom:7px; width: 90%; z-index: 1000; position: relative">
2020-10-30 17:27:23 +00:00
<span v-if="player.devSpeed && player.devSpeed != 1" class="overlayThing">
<br>Dev Speed: {{format(player.devSpeed)}}x<br>
</span>
<span v-if="player.offTime !== undefined" class="overlayThing">
<br>Offline Time: {{formatTime(player.offTime.remain)}}<br>
</span>
<br>
<span v-if="player.points.lt('1e1000')" class="overlayThing">You have </span>
<h2 class="overlayThing" id="points">{{format(player.points)}}</h2>
<span v-if="player.points.lt('1e1e6')" class="overlayThing"> {{modInfo.pointsName}}</span>
<br>
2021-05-06 21:51:06 +00:00
<span v-if="canGenPoints()" class="overlayThing">({{tmp.other.oompsMag != 0 ? format(tmp.other.oomps) + " OOM" + (tmp.other.oompsMag < 0 ? "^OOM" : tmp.other.oompsMag > 1 ? "^" + tmp.other.oompsMag : "") + "s" : formatSmall(getPointGen())}}/sec)</span>
2020-10-30 17:27:23 +00:00
<div v-for="thing in tmp.displayThings" class="overlayThing"><span v-if="thing" v-html="thing"></span></div>
</div>
`
},
2020-10-30 23:40:48 +00:00
'info-tab': {
template: `
<div>
<h2>{{modInfo.name}}</h2>
<br>
<h3>{{VERSION.withName}}</h3>
<span v-if="modInfo.author">
<br>
Made by {{modInfo.author}}
</span>
<br>
2020-12-05 19:52:29 +00:00
The Modding Tree <a v-bind:href="'https://github.com/Acamaeda/The-Modding-Tree/blob/master/changelog.md'" target="_blank" class="link" v-bind:style = "{'font-size': '14px', 'display': 'inline'}" >{{TMT_VERSION.tmtNum}}</a> by Acamaeda
2020-10-30 23:40:48 +00:00
<br>
The Prestige Tree made by Jacorb and Aarex
2020-12-05 19:52:29 +00:00
<br><br>
<div class="link" onclick="showTab('changelog-tab')">Changelog</div><br>
2020-10-30 23:40:48 +00:00
<span v-if="modInfo.discordLink"><a class="link" v-bind:href="modInfo.discordLink" target="_blank">{{modInfo.discordName}}</a><br></span>
<a class="link" href="https://discord.gg/F3xveHV" target="_blank" v-bind:style="modInfo.discordLink ? {'font-size': '16px'} : {}">The Modding Tree Discord</a><br>
<a class="link" href="http://discord.gg/wwQfgPa" target="_blank" v-bind:style="{'font-size': '16px'}">Main Prestige Tree server</a><br>
2020-12-05 19:52:29 +00:00
<br><br>
2020-10-30 23:40:48 +00:00
Time Played: {{ formatTime(player.timePlayed) }}<br><br>
<h3>Hotkeys</h3><br>
2020-11-29 02:25:53 +00:00
<span v-for="key in hotkeys" v-if="player[key.layer].unlocked && tmp[key.layer].hotkeys[key.id].unlocked"><br>{{key.description}}</span></div>
2020-10-30 23:40:48 +00:00
`
},
'options-tab': {
template: `
<table>
<tr>
<td><button class="opt" onclick="save()">Save</button></td>
2021-06-03 05:04:56 +00:00
<td><button class="opt" onclick="toggleOpt('autosave')">Autosave: {{ options.autosave?"ON":"OFF" }}</button></td>
2020-10-30 23:40:48 +00:00
<td><button class="opt" onclick="hardReset()">HARD RESET</button></td>
</tr>
<tr>
<td><button class="opt" onclick="exportSave()">Export to clipboard</button></td>
<td><button class="opt" onclick="importSave()">Import</button></td>
2021-06-03 05:04:56 +00:00
<td><button class="opt" onclick="toggleOpt('offlineProd')">Offline Prod: {{ options.offlineProd?"ON":"OFF" }}</button></td>
2020-10-30 23:40:48 +00:00
</tr>
<tr>
<td><button class="opt" onclick="switchTheme()">Theme: {{ getThemeName() }}</button></td>
2021-06-03 05:04:56 +00:00
<td><button class="opt" onclick="adjustMSDisp()">Show Milestones: {{ MS_DISPLAYS[MS_SETTINGS.indexOf(options.msDisplay)]}}</button></td>
<td><button class="opt" onclick="toggleOpt('hqTree')">High-Quality Tree: {{ options.hqTree?"ON":"OFF" }}</button></td>
2020-10-30 23:40:48 +00:00
</tr>
2021-05-10 22:27:37 +00:00
<tr>
2021-06-03 05:04:56 +00:00
<td><button class="opt" onclick="toggleOpt('hideChallenges')">Completed Challenges: {{ options.hideChallenges?"HIDDEN":"SHOWN" }}</button></td>
<td><button class="opt" onclick="toggleOpt('forceOneTab'); needsCanvasUpdate = true">Single-Tab Mode: {{ options.forceOneTab?"ALWAYS":"AUTO" }}</button></td>
2021-05-10 22:27:37 +00:00
</tr>
2020-10-30 23:40:48 +00:00
</table>`
},
'back-button': {
template: `
<button v-bind:class="back" onclick="goBack()"></button>
`
2021-04-27 05:26:07 +00:00
},
2021-04-27 05:26:07 +00:00
'tooltip' : {
props: ['text'],
template: `<div class="tooltip" v-html="text"></div>
`
2021-05-12 03:04:59 +00:00
},
'node-mark': {
2021-06-03 05:04:56 +00:00
props: {'layer': {}, data: {}, offset: {default: 0}, scale: {default: 1}},
2021-05-12 03:04:59 +00:00
template: `<div v-if='data'>
2021-06-03 05:04:56 +00:00
<div v-if='data === true' class='star' v-bind:style='{position: "absolute", left: (offset-10) + "px", top: (offset-10) + "px", transform: "scale( " + scale||1 + ", " + scale||1 + ")"}'></div>
<img v-else class='mark' v-bind:style='{position: "absolute", left: (offset-22) + "px", top: (offset-15) + "px", transform: "scale( " + scale||1 + ", " + scale||1 + ")"}' v-bind:src="data"></div>
2021-05-12 03:04:59 +00:00
</div>
`
2021-05-14 01:40:51 +00:00
},
'particle': {
props: ['data', 'index'],
2021-05-18 20:06:03 +00:00
template: `<div><div class='particle instant' v-bind:style="[constructParticleStyle(data), data.style]"
v-on:click="run(data.onClick, data)" v-on:mouseenter="run(data.onMouseOver, data)" v-on:mouseleave="run(data.onMouseLeave, data)" ><span v-html="data.text"></span>
</div>
2021-05-18 20:06:03 +00:00
<svg version="2" v-if="data.color">
<mask v-bind:id="'pmask' + data.id">
<image id="img" v-bind:href="data.image" x="0" y="0" :height="data.width" :width="data.height" />
</mask>
</svg>
</div>
2021-05-14 01:40:51 +00:00
`
},
2021-05-12 03:04:59 +00:00
2021-06-02 22:51:33 +00:00
'bg': {
props: ['layer'],
2021-06-03 05:04:56 +00:00
template: `<div class ="bg" v-bind:style="[tmp[layer].style ? tmp[layer].style : {}, (tmp[layer].tabFormat && !Array.isArray(tmp[layer].tabFormat)) ? tmp[layer].tabFormat[player.subtabs[layer].mainTabs].style : {}]"></div>
2021-06-02 22:51:33 +00:00
`
}
2021-05-12 03:04:59 +00:00
}