summaryrefslogtreecommitdiff
path: root/src/scripting
AgeCommit message (Collapse)AuthorFilesLines
2012-08-01Fixed wrong error raising in lua.cppErik Schilling1-2/+2
2012-07-31Removed old warnings from chr_inv_change. They are handeled different nowErik Schilling1-2/+1
2012-07-22Merge remote-tracking branch 'origin/master' into lpc2012Erik Schilling3-67/+53
2012-07-21Fixed an error message and inlined some one-linersThorbjørn Lindeijer2-30/+29
2012-07-21Removed raiseScriptErrorThorbjørn Lindeijer3-37/+24
It wasn't really adding anything since errors raised using luaL_error are already logged anyway. Reviewed-by: Erik Schilling
2012-07-17Merge branch 'master' into lpc2012Erik Schilling1-2/+97
Conflicts: src/game-server/character.h
2012-07-17Added lua binds for issuing request of quest variable + bind for trying to ↵Erik Schilling1-2/+67
read them The difference to the old chr_get_quest bind is that this allows querying quest vars from non npc functions as well. Change is tested. Reviewed-by: bjorn.
2012-07-17Added script binds to get full monster anger list + drop anger of monstersErik Schilling1-0/+17
Reviewed-by: bjorn.
2012-07-17Added lua bind to send text effect particle to clientsErik Schilling1-0/+13
Change is tested. Reviewed-by: bjorn.
2012-07-17Made chr_get_level capable of retrieving skill levelsErik Schilling1-3/+12
Reviewed-by: bjorn.
2012-07-17Made chr_get_level capable of retrieving skill levelsErik Schilling1-3/+12
Reviewed-by: bjorn.
2012-07-14Fixed the get_beings_in_rectangle function.Erik Schilling1-1/+2
Previously it only used the rectangle iterator which in fact iterated over the beings in the map zones and returned often way higher number of beings compared to the actual rectangle. Change is tested. Reviewed-by: Bjorn.
2012-07-14Fixed the get_beings_in_rectangle function.Erik Schilling1-1/+2
Previously it only used the rectangle iterator which in fact iterated over the beings in the map zones and returned often way higher number of beings compared to the actual rectangle. Change is tested. Reviewed-by: Bjorn.
2012-07-13Fixed the atinit functionErik Schilling1-0/+1
Previously each map had its own scope. They got merged now but the atinit function was forgotten to adapt.
2012-07-11Made sure the map is set for trigger scriptsErik Schilling1-0/+1
Also unsetted maps after execution of scripts to make finding this mistakes easier. Reviewed-by: bjorn.
2012-07-11Made sure the map is set for trigger scriptsErik Schilling1-0/+1
Also unsetted maps after execution of scripts to make finding this mistakes easier. Reviewed-by: bjorn.
2012-07-10Made kill count script bind capable of taking the monster name as argumentErik Schilling1-2/+2
Reviewed-by: bjorn.
2012-07-10Made kill count script bind capable of taking the monster name as argumentErik Schilling1-2/+2
Reviewed-by: bjorn.
2012-07-08Added bind for setting login callbackErik Schilling1-0/+8
Reviewed-by: bjorn.
2012-07-08Added bind for setting login callbackErik Schilling1-0/+8
Reviewed-by: bjorn.
2012-07-07Added script bind for getting specy id of a monster handleErik Schilling1-0/+12
Reviewed-by: bjorn.
2012-07-07Added script bind for getting specy id of a monster handleErik Schilling1-0/+12
Reviewed-by: bjorn.
2012-07-07Added script binds for getting attack informationErik Schilling2-8/+155
New binds: - Damage: - id - skill - base - delta - cth - element - type - truestrike - range - Attack: - priority - cooldown - warmup - global_cooldown - damage - on_attack - MonsterClass: - attacks - ItemClass: - attacks
2012-05-20Removed no longer needed codeErik Schilling2-24/+0
I forgot to remove this during my special cleanup Reviewed-by: bjorn.
2012-05-06Don't send NPC text as fixed-length stringThorbjørn Lindeijer1-3/+2
This is intended to be used only when the string length is known. The client was deriving the length from the remaining amount of data in the message, but that doesn't work in the new 'debug mode' of the protocol. Reviewed-by: Ben Longbons
2012-05-06Some small optimizations in Lua helper functionsThorbjørn Lindeijer1-6/+3
Reviewed-by: Ben Longbons
2012-04-04Adding monster::on_damage callbackStefan Beller1-0/+9
Reviewed-by: bjorn
2012-04-04Renamed Thing to EntityThorbjørn Lindeijer6-22/+22
In preparation for using an entity/component system for the entities in the game world, this name will be more recognizable and easier to talk about. Reviewed-by: Yohann Ferreira
2012-04-04Enhanced special supportErik Schilling6-46/+162
- Made the current charge being saved. - Added script binds: - chr_set_special_recharge_speed - chr_get_special_recharge_speed - chr_set_special_mana - chr_get_special_mana - get_special_info - Added special info lua class. Functions: - name - needed_mana - rechargeable - on_use - on_recharged - category Further the engine no longer sets charge to 0 after using of specials this allows more flexbilillity (like failing specials). Changes on the xml database: - recharge renamed to rechargeable (needed by client and server) - needed - the needed mana to trigger a special (server only) - rechargespeed - the defailt recharge speed in mana per tick (server only) - target - the type of target (either being or point) (server and client) I also made the lua engine pushing nil instead of a 0 light userdata when the pointer was 0. Database update needed. Change is tested. Mana-Mantis: #167, #156 Reviewed-by: bjorn.
2012-03-17Made skill related function capable of taking the skill name as parameterErik Schilling3-5/+27
Reviewed-by: bjorn.
2012-03-17Added map update function, moved schedules there to keep map contextErik Schilling1-2/+15
Reviewed-by: bjorn.
2012-03-16Fixed fastRemoveOne when the element isn't foundThorbjørn Lindeijer1-1/+1
For a non-empty vectors that did not contain the element to remove, the loop would go on forever because a size_t can't become smaller than 0. Fixed by simply iterating forwards.
2012-03-14Added chr_kick() lua bindErik Schilling1-2/+16
Another step towards scriptable @commands. Reviewed-by: bjorn.
2012-03-14Added being_get_mapid lua bindErik Schilling1-2/+18
Another step for being able to make @commands scriptable Reviewed-by: bjorn.
2012-03-14Added get_character_by_name lua bindErik Schilling1-0/+18
Step to be able to handle chatcommands by scripts. Reviewed-by: bjorn.
2012-03-13Added script bind to set walkmask for beingsErik Schilling1-0/+42
TODO: Inform client about this change. Reviewed-by: bjorn.
2012-03-11Removed "mana." from script function documentationThorbjørn Lindeijer1-102/+99
Forgot to do this in the previous commit.
2012-03-11Register Lua script API functions into the global namespaceThorbjørn Lindeijer1-2/+3
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
2012-03-11Removed the create_npc wrapper and the last two NPC callbacksThorbjørn Lindeijer5-40/+54
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
2012-03-11Added callbacks for map/worldvar changesErik Schilling2-3/+27
Reviewed-by: bjorn.
2012-03-10Moved the managing of NPC script coroutines into C++Thorbjørn Lindeijer7-154/+341
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
2012-03-07Fixed compileThorbjørn Lindeijer1-1/+1
This was meant to be amended to the previous commit...
2012-03-07Added a function that returns the current map or raises an errorThorbjørn Lindeijer5-136/+80
The new function 'checkCurrentMap' will raise an error when no current map has been set, eliminating the need to do custom error handling all over the place. This also fixes several functions that would otherwise have simply crashed when there was no current map. Also cleaned up some "empty string parameter" checks. Reviewed-by: Erik Schilling
2012-03-05Added lua function for getting pvp status of mapErik Schilling1-0/+13
mana.map_get_pvp() now returns one of the constants in libmana-constants.lua Reviewed-by: Bertram.
2012-03-05Added possibility to make a being attack an other beingErik Schilling1-7/+33
This allows the script to let the character perform a scripted attack but the character still gets xp and killed monsters give drops. You can now call: mana.being_damage(target, dmg, dmg_delta, accurancy, type, element, source, skill) While on it I also added checks to the being_damage function. Reviewed-by: bjorn, Bertram.
2012-03-05Improved Lua API argument checkingThorbjørn Lindeijer3-580/+194
It's a bit embarrassing the way this has gotten out of hand. The error checking was inconsistent, and in some cases wrong. A host of new helper functions, starting with 'check' rather than 'get', perform error handling on function arguments (they will not return when encountering an error). Reviewed-by: Erik Schilling
2012-03-03Removed the last direct call to global script functionThorbjørn Lindeijer4-32/+15
The ScriptAction of the TriggerArea (which can be created by mana.trigger_create) was still using a named global function for its callback. Now it also uses a reference to a script function. Since it was the last occurrence of a call to a global script function, I've also removed the Script::prepare(std::string) overload. Reviewed-by: Erik Schilling Mantis-issue: 299
2012-03-03Improved handling of item and monster class parametersThorbjørn Lindeijer3-163/+108
Item and monster classes could already be identified by either their id or their name. Now the explicit values returned by 'get_item_class' and 'get_monster_class' can also be used as parameter. In addition the above two getters learned to understand all three types of parameter as well, rather than only supporting a name. Reviewed-by: Erik Schilling
2012-03-03Use callbacks for items, monsters and status effectsThorbjørn Lindeijer2-37/+97
Previously, global function names were defined in the respective XML definitions of items, monsters and status effects. This was reasonable when they all had the same state, but now they're sharing the single global Lua state. Now the Lua API provides access to the ItemClass, MonsterClass and StatusEffect instances, on which callbacks for both standard and custom events can be explicitly set. Reviewed-by: Erik Schilling
2012-03-03Added further missing callbacksErik Schilling5-6/+154
Reviewed-by: bjorn.