diff --git a/CMakeLists.txt b/CMakeLists.txt index dd9b1e67c..4c47eb509 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8.2) +cmake_minimum_required (VERSION 2.8.7) # Without this, the MSVC variable isn't defined for MSVC builds ( http://www.cmake.org/pipermail/cmake/2011-November/047130.html ) enable_language(CXX C) diff --git a/Install/Lua-LICENSE.txt b/Install/ThirdPartyLicenses/Lua-LICENSE.txt similarity index 100% rename from Install/Lua-LICENSE.txt rename to Install/ThirdPartyLicenses/Lua-LICENSE.txt diff --git a/Install/LuaExpat-license.html b/Install/ThirdPartyLicenses/LuaExpat-license.html similarity index 100% rename from Install/LuaExpat-license.html rename to Install/ThirdPartyLicenses/LuaExpat-license.html diff --git a/Install/LuaSQLite3-LICENSE.txt b/Install/ThirdPartyLicenses/LuaSQLite3-LICENSE.txt similarity index 100% rename from Install/LuaSQLite3-LICENSE.txt rename to Install/ThirdPartyLicenses/LuaSQLite3-LICENSE.txt diff --git a/Install/MersenneTwister-LICENSE.txt b/Install/ThirdPartyLicenses/MersenneTwister-LICENSE.txt similarity index 100% rename from Install/MersenneTwister-LICENSE.txt rename to Install/ThirdPartyLicenses/MersenneTwister-LICENSE.txt diff --git a/Install/SQLiteCpp-LICENSE.txt b/Install/ThirdPartyLicenses/SQLiteCpp-LICENSE.txt similarity index 100% rename from Install/SQLiteCpp-LICENSE.txt rename to Install/ThirdPartyLicenses/SQLiteCpp-LICENSE.txt diff --git a/Install/Zip2008.list b/Install/Zip2008.list index 5736867d8..dba435f60 100644 --- a/Install/Zip2008.list +++ b/Install/Zip2008.list @@ -8,8 +8,4 @@ ..\MCServer\monsters.ini MCServer*debug.cmd *.example.ini -Lua-LICENSE.txt -LuaExpat-license.html -LuaSQLite3-LICENSE.txt -SQLiteCpp-LICENSE.txt -MersenneTwister-LICENSE.txt +ThirdPartyLicenses diff --git a/MCServer/Plugins/APIDump/APIDesc.lua b/MCServer/Plugins/APIDump/APIDesc.lua index e7f9e9b18..718cb4e98 100644 --- a/MCServer/Plugins/APIDump/APIDesc.lua +++ b/MCServer/Plugins/APIDump/APIDesc.lua @@ -1188,7 +1188,7 @@ These ItemGrids are available in the API and can be manipulated by the plugins, constructor = { { Params = "", Return = "cItem", Notes = "Creates a new empty cItem object" }, - { Params = "ItemType, Count, Damage, EnchantmentString", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default) and enchantments (non-enchanted by default)" }, + { Params = "ItemType, Count, Damage, EnchantmentString, CustomName, Lore", Return = "cItem", Notes = "Creates a new cItem object of the specified type, count (1 by default), damage (0 by default), enchantments (non-enchanted by default), CustomName (empty by default) and Lore (string, empty by default)" }, { Params = "cItem", Return = "cItem", Notes = "Creates an exact copy of the cItem object in the parameter" }, } , AddCount = { Params = "AmountToAdd", Return = "cItem", Notes = "Adds the specified amount to the item count. Returns self (useful for chaining)." }, @@ -1201,12 +1201,14 @@ These ItemGrids are available in the API and can be manipulated by the plugins, IsDamageable = { Params = "", Return = "bool", Notes = "Returns true if this item does account for its damage" }, IsEmpty = { Params = "", Return = "bool", Notes = "Returns true if this object represents an empty item (zero count or invalid ID)" }, IsEqual = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is the same as the one stored in the object (type, damage, lore, name and enchantments)" }, - IsEnchantable = { Params = "", Return = "bool", Notes = "Returns true if the item is enchantable" }, IsFullStack = { Params = "", Return = "bool", Notes = "Returns true if the item is stacked up to its maximum stacking" }, IsSameType = { Params = "cItem", Return = "bool", Notes = "Returns true if the item in the parameter is of the same ItemType as the one stored in the object. This is true even if the two items have different enchantments" }, IsBothNameAndLoreEmpty = { Params = "", Return = "bool", Notes = "Returns if both the custom name and lore are not set." }, IsCustomNameEmpty = { Params = "", Return = "bool", Notes = "Returns if the custom name of the cItem is empty." }, IsLoreEmpty = { Params = "", Return = "", Notes = "Returns if the lore of the cItem is empty." }, + GetEnchantability = { Params = "", Return = "number", Notes = "Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0" }, + EnchantByXPLevels = { Params = "NumXPLevels", Return = "bool", Notes = "Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not." }, + IsEnchantable = { Params = "ItemType, WithBook", Return = "bool", Notes = "(STATIC) Returns true if the specified item type is enchantable. If WithBook is true, the function is used in the anvil inventory with book enchantments. So it checks the \"only book enchantments\" too. Example: You can only enchant a hoe with a book." }, }, Variables = { @@ -1214,8 +1216,10 @@ These ItemGrids are available in the API and can be manipulated by the plugins, m_ItemCount = { Type = "number", Notes = "Number of items in this stack" }, m_ItemDamage = { Type = "number", Notes = "The damage of the item. Zero means no damage. Maximum damage can be queried with GetMaxDamage()" }, m_ItemType = { Type = "number", Notes = "The item type. One of E_ITEM_ or E_BLOCK_ constants" }, - m_CustomName = { Type = "string", Notes = "The custom name for an item." }, - m_Lore = { Type = "string", Notes = "The lore for an item. Line breaks are represented by the ` character." }, + m_CustomName = { Type = "string", Notes = "The custom name for an item." }, + m_Lore = { Type = "string", Notes = "The lore for an item. Line breaks are represented by the ` character." }, + m_RepairCost = { Type = "number", Notes = "The repair cost of the item. The anvil need this value" }, + m_Enchantments = { Type = "{{cEnchantments|cEnchantments}}}", Notes = "The enchantments of the item." }, }, AdditionalInfo = { @@ -2340,6 +2344,7 @@ end ForEachBlockEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each block entity in the chunk. Returns true if all block entities in the chunk have been processed (including when there are zero block entities), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature:
function Callback({{cBlockEntity|BlockEntity}}, [CallbackData])
The callback should return false or no value to continue with the next block entity, or true to abort the enumeration. Use {{tolua}}.cast() to cast the Callback's BlockEntity parameter to the correct {{cBlockEntity}} descendant." }, ForEachChestInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each chest in the chunk. Returns true if all chests in the chunk have been processed (including when there are zero chests), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature:
function Callback({{cChestEntity|ChestEntity}}, [CallbackData])
The callback should return false or no value to continue with the next chest, or true to abort the enumeration." }, ForEachEntity = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the loaded world. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cEntity|Entity}}, [CallbackData])
The callback should return false or no value to continue with the next entity, or true to abort the enumeration." }, + ForEachEntityInBox = { Params = "{{cBoundingBox|Box}}, CallbackFunction", Return = "bool", Notes = "Calls the specified callback for each entity in the specified bounding box. Returns true if all the entities have been processed (including when there are zero entities), or false if the callback function has aborted the enumeration by returning true. If any chunk within the bounding box is not valid, it is silently skipped without any notification. The callback function has the following signature:
function Callback({{cEntity|Entity}})
The callback should return false or no value to continue with the next entity, or true to abort the enumeration." }, ForEachEntityInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each entity in the specified chunk. Returns true if all the entities have been processed (including when there are zero entities), or false if the chunk is not loaded or the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cEntity|Entity}}, [CallbackData])
The callback should return false or no value to continue with the next entity, or true to abort the enumeration." }, ForEachFurnaceInChunk = { Params = "ChunkX, ChunkZ, CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each furnace in the chunk. Returns true if all furnaces in the chunk have been processed (including when there are zero furnaces), or false if the callback has aborted the enumeration by returning true. The CallbackFunction has the following signature:
function Callback({{cFurnaceEntity|FurnaceEntity}}, [CallbackData])
The callback should return false or no value to continue with the next furnace, or true to abort the enumeration." }, ForEachPlayer = { Params = "CallbackFunction, [CallbackData]", Return = "bool", Notes = "Calls the specified callback for each player in the loaded world. Returns true if all the players have been processed (including when there are zero players), or false if the callback function has aborted the enumeration by returning true. The callback function has the following signature:
function Callback({{cPlayer|Player}}, [CallbackData])
The callback should return false or no value to continue with the next player, or true to abort the enumeration." }, diff --git a/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html b/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html index 35c880b00..dd124e119 100644 --- a/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html +++ b/MCServer/Plugins/APIDump/Writing-a-MCServer-plugin.html @@ -202,7 +202,7 @@ function Explode(Split, Player) if (#Split ~= 2) then -- There was more or less than one argument (excluding the "/explode" bit) -- Send the proper usage to the player and exit - SendMessage(Player, "Usage: /explode [playername]") + Player:SendMessage("Usage: /explode [playername]") return true end @@ -213,7 +213,7 @@ function Explode(Split, Player) if (Explodee:GetName() == Split[2]) then -- Create an explosion at the same position as they are; see API docs for further details of this function Player:GetWorld():DoExplosionAt(Explodee:GetPosX(), Explodee:GetPosY(), Explodee:GetPosZ(), false, esPlugin) - SendMessageSuccess(Player, Split[2] .. " was successfully exploded") + Player:SendMessageSuccess(Split[2] .. " was successfully exploded") HasExploded = true; return true -- Signalize to MCS that we do not need to call this callback for any more players end @@ -224,7 +224,7 @@ function Explode(Split, Player) if not(HasExploded) then -- We have not broken out so far, therefore, the player must not exist, send failure - SendMessageFailure(Player, Split[2] .. " was not found") + Player:SendMessageFailure(Split[2] .. " was not found") end return true diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 179935c08..0e7e647d5 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -65,6 +65,8 @@ function Initialize(Plugin) PM:BindCommand("/sb", "debuggers", HandleSetBiome, "- Sets the biome around you to the specified one"); PM:BindCommand("/wesel", "debuggers", HandleWESel, "- Expands the current WE selection by 1 block in X/Z"); PM:BindCommand("/rmitem", "debuggers", HandleRMItem, "- Remove the specified item from the inventory."); + PM:BindCommand("/pickups", "debuggers", HandlePickups, "- Spawns random pickups around you"); + PM:BindCommand("/poof", "debuggers", HandlePoof, "- Nudges pickups close to you away from you"); Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers) Plugin:AddWebTab("StressTest", HandleRequest_StressTest) @@ -1558,3 +1560,57 @@ end + +local PossibleItems = +{ + cItem(E_ITEM_DIAMOND), + cItem(E_ITEM_GOLD), + cItem(E_ITEM_IRON), + cItem(E_ITEM_DYE, 1, E_META_DYE_BLUE), -- Lapis lazuli + cItem(E_ITEM_COAL), +} + + + + + +function HandlePickups(a_Split, a_Player) + local PlayerX = a_Player:GetPosX() + local PlayerY = a_Player:GetPosY() + local PlayerZ = a_Player:GetPosZ() + local World = a_Player:GetWorld() + local Range = 12 + for x = 0, Range do for z = 0, Range do + local px = PlayerX + x - Range / 2 + local pz = PlayerZ + z - Range / 2 + local Items = cItems() + Items:Add(PossibleItems[math.random(#PossibleItems)]) + World:SpawnItemPickups(Items, px, PlayerY, pz, 0) + end end -- for z, for x + return true +end + + + + +function HandlePoof(a_Split, a_Player) + local PlayerPos = Vector3d(a_Player:GetPosition()) -- Create a copy of the position + PlayerPos.y = PlayerPos.y - 1 + local Box = cBoundingBox(PlayerPos, 4, 2) + local NumEntities = 0 + a_Player:GetWorld():ForEachEntityInBox(Box, + function (a_Entity) + if not(a_Entity:IsPlayer()) then + local AddSpeed = a_Entity:GetPosition() - PlayerPos -- Speed away from the player + a_Entity:AddSpeed(AddSpeed * 32 / (AddSpeed:SqrLength() + 1)) -- The further away, the less speed to add + NumEntities = NumEntities + 1 + end + end + ) + a_Player:SendMessage("Poof! (" .. NumEntities .. " entities)") + return true +end + + + + diff --git a/MCServer/webadmin/files/background.gif b/MCServer/webadmin/files/background.gif new file mode 100644 index 000000000..cab9bed56 Binary files /dev/null and b/MCServer/webadmin/files/background.gif differ diff --git a/MCServer/webadmin/files/favicon.ico b/MCServer/webadmin/files/favicon.ico new file mode 100644 index 000000000..ea4bde926 Binary files /dev/null and b/MCServer/webadmin/files/favicon.ico differ diff --git a/MCServer/webadmin/files/logo.png b/MCServer/webadmin/files/logo.png new file mode 100644 index 000000000..50733e824 Binary files /dev/null and b/MCServer/webadmin/files/logo.png differ diff --git a/MCServer/webadmin/files/mc-logo.png b/MCServer/webadmin/files/mc-logo.png new file mode 100644 index 000000000..9a77a490f Binary files /dev/null and b/MCServer/webadmin/files/mc-logo.png differ diff --git a/MCServer/webadmin/files/style.css b/MCServer/webadmin/files/style.css new file mode 100644 index 000000000..e7ffe3999 --- /dev/null +++ b/MCServer/webadmin/files/style.css @@ -0,0 +1,326 @@ +/* reset CSS */ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, font, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; + padding: 0; + border: 0; + outline: 0; + font-size: 100%; + vertical-align: baseline; + background: transparent; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} + +/* remember to define focus styles! */ +:focus { + outline: 0; +} + +/* remove textarea resize at Safari */ +textarea { + resize: none; +} + +/* remember to highlight inserts somehow! */ +ins { + text-decoration: none; +} +del { + text-decoration: line-through; +} + +/* tables still need 'cellspacing="0"' in the markup */ +table { + border-collapse: collapse; + border-spacing: 0; +} + + +/* + Origional from http://www.perspectived.com/ + Modified by Ben Phelps + Made for FakeTruth - MCServer +*/ + +/* Basic ---------------------------------------- */ + +.clear { clear: both; } + +body { + background: white; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + color: #646464; + text-align: center; +} + +#wrapper { + text-align: left; + width: 930px; + margin: 0 auto; +} + +/* Logo ---------------------------------------- */ + +h1 { + margin: 15px 0 10px 5px; + width: 180px; + height: 36px; + background: url(logo.png) no-repeat left top; +} + +h1 a { + display: block; + width: 225px; + height: 28px; +} + +h1 span { display: none; } + +a { + color: #646464; +} + +/* Container ---------------------------------------- */ + +#containerHolder { + background: #eee; + padding: 5px; +} + + +#container { + background: #fff url(background.gif) repeat-y left top; + border: 1px solid #ddd; + width: 918px; + +} + +#connectHolder { + background: #eee; + padding: 5px; + margin-bottom:8px; +} + + +#connect { + border: 1px solid #ddd; + background-color: #fff; + padding:5px; + width: 908px; +} + +.pics { + height: 375px; + width: 600px; +} + +.pics img { + padding: 5px; + border: 1px solid #ddd; + background-color: #eee; + width: 600px; + height: 375px; + margin-left: 15px; +} + +/* Login -------------------------------------- */ + +#loginLogo { + margin: 0 auto; + margin-top:100px; + width: 180px; + height: 36px; + background-image: url(logo.png); +} + +#loginHolder { + background: #eee; + padding: 5px; + width: 310px; + margin: 0 auto; + height: 90px; + margin-top:20px; +} + +#login { + padding:10px; + width: 288px; + height: 68px; + border: 1px solid #ddd; + background:#fff; + text-align: left; +} + + +/* Sidebar ---------------------------------------- */ + +#sidebar { + width: 179px; + float: left; +} + +#sidebar .sideNav { width: 179px; } + +#sidebar .sideNav li { border-bottom: 1px solid #ddd; width: 179px; } + +#sidebar .sideNav li a { + display: block; + color: #646464; + background: #f6f6f6; + text-decoration: none; + height: 29px; + line-height: 29px; + padding: 0 19px; + width: 141px; +} + +#sidebar .sideNav li a:hover { background: #fdfcf6; } + +#sidebar .sideNav li a.active, #sidebar .sideNav li a.active:hover { + background: #f0f7fa; + color: #c66653; +} + +/* Breadcrumb ---------------------------------------- */ + +h2 { + width: 718px; + float: right; + color: #646464; + font-size: 16px; + line-height: 16px; + font-weight: bold; + margin: 20px 0 0 0; + padding: 0 0 10px 0; + border-bottom: 1px solid #ddd; +} + +h2 a { + color: #646464; + text-decoration: none; +} + +h2 a.active { color: #c66653; } + +h2 a:hover { text-decoration: underline; } + +/* Content ---------------------------------------- */ + +#main { + width: 700px; + float: right; + padding: 0 19px 0 0; +} + +#main p { + + padding: 10px; + +} + +h3 { + font-size: 14px; + line-height: 14px; + font-weight: bold; + color: #5494af; + padding: 0 0 0 10px; + margin: 20px 0 10px; +} + +h4 { + padding: 0 0 0 10px; + margin: 20px 0 10px; +} + +#main ul { + padding: 0 0 0 10px; + list-style-type: circle; + list-style-position: inside; +} + +#main table { + border-top: 1px solid #ddd; + width: 700px; +} + +#main table tr th { + text-align: left; + background: #f6f6f6; + padding: 0px 20px; + height: 20px; + line-height: 20px; + border-bottom: 1px solid #ddd; +} + +#main table tr td { + background: #f6f6f6; + padding: 0px 20px; + height: 29px; + line-height: 29px; + border-bottom: 1px solid #ddd; +} + +#main table tr.odd td { + background: #fbfbfb; +} + +#main table tr:hover td { background: #fdfcf6; } + +#main table .action { + text-align: right; + padding: 0 20px 0 10px; +} + +#main table tr .action a { margin: 0 0 0 10px; text-decoration: none; color: #9b9b9b; } +#main table tr:hover .action .edit { color: #c5a059; } +#main table tr:hover .action .delete { color: #a02b2b; } +#main table tr:hover .action .view { color: #55a34a; } + +#main table tr:hover .action a:hover { text-decoration: underline; } + +fieldset { + border: 1px solid #ddd; + padding: 19px; + margin: 0 0 20px 0; + background: #fbfbfb; +} + +form p { margin: 0 0 14px 0; float: left; width: 100%; } + +label { + display: block; + width: 100%; + margin: 0 0 7px 0; + line-height: 12px; +} + +/* Footer ---------------------------------------- */ + +#footer { + margin: 10px 0 30px 0; + font-size: 11px; + line-height: 11px; + color: #9B9B9B; + padding: 0 0 0 5px; +} + +#footer a { color: #9B9B9B; } + +#footer a:hover { text-decoration: none; } diff --git a/MCServer/webadmin/login_template.html b/MCServer/webadmin/login_template.html new file mode 100644 index 000000000..913a85db0 --- /dev/null +++ b/MCServer/webadmin/login_template.html @@ -0,0 +1,25 @@ + + + MCServer WebAdmin - Login + + + + + + +
+ +

MCServer - WebAdmin

+
+ +
+
+ + + diff --git a/MCServer/webadmin/template.lua b/MCServer/webadmin/template.lua index a066d8b33..a7480f83e 100644 --- a/MCServer/webadmin/template.lua +++ b/MCServer/webadmin/template.lua @@ -57,7 +57,7 @@ end function ShowPage(WebAdmin, TemplateRequest) SiteContent = {} local BaseURL = WebAdmin:GetBaseURL(TemplateRequest.Request.Path) - local Title = "MCServer" + local Title = "MCServer WebAdmin" local MemoryUsageKiB = cRoot:GetPhysicalRAMUsage() local NumChunks = cRoot:Get():GetTotalChunkCount() local PluginPage = WebAdmin:GetPage(TemplateRequest.Request) @@ -74,339 +74,9 @@ function ShowPage(WebAdmin, TemplateRequest) - + ]] .. Title .. [[ - - - + @@ -421,16 +91,16 @@ function ShowPage(WebAdmin, TemplateRequest)