summaryrefslogtreecommitdiff
path: root/src/map/script.c
AgeCommit message (Collapse)AuthorFilesLines
2016-12-03Remove the platform-dependent variables from struct status_dataHaru1-1/+1
`struct status_data::class_` was platform dependent since c30bb75ec50624429bff7b4106db4be0fda366d6 in order to silence some compile warnings (uint32 on 64 bit builds and uint16 on 32 bit builds). It's now been changed to the correct type, int32, on all platforms. Since the change has potential to silently break third party code, the variable was renamed to `class`. Signed-off-by: Haru <haru@dotalux.com>
2016-12-03Ensure that pc->addfame() increments the correct fame pointsHaru1-9/+9
The function now takes the rank type as argument, rather than guessing it from the character's class. If the wrong fame point type for the current character is requested, the request is ignored. This fixes some (unofficial) edge cases where a Taekwon or an Alchemist refined a signed item, they could obtain rank points. Signed-off-by: Haru <haru@dotalux.com>
2016-12-03Clarify some Job Class vs MapID confusion (2/2)Haru1-6/+6
This commit ensures that `sd->job` and related variables only contain MapIDs (i.e. the serverside optimized values, where High Novice is MAPID_NOVICE | JOBL_UPPER) and are never checked against the client-based Job Class values. As a rule of thumb, from now on, when a variable is named `job` or `jobid`, it is intended to contain a MapID and not a Job Class ID. The type of such variable shall be an unsigned `uint16` or `uint32`. To ensure that related third party code is also verified when this commit is merged, the variable `struct map_session_data::class_ (i.e. `sd->class_`) is renamed to `job`. Some issues in related lines are also fixed, including: - The atcommand `@mount` would not check properly that the requesting character is a 2nd class Swordsman type. - `pc->addfame()` would silently accept invalid MapIDs, sending unknown values to the client (more on this in a subsequent commit). - `pc->famerank()` would not use the passed job as a bitmask, causing the caller to have to mask it beforehand (more on this in a subsequent commit). - The Soul Linker check in TK_JUMPKICK wasn't future-proof (no harm caused currently). - Gunslingers would be able to be targeted by Spiritual Bestowment (`MO_KITRANSLATION`) and Spiritual Sphere Absorption (`MO_ABSORBSPIRITS`) due to a faulty check introduced when the Rebellion class was implemented (causing unintended interaction with Coins). Signed-off-by: Haru <haru@dotalux.com>
2016-12-03Clarify some Job Class vs MapID confusion (1/2)Haru1-14/+14
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-02Fixed a null-pointer dereference in BUILDIN(makeitem2)Haru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-12-02Merge pull request #1405 from Emistry/scriptcommand_makeitem2Haru1-0/+85
Add *makeitem2 script command.
2016-12-01Fixed areawarp cell checkLemongrass31101-1/+4
The script command areawarp has been checking the wrong target map for ages. It has been checking the mapindex rather than the mapid and therefore returned a wrong result. Original commit: rathena/rathena@ac2ba09
2016-11-20Removed support for apostrophes in constantsHaru1-1/+1
Supporting apostrophes (`'`) inside constants or variables is no longer necessary thanks to the more strict AegisName ruleset we're using now. Signed-off-by: Haru <haru@dotalux.com>
2016-10-22Implemented SC_BITESCAR:Dastgir Pojee1-2/+5
Cannot be reset by dispell. Cannot be healed by item/NPC once in BITESCAR. Heal Skill would end the BiteScar Effect.
2016-10-07Fixed some issues detected by clang's static analyzer (Xcode 8/macOS Sierra)Haru1-2/+0
Signed-off-by: Haru <haru@dotalux.com>
2016-09-30Add different fixes for gcc 7 warnings.Andrei Karas1-2/+2
Some possible buffer overflows. Add attribute for mark fallthrough cases. Skipped libconfig warnings.
2016-09-12Add script command navigateto. Add packet for this command.Andrei Karas1-0/+55
Based on rAthena commits: commit 4f13007fec7f08c265620a71c3bc4806d186c0f1 Author: Lemongrass3110 <lemongrass@kstp.at> Date: Sun Mar 6 21:48:47 2016 +0100 commit 809f220b9f5ef70ee062ee56ae6e8d5f56cb5d32 Author: aleos89 <aleos89@users.noreply.github.com> Date: Sun Mar 6 16:15:54 2016 -0500 commit 179f73424934d528ebe494dfb66503c182eacb09 Author: aleos89 <aleos89@users.noreply.github.com> Date: Sun Mar 6 16:10:15 2016 -0500
2016-09-11Clarified/rewritten part of script_array_ensure_zero()Haru1-9/+12
- There exists a case where st is NULL, such as when called by script->cleararray_pc(). This documents such possibility. - Fixes Coverity CID 152760 - Follow-up to 0f803e7 Signed-off-by: Haru <haru@dotalux.com>
2016-09-11Changed GD_MAX check to be non-inclusiveHaru1-1/+1
- GD_MAX is not a valid guild skill ID - Fixes Coverity CID 152761 - Follow-up to 0f803e7 Signed-off-by: Haru <haru@dotalux.com>
2016-09-10Add missing checks into script.cAndrei Karas1-60/+208
2016-08-28Update *makeitem2 script commandEmistry Haoyan1-0/+85
- squash commits. - fix conflicts during rebase. - fix travis build warnings.
2016-08-20Re-added HPM support for configuration settingsHaru1-1/+2
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-19Ported script.conf to libconfigHaru1-41/+44
Ported to modern Hercules and cleaned up from Panikon's commits: a0e4da63ef3afcd896603398e2468876681ac54a, b5f487c2676833492a6d4044b5d1f1bb1e552b04 Signed-off-by: Haru <haru@dotalux.com>
2016-07-14Changed chat_data::minLvl and chat_data::maxLvl to int and renamed to ↵Haru1-2/+2
min_level and max_level Fixes several -Wsign-compare issues Signed-off-by: Haru <haru@dotalux.com>
2016-07-12Interface md5calc.chemagx1-2/+2
2016-07-10HULD: Improved .po file parser to properly read concatenated stringsHaru1-57/+141
- For compliance with gettext's .po file specifications Signed-off-by: Haru <haru@dotalux.com>
2016-07-04Add one check for possible script issue.Andrei Karas1-3/+15
2016-06-30Use item attribute as flags varible. Now only ATTR_BROKEN flag exists.Andrei Karas1-6/+8
2016-06-25Corrected an issue that prevented changing default languagesHaru1-12/+26
The script->get_translation_file_name() is more robust (and actually works) now. Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Added mesf() command (combination of mes() and sprintf())Haru1-0/+33
Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Added _$() macro to the script engine to mark a translatable string as ↵Haru1-2/+9
format string - Strings passed to sprintf should use the _$() macro instead of _(), to generate the .pot translation template with a directive to correctly handle the % sign. - Strings passed through _() are instead explicitly marked as regular (non format) strings if they contain '%'. Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Split sprintf logic out of buildin_sprintf (to be used by other commands as ↵Haru1-214/+234
well)
2016-06-25Removed the uncommon (and useless) multi-argument variant of mes()Haru1-12/+3
Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Moved translations template generator to a pluginHaru1-77/+0
Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Improved the format of the exported .pot translation templateHaru1-1/+1
Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Split translation handling out of parse_simpleexpr_string()Haru1-73/+81
Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Split parse_simpleexpr() in specialized sub-functions (HPM compatibility)Haru1-178/+212
- parse_simpleexpr_paren() - parse_simpleexpr_number() - parse_simplexpr_string() - parse_simpleexpr_name() Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Correctly escaped special characters in the generated_translations.potHaru1-15/+11
Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Improved handling of nested function calls by the HULDHaru1-17/+14
Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Re-implemented BUILDIN(sprintf)Haru1-93/+188
- The function now checks its arguments, rather than passing them to the system implementation (safer against arbitrary memory access or wrong variable type) - Implemented positional ('%1$d') specifiers (POSIX style) - See script_commands.txt for details about the supported format specifiers. Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Changed script->translation_buf to a VECTORHaru1-25/+24
Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Replaced script_code::script_buf with a VECTORHaru1-36/+43
- Fixes various signed/unsigned comparisons. Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Replaced script->buf with a VECTORHaru1-121/+119
- Fixes various signed/unsigned comparisons. Signed-off-by: Haru <haru@dotalux.com>
2016-06-25Replaced struct script_string_buf definition with a VECTORHaru1-80/+73
- Fixes various signed/unsigned comparisons. Signed-off-by: Haru <haru@dotalux.com>
2016-05-14Removed leftover definition of BUILDIN(checkre)Haru1-62/+0
- The command was already deprecated in ca877ec and removed in 7e93d08 - Resolves #1288 Signed-off-by: Haru <haru@dotalux.com>
2016-05-08Fixed various issues pointed out by cppcheckHaru1-31/+23
Signed-off-by: Haru <haru@dotalux.com>
2016-04-29Fix issues found by new warnings.Andrei Karas1-0/+1
2016-04-23Removed the 'len' argument from clif_disp_onlyself() and clif->disp_message()Haru1-1/+1
- The argument was redundant, since the passed value is always the same as the passed string's length (it doesn't make sense otherwise). The argument is implicit now. Less typing and less errors. Signed-off-by: Haru <haru@dotalux.com>
2016-04-23Corrected the type of the 'length' argument of various broadcast-related ↵Haru1-14/+25
functions - Variable types were changed to int - Corrects several warnings in VS2015 - Affected functions: `clif->broadcast()`, `clif->broadcast2()`, `intif->broadcast()`, `intif->broadcast2()` Signed-off-by: Haru <haru@dotalux.com>
2016-04-23Changed map_session_data::chatID to int (and renamed to chat_id)Haru1-1/+1
- Chat IDs are signed integers. - Resolves various warnings, depending on the compiler settings. Signed-off-by: Haru <haru@dotalux.com>
2016-04-04Merge pull request #1210 from HerculesWS/wcast_qualAndrei Karas1-148/+178
Added -Wcast-qual compiler flag
2016-04-02Unittalk script cmd shouldn't display the hidden name of npcAngelmelody1-1/+5
Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Dropped typedef from DBMapHaru1-4/+6
Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Dropped typedef from DBIteratorHaru1-11/+14
Signed-off-by: Haru <haru@dotalux.com>
2016-03-20Dropped typedefs from union DBKey and struct DBDataHaru1-4/+7
Signed-off-by: Haru <haru@dotalux.com>