summaryrefslogtreecommitdiffstats
path: root/src/scripting
Commit message (Collapse)AuthorAgeFilesLines
...
* Added equip lua script functions.Yohann Ferreira2012-01-101-0/+71
| | | | | | | | | | One per inventory slot, one per item id or name. + Fixes from 2 Ablu's reviews. Reviewed-by: Ablu. 1st part of Mana-Mantis #339, 350.
* Made all beings capable of having a genderErik Schilling2012-01-021-17/+21
| | | | Reviewed-by: o11c, bjorn, Bertram.
* Merged three global script states into oneThorbjørn Lindeijer2011-11-074-59/+29
| | | | | | | | | | | | | | | | | 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
* Merge github.com:mana/manaservYohann Ferreira2011-11-013-1/+20
|\ | | | | | | | | | | Conflicts: src/game-server/character.cpp src/scripting/lua.cpp
| * Added function to determine the script engine by the file name extensionjurkan2011-10-232-0/+19
| | | | | | | | Reviewed-by: Bjorn, Bertram.
| * Fixed the get_level doxygen documentation.Yohann Ferreira2011-10-221-1/+1
| | | | | | | | Thanks to Ablu.
| * Added the chr_get_level script function.Yohann Ferreira2011-10-221-0/+18
| | | | | | | | Reviewed-by: Ablu.
| * Added the chr_set_gender() script function.Yohann Ferreira2011-10-221-0/+20
| | | | | | | | Reviewed-by: Ablu.
* | Merge branch 'master' of github.com:mana/manaservYohann Ferreira2011-10-193-4/+156
|\| | | | | | | | | Conflicts: src/game-server/accountconnection.cpp
| * Made get_beings_in_circle capable of taking a being as argument.Erik Schilling2011-10-191-3/+16
| | | | | | | | | | Instead of giving the x, y coordinates of the circle you can give a being which is in the center of the circle.
| * Added script bindings for reading map objectsErik Schilling2011-10-153-1/+140
| | | | | | | | | | | | | | | | | | | | | | map_get_objects([string filter]): returns all object of the current map optionally filtered by type. map_get_object_property(handle object, string key): returns the value of the property of the object. map_get_object_bounds(handle object): returns x, y, width, height of an object. map_get_object_name(handle object): returns name of an object. map_get_object_type(handle object): returns type of an object. Mantis-issue: 397 Reviewed-by: Thorbjørn Lindeijer
| * Made the npc_create() function use insertion enqueueing.Yohann Ferreira2011-09-281-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | As the server was exitting when the insertion was failing anyway, and because the GameState::update() doesn't allow actor insertion while the update process, it was then pretty weird to not use an enqueued insertion for it. Plus, it fixes an assertion failure when scheduling an npc creation. Resolves: Mana-Mantis #360. Reviewed-by: o11c.
| * Allowed map names in chr_warp function.Erik Schilling2011-08-231-2/+6
| | | | | | | | | | | | Resolves: Mana-Mantis #293. Reviewed-by: Bertram.
| * Created function to make getting monsters easier in scripts.Erik Schilling2011-08-193-14/+16
| |
| * Added LUA function for changing anger of monsters.Erik Schilling2011-08-181-0/+30
| | | | | | | | | | | | | | You now can change the anger of a monster to a being using mana.monster_change_anger(monster, being, anger) Resolves: Mana-Mantis #366.
* | Added the chr_set_gender() script function.Yohann Ferreira2011-09-281-0/+20
| |
* | Added the chr_get_level script function.Yohann Ferreira2011-09-281-0/+18
| |
* | Made the monster removal not using queues to avoid a crash.Yohann Ferreira2011-08-301-4/+4
| | | | | | | | | | | | | | | | | | | | A race condition on the being pointer could happen when the being queue was highly requested. IMHO, using queues to add being but remove them directly is the way to go. Resolves: Mana-Mantis #384
* | Made the npc_create() function use insertion enqueueing.Yohann Ferreira2011-08-261-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | As the server was exitting when the insertion was failing anyway, and because the GameState::update() doesn't allow actor insertion while the update process, it was then pretty weird to not use an enqueued insertion for it. Plus, it fixes an assertion failure when scheduling an npc creation. Resolves: Mana-Mantis #360.
* | Merge branch 'equipment-fix' of github.com:Bertram25/manaservYohann Ferreira2011-08-251-4/+5
|\ \
| * \ Merge branch 'master' of ↵Yohann Ferreira2011-08-111-4/+5
| |\ \ | | |/ | |/| | | | | | | | | | | | | git://gitorious.org/~bertram/mana/manaserv-equipment-fix into equipment-fix Conflicts: src/common/manaserv_protocol.h
| | * Merge branch 'master' of git://gitorious.org/mana/manaservYohann Ferreira2011-08-041-27/+100
| | |\
| | * \ Merge branch 'master' of git://gitorious.org/mana/manaservYohann Ferreira2011-08-041-159/+276
| | |\ \
| | * | | Removed the inventory delay mode for now.Yohann Ferreira2011-07-271-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I said I wouldn't do it, but I change my mind. Here is why: The delay mode is used in the trading code, and in the inventory code for lua only. In the lua part, the delay mode is useless as it is used only when the script is requesting removal of more items than owned. This is something that can't be handled well anyway, as for the script part, even when the character was still keeping its items. Plus, it's not actually an error, IMHO. In the trading code, it made sense. But the next commit will bring design changes making the inventory items and the equipment items not linked anymore. Hence, making it impossible to trade equipped items, for instance, which is a good thing IMHO. It will also remove the need of a delayed inventory mode in that case. The two cases where it is used will disappear, making it useless. Last but no least, the part watching for equipment changes in the commit() function is not something easy to debug without first having a proper and working base. (checking of two multimaps changes, for instance). We can add it back once the code has been fully debugged for the most skilled among us. And yes, I am sure of what I'm currently doing. For now the whole inventory and trading code is in need of review but it already was, anyway.
* | | | | Allowed map names in chr_warp function.Erik Schilling2011-08-251-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Resolves: Mana-Mantis #293. Reviewed-by: Bertram.
* | | | | Created function to make getting monsters easier in scripts.Erik Schilling2011-08-253-14/+16
| | | | |
* | | | | Added LUA function for changing anger of monsters.Erik Schilling2011-08-181-0/+30
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | You now can change the anger of a monster to a being using mana.monster_change_anger(monster, being, anger) Resolves: Mana-Mantis #366.
* | | / Made chr_inv_count and npc_trade capable of taking a name or an id.Erik Schilling2011-08-101-3/+36
| |_|/ |/| | | | | | | | | | | | | | Resolves: Mana-Mantis #318. Reviewed-by: Bertram.
* | | Added new LUA functions used to get items and monster names.Erik Schilling2011-08-041-0/+37
| | | | | | | | | | | | | | | | | | | | | mana.monster_get_name(id) and mana.item_get_name(id) can be used to get the name of an item or a monster if only an id is given. Reviewed-by: Bertram.
* | | Allowed names of items and monsters in scripts - part 1.Erik Schilling2011-08-041-27/+63
| |/ |/| | | | | | | | | | | | | | | You can now use either the name or the id of the item in the LUA functions chr_inv_change, monster_create, item_drop. Part of: Mana-Mantis #318. Reviewed-by: Bertram.
* | Unified the lua.cpp documentation.Yohann Ferreira2011-08-031-162/+200
| | | | | | | | | | I also changed the chatmessage function to chat_message to follow the coding standard.
* | Added is_walkable lua function.Erik Schilling2011-08-031-0/+30
| | | | | | | | | | | | | | mana.is_walkable(x, y) can now be used to check wether the pixel on the current map is walkable or not. Reviewed-by: Bertram.
* | Added monster_remove lua function.Erik Schilling2011-08-031-0/+25
| | | | | | | | | | | | | | | | | | mana.monster_remove(monster) can now be used to remove a monster from a map. Resolves: Mana-Mantis #352. Reviewed-by: Bertram.
* | Added get_map_property lua function.Erik Schilling2011-08-031-0/+24
|/ | | | | | | | | mana.get_map_prpoperty(string) can now be used to read a property from a map file. String is the property name. Resolves: Mana-Mantis #353. Reviewed-by: Bertram.
* Added new lua function for calculating distances.Ablu2011-07-041-0/+32
| | | | | | | | | You can now call mana.get_distance(being1, being2) or mana.get_distance(x1, y1, x2, y2) for calculating distances. Reviewed-by: Jaxad0127, Bertram. Resolves: Mana-Mantis #370.
* Added LUA function get_beings_in_rectangle.Ablu2011-07-021-0/+39
| | | | | | Reviewed-by: Bertram. Resolves: Mana-Mantis #369.
* Added Lua function for logging.Ablu2011-06-271-0/+16
| | | | | | | | You can now call mana.log(loglevel, message) to log messages with scripts. For loglevel you can use the new constants defined in libmana-constants.lua Resolves: Mana-Mantis #359
* Added a simple crafting systemPhilipp Sehmisch2011-04-274-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Improved error handling in chr_shake_screen Lua functionThorbjørn Lindeijer2011-03-181-22/+10
| | | | | | | | | | | | | | | | It's better to use luaL_checkint than manually checking and printing out an error, since using the helper function makes a more informative error message. Also, scripts errors need to be raised before constructing objects, since due to the way Lua does error handling the destructors of the objects will not be called. Also fixed an issue with the 4th parameter, which was first cast to integer and then multiplied by 10000. Now the multiplication happens before the casting to integer. Reviewed-by: Crush
* Micro-optimizations related to std::stringThorbjørn Lindeijer2011-03-172-3/+3
| | | | | | | | * 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
* Script binding for the new screen shake effect.Philipp Sehmisch2011-03-141-0/+45
| | | | | | | | | | The new lua function mana.chr_shake_screen can cause a screen shake for a single client with variable x-intensity, y-intensity, decay and duration. I also added an example script which causes tremors for nearby characters with intensity and direction relative to a specific point. The function is not referenced on the example map because it is quite distracting.
* Removed a bunch of silly documentationThorbjørn Lindeijer2011-03-122-9/+0
| | | | | | A C++ developer should be able to recognize a constructor and a destructor by just looking at it, so let's stop writing down the obvious. :)
* Renamed GameState::insertSafe() to inserOrDelete.Yohann Ferreira2011-03-091-1/+1
| | | | | | This reflects much more what the function does IMHO. Trivial.
* Made the monster creation delayed, to avoid crashing.Yohann Ferreira2011-03-091-5/+1
| | | | | | | | | Creation of monsters shouldn't be done during game state update. So we delay their insertion after the update to avoid a crash in debug builds and weird stuff happening in release builds. Reviewed-by: Thorbjorn.
* Small fixes coming from my comment on issue #77.Yohann Ferreira2011-03-061-4/+4
| | | | Trivial.
* Implemented persistent world and map variablesPhilipp Sehmisch2011-03-041-1/+91
| | | | | | | | | | | | | | | | | | | | | The gameserver now receive a copy of all world state variables when they are accepted by the accountserver and receive a copy of all map state variables of a map when they register it successfully. Implemented LUA script bindings for getting and setting these variables. When such a variable is set, the accountserver is notified about this change. Changes to world state variables are then propagated to all gameservers by the accountserver. Be aware that when a gameserver is updating a map, there is no check if it is actually responsible for said map. But I consider this not a security flaw, because authenticated game servers are considered to be trustworthy in a lot of other situations, too. Also renamed "quest" to "character variable" in the sourcecode. Reviewed-by: Bertram
* Fixed enabling/disabling npcs by enqueuing the insertion.Yohann Ferreira2011-02-201-2/+1
| | | | | | | | This permits to handle such operation after the object locking, thus avoiding to fail on the assertion: assert(!dbgLockObjects); when inserting a npc. Reviewed-by: Ablu.
* Fix basic money handling using the ATTR_GP attribute.Yohann Ferreira2011-02-111-4/+18
| | | | Reviewed-by: Freeyorp.
* Added lua attributes getters/setters thanks to Freeyorp.Yohann Ferreira2011-02-111-68/+155
|
* Implemented LUA binding to get the gender of a characterPhilipp Sehmisch2011-02-081-0/+17
| | | | | | | | | The function is named mana.chr_get_gender. It returns 0 for male and 1 for female. libmana-constants.lua defines the variables GENDER_MALE and GENDER_FEMALE with these values. Also made the banker NPC refer to the gender of the player character. Reviewed-by: Jaxad0127