summaryrefslogtreecommitdiff
path: root/src/map/npc.c
AgeCommit message (Collapse)AuthorFilesLines
2015-05-19Fixed some issues reported by coverity scan [2/3]Haru1-7/+22
- Corrected some NPC ID range checks Signed-off-by: Haru <haru@dotalux.com>
2015-05-19Fixed some issues reported by coverity scan [1/3]Haru1-3/+4
Signed-off-by: Haru <haru@dotalux.com>
2015-05-17Fixed some issues detected by coverity scanHaru1-8/+11
Signed-off-by: Haru <haru@dotalux.com>
2015-03-15Follow up 330e31cc71ece055908acb1eb967b4009ebc9c46shennetsind1-0/+1
Fixed an issue caused by unescaped characters being written and read out of the .pot unproperly. This commit also causes map server to print the file it wrote to when terminating Signed-off-by: shennetsind <ind@henn.et>
2015-02-23Hercules Ultimate Localization Designshennetsind1-6/+22
Servers can now run on any number of languages, without editing npc files. Designed by Haruna and Ind http://hercules.ws/board/topic/8687-hercules-ultimate-localization-design/ Signed-off-by: shennetsind <ind@henn.et>
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru1-38/+37
- Variable scopes reduced - Parenthesized ambiguous expressions - Removed or added NULL checks where (un)necessary - Corrected format strings - Fixed typos potentially leading to bugs Signed-off-by: Haru <haru@dotalux.com>
2015-01-18Fixing 38 issuesshennetsind1-2/+1
Addressing out of bounds read/write, pointless null checks on already deferenced variables, dead code. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-1727 Fixesshennetsind1-1/+1
Addressing out of bounds read/write, pointless null checks on already deferenced variables. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-17Another ~10 Fixesshennetsind1-1/+2
Addressing out of bounds read/write. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-02Add npcdb_checkid to npc interface.Andrei Karas1-1/+9
2015-01-01Merge pull request #425 from 4144/fixesHaruna1-11/+13
Different fixes after automatic checks
2014-12-31Remove useless checks.Andrei Karas1-3/+3
2014-12-31Add some missing null pointer checks after automatic checks.Andrei Karas1-8/+10
2014-12-31fix for bug http://hercules.ws/board/tracker/issue-8483-map-crash/Andrei Karas1-0/+6
2014-12-16If player left npc, call onUnTouch event.Andrei Karas1-1/+8
2014-12-16Add function what called if player leave npc area.Andrei Karas1-0/+11
2014-12-16Add function what call OnUntouch event.Andrei Karas1-2/+14
2014-12-16Fix script error termination if already running script continue from very ↵Andrei Karas1-1/+1
far npc. Note for Haruna: possible it may add side effects. Need check.
2014-12-15add npc area size field.Andrei Karas1-6/+13
2014-11-28Add function for create npc.Andrei Karas1-39/+21
2014-11-27Fix npc->parse_unknown_object usage.Andrei Karas1-1/+1
2014-11-27Add function for parse or report about unknown object in parsing script file.Andrei Karas1-3/+10
2014-11-27Add function for parse/report unknown map flag.Andrei Karas1-2/+10
2014-11-16Whitespace cleanup (no code changes)Haru1-23/+26
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
2014-10-28Removed some temporary case-check error messages.Haru1-1/+1
- Control flow statements (break, case, continue, default, do, for, if, switch, whilei, else) and sub-function declarations (function) will no longer show a custom error message when they are incorrectly capitalized. - Note: This does not mean that they are no longer case-sensitive. This only means that no special message will be shown in case such an error is detected. The script engine will throw a normal error, as it would with any other kind of typo, rather than treating this as a special case. Enough time was given to update third party scripts, and it is now time to clean up our parsing code and get rid of these special warnings. - Variables, labels and commands will still show a warning for the time being, since the side-effects of silently ignoring it could be quite dangerous. An alternative approach to the case-check will be presented in future. For now, those who want to disable it (and save a bit on execution time and memory use), can simply comment out the #define ENABLE_CASE_CHECK line in script.h, as usual. Signed-off-by: Haru <haru@dotalux.com>
2014-10-28Removed some temporary case-check error messages.Haru1-19/+0
- Top level commands (function, warp, shop, cashshop, script, trader, duplicate, monster, boss_monster, mapflag) will no longer show a custom error message when they are incorrectly capitalized. - Note: This does not mean that the commands are no longer case-sensitive. This only means that no special message will be shown in case such an error is detected. The script engine will throw a normal error, as it would with any other kind of typo, rather than treating this as a special case. Enough time was given to update third party scripts, and it is now time to clean up our parsing code and get rid of these special warnings. Signed-off-by: Haru <haru@dotalux.com>
2014-10-25Added some missing variable initializationsHaru1-6/+6
- The issue was caused by memcmp failing because of garbage in structs padding. - Fixes bugreport:8410, special thanks (and credits for the fix) to Garr http://hercules.ws/board/tracker/issue-8410-autotradeat-issue/ - Also reduced scope of some variables, where appropriate. - Thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2014-10-23Improved bindatcmd handling of spaces in parameters.Haru1-20/+22
- Parameters passed to bindatcmd-invoked labels are now properly space-delimited. - This is in order to support strings containing multiple spaces or containing a trailing space. Previously it was impossible to create a bindatcmd command that could accept a player name such as 'This name has two spaces' or 'Sir Trailingspace '. - Added documentation and usage examples, especially wrt space handling. See doc/script_commands.txt for details. - NOTE: Your custom atcommand labels may need edits, as we're no longer trimming multiple sequantial spaces or trailing spaces, in order to gain more flexibility. It is your care to do that. - Special thanks to Dastgir, jaBote. Signed-off-by: Haru <haru@dotalux.com>
2014-10-18Renamed DeprecationWarning to DeprecationCaseWarning, since that's what it ↵Haru1-11/+11
is about. Signed-off-by: Haru <haru@dotalux.com>
2014-09-20Fixed Bug 8272shennetsind1-1/+1
Fixed issue where 'pvp off' mapflag would assign the map the pk zone (this would not affect the pvp status of the map, only the disabled_ settings). Special Thanks to kyeme http://hercules.ws/board/tracker/issue-8272-map-zone-db-mapflags/ Signed-off-by: shennetsind <ind@henn.et>
2014-09-20Fixed Bug 8301shennetsind1-2/+6
reloadscript now clears npc-spawned (by warpportal script command) warps properly. Special Thanks to Emistry, Cydh http://hercules.ws/board/tracker/issue-8301-warpportal-reloadscript-map-server-error/ Signed-off-by: shennetsind <ind@henn.et>
2014-09-08Fix on start possible buffer overruns.Andrei Karas1-1/+1
Checks after using --enable-sanitize.
2014-08-07Corrected several format-string errors through the codeHaru1-3/+4
- Functions that expect a printf-style format string are now marked as such, so that gcc/clang will emit a warning warn you if you mismatch format string and arguments. Signed-off-by: Haru <haru@dotalux.com>
2014-07-11Fixed reserved __identifier violationsHaru1-1/+1
- Complies with CERT DCL37-C - Fixes issue #293 (special thanks to elfring) Signed-off-by: Haru <haru@dotalux.com>
2014-06-28Changes in npc_parse_shop in order to fit documentation standard, now an ↵panikon1-7/+29
unlimited item amount is supported in SHOP/CASHSHOP NPC objects and when value is a negative value other than -1 a warning is shown
2014-06-28Changes in npc_parsefile in order to decrease the number of unecessary calls ↵panikon1-11/+16
to strcmp Fixed issue that different header syntax would lead to a deprecation warning instead of the proper error
2014-05-30Fixed typos inside src/Shido1-5/+5
2014-05-13Removed trailing whitespace (sources)Haru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2014-05-10Follow-up to 5f1529083ad1f35a3ac66cc041ee74d6db2f3552Haru1-1/+5
- Now the map-server returns nonzero even on nomral runs (or --run-once) if any script failed loading. Signed-off-by: Haru <haru@dotalux.com>
2014-05-10Re-commit of "Fixed order of includes in all source files"Haru1-27/+30
This reverts commit 94657284973f4037596bae468ebfbee5c217e02b.
2014-05-10Revert "Fixed order of includes in all source files"panikon1-30/+27
This reverts commit b6b3f58795288701d0e162d43fa6f0a47af913b3. Fixes issue 8184 http://hercules.ws/board/tracker/issue-8184-cart-related/
2014-05-10Optimized THQS_TTShop.txt and corrected a minor mistakepanikon1-8/+7
Added npc_market_data_db to inter-server.conf Added shop message to messages.conf Fixed small typo in clif_GM_kickack
2014-05-10Small changes in npc loading/reloadingpanikon1-52/+53
Compartmentalized npc file processing Corrected event initalisation order in npc_reload Changed loading order, now item db constants are loaded before npc processing in order to avoid labels overwriting constants values, like Aegis Names Added information regarding reloading scripts in /doc/script_commands.txt
2014-05-09Added documentation regarding trader objects in script_commands.txtpanikon1-30/+30
Added enumered returns to npc_cashshop_buy and to npc_cashshop_buylist
2014-05-09Fixed order of includes in all source filesHaru1-27/+30
- Changed order according to the (upcoming) code style guidelines. - Fixes several issues caused by missing headers when their include order is changed or in plugins. Signed-off-by: Haru <haru@dotalux.com>
2014-05-09Return EXIT_FAILURE if a script parse error occurred.Haru1-95/+144
- This affects normal execution as well as ./script-checker runs. Signed-off-by: Haru <haru@dotalux.com>
2014-05-06Bug fixes and other changespanikon1-3/+18
#Fixed issue where a corrupted map cache would lead to a crash *Moved Big-endian compatibility functions to common/utils.h #Fixed issue 8162 *http://hercules.ws/board/tracker/issue-8162-loadnpc-doesnt-trigger-oninit-of-duplicate-npcs/ *Added options to npc_parse_duplicate #Fixed issue 8169 *http://hercules.ws/board/tracker/issue-8169-script-command-guildskill-skill-idlevel-not-working-as-intended/ *Changed *guildskill behavior, now it behaves exactly as depicted in the documentation *Updated *guildskill documentation #Added missing GBI types to mapif_parse_GuildBasicInfoChange now it's possible to change guild exp, lv, skill point and skill information #GeoIP revamp *GeoIP module was partially rewritten *Added several data checks to prevent corruption and crashes *Updated GeoIP database *See https://github.com/maxmind/geoip-api-c/blob/master/libGeoIP/GeoIP.c for more information #Added packetver checks regarding NST_MARKET *Now *tradertype warns if user is trying to use this feature with older clients
2014-04-12Fixed some compiler/analyzer warnings.Haru1-2/+1
- Sanitized some macros (they weren't going to cause problems, but better being safe than sorry) - Parenthesized an incorrect expression in 6f6a6b3. - Inverted an if(foo); else bar; statement in 6f6a6b3 to get rid of the empty expression (for legibility). - Commented out some unnecessary lines as suggested by clang's static analyzer. Signed-off-by: Haru <haru@dotalux.com>
2014-04-11Fixed issue: 7694panikon1-4/+9
http://hercules.ws/board/tracker/issue-7694-guild-notice/ Follow up to 7a5f7db Follow up to 4147d9f
2014-04-10Fixed issue: 8140panikon1-0/+7
http://hercules.ws/board/tracker/issue-8140-toucan-npc-error-message/ That error usually happens when the player clicked on a NPC that has the view id of a mob, to activate this kind of npc it's needed to be in a 2,2 range from it. If the OnTouch area of a npc, coincides with the 2,2 range of another it's expected that the OnTouch event be put first in stack, because unit_walktoxy_timer is executed before any other function in this case. So it's best practice to put an 'end;' before OnTouch events in npcs that have view ids of mobs to avoid this kind of error. Also updated script_commands.txt to add this recomendation.