Back to Home

ESO Lua File v100033

pregame/gamemenu_pregame/keyboard/gamemenu_charactercreate.lua

[◄ back to folders ]
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
local GAME_MENU_CHARACTERCREATE
local gameEntries = {}
-- Preview
local function SelectStartingGear()
    SelectClothing(DRESSING_OPTION_STARTING_GEAR)
    SCENE_MANAGER:AddFragment(CHARACTER_CREATE_FRAGMENT)
end
local function SelectCurrentGear()
    SelectClothing(DRESSING_OPTION_YOUR_GEAR)
    SCENE_MANAGER:AddFragment(CHARACTER_CREATE_FRAGMENT)
end
    SelectClothing(DRESSING_OPTION_YOUR_GEAR_AND_COLLECTIBLES)
    SCENE_MANAGER:AddFragment(CHARACTER_CREATE_FRAGMENT)
end
local function SelectChampionGear()
    SelectClothing(DRESSING_OPTION_WARDROBE_1)
    SCENE_MANAGER:AddFragment(CHARACTER_CREATE_FRAGMENT)
end
local function SelectNoGear()
    SelectClothing(DRESSING_OPTION_NUDE)
    SCENE_MANAGER:AddFragment(CHARACTER_CREATE_FRAGMENT)
end
local function HideCharacterCreate()
    SCENE_MANAGER:RemoveFragment(CHARACTER_CREATE_FRAGMENT)
end
local function AddPreviewEntries(entryTable)
    local characterMode = ZO_CHARACTERCREATE_MANAGER:GetCharacterMode()
    if characterMode == CHARACTER_MODE_CREATION then
        local startingGearOption = {name = GetString("SI_CHARACTERCREATEDRESSINGOPTION", DRESSING_OPTION_STARTING_GEAR), categoryName = GetString(SI_GAME_MENU_PREVIEW), callback = SelectStartingGear, unselectedCallback = HideCharacterCreate}
        table.insert(entryTable, startingGearOption)
    elseif characterMode == CHARACTER_MODE_EDIT then
        -- match the first appearance here to the default apperance set in PregameCharacterManager to avoid reloading the character
        local currentGearAndCollectiblesOption = {name = GetString("SI_CHARACTERCREATEDRESSINGOPTION", DRESSING_OPTION_YOUR_GEAR_AND_COLLECTIBLES), categoryName = GetString(SI_GAME_MENU_PREVIEW), callback = SelectCurrentGearAndCollectibles, unselectedCallback = HideCharacterCreate}
        table.insert(entryTable, currentGearAndCollectiblesOption)
        local currentGearOption = {name = GetString("SI_CHARACTERCREATEDRESSINGOPTION", DRESSING_OPTION_YOUR_GEAR), categoryName = GetString(SI_GAME_MENU_PREVIEW), callback = SelectCurrentGear, unselectedCallback = HideCharacterCreate}
        table.insert(entryTable, currentGearOption)
    end
    local championGearOption = {name = GetString("SI_CHARACTERCREATEDRESSINGOPTION", DRESSING_OPTION_WARDROBE_1), categoryName = GetString(SI_GAME_MENU_PREVIEW), callback = SelectChampionGear, unselectedCallback = HideCharacterCreate}
    table.insert(entryTable, championGearOption)
    local nudeOption = {name = GetString("SI_CHARACTERCREATEDRESSINGOPTION", DRESSING_OPTION_NUDE), categoryName = GetString(SI_GAME_MENU_PREVIEW), callback = SelectNoGear, unselectedCallback = HideCharacterCreate}
    table.insert(entryTable, nudeOption)
end
-- Settings
local function AddSettingsEntries(entryTable)
    local settingsHeaderData = {name = GetString(SI_GAME_MENU_SETTINGS)}
    table.insert(entryTable, settingsHeaderData)
end
-- Back
function GoBack()
    if GetNumCharacters() > 0 then
        KEYBOARD_CHARACTER_CREATE_MANAGER:ExitToState("CharacterSelect_FromIngame")
    else
        ZO_Disconnect()
    end
end
local function AddBackEntry(entryTable)
    local backString
    if GetNumCharacters() > 0 then
        backString = GetString(SI_GAME_MENU_BACK)
    else
        backString = GetString(SI_GAME_MENU_LOGOUT)
    end
    local data = {name = backString, callback = GoBack}
    table.insert(entryTable, data)
end
-- Setup
local function RebuildTree(gameMenu)
    gameEntries = {}
    AddPreviewEntries(gameEntries)
    AddSettingsEntries(gameEntries)
    AddBackEntry(gameEntries)
    gameMenu:SubmitLists(gameEntries)
end
local function OnShow(gameMenu)
    RebuildTree(gameMenu)
end
local function OnHide(gameMenu)
    gameMenu:SubmitLists()
end
    GAME_MENU_CHARACTERCREATE = ZO_GameMenu_Initialize(self, OnShow)
    local gameMenuCharacterCreateFragment = ZO_FadeSceneFragment:New(self)
    local gameMenuCharacterCreateScene = ZO_Scene:New("gameMenuCharacterCreate", SCENE_MANAGER)
    gameMenuCharacterCreateScene:AddFragment(gameMenuCharacterCreateFragment)
 
    gameMenuCharacterCreateScene:RegisterCallback("StateChange",    function(oldState, newState)
                                                                        ZO_UpdatePaperDollManipulationForScene(ZO_CharacterCreateCharacterViewport, newState)
                                                                    end)
end