summaryrefslogtreecommitdiff
path: root/src/game-server
AgeCommit message (Collapse)AuthorFilesLines
2013-04-15Moved functions to entity members where appropriateThorbjørn Lindeijer3-7/+21
Some functions were skipped for now because they may need a new name or change of behavior. Changes: chr_warp entity:warp chr_get_inventory entity:inventory chr_inv_change entity:inv_change chr_inv_count entity:inv_count chr_get_equipment entity:equipment chr_equip_slot entity:equip_slot chr_equip_item entity:equip_item chr_unequip_slot entity:unequip_slot chr_unequip_item entity:unequip_item chr_get_level entity:level chr_get_exp entity:xp chr_give_exp entity:give_xp chr_get_rights entity:rights chr_set_hair_style entity:set_hair_style chr_get_hair_style entity:hair_style chr_set_hair_color entity:set_hair_color chr_get_hair_color entity:hair_color chr_get_kill_count entity:kill_count chr_give_special entity:give_special chr_has_special entity:has_special chr_take_special entity:take_special chr_set_special_recharge_speed entity:set_special_recharge_speed chr_get_special_recharge_speed entity:special_recharge_speed chr_set_special_mana entity:set_special_mana chr_get_special_mana entity:special_mana chr_kick entity:kick exp_for_level xp_for_level monster_get_id entity:monster_id monster_change_anger entity:change_anger monster_drop_anger entity:drop_anger monster_get_angerlist entity:angerlist being_apply_status entity:apply_status being_remove_status entity:remove_status being_has_status entity:has_status being_set_status_time entity:set_status_time being_get_status_time entity:status_time being_get_gender entity:gender being_set_gender entity:set_gender being_type entity:type being_walk entity:walk being_say entity:say being_damage entity:damage being_heal entity:heal being_get_name entity:name being_get_action entity:action being_set_action entity:set_action being_get_direction entity:direction being_set_direction entity:set_direction being_apply_attribute_modifier entity:apply_attribute_modifier being_remove_attribute_modifier entity:remove_attribute_modifier being_set_base_attribute entity:set_base_attribute being_get_modified_attribute entity:modified_attribute being_get_base_attribute entity:base_attribute being_set_walkmask entity:set_walkmask being_get_walkmask entity:walkmask being_get_mapid entity:mapid chat_message entity:message being_register entity:register chr_shake_screen entity:shake_screen chr_create_text_particle entity:show_text_particle - entity:position posX entity:x posY entity:y monster_get_name monsterclass:name item_get_name itemclass:name
2013-04-14Removed NPC and character parameters from NPC functionsThorbjørn Lindeijer1-0/+2
These functions can only be used in the context of a character talking to an NPC, so these parameters can be deduced from that context rather than passing them explicitly all the time. Simplifies NPC scripting.
2013-04-14Use a full user data for Entity referencesThorbjørn Lindeijer2-6/+17
Only moved a single script function to a member for now, will do others in a separate commit.
2013-04-13Don't try to kill the connection of a deleted characterThorbjørn Lindeijer1-1/+1
The point is to do this on the new character and to allow the client to continue playing with the existing character instance (when it represents the same character in the DB). Somehow was changed in commit aa04597c5f8.
2013-04-12Fixed uninitialised variable warning in valgrindErik Schilling1-0/+1
2013-04-12Removed static member definitions that are no longer neededThorbjørn Lindeijer6-11/+1
The requirement for having these definitions was relaxed in the C++11 standard. In short, they are not needed anymore for static const integral types. Details: http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#454
2013-04-12Removed CharacterData member from CharacterComponentThorbjørn Lindeijer3-9/+3
It is only needed temporarily while serializing and deserializing.
2013-04-12Moved Actor into an ComponentErik Schilling32-369/+383
This was the final step to remove the hierachy with Entity on the top.
2013-04-11Converted Being into a ComponentErik Schilling39-683/+841
I did not really care too much about staying consistent with the use of static_casts to Actors since they are only temporary anyway until Actor is a component too.
2013-04-11Converted the Character class into a componentErik Schilling32-644/+1032
A CharacterData was created as a proxy class in order to allow using the old serialization method.
2013-04-10Fixed @kill killing yourselfErik Schilling1-1/+1
2013-04-07Fixed undefined #defines in mingw and c++0xErik Schilling1-0/+3
It looks like mingw does not define all the stuff in c++0x it does without.
2013-04-03Moved the Monster class to a ComponentErik Schilling11-102/+135
Things done: - Allowed to create new Attributes outside of the protected scope of Being - Moved Monster to MonsterComponent - Some minor cleanup in the Attribute setting code of monsters
2013-04-02Fixed multiple warnings and errors that blocked c++0xErik Schilling14-50/+69
This allows the server to compile with c++0x (and enables it). This also includes some coding style / readabillity fixes.
2013-04-02Removed old commandhandler approachErik Schilling1-439/+0
It was forgotten to remove when the new approach was added
2013-04-02Moved fighting code into a componentErik Schilling20-372/+640
All damage dealing is now handeled via CombatComponent. Monsters use a derived MonsterCombatComponent since they can have a damage mutation and have a seperate script callback. The wirering with Being is still not optional since most of the stuff does not exist as components. Things done: - Seperated the fighting code from Being and only let Characters and Monsters add the Component (less overhead for npcs) - Added a getter for Attribute values to prevent searching it all the time in non Being members - Fixed the type if the damage mutation to double (no idea why it was int) I did not want to copy it over incorrectly - Removed the addAttack/removeAttack overrides in Character and made the knuckleAttack being added based on newly added signals Future TODOS: - Remove depedency on Being as soon all needed dependencies are available as components of Entity - Move the monster script callback into the general combatcomponent and make it usuable for characters too
2013-03-25Moved documentation out of class definitionThorbjørn Lindeijer2-68/+97
Inline documentation is in general needlessly verbose and only makes it harder to read the actual class API. This change moves this kind of documentation to the function implementation for the 'Entity' class. For inline methods, the implementation is moved outside of the class using the 'inline' keyword. This provides a good place to put the documentation, but it also further cleans up the class definition. The class definition now gives a much better overview over its API. And if needed, details can be looked up at the function implementations. Reviewed-by: Erik Schilling
2013-03-25Changed NPC to an NpcComponent added to a BeingThorbjørn Lindeijer11-138/+135
2013-03-25Changed Effect to a component of ActorThorbjørn Lindeijer8-52/+60
Reviewed-by: Yohann Ferreira
2013-03-25Changed Item to a component of ActorThorbjørn Lindeijer13-74/+124
Items also have positions, so the ItemComponent only makes sense as part of an Actor. Later on it will probably be part of an entity that also has an ActorComponent. Since it was annoying to update all the places where items were created, I've introduced a function for this. The component types are now prefixed with "CT_" because I wanted to introduce an 'Item' namespace which would otherwise be conflicting. The component types enum isn't used much in the code so it can look a bit ugly. Reviewed-by: Yohann Ferreira
2013-03-25Changed SpawnArea and TriggerArea to components of EntityThorbjørn Lindeijer10-53/+185
Well, first visible change is that everything just gets longer to read. Reviewed-by: Yohann Ferreira
2013-02-24Removed mentioning of retired structThorbjørn Lindeijer1-2/+0
MonsterTargetEventDispatch was used before switching to libsigc++.
2013-02-24Fixed default value of the servernameErik Schilling1-1/+1
Since the name was used to log things and the default now is "" also added logging of the address and port too.
2013-02-24Added possibility to reserve mapsErik Schilling2-18/+5
If you set net_gameServerName you can now reserve maps in the maps.xml. There you have to add the servername - property to the <map> tag. Then the map will only be activated by that server. Also changed the activate sequence that the account server now tells the game server what maps to activate (previously the server requested all maps and the account server said yes or no). TODO: Fix general inter server map switching.
2013-02-21Removed loading of script files using the statusmanagerErik Schilling1-17/+1
They are now required via the main.lua. Also made Harmony giving you the plague in order to allow testing.
2013-02-21Introduced Script::ContextErik Schilling9-42/+25
This should allow to finally call functions to lua without having to care about working around situations where a lua call causes a c++ call which needs to call to lua again. Tested against the source of tales repository data.
2013-02-17Monsters no longer load their script filesErik Schilling3-40/+0
Before monsters loaded their script file on *each* spawn. This is rather wrong since the script state keeps growing for each monster. However all of this was unnessecary since the main.lua can simply require the script file. If you do not want to spam the main.lua (or any other file) with all the requires: I guess we can add script binds to iterate over all monsters and add some custom properties to the monsters.xml (See Mana-Mantis #356)
2013-02-04Moved attribute (re)calculation to the scriptsErik Schilling6-176/+70
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-02-04Random cleanup of attribute codeErik Schilling3-19/+28
Did this during trying to understand the code
2013-02-03Modifications to allow crosscompiling with mingwErik Schilling1-0/+1
Reviewed-by: bjorn.
2013-02-01Silenced to Wreorder warnings.Yohann Ferreira2-3/+3
2013-02-01Added emote support.Yohann Ferreira9-2/+192
2013-01-29Silenced some eclipse warningsErik Schilling7-3/+19
2013-01-15Fixed setting current map for npc update functionErik Schilling1-0/+2
2013-01-10Small simplification in Monster::diedThorbjørn Lindeijer1-4/+4
2013-01-10Used a typedef to make callback syntax more readableThorbjørn Lindeijer1-11/+8
2013-01-10Small documentation updates for Point and RectangleThorbjørn Lindeijer1-1/+1
This documentation used to be accurate, until Point was merged with the Position class in commit 8ff3e6674c1d4fc05fc1ba87f42484689fca0879. Also fixed a typo.
2013-01-10Made sure in-inventory trigger is called at pickupErik Schilling1-1/+9
Also added checks for invalid item and zero amount Reviewed-by: bjorn.
2013-01-09Replaced EventListener with signals based on libsigc++Thorbjørn Lindeijer13-313/+134
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 Lindeijer24-160/+160
Same thing, but shorter.
2013-01-08Fixed syntax error (added missing '{')Thorbjørn Lindeijer1-0/+1
2013-01-08Added Vulnerabilities for monstersErik Schilling3-1/+28
You can now actually use the already used node in the monsters.xml Monsters can have different vulnerabillities against elements: <vulnerabillity element="earth" factor="2.0" /> This will double damage of the element earth to this monster.
2013-01-08Work on (Auto)Attack system.Erik Schilling15-465/+577
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 Schilling8-47/+47
2012-10-11Moved order of sending genderErik Schilling1-3/+1
Gender is shared. There is no reason in duplicating code *Breaks compatbility with old clients* *Requires clientside patch* Reviewed-by: Stefan Beller.
2012-09-22Extended warnings for parsing warpsErik Schilling1-1/+1
Reviewed-by: bjorn.
2012-09-22Fixed marking map as activatedErik Schilling2-19/+40
The patch that allowed to use map objects as warp targets broke this. During run of map initalize mActive was still false. This broke creating objects (npc, triggers) in atinit. Reviewed-by: bjorn.
2012-09-02Allow map objects as warp targetsErik Schilling3-14/+57
This patch allows map objects as warp targets. For use: - Create object in tiled with type="WARP_DEST" - Set name to anything you want - Create usual WARP object - Leave out the DEST_{X,Y} part - Add DEST_NAME property with the name of the first object This requires the game server to parse all maps at startup. Change is tested. Reviewed-by: bjorn.
2012-09-02Dropped .gz suffix for mapsErik Schilling1-2/+0
Reviewed-by: bjorn.
2012-08-10Fixed issues with removing attribute modifiersThorbjørn Lindeijer1-4/+5
* AttributeModifiersEffect::remove was not calling updateMod with the 'value' parameter, causing it to have no effect at all for Stackable modifiers. * The cached value of the changed modifier effect was not being recalculated when removing modifiers, because it started one layer too high (there's an inconsistency here: AttributeModifiersEffect::add updates this cached value while AttributeModifiersEffect::remove doesn't). Reviewed-by: Erik Schilling