Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Scripts-UI-HelpBox
- -- =============================================================================
- -- VALKYRIOR V4.0 | IRE MUD SYSTEM FOR MUDLET 3.0 | General
- -- ----------------+----------------------------------------+-------------------
- -- This system is distributed under specific licensing terms specified in
- -- <readme.md> You should have received a copy of this file with the system
- -- and if you did not, you can receive a copy from <havamal@viantha.com>
- --
- -- VALKYRIOR MUD SYSTEM is (c) 2006-2018 Maiyannah Bishop
- --
- -- HelpBox
- -- Console overlay by Mord to display help files in a more helpful fashion
- --
- -- @package Scripts_Luminari
- -- @category UI
- -- @subcategory Character Sheet
- -- @author Mord
- -- @copyright 2006-2018 Maiyannah Bishop
- -- @link ire-system.viantha.com
- -- =============================================================================
- -- INITIAL DRAW
- -- -----------------------------------------------------------------------------
- -- function UI.InitializeHelpBox()
- -- Initializes the help box for display when we need it
- function UI.InitializeCharacterSheet()
- -- Draw the background
- origin_x = tonumber(Config.UI.CharacterSheetOrigin_X) or 0
- origin_y = tonumber(Config.UI.CharacterSheetOrigin_Y) or 0
- width = tonumber(Config.UI.CharacterSheetWidth) or 1920
- height = tonumber(Config.UI.CharacterSheetHeight) or 940
- createLabel("character_sheet", origin_x, origin_y, width, height, 0)
- setLabelStyleSheet("character_sheet", [[
- background-image: url("]]..tostring(Config.UI.CharacterSheetPath)..[[");
- background-repeat: no-repeat;
- background-position: top left;
- background-origin: margin;]])
- hideWindow("character_sheet")
- setBackgroundColor("character_sheet", 0,0,0,0)
- origin_x, origin_y = nil
- width, height = nil
- -- Set a state variable so we can track whether we've initialized or not
- Valkyrior.CharacterSheetInitialized = true
- UI.CharacterSheet.Avatar()
- UI.CharacterSheet.Stats.DrawStrength()
- end
- Valkyrior = Valkyrior or {};
- Valkyrior.DisplayingCharacterSheet = false
- -- Helper function
- function Valkyrior.amDisplayingCharacterSheet()
- return Valkyrior.DisplayingCharacterSheet
- end
- -- ============================================================================
- -- HELP BUTTON TOGGLE
- function UI.DrawCSButton()
- -- Draw the button
- origin_x = tonumber(Config.UI.CSButtonOrigin_X) or 1555
- origin_y = tonumber(Config.UI.CSButtonOrigin_Y) or 490
- width = tonumber(Config.UI.CSButtonWidth) or 1920
- height = tonumber(Config.UI.CSButtonHeight) or 940
- charactersheet_button = Geyser.Label:new({
- name="charactersheet_button",
- x = origin_x, y = origin_y,
- width=38, height=38,})
- raiseWindow("charactersheet_button")
- charactersheet_button:setClickCallback("UI.CharacterSheetToggle")
- setLabelStyleSheet("charactersheet_button", [[
- background-image: url("]]..tostring(Config.UI.CSButtonInactivePath)..[[");
- background-repeat: no-repeat;
- background-position: top left;
- background-origin: margin;]])
- Valkyrior = Valkyrior or {};
- Valkyrior.CSToggled = false
- Valkyrior.CharacterSheetInitialized = Valkyrior.CharacterSheetInitialized or false
- return true
- end
- function UI.CharacterSheetToggle()
- if (Valkyrior.CSToggled == true) then
- Config.UI.CSButtonOrigin_X = 1555
- Config.UI.CSButtonOrigin_Y = 490
- raiseWindow("charactersheet_button")
- hideWindow("character_sheet")
- hideWindow("stats_strength")
- hideWindow("cs_avatar")
- UI.DrawCSButton()
- Valkyrior.CSToggled = false
- setLabelStyleSheet("charactersheet_button", [[
- background-image: url("]]..tostring(Config.UI.CSButtonInactivePath)..[[");
- background-repeat: no-repeat;
- background-position: top left;
- background-origin: margin;]])
- if (not Valkyrior.CharacterSheetInitialized) then
- UI.InitializeCharacterSheet()
- end
- else
- Config.UI.CSButtonOrigin_X = 1880
- Config.UI.CSButtonOrigin_Y = 10
- showWindow("character_sheet")
- raiseWindow("character_sheet")
- --
- raiseWindow("charactersheet_button")
- showWindow("stats_strength")
- --
- raiseWindow("stats_strength")
- --
- showWindow("cs_avatar")
- raiseWindow("cs_avatar")
- --
- UI.DrawCSButton()
- Valkyrior.CSToggled = true
- setLabelStyleSheet("charactersheet_button", [[
- background-image: url("]]..tostring(Config.UI.CSButtonPath)..[[");
- background-repeat: no-repeat;
- background-position: top left;
- background-origin: margin;]])
- raiseWindow("charactersheet_button")
- end
- end
- -- ============================================================================
- -- CHARACTER SHEET LABELS
- -- ----------------------------------------------------------------------------
- -- Function: UI.CharacterSheet.Stats
- -- Function to draw all the character base stats on the CS
- UI.CharacterSheet = UI.CharacterSheet or {};
- function UI.CharacterSheet.Stats()
- -- ----------------------------------------------------------------------------
- -- Function: UI.CharacterSheet.Stats.DrawStrength()
- -- Function to draw strength on the CS
- function UI.CharacterSheet.Stats.DrawStrength()
- local origin_x = 201
- local origin_y = 774
- local height = 16
- local width = 227
- -- Draw the text label
- createLabel("stats_strength", origin_x, origin_y, width, height, 0)
- setBackgroundColor("stats_strength", 0, 0, 0, 0)
- setLabelStyleSheet("stats_strength", [[qproperty-alignment: 'AlignHCenter | AlignVCenter';]])
- raiseWindow("stats_strenth")
- end
- end
- -- ============================================================================
- -- CHARACTER SHEET AVATAR
- -- ----------------------------------------------------------------------------
- -- Function: UI.CharacterSheet.Avatar
- -- Function to draw avatar image on the CS
- function UI.CharacterSheet.Avatar()
- local origin_x = 10
- local origin_y = 10
- local width = 300
- local height = 391
- createLabel("cs_avatar", origin_x, origin_y, width, height, 0)
- setLabelStyleSheet("cs_avatar", [[
- border-image: url("]]..tostring(Config.UI.CSAvatarPath)..[[");
- padding-left: 10px;
- padding-top: 8px;
- qproperty-alignment: 'AlignTop | AlignLeft';
- ]])
- --raiseWindow("cs_avatar")
- end
- -- END OF FILE
- -- ============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement