summaryrefslogtreecommitdiff
path: root/src/game-server/state.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-05-15General code cleanupsThorbjørn Lindeijer1-3/+3
* Overall includes cleanup * Use std::make_pair * Make some functions const
2022-08-19Apply C++11 fixitsThorbjørn Lindeijer1-23/+14
modernize-loop-convert modernize-deprecated-headers
2022-08-19Apply C++11 fixitsThorbjørn Lindeijer1-18/+17
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using
2013-11-02Do not send dir changes back to the player itselfErik Schilling1-1/+1
2013-09-19Removed the unused OBJECT_ACTOR enum valueThorbjørn Lindeijer1-2/+0
NPCs, monsters and character are all actors, but no entity exists that has "actor" as its type. To avoid having to increment the protocol version, the values of the different entity types are now mentioned explicitly.
2013-09-19Removed unused being state enumsThorbjørn Lindeijer1-1/+1
2013-09-15Fixed last commitErik Schilling1-2/+2
Renamed killConnection based on bjorns feedback. Do not send the info on each warp but only on reconnections.
2013-09-15Fixed handling of reconnects while the old connection is still validErik Schilling1-2/+2
The old connection is now terminated. And the new connection will receive the character data properly.
2013-09-09Fixed Entity leak with effectsErik Schilling1-1/+0
2013-09-08Actually send the info about beings using direction abilitiesErik Schilling1-0/+11
2013-09-08Cleaned up the inventory handlingErik Schilling1-36/+29
Things done: - Removed the equips table and added another column which keeps track about whether the item is equipped or not - Added a message to notify the client about failing equips instead of hardcoding to chat notification - Removed the move possibillity. It was a quite long function and our future idea of the inventory does not need any moves - Removed the inInventory and inEquipment parameters from chr_inv_count, but added a equipped key to the table that chr_get_inventory returns This change makes equipped items still being in the inventory. This means in-inventory triggers are still active! However it makes no sense to disable this triggers during equipping since it will appear as still in the inventory to the client.
2013-09-01Fixed inconsistent type of hairstyle networkingErik Schilling1-10/+5
2013-08-31remove unused variableStefan Beller1-1/+0
2013-08-26Allowed to push attributeinfos for the attribute recalculationErik Schilling1-3/+6
While on it I replaced the id usage in the server with the usage of the AttributeInfo directly. Next steps: - Dehardcode the core attribute ids and store their attributeinfos somewhere in AttributeManager (for now i simply wrapped the ids with getAttributeInfo(). - Move AttributeInfo out of AttributeManager to shorten the usage + to allow using a pointer in ModifierLocation without forward declaring it.
2013-08-26[Abilities] Removed the old autoattack systemErik Schilling1-14/+0
As a side effect i had to remove the monster attack AI for now. I will readd this as next thing.
2013-08-26[Abilities] Added a add_hit_taken bindErik Schilling1-4/+3
This allows to display hit messages in the client for abilities
2013-08-26[Abilities] Inform other players about ability usesErik Schilling1-0/+24
2013-05-02Fixed a bunch of cppcheck warningsErik Schilling1-1/+1
2013-04-27Use nullptr instead of NULL everywhereErik Schilling1-1/+1
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.