summaryrefslogtreecommitdiff
path: root/src/map/script.c
AgeCommit message (Collapse)AuthorFilesLines
2006-05-29[Optimized] Lance1-1/+1
- 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-28- Reverted buildin_setd to use NULL as reference.Lance1-3/+2
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6802 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-28[Fixed] script functions that doesn't pass references, thanks to End_of_exam.Lance1-34/+35
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6801 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-27- Added structure status_data which holds status-related information (str, ↵skotlex1-12057/+12055
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* Patches to allow everything to work right. + 1 more sample script.Lance1-25/+26
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6779 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-26Added a few more events in..Lance1-4/+9
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6776 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-26git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6773 ↵Lance1-12/+12
54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-26git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6772 ↵Lance1-28/+29
54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-26git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6771 ↵Lance1-0/+7
54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-26* Mob control engine tested 99% working so far.Lance1-35/+55
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6770 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-26* Change scripting engine's NPC scope vars to dot (.) style.Lance1-28/+36
* Improved and (should be fully) fixed the mob control engine. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6769 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-25added noVending mapflag. Tested. + custom Market Place NPC, fixed MSG stringsLupus1-1/+7
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6755 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-25* Fixed mob control commands.Lance1-53/+73
* Fixed memory leak in scripts (again). Still have a few lying. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6749 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-24- Corrected mob angry mode, now it only "restores" itself after being hit ↵skotlex1-1/+1
when the mob has no target within their range of sight rather than on picking a new target. - Corrected a pair of incorrect sql query parsing logic in the login-sql ban request packet. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6724 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23- Some cleanup of run_script, should fix the memory leak there.skotlex1-26/+30
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6718 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23* Fixed typo (this time it's not my fault) in script_reload() clearing the ↵Lance1-3/+3
same db each time o_o git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6708 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23Reloadscript cleanupLance1-2/+13
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6707 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23Crash preventionLance1-24/+24
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6706 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23* Fixed sleep command.Lance1-58/+58
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6705 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23* Added 'setd' support for local NPC scope (') variables.Lance1-30/+30
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6704 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23* [Scripting Engine Update] New variables are ready to be used. Lance1-1/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6703 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-23Dunno what the hell the causing the errors when using '@variables, ↵Lance1-11/+26
'variables works fine.. something is messing up.... git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6702 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-22- Fixed a possible null pointer in script command misc_effectskotlex1-3/+5
- Modified Investigate to take into consideration final def/vit-def rather than base values for damage adjustment. - Added missing include unit.h in pet.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6695 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-22- Fixed some of the leaks.. still fixing..Lance1-1/+10
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-87/+425
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-21* Speed up array size calculation and deletion.Lance1-9/+18
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6676 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-20* jA1983 script.c buildin_menu fix. Thanks to End_of_exam.Lance1-0/+1
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6665 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-15git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6593 ↵Lance1-1/+1
54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-15* Added NPC event deprecated warnings to ease debugging old scripts. Lance1-5/+36
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6592 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-12- Updated cast times of Kaupe and Kaahi.skotlex1-1/+0
- Some small code cleanups. - Sma has cast-dex reducable now. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6564 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-10- Changed wedding costumes to use setoption rather than changebase.skotlex1-13/+7
- Modified setoption so that flag 1 or no flag adds an option, and flag 0 removes it. - Updated script_commands with the new behaviour. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6548 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-09- Updated setoption script command to receive a second (optional) argument ↵skotlex1-3/+19
flag. If the flag is 1, the option is added to what the player currently has; likewise using flag 2 removes only that option. No flag (or any other value) is the older behaviour of removing all other options and setting specificly what is passed. - Updated script_commands information for setoption due to this change. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6538 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-09- Script commands sc_start, sc_start2 and sc_start4 will now start ↵skotlex1-3/+3
regardless of sc defense of the target player (that is, they cannot be avoided) - Fixed a possible counter overflow in attacked_count, changed the var size to unsigned char since the code can handle the overflow now. - Multiple targets again reduces armor defense, as reported by Tharis. - Increased dex increase of NPC_POWERUP to +20 per level. - Fog of Wall's -50 hit reduction is now only for ranged attacks. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6528 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-07removed old logsLupus1-9/+0
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6510 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-05-01* Optimized fake npc system. Added npc_checknear back to npc_buysellsel.Lance1-13/+0
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6426 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-30- If someone is expulsed from a guild while the guild storage is open, it ↵skotlex1-0/+14
will be auto-closed now. - Modified battle_consume_ammo to prevent consuming multiple arrows on AC_SHOWER. - Readded script command skillpointcount. (who removed it? <.<) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6406 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-30- and more typosLance1-16/+4
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6389 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-30Fixed typo in script.cLance1-2/+3
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6388 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-29- pc_resetskill flag can now be &2, it only returns the total amount of ↵skotlex1-0/+14
skill points spent, it doesn't does a reset. - added script command skillpointcount. Returns total amount of skill points a char has (the value returned is the same that SkillPoint would have after invoking a skill reset) - Modified Defender. Speed reduction is 35-5*lv%, damage reduction on devoted chars is 5+5*lv%. These values are custom, but should be closer to "reality" than what we have. - When you have the wrong ammo type equipped, the equip arrows first message will be sent, as suggested by Haplo git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6384 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-29* Reverted npc_checknear to exclude check for class_ -1.Lance1-2/+3
* 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* Using malloc for memory allocations that doesn't need to be pre-initialized.Lance1-52/+37
* 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-27- Fixed compilation error/warning on script command setbattleflag.skotlex1-3/+3
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6323 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-27- Small change in the pet_ai that should stop the "strange" catch-up ↵skotlex1-0/+2
behaviour of pets when you are much faster than them. - Corrected the unequip script of the wedding dress/tuxedo (it should be Class, not bClass) - Changebase script command will also refresh the weapon sprites (in case you changed into Wedding/Xmas class) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6317 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-27- Added the missing clif_* calls to make changebase's view-class change ↵skotlex1-1/+5
update on the client. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6312 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-27updated 'setmapflag' script commandLupus1-2/+18
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6304 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-26- Updated item_db.sql to current.skotlex1-5/+1
- Some small code-cleanups. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6298 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-26- Item use interval is set to a default of 100ms now.skotlex1-1/+10
- Updated Full Buster so that the can't act delay carries on to the weapon attack delay and can't use item intervals. - Added script command getbattleflag to retrieve the current value of a battle_config switch. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6296 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-26- Wedding Dress/Tuxedo now handle view-change using the onequip/onunequip ↵skotlex1-3/+1
scripts. - Removed special state changebase and view-change check on status_calc_pc git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6292 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-26* Fixed typo in skill.c: skill_clear_groupLance1-1/+1
* Fixed command descriptions in script_commands.txt * Cosmetic changes to script.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6289 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-04-25- Modified and simplified the random item group format. It now is ↵skotlex1-1/+1
<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