setup_valkyrior.xml 6.57 KB
Newer Older
Vadim Peretokin's avatar
Vadim Peretokin committed
1 2 3
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MudletPackage>
<MudletPackage version="1.001">
4 5 6 7 8 9 10 11 12 13 14 15 16 17
	<TriggerPackage />
	<TimerPackage />
	<AliasPackage />
	<ActionPackage />
	<ScriptPackage>
		<ScriptGroup isActive="yes" isFolder="yes">
			<name>ValkyriorBootstrap</name>
			<packageName>ValkyriorBootstrap</packageName>
			<script></script>
			<eventHandlerList />
			<Script isActive="yes" isFolder="no">
				<name>Valkryior bootstrap</name>
				<packageName></packageName>
				<script>-- valkyrior-bootstrap
18 19 20 21
-- -----------------------------------------------------------------------------
-- VALKYRIOR V4.0  |     IRE MUD SYSTEM FOR MUDLET 3.0      |          Bootstrap
-- ----------------+----------------------------------------+-------------------
-- This system is distributed under specific licensing terms specified in
Maiyannah Bishop's avatar
Maiyannah Bishop committed
22 23
-- &lt;readme.md&gt;   You should have received a copy of this file with the system
-- and if you did not, you can receive a copy from &lt;havamal@viantha.com&gt;
24 25 26 27
--
-- VALKYRIOR MUD SYSTEM is (c) 2006-2018 Maiyannah Bishop
--
-- setup_valkyrior.xml
28 29
--    Bootstrap the system within Mudlet
--
30
-- @package     Setup
Maiyannah Bishop's avatar
Maiyannah Bishop committed
31
-- @author      Maiyannah Bishop &lt;havamal@viantha.com&gt;
32 33 34 35 36 37
-- @copyright   2006-2018 Maiyannah Bishop
-- @link        ire-system.viantha.com
-- -----------------------------------------------------------------------------

-- -----------------------------------------------------------------------------
-- Function: valkyriorMessage(string)
38
-- Display a formatted string in the main console
39
function valkryiorMessage(string)
Maiyannah Bishop's avatar
Maiyannah Bishop committed
40
   cecho("&lt;BlueViolet&gt;(&lt;CornflowerBlue&gt;Valkryior&lt;BlueViolet&gt;): &lt;reset&gt;" ..tostring(string).. "&lt;reset&gt;")
Vadim Peretokin's avatar
Vadim Peretokin committed
41 42
end

43 44
-- ----------------------------------------------------------------------------
-- Function: valkyuriorOpenScript()
45
-- Invocation of the file dialog
Vadim Peretokin's avatar
Vadim Peretokin committed
46
function valkryiorOpenScript()
47
  local path = invokeFileDialog(true, "Please select the scripts_valkyrior.xml file and click Open")
Vadim Peretokin's avatar
Vadim Peretokin committed
48

49
  if path == "" then return nil else return path end
Vadim Peretokin's avatar
Vadim Peretokin committed
50 51
end

52 53 54
-- ----------------------------------------------------------------------------
-- Function: findValkyrior()
-- Display a dialog to have the player identify where the repository is cloned
Vadim Peretokin's avatar
Vadim Peretokin committed
55
function findValkryior()
56 57 58
   repeat
      -- looping from a previous run where we didn't select the script - try again
      if scriptsValkyriorLocation then
Maiyannah Bishop's avatar
Maiyannah Bishop committed
59
      valkryiorMessage("Sorry, &lt;green&gt;"..scriptsValkyriorLocation.."&lt;reset&gt; isn't it - please select the &lt;green&gt;scripts_valkyrior.xml&lt;reset&gt; file.")
60 61 62 63 64 65 66 67 68
      end

      scriptsValkyriorLocation = valkryiorOpenScript()
      if not scriptsValkyriorLocation then
         valkryiorMessage("Setup cancelled.\n")
         return
      end
   until string.ends(scriptsValkyriorLocation, "scripts_valkyrior.xml")
   return scriptsValkyriorLocation
Vadim Peretokin's avatar
Vadim Peretokin committed
69 70
end

71
-- ----------------------------------------------------------------------------
72
-- Function: setupValkyrior()
73
-- Install the core system packages
Vadim Peretokin's avatar
Vadim Peretokin committed
74
function setupValkryior()
Maiyannah Bishop's avatar
Maiyannah Bishop committed
75
  valkryiorMessage("Welcome to the system! To get started, please select the &lt;green&gt;scripts_valkyrior.xml&lt;reset&gt; file after pressing &lt;green&gt;Enter&lt;reset&gt;.\n")
