From 9a08f3dc599f7bb193ed16cddebc533e8e63c159 Mon Sep 17 00:00:00 2001 From: faketruth Date: Mon, 20 Aug 2012 19:10:19 +0000 Subject: Can change monster settings in WebAdmin too git-svn-id: http://mc-server.googlecode.com/svn/trunk@767 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Core/web_serversettings.lua | 53 +++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 5 deletions(-) (limited to 'MCServer') diff --git a/MCServer/Plugins/Core/web_serversettings.lua b/MCServer/Plugins/Core/web_serversettings.lua index 4e4901f4c..4f33f53ff 100644 --- a/MCServer/Plugins/Core/web_serversettings.lua +++ b/MCServer/Plugins/Core/web_serversettings.lua @@ -1,5 +1,3 @@ -local CurrentlyEditingIni = nil - -- Some HTML helper functions local function HTML_Option( value, text, selected ) if( selected == true ) then @@ -68,9 +66,9 @@ local function ShowGeneralSettings( Request ) Content = Content .. "Authentication" Content = Content .. "Authenticate:" Content = Content .. "" .. HTML_Select_On_Off("Authentication_Authenticate", SettingsIni:GetValueI("Authentication", "Authenticate") ) .. "" - Content = Content .. "" + Content = Content .. "
" - Content = Content .. " WARNING: Any changes made here might require a server restart to be applied!" + Content = Content .. " WARNING: Any changes made here might require a server restart in order to be applied!" Content = Content .. "" return Content @@ -78,7 +76,52 @@ end local function ShowMonstersSettings( Request ) - return "

Monsters Settings

" + local Content = "" + local InfoMsg = nil + + local SettingsIni = cIniFile("settings.ini") + if( SettingsIni:ReadFile() == false ) then + InfoMsg = "ERROR: Could not read settings.ini!" + end + + if( Request.PostParams["monsters_submit"] ~= nil ) then + + if( tonumber( Request.PostParams["Monsters_AnimalsOn"] ) ~= nil ) then + SettingsIni:SetValue("Monsters", "AnimalsOn", Request.PostParams["Monsters_AnimalsOn"], false ) + end + if( tonumber( Request.PostParams["Monsters_AnimalSpawnInterval"] ) ~= nil ) then + SettingsIni:SetValue("Monsters", "AnimalSpawnInterval", Request.PostParams["Monsters_AnimalSpawnInterval"], false ) + end + SettingsIni:SetValue("Monsters", "Types", Request.PostParams["Monsters_Types"], false ) + if( SettingsIni:WriteFile() == false ) then + InfoMsg = "ERROR: Could not write to settings.ini!" + else + InfoMsg = "INFO: Successfully saved changes to settings.ini" + end + end + + + Content = Content .. "
" + + Content = Content .. "

Monsters Settings

" + if( InfoMsg ~= nil ) then + Content = Content .. "

" .. InfoMsg .. "

" + end + + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + Content = Content .. "
Monsters
Animals On:" .. HTML_Select_On_Off("Monsters_AnimalsOn", SettingsIni:GetValueI("Monsters", "AnimalsOn") ) .. "
Animal Spawn Interval:
Monster Types:

" + + Content = Content .. " WARNING: Any changes made here might require a server restart in order to be applied!" + Content = Content .. "
" + + return Content end local function ShowWorldsSettings( Request ) -- cgit v1.2.3