Skip to content

Commit

Permalink
feat: character list window (#602)
Browse files Browse the repository at this point in the history
Updated character list window for old and new versions.
---------
Co-authored-by: Marcos <[email protected]>
  • Loading branch information
majestyotbr authored Oct 27, 2023
1 parent 01eeb84 commit 23e0626
Show file tree
Hide file tree
Showing 12 changed files with 315 additions and 12 deletions.
Binary file added data/images/game/entergame/dailyreward_collected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/game/entergame/hidden.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/game/entergame/maincharacter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/game/entergame/nopremium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/game/entergame/premium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 54 additions & 1 deletion modules/client_entergame/characterlist.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ local waitingWindow
local updateWaitEvent
local resendWaitEvent
local loginEvent
local outfitCreatureBox

-- private functions
local function tryLogin(charInfo, tries)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 23e0626

Please sign in to comment.