-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuildwindow.js
72 lines (67 loc) · 2.89 KB
/
buildwindow.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// vim: tabstop=2 shiftwidth=2 expandtab
TWDS.buildwindow = {}
TWDS.buildwindow.buttonthing = function (elder) {
TWDS.createEle({
nodeName: 'button.TWDS_buildwindow_start',
last: elder,
title: TWDS._('BUILDWINDOW_CLOTH_TITLE', 'Change clothes'),
children: [
{ nodeName: 'img', src: '/images/items/yield/item_52967.png', alt: 'construction' },
{ nodeName: 'img', src: '/images/items/yield/dynamite.png', alt: 'construction' }
],
onclick: function () {
const items = TWDS.genCalc({ job_1000: 1, joball: 1 }, { build: 3, repair: 1, leadership: 1, joball: 1, job_1000: 1 })
if (items) { TWDS.wearItemsHandler(items) }
}
})
}
TWDS.buildwindow.init = function () {
window.BuildWindow.TWDS_backup_init.apply(this, arguments)
if (!TWDS.settings.misc_buildwindow) { return }
// the original function did format town money, but not player money. Yeah.
this.cbPaymentChanged = function (payer) {
if (this.window.$('#build_cdPayment').data('value') === 'player') {
this.window.$('div.row_build_dollar > span.rp_jobdata_text').text(
'$' + window.format_money(Character.getCapital(true)))
} else { this.window.$('div.row_build_dollar > span.rp_jobdata_text').text('$' + this.deposit) }
}
const drops = TWDS.q1('.build_drops', this.window.divMain)
if (drops) { // wenn nicht vorhanden, dann eben nicht.
TWDS.buildwindow.buttonthing(drops)
}
// fix <small> in the way time.
const bw = TWDS.q1('.build_way', this.window.divMain)
if (bw && bw.textContent.includes('<small>')) {
bw.innerHTML = bw.textContent // what the fuck?
}
const bh = TWDS.q1('.build_head', this.window.divMain)
if (bh.textContent.includes('beichten')) {
bh.innerHTML = '<span>' + bh.textContent + '<br>' +
"<span class='tw_red'>Echt jetzt? Beim Arbeiten?</span></span>"
}
}
TWDS.buildwindow.fairopen = function () {
west.wof.FairSiteWindow.TWDS_backup_open.apply(this, arguments)
if (!TWDS.settings.misc_buildwindow_wof) { return }
const wnd = west.wof.FairSiteWindow.window_.divMain
const cp = TWDS.q1('.tw2gui_window_content_pane', wnd)
if (cp) {
TWDS.buildwindow.buttonthing(cp)
}
}
TWDS.buildwindow.startfunc = function () {
window.BuildWindow.TWDS_backup_init = window.BuildWindow.TWDS_backup_init ||
window.BuildWindow.init
window.BuildWindow.init = TWDS.buildwindow.init
west.wof.FairSiteWindow.TWDS_backup_open = west.wof.FairSiteWindow.TWDS_backup_open || west.wof.FairSiteWindow.open
west.wof.FairSiteWindow.open = TWDS.buildwindow.fairopen
TWDS.registerSetting('bool', 'misc_buildwindow',
TWDS._('BUILDWINDOW_SETTING', 'Add cloth button to the build window.'),
false, null, 'misc')
TWDS.registerSetting('bool', 'misc_buildwindow_wof',
TWDS._('BUILDWINDOW_SETTING_WOF', 'Add cloth button to the fair construction window.'),
true, null, 'misc')
}
TWDS.registerStartFunc(function () {
TWDS.buildwindow.startfunc()
})