From 23e062673e08e990a3203ff72f3efb7fc73c0ec1 Mon Sep 17 00:00:00 2001 From: Majesty <32709570+majestyotbr@users.noreply.github.com> Date: Fri, 27 Oct 2023 18:14:19 -0300 Subject: [PATCH] feat: character list window (#602) Updated character list window for old and new versions. --------- Co-authored-by: Marcos <66353315+marcosvf132@users.noreply.github.com> --- .../game/entergame/dailyreward_collected.png | Bin 0 -> 367 bytes .../entergame/dailyreward_notcollected.png | Bin 0 -> 361 bytes data/images/game/entergame/hidden.png | Bin 0 -> 308 bytes data/images/game/entergame/maincharacter.png | Bin 0 -> 1827 bytes data/images/game/entergame/nopremium.png | Bin 0 -> 859 bytes data/images/game/entergame/premium.png | Bin 0 -> 693 bytes modules/client_entergame/characterlist.lua | 55 +++- modules/client_entergame/characterlist.otui | 256 +++++++++++++++++- modules/client_entergame/entergame.lua | 11 + modules/game_features/features.lua | 1 + modules/gamelib/const.lua | 1 + src/client/const.h | 3 +- 12 files changed, 315 insertions(+), 12 deletions(-) create mode 100644 data/images/game/entergame/dailyreward_collected.png create mode 100644 data/images/game/entergame/dailyreward_notcollected.png create mode 100644 data/images/game/entergame/hidden.png create mode 100644 data/images/game/entergame/maincharacter.png create mode 100644 data/images/game/entergame/nopremium.png create mode 100644 data/images/game/entergame/premium.png diff --git a/data/images/game/entergame/dailyreward_collected.png b/data/images/game/entergame/dailyreward_collected.png new file mode 100644 index 0000000000000000000000000000000000000000..11f253ac8cb5d840b97f409e306e8407c6ee07c3 GIT binary patch literal 367 zcmV-#0g(QQP)^Z zIjt~Zkwgjiwr?2>AdKP+WD`JKkW*obs<>uA#E=t`=O0j43YqgYc1h|nGO>}Rg4ydAPp!U|Ns9#0{~6<*JvHnVP*gT N002ovPDHLkV1m2Zlpp{A literal 0 HcmV?d00001 diff --git a/data/images/game/entergame/dailyreward_notcollected.png b/data/images/game/entergame/dailyreward_notcollected.png new file mode 100644 index 0000000000000000000000000000000000000000..a9cf138476d1d13c98df5d7887069b4b8c2bcfb2 GIT binary patch literal 361 zcmV-v0ha!WP)IHcE?tF_>MN33CQ!bnlW8 zLNVFx$vb#xz!MU(LXZLw1_6*5%%d3L4ATp965MV7|1$yr9$w9HFaF|)00000NkvXX Hu0mjfDe93V literal 0 HcmV?d00001 diff --git a/data/images/game/entergame/hidden.png b/data/images/game/entergame/hidden.png new file mode 100644 index 0000000000000000000000000000000000000000..775679cb71d2908f33ec00399c5567fc68b70b07 GIT binary patch literal 308 zcmV-40n7f0P)`tZuigForg_C-46M&j@5-oUxvP0c0`^?~)M$$^S>j|D{DBG)MzT z(euaG8KmU2z*aqbbPa6c&FiNb9Npu=?Ee{oj1UII&HsP>{0hd04{rZ&tS9@wr=#-! zvq#td@87u)Y%<7JkPeU_gNV31ShJ<62Hd@yx9kMl00JOem_VMDlG9>%^YS4WM@Gef zC1Es7;r^Wq85xm04tCG}oeNPELB+u8z#asJ<9}%p2F9mvP=c+eqmt3s5aO)g$%PCo zAcbJZKLIObL^mCz2nHBo*8i6lfmnrRIx#Uk3aAJe7#ILBk$l1H7luU-@c;c~mx?7@2(o(mV2;Q#9HfBeiRqSl>65H7vMpJ#+`zgrW8r6a$; z!*)71Etdu*?9l-!&4LKff^dC(7GZafFmXUeepr+K{`HLc&d>V?}BOcIwR+AvpltK^{Zo?## z2?SGSI8sna<&<(@r}K1Z5ESTy^~g!SXF5*$hY?YFB%%AUO8|Z)50x7iND*3)=A$NdHVjy{F43UgT8Ox@t>T(6^nyL|OA~cxi z1@=wq?sElmdk^d#y`rPCajj~Y4nmIEsOx&Q>=;hDYBUVZ&TVhSKI}6*`F}n<*Ba6| zz|a(afJa1$!jU8v#j$KUp)m*t>grFH?ihz70>`T&ai$7C zh*D}wT7nbSCsoaRr4BvIHAylh8hBJ_a)USWB8`~FocMY4)QR%+X!AUuI6!k_IFxKKz4G-J3fKKSyN_u;C!)o#}NYp=NfJ$khM?7g@C{bY6NN4$1t<^Dep-@J6J z*6-f^^W)clSlfMXZ~5ij)#K;!ilct^TY2}zpMr%T^t8 zF%@%>UiId+EIoJ=JS=$N$sv2NOXlez&bygq zyZVKf;raD_zwh%t?X&g2Lp^4VqEwzOI;F-=qE=jY|F{Ad~f zr*PD^EDM0i$!|Ux|Eyx$wq;adp->Rpwq<8$N2=ATY;0_ZX_`_f6m)#F?vsj(#iCTJ zRf@%;0JyG8rBVSPm&;+>Hu-!WfJ&u;>$+O`Xx%7`)zwuAf&kZbnVy~oz_x7;4-YAq z%lN*JWm$NhhvPV$o}OacHbD?jE|)nvIwA-H78e&|+1kaO-%vN@Avh0Vq!w)_TRmW6CWQp)cE)~p6Ai;_u1Us z)WL`}LPYL)UMvq_ER~AcN<>&*UY5(tOSZSSX*QcW7)?S1&-3VZyV@?5O6>0L^4+6H z7)p^yCJDok`kOaOt*orb#l;1V_h#tbE@mm&>vD;^){#KfU+`fZD5(Uw93nqW6rZ#09u_cTMS1b@&U|sI^>@|8xq6tkwkMG zDffL}lSlaDw_kaU;yMiZ@yl@l4&DYlGz_*7zJ0#H;lY7YBBDu0TVYuiwOUQL0??b) zUcJ=hfF^x7_k>2{SOFwUrIG|eK%>#%zDNU)vl*`61~I>3eE6#>5y5dBQA&|Yr5Fqb z7>0oegy8@YL8)PZQi{KSKjS=`)yD_84nwVa^2t-`^}5nMz6(oBOY%?iPtLPhTAkr# zMwj=R4@!sR^Ca(k{P4D)bDfU%eLedcap literal 0 HcmV?d00001 diff --git a/data/images/game/entergame/premium.png b/data/images/game/entergame/premium.png new file mode 100644 index 0000000000000000000000000000000000000000..2beff0997bd0e210168c3571e7e77bd2b2b0a609 GIT binary patch literal 693 zcmV;m0!safP)Dliy2IVHn3hX9@@0(%HoFoN)s2riCHfvZ%X23nA|e z5gddO;U6GfB@rP?1bHD?RMx|Rd6Ixn)A_9hY-*6W@botZ~Q6ASBJvH-HH4ttU zcDc60-k>H1!mT24_qfPDJ1?GJ*G0hair%0m^Y(drzsvFZWB9XSR&j%fKf>Fme*oz6 zsN~~OF0KEgf7)Wa&t2Vdd7!B(%d=ZxtGK~Ru}H?WWPWE{OA_3^RNz~_Q~|j$+YP|Q z$RPk$OD_35o!+bs_O~<;OXOHBxw!W@EE6`=mJN?3auw&QNfAPD;#jlzG!^9C`yVo4 zPlByjB1dYaDB~+bCpkB^z+y71ID!L)SB&?$33W8e@dD&nWlRg7zfJCAiCo3S{nHkU z$*kfHcq)Dz>G*0_J-VjKk8D7>%W~1!oczeyFNXp69m}#jDz?VW-_n4t zDH7`Qw-MSd-@feHhqVgugYEY=H2E@vs=HVo6|8;FD@t!r6C>S9MJwuz9@bw)WcdK0 zM?ZJD0vw^T$Bwl+DCI8EKBG`fZKCQfj)s~Yp|Z#OkvHHGHXLw-9td0x2OOaX2HSAJ b5eo1h%tyM2gRasD00000NkvXXu0mjfwSYYG literal 0 HcmV?d00001 diff --git a/modules/client_entergame/characterlist.lua b/modules/client_entergame/characterlist.lua index 20d7e0e708..18ff46c359 100644 --- a/modules/client_entergame/characterlist.lua +++ b/modules/client_entergame/characterlist.lua @@ -9,6 +9,7 @@ local waitingWindow local updateWaitEvent local resendWaitEvent local loginEvent +local outfitCreatureBox -- private functions local function tryLogin(charInfo, tries) @@ -94,7 +95,18 @@ local function resendWait() worldHost = selected.worldHost, worldPort = selected.worldPort, worldName = selected.worldName, - characterName = selected.characterName + characterName = selected.characterName, + characterLevel = selected.characterLevel, + main = selected.main, + dailyreward = selected.dailyreward, + hidden = selected.hidden, + outfitid = selected.outfitid, + headcolor = selected.headcolor, + torsocolor = selected.torsocolor, + legscolor = selected.legscolor, + detailcolor = selected.detailcolor, + addonsflags = selected.addonsflags, + characterVocation = selected.characterVocation } tryLogin(charInfo) end @@ -255,6 +267,10 @@ function CharacterList.create(characters, account, otui) characterList:destroyChildren() local accountStatusLabel = charactersWindow:getChildById('accountStatusLabel') + local accountStatusIcon = nil + if g_game.getFeature(GameEnterGameShowAppearance) then + accountStatusIcon = charactersWindow:getChildById('accountStatusIcon') + end local focusLabel for i, characterInfo in ipairs(characters) do @@ -276,6 +292,37 @@ function CharacterList.create(characters, account, otui) end end + if g_game.getFeature(GameEnterGameShowAppearance) then + local creatureDisplay = widget:getChildById('outfitCreatureBox', characterList) + creatureDisplay:setSize("64 64") + local creature = Creature.create() + local outfit = {type = characterInfo.outfitid, head = characterInfo.headcolor, body = characterInfo.torsocolor, legs = characterInfo.legscolor, feet = characterInfo.detailcolor, addons = characterInfo.addonsflags} + creature:setOutfit(outfit) + creature:setDirection(2) + creatureDisplay:setCreature(creature) + + local mainCharacter = widget:getChildById('mainCharacter', characterList) + if characterInfo.main then + mainCharacter:setImageSource('/images/game/entergame/maincharacter') + else + mainCharacter:setImageSource('') + end + + local statusDailyReward = widget:getChildById('statusDailyReward', characterList) + if characterInfo.dailyreward == 0 then + statusDailyReward:setImageSource('/images/game/entergame/dailyreward_collected') + else + statusDailyReward:setImageSource('/images/game/entergame/dailyreward_notcollected') + end + + local statusHidden = widget:getChildById('statusHidden', characterList) + if characterInfo.hidden then + statusHidden:setImageSource('/images/game/entergame/hidden') + else + statusHidden:setImageSource('') + end + end + -- these are used by login widget.characterName = characterInfo.name widget.worldName = characterInfo.worldName @@ -313,12 +360,18 @@ function CharacterList.create(characters, account, otui) if account.subStatus == SubscriptionStatus.Free then accountStatusLabel:setText(('%s%s'):format(tr('Free Account'), status)) + if accountStatusIcon ~= nil then + accountStatusIcon:setImageSource('/images/game/entergame/nopremium') + end elseif account.subStatus == SubscriptionStatus.Premium then if account.premDays == 0 or account.premDays == 65535 then accountStatusLabel:setText(('%s%s'):format(tr('Gratis Premium Account'), status)) else accountStatusLabel:setText(('%s%s'):format(tr('Premium Account (%s) days left', account.premDays), status)) end + if accountStatusIcon ~= nil then + accountStatusIcon:setImageSource('/images/game/entergame/premium') + end end if account.premDays > 0 and account.premDays <= 7 then diff --git a/modules/client_entergame/characterlist.otui b/modules/client_entergame/characterlist.otui index ddb0784016..efbab374c7 100644 --- a/modules/client_entergame/characterlist.otui +++ b/modules/client_entergame/characterlist.otui @@ -9,11 +9,29 @@ CharacterWidget < UIWidget end end @onFocusChange: self:updateOnStates() - @onSetup: self:updateOnStates() + @onSetup: | + self:updateOnStates() + if g_game.getFeature(GameEnterGameShowAppearance) then + self:setHeight(64) + end $focus: background-color: #ffffff22 + Creature + id: outfitCreatureBox + size: 64 64 + anchors.top: parent.top + anchors.left: parent.left + padding-left: 10 + padding-bottom: 5 + creatureDisplay:setCreature(creature) + fixed-creature-size: true + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + Label id: name color: #bbbbbb @@ -23,6 +41,88 @@ CharacterWidget < UIWidget text-auto-resize: true background-color: alpha text-offset: 2 0 + @onSetup: | + if g_game.getFeature(GameEnterGameShowAppearance) then + self:setMarginLeft(65) + end + + $on: + color: #ffffff + + Label + id: mainCharacter + size: 9 8 + anchors.top: parent.top + anchors.left: prev.right + margin-left: 6 + margin-top: 2 + image-source: /images/game/entergame/maincharacter + image-clip: 0 0 9 8 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + Label + id: statusDailyReward + size: 11 19 + anchors.top: parent.top + anchors.left: parent.left + margin-left: 252 + margin-top: 2 + image-source: /images/game/entergame/dailyreward_collected + image-clip: 0 0 11 19 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + Label + id: statusHidden + size: 11 19 + anchors.top: parent.top + anchors.left: parent.left + margin-left: 267 + margin-top: 2 + image-source: /images/game/entergame/hidden + image-clip: 0 0 11 19 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + Label + id: level + color: #bbbbbb + anchors.top: parent.top + anchors.left: parent.left + margin-left: 300 + font: verdana-11px-monochrome + text-auto-resize: true + background-color: alpha + text-offset: 2 0 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + $on: + color: #ffffff + + Label + id: vocation + color: #bbbbbb + anchors.top: parent.top + anchors.left: parent.left + margin-left: 350 + font: verdana-11px-monochrome + text-auto-resize: true + background-color: alpha + text-offset: 2 0 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end $on: color: #ffffff @@ -31,12 +131,19 @@ CharacterWidget < UIWidget id: worldName color: #bbbbbb anchors.top: parent.top - anchors.right: parent.right - margin-right: 5 font: verdana-11px-monochrome text-auto-resize: true background-color: alpha &baseText: '(%s)' + @onSetup: | + if g_game.getFeature(GameEnterGameShowAppearance) then + self:addAnchor(AnchorLeft, 'parent', AnchorLeft) + self:setMarginLeft(502) + self.baseText = '%s' + else + self:addAnchor(AnchorRight, 'parent', AnchorRight) + self:setMarginRight(5) + end $on: color: #ffffff @@ -45,21 +152,24 @@ MainWindow id: charactersWindow !text: tr('Character List') visible: false - draggable: false @onEnter: CharacterList.doLogin() @onEscape: CharacterList.hide(true) @onSetup: | g_keyboard.bindKeyPress('Up', function() self:getChildById('characters'):focusPreviousChild(KeyboardFocusReason) end, self) g_keyboard.bindKeyPress('Down', function() self:getChildById('characters'):focusNextChild(KeyboardFocusReason) end, self) if g_game.getFeature(GamePreviewState) then - self:setSize({width = 350, height = 400}) + if g_game.getFeature(GameEnterGameShowAppearance) then + self:setSize({width = 745, height = 430}) + else + self:setSize({width = 350, height = 400}) + end else self:setSize({width = 250, height = 248}) end TextList id: characters - background-color: #565656 + background-color: #404040 anchors.top: parent.top anchors.left: parent.left anchors.right: characterListScrollBar.left @@ -69,6 +179,67 @@ MainWindow focusable: false vertical-scrollbar: characterListScrollBar auto-focus: first + @onSetup: | + if g_game.getFeature(GameEnterGameShowAppearance) then + self:setBackgroundColor("#404040") + self:setPaddingTop(20) + else + self:setBackgroundColor("#565656") + end + + + FlatLabel + width: 250 + anchors.left: parent.left + anchors.top: characters.top + !text: tr('Character') .. '' + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + FlatLabel + width: 50 + anchors.left: parent.left + anchors.top: characters.top + margin-left: 250 + !text: tr('Status') .. '' + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + FlatLabel + width: 50 + anchors.left: parent.left + anchors.top: characters.top + margin-left: 300 + !text: tr('Level') .. '' + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + FlatLabel + width: 150 + anchors.left: parent.left + anchors.top: characters.top + margin-left: 350 + !text: tr('Vocation') .. '' + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + FlatLabel + width: 201 + anchors.right: characters.right + anchors.top: characters.top + !text: tr('World') .. '' + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end VerticalScrollBar id: characterListScrollBar @@ -79,22 +250,87 @@ MainWindow step: 14 pixels-scroll: true + VerticalSeparator + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: prev.bottom + margin-left: 249 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + VerticalSeparator + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: prev.bottom + margin-left: 299 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + VerticalSeparator + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: prev.bottom + margin-left: 349 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + + VerticalSeparator + anchors.left: parent.left + anchors.top: parent.top + anchors.bottom: prev.bottom + margin-left: 499 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end + Label id: accountStatusCaption !text: tr('Account Status') .. ':' anchors.left: parent.left anchors.right: parent.right anchors.bottom: next.top - margin-bottom: 1 + @onSetup: | + if g_game.getFeature(GameEnterGameShowAppearance) then + self:setMarginBottom(5) + else + self:setMarginBottom(1) + end + + Label + id: accountStatusIcon + size: 22 20 + anchors.left: parent.left + anchors.bottom: next.bottom + image-source: /images/game/entergame/premium + image-clip: 0 0 22 20 + @onSetup: | + if not(g_game.getFeature(GameEnterGameShowAppearance)) then + self:hide() + end Label id: accountStatusLabel !text: tr('Free Account') anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: separator.top - margin-bottom: 5 text-auto-resize: true + @onSetup: | + if g_game.getFeature(GameEnterGameShowAppearance) then + self:setMarginBottom(15) + self:setPaddingBottom(2) + self:setTextOffset({x = 25, y = 0}) + self:addAnchor(AnchorBottom, 'next', AnchorBottom) + else + self:setMarginBottom(5) + self:addAnchor(AnchorRight, 'parent', AnchorRight) + self:addAnchor(AnchorBottom, 'separator', AnchorTop) + end $on: color: #FF0000 diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index 68b5888123..51626e0c21 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -369,6 +369,17 @@ function EnterGame.tryHttpLogin(clientVersion) local world = worlds[character.worldid] characters[index] = { name = character.name, + level = character.level, + main = character.ismaincharacter, + dailyreward = character.dailyrewardstate, + hidden = character.ishidden, + vocation = character.vocation, + outfitid = character.outfitid, + headcolor = character.headcolor, + torsocolor = character.torsocolor, + legscolor = character.legscolor, + detailcolor = character.detailcolor, + addonsflags = character.addonsflags, worldName = world.name, worldIp = world.ip, worldPort = world.port, diff --git a/modules/game_features/features.lua b/modules/game_features/features.lua index 10477fdf3e..49fce13987 100644 --- a/modules/game_features/features.lua +++ b/modules/game_features/features.lua @@ -179,6 +179,7 @@ controller:registerEvents(g_game, { g_game.enableFeature(GameThingQuickLoot); g_game.enableFeature(GameTournamentPackets); g_game.enableFeature(GameVipGroups); + g_game.enableFeature(GameEnterGameShowAppearance); end if version >= 1260 then diff --git a/modules/gamelib/const.lua b/modules/gamelib/const.lua index 7b814f2e19..72ed136bbc 100644 --- a/modules/gamelib/const.lua +++ b/modules/gamelib/const.lua @@ -190,6 +190,7 @@ GameItemAugment = 110 GameDynamicBugReporter = 111 GameWrapKit = 112 GameContainerFilter = 113 +GameEnterGameShowAppearance = 114 TextColors = { red = '#f55e5e', -- '#c83200' diff --git a/src/client/const.h b/src/client/const.h index ce41951a53..98b9787588 100644 --- a/src/client/const.h +++ b/src/client/const.h @@ -541,7 +541,8 @@ namespace Otc GameDynamicBugReporter = 111, GameWrapKit = 112, GameContainerFilter = 113, - LastGameFeature = 114 + GameEnterGameShowAppearance = 114, + LastGameFeature = 115 }; enum MagicEffectsType_t : uint8_t