summaryrefslogtreecommitdiff
path: root/src/game-server/itemmanager.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-08-26[Abilities] Removed the old autoattack systemErik Schilling1-6/+0
As a side effect i had to remove the monster attack AI for now. I will readd this as next thing.
2013-04-29Single xml solutionPrzemysław Grzywacz1-86/+48
Mana-mantis: #506.
2013-04-02Fixed multiple warnings and errors that blocked c++0xErik Schilling1-2/+1
This allows the server to compile with c++0x (and enables it). This also includes some coding style / readabillity fixes.
2013-01-09Replaced 'unsigned int' with 'unsigned'Thorbjørn Lindeijer1-8/+8
Same thing, but shorter.
2013-01-08Work on (Auto)Attack system.Erik Schilling1-58/+60
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
2013-01-08Rename AutoAttack to AttackErik Schilling1-1/+1
2012-03-03Use callbacks for items, monsters and status effectsThorbjørn Lindeijer1-38/+13
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-02Merged all the different Lua states into oneThorbjørn Lindeijer1-14/+5
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
2011-11-01Merge github.com:mana/manaservYohann Ferreira1-1/+4
Conflicts: src/game-server/character.cpp src/scripting/lua.cpp
2011-10-23Added function to determine the script engine by the file name extensionjurkan1-1/+4
Reviewed-by: Bjorn, Bertram.
2011-10-22.find() -> .value due to recent API changes.Yohann Ferreira1-1/+1
2011-10-22Merge branch 'master' of github.com:mana/manaservYohann Ferreira1-1/+1
2011-10-20Return a const & from NameMap to avoid potential deep copiesThorbjørn Lindeijer1-1/+1
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-09-28Merge github.com:mana/manaservYohann Ferreira1-3/+4
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 Ferreira1-3/+4
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-08-30As requested, changed the trigger 'existence' to 'in-inventory'.Yohann Ferreira1-2/+2
2011-08-19Changed the sprite layer protocol to supportYohann Ferreira1-7/+9
an arbitrary number of layers. (up to 255).
2011-08-19Used the client base to make a final bugfix on the server code.Yohann Ferreira1-6/+15
Made the server handle only one slot type requirement since it's irrelevant to have more anyway. Plus, it simplifies the code for both equipping/unequipping. I also added a dagger to show how equipping/unequipping is working.
2011-08-10Changed ItemEquipInfo to only be a pair of unsigned.Yohann Ferreira1-6/+4
Previously it was a list of pair ofunsigned int, used to get the equipment slot requirements. It didn't make sense as the ItemEquipsInfo was already a list of it. So you had to manage with a list of list and that ended up being irrelevant to the need. I had to disable the equip function to permit compilation. This will be fixed in my next commit.
2011-08-10Fixed getting slot id per name.Yohann Ferreira1-5/+19
2011-07-27Reworked the way equip slot info are loaded in a more logical way.Yohann Ferreira1-56/+49
2011-04-19Implemented scriptable effects on item use and dispell.Yohann Ferreira1-7/+40
Reviewed-by: Thorbjorn.
2011-03-24Rely more on the functionality in XML::DocumentThorbjørn Lindeijer1-21/+7
By default XML::Document will use the ResourceManager to resolve the file name you pass to it. There is no point in disabling that functionality only to resolve it manually. Reviewed-by: Jared Adams
2011-03-24Use a map to quickly find items and monsters by their nameThorbjørn Lindeijer1-28/+24
Introduced a template class NameMap, which provides a nice API for mapping any custom types by their name. This change also makes any duplicate item or monster definitions be complete ignored, rather than being merged into the first definition. Reviewed-by: Philipp Sehmisch Reviewed-by: Yohann Ferreira
2011-03-20Renamed some members to adhere to naming standardThorbjørn Lindeijer1-22/+22
2011-03-20Introduced separate functions for item database loadingThorbjørn Lindeijer1-288/+313
This splits the huge ItemManager::reload() into readEquipSlotsFile() and readItemsFile(), the latter of which is further split up into multiple functions for reading the different elements. Just to keep the amount of nesting down and increase the readability. Removes the need for huge eye-catching comment blocks. Reviewed-by: Freeyorp
2011-03-20Introduced ModifierLocation structThorbjørn Lindeijer1-3/+3
Easier to understand than a std::pair<unsigned int, unsigned int>, or functions like getTagFromInfo(unsigned int, unsigned int), which does not make clear what that "info" actually is. Now it's simply getTag(const ModifierLocation &location), documenting itself and also allowing the name to be shorter. Reviewed-by: Freeyorp
2011-03-20Moved defines.h and manaserv_protocol.h into 'common'Thorbjørn Lindeijer1-1/+1
Just seems a bit more organized to me.
2011-03-20General cleanups and code style fixesThorbjørn Lindeijer1-2/+2
A bunch of variables that were continuously requested from the configuration are now members of the AccountHandler. Reviewed-by: Freeyorp
2011-03-17Micro-optimizations related to std::stringThorbjørn Lindeijer1-10/+14
* Rely on the fact that a std::string is empty by default * Use std::string::empty() rather than comparing to "" * Construct with std::string() rather than from "" Reviewed-by: Bertram
2011-03-16Allowed item names instead of IDs in @commandsPhilipp Sehmisch1-0/+18
The @drop and @item commands can now accept an item name instead of an item ID. In addition the amount can be omitted to create a single item.
2010-11-14Renamed .hpp files into .h for consistency.Yohann Ferreira1-7/+7
Also added an header to the autoattack.{h,cpp} files. Big but trivial fix.
2010-10-22Made the servers check for positive id in xml db loading.Yohann Ferreira1-3/+3
Also fixed a memleak when loading an invalid monster attack. Resolves: Mana-Mantis #215. Reviewed-by: Thorbjorn.
2010-07-10Add in stubs for scripted item effectsFreeyorp1-0/+22
2010-07-10New attribute system and major changes to many low-level areas.Freeyorp1-123/+251
Attribute system: Structure is no longer completely hardcoded. Attributes and structure is defined by new xml file (defaulting to stats.xml) Structure defines non-base modifications to an attribute, to be used by modifiers from items, effects, etc. Calculating the base value for core attributes is still done in C++ (and for such fundamental elements the only reason I can think of to do it any other way is perhaps being able to quickly change scripts without a compile could be useful for testing, but such things are a low priority anyway) Item structure: Modifiers are now through triggers rather than single events. This also removes hardcoded types - an item could be both able to be equipped and be able to be activated. Item activation no longer consumes by default, this must be specified by the property <consumes /> inside the trigger. Currently only attribute modifications, autoattacks, and consumes are defined as effects, but stubs for others do exist. Autoattacks are currently non-functional, and this should be rectified with some urgency. Auto Attacks: AutoAttacks are now separate entities, though not fully complete, nor fully integrated with all beings yet. Integration with the Character class is urgent, integration with other Being children less so. When fully integrated this will allow for multiple autoattacks, through equipping multiple items with this as an equip effect or even through other means if needed. Equipment structure: As ItemClass types are no longer hardcoded, so too are equip types. An item have multiple ways to be equipped across multiple equipment slots with any number in each slot. Character maximums are global but configurable. Miscellaneous: Speed, money, and weight are now attributes. Some managers have been changed into classes such that their associated classes can have them as friends, to avoid (ab)use of public accessors. The serialise procedure should also be set as a friend of Character (both in the account- and game- server) as well; having public accessors returning iterators is simply ridiculous. Some start for such cleanups have been made, but this is not the primary focus here. Significant work will need to be done before this is resolved completely, but the start is there. BuySell::registerPlayerItems() has been completely disabled temporarily. The previous function iterated through equipment, yet in the context I think it is intended to fill items? I have been unable to update this function to fit the modifications made to the Inventory/Equipment/Possessions, as I am unsure what exactly what it should be doing. ItemClass::mSpriteId was previously unused, so had been removed, but I notice that it was used when transmitting equipment to nearby clients. Experimentation showed that this value was never set to anything other than 0, and so has been left out of the ItemManager rewrite. I am not entirely sure what is happening here, but it should be worth looking into at a later time, as I am not sure how equipment appearences would be sent otherwise.
2010-05-30Use XML::Document to automate memory cleanupThorbjørn Lindeijer1-39/+25
Makes the code a little nicer.
2010-05-29Only skip the UTF-8 BOM for Lua scriptsThorbjørn Lindeijer1-2/+1
libxml2 should be able to handle files with a BOM fine. Reviewed-by: Bertram
2010-05-28Added some more log infos, and made small cleanups.Yohann Ferreira1-3/+5
Reviewed-by: Thorbjorn, Jaxad0127
2010-05-16Changed and split up the default location for loading dataThorbjørn Lindeijer1-4/+3
Instead of loading data from a 'data' directory in the current working directory, the server now uses clientDataPath and serverDataPath as specified in the configuration. This removes the need to set up symbolic links in order to merge these two types of data. The default values point to example/clientdata and example/serverdata, where a minimal example world can be developed to make setting up an initial server quick and easy. The XML::Document convenience class was copied over from the client. Also, the ResourceManager is now shared between both servers, since the account client is reading items.xml. Reviewed-by: Jared Adams
2010-04-25Added a Byte Order Mask (BOM) filter to the ResourceManager.Bertram1-1/+2
Reviewed by: Jaxad0127
2010-02-07Update Copyright date for Manaserv.Bertram1-1/+1
2009-12-28Added support for skill names as weapon types in items.xml (still hardcoded)Philipp Sehmisch1-2/+6
2009-12-06Fixed name of the project in copyright headersThorbjørn Lindeijer1-7/+6
Also updated the headers to refer to the GPL by URL instead of suggesting to contact the FSF by snail mail, as per the latest GPL usage instructions.
2009-12-06A host of code style changesThorbjørn Lindeijer1-1/+1
Removed pointless void in method parameter lists, fixed methods and variables that started with upper case, removed pointless 'const' for stuff passed by value, made some getters const, etc.
2009-08-19Removed attack shape from items. Added distance check on attacks (values ↵Philipp Sehmisch1-41/+2
still hardcoded). performAttack now takes a target and a range argument instead of determining the target with accumulate&fire
2009-07-03Makes Skills non hard codedChuck Miller1-5/+3
It should be noted that Jax still needs to update the client Level calulation seems broken now too
2009-04-26Standardize on the position of the const keywordBjørn Lindeijer1-1/+1
Same as for the client.
2009-01-17Filenames of item use scripts are now taken from the items.xmlPhilipp Sehmisch1-13/+16
2008-11-16Got rid of CVS/Subversion $Id$ markersBjørn Lindeijer1-2/+0
2008-11-14Added check for database version on startup of Accountserver.Andreas Habel1-9/+1
The provided CreateTable.sql scripts store their versions inline of a database table. The account server checks this version number with its known compatible version. If the numbers don't match, the account server raises an error and shuts down.