summaryrefslogtreecommitdiff
path: root/src/game-server/state.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-04-15Moved functions to entity members where appropriateThorbjørn Lindeijer1-4/+4
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-12Moved Actor into an ComponentErik Schilling1-43/+49
This was the final step to remove the hierachy with Entity on the top.
2013-04-11Converted Being into a ComponentErik Schilling1-32/+54
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 Schilling1-32/+40
A CharacterData was created as a proxy class in order to allow using the old serialization method.
2013-04-03Moved the Monster class to a ComponentErik Schilling1-7/+14
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 Schilling1-15/+23
This allows the server to compile with c++0x (and enables it). This also includes some coding style / readabillity fixes.
2013-04-02Moved fighting code into a componentErik Schilling1-5/+9
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-25Changed NPC to an NpcComponent added to a BeingThorbjørn Lindeijer1-5/+5
2013-03-25Changed Effect to a component of ActorThorbjørn Lindeijer1-11/+12
Reviewed-by: Yohann Ferreira
2013-03-25Changed Item to a component of ActorThorbjørn Lindeijer1-9/+10
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-02-01Added emote support.Yohann Ferreira1-0/+13
2013-01-29Silenced some eclipse warningsErik Schilling1-0/+3
2013-01-09Replaced EventListener with signals based on libsigc++Thorbjørn Lindeijer1-3/+3
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-5/+5
Same thing, but shorter.
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-04-14Introduced a Timeout class for counting down without countingThorbjørn Lindeijer1-8/+20
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-04Renamed Thing to EntityThorbjørn Lindeijer1-5/+5
In preparation for using an entity/component system for the entities in the game world, this name will be more recognizable and easier to talk about. Reviewed-by: Yohann Ferreira
2012-03-17Added map update function, moved schedules there to keep map contextErik Schilling1-29/+1
Reviewed-by: bjorn.
2012-03-11Added callbacks for map/worldvar changesErik Schilling1-0/+17
Reviewed-by: bjorn.
2012-03-10Removed space before ;Erik Schilling1-1/+1
Reviewed-by: PjotrOrial.
2012-03-02Merged all the different Lua states into oneThorbjørn Lindeijer1-11/+6
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-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-01-10Made the game server execute the chr_respawn_accept script evenYohann Ferreira1-0/+13
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-0/+2
Reviewed-by: o11c, bjorn, Bertram.
2011-08-19Changed the sprite layer protocol to supportYohann Ferreira1-45/+36
an arbitrary number of layers. (up to 255).
2011-07-27Reworked the way equip slot info are loaded in a more logical way.Yohann Ferreira1-1/+1
2011-07-27Begun Applying the new equipment slot handling design.Yohann Ferreira1-4/+4
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.
2011-06-17Changed the attack message to send the attack id.Yohann Ferreira1-1/+1
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.
2011-04-18Made the server send the being position each 5 seconds.Yohann Ferreira1-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.
2011-03-09Renamed GameState::insertSafe() to inserOrDelete.Yohann Ferreira1-2/+2
This reflects much more what the function does IMHO. Trivial.
2011-03-06Small fixes coming from my comment on issue #77.Yohann Ferreira1-5/+5
Trivial.
2011-03-04Implemented persistent world and map variablesPhilipp Sehmisch1-0/+29
The gameserver now receive a copy of all world state variables when they are accepted by the accountserver and receive a copy of all map state variables of a map when they register it successfully. Implemented LUA script bindings for getting and setting these variables. When such a variable is set, the accountserver is notified about this change. Changes to world state variables are then propagated to all gameservers by the accountserver. Be aware that when a gameserver is updating a map, there is no check if it is actually responsible for said map. But I consider this not a security flaw, because authenticated game servers are considered to be trustworthy in a lot of other situations, too. Also renamed "quest" to "character variable" in the sourcecode. Reviewed-by: Bertram
2011-01-09Fix being direction discrepancies by syncing the BeingDirection.Yohann Ferreira1-0/+1
The server was actually using the bitmask enum while the the client still sent another one, creating discrepancies. A second problem is that the being direction was not properly initialized and not updated while it was moving. Reviewed-by: Jaxad.
2011-01-09Removed the superfluous point struct.Yohann Ferreira1-1/+1
It was too close from the Position class and it leads to making the server handle one or another type through the code. Still bugged me many times while making changes. Reviewed-by: Jaxad.
2010-11-14Renamed .hpp files into .h for consistency.Yohann Ferreira1-17/+17
Also added an header to the autoattack.{h,cpp} files. Big but trivial fix.
2010-11-03Renamed write{Byte,Short,Long} to writeInt{8,16,32}Thorbjørn Lindeijer1-56/+56
Mainly for consistency with the client, and the general consensus was that these numbered versions were clearer.
2010-11-02Some random code cleanups.Yohann Ferreira1-16/+31
Also renamed MonsterClass::getType() to getId() since it was misleading with the use of ThingType::getType() and didn't represent the actual meaning, IMHO. Trivial.
2010-10-17Dehardcode the tileWidth and height, except for the speed conversion.Yohann Ferreira1-5/+8
The speed conversion needs a standard tile length anyway and can be improved later once the movement code will start to handle beings size. Reviewed-by: Crush.
2010-09-15Reordered the manaserv.xml.example file and made related code cleanups.Yohann Ferreira1-3/+3
Reviewed-by: Thorbjorn.
2010-07-10New attribute system and major changes to many low-level areas.Freeyorp1-18/+17
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-02-07Update Copyright date for Manaserv.Bertram1-1/+1
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-10-15Speed code unification part 1: Made the server accept speed values in tiles ↵Bertram1-1/+4
per second.
2009-10-09Synced the protocol file with client in protocol.h, letting other defines in ↵Bertram1-1/+0
defines.h, and removing some overheading along the way.
2009-09-27Added script bindings and netcode for creating being-bound effects.Philipp Sehmisch1-5/+14
2009-08-01Simplifies Movement to not send path destinations, but rather just the ↵Chuck Miller1-25/+5
current pos
2009-05-24Fixed a few code style issuesBjørn Lindeijer1-1/+2
Also renamed Guild::totalMembers to Guild::memberCount
2009-04-26Standardize on the position of the const keywordBjørn Lindeijer1-8/+8
Same as for the client.
2009-04-26Merged MovingObject into the Being classBjørn Lindeijer1-32/+39
Also renamed Object to Actor, to make it sound a little less generic. Cleans up a bit the rather big hierarchy of different object types we have.