summaryrefslogtreecommitdiff
path: root/src/game-server/character.h
AgeCommit message (Collapse)AuthorFilesLines
2013-03-25Changed NPC to an NpcComponent added to a BeingThorbjørn Lindeijer1-7/+0
2013-03-25Changed SpawnArea and TriggerArea to components of EntityThorbjørn Lindeijer1-0/+1
Well, first visible change is that everything just gets longer to read. Reviewed-by: Yohann Ferreira
2013-02-04Moved attribute (re)calculation to the scriptsErik Schilling1-5/+5
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.
2013-01-09Replaced EventListener with signals based on libsigc++Thorbjørn Lindeijer1-0/+2
This replaces the rather hard to understand event dispatcher with a probably even harder to understand templated library, but fortunately we can rely on the available documentation. Hopefully it will also help with the readability of our code and with adding additional signals to other classes. Added libsigc++ to README and Travis CI configuration. Reviewed-by: Erik Schilling
2013-01-09Replaced 'unsigned int' with 'unsigned'Thorbjørn Lindeijer1-6/+6
Same thing, but shorter.
2013-01-08Work on (Auto)Attack system.Erik Schilling1-0/+6
During the implementation bjorn and I agreed to limit the number of attacks that can be used in the same tick to one. This makes a lot of stuff easier and the client cannot display two frames at the same time Things done: - Implemented setting of attacks when equipping/unequipping items - Single place where the xml attack node is parsed - Finished attack logic - Unified the attack handling of monsters and characters - Added a global cooldown after attack use (not only for next use of same attack) - Removed the temponary attributes for the monster attack values - Priorities for all attacks - Rewrote the attack core: - Attacks now have this attributes: - warmup -> time a attack needs after starting it to actually deal the damage - cooldown -> time a attack needs after dealing damage before another attack can be used - reuse -> time before the same attack can be used again - If no attack is performed at the moment the following is done: - make a list with all ready attacks - check for attack that has the necessarily range and highest priority - start this attack (inform client about it) - when warmup is finished -> trigger damage - when cooldown is finished -> allow to use other (or the same if reusetimer allows) attacks TODO: - sync client with this to allow better timed animations
2012-07-08Added bind for setting login callbackErik Schilling1-0/+6
Reviewed-by: bjorn.
2012-04-14Introduced a Timeout class for counting down without countingThorbjørn Lindeijer1-2/+4
The timeout remembers a reference point of time against which it can check how much time is remaining. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
2012-04-04Enhanced special supportErik Schilling1-14/+49
- 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-26Some general cleanups and merged Being::perform() into update()Thorbjørn Lindeijer1-8/+5
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
2012-03-13Added script bind to set walkmask for beingsErik Schilling1-7/+0
TODO: Inform client about this change. Reviewed-by: bjorn.
2012-03-11Removed the create_npc wrapper and the last two NPC callbacksThorbjørn Lindeijer1-2/+23
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-10Moved the managing of NPC script coroutines into C++Thorbjørn Lindeijer1-0/+9
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-02Use callbacks for handling character death and respawnThorbjørn Lindeijer1-1/+11
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
2012-01-10Made the game server execute the chr_respawn_accept script evenYohann Ferreira1-0/+10
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.
2012-01-02Made all beings capable of having a genderErik Schilling1-8/+0
Reviewed-by: o11c, bjorn, Bertram.
2011-09-28Officially added the being gender to the protocol.Yohann Ferreira1-4/+3
2011-03-20Moved defines.h and manaserv_protocol.h into 'common'Thorbjørn Lindeijer1-2/+2
Just seems a bit more organized to me.
2011-03-11Moved freeing of map position to Actor destructorThorbjørn Lindeijer1-2/+0
It was done in both the Character and the Monster destructors, but I don't see how any Actor should be excluded from this. Now it also happens for NPC, Effect and Item, though only NPC has a relevant walkmask. Also fixed a small issue introduced in 97e0a9eb170499 and added an assert to freeTile. We should be able to assert that a tile can only be freed if it was blocked. Reviewed-by: Stefan Dombrowski
2011-03-11Split path finding out of the Map classThorbjørn Lindeijer1-2/+2
Extracted the path finding algorithm out of the Map class and introduced a new class called PathInfo that has the path finding information that used to be part of MetaTile. This allows a single vector of path information to be shared between all maps running on the server, significantly reducing the memory overhead per map (for 200x200 maps, the memory reduction is about 1 MB per map). Part of this change is some cleanup, like moving the 'occupation' counts into MetaTile, inlining some methods for performance reasons, and using STL to simplify memory management. Mantis-issue: 106 Reviewed-by: Bertram
2010-12-29protocol.h -> manaserv_protocol.h to avoid conflicts with mysql files.Yohann Ferreira1-1/+1
Resolves: Mana-Mantis #278.
2010-11-14Renamed .hpp files into .h for consistency.Yohann Ferreira1-0/+467
Also added an header to the autoattack.{h,cpp} files. Big but trivial fix.