summaryrefslogtreecommitdiffstats
path: root/src/game-server
Commit message (Collapse)AuthorAgeFilesLines
...
* | Changed the protocol a bit to use int16 instead of 8.Yohann Ferreira2011-07-271-4/+4
| | | | | | | | | | | | This is in preparation of fixes for issues: #373, and 379. Equip and inventory related packets are the only ones changed.
* | Begun Applying the new equipment slot handling design.Yohann Ferreira2011-07-273-46/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | now, the equipment slots are independant from the inventory slots according to the inventory and equipment data. This will permit to avoid checking the equipment each time one touches the inventory and vice versa, and make the former delayed mode useless. Also, note that equipped items will be removed from inventory and readded once unequipped. The design will permit the following, even if not implemented yet: - To make equipment items stackable again, if wanted. - Have more than one item with the same id equipped on different slots using the itemInstance field. Note: I didn't add the database structure updates yet, to see whether other changes may later go along with those.
* | Removed the inventory delay mode for now.Yohann Ferreira2011-07-273-278/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I said I wouldn't do it, but I change my mind. Here is why: The delay mode is used in the trading code, and in the inventory code for lua only. In the lua part, the delay mode is useless as it is used only when the script is requesting removal of more items than owned. This is something that can't be handled well anyway, as for the script part, even when the character was still keeping its items. Plus, it's not actually an error, IMHO. In the trading code, it made sense. But the next commit will bring design changes making the inventory items and the equipment items not linked anymore. Hence, making it impossible to trade equipped items, for instance, which is a good thing IMHO. It will also remove the need of a delayed inventory mode in that case. The two cases where it is used will disappear, making it useless. Last but no least, the part watching for equipment changes in the commit() function is not something easy to debug without first having a proper and working base. (checking of two multimaps changes, for instance). We can add it back once the code has been fully debugged for the most skilled among us. And yes, I am sure of what I'm currently doing. For now the whole inventory and trading code is in need of review but it already was, anyway.
* | Small random code format cleanups, and documentation fixes.Yohann Ferreira2011-07-274-78/+49
|/ | | | This doesn't change anything yet.
* Fixed autoattacks basic handling.Yohann Ferreira2011-06-244-15/+59
| | | | | | | | | | | | | | | | The server is now using the autoattacks system to perform damage based on the attack's timer. I also added a default bare knuckle attack when the character is unequipped. As a result, maggots can be killed again with bare hands now. Known issues left: This isn't tested against equipment changes for now, and the client isn't in sync with the attacks speed. Reviewed-by: Crush.
* Changed the attack message to send the attack id.Yohann Ferreira2011-06-173-6/+7
| | | | | | | | | | This is more precise than sending the attack type, that can be guessed by the client anyway when the type parameter will be added in the <attack> tag. This is the server part of Mana issue: #363. Reviewed-by: Bjorn.
* Fixed crash when handling unequipThorbjørn Lindeijer2011-06-021-5/+13
| | | | | | | | | | | | | * The 'itp' parameter is no longer simply ignored (seems to be a small optimization in Inventory::remove) * Avoid incrementing an invalid iterator, fixing a crash (problem found by Stefan Dombrowski) * Use the right inventory index in the call to changeEquipment, which previously was using "it", which would be equal to "it_end" there. Reviewed-by: Stefan Dombrowski
* Routing party invite through the map serverStefan Dombrowski2011-05-302-0/+45
| | | | | | | | The player sends party invites to the game server. If the invitee is within the visual range of the inviter, the game server forwards the invite to the chat server. Reviewed-by: Bjorn, Jaxad0127
* Allow monsters to drop multiple itemsStefan Dombrowski2011-05-262-27/+12
| | | | | | | Before at most one item was droped and the sum of all probablilites was limited to 100%. Also in the example data drops are changed to existing items.
* Fixing negative being positionsStefan Dombrowski2011-05-261-1/+4
| | | | Reviewed-by: Jaxad0127
* Fixed an item dupe bugAngelo Castellani2011-05-171-4/+15
| | | | | | | Listed: http://bugs.manasource.org/view.php?id=324 Reviewed-by: Yohann Ferreira Reviewed-by: Jared Adams
* Removed unused variableThorbjørn Lindeijer2011-05-151-3/+1
|
* Fixed compile with GCC 4.6Thorbjørn Lindeijer2011-05-152-1/+2
| | | | | | * Include cstddef to be able to use size_t * Replace NULL with 0 since NULL doesn't happen to be defined in any included header file
* Renamed the mana-status-effects.xml to status-effects.xmlYohann Ferreira2011-05-011-1/+1
| | | | | In fact, the client never prefixed that file. Hence, the server doesn't have to.
* Changed the server to look for the skills.xml file.Yohann Ferreira2011-05-011-1/+1
| | | | | This, instead of the mana-skills.xml file, to follow latest client changes.
* Added a simple crafting systemPhilipp Sehmisch2011-04-272-0/+80
| | | | | | | | | | | | | | | | | | | | | | | | A client can craft something using the @craft command. The command needs a list of item names and amounts. The gameserver checks if the character has these items in the inventory and then passes the list together with the character handle to the lua script function on_craft in the script file scripts/crafting.lua. This function can then be used to evaluate if the list is a valid crafting combination and when this is the case take or give items. Implemented two example crafting scripts there, one which enforces exact item order and amount and one which doesn't. Both are disabled per default and one needs to be enabled by uncommenting a line. Also gave the player group permission to use the @craft command in permissions.xml and added two new items (wood and iron) required for the example crafting combination. Resolves: #333 Reviewed-by: bcs86, Bertram
* Implemented scriptable effects on item use and dispell.Yohann Ferreira2011-04-193-17/+87
| | | | Reviewed-by: Thorbjorn.
* Made the server send the being position each 5 seconds.Yohann Ferreira2011-04-181-3/+13
| | | | | | | This will permit the client the make position resyncs when necessary, and make use of the MOVING_POSITION and DESTINATION where relevant. Reviewed-by: Thorbjorn.
* Added of precised some info I found very useful while debugging.Yohann Ferreira2011-04-172-8/+28
| | | | Reviewed-by: Jaxad0127.
* Removed useless calls to updateDerivedAttributes().Yohann Ferreira2011-04-172-2/+0
| | | | | | The setAttribute() already takes care of updating them. Reviewed-by: Jaxad0127.
* Removed an unecessary call to attribute recalculation for monsters.Yohann Ferreira2011-04-171-1/+0
| | | | | | | | | | | The only need to call this function was to trigger derived attributes recalculation as the base attribute recalulation does nothung for monsters atm. And this is useless as setAttribute() already triggers derived attributes recalulation. Reviewed-by: Jaxad0127.
* Fix beings raw speed calculation when obtaining the TPS speed.Yohann Ferreira2011-04-171-1/+6
| | | | | | The bug made the monsters unable to move. Reviewed-by: Jaxad0127.
* Set log verbosity earlier in game server to actually help debug.Yohann Ferreira2011-04-161-6/+6
| | | | | | Before that, all the loading information were kept at info level. Trivial.
* Fixed crash on first map updateThorbjørn Lindeijer2011-04-152-0/+16
| | | | | | | | | | | | The crash happened when it was trying to move an NPC from its old zone to its new zone. The old zone was based on the old position, which was (0,0). That crashed since its zone didn't match its old position, but its new one. This fix makes sure to update the old position to be in sync with the zone, by resetting it after being inserted into the MapComposite. Reviewed-by: Yohann Ferreira
* Initialize attribute base and cached modified valuesThorbjørn Lindeijer2011-04-101-0/+2
| | | | | | | | | | | | | Attributes that didn't get a value yet are not communicated from account to game server. This could leave some attributes with uninitialized (random) values, like the amount of gold or some uncalculated attack speed bonus. Defaulting the value to 0 seems to be appropriate for all current cases. When another default value should be used, it can be specified in attributes.xml and will be sent from the account server. Reviewed-by: Stefan Dombrowski
* Fixing reading of drop rate from monsters.xmlStefan Dombrowski2011-04-041-2/+2
| | | | | | | The xml gives the drop rate as a floating point number. Also added 0.5 for correct rounding. (Without it 0.7% calculates to 69.) Reviewed-by: Jaxad0127
* Changed SYNC_BUFFER_SIZE to unsigned to avoid compiler warningThorbjørn Lindeijer2011-04-031-2/+5
| | | | | | It's being compared to an unsigned integer. Reported-by: Stefan Dombrowski
* Split GameHandler::processMessage up into multiple functionsThorbjørn Lindeijer2011-04-022-394/+481
| | | | | | | | | | | One huge function that handles all the messages isn't very readable and causes everything to be indented by several levels. Hence we generally split this up. It also exposed a missing 'break;' when handling the PGMSG_USE_SPECIAL message, which would continue into the handling of PGMSG_ACTION_CHANGE. Reviewed-by: Stefan Dombrowski
* Some cleanups related to syncing from game to account serverThorbjørn Lindeijer2011-04-022-26/+23
| | | | | | | | | | | | | | | | | | | * Remove SYNC_END_OF_BUFFER since the end of a message can already be identified by no more data being available. * Consistently prefix ++ rather than postfix ++ when incrementing mSyncMessages. * Made SYNC_BUFFER_SIZE into constants rather than defines, and moved them into the .cpp file since they're not used anywhere else. * Just use 1 and 0 to indicate online status. No point in writing it like 0x01 and 0x00. * Merged some duplicated documentation for AccountConnection::syncChanges. Reviewed-by: Jared Adams
* Rely more on the functionality in XML::DocumentThorbjørn Lindeijer2011-03-245-60/+18
| | | | | | | | 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
* Use a map to quickly find items and monsters by their nameThorbjørn Lindeijer2011-03-244-58/+54
| | | | | | | | | | | 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
* Fixed problems with loading XML files containing Windows newlinesThorbjørn Lindeijer2011-03-232-77/+16
| | | | | | | | | | | | | | By using xmlParseFile instead of xmlParseMemory, the system-dependent newlines should be handled automatically. The .tmx.gz files should still be supported, but instead of manually decompressing them the xmlParseFile function should take care of that. It also fixes the leaking of XML documents in both the SkillManager as well as the PermissionManager, since they now rely on XML::Document, which cleans up automatically. Reviewed-by: Stefan Dombrowski
* Renamed some members to adhere to naming standardThorbjørn Lindeijer2011-03-202-25/+25
|
* Introduced separate functions for item database loadingThorbjørn Lindeijer2011-03-203-299/+337
| | | | | | | | | | | 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
* Introduced ModifierLocation structThorbjørn Lindeijer2011-03-203-25/+41
| | | | | | | | | | | 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
* Introduced some functions for reading the attributes fileThorbjørn Lindeijer2011-03-202-148/+159
| | | | | | | Keeps the code indentation within reasonable limits and makes the structure easier to follow. Reviewed-by: Freeyorp
* Renaming stuff to make the code more readableThorbjørn Lindeijer2011-03-207-34/+36
| | | | | | | | | | | | | | | | | | | | SCOPE_TYPES -> ScopeType (plural was confusing) ATTR_BEING -> BeingScope ATTR_CHAR -> CharacterScope ATTR_MOD -> MonsterScope ATTR_MAX -> MaxScope AttributeScopes -> AttributeScope (A single scope seems to include multiple lists of attributes. Seems wrong to me to name this type in plural form.) getAttributeInfoForType -> getAttributeScope (just naming it after what it is actually returning) Reviewed-by: Freeyorp
* Moved defines.h and manaserv_protocol.h into 'common'Thorbjørn Lindeijer2011-03-209-11/+11
| | | | Just seems a bit more organized to me.
* Some renamings to try to make things more readableThorbjørn Lindeijer2011-03-203-93/+130
| | | | | | | | | | | | | | | | | | AT_TY -> StackableType TY_ST -> Stackable TY_NST -> NonStackable TY_NSTB -> NonStackableBonus AME_TY -> ModifierEffectType AME_MULT -> Multiplicative AME_ADD -> Additive Got rid of related documentation, which is now stating the obvious. Also renamed many related variables. Reviewed-by: Freeyorp
* General cleanups and code style fixesThorbjørn Lindeijer2011-03-202-7/+9
| | | | | | | A bunch of variables that were continuously requested from the configuration are now members of the AccountHandler. Reviewed-by: Freeyorp
* Improved @ban commandPhilipp Sehmisch2011-03-182-14/+38
| | | | | | | | | | | When banning a character, the game master now sets a time unit (m, h, d, w or y for minutes, hours, days, weeks or years) after the duration. Ban durations longer than 2^16 minutes are now possible. The banned character is now kicked automatically and the banning character receives a feedback chat message. Reviewed-by: Thorbjorn
* Micro-optimizations related to std::stringThorbjørn Lindeijer2011-03-179-53/+66
| | | | | | | | * 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
* Path finding: Moved F cost from PathInfo to LocationThorbjørn Lindeijer2011-03-161-17/+15
| | | | | | | | | | The F cost represents the estimate of the total cost from source to destination. It is only relevant to sort the locations to be checked, so there is no point in assigning it to each coordinate of the map. With maps up to 200x200, the memory usage is reduced by 160 kB! :P Reviewed-by: Bertram
* Allowed item names instead of IDs in @commandsPhilipp Sehmisch2011-03-164-41/+84
| | | | | 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.
* Allowed monster names in @spawn commandPhilipp Sehmisch2011-03-164-17/+67
| | | | | | | | | I rewrote the @spawn command to allow two new things: 1. The monster ID can be replaced with the name of the monster. 2. The amount of monsters can be omitted. In that case a single monster is spawned. Reviewed by: Jaxad and Thorbjorn
* Some code style cleanups in AutoAttack classThorbjørn Lindeijer2011-03-153-31/+77
|
* Eliminated one version of Being::performAttackThorbjørn Lindeijer2011-03-153-14/+12
| | | | | There was a version taking an attack range, but the range was always the same as the one specified in the Damage class.
* Fixed monster flawed movements and client net messages flooding.Yohann Ferreira2011-03-121-2/+2
| | | | | | | | | | The monsters weren't respecting the end of the stroll time before resetting their destination, which made them never cease changing it and flooded the clients with movement messages. Resolves: Mana-Mantis #315. Reviewed-by: Jaxad0127.
* Removed a bunch of silly documentationThorbjørn Lindeijer2011-03-126-30/+0
| | | | | | A C++ developer should be able to recognize a constructor and a destructor by just looking at it, so let's stop writing down the obvious. :)
* Moved freeing of map position to Actor destructorThorbjørn Lindeijer2011-03-116-30/+22
| | | | | | | | | | | | | 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