Vadim Peretokin's avatar
Vadim Peretokin committed
76 77 78 79 80 81 82

  local location = findValkryior()
  -- cleanup globals
  scriptsValkyriorLocation = nil

  if not location then return end

83
  valkryiorMessage("Awesome, thanks! Setting up all Valkryior modules now...\n\n")
Vadim Peretokin's avatar
Vadim Peretokin committed
84

85
  local gitRepoLocation = location:gsub("scripts_valkyrior%.xml", '')
86
   ValkyriorLocation = gitRepoLocation
Vadim Peretokin's avatar
Vadim Peretokin committed
87 88

  for _, file in ipairs{
89
    "alias_combat.xml", "keybind_f5.xml",
90 91
      "scripts_character.xml", "scripts_combat.xml", "scripts_room.xml", "scripts_UI.xml", "scripts_valkyrior.xml",
			"config.xml",} do
Vadim Peretokin's avatar
Vadim Peretokin committed
92 93 94
    installModule(gitRepoLocation..file)
  end

Maiyannah Bishop's avatar
Maiyannah Bishop committed
95 96
  valkryiorMessage("And done. Open the Module Manager now and tick &lt;green&gt;sync&lt;reset&gt; besides all the modules.\n")
  tempTimer(10, function() valkryiorMessage("Core modules now installed.  To install for your mud, type  lua setup&lt;mud name&gt;()   for example,  lua setupImperian()\n\n") end)
97 98 99 100 101 102 103
end


-- ----------------------------------------------------------------------------
-- Function: setupImperian()
-- Install the Imperian-specific modules into this profile.
function setupImperian()
104
   valkryiorMessage("Setting up Valkyrior for play on Imperian: The Sundered Heavens\n")
105 106 107
   if (ValkyriorLocation==nil) then
      valkryiorMessage("Root Valkyrior folder not set, please specify the location of scripts_valkyrior.\n")
      local location = findValkryior()
108 109
      ValkyriorLocation = location:gsub("scripts_valkyrior%.xml", '')
   end
110

Maiyannah Bishop's avatar
Maiyannah Bishop committed
111
   valkryiorMessage("Loading Imperian-specific modules...")
112 113
   for _, file in ipairs{"scripts_imperian.xml", "triggers_imperian.xml"} do
      installModule(ValkyriorLocation..file)
114
   end
Maiyannah Bishop's avatar
Maiyannah Bishop committed
115
   valkryiorMessage("And done. Open the Module Manager now and tick &lt;green&gt;sync&lt;reset&gt; besides all the modules.\n")
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
   tempTimer(10, function() valkryiorMessage("Enabling sync for the mud-specific modules is the last step! \n"..
      "Now whenever you make a change to the system, hit Save and Save Profile (Ctrl+S and Ctrl+Shift+S) and you can use your Git client to submit a pull request :)") end)
   tempTimer(10, UI.Initialize())
end

-- ----------------------------------------------------------------------------
-- Function: setupAetolia()
-- Install the Aetolia-specific modules into this profile.
function setupAetolia()
   valkryiorMessage("Setting up Valkyrior for play on Aetolia: the Midnight Age\n")
   if (ValkyriorLocation==nil) then
      valkryiorMessage("Root Valkyrior folder not set, please specify the location of scripts_valkyrior.\n")
      local location = findValkryior()
      ValkyriorLocation = location:gsub("scripts_valkyrior%.xml", '')
   end

   valkryiorMessage("Loading Aetolia-specific modules...")
   for _, file in ipairs{"scripts_aetolia.xml", "triggers_aetolia.xml"} do
      installModule(ValkyriorLocation..file)
   end
   valkryiorMessage("And done. Open the Module Manager now and tick &lt;green&gt;sync&lt;reset&gt; besides all the modules.\n")
137
   tempTimer(10, function() valkryiorMessage("Enabling sync for the mud-specific modules is the last step! \n"..
138
        "Now whenever you make a change to the system, hit Save and Save Profile (Ctrl+S and Ctrl+Shift+S) and you can use your Git client to submit a pull request :)") end)
139
   tempTimer(10, UI.Initialize())
140 141 142 143
end

-- END OF SCRIPT
-- ============================================================================</script>
144 145 146 147 148 149 150 151
				<eventHandlerList />
			</Script>
		</ScriptGroup>
	</ScriptPackage>
	<KeyPackage />
	<HelpPackage>
		<helpURL></helpURL>
	</HelpPackage>
Vadim Peretokin's avatar
Vadim Peretokin committed
152
</MudletPackage>