summaryrefslogtreecommitdiff
path: root/src/account-server/storage.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-01-10Removed deprecated and unused Storage::flushSkillThorbjørn Lindeijer1-8/+0
2013-01-09Replaced 'unsigned int' with 'unsigned'Thorbjørn Lindeijer1-42/+30
Same thing, but shorter.
2012-07-31Fixed SQL syntax error when updating character pointsThorbjørn Lindeijer1-2/+1
Had a comma too much. Reviewed-by: Stefan Beller Reviewed-by: Erik Schilling
2012-05-25Fixed handling of skillsErik Schilling1-8/+8
- Removed possibility of skills getting mixed with attributes - Made the server sending the level of the current skill on exp change (currently the client could calculate it itself, but it allows more flexibillity in future this way) - Fixed reading of skills out of the database (for some reason the status effects were added as skills) ** Needs clientside patch as well (coming soon) ** Reviewed-by: Bertram.
2012-04-19Fixed guild supportErik Schilling1-3/+27
List of things fixed: - fixed having multiple guild support everywhere - implemented kick code (untested due to missing kick possiblity in client) - fixed giving owner rights to next member when owner leaves guild - fixed potentional segmention fault when trying to access deleted guild after all members left - fixed saving right changes to database - made searching for guilds faster a bit (at least when having many guilds) TODO: + Fix conflict between guild and normal channels + Fix being able to leave guild channel without leaving guild itself + Add kick possiblity to client Reviewed-by: bjorn.
2012-04-04Enhanced special supportErik Schilling1-7/+16
- Made the current charge being saved. - Added script binds: - chr_set_special_recharge_speed - chr_get_special_recharge_speed - chr_set_special_mana - chr_get_special_mana - get_special_info - Added special info lua class. Functions: - name - needed_mana - rechargeable - on_use - on_recharged - category Further the engine no longer sets charge to 0 after using of specials this allows more flexbilillity (like failing specials). Changes on the xml database: - recharge renamed to rechargeable (needed by client and server) - needed - the needed mana to trigger a special (server only) - rechargespeed - the defailt recharge speed in mana per tick (server only) - target - the type of target (either being or point) (server and client) I also made the lua engine pushing nil instead of a 0 light userdata when the pointer was 0. Database update needed. Change is tested. Mana-Mantis: #167, #156 Reviewed-by: bjorn.
2012-03-16Use the guild ID when setting guild member rightsThorbjørn Lindeijer1-4/+4
While the plan is to allow only one guild per player, the database currently doesn't enforce this. The expected behavior of this API is that it changes the rights only for the specified guild, but the query was changing the rights of the player in all his guilds. Reviewed-by: Erik Schilling
2012-03-13Fixed problems with map-bound world state variablesThorbjørn Lindeijer1-28/+10
Due to a wrong primary key, which covered only the state name, it was impossible to use the same state name on different maps. This has now been fixed. Another problem was that the map variables were being included in the global variables, because the related database query did not filter on the map_id column properly. While fixing that, the map_id column now allows explicitly marking a state variable as global (with the value 0) or system variables (with the value -1). System variables are currently not accessible from scripts, but that could be changed later. Reviewed-by: Yohann Ferreira Reviewed-by: Erik Schilling
2012-02-28Removed unnessecary second check for same conditionErik Schilling1-65/+62
Reviewed-by: Bertram.
2012-02-27Fixed compilation again + some more code cleanupErik Schilling1-9/+9
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.
2011-09-09Add persistent items support based on seeseekey's work.Yohann Ferreira1-0/+87
Also made some random changes where useful, including: - Code formatting fixes, - Design fix about the fact that only the game config option should be checked. - Fixed the size of the values sent and receive to follow the rest of the development. - Fixed variables names to make them show what they are, and not why they are used. Resolves: Mana-Mantis #142.
2011-08-30Made the db version an official pre-requisite.Yohann Ferreira1-4/+7
It was uneasy to not miss something when updating the db. And as the db version is somewhat corresponding to a certain protocol version, adding it in the protocol file sounds relevant to me, and helps when updating it.
2011-08-30Added missing sql update scripts.Yohann Ferreira1-1/+1
2011-07-27Begun Applying the new equipment slot handling design.Yohann Ferreira1-15/+27
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-14Fixing storing of changed passwordsStefan Dombrowski1-2/+2
Reviewed-by: Bertram
2011-04-13Fixed swapping of equipment and inventory slotsThorbjørn Lindeijer1-3/+4
This was happening when retrieving characters from the database. Also made the query more explicit about which columns it requests. Reviewed-by: Yohann Ferreira
2011-04-13Fixed equipment duplication when updating it.Yohann Ferreira1-1/+7
Reviewed-by: Thorbjorn.
2011-03-20Use of uint64_t requires including C99 header stdint.hThorbjørn Lindeijer1-0/+2
This is not standard C++... Reviewed-by: Freeyorp
2011-03-18Improved @ban commandPhilipp Sehmisch1-1/+4
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
2011-03-17Micro-optimizations related to std::stringThorbjørn Lindeijer1-6/+7
* 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-15Introduced an AttributeValue class for convenience and readabilityThorbjørn Lindeijer1-4/+3
Easier to understand than a std::pair with its 'first' and 'second' members, and it also provides an implicit constructor so that AttributeValue is implicitly constructed from a double. Reviewed-by: Freeyorp
2011-03-09Prevented a potential crash in storage::getAllWorldStateVars()Yohann Ferreira1-2/+10
Minor other fixes. Trivial.
2011-03-04Implemented persistent world and map variablesPhilipp Sehmisch1-0/+42
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-09Removed the superfluous point struct.Yohann Ferreira1-2/+3
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-12-29Made the server handle properly the characters slots.Yohann Ferreira1-24/+106
I turned the vector storing character data into a map, keeping the character's slot. Fixed a memleak along the way. Reviewed-by: Crush.
2010-12-27Transaction logging of various command, new transaction codes and style fix.Philipp Sehmisch1-1/+1
The @mute, @goto, @attribute and @announce commands now logs transactions to the database. Added new transaction codes to database. I've preliminarily added a lot of codes for not yet supported commands so that we needn't do a database update with every single commit which implements one. Also using the equivalent "say" helper function in place of the "GameState::sayTo" method in the command handler. Reviewed-by: Kage
2010-12-17Fixed a compiler warning.Philipp Sehmisch1-1/+1
2010-12-16Added last missing try catch implementation in storage.cppYohann Ferreira1-103/+175
Resolves: Mana-mantis #269. Reviewed-by: Jaxad0127.
2010-12-16Use bound values for Storage::flush() since it leaked sensitive info.Yohann Ferreira1-7/+19
(Readable in the log with debug level.) Reviewed-by: Jaxad0127.
2010-12-16Fix existing binding use in storage.cpp.Yohann Ferreira1-55/+98
Reviewed-by: Jaxad0127.
2010-12-16Standardized the current errors thrown.Yohann Ferreira1-110/+85
Reviewed-by: Jaxad0127.
2010-12-14Dummy commit since it seems my private repo didn't want to updateYohann Ferreira1-0/+1
the public one.
2010-12-14Remove an outdated comment talking about subversion tagging.Yohann Ferreira1-3/+1
2010-12-14Removed the code preventing from being able to sync items with id < 500.Yohann Ferreira1-4/+1
Instead, let's use the actual rule: Id > 0. Trivial fix.
2010-12-14Second round of small random cleanups on storage.Yohann Ferreira1-54/+49
Trivial also.
2010-12-14Small random hacking cleanups.Yohann Ferreira1-163/+189
Trivial.
2010-12-13Moved storage doc from .cpp to .h and updated it.Yohann Ferreira1-245/+2
Since it's what is done for the other files in the project. Trivial fix.
2010-11-15Upgrade database version to 12 as it should have been from the latest update.Yohann Ferreira1-1/+1
Trivial fix.
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-11-10Fix code indentation in the sql related files.Yohann Ferreira1-29/+37
Trivial fix.
2010-11-09Fixed unregistering on the server-side.Yohann Ferreira1-6/+16
When registering or logging, The client is hashing the password for sending it safely. And the server is hashing it also to store it the same way. Hence, the password ends hashed twice, which is correct because the server can't trust the client anyway. At unregister attempt, the server wasn't hashing the password before comparing it. Also while on it, I made the corresponding SQL query use the try catch method and only delete the account in memory when it's also done on the Db. Reviewed-by: thorbjorn, Freeyorp.
2010-10-30Have the PerformTransaction class automatically handle nestingThorbjørn Lindeijer1-66/+14
No need to fiddle around with "startTransaction" booleans now that the helper class is a little more intelligent. When the database is already performing a transaction, no new one will be started.
2010-10-30Introduced a helper class for performing transactionsThorbjørn Lindeijer1-12/+10
Avoids having to remember to call rollbackTransaction and makes transactions exception-safe (since the destructor of PerformTransaction will be called when an exception is thrown).
2010-09-15Reordered the manaserv.xml.example file and made related code cleanups.Yohann Ferreira1-1/+1
Reviewed-by: Thorbjorn.
2010-08-29Merge branch 'testing'Freeyorp1-149/+222
Conflicts: src/account-server/storage.cpp src/game-server/being.cpp src/game-server/being.hpp src/game-server/character.cpp src/game-server/character.hpp src/game-server/gamehandler.cpp src/game-server/inventory.cpp src/scripting/lua.cpp src/sql/mysql/createTables.sql src/sql/sqlite/createTables.sql
2010-08-22Another small simplificationThorbjørn Lindeijer1-7/+1
2010-08-22Avoid collision with type 'int' in SQL queryThorbjørn Lindeijer1-12/+7
Was causing the account server to crash when using MySQL backend. Mantis-issue: 188 Reviewed-by: Yohann Ferreira
2010-08-18Change references from database version 10 to version 11 to reflect changes ↵Freeyorp1-1/+1
made to mainline
2010-08-14Set the database ID of a new character immediately after creating it.Freeyorp1-3/+3
(Ooops.)
2010-08-07Fixed index creation on mana_char_kill_stats tableThorbjørn Lindeijer1-1/+1
Reviewed-by: Philipp Sehmisch