summaryrefslogtreecommitdiffstats
path: root/src/game-server
Commit message (Collapse)AuthorAgeFilesLines
...
* Enhanced special supportErik Schilling2012-04-048-101/+713
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* Some general cleanups and merged Being::perform() into update()Thorbjørn Lindeijer2012-03-267-114/+104
| | | | | | | | The main change here is to remove the separate calling of 'perform' on all beings, and rather rely on the beings to do whatever they were doing in that function when the virtual 'update' function is called. Reviewed-by: Yohann Ferreira
* Fixed restoring of persistent floor itemsThorbjørn Lindeijer2012-03-211-1/+1
| | | | | | | Only 1/4th of the floor items were being restored after a reboot of the game server. Reviewed-by: jurkan
* Fixed finding characters by nameThorbjørn Lindeijer2012-03-201-1/+1
| | | | | | | This was broken in ba66fbeda8ef9afb6c33eba66d109bac85ebf628 where we forgot to make sure to invert the condition when moving it into the function. Reviewed-by: Erik Schilling
* Made skill related function capable of taking the skill name as parameterErik Schilling2012-03-172-4/+16
| | | | Reviewed-by: bjorn.
* Added map update function, moved schedules there to keep map contextErik Schilling2012-03-173-29/+35
| | | | Reviewed-by: bjorn.
* Fixed remaining compiler warningsThorbjørn Lindeijer2012-03-165-10/+10
| | | | | | | These were unused parameters and one return type with an ignored 'const' qualifier. Reviewed-by: Yohann Ferreira
* Fixed Inventory::unequipItem functionThorbjørn Lindeijer2012-03-161-1/+1
| | | | | | | | Due to a misplaced semicolon, it always returned false after the first instance. This function is only used by the script function chr_unequip_item. Reviewed-by: Yohann Ferreira
* Added get_character_by_name lua bindErik Schilling2012-03-144-48/+25
| | | | | | Step to be able to handle chatcommands by scripts. Reviewed-by: bjorn.
* Added script bind to set walkmask for beingsErik Schilling2012-03-138-28/+21
| | | | | | TODO: Inform client about this change. Reviewed-by: bjorn.
* Removed the create_npc wrapper and the last two NPC callbacksThorbjørn Lindeijer2012-03-115-30/+100
| | | | | | | | | | | | 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
* Added callbacks for map/worldvar changesErik Schilling2012-03-114-0/+77
| | | | Reviewed-by: bjorn.
* Moved the managing of NPC script coroutines into C++Thorbjørn Lindeijer2012-03-108-68/+102
| | | | | | | | | | | | 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
* Removed space before ;Erik Schilling2012-03-101-1/+1
| | | | Reviewed-by: PjotrOrial.
* Added @effect commandErik Schilling2012-03-051-0/+48
| | | | | | | | | Usage: @effect <id> @effect <id> <char> @effect <id> <x> <y> Reviewed-by: Bertram.
* Added lua function for getting pvp status of mapErik Schilling2012-03-051-2/+2
| | | | | | mana.map_get_pvp() now returns one of the constants in libmana-constants.lua Reviewed-by: Bertram.
* Added possibility to make a being attack an other beingErik Schilling2012-03-053-28/+28
| | | | | | | | | | | | | 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.
* Removed the last direct call to global script functionThorbjørn Lindeijer2012-03-032-7/+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
* Use callbacks for items, monsters and status effectsThorbjørn Lindeijer2012-03-0310-90/+139
| | | | | | | | | | | | | 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
* Added further missing callbacksErik Schilling2012-03-034-14/+68
| | | | Reviewed-by: bjorn.
* Converted functions called by LuaScript to callbacksThorbjørn Lindeijer2012-03-024-9/+11
| | | | | | | | | | 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
* Use callbacks for handling character death and respawnThorbjørn Lindeijer2012-03-022-5/+33
| | | | | | | | | | | | | | | Rather than relying on the availability of global functions with certain predefined names, the Lua script now calls API functions to set which function should be called on these global events. This mechanism should make it easier to avoid name collisions in the global namespace, which is important now that there is only a single script state. For these global events this was not likely to become a problem, but this solution can also be used for callbacks on specific item or monster types, or even allow setting callbacks on certain instances. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
* Merged all the different Lua states into oneThorbjørn Lindeijer2012-03-0214-160/+89
| | | | | | | | | | | | | | | | | 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
* Fixed bug with erasing the last status effectThorbjørn Lindeijer2012-02-281-3/+9
| | | | | | | It's not nice to use ++ on an iterator that may be std::map::end(), in my case this caused it to hang indefinitely. Reviewed-by: Yohann Ferreira
* Prevent calculating movement of being further if it does not moveErik Schilling2012-02-271-0/+4
| | | | Reviewed-by: bjorn.
* Fixed compilation again + some more code cleanupErik Schilling2012-02-271-1/+1
| | | | | | | | | | I did some cleanup but i had a wrong path set inside qtcreator. So i recompiled old versions and it all worked fine. But when i recompiled from console i got a whole bunch of errors. Sorry for pushing broken commits. Reviewed-by: bjorn.
* Some random code cleanupErik Schilling2012-02-261-33/+25
| | | | | | Moved a code comment about syncmessages to the bugtracker: #473. Reviewed-by: bjorn.
* Clear the gid flags before processing themThorbjørn Lindeijer2012-02-032-12/+21
| | | | | | | Also read the gids as unsigned integers since that's how Tiled writes them to prevent the number going negative when the highest flag is used. Reviewed-by: Yohann Ferreira
* Added a way to specify the min and max attributes values.Yohann Ferreira2012-02-028-49/+129
| | | | | | | | | This can now be done in attributes.xml through the minimum and maximum attribute parameters. I also changed the AttributeInfo struct as requested by bjorn. Reviewed-by: Erik Schilling, Thorbjørn Lindeijer
* Removed logging of chatErik Schilling2012-01-221-3/+0
| | | | Reviewed-by: Bertram
* Made @announce fully functionalErik Schilling2012-01-211-7/+8
| | | | | | | - Added announcements having senders now. - Removed /announcement support. Reviewed-by: Bjorn.
* Fixed the chr_inv_count function to handle equipment.Yohann Ferreira2012-01-182-10/+37
| | | | | | | | | | | | | | | the function can now count in the inventory and/or the player's equipment. I also fixed the script function and added a use case in the example map. + Fixes after Ablu's review. + 2nd fix after Ablu's review: Fix the inventory remove behaviour. Resolves: Mana-Mantis #288 Reviewed-by: Ablu
* Made the game server execute the chr_respawn_accept script evenYohann Ferreira2012-01-104-19/+52
| | | | | | | | | | | | | | | | | | | in case of disconnection. I made the Character::disconnected() function handle that case, permitting also to centralize GameState::remove() calls there. I also made the GameState::enqueueWarp() function test whether the Character pointer is about to be deleted, so that the warp can be handled directly to avoid a crash. Last but not least, I also made the Character::update() function not update the Character specials and hp to avoid discrepancies seen in the client. Resolves: Mana-Mantis #309. Reviewed-by: Ablu.
* Added unequip lua script functions.Yohann Ferreira2012-01-102-0/+46
| | | | | | | | | | You can unequip using the slot or an item id. + Fixes from Ablu's review. Resolves: Mana-Mantis #350. Reviewed-by: Ablu.
* Added equip lua script functions.Yohann Ferreira2012-01-102-1/+16
| | | | | | | | | | 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.
* Fixed code not getting executed since it was behind a returnErik Schilling2012-01-031-1/+1
| | | | Reviewed-by: o11c.
* Made all beings capable of having a genderErik Schilling2012-01-028-24/+29
| | | | Reviewed-by: o11c, bjorn, Bertram.
* Added @skills command which lists all skillsErik Schilling2011-12-041-0/+41
| | | | Reviewed-by: o11c.
* Prevented the equipment to remove the item when something went wrong.Yohann Ferreira2011-11-121-10/+12
| | | | Reviewed-by: Thorbjorn Lindeijer.
* Made the server warn the player when equip/unequip failed.Yohann Ferreira2011-11-121-4/+15
| | | | Reviewed-by: Erik Schilling
* Merged three global script states into oneThorbjørn Lindeijer2011-11-073-9/+9
| | | | | | | | | | | | | | | | | 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
* Small cleanups in utils::TimerThorbjørn Lindeijer2011-11-071-1/+1
| | | | | | | | * Not nice to pass boolean parameter to constructor for preventing the timer from running on creation. Just call 'start' on it explicitly. * getTimeInMillisec could be made static. Reviewed-by: Yohann Ferreira
* Added @permissions commandErik Schilling2011-11-021-18/+47
| | | | | | | Added @permissions <character> which lists the permissions of a player. Made @givepermission giving feedback on success. Reviewed-by: Thorbjørn Lindeijer.
* Removed the inventory checkThorbjørn Lindeijer2011-11-011-46/+0
| | | | | | | | | | | | We can't arbitrarily remove inventory items on initialization, and shouldn't have to, because what's in the DB was correct when it was stored. Also, there should be no need to check the inventory after inserting items, since the insert method should already make sure not to insert items when there is no space. Reviewed-by: Yohann Ferreira
* Have one place where the Configuration is initializedThorbjørn Lindeijer2011-11-011-44/+12
| | | | | | | | Also, removed the fallback to the standard config file path when a config file path is specified on the command line. Surely that's not what you would want to happen. Reviewed-by: Yohann Ferreira
* Merge github.com:mana/manaservYohann Ferreira2011-11-016-20/+51
|\ | | | | | | | | | | Conflicts: src/game-server/character.cpp src/scripting/lua.cpp
| * Made @money functional again.Erik Schilling2011-10-231-6/+5
| | | | | | | | Reviewed-by: Thorbjørn Lindeijer.
| * Added function to determine the script engine by the file name extensionjurkan2011-10-234-11/+41
| | | | | | | | Reviewed-by: Bjorn, Bertram.
| * Added a default skill id getter in the skill manager.Yohann Ferreira2011-10-221-0/+4
| | | | | | | | | | | | | | | | I also added a link to the skillmanager object in its header file. This will later be used to get info from elsewhere than the server main loop. Reviewed-by: Bjorn.
| * Officially added the being gender to the protocol.Yohann Ferreira2011-10-222-5/+19
| | | | | | | | Reviewed-by: o11c.