summaryrefslogtreecommitdiff
path: root/src/game-server
AgeCommit message (Collapse)AuthorFilesLines
2012-03-02Use callbacks for handling character death and respawnThorbjørn Lindeijer2-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
2012-03-02Merged all the different Lua states into oneThorbjørn Lindeijer14-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
2012-02-28Fixed bug with erasing the last status effectThorbjørn Lindeijer1-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
2012-02-27Prevent calculating movement of being further if it does not moveErik Schilling1-0/+4
Reviewed-by: bjorn.
2012-02-27Fixed compilation again + some more code cleanupErik Schilling1-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.
2012-02-26Some random code cleanupErik Schilling1-33/+25
Moved a code comment about syncmessages to the bugtracker: #473. Reviewed-by: bjorn.
2012-02-03Clear the gid flags before processing themThorbjørn Lindeijer2-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
2012-02-02Added a way to specify the min and max attributes values.Yohann Ferreira8-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
2012-01-22Removed logging of chatErik Schilling1-3/+0
Reviewed-by: Bertram
2012-01-21Made @announce fully functionalErik Schilling1-7/+8
- Added announcements having senders now. - Removed /announcement support. Reviewed-by: Bjorn.
2012-01-18Fixed the chr_inv_count function to handle equipment.Yohann Ferreira2-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
2012-01-10Made the game server execute the chr_respawn_accept script evenYohann Ferreira4-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.
2012-01-10Added unequip lua script functions.Yohann Ferreira2-0/+46
You can unequip using the slot or an item id. + Fixes from Ablu's review. Resolves: Mana-Mantis #350. Reviewed-by: Ablu.
2012-01-10Added equip lua script functions.Yohann Ferreira2-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.
2012-01-03Fixed code not getting executed since it was behind a returnErik Schilling1-1/+1
Reviewed-by: o11c.
2012-01-02Made all beings capable of having a genderErik Schilling8-24/+29
Reviewed-by: o11c, bjorn, Bertram.
2011-12-04Added @skills command which lists all skillsErik Schilling1-0/+41
Reviewed-by: o11c.
2011-11-12Prevented the equipment to remove the item when something went wrong.Yohann Ferreira1-10/+12
Reviewed-by: Thorbjorn Lindeijer.
2011-11-12Made the server warn the player when equip/unequip failed.Yohann Ferreira1-4/+15
Reviewed-by: Erik Schilling
2011-11-07Merged three global script states into oneThorbjørn Lindeijer3-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
2011-11-07Small cleanups in utils::TimerThorbjørn Lindeijer1-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
2011-11-02Added @permissions commandErik Schilling1-18/+47
Added @permissions <character> which lists the permissions of a player. Made @givepermission giving feedback on success. Reviewed-by: Thorbjørn Lindeijer.
2011-11-01Removed the inventory checkThorbjørn Lindeijer1-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
2011-11-01Have one place where the Configuration is initializedThorbjørn Lindeijer1-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
2011-11-01Merge github.com:mana/manaservYohann Ferreira6-20/+51
Conflicts: src/game-server/character.cpp src/scripting/lua.cpp
2011-10-23Made @money functional again.Erik Schilling1-6/+5
Reviewed-by: Thorbjørn Lindeijer.
2011-10-23Added function to determine the script engine by the file name extensionjurkan4-11/+41
Reviewed-by: Bjorn, Bertram.
2011-10-22Added a default skill id getter in the skill manager.Yohann Ferreira1-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.
2011-10-22Officially added the being gender to the protocol.Yohann Ferreira2-5/+19
Reviewed-by: o11c.
2011-10-22.find() -> .value due to recent API changes.Yohann Ferreira1-1/+1
2011-10-22Merge branch 'master' of github.com:mana/manaservYohann Ferreira4-5/+5
2011-10-20Return a const & from NameMap to avoid potential deep copiesThorbjørn Lindeijer4-5/+5
When I introduced NameMap it was only used with pointers, but now it is also used with std::string so it probably makes sense to keep a default- constructed value around so that a reference can be returned rather than a copy. NameMap::find was renamed to NameMap::value to make it more clear that it doesn't return an iterator, like std::map::find. Reviewed-by: Yohann Ferreira Reviewed-by: Ben Longbons
2011-10-19Merge branch 'master' of github.com:mana/manaservYohann Ferreira11-349/+317
Conflicts: src/game-server/accountconnection.cpp
2011-10-19Have one place where the Logger is initializedThorbjørn Lindeijer1-18/+1
log_accountToStandardOutput and log_gameToStandardOutput have been merged together as log_toStandardOutput. Reviewed-by: Yohann Ferreira
2011-10-19Took interpreting the objects out of the map readerThorbjørn Lindeijer8-216/+229
The map reader is now only concerned with parsing the XML, whereas the MapComposite turns some of the objects into Warps, Spawns and NPCs. Reviewed-by: Yohann Ferreira
2011-10-19Removed inappropriate assignment to mOld in Being::findPathThorbjørn Lindeijer1-5/+7
Being::findPath doesn't change the position of a being, and so should not be syncing mOld to the current position. When invoked on the wrong moment, this could cause MapComposite::update to fail to realize that a being has moved into another zone. Also removed some other usages of mOld that were not necessary, to make its purpose clearer and make a potential cleanup easier. Reviewed-by: Yohann Ferreira
2011-10-15Added script bindings for reading map objectsErik Schilling3-154/+124
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
2011-09-28Started to fix the autoattack system.Yohann Ferreira4-46/+36
I simply made the default autoattack look for the default skill and add exp to it when killing monsters. Now the player can earn xp again even if it's not well handled between two logins.
2011-09-28Added a default skill id getter in the skill manager.Yohann Ferreira1-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.
2011-09-28Officially added the being gender to the protocol.Yohann Ferreira2-5/+17
2011-09-28Merge github.com:mana/manaservYohann Ferreira4-14/+16
Conflicts: src/game-server/inventory.cpp src/game-server/inventory.h src/game-server/item.h src/game-server/main-game.cpp src/game-server/skillmanager.cpp src/utils/point.h
2011-09-28Clarified the role of initialize() and reload() functions in the monsterYohann Ferreira2-6/+8
and item managers. ack-by: o11c. note: The managers still need to auto deinit when already loaded. This will be done in another trivial commit.
2011-09-28Fixed mem leak on the item and monster manager unloading processYohann Ferreira3-8/+16
Reviewed-by: o11c. Note: the initialize/reload() api problem will be fixed in another commit.
2011-09-28Added a bit more precision on the conditions used in the ↵Yohann Ferreira2-2/+6
TriggerArea::update() function.
2011-09-28Rewrote the skill manager the same way as the item manager.Yohann Ferreira2-128/+149
This will permit better handling of both skills names and id. This is needed to start reworking on the auto-attack system.
2011-09-28Turned the skill manager into a class.Yohann Ferreira3-7/+24
Ack-by: o11c.
2011-09-28Fixed the trigger area declared within map files.Yohann Ferreira1-1/+5
The bug was pretty generic, as the contains() method of the Rectangle class wasn't checking against left and top sides according to the client view point. I also documented the call site. Resolves: Mana-Mantis #317. Reviewed-by: o11c.
2011-09-28Small random code format cleanups, and documentation fixes.Yohann Ferreira4-78/+49
This doesn't change anything yet. Reviewed-by: o11c.
2011-09-15Added chatcommand to get position of a character.Erik Schilling1-0/+33
Add chatcommand @getpos <character> which return the mapid and location of the character. Part of: Mana-Mantis: #385. Reviewed-by: Bertram.
2011-09-13Avoid crashing the game server when the last argument is quoted.Yohann Ferreira1-1/+9
Resolves: Mana-Mantis #386 Reviewed-by: o11c.