summaryrefslogtreecommitdiff
path: root/src/map/npc.c
AgeCommit message (Collapse)AuthorFilesLines
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.
2014-04-02Added UTF-8 BOM detectionHaru1-0/+12
- This prevents things like the following from happening, by warning the user if an incompatible file is loaded: http://hercules.ws/board/topic/5126-mapname-selft-announcer/?p=33068 - We're erroring out instead of ignoring it, as explained in the source comment. - Special thanks to jaBote. Signed-off-by: Haru <haru@dotalux.com>
2014-03-14Added internal awareness of active script instancesshennetsind1-7/+9
Fixes the following issues: - donpcevent could cause a crash when used to a event of the same npc - input/other-dialog-interactions could cause a crash when sending data to a disabled-fakenpc-id'd. Special Thanks to Haruna, ossi0110. Signed-off-by: shennetsind <ind@henn.et>
2014-03-05Ref redesign, part 2Haru1-3/+2
- Reorganized regs var/array DBMaps into a specific reg_db structure Signed-off-by: Haru <haru@dotalux.com>
2014-02-27Cleaned up messages.confHaru1-13/+12
- Removed some unused messages. - Re-mapped some duplicate IDs - fixes bugreport:8057, thanks to AnnieRuru http://hercules.ws/board/tracker/issue-8057-jobname-with-invalid-id-return-tomb/ - Fixed some issues with the message range loaded by the char server. - Reworded some messages, fixed typos in others. Note for translation users: some messages have been remapped to new IDs. You'll need to remap them in your custom translations as well. The list of changes is as follows: - Removed messages (you can safely remove them from your translations): 15, 26-27, 35, 48-52, 57-58, 65-69, 82-83, 86-87, 91, 101, 140-142, 164, 189-194, 199-200, 202-203, 209-211, 215-218, 267-268, 275, 289-290, 380-385, 387-388, 401, 497, 499, 535-537, 922, 995, 1063, 1079, 1291-1294 - New messages (you need to add them to your translations): 15 - Moved messages (you need to change their IDs in your translations file): * [Unknown Job] 656 -> 620, * [Job names] 681~693 -> 656~668 * [Tombstone related] 656~661 -> 856~861 * [Etc messages] 662~680 -> 862~880 * [@version] 1436 -> 1294 * [Hercules Chat] 1475 -> 1436 Signed-off-by: Haru <haru@dotalux.com>
2014-02-03Fixed Bug 7333shennetsind1-6/+11
Zones are now able to merge during runtime. Special Thanks to Haru, kyeme. http://hercules.ws/board/tracker/issue-7333-map-zone-db/ Signed-off-by: shennetsind <ind@henn.et>
2014-01-23Compatibility fixes for NetBSD and SolarisHaru1-2/+2
- Fixed some warnings in NetBSD (5.x and 6.x) and Solaris (11) Signed-off-by: Haru <haru@dotalux.com>
2014-01-12Two Adjustmentsshennetsind1-1/+1
From some notes I took while working on the megapatch: - Dropped unused char_dat variable in chrif's auth_node - Fixed DB/BB/PB Logging, which could create false logs due to where it was placed. Signed-off-by: shennetsind <ind@henn.et>
2014-01-01Correctly removed persistent database entries for disabled NPC Market scriptsHaru1-7/+14
- When a Market script is disabled or removed, its database entries are now correctly cleared upon reloadscript and/or server restart. - Special thanks to ossi0110. Signed-off-by: Haru <haru@dotalux.com>
2013-12-24Follow up cf19b26d50ac96111e44c33a80afd1f1ea935cecshennetsind1-3/+9
Fixed selllist on zeny trader. Special Thanks to Thunderbolt, bleachftl and Frost Signed-off-by: shennetsind <ind@henn.et>
2013-12-24Christmas Patch - 2013-12-23 Supportshennetsind1-79/+487
Info: http://hercules.ws/board/topic/3614-christmas-patch-gifto/ Signed-off-by: shennetsind <ind@henn.et>
2013-12-17Fixed several compiler warningsHaru1-11/+10
- Warnings detected thanks to Xcode's compiler settings (more strict by default) and clang, warnings mostly but not only related to data sizes on 64 bit systems, that were silenced until now by very lax compiler settings. - This also decreases by a great deal the amount of warnings produced by MSVC in x64 mode (for the adventurous ones who tried that) - Also fixed (or silenced in case of false positives) the potential issues pointed out by the (awesome) clang static analyzer. - Patch co-produced with Ind, I'm merging and committing in his place! Signed-off-by: Haru <haru@dotalux.com>
2013-12-09Fixed some logic errorsshennetsind1-5/+8
Special Thanks to Haru Signed-off-by: shennetsind <ind@henn.et>
2013-12-06HPM: mapindex interfaceshennetsind1-4/+4
Signed-off-by: shennetsind <ind@henn.et>
2013-12-01Changed variables, labels, functions, commands to case sensitive.Haru1-7/+8
- Fixes bugreport:7810, thanks to Wend, kyeme, evilpuncker, jaBote, and various other people I may be forgetting to mention http://hercules.ws/board/tracker/issue-7810-disguise-script-command - Due to the nature of this change, I'm leaving the deprecation messages lingering around for a while more (as errors rather than warnings), to make sure they won't pass unnoticed, in case you haven't yet updated your custom scripts to comply with this. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2013-12-01Changed builtin keywords in the script engine to case sensitive.Haru1-34/+31
- Any scripts using the wrong case, that were throwing deprecation warnings until now, will become invalid. - Related to bugreport:7810. Signed-off-by: Haru <haru@dotalux.com>
2013-11-13Follow up 8fda38dcdabbb9d252b0e11fb07b2ad37f9e659fshennetsind1-0/+2
Fixed compiler error on selected systems, thanks to haruna bringing it up! Signed-off-by: shennetsind <ind@henn.et>
2013-11-13HPM Custom Data Struct Makeover!shennetsind1-0/+11
- Modified how the core handles it, making it easier to add new points. - Modified how plugins call it, calls were made shorter, e.g. 'HPMi->getFromSession(session[fd],HPMi->pid,0)' => 'getFromSession(session[fd],0)' -- check src/common/HPMi.h #defines for all the options - Added support for npc_data (getFromNPCD and so on) as requested in http://hercules.ws/board/topic/2923-hpm-custom-struct-npcs/ Signed-off-by: shennetsind <ind@henn.et>
2013-11-10Added deprecation messages for incorrect capitalization in scriptsHaru1-0/+25
- These messages are temporary, only meant to help those with custom scripts to transition them to the correct case-sensitive syntax. If you ignore the deprecation messages you encounter, your scripts may continue to work just as they did until now, but this will no longer be true in the near future, and they may stop working at any time. If you ignore this, and your scripts break, you'll get to keep the pieces :) Signed-off-by: Haru <haru@dotalux.com>
2013-11-08Fixed Bug 7807shennetsind1-1/+1
NPC Duplicates with xs/ys weren't being properly loaded, Special Thanks to Haruna. Also fixes an issue with the instance empty timer. http://hercules.ws/board/tracker/issue-7807-endless-tower/ Signed-off-by: shennetsind <ind@henn.et>
2013-11-05Introducing the Hercules Standalone Script Syntax CheckerHaru1-33/+36
- Added a command line argument '--script-check' to check a script's syntax without running the server (and without requiring a SQL connection). Usage: ./map-server --script-check /path/to/the/script.txt - For convenience, a script-checker bash script is provided, to set the path correctly when called from a different directory. Usage: /path/to/Hercules/script-checker /path/to/the/script/to/check.txt - While the script checker will supposedly work under windows as well, no convenience scripts are currently provided for platforms other than UNIX (feel free to open a pull request with a .bat launcher or whatever you like) - Integration with IDEs or text editors is possible. In fact, I already have a fully functional plugin for vim (through vim-syntastic), and if there's enough interest, I'll publish it. - screenshot: http://d.pr/i/NOBD - If you want an online checker, http://haru.ws/scriptchecker/ is running this code, without modifications and will be kept up to date (without any warranty though.) - Special thanks to Ind, Yommy, Streusel, who helped making this possible, in a way or another.
2013-11-04Standardized the format of some NPC parse error messagesHaru1-37/+37
- For better machine-parsing of such messages (i.e. in IDEs) Signed-off-by: Haru <haru@dotalux.com>
2013-11-03Allow warp duplicates without a 'facing' valueHaru1-2/+4
- Warps don't require a facing, so their duplicates shouldn't either. - Credits to jaBote. Signed-off-by: Haru <haru@dotalux.com>
2013-10-28Clean up to view id parsing and small fixes thanks for Haruna and Ind.Kisuka1-30/+15
2013-10-28Added ability to use constants instead of sprite IDs for NPCs. Converted all ↵Kisuka1-5/+67
npcs to use this.
2013-10-26Changed 'tick' variables to 64 bitHaru1-13/+10
- This fixes an issue with timers that stop working after about 24-49 days when the tick overflows (note that this may happen much earlier than that, and at hard to predict times, on some systems) - Updated the RDTSC help message in the configure script to also warn users about issues with SpeedStep enabled systems. - On Windows, tick() still has a resolution of 10~15ms (or even as low as 100ms on some systems). A TODO comment (thanks, Ai4rei) was added for a follow-up patch, as I want this one to be as small as possible) - Note: on Windows versions earlier than 6.x (Vista, Server 2008), the tick overflow issue is NOT fixed, since they don't support the function used to retrieve a 64 bit tick. This isn't a big issue, since those platforms are already - or going soon to be - out of their extended support period, and it's already advisable to upgrade, for other reasons. If you're the unfortunate user of such a system, it is recommended that you reboot your machine at least once every 49 days for Hercules to work reliably. - Note: To clear some doubts, since I've already been asked, this has absolutely NOTHING to do with 32/64 bit CPUs or OSes. It's all about a variable's size, not the size of registers of your CPU, and your 32bit CPU will be able to handle this just fine. Signed-off-by: Haru <haru@dotalux.com>
2013-10-25Merge pull request #202 from kisuka/mastershennetsind1-0/+3
Quest Bubbles (Actually Works Finally)
2013-10-25nocashshop mapflagshennetsind1-0/+2
As requested by the community in http://hercules.ws/board/topic/1477-mapflag-for-cash-shop/ and http://hercules.ws/board/topic/1476-disable-cashshop-in-pvp-woe/ 'nocashshop' mapflag disables the usage of the cashshop button as well as any attempts to purchase (in case the flag is turned on after someone gets the shop open). Signed-off-by: shennetsind <ind@henn.et>
2013-10-25Quest Bubbles Updateshennetsind1-0/+3
- Introduced questinfo cache, memory & processing speed improvement - Fixed mini-map marker support Special Thanks to Haruna Signed-off-by: shennetsind <ind@henn.et>
2013-10-19Instance Dungeons Updateshennetsind1-4/+4
As requested by the community in http://hercules.ws/board/topic/1702-implement-rathena-npc/ we're merging in the latest of rAthena's dungeons, this includes the rewriting of all instance dungeons and the addition of 4 dungeons that were not present previously (BakonawaLake, BangungotHospital, BuwayaCave and OldGlastHeim). Update also includes the ability for instances to reset (or be destroyed if instance files were disabled/removed) upon @reloadscript, instance scripts are able to control to what stage the instances are to be reset via the instance_set_respawn (reload spawn) script command, OnInstanceInit labels are now triggered when the instance starts via instance_init (and upon reload), they may be used alongside instance variables (which are persistent to @reloadscript) to save players' progress. - NPC Changelog: -- npc/instances/EndlessTower.txt --- 2.2 Instance system rewrite. [Euphy] --- 2.3 Added some missing announcements. [Euphy] --- 2.4 Added GM management function. [Euphy] -- npc/instances/NydhoggsNest.txt --- 1.5 Instance system rewrite. [Euphy] --- 1.6 Added GM management NPCs. [Euphy] -- npc/instances/OrcsMemory.txt --- 1.7 Instance system rewrite. [Euphy] -- npc/instances/SealedShrine.txt --- 2.3 Instance system rewrite. [Euphy] -- npc/other/gm_npcs.txt --- 1.0 First version. [Euphy] -- npc/re/instances/BakonawaLake.txt --- 1.0 First version. [Euphy] --- 1.1 Added GM management NPC. [Euphy] -- npc/re/instances/BangungotHospital.txt --- 1.0 First version. [Euphy] --- 1.1 Added GM management function. [Euphy] -- npc/re/instances/BuwayaCave.txt --- 1.0 First version. [Euphy] -- npc/re/instances/HazyForest.txt --- 1.1 Instance system rewrite. [Euphy] -- npc/re/instances/MalangdoCulvert.txt --- 1.0b Fixed incorrect use of 'close'. [Joseph] --- 1.1 Instance system rewrite. [Euphy] -- npc/re/instances/OctopusCave.txt --- 1.1 Instance system rewrite. [Euphy] -- npc/re/instances/OldGlastHeim.txt --- 1.0 First version. [Euphy] Special Thanks to Haru, Uziel for their contributions to this update, and ossi0110 for helping us debug it. Signed-off-by: shennetsind <ind@henn.et>
2013-10-07Fixed Bug #7744shennetsind1-4/+2
Adjusted missing #ifdef behavior to be friendly to the hooking. http://hercules.ws/board/tracker/issue-7744-compiler-error-on-hpm-hooking-after-undefined-packetver-re/ Signed-off-by: shennetsind <ind@henn.et>
2013-10-02HPM: Map.c Completedshennetsind1-259/+259
Fully Interfaced. Moved missing vars and declarations of interest into the interface, removed duplicate mentions of map within calls to shorten wherever it made sense to. Ladies and Gentleman its my pleasure to announce that with this commit we've revised all of map-server, we've learned a hell lot from this, improved many things on the go and have a number of features to be released thanks to this. *cough* hpm hooking *cough*. Signed-off-by: shennetsind <ind@henn.et>
2013-09-27HPM: Chat.c Completedshennetsind1-1/+1
Moved missing vars and declarations of interest into the interface, removed duplicate mentions of chat within calls to shorten wherever it made sense to, and renamed some members to ease reading. Signed-off-by: shennetsind <ind@henn.et>
2013-09-27Renamed iMap interface to mapHaru1-198/+174
Signed-off-by: Haru <haru@dotalux.com>
2013-09-27Renamed iStatus interface to statusHaru1-9/+8
Signed-off-by: Haru <haru@dotalux.com>
2013-09-26Renamed variables that would conflict with a rename of iMap to mapHaru1-261/+261
Note to plugin developers: if you were importing the "map", you'll need to change it to "maplist" Signed-off-by: Haru <haru@dotalux.com>
2013-09-25Merge branch 'master' of https://github.com/HerculesWS/Herculesshennetsind1-42/+30
Conflicts: src/map/chrif.c src/map/clif.c src/map/homunculus.c src/map/pet.c src/map/script.c src/map/skill.c src/map/status.c All clear.
2013-09-25Renamed iTimer interface to timer.shennetsind1-25/+25
Also removed duplicate mentions of timer within calls to shorten.
2013-09-25Renamed local variables that would conflict with a rename of iTimer to timerHaru1-3/+3
Signed-off-by: Haru <haru@dotalux.com>
2013-09-25Renamed more forgotten variables during interface conversionsHaru1-2/+2
(related: b9c8f57) Most renames are trivial (just to avoid shadowing global variables, even if they currently did no harm), but there were some cases of partly renamed variables that caused some NULL checks to always pass and who knows what could have been happened when they were too subtle to make the application crash. Also corrected some potentially unsafe macro definitions Signed-off-by: Haru <haru@dotalux.com>
2013-09-21Fixed a potentially negative array subscript causing a mapserver crashHaru1-37/+25
- Fixes bugreport:7717, special thanks to quesoph http://hercules.ws/board/tracker/issue-7717-map-crash-when-warping-on-a-floating-npc/ - Also changed various map[foo].index to the map_id2index(foo) macro. Signed-off-by: Haru <haru@dotalux.com>
2013-09-17HPM: npc_chat.c Interfacedshennetsind1-1/+1
Fully Integrated, closes #117 Also updated buildin_ functions to match latest script.c/.h macros. Signed-off-by: shennetsind <ind@henn.et>
2013-09-17HPM: Itemdb.c Interfaceshennetsind1-4/+4
Fully Integrated. Closes #110 Signed-off-by: shennetsind <ind@henn.et>
2013-09-16HPM: Pet.c Interfaceshennetsind1-4/+4
Fully Integrated. Signed-off-by: shennetsind <ind@henn.et>
2013-09-16HPM: Npc.c Interfaceshennetsind1-272/+343
Fully Interfaced. Special Thanks to Haruna Signed-off-by: shennetsind <ind@henn.et>
2013-09-16HPM: Unit.c Interfaceshennetsind1-3/+3
Fully Interfaced Signed-off-by: shennetsind <ind@henn.et>
2013-09-16HPM: Mob.c Interfaceshennetsind1-47/+47
Fully Interfaced Signed-off-by: shennetsind <ind@henn.et>
2013-07-29Added intif interfaceSusu1-2/+2