537 Commits

Author SHA1 Message Date
ultramage
7906017662 Moved distance-related functions to path.c/h
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11981 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-26 17:18:57 +00:00
FlavioJS
214feac880 * Fixed string variables dereferencing directly to the value instead of dereferencing to a copy of the value. (fixes bugreport:684 bugreport:641)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11976 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-26 00:55:27 +00:00
ultramage
1e6922174e Guardian hp handling code removal (see bugreport:342)
- removed guardian hp from the castle data structure, database, savefiles and various script functions (use upgrade_svn11914.sql)
- removed guardian hp calculation and manipulation from the castle manager npc, now the hp values are updated by the server itself (glitch: when castle defense changes, all guardians are healed to full)
- tweaked script function 'guardianinfo' to provide some data needed by the manager npc (currently available are hp, maxhp and visibility); also, it doesn't need a player attached to execute anymore
The whole thing is experimental, use at your own risk (seems to work though...)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11915 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-14 23:38:11 +00:00
FlavioJS
9bfc5b4425 * Fixed possible segmentation faults in the script engine.
- some strings that can be freed outside the script engine were being pushed into the stack as constant strings

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11901 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-13 21:42:38 +00:00
skotlex
9d353fba9b - Added query_logsql script command to perform sql commands using the log db connection.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11892 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-11 22:37:07 +00:00
FlavioJS
43ac1fd8ad ooops, two errors escaped... >.<
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11861 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-06 15:37:14 +00:00
FlavioJS
1d827807ae * Removed the attempts to recover from invalid syntax in npc_parsesrcfile since they can produce incorrect results (spaces in sscanf can match \n's and company).
* Made script_rid2sd report the script source directly and changed related return 1's to return 0's to avoid double script source reports.
* Added missing return 0's after script_rid2sd is used and an extra error message in buildin_set/buildin_setd.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11860 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-06 15:12:55 +00:00
skotlex
fc7b4eaef0 - The default event script behaviour is to trigger on labels rather than NPCs now.
- Removed several script config options which break NPC compatibility when you mess with them (event_script_type, event_requires_trigger, die_event_name, kill_pc_event_name, kill_mob_event_name, logout_event_name, login_event_name, loadmap_event_name, baselvup_event_name, joblvup_event_name)
- LoadMap events no longer set the variable "@maploaded$" to the name of the new map.
- Optimized/simplified the code now that the previous config options were removed.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11859 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-12-06 12:59:12 +00:00
ultramage
ea5212c5a8 * TXT/SQL login server code synchronization
- exported several core structures to login.h
- split off ladmin communication code from the TXT login server
- removed all occurences of login_log(); a unified function should be added when SQL's loginlog_db logging code gets synced with TXT
- removed conf setting login_log_filename
- fixed ladmin getting timeouts since the ping system was changed
- removed login/char server_fd[] arrays, added server[].fd instead

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11826 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-27 19:38:16 +00:00
skotlex
f98611b450 - Cleaned some more the sc_end check so it is more generic and not so limited just to infinite endure.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11821 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-27 10:08:22 +00:00
skotlex
9a56a88f4a - Corrected the online_data_cleanup routine setting offline characters that are still connected to the char-server.
- Added a check in script command sc_end to properly end infinte endure
- ASC_BREAKER no longer triggers status effect cards.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11817 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-27 09:21:18 +00:00
FlavioJS
83fb3336e7 * Fixed buildin_query_sql using Sql_Query instead of Sql_QueryStr, wrongly processing all %f,%d,... (fixes bureport:218)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11809 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-26 18:14:06 +00:00
ultramage
128efc8d50 Fixed some old mistakes in npc shop code causing misinterpretation of the number of function parameters (bugreport:404)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11788 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-23 02:25:50 +00:00
FlavioJS
69be534c6f * Moved the reset of references to after the empty script checks in parse_script. (fixes bugreport:222 and bugreport:449)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11782 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-22 19:00:39 +00:00
FlavioJS
508ffb82d9 * Renamed fakenpcname to setnpcdisplay, fixed and extended it.
- See doc/script_commands.txt for information on how to use it

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11779 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-22 16:06:39 +00:00
skotlex
6840bb28ab - Moved subtype from struct block_list to struct npc_data.
- Fixed some compilation warnings.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11772 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-21 13:29:45 +00:00
ultramage
9ea5b9c76c * Replaced jA's way of allocating npc shop data with a simple dynamic array that gets allocated during loading and freed on unload
- automatically fixes bugreport:404, which would otherwise require manipulating the npcname_db (the original author didn't, hence the bug)
- now a supporting variable 'count' is used for tracking the length instead of an extra dummy entry at the end of the shop list
- partially removed the MAX_SHOPITEM restriction (if this was written properly, the system could support an unlimited amount of entries)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11753 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-18 10:36:09 +00:00
ultramage
42746f05f9 Fixed npc_debug_warps() not identifying x:0,y:0 as valid (random) coordinates
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11752 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-18 02:30:29 +00:00
ultramage
560005b13e Removed battle_config.error_log as console_silent already handles this
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11751 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-17 20:51:25 +00:00
ultramage
2d71189702 Added error reporting to buildin_warp when it fails.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11727 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-12 21:06:49 +00:00
ultramage
a5b2c3b30c Applied Rayce's improvements to the npc script parser (see bugreport:387 for details).
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11715 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-11 10:59:41 +00:00
ultramage
3b742b114e Fixed some more gcc incompatibilities...
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11706 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-10 13:59:23 +00:00
ultramage
5eda6c0e57 Replaced several 'int' variables with enums that they represent.
Expanded weapon_type enum with dual-wield constants (bugreport:384).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11704 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-09 22:42:56 +00:00
FlavioJS
9d2688ad87 * Changed EXIT_SUCCESS back to 0 in console.c to avoid an unnecessary include.
* Fixed gm_account_db not being deallocated in login-converter.c.
* Refactoring names and documentation in db.h/db.c:
  - changed 'struct dbt' to 'struct DBMap' and 'DB' to 'DBMap*'
  - changed 'struct db' to 'struct DBMap_impl' and 'DB_impl' to 'DBMap_impl*'
  - changed COUNT to DB_COUNTSTAT and made it's existence not depend on DB_ENABLE_STATS
  - removed some @see links and corrected small typos in the documentation

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11698 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-08 14:08:32 +00:00
ultramage
17eb2f7764 Added script function 'strnpcinfo', for increased npc awareness (originally from jAthena).
Updated script reference doc.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11650 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-03 22:07:47 +00:00
ultramage
9c9859a1c5 Fixed one wrong return value in buildin_getcharid (bugreport:33)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11638 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-02 12:07:37 +00:00
ultramage
45cf77f464 Moved the BUILDIN_DEF() block to the end of script.c.
Removed the big list of BUILDIN_FUNC() declarations in script.c, as they are not needed anymore and no code utilizes them => file size-= 11 kB.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11637 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-11-02 11:42:36 +00:00
skotlex
fe0c93c77b - Fixed the pc_additem weight check breaking when your current weight is above your max.
- Some minor cleanups.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11621 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-31 00:42:56 +00:00
ultramage
fc9d14b1bd Command code cleaning (refer to topic:169759)
* separated the execution part of command code into interface part and internal part to better see which checks are done and when (fixes problem where 'nocommand' mapflag blocked server npcs)
 * moved the internal commands list (array) to the end of the file, this let me discard that long block of ACMD_FUNC() declarations
 * removed enum AtCommandType from command headers and commands array; its purpose was perhaps to identify aliased commands, but apparently it was never finished because the rest of the code doesn't use it (also doing aliases like this is not a very good idea)
 * internally, commands are now referenced to using their function name
 * removed the @/# symbols from the command lists; all lookup functions will now properly deal with strings with- and without a command symbol (commands interface still requires the symbol tho', so TODO for later)
 * removed several unneeded commands (*id2 code, dmalloc debug commands)
 * reverted atcommand config from alphabetically-sorted to how it was before (with additional fixes; see /conf changelog)
 * added missing code for #dropall / #storeall
 * added a warning when trying to set gm level of an undefined command

The structure of the commands table has changed, please adjust docs/guides to match the new format (sorry for the inconvenience).


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11607 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-29 09:16:39 +00:00
ultramage
2cb8a5838e * Fixed TXT charserver doing periodic random-sized memory allocation (bugreport:312)
* Set 'Create Converter's produce success rate to 100% (bugreport:302)
* Added check that verifies weapon/ammo/state requirements also when casting finishes (might have unwanted side-effects tho'!) (bugreport:228)
* Fixed Firewall knocking back undead/fire element mobs (bug in r11578)
* Added dummy 'openmail' to txt server to fix a script error message

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11585 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-27 11:59:35 +00:00
skotlex
480a4f0ac8 - added defines JOB_MAX_BASIC and JOB_MAX to mmo.h so the code can know which are the max valid classes.
- @/#jobchange no longer strip your equipment since pc_jobchange removes any unequippables already.
- removed the wasteful define MAX_PC_CLASS and replaced it by the CLASS_COUNT define (which is automatically updated using the previous JOB_MAX* defines) + pc_class2idx function (which converts high class IDs into values that fit in CLASS_COUNT)
- Made status_charge a function rather than a define to get rid of those warnings that have been there since forever.
- Merged the CELL_NOVENDING code (see topic #129209)
- Small check that disables the pet catching process if you try to use another item. 
- Added a check to fix a warning and prevent a crash in the npc duplicate check (even though I have no idea what this check is supposed to do, therefore I can't fix it properly other than to avoid the crash)


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11572 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-24 13:02:00 +00:00
zephyrus
c34325a53b - Added the new mail system. Requires optimization and tests.
- Updated the maildb sql structure.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11548 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-22 20:38:26 +00:00
ultramage
28dcdcdf9e * Fixed 'unequip' removing items in the wrong position (bugreport:252)
* Fixed #refine unequpping the caller's item by mistake (bugreport:265)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11534 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-21 02:18:15 +00:00
skotlex
a1becae58f - Added bonusautoscript and bonusautoscript2. These are used to attach a script to a player which gets executed on attack (or when attacked). Required for several of the more recent items.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11519 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-19 20:31:57 +00:00
ultramage
4cfb15d8bb Fixed numerous /W4 warnings (and created more :)
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11514 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-18 21:25:26 +00:00
ultramage
d2b9e2498e Some code cleaning...
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11505 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-18 08:04:53 +00:00
FlavioJS
05134f3dcc * Reworked the parsing at npc.c.
- Fixes npc.c discarding the '}' at the end of file, when there is no newline. (uncovered as a side-effect of r11487)
* Empty script functions always have code now (won't report as missing when you try to call them).
* Changed userfunc_db to not limit the name to 50 characters.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11502 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-17 20:15:39 +00:00
FlavioJS
b445bfa64e >.>
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11489 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-16 17:39:49 +00:00
FlavioJS
7109831b80 * Tweaked the loop in parse_script to better handle when the outer brackets aren't checked.
* Fixed a typo in skip_space that stopped skipping characters when it encountered a '*' or '/' in a block comment.
  ex: /* this will give a parse error after this character->* */
      /* same thing here->/ */

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11487 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-16 17:32:47 +00:00
FlavioJS
faa553103c * Fixed itemdb_read_sqldb blowing up the server with segmentation faults.
* Added an option for parse_script to ignore the checks for the set of brackets around the script.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11398 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-10 21:51:56 +00:00
ultramage
52a7948f8b * Corrected string lengths according to bugreport:198
- CHATBOX_SIZE: 70 -> 70+1
- removed some too aggressive checks in clif_parse_globalmessage()
- removed CHAT_SIZE define as it actually doesn't apply anywhere
- added CHAT_SIZE_MAX to serve as a custom limit to input string lengths
- added length/contents checks to /b and /lb (against fake names)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11386 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-09 17:45:51 +00:00
ultramage
1069e3524c * the mapserver won't exit when no mapcache is found, with use_grf: yes
* Fixed some \r uses, now looks better; /thx to Ai4rei (topic:165952)
 * Removed that ridiculous spinner that displays during map/npc loading, and added a more informative progress indicator (idea from jA/eapp)

 * Checked/fixed/removed some old script and npc commands
  * cmdothernpc - a specialized 'donpcevent' with the event specified as two arguments
  * enablearena/disablearena - completely equivalent to enablewaitingroomevent & co.
  * inittimer/stoptimer - removed since its logic was incompatible with the code it depended on
 * Removed loads of code that supported these functions. Result: -100b per npc => -1,5MB of wasted memory
 * Fixed related npcs that erroneously used 'stoptimer'

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11374 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-06 15:35:31 +00:00
ultramage
286e1a32c4 * Added MAX_HOTKEYS to supplement the HOTKEY_SAVING define
* Fixed a compile problem when hotkey saving is disabled (topic:167265)
* Added script source error reporting to countitem() (topic:167165)
* Removed integer mob skill state/target definition support (unused)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11353 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-04 16:16:44 +00:00
zephyrus
383f017009 * Moved the homunculus shuffle code to mercenary.c, fixing the bug in the atcommand not using the bonus evolution stats for homunculus.
* Added a new script command "homshuffle" to reset the homunculus stats using NPC.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11350 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-10-03 21:47:47 +00:00
FlavioJS
0498cb19c0 * Reimplemented mmo_char_fromsql using sql statements. (fixes bugreport:93)
* Fixed buildin_gethominfo not being included in the script engine. (bugreport:124)
* homunculus_evolution -> homevolution in script_commands.txt.
* Deleted item DEFAULT from item_db.txt and regenerated item_db.sql. (bugreport:103)
* Skip empty lines and give more feedback (for invalid lines) when reading item_db.txt/item_db2.txt.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11311 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-27 11:18:58 +00:00
FlavioJS
beda52e6b3 * map_addflooritem and struct item_drop_list using id's instead of struct map_session_data's (fixes bugreport:36).
* Fixed buildin_escape_sql not properly escaping in sql servers.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11279 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-23 03:14:57 +00:00
ultramage
961f23767d * Added 'safestrnlen' to prevent null pointer crashes
* Fixed global chat logging always crashing on a null pointer
* Applied changes to clif_parse_globalmessage() from my WiP code
- clearer processing of the individual packet components
- proper code ordering, some more integrity checks
- fixes to some poorly chosen ShowWarning() format strings
- global chat logging no longer logs the entire string (w/ player name)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11271 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-22 11:02:26 +00:00
FlavioJS
b848357f20 * Added a sanity check for MAX_ZENY (doesn't compile if too big).
* Redid the buildin_query_sql function. (fixes bugreport:81).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11268 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-22 01:43:08 +00:00
FlavioJS
65642f6f1c * Merged the tmpsql branch:
- Abstraction for the sql code (sql.c/h).
- New configure script and makefiles.
- Restored txt zeny logging code. (r10814)
- Rewrote mapserver's sql code - itemdb, mobdb, mapreg, logs. (r10814)
- Fixed a precedence issue (&& and ) in char_sql/char.c. (r10833)
- Improved db reading code a bit for consistency. (r11077)
- Added separate atcommand for mail deletion. (r11077)
- Corrected a few messages that said "new" instead of "unread". (r11077)
- Broadcast (*) messages now use "*" as the target's name (not ""). (r11077)
- Moved StringBuf code from utils.c/h to strlib.c/h. (r11084 r11117)
- Some misc login server cleanups (reformatting etc). (r11136)
- Corrected/modified some header entries. (r11141 r11147 11148)
- Adjusted VS project files. (r11147)
- Adjusted the way the sql charserver does item saving. (r11192)
- Corrected usage of reserved keyword 'friend' in mmo.h. (r11192)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11245 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-20 11:09:36 +00:00
skotlex
8105f340a2 - Applied various crash-protections to script commands that deal with the equip-position array.
- Corrected and simplified the skill_magic_reflect function. Fixed damage reflection being based on the caster rather than the target.
- Potions are now usable inside Gospel by the casting Paladin (as per Aegis tests done by AuronX)
- The unequip script command now takes a position from 1 to 10 rather than 0 to 9 (to make it consistant with all the other equip position related script commands)
- Added the EQI_* constants to db/const.txt in a format usable by the equip-position related script commands.
- Updated some items to use the new EQI constants.
- Also updated doc/script_commands.txt to refer to the EQI list.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11230 54d463be-8e91-2dee-dedb-b68131a5f0ec
2007-09-17 19:13:58 +00:00