summaryrefslogtreecommitdiff
path: root/src/map/script.c
AgeCommit message (Collapse)AuthorFilesLines
2011-02-14* Fixed a crash when script 'npctalk' is given too long string ↵ai4rei1-7/+7
(bugreport:4759, related r2145). - Fixed related buffer overflows in message related clif functions (since r1182, r14270). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14704 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-02-09* Fixed script command 'bpet' (Pet Incubator) displaying an empty egg list ↵ai4rei1-0/+5
when attempting to hatch a pet while already having one out (bugreport:3313). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14702 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-02-08* Moved script constant manipulation code into separate functions ↵ai4rei1-10/+37
script_get_constant / script_set_constant. [Ai4rei] - Added protection against overwriting existing names in script constant creation code. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14701 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-02-08* Updates to various client packets.ai4rei1-4/+4
- Renamed clif_set0199 and clif_send0199 to clif_map_property and clif_map_property_mapall respectively and added an enumeration for currently known map properties. - Renamed clif_set01D6 to clif_map_type and added an enumeration for currently known map types. - Resolved undocumented field of packet 0x22e (ZC_PROPERTY_HOMUN) to attack range. - Fixed aspd field of packet 0xbd (ZC_STATUS) getting filled with karma value. - Removed commented clif_skillinfo (duplicate of clif_item_skill). - Other minor comment updates and 'FIXME' assignments. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14698 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-02-06* Replaced 'nameid < 500' checks in script commands 'countitem', ↵ai4rei1-35/+52
'countitem2' and 'autoequip' with stricter ones. - This should stop meaningless itemdb_search warnings from said commands when an invalid item id is used. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14696 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-02-06* Fixed closing 'switch' curly not causing script EOL processing to trigger, ↵ai4rei1-1/+3
leading to the script line after the switch being handled as belonging to the curly-less statement block (bugreport:3273, since r3422). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14694 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-31* Various accumulated cleanups and fixes.ai4rei1-3/+3
- Improved the compile speed for files which include common/socket.h on windows builds (related r10471). - Moved FIFOSIZE_SERVERLINK define from common/mmo.h to common/socket.h (since it is a server connection FIFO size setting). - Fixed script command 'areamobuseskill' canceling monster's skill cast before it determined it's new target, which could be 'none' (bugreport:3272, since r13897). - Added a protection against attempts to read an empty backup / write to a full backup in skill_dance_switch as per TODO from r11347. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14690 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-16* Fixed a map-server crash, when a script attempts to call a local function, ↵ai4rei1-5/+26
which has only a forward declaration. Such functions now count as script parse error (bugreport:4009, since r3422). * Fixed definitions of local functions would set a label reference, even when their name was already taken (follow up to r14600, since r3422). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14675 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-15* Various accumulated insignificant fixes to documentation, examples and ↵ai4rei1-5/+2
comments. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14674 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-14* Replaced remaining occurences of '-1' with 'INVALID_TIMER', where ↵ai4rei1-11/+11
appropriate (follow up to r12998). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14670 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-10* Fixed script command 'cleararray' setting 1 element more, than it is told ↵ai4rei1-7/+7
to (bugreport:2047, since r12253). - Fixed 'inaccessible element 127' issue in 'cleararray', 'setarray' (since r10813) and 'copyarray' (since r14608) script commands (bugreport:864, related r12253, follow up to r14608). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14663 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-10* Made script command 'charisalpha' always return 1 when 'isaplha' is true, ↵ai4rei1-1/+1
rather than to return the return value of 'isalpha' which is only defined as zero/non-zero and can be different from 1 (bugreport:2024, related r2003). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14661 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-06* Fixed script command 'deletearray' deleting incorrect amount of array ↵ai4rei1-1/+2
elements from arrays with empty elements (bugreport:4628). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14652 54d463be-8e91-2dee-dedb-b68131a5f0ec
2011-01-05* Fixed ends of statement blocks missing script EOL processing, thus causing ↵ai4rei1-9/+35
'next line' label (-) to misbehave in statement blocks without additional curly braces (bugreport:4417, since r3422). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14651 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-30* Fixed improper use of itemdb_search. It does not return NULL but a dummy ↵ai4rei1-1/+1
item, if the item id is invalid. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14642 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-29* Collection of random insignificant changes.ai4rei1-1/+1
- Added progress indication on map-server shutdown when objects are removed from maps, as it takes significant amount of time to complete. - Moved ers_free in db_obj_vclear, so that the node pointer is not used for comparison after it has been freed. - Some documentation of shop packets. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14639 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-26- Added missing script_pushint() in 'checkweight' that were forgotten in r14629.brianluau1-0/+3
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14631 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-26* Cleaned up script command checkweight.ai4rei1-31/+63
- Replaced some code parts with calls to pc_checkadditem and pc_inventoryblank (follow up to r13735). - Fixed item id not getting checked for validity properly. * Moved MAX_AMOUNT check in pc_checkadditem to the top of the function, to prevent unnecessary inventory scan before it. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14629 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-26* Fixed items, that get dropped at 100% chance, being reported in @iteminfo ↵ai4rei1-2/+2
as 'available in the shops only' (since/replaces r3482). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14627 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-25* Updated script commands delitem and delitem2.ai4rei1-121/+189
- Items are now deleted only if there is enough of them (as per r14395, related r13368). - Not equipped items are now actually prioritized over equipped ones (related r200). - Fixed item id not getting checked for validity. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14623 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-21* Added script_setarray_pc for setting temporary character array variables ↵ai4rei1-0/+36
outside of script.c without requiring them to use script-interal code (add_str and reference_uid). - Applied script_setarray_pc to assignment of dynamic shop arrays (related r5841). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14613 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-21* Replaced in-place generation of uid of script array elements with ↵ai4rei1-21/+21
reference_uid macro (follow up to r10813). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14612 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-21* Fixed dynamic shop arrays @bought_nameid, @bought_quantity, @sold_nameid ↵ai4rei1-0/+32
and @sold_quantity not getting reset to zero before use, thus providing attached script with wrong/old data, if it did not clear them by itself in previous call (bugreport:1574, since r5841). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14611 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-19* Replaced maximum script array size literals with a define (constant).ai4rei1-11/+14
- Fixed an off-by-one mistake in copyarray, allowing to copy 1 element more into the target array, than allowed (since r10813). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14608 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-18* Made the 'player not attached' script error also report the function it ↵ai4rei1-0/+39
occured in, if available. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14602 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-17* Fixed a crash, when script command 'doevent' is called without an attached ↵ai4rei1-1/+8
player (bugreport:3973). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14601 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-17* Fixed label definitions silently overwriting built-in script functions ↵ai4rei1-2/+2
(bugreport:2806, follow up to r8027). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14600 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-17* Random script engine clean-ups that have accumulated over time.ai4rei1-8/+26
- Resolved unnecessary script_getnum re-evaluation in a loop in script command 'npcshopdelitem' (since r7120). - Script commands 'menu', 'select' and 'prompt' now warn, when there are more menu options, than the client can handle correctly (TODO from r10316). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14597 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-15* Corrected type of second argument of script command 'setbattleflag' from ↵ai4rei1-2/+2
string to number (bugreport:4640, topic:261833, since r5407, related r14577). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14593 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-12* Removed disabled backup of script command 'isequipped' (since r1605).ai4rei1-62/+0
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14586 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-12* Made script engine's DEBUG_DISASM block use script_op2name, rather than ↵ai4rei1-37/+12
hardcoding operator names as per TODO from r13083 (related r9569, follow up to r10667). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14585 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-12* Fixed impossible condition in soundeffect script command (since ↵ai4rei1-4/+1
athena-dev-2.1.1-mod1046, related r5841). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14583 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-12* Updates to the playBGM functionality (since r14335).ai4rei1-23/+26
- Removed impossible condition in playBGM script command (from soundeffect). - Removed unused code (retrieving of a bl) in playBGMall (from soundeffectall). - Made playBGMall default to 'entire server' when both map name and coordinates are omitted instead of printing an error. - Updated documentation for playBGM and playBGMall to match actual behavior. - Removed unused parameter 'bl' in clif_playBGM. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14582 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-12* Fixed script command setd always assuming value parameter to be a string, ↵ai4rei1-5/+4
which causes hexadecimal and octal numbers not being handled properly (topic:261833, followup to r14577 and r14578). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14581 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-12- Fixed argument declaration of 'setd' (topic:261833, related r14573).brianluau1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14578 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-11* Added support for checking argument data type of built-in script functions ↵ai4rei1-0/+97
(bugreport:1701, topic:261833, related r14573). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14577 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-11* Replaced buildin_getpartyname_sub, buildin_getguildname_sub and ↵ai4rei1-77/+54
buildin_getguildmaster_sub, which create only unnecessary overhead, with equivalent inlined code. - Fixed a memory leak in getguildmasterid, when the guild leader was not online (bugreport:2743). - Command getguildmasterid no longer requires the guild leader to be online. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14575 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-10* Revised argument declaration of all script commands according to the ↵ai4rei1-62/+63
actual functions' argument usage. - Fixed many script commands with fixed amount of optional parameters to no longer accept any amount of arguments (faulty declaration). - Corrected use of dummy parameter for guildopenstorage in scripts. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14573 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-07* Reverted r14563, due to multiple issues which render the source ↵ai4rei1-48/+48
malfunctioning or uncompilable. To be redone later (bugreport:4627). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14567 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-07Changed almost all instances of sprintf() to snprintf().Paradox924X1-48/+48
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14563 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-12-02* Removed clif_weather_sub and clif_misceffect2 in favor of ↵ai4rei1-3/+3
clif_specialeffect_single and clif_specialeffect (all of them are ZC_NOTIFY_EFFECT2). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14541 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-30* Fixed script command getusers causing 'player not attached' errors when ↵ai4rei1-9/+9
asking for character count in entire server (bugreport:4591, since r14495). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14522 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-29* Insignificant code tweaks: removal of excess function declarations and ↵ai4rei1-2/+0
self assignments. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14520 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-28* Added emotion_type enumeration for clif_emotion constants.ai4rei1-1/+1
- Made clif_parse_Emotion use clif_emotion, rather than having it's code inlined. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14518 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-28* Added clr_type enumeration for vanish effect constants.ai4rei1-29/+29
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14517 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-28* Fixed a crash uncovered with r14501, caused by outdated local variables ↵ai4rei1-58/+78
when a script is about to suspend or terminate (bugreport:4577). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14511 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-25* Fixed script commands attachrid and detachrid not updating the attached ↵ai4rei1-3/+29
character's information about currently running script, causing errors with dialog-based scripts or preventing characters from walking (bugreport:4571). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14501 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-23* Fixed script command getusers causing map server to crash when called with ↵ai4rei1-6/+31
type 0 without attached character (bugreport:4565). - Lack of character is now reported like other script commands do. Additionally invalid types are reported as well. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14495 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-23* Added script command pushpc, which is required by newer scripts.ai4rei1-0/+39
- Moved knockback-part of skill_blown into unit_blown, to allow unconditional knockback required by pushpc without copy-pasting code. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14492 54d463be-8e91-2dee-dedb-b68131a5f0ec
2010-11-20* Made script command getmapxy print a warning, if an invalid type is ↵ai4rei1-0/+4
supplied (related r69, r8459). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14470 54d463be-8e91-2dee-dedb-b68131a5f0ec