summaryrefslogtreecommitdiff
path: root/src/map/npc.c
AgeCommit message (Collapse)AuthorFilesLines
2006-06-16* [Fixed]: Lance1-1/+2
- intif_parse_RenamePetOk for not compatible with ANSI-C initialzation specification. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7199 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-14- A quick fix for lazy scripters -_- sheeshLance1-11/+11
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7154 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-14* [Improved]: Lance1-1/+6
- npc_parse_script to show information and remove duplicated NPCs. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7148 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-12- Fixed npc_checknear's distance check returning the opposite of what it ↵skotlex1-2/+2
should (false when the range is correct and viceversa) - SL_STIN/SL_STUN have dex-reducable casting times now. - Added a warning on item loading when an item is of equippable type but has no equippable position. - Turning an alliance to an opposition won't work now during WoE - Slaves can summon other mobs now. The only ones who can't do this are player summoned mobs. - Merged the following functions for faster processing of items: clif_storageitemlist + clif_storageequiplist = clif_storagelist clif_guildstorageitemlist + clif_guildstorageequiplist = clif_guildstoragelist clif_itemlist + clif_equiplist = clif_inventorylist - Increased max knockback value support to 25. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7109 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-12- Made guild member exp an unsigned int.skotlex1-84/+68
- Modified npc_click to receive the bl that was clicked directly. Also cleaned it up so it isn't as easy to crash the server with invalid ids <.< - Moved npc_checknear to npc_checknear2 and added npc_checknear. The near version receives a bl, checks it's validity, and returns a TBL_NPC object, near2 does the same but doesn't checks for type NPC. The first returns a pointer, the second returns 1 on fail, 0 success. - Also uncommented various npc_checknear calls in the code, who's idea was to comment them out so you could exploit npcs from afar with custom packets? - Added overflow checks for bonus settings mdef_rate/def_rate. - Added missing update of INT after a buf. - Small cleanup of how SC_BLEEDING works. - Fixed party_foreach_samemap invoking the function on the CASTER instead of on the party members. - Added clif_parse_ActionRequest_sub to handle player commands, is used from npc_click or any other function that needs to "re-route" a player's request. - Modified clif_parse_NpcClicked to handle the different situations with different bl-objects (attack on players/mobs, click on npcs or mobs with npc attached) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7103 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-10* [Improved]: Lance1-3/+35
- npc_click interception on BL_MOB and BL_PC to let sd act accordingly. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7079 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-08- Updated mob_npc_warp to a three-state config switch. 0 disables. 1 enable ↵skotlex1-0/+4
only on warps that don't lead to nobranch maps. 2 - enable on all warps. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7048 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-07- Added config setting mob_npc_warp, when set to yes, enables mobs to be ↵skotlex1-0/+29
warped between maps when stepping on a npc-warp. - Added monster_ai setting &64, when enabled makes a mob run to any nearby npc-warp when their current target has switched maps. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7039 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-07- Added pc_calcexp to calculate individual exp bonuses acquired from exp's ↵skotlex1-2/+2
source (race bonus cards, SG Exp skills, pk-mode higher level exp) - pc_gain_exp now also receives the source of the exp, when said source exists, bonuses are applicated as needed. - Added status_kill when capturing a mob, should take care of the mob not respawning after caputed. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7037 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-02- Uncommented the npc_debug_warps code.. oops.skotlex1-2/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6930 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-02- Altered status_calc_pc so that equipment scripts are ran before card-scripts.skotlex1-2/+2
- Fixed pc_bonus to not underflow/overflow when adjusting def/mdef. - These two together, should fix Tao Gunka Card. - npc_debug_warps() will now be invoked if warp_point_debug is set. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6925 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-06-02[Fixed] Lance1-2/+2
- Yet another compilation warning. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6924 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-31[Fixed]: Lance1-0/+1
- Incorrect SQL syntax in login.c (missing collumn) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6892 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-31[Fixed]: Lance1-1/+1
- Compile warnings/errors git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6878 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-31git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6876 ↵Lance1-0/+2
54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-31[Improved]: Lance1-5/+23
- Fake NPC interface to use real NPCs. - Scripting interface to restore and save sd->npc_id. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6873 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-30- Small optimization in battle_check_targetskotlex1-1/+1
- Disabled ontouch npcs triggering on hidden/chase-walk characters. - Added the SC* code blocks relevant to SC_AVOID, SC_CHANGE, SC_BLOODLUST, SC_FLEET - Added structure status_data to homun_data - Added handling of BL_HOMUNCULUS in status_heal, status_damage. - Cleaned up the homun-submitted code, moved the relevant code to status_calc_homunculus. - Updated map-server Makefile to compile mercenary.* files. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6847 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-29[Optimized] Lance1-1/+2
- Removed unused checks for unsigned data type and possible logic error for char type (gcc treats char as unsigned). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6814 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-27- Added structure status_data which holds status-related information (str, ↵skotlex1-1/+3
agi, etc, speed, amotion, adelay, dmotion, weapon-damage, race, size, etc) and weapon_atk structure with the weapon specific info (atk, atk2, element) to be used by all combat structures (TODO: Homun needs to be updated to use it) - Cleaned up TBL_PC, TBL_MOB, TBL_PC and mob_db structures to use status_data. - Set the NPC-Change Attribute duration on Time1, updated their max to 1 in the db. - Berserk's HP cost interval is now defined as time2. - Split damage received functions into pc_damage/pc_dead and mob_damage/mob_dead - Rewrote the @heal related functions to use the new status_* healing functions. - Added status functions to deal with damage and healing (status_damage, status_heal, status_percent_change) and a bunch of defines for easier handling of them (status_percent_heal, status_percent_damage, status_fix_damage, status_kill, etc) - Splitted mob_once_spawn into two. mob_once_spawn_sub creates the mob instance without spawning it. - Added defines for Elements (ELE_*) - Modified battle_calc_(weapon/magic/misc)_attack to use the status data structure. - Rewrote and cleaned up battle_calc_misc_attack - Merged config options pc_attack_attr_none, mob_attack_attr_none, pet_attack_attr_none into attack_attr_none (type 4) - Removed config options player_defense_type, monster_defense_type, pet_defense_type in favor of weapon_defense_type - Cleaned up pet.c to stop invoking status_calc_pc when unnecessary - Modified skill_calc_heal to take into account the MEDITATION bonus. - Cleaned up code of Adjustment, Madness Cancel and other GS/NJ skills inside skill_check_condition - Added status change SC_MODECHANGE which handles mob state changes (this SC is continous until manually ended, eg: like Weight50) - Modified Slim Pitcher so it will work when casted by non-players. Will now also work with SP-healing items. - Rewrote Freedom of Cast code to use function status_freecast_switch to switch adelay/speed when cast begins/ends. - Modified Magic Power to store amplified MATK/MATK2 in val3/val4 for easier updating when used in conjunction with ground skills. - Fixed Asura Strike being usable from within a combo regardless of combo skill. - Modifed SC_DANCING to store speed-change in val3 (it is shared with skill duration...) - Added StatusChangeFlagTable to store which statuses are changed by each SC - Added SCB_* constants to specify the different stats that each sc changes. SCB_PC is the only one that means a change hardcoded in status_calc_pc, the rest are handled by status_calc_bl - Added some helper functions to simplify with basic status calculations (status_base_atk, status_calc_misc, status_base_pc_maxhp, status_base_pc_maxsp) - Added status_calc_mob which calculates initial status and special base status alterations (HP changes, stat changes due to big/small mobs, etc) - Made all the status_calc functions static. - Added status_calc_bl_sub_pc for PC related calculations that must happen after status-change adjustments. - Added status_calc_bl which does status-change related calculations using as base the base_status of the bl object and the SCB_* flag passed. - Added status_get_status_data and status_get_base_status to retrieve the bl objects current status_data and basic status_data (current never returns null, instead it returns a dummy structure with basic data) - The main switch in status_change_start now only sets the tick and val values, therefore it is skipped when loading (flag&4) - Cleaned up status_change_start and replaced many of the ex-japanese comments for english ones. - Changed Hiding to store the speed penalty on val3. val4 stores interval SP cost. - Changed Chase Walk to store Speed adjustment on val3, sp cost in val4 - Changed Cloaking to store speed penalty on val3, val4&2 signals wall-present, val4&1 is infinite cloaking. - Changed Wind walk to store speed bonus on val3 - Rewrote Marionette Control to store the status to add/substract in val3/val4, it now works on anyone (players/mobs) - Changed Improve concentration to store Card bonuses (which are not counted for total % increase) on val3/val4 - Changed SC_ADRENALINE, SC_CONCENTRATION, SC_ANGELUS, SC_IMPOSITIO, SC_MELTDOWN, SC_TRUESIGHT, SC_SUN_COMFORT, SC_MOON_COMFORT, SC_STAR_COMFORT, SC_QUAGMIRE, SC_GATLINGFEVER to store the bonus modifiers in their val values rather than calculate them in status_calc_* - Status_change_start/end will use clif_status_load rather than clif_status_change when related bl is not on a map. - Modified status_change_timer to use the status_charge function rather than directly substracting SP - Added SC_ELEMENTALCHANGE to modify someone's base defense element. - pc_clean_skilltree will now also remove item-granted skills. - Learning skills will now only invoke status_calc_pc when the skill is passive. - Cleaned up pc_steal_coin - Cleaned up pc_check_base/job_lvup to only invoke the lv-up related packets and functions ONCE regardless of skill-levls earned. - Cleaned up pc_ regen related functions. - Made player-sprite mobs have item pickup animation and walkdelay when taking items. - Cleaned up mob_dead code. - Removed paramb, parame from struct map_session_data, replaced them by param_bonus[6],param_equip[6] - mob special ai state 3 signals summon flora. - Moved petDB pet_hungry_timer vars from TBL_PC to TBL_PET - Cleaned up some pet functions, made the menu functions receive as argument both pet and master. - Clones will copy a player's base status rather than battle status (so status-change alterations are not cloned) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6791 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-26* Mob control engine tested 99% working so far.Lance1-2/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6770 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-25added noVending mapflag. Tested. + custom Market Place NPC, fixed MSG stringsLupus1-0/+3
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6755 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-24- Corrected item script for dead branch and poring boxskotlex1-1/+2
- Removed that npc-warp warning as requested by Playtester. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6732 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23- the charname request hack message has been downgraded to only include ↵skotlex1-2/+3
GM-invisible characters. - corrected clif_charnameack to send negative ID when a disguised player asks for it's own disguised name. - Cleaned up the disguised target-id checks taking into considering that the only character that sees a negative ID is the same disguised character. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6715 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23* Added 'setd' support for local NPC scope (') variables.Lance1-2/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6704 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-22- Fixed some of the leaks.. still fixing..Lance1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6691 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-22* WARNING: New scripting system contains memory leakLance1-4/+6
TODO: Free all scripts using script_free_code() instead of old methods. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6690 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-15- When reading mapflags, when a map is set to be pvp or gvg, the other will ↵skotlex1-0/+9
be turned off (disables pvp mapflags in gvg maps for pk-servers) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6610 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-14* Bugfix on fake npcLance1-7/+12
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6585 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-11- Changed a bit the MAX_ZENY checks in trade.c to prevent overflows.skotlex1-34/+54
- Rewrote npc_selllist for a more proper-clean implementation. - Increased NPC_POWERUP's dex bonus to +25*lv - Moved TK_DOWNKICK's stun time from time to time2 - Added TK_TURNKICK's stun to splash-pushed mobs. Duration is 2secs (time2) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6557 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-08- Removed SP_DISGUISE from the bonus list.skotlex1-2/+3
- Moved Sharp Shooting display to the block with Auto-Counter (since that's the other skill that can show critical as well) - Corrected some fields in the still packet (guild emblem being stored as a Long when it should be Short) - Modified most fields of view_data to be unsigned shorts rather than signed ones. - On-Touch NPCs will now make you stop walking when you trigger them. - Reduced stun duration of most skills to 3 secs. - ShadowJump/JumpKick will make you land on the target's cell now. - Fixed Kaahi triggering only once per skill duration. - Added the kaahi_heal_timer to the list of status change functions. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6516 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-06- Added missing include <limits.h> to npc.c...skotlex1-0/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6499 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-05- Added a npc-script-event cache to avoid looking up event-scripts every ↵skotlex1-1/+103
time they need to be executed. Events cached are all those defined in script_config. - Since the cache holds direct pointers to the npcs/events, do NOT unload the related NPCs or you'll get dangling pointers. However, @reloadscript will work fine. - Set the etc_log to on to see a summary of npcs/events loaded for script execution on startup. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6494 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-02- Corrected a crash when sd is null in npc_eventskotlex1-1/+3
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6440 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-01* Optimized fake npc system. Added npc_checknear back to npc_buysellsel.Lance1-7/+8
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6426 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-30Fixed scripts relying on older event calling methods.. Still searching for ↵Lance1-1/+1
other scripts.. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6396 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-29- Cleaned up unused variables in npc.cLance1-2/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6383 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-29* Reverted npc_checknear to exclude check for class_ -1.Lance1-8/+9
* Removed npc_checknear in npc_buysellsel, npc_selllist and npc_buylist as enough preventive measures of hacking are already implemented. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6370 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-29- Clones can't be class-changed nowskotlex1-2/+2
- Readded the class == -1 distance check in npc_checknear - Replaced check sd->trade_partner for sd->state.trading in clif.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6356 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-29* Using malloc for memory allocations that doesn't need to be pre-initialized.Lance1-18/+17
* Eliminated initializations for pointers returned by calloc. * Moved grfio_final to do_init since it's not used after server boot. * Optimized scripts to return CONSTSTR instead of allocating memory just to return a constant string. Some buildin functions still need work. * Disabled graph since it doesn't work yet. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6355 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-25- Modified and simplified the random item group format. It now is ↵skotlex1-2/+0
<GroupID>,<ItemID>,<Rate>, where Rate normally is 1, greater numbers is the equivalent of adding the line multiple times. - Added constants to identify all groups to db/const.txt - Cleaned up and updated item_db to use these new constants (warning: item_db.sql needs to be updated!) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6275 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-25- Simplified npc_gettimerevent_tick so that it should return a tick value ↵skotlex1-18/+2
even after the last ontimer label has been reached. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6264 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-24- Fixed a typo when parsing the mob spawn files.skotlex1-4/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6256 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-24- Cleaned up @grind2skotlex1-0/+10
- Updated @monsterbig, @monstersmall to use the event 2 and 4 rather than the max_mob_db code check. - Modified override_mobs_names to work only on the mob spawn files. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6252 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-23git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6239 ↵shinomori1-1/+8
54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-20- Added support for n to specify minutes to @charban. skotlex1-0/+1
- Fixed a logic typo on the way dummy_npc_id was defined. - Added state.trading to specify when a trading has started. Now you should be able to walk around until the trade is either rejected or started. - Armor defense is no longer reduced by the amount of characters targetting you. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6192 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-19- Removed the max cap of autoloot so you are now allowed to set autoloot ↵skotlex1-0/+3
values above 100. - Initialized w1/w2/w3/w4 before reading each npc line to avoid sending unread values to the parsers (for example, if w4 has a value in one line and none on the next, it will be parsed with the previous value of w4 on the following lines) - Updated getpartymember to receive an int which specifies what to retrieve. 0: Character names (array $@partymembername$), 1 character char ids (array $@partymembercid), 2 character account ids (array $@partynameaid). By default it returns party member names. - Updated script_commands.txt with the updated behaviour of getpartymember. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6182 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-18- Removed message 592 from trade.cskotlex1-53/+59
- Removed mapflag nopvp - Added support for disabling mapflags on a mapflag line: comodo.gat mapflag nomemo <- turns on nomemo mapflag comodo.gat mapflag nomemo off <- turns off nomemo mapflag - Cleaned up and optimized the restricted/zones mapflag. Restricted cards will just not work in disallowed maps rather than blocking the compounded equipement from being used. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6159 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-18* Shinomori's method (kinda) of remote script execution with interaction.Lance1-2/+8
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6151 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-17- Changed the npc_id mismatch warning to be more informative.skotlex1-1/+1
- Modified @monster command to use map_search_freecell (prevents mobs spawning on non-walkable tiles) - Modified @nuke to invoke skill_cast_nodamage_id instead of the damage_id version (fixes sprite and splash damage for the skill) - Corrected Venom Knife's requiring two knives per use. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6124 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-16- Fixed mysql ping setting being in minutes rather than hours.skotlex1-0/+1
- Removed npc_event_sub from npc.h and moved it to npc.c - Cleaned up #warp to prevent spitting non-walkable tile warnings. - Changed the meaning of msg_athena 2, it is now "invalid target cell, randomizing". git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6114 54d463be-8e91-2dee-dedb-b68131a5f0ec