summaryrefslogtreecommitdiff
path: root/src/common
AgeCommit message (Collapse)AuthorFilesLines
2017-05-22Add storage_data reception, parsing and sending to/from the map-server.Smokexyz1-3/+5
Remove loading and saving of storage_data through char.c Re-declaration of structure storage_data as a vector. Re-code of portions in the map-server using storage_data. A new approach is taken by saving the loaded storage data from sql into memory for the duration of the session, thereby removing the need of querying the database to re-load all items everytime a storage save routine is issued from the map-server. Saving of storage items is done through a new function that significantly reduces the number of queries compared to char_memitemdata_tosql(), and therefore run-time speed. This method potentially reduces the number of update and delete queries from MAX_STORAGE (which could be >= 600) times to literally 1. Storage items are stored in a dynamically allocated array and handled accordingly. struct mmo_charstatus size reduces by 34,800 bytes. Update pc_checkitem() with masks for item checks. `sd->state.itemcheck` has been changed to `sd->itemcheck` of type `enum pc_checkitem_types` `battle/items.conf` has been updated to reflect configuration changes. Further updates to assert a successful reception of storage data in related functions.
2017-04-26HPM Hooks UpdateHercules.ws1-81/+162
Signed-off-by: HerculesWSAPI <dev@herc.ws>
2017-04-09Merge pull request #1598 from Smokexyz/IROHaru2-1/+14
Implementation of Item Options System.
2017-04-04Implementation of Item Options System.Smokexyz2-1/+14
Allows the infusing of equipments with bonus item options. This feature is constrained to clients of packet versions greater than or equal to `20150226`. Item Options and their effects are defined server-side in `db/item_options.conf` and client side in `data/luafiles514/lua files/datainfo/addrandomoptionnametable.lub` The ID of the option must tally with the correct index of the description provided in the client side lua file to avoid bugs. IT_OPT_* keys and MAX_ITEM_OPTIONS macro are also exported from the source as constants. An additional flag `disable_options` has been added to sql, and as `DisableOptions: true/false (boolean, defaults to false !!for equipments only!!)` to item_db.conf files. Script commands documentation is also included. SQL file updates are included. Credits: [Smokexyz](https://github.com/Smokexyz) Style and Script Fixes by [Asheraf](https://github.com/Asheraf) Initial design Idea by [secretdataz](https://github.com/secretdataz)
2017-03-20Add comment to safestrncpy about size checks.Andrei Karas1-0/+1
2017-03-16Increase Character Slots from 9 to 12Jedzkie1-1/+9
- kRO Mains recently increased their character slots from 11 to 12.
2017-01-22Fix CMDLINE_OPT_PARAM arguments in plugins failing to loadHaru1-0/+2
When the server is called with a plugin-defined argument expecting additional values, in the form '--foo bar', the parser is unable to skip the additional value until the plugin is fully loaded. The issue was caused by the first scans of the argument list to find CMDLINE_OPT_PREINIT or CMDLINE_OPT_SILENT arguments, which happen before plugins are loaded, and would cause the parser to choke on the additional values, interpreting them as separate arguments. This is related to PR #1552, where we attempted to use this option for the first time. Signed-off-by: Haru <haru@dotalux.com>
2017-01-10Update md5 calculation to be able to hash a binary buffer instead of only ↵hemagx2-18/+16
strings Signed-off-by: hemagx <ibrahem.h.basyone@gmail.com>
2017-01-02HPM Hooks UpdateHercules.ws2-2/+2
Signed-off-by: HerculesWSAPI <dev@herc.ws>
2016-12-03Add function to retrieve the appropriate fame list type for a job mapidHaru1-0/+1
This commit adds the function `pc->famelist_type()` to retrieve the appropriate fame list for a given job (common operation). When the given job ID doesn't have an appropriate fame list, the newly introduced value RANKTYPE_UNKNOWN is returned. Signed-off-by: Haru <haru@dotalux.com>
2016-12-03Clarify some Job Class vs MapID confusion (1/2)Haru1-3/+5
This commit ensures that `sd->status.class` and related variables only contain Job Classes (i.e. the client-compatible values, where High Novice 4001) and are never checked against the bitmask-based MapID values. As a rule of thumb, from now on, when a variable is named `class`, it is intended to contain a Job Class ID and not a MapID. The type of such variable shall be a signed `int16` or `int`. To ensure that related third party code is also verified when this commit is merged, the variable `struct mmo_charstatus::class_ (i.e. `sd->status.class_`) is renamed to `class`. Some issues in related lines are also fixed, including: - A wrong check in the char server would prevent the correct detection of babies in code related to the family exp sharing. - Baby Arch Bishops would not be affected by Eucharistica. - A wrong check would cause the `questinfo()` script command not to display its information for most classes (except 1-1 classes). - Map IDs and Job Classes were mixed up in `itemdb_jobid2mapid()` and `itemdb_jobmask2mapid()` for 1-1 classes (causing currently no harm, since they just happen to coincide). - The Baby Sura class would not cause parties to be marked as containing a monk type character (for SLS Team Up purposes). - Baby Geneticists would bypass the cart check when trying to equip ammunitions. - Baby Mechanics would bypass the Mado Gear check when trying to equip ammunitions. - Transcendent Shadow Chasers would lose the Stalkers' ability to clone transcendent skills. Signed-off-by: Haru <haru@dotalux.com>
2016-12-03Clarify the meaning of the MAPID_* constantsHaru1-6/+6
The enum values are now written in a more explicit way, showing how they're composed (upper mask + base job). A future-proof static assertion is added, to make sure the base jobs won't overlap the upper masks. Signed-off-by: Haru <haru@dotalux.com>
2016-12-03Add support for static assertions (on compilers that support them)Haru1-0/+27
This introduces the macro `STATIC_ASSERT(ex, msg)`, that works like its C11 counterpart `_Static_assert(ex, msg)`, on compilers that support it. Support is provided, depending on the compiler: - When in C11 mode, use the native `_Static_assert` - If the compiler advertises having the `c_static_assert` feature, use `_Static_assert` (according to the clang documentation). - If the compiler is GCC >= 4.7 (tested to be compatible), use `_Static_assert` (nonstandard extension, C11 feature available in C99). - If the compiler is MSVC (all the currently supported versions have been tested to be compatible), then use `static_assert` (nonstandard extension, C++ feature) - Otherwise, define it as a no-op macro. Signed-off-by: Haru <haru@dotalux.com>
2016-11-19Add fixed-size versions of the _int64 libconfig getters/settersHaru2-13/+87
As we use int64 (instead of long long int) through the code, it's preferable if our libconfig interface does the same, avoiding us to create temporary interchange variables for that purpose. Signed-off-by: Haru <haru@dotalux.com>
2016-11-01Merge pull request #1498 from Lemongrass3110/cleanup/copyright2016Ibrahem Hossam24-24/+24
Fixed copyright year for 2016
2016-10-28Fixed copyright year for 2016Lemongrass311024-24/+24
2016-10-28Fixed wrong nullpo checkLemongrass31101-1/+1
2016-10-22Increases MAX_SKILL to occupy Summoner SkillsDastgir Pojee1-1/+1
2016-10-22Added Packets for Several Clients: 2015-10-01, 2015-10-29, 2015-11-04 andDastgir Pojee1-0/+2
2015-12-16 Added New Char Creation Packet(0xa39). Added Placeholder of JOB_SUMMONER
2016-10-14HPM Hooks UpdateHaru1-6/+0
Signed-off-by: Haru <haru@dotalux.com>
2016-10-14Fixed a memory manager crash when a memory leak occurs in a pluginHaru3-2/+6
- Plugins were accidentally using the core's memory manager instead of the HPM-safe wrappers. - As a side-effect of this, plugins shall not be able to hook into the iMalloc interface. - The issue was introduced in e7c2f7d827ad286dc826e483391e64b8ffe2720b Signed-off-by: Haru <haru@dotalux.com>
2016-10-07Updated VECTOR_INIT() and VECTOR_ENSURE() to be more analyzer- (and ↵Haru1-7/+10
human-reader-) friendly Signed-off-by: Haru <haru@dotalux.com>
2016-10-07Fixed some issues detected by clang's static analyzer (Xcode 8/macOS Sierra)Haru3-9/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-10-04Fix warning in strlib.cAndrei Karas1-0/+1
2016-10-04Add missing checks into utils.cAndrei Karas1-6/+23
2016-10-04Add missing checks into sysinfo.cAndrei Karas1-26/+58
2016-10-04Add missing checks into sql.cAndrei Karas1-5/+15
2016-10-04Add missing checks into socket.cAndrei Karas1-9/+22
2016-10-04Add missing checks into mutex.cAndrei Karas1-0/+12
2016-10-04Add missing checks into mapindex.cAndrei Karas1-10/+25
2016-10-04Add missing checks into grfio.cAndrei Karas1-3/+21
2016-10-04Add missing checks into ers.cAndrei Karas1-5/+11
2016-10-04Add missing checks into des.cAndrei Karas1-0/+7
2016-10-04Add missing checks into db.cAndrei Karas1-10/+15
2016-10-04Add missing checks into core.cAndrei Karas1-9/+30
2016-10-04Add missing checks into console.cAndrei Karas1-11/+32
2016-10-04Add missing checks into HPM.cAndrei Karas1-11/+35
2016-10-02Changed _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") to target GCC 4.6 ↵Haru2-9/+9
instead of 4.5 - The support on GCC 4.5 is incomplete, and in order to build Hercules, GCC >= 4.6 is recommended Signed-off-by: Haru <haru@dotalux.com>
2016-09-30Add different fixes for gcc 7 warnings.Andrei Karas3-0/+17
Some possible buffer overflows. Add attribute for mark fallthrough cases. Skipped libconfig warnings.
2016-09-22Fixed a compile error when SEND_SHORTLIST is disabledHaru1-5/+4
- Since f8edb93a (likely caused by a find and replace macro gone horribly wrong) Signed-off-by: Haru <haru@dotalux.com>
2016-08-20Re-added HPM support for configuration settingsHaru2-4/+60
Plugin settings should be relative to the the libconfig file root. For example, a configuration setting of type HPCT_CHAR will be relative to the root of conf/char/char-server.conf. In order to add a configuration entry inside the char_configuration block, the full configuration path (slash-delimited) should be passed to addCharConf(), as in the following example: `addCharConf("char_configuration/my_setting", my_parser_function);` Signed-off-by: Haru <haru@dotalux.com>
2016-08-20Added a better error message when a libconfig file is not foundHaru1-0/+5
Previously, it'd say "[Error] (null):0 - file I/O error" Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Added option to make plugin-defined battle config entries optionalHaru3-10/+12
When a setting optional, no warning is issued on the console when said setting is not found in the config Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported battle.conf to libconfigHaru2-2/+52
Ported to modern Hercules and cleaned up from Panikon's commits: 44fea0b3cdba6901599265220228ba4359b1f96d, 9cba05bc0811e638bbaaa6cff887d0b2c9872560 Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported socket.conf (was packet.conf) to libconfigHaru1-67/+196
Ported to modern Hercules and cleaned up from Panikon's commits: b10f2a88073882bea812c6278fdec7848102ab87, bc5007299a92898ea4630f2a977d9a1b42b6c145 Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Changed access_allow and access_deny to VECTORsHaru1-24/+29
Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Removed unnecessary typedefs in socket.cHaru1-13/+13
Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported inter-server.conf to libconfigHaru2-42/+56
Ported to modern Hercules and cleaned up from Panikon's commits: 40f9ec33868e2240cab013308897898ed252b3e0, a9d646da19e25ab6fcf44dbd1ae7d90c30f6686c, 1aa8581a0aecbfd53e877686c399ffb731dcd75e, 72c645b015ae6130ca7d4309d0fb1413340e7f23, f8c906a0496b9acdae1d8244b1544fa03592061e, 51d88a58983c9552dfd1a0f059e5a031742aed61, 443684b3c77f4c32fe7877a7f8d62debf73b1e93, cf93eafef1f322cd1583226272b7d4008f562da4 Signed-off-by: Haru <haru@dotalux.com>
2016-08-19Ported char-server.conf to libconfigHaru1-4/+2
Fixed issue: 8115, now start items can be equipped as well Ported to modern Hercules and cleaned up from Panikon's commits: c6482e9870645ffe59a6a059b819574d4ac79fd9, 832fb27d4f767e4bc8b68c432d0da00b7cb7a4f9, f81b579899e3a15bd472ca8c6a6e0116c43bec92, e23723725499b617def03d05661eca637edaeabd, 0b783a83d82e588efd760f7f4baec0c8074a6fd1, 1b7de91308a57ea07b158ed95a2515a3c8cc36bd, 677d3430cbda0962b320a60cf499e9dadf637d00 Signed-off-by: Haru <haru@dotalux.com>
2016-07-17If build bot enabled, show error message in ShowConfigWarning.Andrei Karas1-0/+4