Repository navigation
Expand file tree
/
Copy pathArjUI.lua
More file actions
3832 lines (3384 loc) · 152 KB
/
Copy pathArjUI.lua
File metadata and controls
3832 lines (3384 loc) · 152 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
-- ArjUI Core v1.2 (Mudlet 4.19.1)
-- GMCP-based UI for Duris MUD
-- Dark Fantasy Aesthetic
ArjUI = ArjUI or {}
ArjUI.VERSION = "1.3.0"
ArjUI.eventHandlers = ArjUI.eventHandlers or {}
ArjUI.playerName = ArjUI.playerName or nil
ArjUI.captureTriggers = ArjUI.captureTriggers or {}
ArjUI.capturing = nil
ArjUI.captureBuffer = {}
ArjUI.customCommands = ArjUI.customCommands or {
players = {}, -- { {text="Label", cmd="command"}, ... } - target auto-appended
mobs = {},
objects = {},
inventory = {},
equipment = {}
}
-- Private messaging system (session-only, not persisted)
ArjUI.privateChats = {} -- { [playerName] = { window, history, unread } }
ArjUI.tellContacts = {} -- List of players we've had tells with
-- ============================================================
-- CLEANUP
-- ============================================================
function ArjUI:kill()
for _, handler in ipairs(self.eventHandlers) do
killAnonymousEventHandler(handler)
end
self.eventHandlers = {}
-- Kill capture triggers
for _, tid in pairs(self.captureTriggers or {}) do
pcall(function() killTrigger(tid) end)
end
self.captureTriggers = {}
self.capturing = nil
self.captureBuffer = {}
if self.teardownPorted then self:teardownPorted() end
-- Kill routeall trigger
if self.routeAllTriggerId then
pcall(function() killTrigger(self.routeAllTriggerId) end)
self.routeAllTriggerId = nil
end
-- Also kill by name in case it's a permanent trigger
if exists("ArjUI_RouteAll", "trigger") > 0 then
pcall(function() killTrigger("ArjUI_RouteAll") end)
end
-- Clean up popup if open
if self.addCmdPopup then pcall(function() self.addCmdPopup:hide() end) end
-- Clean up private chat windows (Label-based custom windows)
for pname, chat in pairs(self.privateChats or {}) do
if chat.window then
pcall(function()
chat.window:hide()
end)
end
end
if self.bg then
self.bg:hide()
self.bg = nil
end
if self.main then
self.main:hide()
self.main = nil
end
-- Restore default borders so main console is visible again
setBorderTop(0)
setBorderBottom(0)
setBorderLeft(0)
setBorderRight(0)
-- Re-enable main command line
pcall(function() enableCommandLine("main") end)
pcall(function() enableCommandLine() end)
end
function ArjUI:applyBackground()
-- Package installs to profile folder: getMudletHomeDir()/profiles/[profile]/[package]/
-- Try multiple possible paths
local possiblePaths = {
getMudletHomeDir() .. "/Arjinius Client V1.0/NewDuris v1.png", -- Old location
getMudletHomeDir() .. "/Arjinius Client/NewDuris v1.png", -- Without version
}
-- Also try profile-relative path if available
if getProfileName then
local profile = getProfileName()
if profile then
table.insert(possiblePaths, 1, getMudletHomeDir() .. "/profiles/" .. profile .. "/Arjinius Client V1.0/NewDuris v1.png")
table.insert(possiblePaths, 2, getMudletHomeDir() .. "/profiles/" .. profile .. "/Arjinius Client/NewDuris v1.png")
end
end
local bgPath = nil
for _, path in ipairs(possiblePaths) do
local normalPath = path:gsub("/", "\\")
local f = io.open(normalPath, "r")
if f then
f:close()
bgPath = path:gsub("\\", "/") -- Qt needs forward slashes
break
end
end
if self.bg then
if bgPath then
self.bg:setStyleSheet(string.format([[
border-image: url("%s") 0 0 0 0 stretch stretch;
]], bgPath))
else
-- Fallback: dark gradient background
self.bg:setStyleSheet([[
background-color: qlineargradient(x1:0,y1:0,x2:1,y2:1,stop:0 #0a0908,stop:0.5 #12100c,stop:1 #0a0908);
]])
end
end
end
-- ============================================================
-- UTILITIES
-- ============================================================
local function styleSafe(widget, css)
if widget and widget.setStyleSheet then
widget:setStyleSheet(css)
end
end
local function labelSet(labelObj, text)
if not labelObj then return end
if labelObj.clear then labelObj:clear() end
if labelObj.echo then labelObj:echo(text or "") end
end
local function makePanel(parent, name, x, y, w, h, css)
local panel = Geyser.Label:new({
name = name, x = x, y = y, width = w, height = h,
}, parent)
styleSafe(panel, css)
labelSet(panel, "")
return panel
end
local function makeConsole(parent, name, x, y, w, h, fontSize, wrap)
local console = Geyser.MiniConsole:new({
name = name, x = x, y = y, width = w, height = h, fontSize = fontSize or 10
}, parent)
-- Warm-tinted background - MiniConsoles don't support true transparency
-- Use a color that blends with the bronze theme
console:setBgColor(12, 11, 9)
console:setFgColor(200, 200, 200)
console:setWrap(wrap or 200)
setBackgroundColor(console.name, 12, 11, 9, 255)
return console
end
local function toNum(x) return tonumber(x) end
local function upper3(pos)
if not pos or type(pos) ~= "string" then return "" end
return string.upper(pos:sub(1,3))
end
local function pick(tbl, ...)
if not tbl then return nil end
for i = 1, select("#", ...) do
local k = select(i, ...)
local v = tbl[k]
if v ~= nil then return v end
end
return nil
end
local function stripColors(text)
if not text then return "" end
text = text:gsub("&%+.", "")
text = text:gsub("&=..", "")
text = text:gsub("&[nN%]]", "")
text = text:gsub("\27%][^\7]*\7", "")
text = text:gsub("\27%][^\27]*\27\\", "")
text = text:gsub("\27%[%d*;?%d*m", "")
return text
end
-- Duris color code to decho RGB format (for MiniConsoles)
local durisColors = {
r = "<128,0,0>", R = "<255,0,0>",
g = "<0,128,0>", G = "<0,255,0>",
b = "<0,0,170>", B = "<85,85,255>",
c = "<0,128,128>", C = "<0,255,255>",
m = "<128,0,128>", M = "<255,0,255>",
y = "<128,128,0>", Y = "<255,255,0>",
w = "<192,192,192>", W = "<255,255,255>",
L = "<96,96,96>", l = "<96,96,96>",
}
-- Convert Duris color codes to Mudlet decho format (RGB)
local function durisToDecho(text)
if not text then return "" end
local result = {}
local i, len = 1, #text
local currentColor = nil
local buffer = ""
local function flushBuffer()
if buffer ~= "" then
if currentColor then
table.insert(result, currentColor .. buffer)
else
table.insert(result, buffer)
end
buffer = ""
end
end
while i <= len do
local ch = text:sub(i, i)
if ch == "&" and i < len then
local nxt = text:sub(i+1, i+1)
if nxt == "+" and i + 2 <= len then
flushBuffer()
local colorCode = text:sub(i+2, i+2)
currentColor = durisColors[colorCode]
i = i + 3
elseif nxt == "n" or nxt == "N" or nxt == "]" then
flushBuffer()
currentColor = nil
i = i + 2
elseif nxt == "=" and i + 3 <= len then
flushBuffer()
local fgCode = text:sub(i+2, i+2)
currentColor = durisColors[fgCode]
i = i + 4
else
i = i + 1
end
else
buffer = buffer .. ch
i = i + 1
end
end
flushBuffer()
return table.concat(result)
end
-- ============================================================
-- TARGET NORMALIZATION (FIX: clickable mobs/objs passing tags)
-- ============================================================
local function trim(s)
return (s or ""):gsub("^%s+", ""):gsub("%s+$", "")
end
local function normalizeTargetName(name)
if not name then return "" end
-- 1) remove formats we already handle
local s = stripColors(name)
-- 2) remove Mudlet-style tags like <red>, <reset>, etc.
s = s:gsub("<[^>]+>", "")
-- 2b) sometimes we get partial/broken tag fragments; strip common leftovers
s = s:gsub("</[%w_]+", "")
:gsub("<[%w_]+", "")
:gsub("/[%w_]+>", "")
-- 3) collapse whitespace
s = trim(s):gsub("%s+", " ")
-- 4) optionally strip leading articles (often helps targeting)
s = s:gsub("^[Aa]n%s+", "")
:gsub("^[Aa]%s+", "")
:gsub("^[Tt]he%s+", "")
return trim(s)
end
local function quoteIfNeeded(s)
s = trim(s or "")
if s:find("%s") then
return "'" .. s .. "'"
end
return s
end
local function durisTargetKey(name)
-- Start from the clean display name
local s = normalizeTargetName(name)
s = trim(s)
if s == "" then return "" end
-- If it has an "of ..." tail, drop it (corpse of a raccoon -> corpse)
-- This avoids the classic "that isn't a container" / parse confusion.
if s:find("%s+[Oo][Ff]%s+") then
local head = s:match("^(.-)%s+[Oo][Ff]%s+.+$")
if head and head ~= "" then s = trim(head) end
end
-- If it's still multi-word, prefer the last word as a stable keyword
-- (black wolf -> wolf) which Duris will generally match.
if s:find("%s") then
s = s:match("(%S+)$") or s
end
return trim(s)
end
-- ============================================================
-- UI INITIALIZATION
-- ============================================================
function ArjUI:init()
self:kill()
-- Layout constants as percentages for DPI-independent scaling
-- Tuned to match the decorative background frame
self.bannerPct = 10.5 -- top margin (below New Duris banner)
self.frameInsetXPct = 2.5 -- side margins (inside decorative frame)
self.frameInsetBottomPct = 2.8 -- bottom margin (above bottom frame)
local w, h = getMainWindowSize()
-- Create background label at ROOT level (no parent) so it sits behind everything including main console
self.bg = Geyser.Label:new({
name = "ArjUI_Background", x = 0, y = 0, width = "100%", height = "100%"
})
self.bg:setStyleSheet([[background-color: #000000;]])
self:applyBackground()
-- Reserve ALL space with borders so main console has nowhere to render
-- This pushes the main console out of view
setBorderTop(h)
setBorderBottom(0)
setBorderLeft(0)
setBorderRight(0)
pcall(function() disableCommandLine("main") end)
pcall(function() disableCommandLine() end)
-- Main container for our UI, sits on top of background (transparent so bg shows through gaps)
self.main = Geyser.Container:new({
name = "ArjUI_Main", x = 0, y = 0, width = "100%", height = "100%"
})
-- Use percentage-based positioning for DPI independence
local rootX = self.frameInsetXPct .. "%"
local rootY = self.bannerPct .. "%"
local rootW = (100 - self.frameInsetXPct * 2) .. "%"
local rootH = (100 - self.bannerPct - self.frameInsetBottomPct) .. "%"
self.uiRoot = Geyser.Container:new({
name = "ArjUI_Root", x = rootX, y = rootY, width = rootW, height = rootH
}, self.main)
local colors = {
-- Backgrounds: warm-tinted dark (not pure black)
bgDark = "#0a0908", bgMid = "#0f0e0c", bgLight = "#16140f",
-- Border hierarchy: primary (muted bronze), secondary (darker), dividers (near-neutral)
borderPrimary = "#8c6e46", -- muted bronze for primary panels
borderSecondary = "#5a4b37", -- darker bronze for secondary panels
borderDivider = "#3c3832", -- near-neutral warm gray for dividers
borderDark = "#2a2520", -- darkest for subtle edges
accent = "#c9a227", -- warm gold accent (unchanged)
-- Text colors (unchanged - no font changes)
textDim = "#8a8a8a", textMid = "#b0b0b0", textBright = "#e6e6e6",
textGold = "#d4a855", textRed = "#c45050", textGreen = "#50c070", textBlue = "#7090c0",
}
self.colors = colors
self.styles = {
-- Primary panels (main output, map, input) - stronger bronze border, near-opaque
panel = string.format("background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 %s,stop:1 %s); border: 2px solid %s; border-top: 2px solid %s; border-radius: 4px;", colors.bgMid, colors.bgDark, colors.borderSecondary, colors.borderPrimary),
-- Primary content panels (main output, input) - opaque for readability
panelPrimary = "background-color: rgba(10, 9, 8, 250); border: 2px solid #5a4b37; border-top: 2px solid #8c6e46; border-radius: 4px;",
-- Secondary panels (side info) - softer border, slight transparency (85-90%)
panelGlass = "background-color: rgba(10, 9, 8, 218); border: 1px solid #5a4b37; border-top: 1px solid #8c6e46; border-radius: 4px;",
header = string.format("background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 %s,stop:1 %s); border: 1px solid %s; border-bottom: 1px solid %s; color: %s; qproperty-alignment: 'AlignCenter'; font-size: 9px; font-weight: bold;", colors.bgLight, colors.bgMid, colors.borderDivider, colors.borderSecondary, colors.textDim),
headerCombat = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #1a100c,stop:1 #0f0e0c); border: 1px solid #4a3028; border-bottom: 1px solid #5a3830; color: #c45050; qproperty-alignment: 'AlignCenter'; font-size: 9px; font-weight: bold;",
headerTarget = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #18140c,stop:1 #0f0e0c); border: 1px solid #4a4028; border-bottom: 1px solid #5a4830; color: #d4a855; qproperty-alignment: 'AlignCenter'; font-size: 9px; font-weight: bold;",
headerAffects = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #10140c,stop:1 #0f0e0c); border: 1px solid #384a28; border-bottom: 1px solid #405830; color: #50c070; qproperty-alignment: 'AlignCenter'; font-size: 9px; font-weight: bold;",
areaName = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #0c1012,stop:1 #0a0908); border: 1px solid #3c3832; border-bottom: 1px solid #5a4b37; color: #70b0c0; qproperty-alignment: 'AlignCenter'; font-weight: bold; font-size: 11px;",
areaNameHover = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #10141a,stop:1 #0c1012); border: 1px solid #5a4b37; border-bottom: 1px solid #8c6e46; color: #90d0e0; qproperty-alignment: 'AlignCenter'; font-weight: bold; font-size: 11px;",
exits = string.format("background-color: %s; border: 1px solid %s; color: %s; font-size: 10px;", colors.bgMid, colors.borderDivider, colors.textDim),
pos = string.format("background-color: %s; border: 1px solid %s; color: %s; qproperty-alignment: 'AlignCenter'; font-size: 9px; font-weight: bold;", colors.bgLight, colors.borderDivider, colors.textBlue),
posAlert = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #1a0c0c,stop:1 #120808); border: 1px solid #8a4040; border-top: 1px solid #a05050; color: #ff6060; qproperty-alignment: 'AlignCenter'; font-size: 9px; font-weight: bold;",
tankName = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #10140c,stop:1 #0a0908); border: 1px solid #384a28; border-bottom: 1px solid #405830; color: #70d070; qproperty-alignment: 'AlignLeft'; font-weight: bold; font-size: 11px; padding-left: 4px;",
tankNameMe = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #1a0c0c,stop:0.5 #200f0f,stop:1 #1a0c0c); border: 1px solid #5a3028; border-bottom: 1px solid #6a3830; color: #ff7070; qproperty-alignment: 'AlignLeft'; font-weight: bold; font-size: 11px; padding-left: 4px;",
targetName = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #16120a,stop:1 #0a0908); border: 1px solid #5a4b37; border-bottom: 1px solid #8c6e46; color: #e0b060; qproperty-alignment: 'AlignLeft'; font-weight: bold; font-size: 11px; padding-left: 4px;",
targetDead = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #0c0b0a,stop:1 #0a0908); border: 1px solid #3c3832; border-bottom: 1px solid #3c3832; color: #606060; qproperty-alignment: 'AlignLeft'; font-weight: bold; font-size: 11px; padding-left: 4px;",
roomName = string.format("background-color: %s; border: 1px solid %s; color: %s; qproperty-alignment: 'AlignCenter'; font-size: 12px; font-weight: bold;", colors.bgMid, colors.borderDivider, colors.textBlue),
separator = "background-color: qlineargradient(x1:0,y1:0,x2:1,y2:0,stop:0 #0a0908,stop:0.5 #5a4b37,stop:1 #0a0908); border: none; border-radius: 1px;", -- warm bronze separator with gradient
inputBar = "background-color: qlineargradient(x1:0,y1:0,x2:0,y2:1,stop:0 #12100c,stop:1 #0a0908); border: 2px solid #5a4b37; border-top: 2px solid #8c6e46; border-radius: 4px; color: #d0d0d8; font-size: 12px; font-family: Consolas; padding: 3px 6px;",
exitButton = "background-color: transparent; color: #7090c0; font-size: 10px; font-weight: bold;",
exitButtonHover = "background-color: #1a2a3a; color: #90b0e0; font-size: 10px; font-weight: bold; border-radius: 2px;",
exitButtonClosed = "background-color: transparent; color: #b08040; font-size: 10px; font-weight: bold; border-bottom: 1px solid #8a5a20;",
exitButtonLocked = "background-color: transparent; color: #c05050; font-size: 10px; font-weight: bold; border-bottom: 1px solid #8a3030;",
}
self.gaugeStyles = {
-- Gauge borders use warm-tinted versions of their colors
hpFront = "background-color: qlineargradient(x1:0,y1:0,x2:1,y2:0,stop:0 #6b1010,stop:0.5 #8b2020,stop:1 #6b1010); border: none; border-radius: 2px;",
hpBack = "background-color: #0a0908; border: 1px solid #3a2520; border-radius: 3px;",
mpFront = "background-color: qlineargradient(x1:0,y1:0,x2:1,y2:0,stop:0 #102060,stop:0.5 #203080,stop:1 #102060); border: none; border-radius: 2px;",
mpBack = "background-color: #0a0908; border: 1px solid #2a3040; border-radius: 3px;",
mvFront = "background-color: qlineargradient(x1:0,y1:0,x2:1,y2:0,stop:0 #105010,stop:0.5 #207020,stop:1 #105010); border: none; border-radius: 2px;",
mvBack = "background-color: #0a0908; border: 1px solid #2a3a20; border-radius: 3px;",
xpFront = "background-color: qlineargradient(x1:0,y1:0,x2:1,y2:0,stop:0 #301050,stop:0.5 #502080,stop:1 #301050); border: none; border-radius: 2px;",
xpBack = "background-color: #0a0908; border: 1px solid #302540; border-radius: 3px;",
targetFront = "background-color: qlineargradient(x1:0,y1:0,x2:1,y2:0,stop:0 #5a4010,stop:0.5 #7a5520,stop:1 #5a4010); border: none; border-radius: 2px;",
targetBack = "background-color: #0a0908; border: 1px solid #3c3020; border-radius: 3px;",
deadFront = "background-color: #1a1816; border: none; border-radius: 2px;",
deadBack = "background-color: #0a0908; border: 1px solid #2a2520; border-radius: 3px;",
gaugeText = "color: #e6e6e6; font-size: 9px; font-weight: bold;",
}
local gap = "0.2%" -- minimal gap between panels
local leftW, centerW, rightW = "16.5%", "57%", "26%" -- total ~99.5%, fills more space
local bottomH, topH = "16.5%", "83%"
self.topSection = makePanel(self.uiRoot, "ArjUI_TopSection", "0%", "0%", "100%", topH, self.styles.panel)
styleSafe(self.topSection, "background-color: transparent; border: none;")
self.bottomBar = makePanel(self.uiRoot, "ArjUI_BottomBar", "0%", "83.5%", "100%", bottomH, self.styles.panel)
styleSafe(self.bottomBar, "background-color: transparent; border: none;")
-- LEFT COLUMN (container for distinct panels with gaps)
self.leftCol = makePanel(self.topSection, "ArjUI_LeftCol", 0, 0, leftW, "100%", self.styles.panel)
styleSafe(self.leftCol, "background-color: transparent; border: none;") -- transparent container
-- SECTION 1: Area + Map (0% - 35%) - Larger map section
self.mapSection = makePanel(self.leftCol, "ArjUI_MapSection", 0, 0, "100%", "35%", self.styles.panel)
styleSafe(self.mapSection, self.styles.panelGlass)
-- Globe/World Map link (top-left, above area label)
self.globeBtn = Geyser.Label:new({ name = "ArjUI_GlobeBtn", x = "3%", y = "1%", width = "12%", height = "12%" }, self.mapSection)
self.globeBtn:setStyleSheet([[
QLabel { background-color: rgba(10,9,8,200); color: #7be; border: 1px solid #5a4b37; border-radius: 10px; font-size: 11px; }
QLabel:hover { background-color: rgba(22,20,15,220); color: #9df; border-color: #8c6e46; }
]])
self.globeBtn:echo("<center>🌐</center>")
self.globeBtn:setClickCallback(function() openUrl("https://www.newduris.com/wiki/map") end)
self.globeBtn:setOnEnter(function() self.globeBtn:setCursor("PointingHand") end)
self.globeBtn:setOnLeave(function() self.globeBtn:setCursor("Arrow") end)
-- Area label (next to globe)
self.areaLabel = Geyser.Label:new({ name = "ArjUI_AreaLabel", x = "16%", y = "1%", width = "81%", height = "12%" }, self.mapSection)
styleSafe(self.areaLabel, self.styles.areaName)
labelSet(self.areaLabel, "Unknown Area")
self.areaLabel:setClickCallback(function()
if self.state.zoneId then openUrl("https://www.newduris.com/wiki/zones/" .. tostring(self.state.zoneId)) end
end)
self.areaLabel:setOnEnter(function()
if self.state.zoneId then styleSafe(self.areaLabel, self.styles.areaNameHover); self.areaLabel:setCursor("PointingHand") end
end)
self.areaLabel:setOnLeave(function() styleSafe(self.areaLabel, self.styles.areaName); self.areaLabel:setCursor("Arrow") end)
-- Map - below globe and area label (with clipping to prevent overflow)
self.mapWrap = makePanel(self.mapSection, "ArjUI_MapWrap", "3%", "14%", "94%", "83%", self.styles.panel)
self.mapWrap:setStyleSheet("background-color: rgba(10,9,8,240); border: 2px solid #5a4b37; border-top: 2px solid #8c6e46; border-radius: 4px; overflow: hidden;")
self.mapper = Geyser.Mapper:new({ name = "ArjUI_Mapper", x = 2, y = 2, width = "96%", height = "96%" }, self.mapWrap)
-- SECTION 2: Exits + Time (36% - 40%) - Split into two halves
self.exitsSection = makePanel(self.leftCol, "ArjUI_ExitsSection", 0, "36%", "50%", "4%", self.styles.panel)
styleSafe(self.exitsSection, self.styles.panelGlass)
self.exitsWrap = Geyser.Label:new({ name = "ArjUI_ExitsWrap", x = "3%", y = "5%", width = "94%", height = "90%" }, self.exitsSection)
styleSafe(self.exitsWrap, self.styles.exits)
self.exitButtons = {}
-- Time of day section (right half) - clickable to send 'time' command
self.timeSection = makePanel(self.leftCol, "ArjUI_TimeSection", "51%", "36%", "49%", "4%", self.styles.panel)
styleSafe(self.timeSection, self.styles.panelGlass)
self.timeLabel = Geyser.Label:new({ name = "ArjUI_TimeLabel", x = "5%", y = "5%", width = "90%", height = "90%" }, self.timeSection)
self.timeLabel:setStyleSheet("background-color: transparent; color: #a0a0b0; font-size: 10px; qproperty-alignment: 'AlignCenter';")
self.timeLabel:echo("☀ Day")
self.timeLabel:setClickCallback(function() send("time") end)
-- SECTION 3: Mobs (41% - 69%)
self.mobsSection = makePanel(self.leftCol, "ArjUI_MobsSection", 0, "41%", "100%", "28%", self.styles.panel)
styleSafe(self.mobsSection, self.styles.panelGlass)
self.mobsHeader = Geyser.Label:new({ name = "ArjUI_MobsHeader", x = "3%", y = "3%", width = "94%", height = "14%" }, self.mobsSection)
styleSafe(self.mobsHeader, self.styles.headerCombat)
labelSet(self.mobsHeader, "⚔ MOBS")
self.mobsBox = makeConsole(self.mobsSection, "ArjUI_MobsBox", "3%", "18%", "94%", "79%", 9, 30)
-- SECTION 4: Items (70% - 100%) - extends to match output window bottom
self.itemsSection = makePanel(self.leftCol, "ArjUI_ItemsSection", 0, "70%", "100%", "30%", self.styles.panel)
styleSafe(self.itemsSection, self.styles.panelGlass)
self.objsHeader = Geyser.Label:new({ name = "ArjUI_ObjsHeader", x = "3%", y = "3%", width = "94%", height = "13%" }, self.itemsSection)
styleSafe(self.objsHeader, self.styles.headerTarget)
labelSet(self.objsHeader, "◆ ITEMS")
self.objsBox = makeConsole(self.itemsSection, "ArjUI_ObjsBox", "3%", "17%", "94%", "80%", 9, 30)
-- CENTER COLUMN (with gaps on sides) - primary panel, near-opaque for readability
self.centerCol = makePanel(self.topSection, "ArjUI_CenterCol", "16.7%", 0, centerW, "100%", self.styles.panel)
styleSafe(self.centerCol, self.styles.panelPrimary)
self.xpGauge = Geyser.Gauge:new({ name = "ArjUI_TNLTop", x = "0.5%", y = "0.5%", width = "99%", height = "2.2%" }, self.centerCol)
self.xpGauge.front:setStyleSheet(self.gaugeStyles.xpFront)
self.xpGauge.back:setStyleSheet(self.gaugeStyles.xpBack)
self.xpGauge.text:setStyleSheet(self.gaugeStyles.gaugeText)
self.roomLabel = Geyser.Label:new({ name = "ArjUI_RoomLabel", x = "0.5%", y = "3.0%", width = "99%", height = "3.2%" }, self.centerCol)
styleSafe(self.roomLabel, self.styles.roomName)
self.console = makeConsole(self.centerCol, "ArjUI_Console", "0.5%", "6.5%", "99%", "88%", 10, 400)
self.inputBar = Geyser.CommandLine:new({ name = "ArjUI_Input", x = "0.5%", y = "95%", width = "99%", height = "4.5%" }, self.centerCol)
self.inputBar:setStyleSheet(self.styles.inputBar)
self.inputBar:setFontSize(12)
-- RIGHT COLUMN (container for distinct panels with gaps) - extends to target bar bottom
self.rightCol = makePanel(self.uiRoot, "ArjUI_RightCol", "73.9%", "0%", rightW, "100%", self.styles.panel)
styleSafe(self.rightCol, "background-color: transparent; border: none;") -- transparent container
-- SECTION 1: Tabbed Pane (0% - 45%) - Info tabs fill top space
self.tabSection = makePanel(self.rightCol, "ArjUI_TabSection", 0, 0, "100%", "45%", self.styles.panel)
styleSafe(self.tabSection, self.styles.panelGlass)
-- TABBED PANE (Group/Stats/Inv/Eq/Skills)
self.tabButtons = {}
self.tabPanels = {}
self.activeTab = "group"
local tabNames = { "group", "stats", "inv", "eq", "who", "ship" }
local tabLabels = { "GROUP", "STATS", "INV", "EQ", "WHO", "SHIP" }
local tabW = 16 -- percentage width per tab
for i, tabName in ipairs(tabNames) do
local xPos = string.format("%d%%", 2 + (i-1) * tabW)
local btn = Geyser.Label:new({ name = "ArjUI_Tab_" .. tabName, x = xPos, y = "2%", width = (tabW - 1) .. "%", height = "5%" }, self.tabSection)
btn:echo("<center>" .. tabLabels[i] .. "</center>")
self.tabButtons[tabName] = btn
btn:setClickCallback(function() self:switchTab(tabName) end)
btn:setOnEnter(function() btn:setCursor("PointingHand") end)
btn:setOnLeave(function() btn:setCursor("Arrow") end)
end
-- Tab content area
self.tabContent = Geyser.Container:new({ name = "ArjUI_TabContent", x = "3%", y = "8%", width = "94%", height = "90%" }, self.tabSection)
-- GROUP panel (default) - Container for dynamic gauge widgets
self.groupContainer = Geyser.Container:new({ name = "ArjUI_GroupContainer", x = 0, y = 0, width = "100%", height = "100%" }, self.tabContent)
self.tabPanels.group = self.groupContainer
self.groupWidgets = {} -- Store dynamically created group member widgets
-- STATS panel
self.statsBox = makeConsole(self.tabContent, "ArjUI_StatsBox", 0, 0, "100%", "100%", 9, 40)
self.statsBox:hide()
self.tabPanels.stats = self.statsBox
-- INVENTORY panel
self.invBox = makeConsole(self.tabContent, "ArjUI_InvBox", 0, 0, "100%", "100%", 9, 40)
self.invBox:hide()
self.tabPanels.inv = self.invBox
-- EQ panel (equipment)
self.eqBox = makeConsole(self.tabContent, "ArjUI_EqBox", 0, 0, "100%", "100%", 9, 50)
self.eqBox:hide()
self.tabPanels.eq = self.eqBox
-- WHO panel
self.whoBox = makeConsole(self.tabContent, "ArjUI_WhoBox", 0, 0, "100%", "100%", 9, 60)
self.whoBox:hide()
self.tabPanels.who = self.whoBox
-- SHIP panel (GMCP Ship.Info/Ship.Contacts, or 'look contacts' text)
self.shipBox = makeConsole(self.tabContent, "ArjUI_ShipBox", 0, 0, "100%", "100%", 9, 60)
self.shipBox:hide()
self.tabPanels.ship = self.shipBox
self:updateTabStyles()
-- SECTION 2: Players (46% - 72%) - Players section above chat (expanded to fill gap)
self.playersSection = makePanel(self.rightCol, "ArjUI_PlayersSection", 0, "46%", "100%", "26%", self.styles.panel)
styleSafe(self.playersSection, self.styles.panelGlass)
self.enemyHeader = Geyser.Label:new({ name = "ArjUI_EnemyHeader", x = "3%", y = "3%", width = "94%", height = "14%" }, self.playersSection)
styleSafe(self.enemyHeader, self.styles.headerCombat)
labelSet(self.enemyHeader, "⚔ PLAYERS")
self.enemyBox = makeConsole(self.playersSection, "ArjUI_EnemyBox", "3%", "18%", "94%", "79%", 9, 60)
-- SECTION 3: Chat (73% - 100%) - Chat at bottom, sits just above credit box
self.chatSection = makePanel(self.rightCol, "ArjUI_ChatSection", 0, "73%", "100%", "27%", self.styles.panel)
styleSafe(self.chatSection, self.styles.panelGlass)
-- Chat tabs
self.chatTabs = {}
self.chatPanels = {}
self.activeChatTab = "all"
local chatTabNames = { "all", "tells", "nchat", "room", "guild", "group" }
local chatTabLabels = { "ALL", "TELLS", "NCHAT", "ROOM", "GUILD", "GROUP" }
local chatTabW = 16 -- percentage width per tab
for i, tabName in ipairs(chatTabNames) do
local xPos = string.format("%d%%", 2 + (i-1) * chatTabW)
local btn = Geyser.Label:new({ name = "ArjUI_ChatTab_" .. tabName, x = xPos, y = "2%", width = (chatTabW - 1) .. "%", height = "8%" }, self.chatSection)
btn:echo("<center>" .. chatTabLabels[i] .. "</center>")
self.chatTabs[tabName] = btn
btn:setClickCallback(function() self:switchChatTab(tabName) end)
btn:setOnEnter(function() btn:setCursor("PointingHand") end)
btn:setOnLeave(function() btn:setCursor("Arrow") end)
end
-- Chat content area
self.chatContent = Geyser.Container:new({ name = "ArjUI_ChatContent", x = "3%", y = "12%", width = "94%", height = "86%" }, self.chatSection)
-- ALL chat panel (default)
self.chatBox = makeConsole(self.chatContent, "ArjUI_ChatBox", 0, 0, "100%", "100%", 9, 60)
self.chatPanels.all = self.chatBox
-- TELLS panel
self.tellsBox = makeConsole(self.chatContent, "ArjUI_TellsBox", 0, 0, "100%", "100%", 9, 60)
self.tellsBox:hide()
self.chatPanels.tells = self.tellsBox
-- NCHAT panel
self.nchatBox = makeConsole(self.chatContent, "ArjUI_NchatBox", 0, 0, "100%", "100%", 9, 60)
self.nchatBox:hide()
self.chatPanels.nchat = self.nchatBox
-- ROOM panel (say/yell)
self.roomBox = makeConsole(self.chatContent, "ArjUI_RoomBox", 0, 0, "100%", "100%", 9, 60)
self.roomBox:hide()
self.chatPanels.room = self.roomBox
-- GUILD panel
self.guildBox = makeConsole(self.chatContent, "ArjUI_GuildBox", 0, 0, "100%", "100%", 9, 60)
self.guildBox:hide()
self.chatPanels.guild = self.guildBox
-- GROUP panel
self.groupChatBox = makeConsole(self.chatContent, "ArjUI_GroupChatBox", 0, 0, "100%", "100%", 9, 60)
self.groupChatBox:hide()
self.chatPanels.group = self.groupChatBox
self:updateChatTabStyles()
-- Credit box (directly under chat panel, same width as right column)
local creditX = "73.9%" -- same as rightCol
local creditW = rightW -- same width as rightCol (26%)
local creditY = (100 - self.frameInsetBottomPct + 0.3) .. "%"
self.creditBox = Geyser.Label:new({
name = "ArjUI_CreditBox",
x = creditX, y = creditY, width = creditW, height = 20
}, self.main)
self.creditBox:setStyleSheet([[
background-color: rgba(15, 14, 12, 0.85);
border: 1px solid #3c3428;
border-radius: 3px;
color: #8a7a5a;
font-size: 9px;
qproperty-alignment: 'AlignRight | AlignVCenter';
padding-right: 8px;
]])
self.creditBox:echo("Arjinius Client v1.0")
-- Hover tooltip (appears above credit box)
local tooltipY = (100 - self.frameInsetBottomPct - 3.2) .. "%"
self.creditTooltip = Geyser.Label:new({
name = "ArjUI_CreditTooltip",
x = creditX, y = tooltipY, width = creditW, height = 36
}, self.main)
self.creditTooltip:setStyleSheet([[
background-color: rgba(15, 14, 12, 0.95);
border: 1px solid #5a4b37;
border-radius: 3px;
color: #c0b090;
font-size: 8px;
padding: 4px;
]])
self.creditTooltip:echo("<center>A Mudlet client for New Duris\nCreated by Arjin / Arjinius</center>")
self.creditTooltip:hide()
self.creditBox:setOnEnter(function()
self.creditBox:setStyleSheet([[
background-color: rgba(20, 18, 14, 0.95);
border: 1px solid #5a4b37;
border-radius: 3px;
color: #d4a855;
font-size: 9px;
qproperty-alignment: 'AlignRight | AlignVCenter';
padding-right: 8px;
]])
self.creditTooltip:show()
self.creditTooltip:raise()
end)
self.creditBox:setOnLeave(function()
self.creditBox:setStyleSheet([[
background-color: rgba(15, 14, 12, 0.85);
border: 1px solid #3c3428;
border-radius: 3px;
color: #8a7a5a;
font-size: 9px;
qproperty-alignment: 'AlignRight | AlignVCenter';
padding-right: 8px;
]])
self.creditTooltip:hide()
end)
-- BOTTOM BAR (aligned with columns above)
-- Vitals: under left column (0-16.5%)
-- Tank: first half under output (16.7%-45.2%)
-- Target: second half under output (45.4%-73.7%)
self.myVitalsWrap = makePanel(self.bottomBar, "ArjUI_MyVitalsWrap", "0%", "3%", "16.5%", "94%", self.styles.panel)
styleSafe(self.myVitalsWrap, self.styles.panelGlass)
self.hpGauge = Geyser.Gauge:new({ name="ArjUI_HP", x="4%", y="4%", width="92%", height="19%" }, self.myVitalsWrap)
self.hpGauge.front:setStyleSheet(self.gaugeStyles.hpFront)
self.hpGauge.back:setStyleSheet(self.gaugeStyles.hpBack)
self.hpGauge.text:setStyleSheet(self.gaugeStyles.gaugeText)
self.mpGauge = Geyser.Gauge:new({ name="ArjUI_MP", x="4%", y="26%", width="92%", height="19%" }, self.myVitalsWrap)
self.mpGauge.front:setStyleSheet(self.gaugeStyles.mpFront)
self.mpGauge.back:setStyleSheet(self.gaugeStyles.mpBack)
self.mpGauge.text:setStyleSheet(self.gaugeStyles.gaugeText)
self.mvGauge = Geyser.Gauge:new({ name="ArjUI_MV", x="4%", y="48%", width="92%", height="19%" }, self.myVitalsWrap)
self.mvGauge.front:setStyleSheet(self.gaugeStyles.mvFront)
self.mvGauge.back:setStyleSheet(self.gaugeStyles.mvBack)
self.mvGauge.text:setStyleSheet(self.gaugeStyles.gaugeText)
self.posLabel = Geyser.Label:new({ name="ArjUI_PosLabel", x="4%", y="70%", width="92%", height="26%" }, self.myVitalsWrap)
styleSafe(self.posLabel, self.styles.pos)
labelSet(self.posLabel, "STANDING")
-- TANK (with gap from vitals) - Name as header, HP gauge, buffs below
-- Tank: 16.7% to 45.2% (first half under output window)
self.tankWrap = makePanel(self.bottomBar, "ArjUI_TankWrap", "16.7%", "3%", "28.3%", "94%", self.styles.panel)
styleSafe(self.tankWrap, self.styles.panelGlass)
-- Tank name as header (replaces "TANK" label)
self.tankNameLabel = Geyser.Label:new({ name="ArjUI_TankName", x="3%", y="2%", width="80%", height="14%" }, self.tankWrap)
styleSafe(self.tankNameLabel, self.styles.tankName)
labelSet(self.tankNameLabel, "---")
self.tankPosLabel = Geyser.Label:new({ name="ArjUI_TankPos", x="85%", y="2%", width="12%", height="14%" }, self.tankWrap)
styleSafe(self.tankPosLabel, self.styles.pos)
self.tankHpGauge = Geyser.Gauge:new({ name="ArjUI_TankHP", x="3%", y="18%", width="94%", height="18%" }, self.tankWrap)
self.tankHpGauge.front:setStyleSheet(self.gaugeStyles.hpFront)
self.tankHpGauge.back:setStyleSheet(self.gaugeStyles.hpBack)
self.tankHpGauge.text:setStyleSheet("color: #d0d0d0; font-size: 10px; font-weight: bold;")
-- Buffs section under tank
self.buffsHeader = Geyser.Label:new({ name="ArjUI_BuffsHeader", x="3%", y="38%", width="94%", height="12%" }, self.tankWrap)
styleSafe(self.buffsHeader, self.styles.headerAffects)
labelSet(self.buffsHeader, "✦ BUFFS")
self.buffsBox = makeConsole(self.tankWrap, "ArjUI_BuffsBox", "3%", "51%", "94%", "46%", 8, 40)
self.separator = Geyser.Label:new({ name = "ArjUI_Separator", x = "45.2%", y = "5%", width = "0.3%", height = "90%" }, self.bottomBar)
styleSafe(self.separator, self.styles.separator)
-- TARGET (with gap from tank) - Name as header, HP gauge, debuffs below
-- Target: 45.5% to 73.7% (aligned with output window right edge)
self.targetWrap = makePanel(self.bottomBar, "ArjUI_TargetWrap", "45.5%", "3%", "28.2%", "94%", self.styles.panel)
styleSafe(self.targetWrap, self.styles.panelGlass)
-- Target position label on left (mirrors tank layout)
self.targetPosLabel = Geyser.Label:new({ name="ArjUI_TargetPos", x="3%", y="2%", width="12%", height="14%" }, self.targetWrap)
styleSafe(self.targetPosLabel, self.styles.pos)
-- Target name as header (to the right of position)
self.targetNameLabel = Geyser.Label:new({ name="ArjUI_TargetName", x="17%", y="2%", width="80%", height="14%" }, self.targetWrap)
styleSafe(self.targetNameLabel, self.styles.targetName)
labelSet(self.targetNameLabel, "No Target")
self.targetHpGauge = Geyser.Gauge:new({ name="ArjUI_TargetHP", x="3%", y="18%", width="94%", height="18%" }, self.targetWrap)
self.targetHpGauge.front:setStyleSheet(self.gaugeStyles.targetFront)
self.targetHpGauge.back:setStyleSheet(self.gaugeStyles.targetBack)
self.targetHpGauge.text:setStyleSheet("color: #d0d0d0; font-size: 10px; font-weight: bold;")
-- Debuffs section under target
self.debuffsHeader = Geyser.Label:new({ name="ArjUI_DebuffsHeader", x="3%", y="38%", width="62%", height="12%" }, self.targetWrap)
styleSafe(self.debuffsHeader, self.styles.headerCombat)
labelSet(self.debuffsHeader, "☠ DEBUFFS")
-- Damage counter for the current fight (see setupDamageTracker)
self.damageLabel = Geyser.Label:new({ name="ArjUI_DamageLabel", x="66%", y="38%", width="31%", height="12%" }, self.targetWrap)
styleSafe(self.damageLabel, self.styles.headerTarget)
labelSet(self.damageLabel, "⚔ DMG")
self.damageLabel:setClickCallback(function() self:reportDamage(false) end)
self.damageLabel:setOnEnter(function() self.damageLabel:setCursor("PointingHand") end)
self.damageLabel:setOnLeave(function() self.damageLabel:setCursor("Arrow") end)
self.debuffsBox = makeConsole(self.targetWrap, "ArjUI_DebuffsBox", "3%", "51%", "94%", "46%", 8, 40)
-- STATE
self.state = {
hp = 1, hpmax = 1, mana = 1, manamax = 1, move = 1, movemax = 1,
tnl = 0, tnlBaseline = nil, position = "standing",
area = "Unknown", room = "Unknown", roomId = nil, zoneId = nil,
exits = {}, exitsRaw = {}, npcs = {}, items = {}, players = {},
target = nil, targetHpPct = 100, targetCond = nil, targetPos = nil,
tank = nil, tankHp = nil, tankMaxHp = nil, tankCond = nil, tankPos = nil, iAmTank = false,
group = {}, groupSize = 0, groupMax = 0, affects = {},
doors = {},
coins = { platinum = 0, gold = 0, silver = 0, copper = 0 },
usesMana = true, fighting = nil,
charLevel = nil, charClass = nil, charRace = nil, charGuild = nil, charTitle = nil,
quest = nil,
timeOfDay = "day", -- day, night, dawn, dusk
}
-- Initialize login flag (reset on each init so reconnects work)
self.initialDataRequested = false
local h
h = registerAnonymousEventHandler("sysWindowResizeEvent", function() self:layout() end)
table.insert(self.eventHandlers, h)
h = registerAnonymousEventHandler("sysConnectionEvent", function()
self:applyBackground()
tempTimer(0.2, function() if self and self.applyBackground then self:applyBackground() end end)
end)
table.insert(self.eventHandlers, h)
h = registerAnonymousEventHandler("sysAppStyleSheetChange", function()
self:applyBackground()
tempTimer(0.2, function() if self and self.applyBackground then self:applyBackground() end end)
end)
table.insert(self.eventHandlers, h)
self:layout()
self:loadCustomCommands()
self:loadSettings()
self:registerGMCPHandlers()
self:setupPorted()
self:renderAll()
-- If GMCP data already exists (reconnecting to existing session), render again after short delay
tempTimer(1, function()
if ArjUI and gmcp and gmcp.Char and gmcp.Char.Vitals then
ArjUI:renderAll()
end
end)
-- Output launch message to the UI console
if self.console then
self.console:cecho("\n<gold>══ Arjinius Client v" .. ArjUI.VERSION .. " ══<reset>\n")
self.console:cecho("<dim_gray> A Mudlet client for New Duris<reset>\n")
self.console:cecho("<dim_gray> Created by Arjin / Arjinius<reset>\n")
self.console:cecho("<gold>═══════════════════════════════<reset>\n\n")
end
end
function ArjUI:layout()
if not self.uiRoot then return end
local w, h = getMainWindowSize()
setBorderTop(h)
-- Calculate pixel values from percentages for resize
local banner = h * (self.bannerPct or 5.5) / 100
local insetX = w * (self.frameInsetXPct or 3.8) / 100
local insetBottom = h * (self.frameInsetBottomPct or 3.5) / 100
if self.main and w and h then
self.main:move(0, 0)
self.main:resize(w, h)
end
if self.bg and w and h then
self.bg:move(0, 0)
self.bg:resize(w, h)
end
local rootW = math.max(0, w - (insetX * 2))
local rootH = math.max(0, h - banner - insetBottom)
self.uiRoot:move(insetX, banner)
self.uiRoot:resize(rootW, rootH)
-- Reposition credit box and tooltip on resize (aligned under chat/right column)
if self.creditBox then
local creditX = insetX + rootW * 0.739 -- 73.9% of rootW from left edge
local creditW = rootW * 0.26 -- 26% width (same as rightCol)
local creditY = h - insetBottom + 3
self.creditBox:move(creditX, creditY)
self.creditBox:resize(creditW, 20)
if self.creditTooltip then
self.creditTooltip:move(creditX, creditY - 38)
self.creditTooltip:resize(creditW, 36)
end
end
end
-- ============================================================
-- CONTEXT MENUS
-- ============================================================
function ArjUI:showContextMenu(items, x, y)
-- Hide any existing menu
if self.currentMenu then self.currentMenu:hide() end
-- If caller didn't pass coordinates, use the actual mouse position
if not x or not y then
x, y = getMousePosition()
end
-- Clamp so it never spawns off-screen
local winW, winH = getMainWindowSize()
local menuW = 110
local menuH = (#items * 22 + 26) -- Extra space for close button
x = math.max(0, math.min(x, winW - menuW - 2))
y = math.max(0, math.min(y, winH - menuH - 2))
local menu = Geyser.Label:new({
name = "ArjUI_Menu_" .. tostring(os.time()) .. "_" .. tostring(math.random(1000,9999)),
x = x, y = y, width = menuW, height = menuH,
}, self.main)
menu:setStyleSheet("background-color: #0f0e0c; border: 1px solid #5a4b37; border-radius: 3px;")
menu:raise()
-- Close button at top
local closeBtn = Geyser.Label:new({
name = menu.name .. "_close",
x = menuW - 20, y = 2, width = 18, height = 18,
}, menu)
closeBtn:setStyleSheet("background-color: #1a1610; color: #c05050; font-size: 10px; font-weight: bold; border: 1px solid #5a4b37; border-radius: 2px;")
closeBtn:echo("<center>X</center>")
closeBtn:setClickCallback(function()
menu:hide()
self.currentMenu = nil
end)
closeBtn:setOnEnter(function()
closeBtn:setStyleSheet("background-color: #c05050; color: #ffffff; font-size: 10px; font-weight: bold; border: 1px solid #5a4b37; border-radius: 2px;")
end)
closeBtn:setOnLeave(function()
closeBtn:setStyleSheet("background-color: #1a1610; color: #c05050; font-size: 10px; font-weight: bold; border: 1px solid #5a4b37; border-radius: 2px;")
end)
for i, item in ipairs(items) do
local btn = Geyser.Label:new({
name = menu.name .. "_" .. i, x = 2, y = (i-1) * 22 + 22, width = 106, height = 20,
}, menu)
btn:setStyleSheet("background-color: transparent; color: #c0b8a0; font-size: 10px; padding-left: 5px;")
btn:echo(item.text)
btn:setClickCallback(function()
menu:hide()
self.currentMenu = nil
-- Check for special commands
if item.cmd and item.cmd:match("^arjui_add_") then
local category = item.cmd:gsub("^arjui_add_", "")
self:showAddCommandPopup(category)
elseif item.cmd and item.cmd:match("^arjui_spell_") then
local category = item.cmd:gsub("^arjui_spell_", "")
self:showAddSpellPopup(category)
elseif item.cmd and item.cmd:match("^arjui_remove_") then
local category = item.cmd:gsub("^arjui_remove_", "")
self:showRemoveCommandMenu(category)
elseif item.cmd and item.cmd:match("^arjui_del_") then
-- Handle actual deletion: arjui_del_category_index
local parts = item.cmd:match("^arjui_del_(.+)_(%d+)$")
if parts then
local cat, idx = item.cmd:match("^arjui_del_(.+)_(%d+)$")
idx = tonumber(idx)
if self.customCommands[cat] and idx and self.customCommands[cat][idx] then
local removed = table.remove(self.customCommands[cat], idx)
self:saveCustomCommands()
cecho(string.format("<green>[ArjUI]<reset> Removed '%s'.\n", removed.text))
end
end
elseif item.cmd and item.cmd ~= "" then
send(item.cmd)
end
end)
btn:setOnEnter(function()
btn:setStyleSheet("background-color: #1a1610; color: #e0d8c0; font-size: 10px; padding-left: 5px;")
end)
btn:setOnLeave(function()
btn:setStyleSheet("background-color: transparent; color: #c0b8a0; font-size: 10px; padding-left: 5px;")
end)
end
-- Auto-hide after 10 seconds so it can't get stuck
tempTimer(10, function()
if menu then pcall(function() menu:hide() end) end
end)
self.currentMenu = menu
end
-- ============================================================
-- CUSTOM COMMANDS - LOAD/SAVE
-- ============================================================
function ArjUI:loadCustomCommands()
local path = getMudletHomeDir() .. "/arjui_custom_commands.json"
local file = io.open(path, "r")