Advertisement
Guest User

Untitled

a guest
Oct 17th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.52 KB | None | 0 0
  1. --Scripts-UI-HelpBox
  2. -- =============================================================================
  3. -- VALKYRIOR V4.0 | IRE MUD SYSTEM FOR MUDLET 3.0 | General
  4. -- ----------------+----------------------------------------+-------------------
  5. -- This system is distributed under specific licensing terms specified in
  6. -- <readme.md> You should have received a copy of this file with the system
  7. -- and if you did not, you can receive a copy from <havamal@viantha.com>
  8. --
  9. -- VALKYRIOR MUD SYSTEM is (c) 2006-2018 Maiyannah Bishop
  10. --
  11. -- HelpBox
  12. -- Console overlay by Mord to display help files in a more helpful fashion
  13. --
  14. -- @package Scripts_Luminari
  15. -- @category UI
  16. -- @subcategory Character Sheet
  17. -- @author Mord
  18. -- @copyright 2006-2018 Maiyannah Bishop
  19. -- @link ire-system.viantha.com
  20. -- =============================================================================
  21. -- INITIAL DRAW
  22. -- -----------------------------------------------------------------------------
  23. -- function UI.InitializeHelpBox()
  24. -- Initializes the help box for display when we need it
  25. function UI.InitializeCharacterSheet()
  26. -- Draw the background
  27. origin_x = tonumber(Config.UI.CharacterSheetOrigin_X) or 0
  28. origin_y = tonumber(Config.UI.CharacterSheetOrigin_Y) or 0
  29. width = tonumber(Config.UI.CharacterSheetWidth) or 1920
  30. height = tonumber(Config.UI.CharacterSheetHeight) or 940
  31.  
  32. createLabel("character_sheet", origin_x, origin_y, width, height, 0)
  33. setLabelStyleSheet("character_sheet", [[
  34. background-image: url("]]..tostring(Config.UI.CharacterSheetPath)..[[");
  35. background-repeat: no-repeat;
  36. background-position: top left;
  37. background-origin: margin;]])
  38. hideWindow("character_sheet")
  39. setBackgroundColor("character_sheet", 0,0,0,0)
  40.  
  41. origin_x, origin_y = nil
  42. width, height = nil
  43.  
  44. -- Set a state variable so we can track whether we've initialized or not
  45. Valkyrior.CharacterSheetInitialized = true
  46.  
  47. UI.CharacterSheet.Avatar()
  48. UI.CharacterSheet.Stats.DrawStrength()
  49. end
  50.  
  51. Valkyrior = Valkyrior or {};
  52. Valkyrior.DisplayingCharacterSheet = false
  53.  
  54. -- Helper function
  55. function Valkyrior.amDisplayingCharacterSheet()
  56. return Valkyrior.DisplayingCharacterSheet
  57. end
  58.  
  59. -- ============================================================================
  60. -- HELP BUTTON TOGGLE
  61. function UI.DrawCSButton()
  62. -- Draw the button
  63. origin_x = tonumber(Config.UI.CSButtonOrigin_X) or 1555
  64. origin_y = tonumber(Config.UI.CSButtonOrigin_Y) or 490
  65. width = tonumber(Config.UI.CSButtonWidth) or 1920
  66. height = tonumber(Config.UI.CSButtonHeight) or 940
  67. charactersheet_button = Geyser.Label:new({
  68. name="charactersheet_button",
  69. x = origin_x, y = origin_y,
  70. width=38, height=38,})
  71. raiseWindow("charactersheet_button")
  72. charactersheet_button:setClickCallback("UI.CharacterSheetToggle")
  73. setLabelStyleSheet("charactersheet_button", [[
  74. background-image: url("]]..tostring(Config.UI.CSButtonInactivePath)..[[");
  75. background-repeat: no-repeat;
  76. background-position: top left;
  77. background-origin: margin;]])
  78. Valkyrior = Valkyrior or {};
  79. Valkyrior.CSToggled = false
  80. Valkyrior.CharacterSheetInitialized = Valkyrior.CharacterSheetInitialized or false
  81. return true
  82. end
  83.  
  84. function UI.CharacterSheetToggle()
  85. if (Valkyrior.CSToggled == true) then
  86. Config.UI.CSButtonOrigin_X = 1555
  87. Config.UI.CSButtonOrigin_Y = 490
  88. raiseWindow("charactersheet_button")
  89. hideWindow("character_sheet")
  90. hideWindow("stats_strength")
  91. hideWindow("cs_avatar")
  92. UI.DrawCSButton()
  93. Valkyrior.CSToggled = false
  94. setLabelStyleSheet("charactersheet_button", [[
  95. background-image: url("]]..tostring(Config.UI.CSButtonInactivePath)..[[");
  96. background-repeat: no-repeat;
  97. background-position: top left;
  98. background-origin: margin;]])
  99. if (not Valkyrior.CharacterSheetInitialized) then
  100. UI.InitializeCharacterSheet()
  101. end
  102. else
  103. Config.UI.CSButtonOrigin_X = 1880
  104. Config.UI.CSButtonOrigin_Y = 10
  105. showWindow("character_sheet")
  106. raiseWindow("character_sheet")
  107. --
  108. raiseWindow("charactersheet_button")
  109. showWindow("stats_strength")
  110. --
  111. raiseWindow("stats_strength")
  112. --
  113. showWindow("cs_avatar")
  114. raiseWindow("cs_avatar")
  115. --
  116. UI.DrawCSButton()
  117. Valkyrior.CSToggled = true
  118. setLabelStyleSheet("charactersheet_button", [[
  119. background-image: url("]]..tostring(Config.UI.CSButtonPath)..[[");
  120. background-repeat: no-repeat;
  121. background-position: top left;
  122. background-origin: margin;]])
  123. raiseWindow("charactersheet_button")
  124.  
  125. end
  126. end
  127.  
  128. -- ============================================================================
  129. -- CHARACTER SHEET LABELS
  130. -- ----------------------------------------------------------------------------
  131. -- Function: UI.CharacterSheet.Stats
  132. -- Function to draw all the character base stats on the CS
  133. UI.CharacterSheet = UI.CharacterSheet or {};
  134.  
  135. function UI.CharacterSheet.Stats()
  136.  
  137. -- ----------------------------------------------------------------------------
  138. -- Function: UI.CharacterSheet.Stats.DrawStrength()
  139. -- Function to draw strength on the CS
  140. function UI.CharacterSheet.Stats.DrawStrength()
  141. local origin_x = 201
  142. local origin_y = 774
  143. local height = 16
  144. local width = 227
  145.  
  146. -- Draw the text label
  147. createLabel("stats_strength", origin_x, origin_y, width, height, 0)
  148. setBackgroundColor("stats_strength", 0, 0, 0, 0)
  149. setLabelStyleSheet("stats_strength", [[qproperty-alignment: 'AlignHCenter | AlignVCenter';]])
  150. raiseWindow("stats_strenth")
  151.  
  152. end
  153.  
  154. end
  155. -- ============================================================================
  156. -- CHARACTER SHEET AVATAR
  157. -- ----------------------------------------------------------------------------
  158. -- Function: UI.CharacterSheet.Avatar
  159. -- Function to draw avatar image on the CS
  160.  
  161. function UI.CharacterSheet.Avatar()
  162. local origin_x = 10
  163. local origin_y = 10
  164. local width = 300
  165. local height = 391
  166.  
  167. createLabel("cs_avatar", origin_x, origin_y, width, height, 0)
  168. setLabelStyleSheet("cs_avatar", [[
  169. border-image: url("]]..tostring(Config.UI.CSAvatarPath)..[[");
  170. padding-left: 10px;
  171. padding-top: 8px;
  172. qproperty-alignment: 'AlignTop | AlignLeft';
  173. ]])
  174. --raiseWindow("cs_avatar")
  175. end
  176. -- END OF FILE
  177. -- ============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement