summaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* [Abilities] Added support for a global cooldownErik Schilling2013-05-081-0/+2
| | | | | | | | | Each ability can now define a cooldown that prevents the player from using other abilities for a while. The time of this cooldown can be set to any attribute. The modified value of the attribute is the value of the cooldown in game ticks. The cooldown will be automatically started if the ability has `autoconsume` set to true. Otherwise a script has to call entity:cooldown_ability(ability).
* Made member function tables available as a globalsThorbjørn Lindeijer2013-05-031-14/+14
| | | | | | | | | | | | This way the scripts can add or replace existing member functions, which can be useful. As demonstration chr_money and chr_money_change are now added as Entity.money and Entity.change_money. Also fixed the banker to use ask_number instead of ask_integer (I had decided to rename this and apparently forgot the banker). Mantis-issue: 503 Reviewed-by: Ablu
* Removed old monster attributesErik Schilling2013-04-221-3/+0
|
* Moved functions to entity members where appropriateThorbjørn Lindeijer2013-04-152-17/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some functions were skipped for now because they may need a new name or change of behavior. Changes: chr_warp entity:warp chr_get_inventory entity:inventory chr_inv_change entity:inv_change chr_inv_count entity:inv_count chr_get_equipment entity:equipment chr_equip_slot entity:equip_slot chr_equip_item entity:equip_item chr_unequip_slot entity:unequip_slot chr_unequip_item entity:unequip_item chr_get_level entity:level chr_get_exp entity:xp chr_give_exp entity:give_xp chr_get_rights entity:rights chr_set_hair_style entity:set_hair_style chr_get_hair_style entity:hair_style chr_set_hair_color entity:set_hair_color chr_get_hair_color entity:hair_color chr_get_kill_count entity:kill_count chr_give_special entity:give_special chr_has_special entity:has_special chr_take_special entity:take_special chr_set_special_recharge_speed entity:set_special_recharge_speed chr_get_special_recharge_speed entity:special_recharge_speed chr_set_special_mana entity:set_special_mana chr_get_special_mana entity:special_mana chr_kick entity:kick exp_for_level xp_for_level monster_get_id entity:monster_id monster_change_anger entity:change_anger monster_drop_anger entity:drop_anger monster_get_angerlist entity:angerlist being_apply_status entity:apply_status being_remove_status entity:remove_status being_has_status entity:has_status being_set_status_time entity:set_status_time being_get_status_time entity:status_time being_get_gender entity:gender being_set_gender entity:set_gender being_type entity:type being_walk entity:walk being_say entity:say being_damage entity:damage being_heal entity:heal being_get_name entity:name being_get_action entity:action being_set_action entity:set_action being_get_direction entity:direction being_set_direction entity:set_direction being_apply_attribute_modifier entity:apply_attribute_modifier being_remove_attribute_modifier entity:remove_attribute_modifier being_set_base_attribute entity:set_base_attribute being_get_modified_attribute entity:modified_attribute being_get_base_attribute entity:base_attribute being_set_walkmask entity:set_walkmask being_get_walkmask entity:walkmask being_get_mapid entity:mapid chat_message entity:message being_register entity:register chr_shake_screen entity:shake_screen chr_create_text_particle entity:show_text_particle - entity:position posX entity:x posY entity:y monster_get_name monsterclass:name item_get_name itemclass:name
* Made the scripts being able to installErik Schilling2013-02-242-0/+8
| | | | | | | The game server will now look for the scripts in this order: - serverPath - config value - current working directory - the PKG_DATADIR #define
* Documented all lua binds directly in the sourceErik Schilling2013-02-241-11/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a comment to each lua binding. In the future a script should parse those and generate the docs from them. This should prevent outdated docs and duplicate effort to keep code and docs synced. In C++ categories can be defined in this way: /** LUA_CATEGORY long description of the category (shortname) * further text * goes into * the next lines */ The shortname is only used to bind other comments to the category. In lua the category would look like this: --- LUA_CATEGORY long description of the category (shortname) -- further text -- goes into -- the next lines A comment that describes a bind then can look like this: /** LUA some_function (shortnameofcategory) * some_function(string name) * some_function(int id) ** * Description */ Or in Lua: --- LUA some_function (shortnameofcategory) -- some_function(string name) -- some_function(int id) --- -- Description Autoupdates script follows soon
* Moved attribute (re)calculation to the scriptsErik Schilling2013-02-041-1/+3
| | | | | | | | | | | | | | | | | | | | | | This introduces two callbacks: - on_update_derived_attribute -> Called to recalculate other derived attributes. - on_recalculate_base_attribute -> Called to recalculate a base attribute (only called for characters. However the function passed as callback can be useful for recalculating the derived attributes as well) Monsters no longer block recalculation of attributes except HP and Speed. I saw no sense to keep this. Fixed constant value in libmana-constants.lua Dropped bool type of the recalculation functions. It would be difficult to keep it while pushing all to the script engine and it was unused anyway. All in all this adds a LOT more flexibillity to projects since they can now adapt all attributes in the way they want.
* Fixed the atinit functionErik Schilling2012-08-051-4/+8
| | | | | | | Previously each map had its own scope. They got merged now but the atinit function was forgotten to adapt. Reviewed-by: bjorn.
* Fixed Lua error reporting for NPC scriptsThorbjørn Lindeijer2012-03-301-3/+4
| | | | | | | | | | | | | | This was due to a naming conflict between the 'debug' function I had recently introduced and the 'debug' library provided by Lua. This caused problems when trying to use debug.traceback for printing a backtrace of the error. There's multiple ways to avoid the naming conflict. I opted for writing the related helper functions in all-caps. Also added an ERROR log function now. As Erik pointed out, there is no conflict anymore with Lua's 'error' function with the new naming style. Reviewed-by: Erik Schilling
* Added map update function, moved schedules there to keep map contextErik Schilling2012-03-171-13/+31
| | | | Reviewed-by: bjorn.
* Added some convenience wrappers to libmana.luaThorbjørn Lindeijer2012-03-131-0/+25
| | | | | | | | | | | Global functions 'warn', 'info', 'debug' as shortcuts to the respective 'log' call, which also support passing multiple parameters at the same time, which will be separated by spaces. Global tables 'map' and 'world' which provide convenient read/write access to map and world state variables. Reviewed-by: Yohann Ferreira
* Register Lua script API functions into the global namespaceThorbjørn Lindeijer2012-03-112-26/+26
| | | | | | | | Scripts mostly execute the Mana script API, and it seems like just unnecessary verbosity to refer to the 'mana' table all the time. This table no longer exists now. Reviewed-by: Erik Schilling
* Removed the create_npc wrapper and the last two NPC callbacksThorbjørn Lindeijer2012-03-111-40/+2
| | | | | | | | | | | | When creating an NPC, you now provide its optional talk and update functions directly rather than them being stored in a table on the Lua side and then called in response to a global callback. Also fixed an issue with a missing gender parameter to the delayed NPC creation callback used by NPCs defined on the map (found by Erik while reviewing this patch). Reviewed-by: Erik Schilling
* Removed deprecated NPC helper functionsThorbjørn Lindeijer2012-03-111-9/+0
| | | | Reviewed-by: Erik Schilling
* Added callbacks for map/worldvar changesErik Schilling2012-03-111-0/+44
| | | | Reviewed-by: bjorn.
* Moved the managing of NPC script coroutines into C++Thorbjørn Lindeijer2012-03-101-256/+12
| | | | | | | | | | | | Rather than wrapping NPC functions up in coroutines in the Lua side, they are now managed on the C++ side as "script threads", which are essentially the same thing. The main purpose is that the server can now know whether any of these long running script interactions are still active, which will probably be useful when adding the ability to reload scripts. Reviewed-by: Erik Schilling
* Added lua function for getting pvp status of mapErik Schilling2012-03-051-0/+4
| | | | | | mana.map_get_pvp() now returns one of the constants in libmana-constants.lua Reviewed-by: Bertram.
* Made some global Lua variables localThorbjørn Lindeijer2012-03-031-46/+47
| | | | | | | | | | | We have to be careful with introducing globals now that there is only a single Lua state, so we shouldn't use globals unnecessarily. Any variable should be declared 'local' unless there is a reason to make it global. For additional safety we can also think about disallowing the use of globals entirely. This also helps to catch typos in scripts. Reviewed-by: Erik Schilling
* Added further missing callbacksErik Schilling2012-03-031-0/+11
| | | | Reviewed-by: bjorn.
* Converted functions called by LuaScript to callbacksThorbjørn Lindeijer2012-03-021-21/+16
| | | | | | | | | | This includes the quest reply, post reply, death notification and remove notification. Also, Script::Ref was changed from a typedef to a small class, automating initialization and making the check for validness clearer. Reviewed-by: Erik Schilling
* Merged all the different Lua states into oneThorbjørn Lindeijer2012-03-021-2/+2
| | | | | | | | | | | | | | | | | No more Lua state for each status effect, monster, item effect or map. All scripts are loaded into the same state. This should be more efficient overall and make it easier to implement dynamic reloading of the scripts in the future. Now, this introduces the problem of name collisions between different Lua scripts. For now this is solved by using more specific function names, like 'tick_plague' and 'tick_jump' rather than just 'tick'. The plan is however to get rid of these globals, and register these callbacks from the script, so that they can be local functions without the danger of colliding with other scripts. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
* Made all beings capable of having a genderErik Schilling2012-01-021-2/+2
| | | | Reviewed-by: o11c, bjorn, Bertram.
* Made do_npc_close to be called by default after the end of the talk functionErik Schilling2012-01-021-1/+6
| | | | Reviewed-by: Bertram.
* Officially added the being gender to the protocol.Yohann Ferreira2011-10-221-0/+1
| | | | Reviewed-by: o11c.
* Added Lua function for logging.Ablu2011-06-271-0/+7
| | | | | | | | 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
* Simplified check_schedule a bitThorbjørn Lindeijer2011-03-111-14/+9
|
* Avoid running newly scheduled jobs by using a fixed time point.Yohann Ferreira2011-03-101-1/+2
| | | | Reviewed-by: Thorbjorn.
* Fixed the check_schedule() lua function.Yohann Ferreira2011-02-201-0/+5
| | | | | | | An misleading error was raised when the function dealt with its last remaining job as it didn't return after removing it. Reviewed-by: Ablu.
* Added the schedule_per_date() lua function.Yohann Ferreira2011-02-111-0/+11
| | | | Reviewed-by: Ablu, Freeyorp.
* Fix basic money handling using the ATTR_GP attribute.Yohann Ferreira2011-02-111-3/+5
| | | | Reviewed-by: Freeyorp.
* Synced the libmana-constants.lua file with the current protocol.Yohann Ferreira2011-02-111-59/+68
| | | | Trivial.
* Implemented LUA binding to get the gender of a characterPhilipp Sehmisch2011-02-081-0/+3
| | | | | | | | | 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
* Copied basic Lua libs back from tmwserv-data and added dummy dataThorbjørn Lindeijer2010-05-303-0/+654
| | | | | | | The dummy data is currently mostly empty data though, so still nothing to see as far as the example content is concerned. Reviewed-by: Bertram
* Deleted obsolete files. Cleaned configuration. Removed obsolete SQL tables.Guillaume Melquiond2007-08-131-66/+0
|
* Updated bindings, game state class and more (see ChangeLog).Aaron Marks2005-11-151-6/+53
|
* CVS is being stupid.Aaron Marks2005-11-141-0/+19