summaryrefslogtreecommitdiff
path: root/src/map/script.c
AgeCommit message (Collapse)AuthorFilesLines
2015-08-15HPM compatibility improvementsHaru1-0/+1
Improved compatibility, portability and standards conformance. - Since it is not possible to portably and reliably re-use the core's symbols in plugins, symbols are no longer exported unless explicitly required, in the UNIX builds. This mimics the Windows behavior and adds HPM compatibility to OSes such as FreeBSD. Credits to Andrei Karas for making this possible. - For convenience, it is no longer necessary to call GET_SYMBOL, since the plugin will automatically import all the available symbols when it's loaded, depending on the included headers. - Plugins are now supposed to include the "common/hercules.h" header before including anything else. Incluing common/HPMi.h, common/cbasetypes.h or conf/core.h is no longer necessary, as those are guaranteed to be automatically included by hercules.h. - HPM API version bumped to 1.1. Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Moved session array into the socket interfaceHaru1-3/+3
Signed-off-by: Haru <haru@dotalux.com>
2015-08-15Cleaned up socket interfaceHaru1-1/+1
- Replaced some macro calls with the proper interface syntax - Removed useless macros and workarounds API changes summary: - WFIFOSET() can now be safely used both inside and outside socket.c - RFIFOSKIP() can now be safely used both inside and outside socket.c - do_close() is now sockt->close() - flush_fifo() is now sockt->flush() - flush_fifos() is now sockt->flush_fifos() - getips() is now sockt->getips() - host2ip() is now sockt->host2ip() - ip2str() is now sockt->ip2str() - ntows() is now sockt->ntows() - make_connection() is now sockt->make_connection() - make_listen_bind() is now sockt->make_listen_bind() - realloc_fifo() is now sockt->realloc_fifo() - realloc_writefifo() is now sockt->realloc_writefifo() - session_isActive() is now sockt->session_is_active() - session_isValid() is now sockt->session_is_valid() - set_defaultparse() is now sockt->set_defaultparse() - set_eof() is now sockt->eof() - set_noblocking() is now sockt->set_noblocking() - str2ip() is now sockt->str2ip() Signed-off-by: Haru <haru@dotalux.com>
2015-08-10Add script interface function run_pet. It do same thing as run.Andrei Karas1-0/+1
2015-08-10Add script interface function run_npc. It do same thing as run.Andrei Karas1-1/+2
2015-08-10Move unequip item script function call into function ↵Andrei Karas1-0/+17
script_run_item_unequip_script.
2015-08-10Move equip item script function call into function script_run_item_equip_script.Andrei Karas1-0/+17
2015-08-10Move use item script function call into function script_run_use_script.Andrei Karas1-2/+19
2015-08-09Removed deprecated script command checkreHaru1-1/+0
- Follow-up to ca877ecbef0d3fe8df1b69fcaa9e72693c104f02 Signed-off-by: Haru <haru@dotalux.com>
2015-08-05Add optional parameter to warp script command for prevent stoping npc ↵Andrei Karas1-1/+7
scripts after warp.
2015-07-15Follow up 98274e4 fix script command questactive warningsAngelmelody1-5/+14
Signed-off-by: Angelmelody <Angelmelody@gmail.com>
2015-07-08Update Unique ID system to match official now it cover all cash items ↵Ibrahim Hossam1-0/+12
include stackable ones. Implement ForceSerial option in Package Item Database to force serial for any item. Implement ForceSerial option in item database to force serial for any item. Implement Merge Client interface to merge stackable items with serial numbers ( check npc/other/item_merge.txt ).
2015-07-05Follow up 25c5a610555f442005d562ad463a4f22efb6f744Emistry1-1/+1
missing character.
2015-07-05Added script command `showscript "<message>"{,<GID>};`Emistry1-0/+32
Makes attached player or GID says a message like shouting a skill name, the message will be seen to everyone around but not in chat window.
2015-06-19Removed ".." from include directivesHaru1-47/+46
- Include directives are now directory-independent. - This will allow building plugins from other directories in future. Signed-off-by: Haru <haru@dotalux.com>
2015-06-04Implemented strcmp Function.Dastgir1-0/+9
2015-06-01Replaced some of the hardcoded values with constants (map)Haru1-32/+29
- Replaced several hardcoded values with the appropriate enums. - Added documentation for some hardcoded values that haven't been replaced by enums (yet) - Minor code legibility improvements. Signed-off-by: Haru <haru@dotalux.com>
2015-05-19Fixed some issues reported by coverity scan [1/3]Haru1-0/+2
Signed-off-by: Haru <haru@dotalux.com>
2015-05-18Removed duplicates of clif->msgtableHaru1-1/+1
- Removed clif->msgtable, and renamed clif->msg to clif->msgtable. - Removed clif->msgtable_num, and renamed clif->msg_value to clif->msgtable_num - Renamed clif->msg_skill to clif->msgtable_skill - Removed clif_viewequip_fail - Replaced hardcoded message IDs with constants (see enum clif_messages) Signed-off-by: Haru <haru@dotalux.com>
2015-05-17Fixed some issues detected by coverity scanHaru1-2/+2
Signed-off-by: Haru <haru@dotalux.com>
2015-05-16Added charid2rid script commandHaru1-0/+18
- Returns the account ID (RID) for the given character ID. - As per Streusel's request. Signed-off-by: Haru <haru@dotalux.com>
2015-05-16Fix log10() function actually using log10. Used natural log before.Streusel1-1/+1
2015-05-15Renamed log to log10, as it is creating errors with items called Log.Streusel1-21/+2
Removed floor() and ceil() as they don't make sense since everything is int to begin with.
2015-05-15Added floor(), ceil() and log() functions for usage in scripts.Streusel1-10/+40
2015-05-08Deprecated command checkre().Haru1-1/+1
- The command is deprecated and it will be removed in about a month. Please use the constants RENEWAL, RENEWAL_CAST, RENEWAL_DROP, RENEWAL_EXP, RENEWAL_LVDMG, RENEWAL_EDP, RENEWAL_ASPD instead. Signed-off-by: Haru <haru@dotalux.com>
2015-05-08Removed deprecated command isdayHaru1-6/+0
- Follow-up to b1b1b1aa8edc866a83029081e93d3e7d0f138189 Signed-off-by: Haru <haru@dotalux.com>
2015-05-08Added support for RENEWAL constants in scriptsHaru1-0/+37
Supported constants: - RENEWAL (globally enabled renewal mode) - RENEWAL_CAST (renewal cast time) - RENEWAL_DROP (renewal drop rate algorithms) - RENEWAL_EXP (renewal exp rate algorithms) - RENEWAL_LVDMG (renewal level modifier on damage) - RENEWAL_EDP (renewal enchant deadly poison algorithm) - RENEWAL_ASPD (renewal ASPD) Signed-off-by: Haru <haru@dotalux.com>
2015-04-25Merge pull request #502 from k-py/bugfix-return-getvariableofnpcHaruna1-11/+21
Fix script function return always removing references from NPC variables.
2015-04-25Fixed @changesex issues on PACKETVERs that don't support per-character sex.Haru1-7/+2
- Fixes bugreport:8504 http://hercules.ws/board/tracker/issue-8504-changesex/ - Existing database entries with an incorrect per-character sex will be fixed automatically when the character logs in to match the account's sex, if the PACKETVER doesn't support per-character sex. Signed-off-by: Haru <haru@dotalux.com>
2015-04-22Minor refactoring of script function return.Kpy!1-10/+13
2015-04-22Fix a crash condition when incorrectly using return outside the scope of a ↵Kpy!1-1/+8
function or subroutine.
2015-04-21Fix script function return always removing references from NPC variables.Kpy!1-1/+1
Bugreport:8642 http://hercules.ws/board/tracker/issue-8642-script-engine-issue-quo/
2015-03-15Follow up 330e31cc71ece055908acb1eb967b4009ebc9c46shennetsind1-3/+15
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-03-14Fixed a script function related memory leak on mapserver shutdownHaru1-8/+6
- If a script function was running when the server is shut down, the memory allocated by its local variables would not get freed. - Special thanks to Ind. Signed-off-by: Haru <haru@dotalux.com>
2015-03-05Memory Slasher: Script Parser Boostshennetsind1-17/+14
Noticed this improvement while working on the ultimate localization design. During my experiments I noticed an average 11% speed mod. This patch makes script (item/pet/npc) parsing 11% faster, while dropping map server memory usage by 2.7MB (its faster and uses less memory, signature Hercules achievement). Signed-off-by: shennetsind <ind@henn.et>
2015-02-28Skipped translations in minimal (script-checker) modeHaru1-0/+3
- Translations aren't used in script-checker mode, so there is no point loading them. - Fixes an error message caused by a missing default language when starting in script-checker mode. - Special thanks to Ind, jaBote. Signed-off-by: Haru <haru@dotalux.com>
2015-02-23Hercules Ultimate Localization Designshennetsind1-13/+605
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-02-15Fixed a parser issue on direct assignmentsHaru1-29/+35
- Fixes an undetected error in case a semicolon is missing after a direct assignment line in a script. - Special thanks to Dastgir. Signed-off-by: Haru <haru@dotalux.com>
2015-02-15Follow up 909c0644ce45945c8e3fdc5eb77ebdd1a1cb93d0shennetsind1-1/+0
No longer returns any value. Either it will succeed, or it will stop the script (at which point having a return value has no purpose) Signed-off-by: shennetsind <ind@henn.et>
2015-02-15Updated 'delequip' Script Commandshennetsind1-3/+6
delequip will now stop a script when attempting to delete a item in a position the player has no gear. Special Thanks to Michieru, Haruna. Signed-off-by: shennetsind <ind@henn.et>
2015-02-02Fixed state tracking of dialog windows when the script is suspended and resumedHaru1-1/+0
- If a script was suspended, and then resumed (`sleep2`, but also `getexp`), state tracking of dialog windows would get reset, and a `close` or `close2` would trigger a warning even if a message box was present. - Special thanks to Dastgir. Signed-off-by: Haru <haru@dotalux.com>
2015-01-24Added script command 'channelmes'Haru1-0/+26
Special thanks to Dastgir Signed-off-by: Haru <haru@dotalux.com>
2015-01-23Deprecated command isday().Haru1-1/+1
- The command is deprecated and it will be removed in about a month. Please use isnight() in your custom scripts instead. Signed-off-by: Haru <haru@dotalux.com>
2015-01-23Merged petskillattack and petskillattack2.Haru1-35/+9
Existing custom scripts will need edits. In a nutshell: - Existing calls to `petskillattack` should be changed to specify an extra <number of attacks> argument (after <skill level>), set to 0. - Existing calls to `petskillattack2` should be changed to `petskillattack`, keeping the same arguments. Signed-off-by: Haru <haru@dotalux.com>
2015-01-20Minor fixes and tweaks suggested by cppcheckHaru1-412/+413
- 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-9/+7
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-8/+12
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/+1
Addressing out of bounds read/write. Special Thanks to 4144 and Haruna! Signed-off-by: shennetsind <ind@henn.et>
2015-01-11Convert pcdb_checkid into function in pc interface.Andrei Karas1-2/+2
2015-01-02Add npcdb_checkid to npc interface.Andrei Karas1-1/+1