summaryrefslogtreecommitdiff
path: root/src/scripting/luascript.cpp
AgeCommit message (Collapse)AuthorFilesLines
2011-11-07Merged three global script states into oneThorbjørn Lindeijer1-33/+0
These scripts could trivially share one script state, since the methods called on them from the server are not overlapping. This does leave them open to access each other's global variables, but that's the problem with global variables. The one remaining global script file name is now configurable, so that it may also be set to a script in a different scripting language. The two related script options are: script_mainFile (default: scripts/main.lua) script_defaultEngine (default: lua) - renamed from defaultScriptEngine Reviewed-by: jurkan Reviewed-by: Yohann Ferreira
2011-04-27Added a simple crafting systemPhilipp Sehmisch1-0/+38
A client can craft something using the @craft command. The command needs a list of item names and amounts. The gameserver checks if the character has these items in the inventory and then passes the list together with the character handle to the lua script function on_craft in the script file scripts/crafting.lua. This function can then be used to evaluate if the list is a valid crafting combination and when this is the case take or give items. Implemented two example crafting scripts there, one which enforces exact item order and amount and one which doesn't. Both are disabled per default and one needs to be enabled by uncommenting a line. Also gave the player group permission to use the @craft command in permissions.xml and added two new items (wood and iron) required for the example crafting combination. Resolves: #333 Reviewed-by: bcs86, Bertram
2011-03-17Micro-optimizations related to std::stringThorbjørn Lindeijer1-1/+1
* Rely on the fact that a std::string is empty by default * Use std::string::empty() rather than comparing to "" * Construct with std::string() rather than from "" Reviewed-by: Bertram
2010-11-14Renamed .hpp files into .h for consistency.Yohann Ferreira1-2/+2
Also added an header to the autoattack.{h,cpp} files. Big but trivial fix.
2010-08-22Pass a script name to Lua for proper reporting of error locationsThorbjørn Lindeijer1-5/+5
Now the Lua file name shows up in the error message and stack traceback, or the map file and object name in case of a script embedded in a map file.
2010-08-22Rename some stuff to conform to naming conventionsThorbjørn Lindeijer1-8/+8
2010-08-22Print out a backtrace when a Lua error is raisedThorbjørn Lindeijer1-19/+19
The backtrace is printed by using debug.traceback as error handler when calling Lua functions. At the moment it still looks pretty ugly since Lua is not aware of the file names of the scripts (to be fixed). Reviewed-by: Jared Adams
2010-08-22Print out the actual error message in case of a syntax errorThorbjørn Lindeijer1-3/+7
Should help to locate the problem. Reviewed-by: Jared Adams
2010-07-09Added LUA script bindings for manipulating the specials available to a ↵Philipp Sehmisch1-0/+11
character. Added script call for getting the cost of a special (recharge only for now) Deleting specials works server-sided but the client isn't informed about it properly. Specials without recharge cost don't appear for the player. Both of these features require an additional netcode message. Reviewed-by: Freeyorp
2010-04-11Implemented handler for on_chr_death and put the loading of the global ↵Philipp Sehmisch1-0/+11
script into a method of class LuaScript Reviewed-by: Jared Adams <Jaxad0127@gmail.com>
2010-02-07Update Copyright date for Manaserv.Bertram1-1/+1
2009-12-06Fixed name of the project in copyright headersThorbjørn Lindeijer1-7/+6
Also updated the headers to refer to the GPL by URL instead of suggesting to contact the FSF by snail mail, as per the latest GPL usage instructions.
2009-04-26Standardize on the position of the const keywordBjørn Lindeijer1-8/+8
Same as for the client.
2009-01-31Added on_remove callback to lua APIPhilipp Sehmisch1-1/+10
2009-01-22Reduced the size of lua.cpp by putting the class LuaScript and the utility ↵Philipp Sehmisch1-0/+150
functions in separate files leaving only the script bindings themself. Unified internal and external names of lua script bindings.