diff --git a/data/images/game/entergame/dailyreward_collected.png b/data/images/game/entergame/dailyreward_collected.png new file mode 100644 index 0000000000..11f253ac8c Binary files /dev/null and b/data/images/game/entergame/dailyreward_collected.png differ diff --git a/data/images/game/entergame/dailyreward_notcollected.png b/data/images/game/entergame/dailyreward_notcollected.png new file mode 100644 index 0000000000..a9cf138476 Binary files /dev/null and b/data/images/game/entergame/dailyreward_notcollected.png differ diff --git a/data/images/game/entergame/hidden.png b/data/images/game/entergame/hidden.png new file mode 100644 index 0000000000..775679cb71 Binary files /dev/null and b/data/images/game/entergame/hidden.png differ diff --git a/data/images/game/entergame/maincharacter.png b/data/images/game/entergame/maincharacter.png new file mode 100644 index 0000000000..8391d57085 Binary files /dev/null and b/data/images/game/entergame/maincharacter.png differ diff --git a/data/images/game/entergame/nopremium.png b/data/images/game/entergame/nopremium.png new file mode 100644 index 0000000000..90ee206b93 Binary files /dev/null and b/data/images/game/entergame/nopremium.png differ diff --git a/data/images/game/entergame/premium.png b/data/images/game/entergame/premium.png new file mode 100644 index 0000000000..2beff0997b Binary files /dev/null and b/data/images/game/entergame/premium.png differ 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