From 6d695639b4e40a5739f5d8fa45b48a54a8523431 Mon Sep 17 00:00:00 2001 From: celest Date: Thu, 2 Dec 2004 17:06:40 +0000 Subject: - Modified Weapon Refine - should only +1 every time. - Updated Berserk, Chase Walk, Slim Pitcher - Added skill_range_leniency * Added check for clif.c in case the server didn't realise we've died git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@433 54d463be-8e91-2dee-dedb-b68131a5f0ec --- conf-tmpl/battle_athena.conf | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index d9b39dfc1..2fde5cfeb 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -746,5 +746,10 @@ mobs_level_up: no // Use kRO new steal formula? skill_steal_type: yes +// In some cases when moving to cast a skill the exe will a send a UseSkill packet +// before the server has moved us to the correct position, causing it to fail. +// Setting this at 1 would be enough. +skill_range_leniency: 1 + import: conf/import/battle_conf.txt -- cgit v1.2.3-70-g09d2 From 665680682b57d01415afb478b67d0c7c61d21119 Mon Sep 17 00:00:00 2001 From: celest Date: Thu, 2 Dec 2004 17:50:15 +0000 Subject: * Added motd_type * Edited atcommand.c to fix compile warnings git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@436 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 2 ++ conf-tmpl/battle_athena.conf | 3 +++ src/map/atcommand.c | 4 ++-- src/map/battle.c | 9 ++++++++- src/map/battle.h | 1 + src/map/pc.c | 5 ++++- 6 files changed, 20 insertions(+), 4 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 9462fd0a9..7adfcb4a2 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -6,6 +6,8 @@ Date Added - Added skill_range_leniency * Added check for clif.c in case the server didn't realise we've died [celest] * Added a fix for @npcmove by JohnC and Fredzilla + * Added motd_type [celest] + * Edited atcommand.c to fix compile warnings [celest] 12/1 - Make it build against gcc 2.95 [MouseJstr] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 2fde5cfeb..4a338b256 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -751,5 +751,8 @@ skill_steal_type: yes // Setting this at 1 would be enough. skill_range_leniency: 1 +// Set this to 1 if your clients have langtype problems and can't display motd properly +motd_type: 0 + import: conf/import/battle_conf.txt diff --git a/src/map/atcommand.c b/src/map/atcommand.c index ce2ffaf08..7accfa639 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2884,7 +2884,7 @@ int atcommand_go( return -1; } } else if (town >= 0 && town < (int)(sizeof(data) / sizeof(data[0]))) { - m = map_mapname2mapid(data[town].map); + m = map_mapname2mapid((char *)data[town].map); if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { clif_displaymessage(fd, "You are not authorised to warp you to this destination map."); return -1; @@ -2893,7 +2893,7 @@ int atcommand_go( clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); return -1; } - if (pc_setpos(sd, data[town].map, data[town].x, data[town].y, 3) == 0) { + if (pc_setpos(sd, (char *)data[town].map, data[town].x, data[town].y, 3) == 0) { clif_displaymessage(fd, msg_table[0]); // Warped. } else { clif_displaymessage(fd, msg_table[1]); // Map not found. diff --git a/src/map/battle.c b/src/map/battle.c index 9a11ab892..e90eebbad 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5213,6 +5213,7 @@ static const struct { { "skill_steal_rate", &battle_config.skill_steal_rate}, // [celest] { "night_darkness_level", &battle_config.night_darkness_level}, // [celest] { "skill_range_leniency", &battle_config.skill_range_leniency}, // [celest] + { "motd_type", &battle_config.motd_type}, // [celest] //SQL-only options start #ifndef TXT_ONLY @@ -5443,6 +5444,7 @@ void battle_set_defaults() { battle_config.skill_steal_rate = 100; battle_config.night_darkness_level = 9; battle_config.skill_range_leniency = 1; + battle_config.motd_type = 0; battle_config.castrate_dex_scale = 150; @@ -5566,8 +5568,13 @@ void battle_validate_conf() { if (battle_config.night_darkness_level > 10) // Celest battle_config.night_darkness_level = 10; - if (battle_config.skill_range_leniency <= 0) // Celest + if (battle_config.skill_range_leniency < 0) // Celest battle_config.skill_range_leniency = 0; + + if (battle_config.motd_type < 0) + battle_config.motd_type = 0; + else if (battle_config.motd_type > 1) + battle_config.motd_type = 1; if (battle_config.vending_max_value > 10000000 || battle_config.vending_max_value<=0) // Lupus & Kobra_k88 battle_config.vending_max_value = 10000000; diff --git a/src/map/battle.h b/src/map/battle.h index b0f6c523d..32dabb53e 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -341,6 +341,7 @@ extern struct Battle_Config { int skill_steal_rate; // [celest] int night_darkness_level; // [celest] int skill_range_leniency; // [celest] + int motd_type; // [celest] #ifndef TXT_ONLY /* SQL-only options */ int mail_system; // [Valaris] diff --git a/src/map/pc.c b/src/map/pc.c index c047b5745..94ee62fbb 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -838,7 +838,10 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars break; } } - clif_displaymessage(sd->fd, buf); + if (battle_config.motd_type) + clif_disp_onlyself(sd,buf,strlen(buf)); + else + clif_displaymessage(sd->fd, buf); } fclose(fp); } -- cgit v1.2.3-70-g09d2 From ecbe6aa5b86c57909ee1a7369ceda6b9348fdb1a Mon Sep 17 00:00:00 2001 From: celest Date: Sun, 5 Dec 2004 11:06:48 +0000 Subject: * Added allow_atcommand_when_mute * Temporarily leaving the changing guild emblems requiring Glory of Guild feature only for TXT until the SQL char-server supports guild skills fully * Modified battle_range again to check if src's type is a player first * Modified skill_nocast_db git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@459 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 5 +++++ conf-tmpl/battle_athena.conf | 3 +++ db/Changelog.txt | 3 +++ db/skill_nocast_db.txt | 16 ++++++++-------- src/map/atcommand.c | 5 +++++ src/map/battle.c | 8 +++++--- src/map/battle.h | 3 ++- src/map/guild.c | 16 +++++++++++----- 8 files changed, 42 insertions(+), 17 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index d355302f0..f26946cd1 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,10 @@ Date Added 12/5 + * Added allow_atcommand_when_mute - Change this to set whether muted players + can use gm commands [celest] + * Temporarily leaving the changing guild emblems requiring Glory of Guild + feature only for TXT until the SQL char-server supports guild skills fully[celest] + * Modified battle_range again to check if src's type is a player first [celest] * Corrected typo in battle_range [celest] * Fixed a crash where party chats can be sent to a partially disconnected player [MouseJstr] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 4a338b256..a950720d3 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -723,6 +723,9 @@ packet_ver_flag: 511 // Allow GMs to mute players or not? muting_players: no +// Allow GM commands to be used when muted? +allow_atcommand_when_mute: yes + // Mail system - Only function in sql version mail_system: no diff --git a/db/Changelog.txt b/db/Changelog.txt index 46945588a..dc6e134f3 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -5,6 +5,9 @@ Ayathoya items == Added but no effect ( all are "ect" itens) Skill databases == celest working on them i believe. +12/5 * Edited skill_nocast_db - the skills should be useable outside GvG maps even + if woe is on [celest] + 12/3 * corrected Spider Web's maximum level [celest] * Removed Soul Drain from Professor's skill tree [celest] * Updated Stunner's job - Acolytes and monks should be able to use it too! [celest] diff --git a/db/skill_nocast_db.txt b/db/skill_nocast_db.txt index 158cfbe3b..5669d9235 100644 --- a/db/skill_nocast_db.txt +++ b/db/skill_nocast_db.txt @@ -7,11 +7,11 @@ // 8 - Cannot be used when WoE is on // 16 - Cannot be used in PK Mode maps // Example: 8,6 = Endure cannot be used in PvP and GvG maps (2+4) -8,12 -26,12 -27,12 -87,12 -150,12 -214,12 -361,12 -362,12 \ No newline at end of file +8,4 //SM_ENDURE +26,4 //AL_TELEPORT +27,4 //AL_WARP +87,4 //WZ_ICEWALL +150,4 //TF_BACKSLIDING +214,4 //RG_RAID +361,4 //HP_ASSUMPTIO +362,4 //HP_BASILICA \ No newline at end of file diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7accfa639..da3faa97f 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -670,6 +670,11 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int nullpo_retr(AtCommand_None, sd); + if (!battle_config.allow_atcommand_when_mute && + sd->sc_count && sd->sc_data[SC_NOCHAT].timer != -1) { + return AtCommand_Unknown; + } + if (!message || !*message) return AtCommand_None; diff --git a/src/map/battle.c b/src/map/battle.c index 6b1d68625..df8b583cf 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4962,14 +4962,13 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range) if( range>0 && range < arange ) {// 遠すぎる // be lenient if the skill was cast before we have moved to the correct position [Celest] - if (src->type != BL_PC) - return 0; - else if (src->type == BL_PC) { + if (src->type == BL_PC) { struct map_session_data *sd; nullpo_retr(0, (sd=(struct map_session_data *)bl)); if (sd->walktimer != -1 && !((arange-=battle_config.skill_range_leniency)<=range)) return 0; } + else return 0; } if( arange<2 ) // 同じマスか隣接 @@ -5224,6 +5223,7 @@ static const struct { { "night_darkness_level", &battle_config.night_darkness_level}, // [celest] { "skill_range_leniency", &battle_config.skill_range_leniency}, // [celest] { "motd_type", &battle_config.motd_type}, // [celest] + { "allow_atcommand_when_mute", &battle_config.allow_atcommand_when_mute}, // [celest] //SQL-only options start #ifndef TXT_ONLY @@ -5455,6 +5455,8 @@ void battle_set_defaults() { battle_config.night_darkness_level = 9; battle_config.skill_range_leniency = 1; battle_config.motd_type = 0; + battle_config.allow_atcommand_when_mute = 0; + battle_config.castrate_dex_scale = 150; diff --git a/src/map/battle.h b/src/map/battle.h index 32dabb53e..2b901410f 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -323,7 +323,7 @@ extern struct Battle_Config { int any_warp_GM_min_level; // added by [Yor] int packet_ver_flag; // added by [Yor] int muting_players; // added by [Apple] - + int min_hair_style; // added by [MouseJstr] int max_hair_style; // added by [MouseJstr] int min_hair_color; // added by [MouseJstr] @@ -342,6 +342,7 @@ extern struct Battle_Config { int night_darkness_level; // [celest] int skill_range_leniency; // [celest] int motd_type; // [celest] + int allow_atcommand_when_mute; // [celest] #ifndef TXT_ONLY /* SQL-only options */ int mail_system; // [Valaris] diff --git a/src/map/guild.c b/src/map/guild.c index 0943b4b6d..32aa2434c 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -874,11 +874,17 @@ int guild_change_emblem(struct map_session_data *sd,int len,const char *data) nullpo_retr(0, sd); - if ((g = guild_search(sd->status.guild_id)) && guild_checkskill(g, GD_GLORYGUILD)>0) - return intif_guild_emblem(sd->status.guild_id,len,data); - - clif_skill_fail(sd,GD_GLORYGUILD,0,0); - return 0; + /* Temporarily only for TXT until there's proper char server support [Celest] */ + #ifdef TXT_ONLY + if ((g = guild_search(sd->status.guild_id)) && guild_checkskill(g, GD_GLORYGUILD)>0) + return intif_guild_emblem(sd->status.guild_id,len,data); + + clif_skill_fail(sd,GD_GLORYGUILD,0,0); + #else + if ((g = guild_search(sd->status.guild_id))) + return intif_guild_emblem(sd->status.guild_id,len,data); + #endif + return 0; } // ギルドエンブレム変更通知 int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) -- cgit v1.2.3-70-g09d2 From c57e33ab6b4b57e9d2e18dd1f4402cee5c945372 Mon Sep 17 00:00:00 2001 From: celest Date: Sat, 11 Dec 2004 10:12:43 +0000 Subject: Translated two sections to english git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@545 54d463be-8e91-2dee-dedb-b68131a5f0ec --- conf-tmpl/battle_athena.conf | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index a950720d3..bab565357 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -602,22 +602,19 @@ player_skill_partner_check: yes // Is the character of a GM account set as the object of a display by @ command etc. or not? hide_GM_session: no -// ユニット移動処-摯?@。0で-{鯖仕-l(回線負荷→重、鯖処-掾ィ軽)、1でAthena仕-l(回線負荷→軽、鯖処-掾ィ重) -// translation (babelfish): -// Unit portable place - ? @. -// With 0 - {mackerel SI -l (circuit load -> heavily, the mackerel place - the ? ? lightly), -// With 1 - Athena SI -l (circuit load -> lightly, the mackerel place - the ? ? it is heavy) + +// Skill unit movement processing method +// 0 - Aegis system : Network load -> Heavier, Server load -> Lighter +// 1 - Athena system : Network load -> Lighter, Server load -> Heavier unit_movement_type: 0 // Are other requests accepted during [various things[party,guild]] a request or not? // It does not accept by no accepted by yes. invite_request_check: yes -// リ??ブトラップの仕-l 0:-{鯖仕-l、罠1個 1:Athena仕-l、使ったアイテ?を使った個数 -// translation (babelfish): -// SI of ???????? -l -// 0: - {Mackerel SI -l, trap 1 -// 1:Athena SI -l, the quantity which used the item which was used +// Remove trap type +// 0 - Aegis system : Returns 1 'Trap' item +// 1 - Athena system : Allows the returned item and amount to be defined skill_removetrap_type: 0 // Will display experience gained from killing a monster. (Note 1) -- cgit v1.2.3-70-g09d2 From b15424b1be7020894f2d530636d77a32ec27e32c Mon Sep 17 00:00:00 2001 From: celest Date: Mon, 13 Dec 2004 19:02:17 +0000 Subject: * Added nullpo_retb * Replaced some parts in skill.c with nullpo checks * Updated most of 12/14's skills patch git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@560 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 8 +- conf-tmpl/battle_athena.conf | 34 ++++---- db/skill_cast_db.txt | 32 +++---- db/skill_db.txt | 2 +- db/skill_require_db.txt | 17 ++-- src/common/nullpo.h | 11 +++ src/map/battle.c | 195 ++++++++++++++++++++++--------------------- src/map/battle.h | 18 ++-- src/map/pc.c | 53 ++++++------ src/map/skill.c | 105 ++++++++++++++--------- 10 files changed, 267 insertions(+), 208 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index c95124ed2..6f9f872ed 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,15 +1,21 @@ Date Added 12/14 + * Added nullpo_retb to nullpo.c - does a break; if null [celest] + * Replaced some parts in skill.c with nullpo checks [celest] + * Corrected some typos - penaly -> penalty [celest] + * Skill Updates [celest] + - Most of 12/14's Sakray patch * The SKILL_MAX_DB (yes, a different #define from the one below) was not large enough for current skills causing memory corruptions and crashes [MouseJstr] * Fixed how socket handles EAGIN errors (retry instead of disconnecting) [MouseJstr] + 12/13 * Skill Updates [celest] - Added the new 'Throw Tomahawk' skill (Requires Sakexe1129 or newer) - Added some new monster skills - but still not complete. - - Adjusted Palm Strike, Tiger Fist and Chain Crush based on 11/14's patch + - Adjusted Palm Strike, Tiger Fist and Chain Crush based on 12/14's patch * Removed redundant 'sg_count' for map_session_data and mob_data [celest] * Save both persons' data after trading in case a crash causes them to rollback - fix by Freya [celest] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index bab565357..3cd2fce32 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -410,29 +410,29 @@ player_auto_counter_type: 0 // Monsters monster_auto_counter_type: 0 -// Type of penalty that is applied to FLEE when more than agi_penaly_count monsters are targetting player +// Type of penalty that is applied to FLEE when more than agi_penalty_count monsters are targetting player // 0 = no penalty is applied -// 1 = agi_penaly_num is reduced from FLEE as a % -// 2 = agi_penaly_num is reduced from FLEE as an exact amount -agi_penaly_type: 1 +// 1 = agi_penalty_num is reduced from FLEE as a % +// 2 = agi_penalty_num is reduced from FLEE as an exact amount +agi_penalty_type: 1 // Amount of enemies required to be targetting player before FLEE begins to be penalized -agi_penaly_count: 3 +agi_penalty_count: 3 -// Amount of FLEE penalized per each attacking monster more than agi_penaly_count -agi_penaly_num: 10 +// Amount of FLEE penalized per each attacking monster more than agi_penalty_count +agi_penalty_num: 10 -// Type of penalty that is applied to VIT defense when more than vit_penaly_count monsters are targetting player +// Type of penalty that is applied to VIT defense when more than vit_penalty_count monsters are targetting player // 0 = no penalty is applied -// 1 = vit_penaly_num is reduced from FLEE as a % -// 2 = vit_penaly_num is reduced from FLEE as an exact amount -vit_penaly_type: 1 +// 1 = vit_penalty_num is reduced from FLEE as a % +// 2 = vit_penalty_num is reduced from FLEE as an exact amount +vit_penalty_type: 1 // Amount of enemies required to be targetting player before VIT defense begins to be penalized -vit_penaly_count: 3 +vit_penalty_count: 3 -// Amount of VIT defense penalized per each attacking monster more than vit_penaly_count -vit_penaly_num: 5 +// Amount of VIT defense penalized per each attacking monster more than vit_penalty_count +vit_penalty_num: 5 // When the player attacks an object, the calculation method of DEF. // With 0 this will be ignored specification, at 1 or more def = subtraction of (DEF* value). @@ -505,7 +505,7 @@ player_land_skill_limit: yes monster_land_skill_limit: yes // If a party uses a skill with penalties do they apply? (Note 1) -party_skill_penaly: yes +party_skill_penalty: yes // If monster's class is changed will it fully recover HP and SP and Ailments? (Note 1) monster_class_change_full_recover: no @@ -572,14 +572,14 @@ gtb_pvp_only: no // 2: Full evasion exclusion // 3: Full evasion and evasion exclusion // 4 or more: Except all. -agi_penaly_count_lv: 2 +agi_penalty_count_lv: 2 // How to count the number of the enemies who do a vit penalty // 1 or less: It is a count altogether. // 2: Full evasion exclusion // 3: Full evasion and evasion exclusion // Four or more: Except all. -vit_penaly_count_lv: 3 +vit_penalty_count_lv: 3 // Grandcross Settings (Dont mess with these) // Even if MOB (PC) has overlapped, it HIT(s) compulsion 3. (Default no) diff --git a/db/skill_cast_db.txt b/db/skill_cast_db.txt index d6bfb8606..777d186f6 100644 --- a/db/skill_cast_db.txt +++ b/db/skill_cast_db.txt @@ -69,7 +69,7 @@ 85,15000:14500:14000:13500:13000:12500:12000:11500:11000:10500,5000,0,5500:6000:6500:7000:7500:8000:8500:9000:9500:10000 //WZ_VERMILION#ロードオブヴァーミリオン# 86,1000:2000:3000:4000:5000,0,0,0 //WZ_WATERBALL#ウォーターボール# 87,0,0,5000:10000:15000:20000:25000:30000:35000:40000:45000:50000,0 //WZ_ICEWALL#アイスウォール# -88,5000:4700:4400:4100:3800:3500:3200:2900:2700:2500,1000,0,6000:7000:8000:9000:10000:11000:12000:13000:14000:15000 //WZ_FROSTNOVA#フロストノヴァ# +88,5000:4700:4400:4100:3800:3500:3200:2900:2700:2500,1000,0,3000:3500:4000:4500:5000:5500:6000:6500:7000:7500 //WZ_FROSTNOVA#フロストノヴァ# 89,6000:7000:8000:9000:10000:11000:12000:13000:14000:15000,5000,0,10000:11000:12000:13000:14000:15000:16000:17000:18000:19000 //WZ_STORMGUST#ストームガスト# 90,1000:2000:3000:4000:5000,700,0,0 //WZ_EARTHSPIKE#アーススパイク# 91,1000:2000:3000:4000:5000,700,0,0 //WZ_HEAVENDRIVE#ヘヴンズドライブ# @@ -141,14 +141,14 @@ 220,0,0,180000,0 //RG_GRAFFITI#グラフィティ# 229,1000,0,40000:45000:50000:55000:60000,0 //AM_DEMONSTRATION#デモンストレーション# -230,1000,0,3:7:10:12:13,0 //AM_ACIDTERROR#アシッドテラー# +230,1000,0,3:7:10:12:13,60000 //AM_ACIDTERROR#アシッドテラー# 232,2000,500,40000:50000:60000:70000:80000,0 //AM_CANNIBALIZE#バイオプラント# 233,2000,500,30000,0 //AM_SPHEREMINE#スフィアーマイン# -234,2000,0,60000:120000:180000:240000:300000,0 //AM_CP_WEAPON#ケミカルウェポンチャージ# -235,2000,0,60000:120000:180000:240000:300000,0 //AM_CP_SHIELD#ケミカルシールドチャージ# -236,2000,0,60000:120000:180000:240000:300000,0 //AM_CP_ARMOR#ケミカルアーマーチャージ# -237,2000,0,60000:120000:180000:240000:300000,0 //AM_CP_HELM#ケミカルヘルムチャージ# +234,2000,0,120000:240000:360000:480000:600000,0 //AM_CP_WEAPON#ケミカルウェポンチャージ# +235,2000,0,120000:240000:360000:480000:600000,0 //AM_CP_SHIELD#ケミカルシールドチャージ# +236,2000,0,120000:240000:360000:480000:600000,0 //AM_CP_ARMOR#ケミカルアーマーチャージ# +237,2000,0,120000:240000:360000:480000:600000,0 //AM_CP_HELM#ケミカルヘルムチャージ# 249,0,0,300000,0 //CR_AUTOGUARD#オートガード# 250,0,0,0,8000:9000:10000:11000:12000 //CR_SHIELDCHARGE#シールドチャージ# @@ -175,15 +175,15 @@ 277,700,0,0,0 //SA_SPELLBREAKER#スペルブレイカー# 279,3000,0,120000:150000:180000:210000:240000:270000:300000:360000:390000,0 //SA_AUTOSPELL#オートスペル# -280,3000,0,1200000,0 //SA_FLAMELAUNCHER#フレイムランチャー# -281,3000,0,1200000,0 //SA_FROSTWEAPON#フロストウェポン# -282,3000,0,1200000,0 //SA_LIGHTNINGLOADER#ライトニングローダー# -283,3000,0,1200000,0 //SA_SEISMICWEAPON#サイズミックウェポン# - -285,5000,0,180000,180000 //SA_VOLCANO#ボルケーノ# -286,5000,0,180000,180000 //SA_DELUGE#デリュージ# -287,5000,0,180000,180000 //SA_VIOLENTGALE#バイオレントゲイル# -288,5000,0,180000,180000 //SA_LANDPROTECTOR#ランドプロテクター# +280,3000,0,1200000:1200000:1200000:1200000:1800000,0 //SA_FLAMELAUNCHER#フレイムランチャー# +281,3000,0,1200000:1200000:1200000:1200000:1800000,0 //SA_FROSTWEAPON#フロストウェポン# +282,3000,0,1200000:1200000:1200000:1200000:1800000,0 //SA_LIGHTNINGLOADER#ライトニングローダー# +283,3000,0,1200000:1200000:1200000:1200000:1800000,0 //SA_SEISMICWEAPON#サイズミックウェポン# + +285,5000,0,60000:120000:180000:240000:300000,60000:120000:180000:240000:300000 //SA_VOLCANO#ボルケーノ# +286,5000,0,60000:120000:180000:240000:300000,60000:120000:180000:240000:300000 //SA_DELUGE#デリュージ# +287,5000,0,60000:120000:180000:240000:300000,60000:120000:180000:240000:300000 //SA_VIOLENTGALE#バイオレントゲイル# +288,5000,0,60000:120000:180000:240000:300000,60000:120000:180000:240000:300000 //SA_LANDPROTECTOR#ランドプロテクター# 289,2000,0,0,0 //SA_DISPELL#ディスペル# 304,0,0,0,5000 //BD_ADAPTATION#アドリブ# @@ -243,7 +243,7 @@ 380,0,0,30000,0 //SN_SIGHT#トゥルーサイト# 381,1000,1200,0,0,0 //SN_FALCONASSAULT 382,2000,0,0,0 //SN_SHARPSHOOTING -383,2000:2400:2800:3200:3600:4000:4400:4800:5200:5600,0,65000:80000:95000:110000:125000:140000:155000:170000:185000:200000,0 //SN_WINDWALK#ウインドウォーク# +383,2000:2400:2800:3200:3600:4000:4400:4800:5200:5600,0,130000:160000:190000:220000:250000:280000:310000:340000:370000:400000,0 //SN_WINDWALK#ウインドウォーク# 384,5000:5000:6000:6000:7000:7000:8000:8000:9000:10000,0,15000:20000:25000:30000:35000:40000:45000:50000:55000:60000,5000 //WS_MELTDOWN#メルトダウン# 387,0,0,60000,0 //WS_CARTBOOST#カートブースト# diff --git a/db/skill_db.txt b/db/skill_db.txt index 50623f3e3..f9e28f3c2 100644 --- a/db/skill_db.txt +++ b/db/skill_db.txt @@ -282,7 +282,7 @@ 230,8,6,1,0,0,5,0,no,0,0,0,weapon,0 //AM_ACIDTERROR#アシッドテラ?# 231,8,6,16,0,1,5,1,yes,0,0,0,none,0 //AM_POTIONPITCHER#??ションピッ?ャ?# //231,8,6,16,0,1,10,1,yes,0,0,0,magic,0 -232,3,6,2,0,1,5,1,no,0,0,3,none,0 //AM_CANNIBALIZE#バイオプラント# +232,3,6,2,0,1,5,1,no,0,0,5,none,0 //AM_CANNIBALIZE#バイオプラント# 233,3,6,2,0,1,5,1,no,0,128,3,none,0 //AM_SPHEREMINE#スフィア??イン# 234,1,6,16,0,1,5,1,yes,0,0,0,weapon,0 //AM_CP_WEAPON#ケ?カルウェ?ン?ャ?ジ# 235,1,6,16,0,1,5,1,yes,0,0,0,weapon,0 //AM_CP_SHIELD#ケ?カルシ?ルド?ャ?ジ# diff --git a/db/skill_require_db.txt b/db/skill_require_db.txt index 18d7a63c2..5cd9d73b4 100644 --- a/db/skill_require_db.txt +++ b/db/skill_require_db.txt @@ -112,7 +112,7 @@ 138,0,0,20,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //AS_ENCHANTPOISON#エンチャントポイズン# 139,0,0,20:25:30:35:40:45:50:55:60:45,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //AS_POISONREACT#ポイズンリアクト# 140,0,0,20,0,0,0,99,none,0,716,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //AS_VENOMDUST#ベナムダスト# -141,0,0,33:36:39:42:45:48:51:54:57:60,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //AS_SPLASHER#ベナムスプラッシャ?# +141,0,0,12:14:16:18:20:22:24:26:28:30,0,0,0,99,none,0,716,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //AS_SPLASHER#ベナムスプラッシャ?# 142,0,0,3,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NV_FIRSTAID#?急手?# 143,0,0,5,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NV_TRICKDEAD#死んだふり# @@ -167,7 +167,7 @@ 261,0,0,8,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MO_CALLSPIRITS#?功# 262,0,0,5,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MO_ABSORBSPIRITS#?奪# -264,0,0,10,0,0,0,99,move_enable,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MO_BODYRELOCATION#?影# +264,0,0,14,0,0,0,99,move_enable,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MO_BODYRELOCATION#?影# 266,0,0,10:14:17:19:20,0,0,0,0:1:2:3:4:5:6:7:8:9:10:12:13:14:15:16:17:18:19:20:21:22,none,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MO_INVESTIGATE#?勁# 267,0,0,10,0,0,0,0:1:2:3:4:5:6:7:8:9:10:12:13:14:15:16:17:18:19:20:21:22,none,1:2:3:4:5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //MO_FINGEROFFENSIVE#指?# @@ -192,7 +192,7 @@ 286,0,0,48:46:44:42:40,0,0,0,99,none,0,715,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SA_DELUGE#デリュ?ジ# 287,0,0,48:46:44:42:40,0,0,0,99,none,0,715,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SA_VIOLENTGALE#バイオレントゲイル# 288,0,0,66:62:58:54:50,0,0,0,99,none,0,717,1,715,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SA_LANDPROTECTOR#ランドプロテクタ?# -289,0,0,1,0,0,0,99,none,0,716,1,715,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SA_DISPELL#ディスペル# +289,0,0,1,0,0,0,99,none,0,715,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SA_DISPELL#ディスペル# 290,0,0,50,0,0,0,99,none,0,715,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SA_ABRACADABRA#アブラカタブラ# //reduced 2 to 1 Yellow gemstones, because Abrakadabra has extra hardcoded usage of 1 Yellow gemstone [Lupus] 291,0,0,1,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SA_MONOCELL#チェンジポリン# @@ -243,7 +243,7 @@ 355,0,0,18:26:34:42:50,0,0,0,1:2:3:4:5:6:7:8:9:10:11:12:13:14:15:16:17:18:19:20:21:22,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_AURABLADE#オ?ラブレ?ド# 356,0,0,50,0,0,0,3,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_PARRYING#パリイング# -357,0,0,14:18:22:26:30,0,0,0,4:05,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_CONCENTRATION#コンセントレ?ション# +357,0,0,14:18:22:26:30,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_CONCENTRATION#コンセントレ?ション# 358,0,0,15,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_TENSIONRELAX#テンションリラックス# 359,0,0,100,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_BERSERK#バ?サ?ク# 360,0,0,50,0,0,0,3,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_FURY#フュ?リ?# @@ -255,9 +255,9 @@ 367,0,0,30:35:40:45:50,0,20:25:30:35:40,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PA_PRESSURE#プレッシャ?# 368,0,9,100,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PA_SACRIFICE#サクリファイス# 369,0,0,80:80:80:80:80:100:100:100:100:100,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PA_GOSPEL#ゴスペル# -370,0,0,12:14:16:18:20,0,0,0,99,explosionspirits,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //CH_PALMSTRIKE#猛虎硬派山# -371,0,0,12:14:16:18:20,0,0,0,99,none,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //CH_TIGERFIST#伏虎拳# -372,0,0,12:14:16:18:20:22:24:26:28:30,0,0,0,99,none,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //CH_CHAINCRUSH#連柱崩?# +370,0,0,2:4:6:8:10,0,0,0,99,explosionspirits,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //CH_PALMSTRIKE#猛虎硬派山# +371,0,0,4:6:8:10:12,0,0,0,99,none,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //CH_TIGERFIST#伏虎拳# +372,0,0,4:6:8:10:12:14:16:18:20:22,0,0,0,99,none,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //CH_CHAINCRUSH#連柱崩?# 373,0,0,1:2:3:4:5,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PF_HPCONVERSION#???????# 374,0,0,5,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PF_SOULCHANGE#ソウルチェンジ# 375,0,0,80:90:100:110:120,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PF_SOULBURN#?ウルバ?ン# @@ -267,7 +267,7 @@ 380,0,0,20:20:25:25:30:30:35:35:40:40,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SN_SIGHT#トゥル?サイト# 381,0,0,30:34:38:42:46,0,0,0,99,falcon,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SN_FALCONASSAULT#ファルコンアサルト# 382,0,0,18:21:24:27:30,0,0,0,11,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SN_SHARPSHOOTING#シャ?プシュ?ティング# -383,0,0,23:26:29:32:35:38:41:44:47:50,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SN_WINDWALK#ウインドウォ?ク# +383,0,0,46:52:58:64:70:76:82:88:94:100,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SN_WINDWALK#ウインドウォ?ク# 384,0,0,50:50:60:60:70:70:80:80:90:90,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //WS_MELTDOWN#メルトダウン# 385,0,0,5,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //WS_CREATECOIN#クリエイトコイン# 386,0,0,5,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //WS_CREATENUGGET#塊製造# @@ -289,7 +289,6 @@ 404,0,0,25,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PF_FOGWALL#フォグウォ?ル# 405,0,0,50,0,0,0,99,none,0,1025,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PF_SPIDERWEB#スパイダ?ウェッブ# 406,0,0,10:12:14:16:18:20:22:24:26:28,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //ASC_METEORASSAULT#メテオアサルト# -//407,0,0,50,0,0,0,99,none,0,937,1,952,1,939,1,7033,1,972,1,657,1,713,1,0,0,0,0,0,0 //ASC_CDP 407,0,0,50,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //ASC_CDP#デッドリ?ポイズン作成# 475,0,0,40,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //ST_PRESERVE## diff --git a/src/common/nullpo.h b/src/common/nullpo.h index 11283f941..0b9a9f7a5 100644 --- a/src/common/nullpo.h +++ b/src/common/nullpo.h @@ -87,6 +87,8 @@ #define nullpo_retr(ret, t) \ if (nullpo_chk(NLP_MARK, (void *)(t))) {return(ret);} +#define nullpo_retb(t) \ + if (nullpo_chk(NLP_MARK, (void *)(t))) {break;} // 可変引数マクロに関する条件コンパイル #if __STDC_VERSION__ >= 199901L @@ -100,6 +102,9 @@ #define nullpo_retr_f(ret, t, fmt, ...) \ if (nullpo_chk_f(NLP_MARK, (void *)(t), (fmt), __VA_ARGS__)) {return(ret);} +#define nullpo_retb_f(t, fmt, ...) \ + if (nullpo_chk_f(NLP_MARK, (void *)(t), (fmt), __VA_ARGS__)) {break;} + #elif __GNUC__ >= 2 /* GCC用 */ #define nullpo_ret_f(t, fmt, args...) \ @@ -111,6 +116,9 @@ #define nullpo_retr_f(ret, t, fmt, args...) \ if (nullpo_chk_f(NLP_MARK, (void *)(t), (fmt), ## args)) {return(ret);} +#define nullpo_retb_f(t, fmt, args...) \ + if (nullpo_chk_f(NLP_MARK, (void *)(t), (fmt), ## args)) {break;} + #else /* その他の場合・・・ orz */ @@ -127,6 +135,7 @@ #define nullpo_ret(t) if((t)){;} #define nullpo_retv(t) if((t)){;} #define nullpo_retr(ret, t) if((t)){;} +#define nullpo_retb(t) if((t)){;} // 可変引数マクロに関する条件コンパイル #if __STDC_VERSION__ >= 199901L @@ -134,12 +143,14 @@ #define nullpo_ret_f(t, fmt, ...) if((t)){;} #define nullpo_retv_f(t, fmt, ...) if((t)){;} #define nullpo_retr_f(ret, t, fmt, ...) if((t)){;} +#define nullpo_retb_f(t, fmt, ...) if((t)){;} #elif __GNUC__ >= 2 /* GCC用 */ #define nullpo_ret_f(t, fmt, args...) if((t)){;} #define nullpo_retv_f(t, fmt, args...) if((t)){;} #define nullpo_retr_f(ret, t, fmt, args...) if((t)){;} +#define nullpo_retb_f(t, fmt, args...) if((t)){;} #else /* その他の場合・・・ orz */ diff --git a/src/map/battle.c b/src/map/battle.c index 9c6b313cf..8892104b9 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -638,7 +638,7 @@ int battle_get_atk2(struct block_list *bl) if(sc_data[SC_DRUMBATTLE].timer!=-1) atk2 += sc_data[SC_DRUMBATTLE].val2; if(sc_data[SC_NIBELUNGEN].timer!=-1 && (battle_get_element(bl)/10) >= 8 ) - atk2 += sc_data[SC_NIBELUNGEN].val2; + atk2 += sc_data[SC_NIBELUNGEN].val3; if(sc_data[SC_STRIPWEAPON].timer!=-1) atk2 = atk2*sc_data[SC_STRIPWEAPON].val2/100; if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション @@ -921,11 +921,12 @@ int battle_get_speed(struct block_list *bl) if(sc_data[SC_STEELBODY].timer!=-1) speed = speed*125/100; //ディフェンダー時は加算 - if(sc_data[SC_DEFENDER].timer!=-1) - speed = (speed * (155 - sc_data[SC_DEFENDER].val1*5)) / 100; + // removed as of 12/14's patch [celest] + /*if(sc_data[SC_DEFENDER].timer!=-1) + speed = (speed * (155 - sc_data[SC_DEFENDER].val1*5)) / 100;*/ //踊り状態は4倍遅い if(sc_data[SC_DANCING].timer!=-1 ) - speed*=4; + speed *= 6; //呪い時は450加算 if(sc_data[SC_CURSE].timer!=-1) speed = speed + 450; @@ -967,7 +968,7 @@ int battle_get_adelay(struct block_list *bl) if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ //使用者とパーティメンバーで格差が出る設定でなければ3割減算 - if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penaly) + if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) aspd_rate -= 30; //そうでなければ2.5割減算 else @@ -1020,7 +1021,7 @@ int battle_get_amotion(struct block_list *bl) aspd_rate -= 30; if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ - if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penaly) + if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) aspd_rate -= 30; else aspd_rate -= 25; @@ -1579,10 +1580,18 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i if(rand()%100 < sc_data[SC_AUTOGUARD].val2) { damage = 0; clif_skill_nodamage(bl,bl,CR_AUTOGUARD,sc_data[SC_AUTOGUARD].val1,1); + // different delay depending on skill level [celest] + int delay; + if (sc_data[SC_AUTOGUARD].val1 <= 5) + delay = 300; + else if (sc_data[SC_AUTOGUARD].val1 > 5 && sc_data[SC_AUTOGUARD].val1 <= 9) + delay = 200; + else + delay = 100; if(sd) - sd->canmove_tick = gettick() + 300; + sd->canmove_tick = gettick() + delay; else if(md) - md->canmove_tick = gettick() + 300; + md->canmove_tick = gettick() + delay; } } // -- moonsoul (chance to block attacks with new Lord Knight skill parrying) @@ -1838,14 +1847,14 @@ static struct Damage battle_calc_pet_weapon_attack( // 回避率計算、回避判定は後で flee = battle_get_flee(target); - if(battle_config.agi_penaly_type > 0 || battle_config.vit_penaly_type > 0) - target_count += battle_counttargeted(target,src,battle_config.agi_penaly_count_lv); - if(battle_config.agi_penaly_type > 0) { - if(target_count >= battle_config.agi_penaly_count) { - if(battle_config.agi_penaly_type == 1) - flee = (flee * (100 - (target_count - (battle_config.agi_penaly_count - 1))*battle_config.agi_penaly_num))/100; - else if(battle_config.agi_penaly_type == 2) - flee -= (target_count - (battle_config.agi_penaly_count - 1))*battle_config.agi_penaly_num; + if(battle_config.agi_penalty_type > 0 || battle_config.vit_penalty_type > 0) + target_count += battle_counttargeted(target,src,battle_config.agi_penalty_count_lv); + if(battle_config.agi_penalty_type > 0) { + if(target_count >= battle_config.agi_penalty_count) { + if(battle_config.agi_penalty_type == 1) + flee = (flee * (100 - (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100; + else if(battle_config.agi_penalty_type == 2) + flee -= (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num; if(flee < 1) flee = 1; } } @@ -2065,11 +2074,11 @@ static struct Damage battle_calc_pet_weapon_attack( damage = damage*(240+ 60*skill_lv)/100; break; case DC_THROWARROW: // 矢撃ち - damage = damage*(100+ 50 * skill_lv)/100; + damage = damage*(60+ 40 * skill_lv)/100; flag=(flag&~BF_RANGEMASK)|BF_LONG; break; case BA_MUSICALSTRIKE: // ミュージカルストライク - damage = damage*(100+ 50 * skill_lv)/100; + damage = damage*(60+ 40 * skill_lv)/100; flag=(flag&~BF_RANGEMASK)|BF_LONG; break; case CH_TIGERFIST: // 伏虎拳 @@ -2117,18 +2126,18 @@ static struct Damage battle_calc_pet_weapon_attack( // ディバインプロテクション(ここでいいのかな?) if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && def1 < 1000000 ) { //DEF, VIT無視 int t_def; - target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penaly_count_lv); - if(battle_config.vit_penaly_type > 0) { - if(target_count >= battle_config.vit_penaly_count) { - if(battle_config.vit_penaly_type == 1) { - def1 = (def1 * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - def2 = (def2 * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - t_vit = (t_vit * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; + target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penalty_count_lv); + if(battle_config.vit_penalty_type > 0) { + if(target_count >= battle_config.vit_penalty_count) { + if(battle_config.vit_penalty_type == 1) { + def1 = (def1 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; + def2 = (def2 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; + t_vit = (t_vit * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; } - else if(battle_config.vit_penaly_type == 2) { - def1 -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - def2 -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - t_vit -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; + else if(battle_config.vit_penalty_type == 2) { + def1 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; + def2 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; + t_vit -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; } if(def1 < 0) def1 = 0; if(def2 < 1) def2 = 1; @@ -2298,14 +2307,14 @@ static struct Damage battle_calc_mob_weapon_attack( // 回避率計算、回避判定は後で flee = battle_get_flee(target); - if(battle_config.agi_penaly_type > 0 || battle_config.vit_penaly_type > 0) - target_count += battle_counttargeted(target,src,battle_config.agi_penaly_count_lv); - if(battle_config.agi_penaly_type > 0) { - if(target_count >= battle_config.agi_penaly_count) { - if(battle_config.agi_penaly_type == 1) - flee = (flee * (100 - (target_count - (battle_config.agi_penaly_count - 1))*battle_config.agi_penaly_num))/100; - else if(battle_config.agi_penaly_type == 2) - flee -= (target_count - (battle_config.agi_penaly_count - 1))*battle_config.agi_penaly_num; + if(battle_config.agi_penalty_type > 0 || battle_config.vit_penalty_type > 0) + target_count += battle_counttargeted(target,src,battle_config.agi_penalty_count_lv); + if(battle_config.agi_penalty_type > 0) { + if(target_count >= battle_config.agi_penalty_count) { + if(battle_config.agi_penalty_type == 1) + flee = (flee * (100 - (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100; + else if(battle_config.agi_penalty_type == 2) + flee -= (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num; if(flee < 1) flee = 1; } } @@ -2556,11 +2565,11 @@ static struct Damage battle_calc_mob_weapon_attack( div_=4; break; case BA_MUSICALSTRIKE: // ミュージカルストライク - damage = damage*(100+ 50 * skill_lv)/100; + damage = damage*(60+ 40 * skill_lv)/100; flag=(flag&~BF_RANGEMASK)|BF_LONG; break; case DC_THROWARROW: // 矢撃ち - damage = damage*(100+ 50 * skill_lv)/100; + damage = damage*(60+ 40 * skill_lv)/100; flag=(flag&~BF_RANGEMASK)|BF_LONG; break; case MO_COMBOFINISH: // 猛龍拳 @@ -2611,18 +2620,18 @@ static struct Damage battle_calc_mob_weapon_attack( // ディバインプロテクション(ここでいいのかな?) if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && def1 < 1000000) { //DEF, VIT無視 int t_def; - target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penaly_count_lv); - if(battle_config.vit_penaly_type > 0) { - if(target_count >= battle_config.vit_penaly_count) { - if(battle_config.vit_penaly_type == 1) { - def1 = (def1 * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - def2 = (def2 * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - t_vit = (t_vit * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; + target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penalty_count_lv); + if(battle_config.vit_penalty_type > 0) { + if(target_count >= battle_config.vit_penalty_count) { + if(battle_config.vit_penalty_type == 1) { + def1 = (def1 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; + def2 = (def2 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; + t_vit = (t_vit * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; } - else if(battle_config.vit_penaly_type == 2) { - def1 -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - def2 -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - t_vit -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; + else if(battle_config.vit_penalty_type == 2) { + def1 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; + def2 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; + t_vit -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; } if(def1 < 0) def1 = 0; if(def2 < 1) def2 = 1; @@ -2856,14 +2865,14 @@ static struct Damage battle_calc_pc_weapon_attack( // 回避率計算、回避判定は後で flee = battle_get_flee(target); - if(battle_config.agi_penaly_type > 0 || battle_config.vit_penaly_type > 0) //AGI、VITペナルティ設定が有効 - target_count += battle_counttargeted(target,src,battle_config.agi_penaly_count_lv); //対象の数を算出 - if(battle_config.agi_penaly_type > 0) { - if(target_count >= battle_config.agi_penaly_count) { //ペナルティ設定より対象が多い - if(battle_config.agi_penaly_type == 1) //回避率がagi_penaly_num%ずつ減少 - flee = (flee * (100 - (target_count - (battle_config.agi_penaly_count - 1))*battle_config.agi_penaly_num))/100; - else if(battle_config.agi_penaly_type == 2) //回避率がagi_penaly_num分減少 - flee -= (target_count - (battle_config.agi_penaly_count - 1))*battle_config.agi_penaly_num; + if(battle_config.agi_penalty_type > 0 || battle_config.vit_penalty_type > 0) //AGI、VITペナルティ設定が有効 + target_count += battle_counttargeted(target,src,battle_config.agi_penalty_count_lv); //対象の数を算出 + if(battle_config.agi_penalty_type > 0) { + if(target_count >= battle_config.agi_penalty_count) { //ペナルティ設定より対象が多い + if(battle_config.agi_penalty_type == 1) //回避率がagi_penalty_num%ずつ減少 + flee = (flee * (100 - (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num))/100; + else if(battle_config.agi_penalty_type == 2) //回避率がagi_penalty_num分減少 + flee -= (target_count - (battle_config.agi_penalty_count - 1))*battle_config.agi_penalty_num; if(flee < 1) flee = 1; //回避率は最低でも1 } } @@ -3365,8 +3374,8 @@ static struct Damage battle_calc_pc_weapon_attack( damage += arr; damage2 += arr; } - damage = damage*(100+ 50 * skill_lv)/100; - damage2 = damage2*(100+ 50 * skill_lv)/100; + damage = damage*(60+ 40 * skill_lv)/100; + damage2 = damage2*(60+ 40 * skill_lv)/100; if(sd->arrow_ele > 0) { s_ele = sd->arrow_ele; s_ele_ = sd->arrow_ele; @@ -3508,18 +3517,18 @@ static struct Damage battle_calc_pc_weapon_attack( // ディバインプロテクション(ここでいいのかな?) if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && def1 < 1000000) { //DEF, VIT無視 int t_def; - target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penaly_count_lv); - if(battle_config.vit_penaly_type > 0) { - if(target_count >= battle_config.vit_penaly_count) { - if(battle_config.vit_penaly_type == 1) { - def1 = (def1 * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - def2 = (def2 * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; - t_vit = (t_vit * (100 - (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num))/100; + target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penalty_count_lv); + if(battle_config.vit_penalty_type > 0) { + if(target_count >= battle_config.vit_penalty_count) { + if(battle_config.vit_penalty_type == 1) { + def1 = (def1 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; + def2 = (def2 * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; + t_vit = (t_vit * (100 - (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num))/100; } - else if(battle_config.vit_penaly_type == 2) { - def1 -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - def2 -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; - t_vit -= (target_count - (battle_config.vit_penaly_count - 1))*battle_config.vit_penaly_num; + else if(battle_config.vit_penalty_type == 2) { + def1 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; + def2 -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; + t_vit -= (target_count - (battle_config.vit_penalty_count - 1))*battle_config.vit_penalty_num; } if(def1 < 0) def1 = 0; if(def2 < 1) def2 = 1; @@ -5131,14 +5140,14 @@ static const struct { { "undead_detect_type", &battle_config.undead_detect_type }, { "player_auto_counter_type", &battle_config.pc_auto_counter_type }, { "monster_auto_counter_type", &battle_config.monster_auto_counter_type}, - { "agi_penaly_type", &battle_config.agi_penaly_type }, - { "agi_penaly_count", &battle_config.agi_penaly_count }, - { "agi_penaly_num", &battle_config.agi_penaly_num }, - { "agi_penaly_count_lv", &battle_config.agi_penaly_count_lv }, - { "vit_penaly_type", &battle_config.vit_penaly_type }, - { "vit_penaly_count", &battle_config.vit_penaly_count }, - { "vit_penaly_num", &battle_config.vit_penaly_num }, - { "vit_penaly_count_lv", &battle_config.vit_penaly_count_lv }, + { "agi_penalty_type", &battle_config.agi_penalty_type }, + { "agi_penalty_count", &battle_config.agi_penalty_count }, + { "agi_penalty_num", &battle_config.agi_penalty_num }, + { "agi_penalty_count_lv", &battle_config.agi_penalty_count_lv }, + { "vit_penalty_type", &battle_config.vit_penalty_type }, + { "vit_penalty_count", &battle_config.vit_penalty_count }, + { "vit_penalty_num", &battle_config.vit_penalty_num }, + { "vit_penalty_count_lv", &battle_config.vit_penalty_count_lv }, { "player_defense_type", &battle_config.player_defense_type }, { "monster_defense_type", &battle_config.monster_defense_type }, { "pet_defense_type", &battle_config.pet_defense_type }, @@ -5159,7 +5168,7 @@ static const struct { { "monster_attack_direction_change", &battle_config.monster_attack_direction_change }, { "player_land_skill_limit", &battle_config.pc_land_skill_limit }, { "monster_land_skill_limit", &battle_config.monster_land_skill_limit}, - { "party_skill_penaly", &battle_config.party_skill_penaly }, + { "party_skill_penalty", &battle_config.party_skill_penalty }, { "monster_class_change_full_recover", &battle_config.monster_class_change_full_recover }, { "produce_item_name_input", &battle_config.produce_item_name_input }, { "produce_potion_name_input", &battle_config.produce_potion_name_input}, @@ -5365,14 +5374,14 @@ void battle_set_defaults() { battle_config.undead_detect_type = 0; battle_config.pc_auto_counter_type = 1; battle_config.monster_auto_counter_type = 1; - battle_config.agi_penaly_type = 0; - battle_config.agi_penaly_count = 3; - battle_config.agi_penaly_num = 0; - battle_config.agi_penaly_count_lv = ATK_FLEE; - battle_config.vit_penaly_type = 0; - battle_config.vit_penaly_count = 3; - battle_config.vit_penaly_num = 0; - battle_config.vit_penaly_count_lv = ATK_DEF; + battle_config.agi_penalty_type = 0; + battle_config.agi_penalty_count = 3; + battle_config.agi_penalty_num = 0; + battle_config.agi_penalty_count_lv = ATK_FLEE; + battle_config.vit_penalty_type = 0; + battle_config.vit_penalty_count = 3; + battle_config.vit_penalty_num = 0; + battle_config.vit_penalty_count_lv = ATK_DEF; battle_config.player_defense_type = 0; battle_config.monster_defense_type = 0; battle_config.pet_defense_type = 0; @@ -5394,7 +5403,7 @@ void battle_set_defaults() { battle_config.pc_undead_nofreeze = 0; battle_config.pc_land_skill_limit = 1; battle_config.monster_land_skill_limit = 1; - battle_config.party_skill_penaly = 1; + battle_config.party_skill_penalty = 1; battle_config.monster_class_change_full_recover = 0; battle_config.produce_item_name_input = 1; battle_config.produce_potion_name_input = 1; @@ -5534,10 +5543,10 @@ void battle_validate_conf() { battle_config.max_cart_weight = 100; battle_config.max_cart_weight *= 10; - if(battle_config.agi_penaly_count < 2) - battle_config.agi_penaly_count = 2; - if(battle_config.vit_penaly_count < 2) - battle_config.vit_penaly_count = 2; + if(battle_config.agi_penalty_count < 2) + battle_config.agi_penalty_count = 2; + if(battle_config.vit_penalty_count < 2) + battle_config.vit_penalty_count = 2; if(battle_config.guild_exp_limit > 99) battle_config.guild_exp_limit = 99; diff --git a/src/map/battle.h b/src/map/battle.h index 2b901410f..48a543844 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -229,12 +229,12 @@ extern struct Battle_Config { int undead_detect_type; int pc_auto_counter_type; int monster_auto_counter_type; - int agi_penaly_type; - int agi_penaly_count; - int agi_penaly_num; - int vit_penaly_type; - int vit_penaly_count; - int vit_penaly_num; + int agi_penalty_type; + int agi_penalty_count; + int agi_penalty_num; + int vit_penalty_type; + int vit_penalty_count; + int vit_penalty_num; int player_defense_type; int monster_defense_type; int pet_defense_type; @@ -256,7 +256,7 @@ extern struct Battle_Config { int pc_undead_nofreeze; int pc_land_skill_limit; int monster_land_skill_limit; - int party_skill_penaly; + int party_skill_penalty; int monster_class_change_full_recover; int produce_item_name_input; int produce_potion_name_input; @@ -297,8 +297,8 @@ extern struct Battle_Config { int pk_mode; int show_mob_hp; // end additions [Valaris] - int agi_penaly_count_lv; - int vit_penaly_count_lv; + int agi_penalty_count_lv; + int vit_penalty_count_lv; int gx_allhit; int gx_cardfix; diff --git a/src/map/pc.c b/src/map/pc.c index b7c540e1d..3cb78e65a 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1458,7 +1458,7 @@ int pc_calcstatus(struct map_session_data* sd,int first) } if( (skill=pc_checkskill(sd,MC_INCCARRY))>0 ) // skill can be used with an item now, thanks to orn [Valaris] - sd->max_weight += skill*1000; + sd->max_weight += skill*2000; if( (skill=pc_checkskill(sd,AC_OWL))>0 ) // ふくろうの目 sd->paramb[4] += skill; @@ -1467,6 +1467,9 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->paramb[0] ++; sd->base_atk += 4; } + if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // Dragonology increases +1 int every 2 levels + sd->paramb[3] += (skill+1)*0.5; + } // New guild skills - Celest if (sd->status.guild_id > 0) { @@ -1656,7 +1659,7 @@ int pc_calcstatus(struct map_session_data* sd,int first) //攻?速度?加 - if( (skill=pc_checkskill(sd,AC_VULTURE))>0){ // ワシの目 + if((skill=pc_checkskill(sd,AC_VULTURE))>0){ // ワシの目 sd->hit += skill; if(sd->status.weapon == 11) sd->attackrange += skill; @@ -1671,27 +1674,17 @@ int pc_calcstatus(struct map_session_data* sd,int first) else if (pc_isriding(sd)) { // ペコペコ?りによる速度?加 sd->speed -= (0.25 * DEFAULT_WALK_SPEED); sd->max_weight += 10000; - } - if(sd->sc_count){ - if(sd->sc_data[SC_WINDWALK].timer!=-1) //ウィンドウォ?ク時はLv*2%減算 - sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100; - if(sd->sc_data[SC_CARTBOOST].timer!=-1) // カ?トブ?スト - sd->speed -= (DEFAULT_WALK_SPEED * 20)/100; - if(sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中はIAと同じぐらい速い? - sd->speed -= sd->speed *25/100; - if(sd->sc_data[SC_WEDDING].timer!=-1) //結婚中は?くのが?い - sd->speed = 2*DEFAULT_WALK_SPEED; - } - + } if((skill=pc_checkskill(sd,CR_TRUST))>0) { // フェイス sd->status.max_hp += skill*200; sd->subele[6] += skill*5; } - if((skill=pc_checkskill(sd,BS_SKINTEMPER))>0) - { + if((skill=pc_checkskill(sd,BS_SKINTEMPER))>0) { sd->subele[0] += skill; sd->subele[3] += skill*5; } + if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 ) + aspd_rate -= skill*0.5; bl=sd->status.base_level; @@ -1831,16 +1824,17 @@ int pc_calcstatus(struct map_session_data* sd,int first) } if(sd->sc_data[SC_NIBELUNGEN].timer!=-1) { // ニ?ベルングの指輪 index = sd->equip_index[9]; - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3) + /*if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3) sd->watk += sd->sc_data[SC_NIBELUNGEN].val3; index = sd->equip_index[8]; if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3) sd->watk_ += sd->sc_data[SC_NIBELUNGEN].val3; + index = sd->equip_index[9];*/ if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4) - sd->watk += sd->sc_data[SC_NIBELUNGEN].val2; + sd->watk2 += sd->sc_data[SC_NIBELUNGEN].val3; index = sd->equip_index[8]; if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4) - sd->watk_ += sd->sc_data[SC_NIBELUNGEN].val2; + sd->watk_2 += sd->sc_data[SC_NIBELUNGEN].val3; } if(sd->sc_data[SC_VOLCANO].timer!=-1 && sd->def_ele==3){ // ボルケ?ノ @@ -1876,7 +1870,7 @@ int pc_calcstatus(struct map_session_data* sd,int first) aspd_rate -= 30; if(sd->sc_data[SC_ADRENALINE].timer != -1 && sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ - if(sd->sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penaly) + if(sd->sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) aspd_rate -= 30; else aspd_rate -= 25; @@ -1896,6 +1890,14 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sd->sc_data[i=SC_SPEEDPOTION0].timer!=-1) // ? 速ポ?ション aspd_rate -= sd->sc_data[i].val2; + if(sd->sc_data[SC_WINDWALK].timer!=-1) //ウィンドウォ?ク時はLv*2%減算 + sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100; + if(sd->sc_data[SC_CARTBOOST].timer!=-1) // カ?トブ?スト + sd->speed -= (DEFAULT_WALK_SPEED * 20)/100; + if(sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中はIAと同じぐらい速い? + sd->speed -= sd->speed *25/100; + if(sd->sc_data[SC_WEDDING].timer!=-1) //結婚中は?くのが?い + sd->speed = 2*DEFAULT_WALK_SPEED; // HIT/FLEE?化系 if(sd->sc_data[SC_WHISTLE].timer!=-1){ // 口笛 @@ -1980,13 +1982,15 @@ int pc_calcstatus(struct map_session_data* sd,int first) } if(sd->sc_data[SC_DEFENDER].timer != -1) { sd->aspd += (550 - sd->sc_data[SC_DEFENDER].val1*50); - sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; + // removed as of 12/14's patch [celest] + //sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; } if(sd->sc_data[SC_ENCPOISON].timer != -1) sd->addeff[4] += sd->sc_data[SC_ENCPOISON].val2; if( sd->sc_data[SC_DANCING].timer!=-1 ){ // 演奏/ダンス使用中 - sd->speed*=4; + sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON))); + //sd->speed*=4; sd->nhealsp = 0; sd->nshealsp = 0; sd->nsshealsp = 0; @@ -2175,10 +2179,11 @@ int pc_calcspeed (struct map_session_data *sd) sd->speed = (sd->speed * 125) / 100; } if(sd->sc_data[SC_DEFENDER].timer != -1) { - sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; + // removed as of 12/14's patch [celest] + //sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; } if( sd->sc_data[SC_DANCING].timer!=-1 ){ - sd->speed*=4; + sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON))); } if(sd->sc_data[SC_CURSE].timer!=-1) sd->speed += 450; diff --git a/src/map/skill.c b/src/map/skill.c index be23b2234..3cdc4a8f4 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1195,6 +1195,11 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s } break; + case AM_ACIDTERROR: + if( rand()%100 < (skilllv*3)*sc_def_vit/100 ) + skill_status_change_start(bl,SC_BLEEDING,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + break; + case CR_SHIELDCHARGE: /* シ?ルドチャ?ジ */ if( rand()%100 < (15 + skilllv*5)*sc_def_vit/100 ) skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); @@ -2391,8 +2396,10 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case AM_ACIDTERROR: /* アシッドテラ? */ skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); - if(bl->type == BL_PC && rand()%100 < skill_get_time(skillid,skilllv) && battle_config.equipment_breaking) + if(bl->type == BL_PC && rand()%100 < skill_get_time(skillid,skilllv) && battle_config.equipment_breaking) { pc_breakarmor((struct map_session_data *)bl); + clif_emotion(bl, 23); + } break; case MO_FINGEROFFENSIVE: /* 指? */ { @@ -3170,7 +3177,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; } } - if(rand()%100 > (75+skilllv*1) && (skilllv != 5)) { + if(rand()%100 > (60+skilllv*10) && (skilllv != 5)) { clif_skill_fail(sd,skillid,0,0); clif_skill_nodamage(src,bl,skillid,skilllv,0); if(bl->type==BL_PC && battle_config.equipment_breaking) { @@ -5041,15 +5048,19 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil pc_movepos(sd,x,y); }else if( src->type==BL_MOB ) mob_warp((struct mob_data *)src,-1,x,y,0); + skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,MO_EXTREMITYFIST,0,2000,0 ); break; case AM_CANNIBALIZE: // バイオプラント if(sd){ int mx,my,id=0; + int summons[5] = { 1020, 1068, 1118, 1500, 1368 }; + struct mob_data *md; mx = x;// + (rand()%10 - 5); my = y;// + (rand()%10 - 5); - id=mob_once_spawn(sd,"this",mx,my,"--ja--",1118,1,""); + + id=mob_once_spawn(sd,"this",mx,my,"--ja--", summons[skilllv] ,1,""); if( (md=(struct mob_data *)map_id2bl(id)) !=NULL ){ md->master_id=sd->bl.id; md->hp=2210+skilllv*200; @@ -5069,7 +5080,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil id=mob_once_spawn(sd,"this",mx,my,"--ja--",1142,1,""); if( (md=(struct mob_data *)map_id2bl(id)) !=NULL ){ md->master_id=sd->bl.id; - md->hp=1000+skilllv*200; + md->hp=2000+skilllv*400; md->state.special_mob_ai=2; md->deletetimer=add_timer(gettick()+skill_get_time(skillid,skilllv),mob_timer_delete,id,0); } @@ -5272,7 +5283,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, case PR_SANCTUARY: /* サンクチュアリ */ count=21; limit=skill_get_time(skillid,skilllv); - val1=skilllv+3; + val1=(skilllv+3)*2; val2=(skilllv>6)?777:skilllv*100; target=BCT_ALL; range=1; @@ -5390,7 +5401,8 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, case SA_DELUGE: /* デリュ?ジ */ case SA_VIOLENTGALE: /* バイオレントゲイル */ limit=skill_get_time(skillid,skilllv); - count=skilllv<=2?25:(skilllv<=4?49:81); + //count=skilllv<=2?25:(skilllv<=4?49:81); + count=49; target=BCT_ALL; break; @@ -5408,7 +5420,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, count=81; limit=skill_get_time(skillid,skilllv); range=5; - target=BCT_ALL; + target=(skillid==BD_ETERNALCHAOS ? BCT_ENEMY : BCT_ALL); break; case BD_RICHMANKIM: case BD_DRUMBATTLEFIELD: /* ?太鼓の響き */ @@ -5897,8 +5909,11 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int clif_skill_nodamage(&src->bl,bl,AL_HEAL,heal,1); battle_heal(NULL,bl,heal,0,0); } - else + else { + // reduce healing count if this was meant for damaging [celest] + sg->val1 /= 2; skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); + } } break; @@ -7032,6 +7047,10 @@ int skill_check_condition(struct map_session_data *sd,int type) } else sd->spiritball_old = lv; break; + case MO_BODYRELOCATION: + if (sd->sc_count && sd->sc_data[SC_EXPLOSIONSPIRITS].timer!=-1) + spiritball = 0; + break; case MO_CHAINCOMBO: //連打掌 if(sd->sc_data[SC_BLADESTOP].timer==-1){ if(sd->sc_data[SC_COMBO].timer == -1 || sd->sc_data[SC_COMBO].val1 != MO_TRIPLEATTACK) @@ -7094,8 +7113,9 @@ int skill_check_condition(struct map_session_data *sd,int type) case AM_SPHEREMINE: /* スフィア?マイン */ if(type&1){ int c=0; - int maxcount=skill_get_maxcount(skill); - int mob_class=(skill==AM_CANNIBALIZE)?1118:1142; + int summons[5] = { 1020, 1068, 1118, 1500, 1368 }; + int maxcount = (skill==AM_CANNIBALIZE)? 6-lv : skill_get_maxcount(skill); + int mob_class = (skill==AM_CANNIBALIZE)? summons[lv] :1142; if(battle_config.pc_land_skill_limit && maxcount>0) { map_foreachinarea(skill_check_condition_mob_master_sub ,sd->bl.m, 0, 0, map[sd->bl.m].xs, map[sd->bl.m].ys, BL_MOB, sd->bl.id, mob_class,&c ); if(c >= maxcount){ @@ -7657,15 +7677,16 @@ int skill_use_id( struct map_session_data *sd, int target_id, return 0; } break; - case AS_SPLASHER: /* ベナムスプラッシャ? */ - { + // removed on 12/14's patch [celest] + //case AS_SPLASHER: /* ベナムスプラッシャ? */ + /* { struct status_change *t_sc_data = battle_get_sc_data(bl); if(t_sc_data && t_sc_data[SC_POISON].timer==-1){ clif_skill_fail(sd,skill_num,0,10); return 0; } } - break; + break;*/ case PF_MEMORIZE: /* メモライズ */ casttime = 12000; break; @@ -8860,12 +8881,11 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) struct status_change *sc_data; //short *sc_count; //使ってない? - if( (bl=map_id2bl(id)) == NULL ) - return 0; //該?IDがすでに消滅しているというのはいかにもありそうなのでスル?してみる + nullpo_retr(0, bl=map_id2bl(id)); nullpo_retr(0, sc_data=battle_get_sc_data(bl)); if(bl->type==BL_PC) - sd=(struct map_session_data *)bl; + nullpo_retr(0, sd=(struct map_session_data *)bl); //sc_count=battle_get_sc_count(bl); //使ってない? @@ -8975,8 +8995,8 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) case SC_WATERBALL: /* ウォ?タ?ボ?ル */ { struct block_list *target=map_id2bl(sc_data[type].val2); - if(target==NULL || target->prev==NULL) - break; + nullpo_retb(target); + nullpo_retb(target->prev); skill_attack(BF_MAGIC,bl,bl,target,WZ_WATERBALL,sc_data[type].val1,tick,0); if((--sc_data[type].val3)>0) { sc_data[type].timer=add_timer( 150+tick,skill_status_change_timer, bl->id, data ); @@ -9003,12 +9023,14 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) struct skill_unit *unit= (struct skill_unit *)sc_data[type].val4; struct block_list *src; - - if(!unit || !unit->group) + /*if(!unit || !unit->group) break; src=map_id2bl(unit->group->src_id); if(!src) - break; + break;*/ + nullpo_retb(unit); + nullpo_retb(unit->group); + nullpo_retr(0, src=map_id2bl(unit->group->src_id)); skill_attack(BF_MISC,src,&unit->bl,bl,unit->group->skill_id,sc_data[type].val1,tick,0); sc_data[type].timer=add_timer(skill_get_time2(unit->group->skill_id,unit->group->skill_lv)+tick, skill_status_change_timer, bl->id, data ); @@ -9020,7 +9042,9 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) if( (--sc_data[type].val2)>0){ struct skill_unit *unit= (struct skill_unit *)sc_data[type].val4; - if(!unit || !unit->group || unit->group->src_id==bl->id) + nullpo_retb(unit); + nullpo_retb(unit->group); + if(unit->group->src_id == bl->id) break; skill_additional_effect(bl,bl,unit->group->skill_id,sc_data[type].val1,BF_LONG|BF_SKILL|BF_MISC,tick); if (unit->group != 0) @@ -9048,8 +9072,8 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) if((++sc_data[type].val4)%5 == 0 && battle_get_hp(bl) > hp>>2) { hp = hp/100; if(hp < 1) hp = 1; - if(bl->type == BL_PC) - pc_heal((struct map_session_data *)bl,-hp,0); + if(sd) + pc_heal(sd,-hp,0); else if(bl->type == BL_MOB){ struct mob_data *md; if((md=((struct mob_data *)bl)) == NULL) @@ -9072,8 +9096,9 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) } else if(bl->type == BL_MOB) { struct mob_data *md; - if((md=((struct mob_data *)bl)) == NULL) - break; + nullpo_retr(0, md=(struct mob_data *)bl); + /*if((md=((struct mob_data *)bl)) == NULL) + break;*/ hp = 3 + hp/200; md->hp -= hp; } @@ -9088,13 +9113,14 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) if (sc_data[SC_SLOWPOISON].timer == -1 && (--sc_data[type].val3) > 0) { int hp = battle_get_max_hp(bl); if (battle_get_hp(bl) > hp>>2) { - if(bl->type == BL_PC) { + if(sd) { hp = 3 + hp/50; - pc_heal((struct map_session_data *)bl, -hp, 0); + pc_heal(sd, -hp, 0); } else if (bl->type == BL_MOB) { struct mob_data *md; - if ((md=((struct mob_data *)bl)) == NULL) - break; + nullpo_retr(0, md=(struct mob_data *)bl); + /*if ((md=((struct mob_data *)bl)) == NULL) + break;*/ hp = 3 + hp/100; md->hp -= hp; } @@ -9124,14 +9150,15 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) // case SC_BLEEDING: if((--sc_data[type].val3) > 0) { int hp = battle_get_max_hp(bl); - if(bl->type == BL_PC) { + if(sd) { hp = 3 + hp*3/200; - pc_heal((struct map_session_data *)bl,-hp,0); + pc_heal(sd,-hp,0); } else if(bl->type == BL_MOB) { struct mob_data *md; - if((md=((struct mob_data *)bl)) == NULL) - break; + nullpo_retr(0, md=(struct mob_data *)bl); + /*if((md=((struct mob_data *)bl)) == NULL) + break;*/ hp = 3 + hp/200; md->hp -= hp; } @@ -9517,11 +9544,13 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val calc_flag = 1; break; case SC_WEAPONPERFECTION: /* ウェポンパ?フェクション */ - if(battle_config.party_skill_penaly && !val2) tick /= 5; + // Lasting time penalties have been removed on sakray as of 12/14 [celest] + //if(battle_config.party_skill_penalty && !val2) tick /= 5; break; case SC_OVERTHRUST: /* オ?バ?スラスト */ *opt3 |= 2; - if(battle_config.party_skill_penaly && !val2) tick /= 10; + // Lasting time penalties have been removed on sakray as of 12/14 [celest] + //if(battle_config.party_skill_penalty && !val2) tick /= 10; break; case SC_MAXIMIZEPOWER: /* マキシマイズパワ?(SPが1減る時間,val2にも) */ if(bl->type == BL_PC) @@ -9682,7 +9711,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val break; case SC_NIBELUNGEN: /* ニ?ベルングの指輪 */ calc_flag = 1; - val2 = (val1+2)*50; + //val2 = (val1+2)*50; val3 = (val1+2)*25; break; case SC_ROKISWEIL: /* ロキの叫び */ @@ -9691,7 +9720,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val break; case SC_SIEGFRIED: /* 不死身のジ?クフリ?ド */ calc_flag = 1; - val2 = 40 + val1*5; + val2 = 55 + val1*5; val3 = val1*10; break; case SC_DISSONANCE: /* 不協和音 */ -- cgit v1.2.3-70-g09d2 From 7ce8cd3af8480f5236497ccd59b75d221070927f Mon Sep 17 00:00:00 2001 From: celest Date: Wed, 15 Dec 2004 13:06:43 +0000 Subject: - Corrected traps - Some minor changes to Hiding, Cloaking and Chasewalk - Corrected Cannibalize - Updated Marionette Control, Berserk * Changed the weather gm commands to be able to toggle on and off * Added Jawaii and Ayothaya to @go list * Changed the default values for ranged, magic and misc damage rate in battle_athena * Removed redundant 'berserkdamagetick' * Added changes to map.h according to Shinomori * Changed Parasite in mob_db git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@570 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 16 +++++++++ conf-tmpl/battle_athena.conf | 6 ++-- db/Changelog.txt | 2 ++ db/mob_db.txt | 2 +- src/map/atcommand.c | 80 +++++++++++++++++++++++++++++--------------- src/map/map.h | 5 +-- src/map/pc.c | 42 ++++++++++++++++++----- src/map/skill.c | 71 +++++++++++++++++++++++++-------------- 8 files changed, 156 insertions(+), 68 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 6d354f0ea..bcd349bdf 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,20 @@ Date Added +12/15 + * Skill Updates [celest] + - Corrected traps to last longer in GvG + - Some minor changes to Hiding, Cloaking and Chasewalk to prevent it from + not working if sc_data is null + - Corrected an error in Cannibalize + - Updated Marionette Control to check its range from the partner + - Updated Berserk to disable hp and sp regen for 5 minutes after the skill + * Changed the weather gm commands to be able to toggle on and off. For example, + use @snow once to turn it on, reuse it again to turn it off. [celest] + * Added Jawaii and Ayothaya to @go list [celest] + * Changed the default values for ranged, magic and misc damage rate in + battle_athena to 60, 50 and 60 [celest] + * Removed redundant 'berserkdamagetick' from map_session_data [celest] + * Added changes to map.h according to Shinomori [celest] + 12/14 * Changed "Map-server can't connect to char-server" message to reduce output spamming and set it to display only once [MC Cameri] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 3cd2fce32..6b0381074 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -473,13 +473,13 @@ monster_cloak_check_type: no gvg_short_attack_damage_rate: 100 // Ranged damage adjustments for WoE battles (Guild Vs Guild) (Note 2) -gvg_long_attack_damage_rate: 100 +gvg_long_attack_damage_rate: 60 // Magic damage adjustments for WoE battles (Guild Vs Guild) (Note 2) -gvg_magic_attack_damage_rate: 100 +gvg_magic_attack_damage_rate: 50 // Misc damage adjustments for WoE battles (Guild Vs Guild) (Note 2) -gvg_misc_attack_damage_rate: 100 +gvg_misc_attack_damage_rate: 60 // When the empelium is broken with WoE mode on, How Long Before The Declaration Of Castle Owner // and Removal of Monsters/Players from Castle. (in milliseconds) diff --git a/db/Changelog.txt b/db/Changelog.txt index c684cfeee..2c8794a48 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -5,6 +5,8 @@ Ayathoya items == Added but no effect ( all are "ect" itens) Skill databases == celest working on them i believe. +12/14 * Changed 'Parasite' to non-moving [celest] + 12/12 * Removed unuseable skills from skill_tree.txt [celest] 12/11 * Corrected item_db - Wedding rings should give all 3 skills [celest] diff --git a/db/mob_db.txt b/db/mob_db.txt index f3e097cb3..79ea8f029 100644 --- a/db/mob_db.txt +++ b/db/mob_db.txt @@ -494,7 +494,7 @@ 1497,WOODEN_GOLEM,Wooden Golem,51,9200,0,1926,1353,1,570,657,32,36,1,41,69,5,85,41,10,12,2,3,42,149,200,1152,1584,400,7188,6500,7189,5000,757,120,604,100,2270,3,921,1000,7201,900,0,0,0,0,0,0,0,0,0,0,, 1498,WOODEN_SHOOTER,Wooden Shooter,39,3977,0,886,453,9,224,271,10,28,1,35,29,15,120,42,10,12,1,7,42,133,200,1152,1152,384,7049,1000,513,1000,7195,4500,7200,3500,512,100,512,0,512,0,512,0,0,0,0,0,0,0,0,0,, 1499,WOODEN_FIGHTER,Wooden Fighter,41,4457,0,1790,833,1,395,480,30,19,1,41,31,10,67,30,10,12,1,7,43,149,200,1152,1152,384,517,4700,7196,4000,513,1000,7198,900,1801,5,1812,3,512,0,512,0,0,0,0,0,0,0,0,0,, -1500,PARASITE,Parasite,37,3090,0,1098,478,9,175,215,5,19,1,40,20,10,90,25,10,12,1,3,44,149,200,1152,1152,384,7194,2000,7186,3500,7193,6700,711,2300,7198,1000,2270,20,1957,1,0,0,0,0,0,0,0,0,, +1500,PARASITE,Parasite,37,3090,0,1098,478,9,175,215,5,19,1,40,20,10,90,25,10,12,1,3,44,148,200,1152,1152,384,7194,2000,7186,3500,7193,6700,711,2300,7198,1000,2270,20,1957,1,0,0,0,0,0,0,0,0,, 1502,FIRE_PORING,Fire Poring,1,50,0,2,1,1,7,10,0,5,1,1,1,1,6,30,10,12,1,3,21,131,400,1872,672,480,909,7000,1202,100,938,400,512,1000,713,1500,741,5,619,20,4001,20,0,0,0,0,0,0,0,0,, 1503,GIBBET,Gibbet,58,6841,0,4011,1824,3,238,418,28,31,1,42,42,27,46,28,10,12,2,6,27,149,150,1152,1584,400,7218,5500,7212,2000,7222,1000,604,100,716,100,724,10,512,0,512,0,0,0,0,0,0,0,0,0,, 1504,DULLAHAN,Dullahan,62,12437,0,4517,2963,3,418,647,47,38,1,30,5,45,62,22,10,12,1,1,49,149,155,1152,1152,428,7210,5500,7209,2000,2505,100,2506,2,2614,5,512,0,512,0,512,0,0,0,0,0,0,0,0,0,, diff --git a/src/map/atcommand.c b/src/map/atcommand.c index ff7ff00da..9ee2bdb14 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2900,6 +2900,8 @@ int atcommand_go( { "louyang.gat", 217, 40 }, // 14=Lou Yang { "new_1-1.gat", 53, 111 }, // 15=Start point { "sec_pri.gat", 23, 61 }, // 16=Prison + { "jawaii.gat", 249, 127 }, // 17=Jawaii + { "ayothaya.gat", 151, 117 }, // 18=Ayothaya }; nullpo_retr(-1, sd); @@ -2925,7 +2927,8 @@ int atcommand_go( clif_displaymessage(fd, " 0=Prontera 7=Lutie 14=Lou Yang"); clif_displaymessage(fd, " 1=Morroc 8=Comodo 15=Start point"); clif_displaymessage(fd, " 2=Geffen 9=Yuno 16=Prison"); - clif_displaymessage(fd, " 3=Payon 10=Amatsu"); + clif_displaymessage(fd, " 3=Payon 10=Amatsu 17=Jawaii"); + clif_displaymessage(fd, " 18=Ayothaya"); return -1; } else { // get possible name of the city and add .gat if not in the name @@ -2980,6 +2983,12 @@ int atcommand_go( strncmp(map_name, "prison.gat", 3) == 0 || // name of the position (3 first characters) strncmp(map_name, "jails.gat", 3) == 0) { // name of the position town = 16; + } else if (strncmp(map_name, "jawaii.gat", 3) == 0 || // 3 first characters + strncmp(map_name, "jawai.gat", 3) == 0) { // writing error (3 first characters) + town = 17; + } else if (strncmp(map_name, "ayothaya.gat", 4) == 0 || // 3 first characters + strncmp(map_name, "ayotaya.gat", 4) == 0) { // writing error (3 first characters) + town = 18; } if (town >= -3 && town <= -1) { @@ -7601,11 +7610,14 @@ atcommand_rain( int effno = 0; nullpo_retr(-1, sd); effno = 161; - if (effno < 0 || map[sd->bl.m].flag.rain) - return -1; - - map[sd->bl.m].flag.rain=1; - clif_specialeffect(&sd->bl,effno,2); + if (map[sd->bl.m].flag.rain) { + map[sd->bl.m].flag.rain=0; + clif_displaymessage(fd, "The rain has stopped."); + } else { + map[sd->bl.m].flag.rain=1; + clif_specialeffect(&sd->bl,effno,2); + clif_displaymessage(fd, "It is made to rain."); + } return 0; } /*========================================== @@ -7620,11 +7632,15 @@ atcommand_snow( int effno = 0; effno = 162; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.m].flag.snow) - return -1; - - map[sd->bl.m].flag.snow=1; - clif_specialeffect(&sd->bl,effno,2); + if (map[sd->bl.m].flag.snow) { + map[sd->bl.m].flag.snow=0; + clif_displaymessage(fd, "Snow has stopped falling."); + } else { + map[sd->bl.m].flag.snow=1; + clif_specialeffect(&sd->bl,effno,2); + clif_displaymessage(fd, "It is made to snow."); + } + return 0; } @@ -7640,11 +7656,14 @@ atcommand_sakura( int effno = 0; effno = 163; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.m].flag.sakura) - return -1; - - map[sd->bl.m].flag.sakura=1; - clif_specialeffect(&sd->bl,effno,2); + if (map[sd->bl.m].flag.sakura) { + map[sd->bl.m].flag.sakura=0; + clif_displaymessage(fd, "Cherry tree leaves is made to fall."); + } else { + map[sd->bl.m].flag.sakura=1; + clif_specialeffect(&sd->bl,effno,2); + clif_displaymessage(fd, "Cherry tree leaves is made to fall."); + } return 0; } @@ -7660,11 +7679,14 @@ atcommand_fog( int effno = 0; effno = 233; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.m].flag.fog) - return -1; - - map[sd->bl.m].flag.fog=1; - clif_specialeffect(&sd->bl,effno,2); + if (map[sd->bl.m].flag.fog) { + map[sd->bl.m].flag.fog=0; + clif_displaymessage(fd, "The fog has gone."); + } else { + map[sd->bl.m].flag.fog=1; + clif_specialeffect(&sd->bl,effno,2); + clif_displaymessage(fd, "Fog hangs over."); + } return 0; } @@ -7681,11 +7703,15 @@ atcommand_leaves( int effno = 0; effno = 333; nullpo_retr(-1, sd); - if (effno < 0 || map[sd->bl.m].flag.leaves) - return -1; + if (map[sd->bl.m].flag.leaves) { + map[sd->bl.m].flag.leaves=0; + clif_displaymessage(fd, "Leaves no longer fall."); + } else { + map[sd->bl.m].flag.leaves=1; + clif_specialeffect(&sd->bl,effno,2); + clif_displaymessage(fd, "Fallen leaves fall."); + } - map[sd->bl.m].flag.leaves=1; - clif_specialeffect(&sd->bl,effno,2); return 0; } @@ -7698,14 +7724,14 @@ atcommand_clearweather( const int fd, struct map_session_data* sd, const char* command, const char* message) { - int effno = 0; + //int effno = 0; nullpo_retr(-1, sd); map[sd->bl.m].flag.rain=0; map[sd->bl.m].flag.snow=0; map[sd->bl.m].flag.sakura=0; map[sd->bl.m].flag.fog=0; map[sd->bl.m].flag.leaves=0; - clif_specialeffect(&sd->bl,effno,2); + //clif_specialeffect(&sd->bl,effno,2); // not required. [celest] return 0; } diff --git a/src/map/map.h b/src/map/map.h index 3ad6105ad..060bfb451 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -212,10 +212,11 @@ struct map_session_data { unsigned int canact_tick; unsigned int canmove_tick; unsigned int canlog_tick; + unsigned int canregen_tick; int hp_sub,sp_sub; int inchealhptick,inchealsptick,inchealspirithptick,inchealspiritsptick; // -- moonsoul (new tick for berserk self-damage) - int berserkdamagetick; +// int berserkdamagetick; int fame; short view_class; @@ -481,8 +482,8 @@ enum { ATK_LUCKY=1,ATK_FLEE,ATK_DEF}; // struct map_data { char name[24]; - char *alias; // [MouseJstr] unsigned char *gat; // NULLなら下のmap_data_other_serverとして扱う + char *alias; // [MouseJstr] struct block_list **block; struct block_list **block_mob; int *block_count,*block_mob_count; diff --git a/src/map/pc.c b/src/map/pc.c index 7c5a8c077..9c6e777ca 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1559,15 +1559,18 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->paramb[5]+= 5; } if(sd->sc_data[SC_MARIONETTE].timer!=-1){ - sd->paramb[0]-= sd->status.str/2; // bonuses not included - sd->paramb[1]-= sd->status.agi/2; - sd->paramb[2]-= sd->status.vit/2; - sd->paramb[3]-= sd->status.int_/2; - sd->paramb[4]-= sd->status.dex/2; - sd->paramb[5]-= sd->status.luk/2; + struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3); + if (psd) { // if partner is found + sd->paramb[0]-= sd->status.str/2; // bonuses not included + sd->paramb[1]-= sd->status.agi/2; + sd->paramb[2]-= sd->status.vit/2; + sd->paramb[3]-= sd->status.int_/2; + sd->paramb[4]-= sd->status.dex/2; + sd->paramb[5]-= sd->status.luk/2; + } } else if(sd->sc_data[SC_MARIONETTE2].timer!=-1){ - struct map_session_data *psd = (struct map_session_data *)map_id2bl(sd->sc_data[SC_MARIONETTE2].val3); + struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3); if (psd) { // if partner is found sd->paramb[0] += sd->status.str+psd->status.str/2 > 99 ? 99-sd->status.str : psd->status.str/2; sd->paramb[1] += sd->status.agi+psd->status.agi/2 > 99 ? 99-sd->status.agi : psd->status.agi/2; @@ -4080,6 +4083,7 @@ static int pc_walk(int tid,unsigned int tick,int id,int data) sd->bl.y = y; if(moveblock) map_addblock(&sd->bl); + #if 0 if (sd->status.guild_id > 0) { struct skill_unit *su; if (sd->sc_data[SC_LEADERSHIP].val4 && (su=(struct skill_unit *)sd->sc_data[SC_LEADERSHIP].val4)) { @@ -4095,6 +4099,7 @@ static int pc_walk(int tid,unsigned int tick,int id,int data) skill_unit_move_unit_group(su->group,sd->bl.m,dx,dy); } } + #endif map_foreachinmovearea(clif_pcinsight,sd->bl.m,x-AREA_SIZE,y-AREA_SIZE,x+AREA_SIZE,y+AREA_SIZE,-dx,-dy,0,sd); sd->walktimer = -1; @@ -4200,6 +4205,22 @@ int pc_walktoxy(struct map_session_data *sd,int x,int y) pc_walktoxy_sub(sd); } + if (sd->sc_data && sd->status.guild_id > 0) { + struct skill_unit *su; + if (sd->sc_data[SC_LEADERSHIP].val4 && (su=(struct skill_unit *)sd->sc_data[SC_LEADERSHIP].val4)) { + skill_unit_move_unit_group(su->group,sd->bl.m,(x - sd->bl.x),(y - sd->bl.y)); + } + if (sd->sc_data[SC_GLORYWOUNDS].val4 && (su=(struct skill_unit *)sd->sc_data[SC_GLORYWOUNDS].val4)) { + skill_unit_move_unit_group(su->group,sd->bl.m,(x - sd->bl.x),(y - sd->bl.y)); + } + if (sd->sc_data[SC_SOULCOLD].val4 && (su=(struct skill_unit *)sd->sc_data[SC_SOULCOLD].val4)) { + skill_unit_move_unit_group(su->group,sd->bl.m,(x - sd->bl.x),(y - sd->bl.y)); + } + if (sd->sc_data[SC_HAWKEYES].val4 && (su=(struct skill_unit *)sd->sc_data[SC_HAWKEYES].val4)) { + skill_unit_move_unit_group(su->group,sd->bl.m,(x - sd->bl.x),(y - sd->bl.y)); + } + } + return 0; } @@ -7450,13 +7471,16 @@ static int pc_natural_heal_sub(struct map_session_data *sd,va_list ap) { if ((battle_config.natural_heal_weight_rate > 100 || sd->weight*100/sd->max_weight < battle_config.natural_heal_weight_rate) && !pc_isdead(sd) && !pc_ishiding(sd) && - !(sd->sc_data[SC_POISON].timer != -1 && sd->sc_data[SC_SLOWPOISON].timer == -1) && - sd->sc_data[SC_BERSERK].timer == -1 ) { + //-- cannot regen for 5 minutes after using Berserk --- [Celest] + DIFF_TICK (gettick(), sd->canregen_tick)>=0 && + (sd->sc_data && !(sd->sc_data[SC_POISON].timer != -1 && sd->sc_data[SC_SLOWPOISON].timer == -1) && + sd->sc_data[SC_BERSERK].timer == -1 )) { pc_natural_heal_hp(sd); if( sd->sc_data && sd->sc_data[SC_EXTREMITYFIST].timer == -1 && //阿修羅?態ではSPが回復しない sd->sc_data[SC_DANCING].timer == -1 && //ダンス?態ではSPが回復しない sd->sc_data[SC_BERSERK].timer == -1 ) //バ?サ?ク?態ではSPが回復しない pc_natural_heal_sp(sd); + sd->canregen_tick = gettick(); } else { sd->hp_sub = sd->inchealhptick = 0; sd->sp_sub = sd->inchealsptick = 0; diff --git a/src/map/skill.c b/src/map/skill.c index 3a0d02c8d..cb4b37fad 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1,4 +1,4 @@ -// $Id: skill.c,v 1.8 2004/12/13 7:22:51 PM Celestia $ +// $Id: skill.c,v 1.8 2004/12/15 8:56:46 PM Celestia $ /* スキル?係 */ #include @@ -3579,14 +3579,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int struct status_change *tsc_data = battle_get_sc_data(bl); int sc=SkillStatusChangeTable[skillid]; clif_skill_nodamage(src,bl,skillid,-1,1); - if( tsc_data ){ - if( tsc_data[sc].timer==-1 ) - /* 付加する */ - skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); - else + if(tsc_data && tsc_data[sc].timer!=-1 ) /* 解除する */ skill_status_change_end(bl, sc, -1); - } + else + /* 付加する */ + skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); } break; @@ -3595,14 +3593,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int struct status_change *tsc_data = battle_get_sc_data(bl); int sc=SkillStatusChangeTable[skillid]; clif_skill_nodamage(src,bl,skillid,skilllv,1); - if( tsc_data ){ - if( tsc_data[sc].timer==-1 ) - /* 付加する */ - skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); - else + if(tsc_data && tsc_data[sc].timer!=-1 ) /* 解除する */ skill_status_change_end(bl, sc, -1); - } + else + /* 付加する */ + skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); //skill_check_cloaking(bl); } break; @@ -3612,14 +3608,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int struct status_change *tsc_data = battle_get_sc_data(bl); int sc=SkillStatusChangeTable[skillid]; clif_skill_nodamage(src,bl,skillid,-1,1); - if( tsc_data ){ - if( tsc_data[sc].timer==-1 ) - /* 付加する */ - skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); - else - /* 解除する */ - skill_status_change_end(bl, sc, -1); - } + if(tsc_data && tsc_data[sc].timer!=-1 ) + /* 解除する */ + skill_status_change_end(bl, sc, -1); + else + /* 付加する */ + skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); } break; @@ -5060,7 +5054,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil mx = x;// + (rand()%10 - 5); my = y;// + (rand()%10 - 5); - id=mob_once_spawn(sd,"this",mx,my,"--ja--", summons[skilllv] ,1,""); + id=mob_once_spawn(sd,"this",mx,my,"--ja--", summons[skilllv-1] ,1,""); if( (md=(struct mob_data *)map_id2bl(id)) !=NULL ){ md->master_id=sd->bl.id; md->hp=2210+skilllv*200; @@ -5359,6 +5353,8 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, case HT_SANDMAN: /* サンドマン */ case HT_CLAYMORETRAP: /* クレイモア?トラップ */ limit=skill_get_time(skillid,skilllv); + // longer trap times in WOE [celest] + if (map[src->m].flag.gvg) limit *= 4; range=2; break; case HT_SKIDTRAP: /* スキッドトラップ */ @@ -5369,6 +5365,9 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, case HT_FREEZINGTRAP: /* フリ?ジングトラップ */ case HT_BLASTMINE: /* ブラストマイン */ limit=skill_get_time(skillid,skilllv); + // longer trap times in WOE [celest] + if (skillid != PF_SPIDERWEB && map[src->m].flag.gvg) + limit *= 4; range=1; break; @@ -7115,7 +7114,7 @@ int skill_check_condition(struct map_session_data *sd,int type) int c=0; int summons[5] = { 1020, 1068, 1118, 1500, 1368 }; int maxcount = (skill==AM_CANNIBALIZE)? 6-lv : skill_get_maxcount(skill); - int mob_class = (skill==AM_CANNIBALIZE)? summons[lv] :1142; + int mob_class = (skill==AM_CANNIBALIZE)? summons[lv-1] :1142; if(battle_config.pc_land_skill_limit && maxcount>0) { map_foreachinarea(skill_check_condition_mob_master_sub ,sd->bl.m, 0, 0, map[sd->bl.m].xs, map[sd->bl.m].ys, BL_MOB, sd->bl.id, mob_class,&c ); if(c >= maxcount){ @@ -8670,7 +8669,7 @@ int skill_status_change_end(struct block_list* bl, int type, int tid) break; case SC_BERSERK: /* バ?サ?ク */ calc_flag = 1; - clif_status_change(bl,SC_INCREASEAGI,0); /* アイコン消去 */ + clif_status_change(bl,SC_INCREASEAGI,0); /* アイコン消去 */ break; case SC_DEVOTION: /* ディボ?ション */ { @@ -9292,6 +9291,21 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) return 0; } break; + + case SC_MARIONETTE: /* マリオネットコントロ?ル */ + case SC_MARIONETTE2: + { + struct block_list *pbl = map_id2bl(sc_data[type].val3); + if (pbl && battle_check_range(bl, pbl, 7) && + (sc_data[type].val2 -= 1000)>0) { + sc_data[type].timer = add_timer( + 1000 + tick, skill_status_change_timer, + bl->id, data); + return 0; + } + } + break; + case SC_LEADERSHIP: case SC_GLORYWOUNDS: case SC_SOULCOLD: @@ -10038,10 +10052,11 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val case SC_BERSERK: /* バ?サ?ク */ if(sd){ sd->status.hp = sd->status.max_hp * 3; - sd->status.sp = 0; + sd->status.sp = 0; clif_updatestatus(sd,SP_HP); clif_updatestatus(sd,SP_SP); - clif_status_change(bl,SC_INCREASEAGI,1); /* アイコン表示 */ + clif_status_change(bl,SC_INCREASEAGI,1); /* アイコン表示 */ + sd->canregen_tick = gettick() + 300000; } *opt3 |= 128; tick = 10000; @@ -10060,6 +10075,10 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val case SC_MARIONETTE: /* マリオネットコントロ?ル */ case SC_MARIONETTE2: + val2 = tick; + if (!val3) + return 0; + tick = 1000; calc_flag = 1; *opt3 |= 1024; break; -- cgit v1.2.3-70-g09d2 From 9b6b0a2b79ad09a1d81cc1929167cbcf4d5e36de Mon Sep 17 00:00:00 2001 From: celest Date: Thu, 16 Dec 2004 10:50:03 +0000 Subject: * Corrected Extremity Fist * Added weapon skills rely on attack speed as cast delays * Fixed mob_ghostring_fix not working git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@583 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 6 ++++++ conf-tmpl/battle_athena.conf | 2 +- src/map/battle.c | 16 ++++++++-------- src/map/skill.c | 10 +++++++++- 4 files changed, 24 insertions(+), 10 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index d3a4ae2b5..478ff0d98 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,11 @@ Date Added 12/16 + * Corrected Extremity Fist to not require Explosion Spirits when being used + right after using Combo Finish or Dilemma [celest] + * Added instant cast weapon skills rely on attack speed as cast delays, not + on dex [celest] + * Fixed mob_ghostring_fix not working [celest] + * Changed default value for mob_ghostring_fix to 'yes' [celest] * Added #itemlist, removed @charitemlist [MC Cameri] * Changed @job and #job so that when it's used it unequips all the items, to prevent sprite errors [MC Cameri] * Fixed a misuse of mysql_config (thanks Daegalus for diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 6b0381074..f0ae5e9b1 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -560,7 +560,7 @@ pc_attack_attr_none: no mob_attack_attr_none: no // mob attacks againsts players wearing ghostring armor do full damage -mob_ghostring_fix: no +mob_ghostring_fix: yes // Does the Golden Thief Bug card only work during pvp? // no or 0 - gtb works all the time diff --git a/src/map/battle.c b/src/map/battle.c index 34c9d5ebb..494b7a323 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -2717,11 +2717,11 @@ static struct Damage battle_calc_mob_weapon_attack( if(damage < 0) damage = 0; // 属 性の適用 - if (!((battle_config.mob_ghostring_fix == 1) && - (battle_get_element(target) == 8) && - (target->type==BL_PC))) // [MouseJstr] - if(skill_num != 0 || s_ele != 0 || !battle_config.mob_attack_attr_none) - damage=battle_attr_fix(damage, s_ele, battle_get_element(target) ); + if (!((battle_config.mob_ghostring_fix == 1) && + (battle_get_elem_type(target) == 8) && + (target->type==BL_PC))) // [MouseJstr] + if(skill_num != 0 || s_ele != 0 || !battle_config.mob_attack_attr_none) + damage=battle_attr_fix(damage, s_ele, battle_get_element(target) ); //if(sc_data && sc_data[SC_AURABLADE].timer!=-1) /* オーラブレード 必中 */ // damage += sc_data[SC_AURABLADE].val1 * 10; @@ -5394,9 +5394,9 @@ void battle_set_defaults() { battle_config.pc_cloak_check_type = 0; battle_config.monster_cloak_check_type = 0; battle_config.gvg_short_damage_rate = 100; - battle_config.gvg_long_damage_rate = 100; - battle_config.gvg_magic_damage_rate = 100; - battle_config.gvg_misc_damage_rate = 100; + battle_config.gvg_long_damage_rate = 60; + battle_config.gvg_magic_damage_rate = 50; + battle_config.gvg_misc_damage_rate = 60; battle_config.gvg_eliminate_time = 7000; battle_config.mob_changetarget_byskill = 0; battle_config.pc_attack_direction_change = 1; diff --git a/src/map/skill.c b/src/map/skill.c index 740caf777..2cba675c2 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1,4 +1,4 @@ -// $Id: skill.c,v 1.8 2004/12/15 8:56:46 PM Celestia $ +// $Id: skill.c,v 1.8 2004/12/16 6:46:08 PM Celestia $ /* スキル?係 */ #include @@ -7259,6 +7259,9 @@ int skill_check_condition(struct map_session_data *sd,int type) } break; case ST_EXPLOSIONSPIRITS: + if (skill == MO_EXTREMITYFIST && ((sd->sc_data[SC_COMBO].timer != -1 && (sd->sc_data[SC_COMBO].val1 == MO_COMBOFINISH || sd->sc_data[SC_COMBO].val1 == CH_CHAINCRUSH)) || sd->sc_data[SC_BLADESTOP].timer!=-1)) { + break; + } if(sd->sc_data[SC_EXPLOSIONSPIRITS].timer == -1) { clif_skill_fail(sd,skill,0,0); return 0; @@ -7730,6 +7733,11 @@ int skill_use_id( struct map_session_data *sd, int target_id, skill_status_change_end(&sd->bl, SC_MEMORIZE, -1); } + // instant cast attack skills depend on aspd as delay [celest] + if (casttime == 0 && delay == 0 && skill_db[skill_num].skill_type == BF_WEAPON) { + delay = battle_get_adelay (&sd->bl) * battle_config.delay_rate / 100; + } + if(battle_config.pc_skill_log) printf("PC %d skill use target_id=%d skill=%d lv=%d cast=%d\n",sd->bl.id,target_id,skill_num,skill_lv,casttime); -- cgit v1.2.3-70-g09d2 From 5a00db39c2eaf410292ae86d8b4f356ffa81e5dd Mon Sep 17 00:00:00 2001 From: amber Date: Fri, 17 Dec 2004 04:42:48 +0000 Subject: more updates git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@590 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 3 +++ Makefile | 1 + conf-tmpl/battle_athena.conf | 3 ++- src/map/atcommand.c | 42 +++++++++++++++++++++++++++++++++++++++++- src/map/atcommand.h | 1 + src/map/pc.c | 2 +- 6 files changed, 49 insertions(+), 3 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 0c8782821..893d11747 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,8 @@ Date Added 12/17 + * Fixed skill #301 causing crashes [MouseJstr] + * Fixed documentation error on gm_skills_unconditionl [MouseJstr] + * added @grind test command.. only for testing [MouseJstr] * Added clearweather to the atcommand configuration file. [nsstrunks] 12/16 * Added a fix for AFM loading, thanks to Pete [celest] diff --git a/Makefile b/Makefile index e6b79229e..0cd7f2c31 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ # $Id: Makefile 158 2004-10-01 03:45:15Z PoW $ +# CC = /usr/local/bin/gcc -fbounds-checking -pipe CC = gcc -pipe PACKETDEF = -DPACKETVER=6 -DNEW_006b -DSO_REUSEPORT #PACKETDEF = -DPACKETVER=5 -DNEW_006b diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index f0ae5e9b1..74672d35d 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -208,7 +208,8 @@ gm_all_skill_add_abra: no // [GM] Can equip anything? (No or minimum GM level, can cause client errors.) gm_all_equipment: no -// [GM] Raise skills unconditionally, that is, put points in to a skill not in thier jobs skill tree? (no or minimum gm level) +// [GM] Can use skills without meeting the required conditions (no +// blue gems? no problem gm_skill_unconditional: no // Can a normal player by-pass the skill tree? (Note 1) diff --git a/src/map/atcommand.c b/src/map/atcommand.c index aea1f145b..d1f645d9c 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -233,6 +233,8 @@ ACMD_FUNC(marry); // by MouseJstr ACMD_FUNC(divorce); // by MouseJstr ACMD_FUNC(rings); // by MouseJstr +ACMD_FUNC(grind); // by MouseJstr + /*========================================== *AtCommandInfo atcommand_info[]構造体の定義 *------------------------------------------ @@ -483,6 +485,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Marry, "@marry", 40, atcommand_marry }, // [MouseJstr] { AtCommand_Divorce, "@divorce", 40, atcommand_divorce }, // [MouseJstr] { AtCommand_Rings, "@rings", 40, atcommand_rings }, // [MouseJstr] + { AtCommand_Grind, "@grind", 40, atcommand_grind }, // [MouseJstr] // add new commands before this line { AtCommand_Unknown, NULL, 1, NULL } @@ -2160,7 +2163,6 @@ int atcommand_alive( return 0; } return -1; - } /*========================================== @@ -7494,6 +7496,44 @@ atcommand_rings(const int fd, struct map_session_data* sd, return 0; } +/*========================================== + * @grind by [MouseJstr] + *------------------------------------------ + */ +int +atcommand_grind(const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct map_session_data *pl_sd = NULL; + int skillnum; + int inf; + char target[255]; + nullpo_retr(-1, sd); + + if (!message || !*message) + return -1; + if(sscanf(message, "%s", target) != 1) { + clif_displaymessage(fd, "Usage: @grind "); + return -1; + } + if((pl_sd=map_nick2sd(target)) == NULL) + return -1; + + for (skillnum = 1; skillnum < 500; skillnum++) { + sd->status.sp = sd->status.max_sp; + atcommand_alive(fd, sd, command, message); + + inf = skill_get_inf(skillnum); + + if ((inf == 2) || (inf == 1)) + skill_use_pos(sd, pl_sd->bl.x+5, pl_sd->bl.y+5, skillnum, 1); + else + skill_use_id(sd, pl_sd->bl.id, skillnum, 1); + } + + return 0; +} + /*========================================== * It is made to rain. *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index d3fa22a07..96838b7ae 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -216,6 +216,7 @@ enum AtCommandType { AtCommand_Marry, // by MouseJstr AtCommand_Divorce, // by MouseJstr AtCommand_Rings, // by MouseJstr + AtCommand_Grind, // by MouseJstr // end AtCommand_Unknown, diff --git a/src/map/pc.c b/src/map/pc.c index d975deaf5..3c37f7ce1 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5408,7 +5408,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) if (sd->sc_data) { if (sd->sc_data[SC_ENDURE].timer == -1 && sd->sc_data[SC_BERSERK].timer == -1 && !sd->special_state.infinite_endure) pc_stop_walking(sd,3); - else if(sd->sc_data[SC_ENDURE].timer != -1 && src->type==BL_MOB && (--sd->sc_data[SC_ENDURE].val2) <= 0) + else if(sd->sc_data[SC_ENDURE].timer != -1 && (src != NULL && src->type==BL_MOB) && (--sd->sc_data[SC_ENDURE].val2) <= 0) skill_status_change_end(&sd->bl, SC_ENDURE, -1); } else pc_stop_walking(sd,3); -- cgit v1.2.3-70-g09d2 From aab0d866949ff34a86096d3da93134b79accd245 Mon Sep 17 00:00:00 2001 From: ajarn Date: Mon, 20 Dec 2004 21:10:11 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@687 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 1 + conf-tmpl/battle_athena.conf | 4 ++-- conf-tmpl/char_athena.conf | 5 +---- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 9d8c041b3..ce1eecf50 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,7 @@ Date Added 12/20 + * Moddified some *_athena.conf's (my typos and some inncorect default values) [Ajarn] * Added Valaris' double connection bug fix (imalive watchdog) [Valaris] * Fixed map-server exiting when it came across a bad NPC file [Codemaster] * Updated Valaris' large/tiny monsters - of course, he told us what he did wrong and how to fix it :) [Codemaster & Valaris] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 74672d35d..681a42063 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -154,7 +154,7 @@ base_exp_rate: 100 job_exp_rate: 100 // PVP exp. Do players get exp during pvp -pvp_exp: yes +pvp_exp: no // When a player dies, how should we penalize them? // 0 = No penalty. @@ -216,7 +216,7 @@ gm_skill_unconditional: no player_skillfree: no // When doing a skill reset, whether the skill's restriction is to be ignored or not. (Note 1) -player_skillup_limit: yes +player_skillup_limit: no // Forging success rate. (Note 2) weapon_produce_rate: 100 diff --git a/conf-tmpl/char_athena.conf b/conf-tmpl/char_athena.conf index 93769c144..d50862e6b 100644 --- a/conf-tmpl/char_athena.conf +++ b/conf-tmpl/char_athena.conf @@ -161,13 +161,10 @@ anti_freeze_enable: 0 // Anti-freeze system interval (in seconds) anti_freeze_interval: 6 -// If you want use an additional configuration file, uncomment and use this parameter -//import: path/additional_configuration_file - // Mugendai's GUI Support imalive_on: 0 imalive_time: 30 flush_on: 0 flush_time: 30 -import: conf/import/char_conf.txt \ No newline at end of file +import: conf/import/char_conf.txt -- cgit v1.2.3-70-g09d2 From 99ebdaf8e77e81e43d39825163837d6f4b2bc07a Mon Sep 17 00:00:00 2001 From: celest Date: Tue, 21 Dec 2004 12:27:02 +0000 Subject: * Updated most of map-server to 1082 * Removed my own additions for skill delays using aspd * Adapted skill_range_leniency to jA's code * Fixed drop rates only limited to multiples of 100's * Added missing code for castle_defense_rate * Removed pc_undead_nofreeze * Updated unrefineable items table * Added 3 new script commands * Added SC_SpeedUp0 * Merged itemdb_read for SQL and TXT * Removed itemdb_read_cardillustnametable limited to TXT only * Added reading itemslotcounttable.txt from the GRF to auto set number of slots per item * Added a display message when reading itemslottable from the GRF * Added options in battle_athena.conf to enable/disable reading the GRF git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@699 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 25 ++++ conf-tmpl/battle_athena.conf | 60 +++++++++ db/Changelog.txt | 2 + db/const.txt | 1 + db/create_arrow_db.txt | 28 ++--- db/item_db.txt | 16 ++- src/map/battle.c | 242 ++++++++++++++++++++++++------------ src/map/battle.h | 14 ++- src/map/clif.c | 42 +++++++ src/map/clif.h | 1 + src/map/guild.c | 13 +- src/map/itemdb.c | 188 ++++++++++++++++------------ src/map/map.h | 16 ++- src/map/mob.c | 58 +++++++-- src/map/npc.c | 3 +- src/map/pc.c | 123 ++++++++++++++++++- src/map/pc.h | 3 +- src/map/script.c | 64 +++++++++- src/map/skill.c | 286 ++++++++++++++++++++++--------------------- src/map/skill.h | 19 +-- 20 files changed, 864 insertions(+), 340 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index e0723fd9b..c9ff6f667 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,30 @@ Date Added 12/21 + * Finished updating most of the map-server to 1082... i'll leave the more + technical ones for the other devs ^^; [celest] + * Added other new battle_athena options from jA 1082 ... descriptions not + translated yet [celest] + * Removed my own additions for skill delays using aspd and added jA's code [celest] + * Adapted skill_range_leniency to jA's code - should be more stable [celest] + * Fixed drop rates only limited to multiples of 100's - thanks to jathena + for pointing it out [celest] + * Added missing code for castle_defense_rate [celest] + * Removed pc_undead_nofreeze - no code for it [celest] + * Updated unrefineable items table - thanks to jathena [celest] + * Added 3 new script commands: [celest] + - skilleffect : shows a skill effect on the player + - doskill/skilluseid (originally by Qamera) : casts a skill on the player + - skillusepos : casts a skill on a position + * Added SC_SpeedUp0 [celest] + * Merged itemdb_read for SQL and TXT [celest] + * Moved itemdb_read_itemslottable in itemdb.c for better readability [celest] + * Removed itemdb_read_cardillustnametable limited to TXT only [celest] + * Added reading itemslotcounttable.txt from the GRF to auto set number of slots + per item [celest] + * Added a display message when reading itemslottable from the GRF [celest] + * Added options in battle_athena.conf to enable/disable reading the GRF for + indoorrswtable.txt, leveluseskillspamount.txt, num2cardillustnametable.txt, + itemslottable.txt & itemslotcounttable.txt [celest] * Removed conf/npcs_list.txt, and placed it in npc/npcs_athena.conf 12/20 diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 681a42063..b317575cc 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -349,8 +349,27 @@ natural_heal_skill_interval: 10000 // The maximum weight for a character to carry when the character stops healing naturally. (in %) natural_heal_weight_rate: 50 +// You can turn the following 5 settings off if you don't need them, +// or if you're experiencing problems with GRF loading +// // Override item names from GRF file? (Note 1) item_name_override_grffile: yes +// +// Override item equip positions from GRF file? (Note 1) +item_equip_override_grffile: yes +// +// Override item slots from GRF file? (Note 1) +item_slots_override_grffile: yes +// +// Override 'indoors' mapflags from GRF file? (Note 1) +indoors_override_grffile: yes +// +// Override SP used per level from GRF file? (Note 1) +// Turn this off if you have a customised skill_require_db.txt +skill_sp_override_grffile: yes +// +// Read card illustrations from GRF file? (Note 1) +cardillust_read_grffile: yes // Are arrows are consumed when used on a bow? (Note 1) arrow_decrement: yes @@ -470,6 +489,9 @@ player_cloak_check_type: yes // When a monster is cloaking, Whether the wall is checked or not. (Note 1) monster_cloak_check_type: no +// Damage adjustments for WOE battles against defending Guild monsters (Note 2) +castle_defense_rate: 100 + // Melee damage adjustments for WoE battles (Guild Vs Guild) (Note 2) gvg_short_attack_damage_rate: 100 @@ -755,5 +777,43 @@ skill_range_leniency: 1 // Set this to 1 if your clients have langtype problems and can't display motd properly motd_type: 0 +// キャラのHP?率を設定。(100で正規の値) +hp_rate: 100 + +// キャラのSP?率を設定。(100で正規の値) +sp_rate: 100 + +//GMの行動制限 アイテ?ドロップ・倉庫出し入れ・ItemZeny交換 +gm_can_drop_lv: 0 + +//全キャラがGMにHPメ???を常に送信するか +disp_hpmeter: no + +//PC?亡時に、ドクロをドロップするか +//0:しない 1:PvP?ップのみ 2:いつでも +bone_drop: 0 + +//敵のアイテ?ドロップ率をレ?トごとに個別?率をかけるかどうか +//details = 0:個別設定なし(デフォルト) 1:それぞれ?率指定(百分率) ?detailsが0以外の場合、以前のドロップ?率は無視されます +// 2:それぞれ?率指定(百分率)、ドロップ率上限と下限を設定?ドロップ設定0は無視します +//例 details = 3 rate_1 = 1000 min = 20 ドロップ率1/10000?9/10000の物を10?に指定 10?しても20/10000未満の物は 20/10000に固定 +item_rate_details: 0 +//ドロップ設定1?9 +item_rate_1: 100 +item_rate_1_min: 1 +item_rate_1_max: 9 +//ドロップ設定10?99 +item_rate_10: 100 +item_rate_10_min: 10 +item_rate_10_max: 99 +//ドロップ設定100?999 +item_rate_100: 100 +item_rate_100_min: 100 +item_rate_100_max: 999 +//ドロップ設定1000?10000 +item_rate_1000: 100 +item_rate_1000_min: 1000 +item_rate_1000_max: 10000 + import: conf/import/battle_conf.txt diff --git a/db/Changelog.txt b/db/Changelog.txt index de74e9062..f672ece44 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -5,6 +5,8 @@ Ayathoya items == Added but no effect ( all are "ect" itens) Skill databases == celest working on them i believe. +12/21 + * Added the new Quivers, updated Horse Crest [celest] 12/20 * removed extra {},,,,,,, from each tailing [Lupus] * Corrected job requirements for some garments [celest] diff --git a/db/const.txt b/db/const.txt index 867bb4c12..bac7cc4fe 100644 --- a/db/const.txt +++ b/db/const.txt @@ -253,6 +253,7 @@ SC_SpeedPot0 37 SC_SpeedPot1 38 SC_SpeedPot2 39 SC_SpeedPot3 40 +SC_SpeedUp0 41 SC_ATKPot 185 SC_MATKPot 186 SC_EncPoison 6 diff --git a/db/create_arrow_db.txt b/db/create_arrow_db.txt index f5bd1077f..56cad90fc 100644 --- a/db/create_arrow_db.txt +++ b/db/create_arrow_db.txt @@ -5,9 +5,9 @@ 609,1761,40 713,1770,2 714,1757,600,1769,600,1765,600 -715,1756,10,1768,1 +715,1756,100,1768,1 716,1762,10,1763,1,1761,1 -717,1754,10,1759,1 +717,1754,100,1759,1 724,1761,50,1768,10 733,1764,50 756,1765,50 @@ -34,14 +34,14 @@ 969,1760,50,1765,50 984,1765,250 985,1753,1000,1758,50 -990,1752,200 -991,1754,50 -992,1755,50 -993,1756,50 -994,1752,600,1769,5 -995,1754,150,1759,5 -996,1755,150,1768,5 -997,1756,150,1760,5 +990,1752,2000 +991,1754,500 +992,1755,500 +993,1756,500 +994,1752,6000,1769,5 +995,1754,1500,1759,5 +996,1755,1500,1768,5 +997,1756,1500,1760,5 998,1770,100 999,1753,100 1000,1760,30 @@ -78,8 +78,8 @@ 2332,1751,700 2333,1751,1000,1757,10 2408,1770,700,1753,50 -2618,1755,50,1753,100,1764,10 -5014,1754,200,1753,200 +2618,1755,500,1753,100,1764,10 +5014,1754,2000,1753,200 7002,1753,30,1762,5 7008,1758,2 7010,1753,250,1763,1 @@ -93,7 +93,7 @@ 7025,1758,800,1769,400,1768,800 7026,1765,50 7027,1767,100 -7035,1752,1000 -7036,1754,100 +7035,1752,10000 +7036,1754,1000 7053,1751,40 diff --git a/db/item_db.txt b/db/item_db.txt index d4d6ecb21..50eef652f 100644 --- a/db/item_db.txt +++ b/db/item_db.txt @@ -134,7 +134,7 @@ 661,Sky_Apron,Soft Apron,2,20,0,50,,,,,10477567,2,,,,,{ pet 1275; },{} // Newer Items -662,Horse_Crest,Crest of the Horse,2,0,0,30,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 29,5,"Increase Agility Level 5"; },{} +662,Horse_Crest,Crest of the Horse,2,0,0,30,0,0,0,0,10477567,2,0,0,0,0,{ skilleffect 29,5; sc_start SC_SpeedUp0,240000,0; },{} 664,Gift_Box_,Gift Box,2,20,0,200,,,,,10477567,2,,,,,{ getitem -4,1; },{}, 665,Gift_Box__,Gift Box,2,20,0,200,,,,,10477567,2,,,,,{ getitem -4,1; },{}, 666,Gift_Box___,Gift Box,2,20,0,200,,,,,10477567,2,,,,,{ getitem -4,1; },{}, @@ -1721,3 +1721,17 @@ 12001,Heal_3,Heal Level 3,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 28,3,"Heal Level 3"; },{} 12002,Heal_5,Heal Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 28,5,"Heal Level 5"; },{} 12003,Teleport_1,Teleport Level 1,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 26,1,"Teleport Level 1"; },{} + +// Arrow Quivers +12004,Arrow_Quiver,Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1750,500; },{} +12005,Iron_Arrow_Quiver,Iron Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1770,500; },{} +12006,Steel_Arrow_Quiver,Steel Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1753,500; },{} +12007,Oridecon_Arrow_Quiver,Oridecon Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1765,500; },{} +12008,Fire_Arrow_Quiver,Fire Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1752,500; },{} +12009,Silver_Arrow_Quiver,Silver Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1751,500; },{} +12010,Arrow_of_Wind_Quiver,Arrow of Wind Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1755,500; },{} +12011,Stone_Arrow_Quiver,Stone Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1756,500; },{} +12012,Crystal_Arrow_Quiver,Crystal Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1754,500; },{} +12013,Shadow_Arrow_Quiver,Shadow Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1767,500; },{} +12014,Immaterial_Arrow_Quiver,Immaterial Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1757,500; },{} +12015,Rusty_Arrow_Quiver,Rusty Arrow Quiver,2,,,250,,,,,10477567,2,,,,,{ getitem 1762,500; },{} diff --git a/src/map/battle.c b/src/map/battle.c index ba8d22197..22ad51609 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -544,9 +544,10 @@ int battle_get_baseatk(struct block_list *bl) nullpo_retr(1, bl); sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) + if(bl->type==BL_PC && (struct map_session_data *)bl) { batk = ((struct map_session_data *)bl)->base_atk; //設定されているbase_atk - else { //それ以外なら + batk += ((struct map_session_data *)bl)->weapon_atk[((struct map_session_data *)bl)->status.weapon]; + } else { //それ以外なら int str,dstr; str = battle_get_str(bl); //STR dstr = str/10; @@ -935,6 +936,8 @@ int battle_get_speed(struct block_list *bl) speed -= (speed*(sc_data[SC_WINDWALK].val1*2))/100; if(sc_data[SC_SLOWDOWN].timer!=-1) speed = speed*150/100; + if(sc_data[SC_SPEEDUP0].timer!=-1) + speed -= speed*25/100; } if(speed < 1) speed = 1; return speed; @@ -1647,12 +1650,16 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i else if(g && guild_checkskill(g,GD_APPROVAL) <= 0) damage=0;//正規ギルド承認がないとダメージ無し else if (battle_config.guild_max_castles != 0 && guild_checkcastles(g)>=battle_config.guild_max_castles) - damage = 0; // [MouseJstr] + damage = 0; // [MouseJstr] } else damage = 0; } if(map[bl->m].flag.gvg && damage > 0) { //GvG + if(bl->type == BL_MOB){ //defenseがあればダメージが減るらしい? + struct guild_castle *gc=guild_mapname2gc(map[bl->m].name); + if (gc) damage -= damage*(gc->defense/100)*(battle_config.castle_defense_rate/100); + } if(flag&BF_WEAPON) { if(flag&BF_SHORT) damage=damage*battle_config.gvg_short_damage_rate/100; @@ -1681,6 +1688,33 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i return damage; } +/*========================================== + * HP/SP吸収の計算 + *------------------------------------------ + */ +int battle_calc_drain(int damage, int rate, int per, int val) +{ + int diff = 0; + + if (damage <= 0 || rate <= 0) + return 0; + + if (per && rand()%100 < rate) { + diff = (damage * per) / 100; + if (diff == 0) { + if (per > 0) + diff = 1; + else + diff = -1; + } + } + + if (val && rand()%100 < rate) { + diff += val; + } + return diff; +} + /*========================================== * 修練ダメージ *------------------------------------------ @@ -1925,7 +1959,7 @@ static struct Damage battle_calc_pet_weapon_attack( hitrate = (hitrate*(100+5*skill_lv))/100; break; case SM_MAGNUM: // マグナムブレイク - damage = damage*(5*skill_lv +(wflag)?65:115 )/100; + damage = damage*(5*skill_lv + (wflag?65:115))/100; break; case MC_MAMMONITE: // メマーナイト damage = damage*(100+ 50*skill_lv)/100; @@ -2045,6 +2079,7 @@ static struct Damage battle_calc_pet_weapon_attack( hitrate= 1000000; break; case AM_DEMONSTRATION: // デモンストレーション + hitrate= 1000000; damage = damage*(100+ 20*skill_lv)/100; damage2 = damage2*(100+ 20*skill_lv)/100; break; @@ -2127,7 +2162,7 @@ static struct Damage battle_calc_pet_weapon_attack( if( skill_num!=NPC_CRITICALSLASH ){ // 対 象の防御力によるダメージの減少 // ディバインプロテクション(ここでいいのかな?) - if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && def1 < 1000000 ) { //DEF, VIT無視 + if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && skill_num != AM_ACIDTERROR && def1 < 1000000 ) { //DEF, VIT無視 int t_def; target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penalty_count_lv); if(battle_config.vit_penalty_type > 0) { @@ -2392,9 +2427,9 @@ static struct Damage battle_calc_mob_weapon_attack( // ソニックブロー if(sc_data){ //状態異常中のダメージ追加 if(sc_data[SC_OVERTHRUST].timer!=-1) // オーバートラスト - damage += damage*(5*sc_data[SC_OVERTHRUST].val1)/100; + damage += damage*(5*sc_data[SC_OVERTHRUST].val1)/100; if(sc_data[SC_TRUESIGHT].timer!=-1) // トゥルーサイト - damage += damage*(2*sc_data[SC_TRUESIGHT].val1)/100; + damage += damage*(2*sc_data[SC_TRUESIGHT].val1)/100; if(sc_data[SC_BERSERK].timer!=-1) // バーサーク damage += damage*2; if(sc_data && sc_data[SC_AURABLADE].timer!=-1) //[DracoRPG] @@ -2413,7 +2448,7 @@ static struct Damage battle_calc_mob_weapon_attack( hitrate = (hitrate*(100+5*skill_lv))/100; break; case SM_MAGNUM: // マグナムブレイク - damage = damage*(5*skill_lv +(wflag)?65:115 )/100; + damage = damage*(5*skill_lv +(wflag?65:115))/100; break; case MC_MAMMONITE: // メマーナイト damage = damage*(100+ 50*skill_lv)/100; @@ -2540,6 +2575,7 @@ static struct Damage battle_calc_mob_weapon_attack( hitrate= 1000000; break; case AM_DEMONSTRATION: // デモンストレーション + hitrate = 1000000; damage = damage*(100+ 20*skill_lv)/100; damage2 = damage2*(100+ 20*skill_lv)/100; break; @@ -2622,7 +2658,7 @@ static struct Damage battle_calc_mob_weapon_attack( if( skill_num!=NPC_CRITICALSLASH ){ // 対 象の防御力によるダメージの減少 // ディバインプロテクション(ここでいいのかな?) - if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && def1 < 1000000) { //DEF, VIT無視 + if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && skill_num != KN_AUTOCOUNTER && def1 < 1000000) { //DEF, VIT無視 int t_def; target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penalty_count_lv); if(battle_config.vit_penalty_type > 0) { @@ -2988,9 +3024,9 @@ static struct Damage battle_calc_pc_weapon_attack( { damage += atkmax; damage2 += atkmax_; - if(sd->atk_rate != 100) { - damage = (damage * sd->atk_rate)/100; - damage2 = (damage2 * sd->atk_rate)/100; + if(sd->atk_rate != 100 || sd->weapon_atk_rate != 0) { + damage = (damage * (sd->atk_rate + sd->weapon_atk_rate[sd->status.weapon]))/100; + damage2 = (damage2 * (sd->atk_rate + sd->weapon_atk_rate[sd->status.weapon]))/100; } if(sd->state.arrow_atk) damage += sd->arrow_atk; @@ -3038,9 +3074,9 @@ static struct Damage battle_calc_pc_weapon_attack( damage2 += atkmin_ + rand() % (atkmax_-atkmin_ + 1); else damage2 += atkmin_ ; - if(sd->atk_rate != 100) { - damage = (damage * sd->atk_rate)/100; - damage2 = (damage2 * sd->atk_rate)/100; + if(sd->atk_rate != 100 || sd->weapon_atk_rate != 0) { + damage = (damage * (sd->atk_rate + sd->weapon_atk_rate[sd->status.weapon]))/100; + damage2 = (damage2 * (sd->atk_rate + sd->weapon_atk_rate[sd->status.weapon]))/100; } if(sd->state.arrow_atk) { @@ -3119,8 +3155,8 @@ static struct Damage battle_calc_pc_weapon_attack( hitrate = (hitrate*(100+5*skill_lv))/100; break; case SM_MAGNUM: // マグナムブレイク - damage = damage*(5*skill_lv +(wflag)?65:115 )/100; - damage2 = damage2*(5*skill_lv +(wflag)?65:115 )/100; + damage = damage*(5*skill_lv +(wflag?65:115) )/100; + damage2 = damage2*(5*skill_lv +(wflag?65:115) )/100; break; case MC_MAMMONITE: // メマーナイト damage = damage*(100+ 50*skill_lv)/100; @@ -3327,11 +3363,15 @@ static struct Damage battle_calc_pc_weapon_attack( case AM_DEMONSTRATION: // デモンストレーション damage = damage*(100+ 20*skill_lv)/100; damage2 = damage2*(100+ 20*skill_lv)/100; + no_cardfix = 1; break; case AM_ACIDTERROR: // アシッドテラー hitrate = 1000000; damage = damage*(100+ 40*skill_lv)/100; damage2 = damage2*(100+ 40*skill_lv)/100; + s_ele = 0; + s_ele_ = 0; + no_cardfix = 1; break; case MO_FINGEROFFENSIVE: //指弾 if(battle_config.finger_offensive_type == 0) { @@ -3374,11 +3414,6 @@ static struct Damage battle_calc_pc_weapon_attack( damage2 = damage2*(240+ 60*skill_lv)/100; break; case BA_MUSICALSTRIKE: // ミュージカルストライク - if(!sd->state.arrow_atk && sd->arrow_atk > 0) { - int arr = rand()%(sd->arrow_atk+1); - damage += arr; - damage2 += arr; - } damage = damage*(60+ 40 * skill_lv)/100; damage2 = damage2*(60+ 40 * skill_lv)/100; if(sd->arrow_ele > 0) { @@ -3386,7 +3421,6 @@ static struct Damage battle_calc_pc_weapon_attack( s_ele_ = sd->arrow_ele; } flag=(flag&~BF_RANGEMASK)|BF_LONG; - sd->state.arrow_atk = 1; break; case DC_THROWARROW: // 矢撃ち if(!sd->state.arrow_atk && sd->arrow_atk > 0) { @@ -3443,11 +3477,6 @@ static struct Damage battle_calc_pc_weapon_attack( damage2 += damage2*(30*skill_lv)/100; break; case CG_ARROWVULCAN: /* アローバルカン */ - if(!sd->state.arrow_atk && sd->arrow_atk > 0) { - int arr = rand()%(sd->arrow_atk+1); - damage += arr; - damage2 += arr; - } damage = damage*(200+100*skill_lv)/100; damage2 = damage2*(200+100*skill_lv)/100; div_=9; @@ -3456,7 +3485,6 @@ static struct Damage battle_calc_pc_weapon_attack( s_ele_ = sd->arrow_ele; } flag=(flag&~BF_RANGEMASK)|BF_LONG; - sd->state.arrow_atk = 1; break; case AS_SPLASHER: /* ベナムスプラッシャー */ damage = damage*(200+20*skill_lv+20*pc_checkskill(sd,AS_POISONREACT))/100; @@ -3520,7 +3548,7 @@ static struct Damage battle_calc_pc_weapon_attack( if( skill_num!=NPC_CRITICALSLASH ){ // 対 象の防御力によるダメージの減少 // ディバインプロテクション(ここでいいのかな?) - if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && def1 < 1000000) { //DEF, VIT無視 + if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && skill_num != AM_ACIDTERROR && def1 < 1000000) { //DEF, VIT無視 int t_def; target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penalty_count_lv); if(battle_config.vit_penalty_type > 0) { @@ -3582,11 +3610,23 @@ static struct Damage battle_calc_pc_weapon_attack( // 状態異常中のダメージ追加でクリティカルにも有効なスキル if (sc_data) { // エンチャントデッドリーポイズン - if(sc_data[SC_EDP].timer != -1 && skill_num != ASC_BREAKER && skill_num != ASC_METEORASSAULT) { + if(!no_cardfix && sc_data[SC_EDP].timer != -1 && skill_num != ASC_BREAKER && skill_num != ASC_METEORASSAULT) { damage += damage * (150 + sc_data[SC_EDP].val1 * 50) / 100; - damage2 += damage2 * (150 + sc_data[SC_EDP].val1 * 50) / 100; no_cardfix = 1; } + if (!skill_num && !(t_mode&0x20) && sc_data[SC_SACRIFICE].timer != -1) { + int mhp = battle_get_max_hp(src); + int dmg = mhp * (5 + sc_data[SC_SACRIFICE].val1 * 5) / 1000; + pc_heal(sd, -dmg, 0); + damage = dmg * (90 + sc_data[SC_SACRIFICE].val1 * 15) / 100; + damage2 = 0; + hitrate = 1000000; + s_ele = 0; + s_ele_ = 0; + sc_data[SC_SACRIFICE].val2 --; + if (sc_data[SC_SACRIFICE].val2 == 0) + skill_status_change_end(src, SC_SACRIFICE,-1); + } } // 精錬ダメージの追加 @@ -4178,7 +4218,7 @@ struct Damage battle_calc_magic_attack( break; case WZ_STORMGUST: // ストームガスト MATK_FIX( skill_lv*40+100 ,100 ); - blewcount|=0x10000; +// blewcount|=0x10000; break; case AL_HOLYLIGHT: // ホーリーライト MATK_FIX( 125,100 ); @@ -4387,6 +4427,8 @@ struct Damage battle_calc_misc_attack( damage=(dex/10+int_/2+skill*3+40)*2; if(flag > 1) damage /= flag; + if(battle_get_mode(target) & 0x40) + damage = 1; break; case TF_THROWSTONE: // 石投げ @@ -4424,12 +4466,17 @@ struct Damage battle_calc_misc_attack( break; case SN_FALCONASSAULT: /* ファルコンアサルト */ #ifdef TWILIGHT - skill = pc_checkskill(sd,HT_BLITZBEAT); - damage=(100+50*skill_lv+(dex/10+int_/2+skill*3+40)*2) * 2; + if( sd==NULL || (skill = pc_checkskill(sd,HT_BLITZBEAT)) <= 0) + skill=0; #else - skill = pc_checkskill(sd,HT_STEELCROW); // Celest - damage=((150+50*skill_lv)*(dex/10+int_/2+skill*3+40)*2)/100; + if( sd==NULL || (skill = pc_checkskill(sd,HT_STEELCROW)) <= 0) + skill=0; + damage=((150+50*skill_lv)*(dex/10+int_/2+skill*3+40)*2)/100; // [Celest] #endif + if(flag > 1) + damage /= flag; + if(battle_get_mode(target) & 0x40) + damage = 1; break; } @@ -4706,29 +4753,25 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, if(!f) pc_heal(sd,0,-sp); } } - if(wd.flag&BF_WEAPON && src != target && (wd.damage > 0 || wd.damage2 > 0)) { + if (wd.flag&BF_WEAPON && src != target && (wd.damage > 0 || wd.damage2 > 0)) { int hp = 0,sp = 0; - if(sd->hp_drain_rate && sd->hp_drain_per > 0 && wd.damage > 0 && rand()%100 < sd->hp_drain_rate) { - hp += (wd.damage * sd->hp_drain_per)/100; - if(sd->hp_drain_rate > 0 && hp < 1) hp = 1; - else if(sd->hp_drain_rate < 0 && hp > -1) hp = -1; - } - if(sd->hp_drain_rate_ && sd->hp_drain_per_ > 0 && wd.damage2 > 0 && rand()%100 < sd->hp_drain_rate_) { - hp += (wd.damage2 * sd->hp_drain_per_)/100; - if(sd->hp_drain_rate_ > 0 && hp < 1) hp = 1; - else if(sd->hp_drain_rate_ < 0 && hp > -1) hp = -1; - } - if(sd->sp_drain_rate && sd->sp_drain_per > 0 && wd.damage > 0 && rand()%100 < sd->sp_drain_rate) { - sp += (wd.damage * sd->sp_drain_per)/100; - if(sd->sp_drain_rate > 0 && sp < 1) sp = 1; - else if(sd->sp_drain_rate < 0 && sp > -1) sp = -1; + if (!battle_config.left_cardfix_to_right) { // 二刀流左手カードの吸収系効果を右手に追加しない場合 + hp += battle_calc_drain(wd.damage, sd->hp_drain_rate, sd->hp_drain_per, sd->hp_drain_value); + hp += battle_calc_drain(wd.damage2, sd->hp_drain_rate_, sd->hp_drain_per_, sd->hp_drain_value_); + sp += battle_calc_drain(wd.damage, sd->sp_drain_rate, sd->sp_drain_per, sd->sp_drain_value); + sp += battle_calc_drain(wd.damage2, sd->sp_drain_rate_, sd->sp_drain_per_, sd->sp_drain_value_); + } else { // 二刀流左手カードの吸収系効果を右手に追加する場合 + int hp_drain_rate = sd->hp_drain_rate + sd->hp_drain_rate_; + int hp_drain_per = sd->hp_drain_per + sd->hp_drain_per_; + int hp_drain_value = sd->hp_drain_value + sd->hp_drain_value_; + int sp_drain_rate = sd->sp_drain_rate + sd->sp_drain_rate_; + int sp_drain_per = sd->sp_drain_per + sd->sp_drain_per_; + int sp_drain_value = sd->sp_drain_value + sd->sp_drain_value_; + hp += battle_calc_drain(wd.damage, hp_drain_rate, hp_drain_per, hp_drain_value); + sp += battle_calc_drain(wd.damage, sp_drain_rate, sp_drain_per, sp_drain_value); } - if(sd->sp_drain_rate_ && sd->sp_drain_per_ > 0 && wd.damage2 > 0 && rand()%100 < sd->sp_drain_rate_) { - sp += (wd.damage2 * sd->sp_drain_per_)/100; - if(sd->sp_drain_rate_ > 0 && sp < 1) sp = 1; - else if(sd->sp_drain_rate_ < 0 && sp > -1) sp = -1; - } - if(hp || sp) pc_heal(sd,hp,sp); + + if (hp || sp) pc_heal(sd, hp, sp); } } @@ -4753,13 +4796,12 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, skill_status_change_end(target,SC_POISONREACT,-1); } } - if(t_sc_data && t_sc_data[SC_BLADESTOP_WAIT].timer != -1){ - if (!(src->type == BL_MOB && mob_db[((struct mob_data *)src)->class].mode&0x20)) { - int lv = t_sc_data[SC_BLADESTOP_WAIT].val1; - skill_status_change_end(target,SC_BLADESTOP_WAIT,-1); - skill_status_change_start(src,SC_BLADESTOP,lv,1,(int)src,(int)target,skill_get_time2(MO_BLADESTOP,lv),0); - skill_status_change_start(target,SC_BLADESTOP,lv,2,(int)target,(int)src,skill_get_time2(MO_BLADESTOP,lv),0); - } + if (t_sc_data && t_sc_data[SC_BLADESTOP_WAIT].timer != -1 && + !(battle_get_mode(src)&0x20)) { // ボスには無効 + int lv = t_sc_data[SC_BLADESTOP_WAIT].val1; + skill_status_change_end(target,SC_BLADESTOP_WAIT,-1); + skill_status_change_start(src,SC_BLADESTOP,lv,1,(int)src,(int)target,skill_get_time2(MO_BLADESTOP,lv),0); + skill_status_change_start(target,SC_BLADESTOP,lv,2,(int)target,(int)src,skill_get_time2(MO_BLADESTOP,lv),0); } if(t_sc_data && t_sc_data[SC_SPLASHER].timer!=-1) //殴ったので対象のベナムスプラッシャー状態を解除 skill_status_change_end(target,SC_SPLASHER,-1); @@ -4989,17 +5031,8 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range) if(src->m != bl->m) // 違うマップ return 0; - if( range>0 && range < arange ) {// 遠すぎる -// be lenient if the skill was cast before we have moved to the correct position [Celest] - /* Celest: Hmm, bl isn't necessarily BL_PC... i think i'll test this more first >.< */ - /*if (src->type == BL_PC && bl->type == BL_PC) { - struct map_session_data *sd; - nullpo_retr(0, (sd=(struct map_session_data *)bl)); - if (sd->walktimer != -1 && !((arange-=battle_config.skill_range_leniency)<=range)) - return 0; - } - else*/ return 0; - } + if( range>0 && range < arange ) // 遠すぎる + return 0; if( arange<2 ) // 同じマスか隣接 return 1; @@ -5128,6 +5161,11 @@ static const struct { { "natural_heal_skill_interval", &battle_config.natural_heal_skill_interval}, { "natural_heal_weight_rate", &battle_config.natural_heal_weight_rate }, { "item_name_override_grffile", &battle_config.item_name_override_grffile}, + { "item_equip_override_grffile", &battle_config.item_equip_override_grffile}, // [Celest] + { "item_slots_override_grffile", &battle_config.item_slots_override_grffile}, // [Celest] + { "indoors_override_grffile", &battle_config.indoors_override_grffile}, // [Celest] + { "skill_sp_override_grffile", &battle_config.skill_sp_override_grffile}, // [Celest] + { "cardillust_read_grffile", &battle_config.cardillust_read_grffile}, // [Celest] { "arrow_decrement", &battle_config.arrow_decrement }, { "max_aspd", &battle_config.max_aspd }, { "max_hp", &battle_config.max_hp }, @@ -5202,8 +5240,26 @@ static const struct { { "invite_request_check", &battle_config.invite_request_check }, { "skill_removetrap_type", &battle_config.skill_removetrap_type }, { "disp_experience", &battle_config.disp_experience }, - { "castle_defense_rate", &battle_config.castle_defense_rate }, - { "riding_weight", &battle_config.riding_weight }, + { "castle_defense_rate", &battle_config.castle_defense_rate }, + { "riding_weight", &battle_config.riding_weight }, + { "hp_rate", &battle_config.hp_rate }, + { "sp_rate", &battle_config.sp_rate }, + { "gm_can_drop_lv", &battle_config.gm_can_drop_lv }, + { "disp_hpmeter", &battle_config.disp_hpmeter }, + { "bone_drop", &battle_config.bone_drop }, + { "item_rate_details", &battle_config.item_rate_details }, + { "item_rate_1", &battle_config.item_rate_1 }, + { "item_rate_10", &battle_config.item_rate_10 }, + { "item_rate_100", &battle_config.item_rate_100 }, + { "item_rate_1000", &battle_config.item_rate_1000 }, + { "item_rate_1_min", &battle_config.item_rate_1_min }, + { "item_rate_1_max", &battle_config.item_rate_1_max }, + { "item_rate_10_min", &battle_config.item_rate_10_min }, + { "item_rate_10_max", &battle_config.item_rate_10_max }, + { "item_rate_100_min", &battle_config.item_rate_100_min }, + { "item_rate_100_max", &battle_config.item_rate_100_max }, + { "item_rate_1000_min", &battle_config.item_rate_1000_min }, + { "item_rate_1000_max", &battle_config.item_rate_1000_max }, { "item_rate_common", &battle_config.item_rate_common }, // Added by RoVeRT { "item_rate_equip", &battle_config.item_rate_equip }, { "item_rate_card", &battle_config.item_rate_card }, // End Addition @@ -5362,6 +5418,11 @@ void battle_set_defaults() { battle_config.natural_heal_skill_interval=10000; battle_config.natural_heal_weight_rate=50; battle_config.item_name_override_grffile=1; + battle_config.item_equip_override_grffile=1; // [Celest] + battle_config.item_slots_override_grffile=1; // [Celest] + battle_config.indoors_override_grffile=1; // [Celest] + battle_config.skill_sp_override_grffile=1; // [Celest] + battle_config.cardillust_read_grffile=1; // [Celest] battle_config.arrow_decrement=1; battle_config.max_aspd = 199; battle_config.max_hp = 32500; @@ -5405,7 +5466,6 @@ void battle_set_defaults() { battle_config.mob_changetarget_byskill = 0; battle_config.pc_attack_direction_change = 1; battle_config.monster_attack_direction_change = 1; - battle_config.pc_undead_nofreeze = 0; battle_config.pc_land_skill_limit = 1; battle_config.monster_land_skill_limit = 1; battle_config.party_skill_penalty = 1; @@ -5437,6 +5497,26 @@ void battle_set_defaults() { battle_config.invite_request_check = 1; battle_config.skill_removetrap_type = 0; battle_config.disp_experience = 0; + battle_config.castle_defense_rate = 100; + battle_config.riding_weight = 0; + battle_config.hp_rate = 100; + battle_config.sp_rate = 100; + battle_config.gm_can_drop_lv = 0; + battle_config.disp_hpmeter = 0; + battle_config.bone_drop = 0; + battle_config.item_rate_details = 0; + battle_config.item_rate_1 = 100; + battle_config.item_rate_10 = 100; + battle_config.item_rate_100 = 100; + battle_config.item_rate_1000 = 100; + battle_config.item_rate_1_min = 1; + battle_config.item_rate_1_max = 9; + battle_config.item_rate_10_min = 10; + battle_config.item_rate_10_max = 99; + battle_config.item_rate_100_min = 100; + battle_config.item_rate_100_max = 999; + battle_config.item_rate_1000_min = 1000; + battle_config.item_rate_1000_max = 10000; battle_config.item_rate_common = 100; battle_config.item_rate_equip = 100; battle_config.item_rate_card = 100; @@ -5530,6 +5610,10 @@ void battle_validate_conf() { battle_config.max_aspd = 10; if(battle_config.max_aspd > 1000) battle_config.max_aspd = 1000; + if(battle_config.hp_rate < 0) + battle_config.hp_rate = 1; + if(battle_config.sp_rate < 0) + battle_config.sp_rate = 1; if(battle_config.max_hp > 1000000) battle_config.max_hp = 1000000; if(battle_config.max_hp < 100) diff --git a/src/map/battle.h b/src/map/battle.h index 616a65061..fb3d3e4e2 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -212,6 +212,11 @@ extern struct Battle_Config { int natural_heal_skill_interval; int natural_heal_weight_rate; int item_name_override_grffile; + int indoors_override_grffile; // [Celest] + int skill_sp_override_grffile; // [Celest] + int cardillust_read_grffile; + int item_equip_override_grffile; + int item_slots_override_grffile; int arrow_decrement; int max_aspd; int max_hp; @@ -253,7 +258,6 @@ extern struct Battle_Config { int mob_changetarget_byskill; int pc_attack_direction_change; int monster_attack_direction_change; - int pc_undead_nofreeze; int pc_land_skill_limit; int monster_land_skill_limit; int party_skill_penalty; @@ -314,6 +318,14 @@ extern struct Battle_Config { int castle_defense_rate; int riding_weight; int backstab_bow_penalty; + int hp_rate; + int sp_rate; + int gm_can_drop_lv; + int disp_hpmeter; + int bone_drop; + int item_rate_details,item_rate_1,item_rate_10,item_rate_100,item_rate_1000; //ドロップレート詳細 + int item_rate_1_min,item_rate_10_min,item_rate_100_min,item_rate_1000_min; //ドロップレート詳細min + int item_rate_1_max,item_rate_10_max,item_rate_100_max,item_rate_1000_max; //ドロップレート詳細max int night_at_start; // added by [Yor] int day_duration; // added by [Yor] diff --git a/src/map/clif.c b/src/map/clif.c index 1467493bb..ffa3acd9d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2387,6 +2387,8 @@ int clif_updatestatus(struct map_session_data *sd,int type) break; case SP_HP: WFIFOL(fd,4)=sd->status.hp; + if(battle_config.disp_hpmeter) + clif_hpmeter(sd); break; case SP_SP: WFIFOL(fd,4)=sd->status.sp; @@ -5773,6 +5775,46 @@ int clif_party_hp(struct party *p,struct map_session_data *sd) // printf("clif_party_hp %d\n",sd->status.account_id); return 0; } +/*========================================== + * GMへ場所とHP通知 + *------------------------------------------ + */ +int clif_hpmeter(struct map_session_data *sd) +{ + struct map_session_data *md; + unsigned char buf[16]; + unsigned char buf2[16]; + int i; + + nullpo_retr(0, sd); + + WBUFW(buf,0)=0x107; + WBUFL(buf,2)=sd->bl.id; + WBUFW(buf,6)=sd->bl.x; + WBUFW(buf,8)=sd->bl.y; + + for(i=0;isession_data) && md->state.auth && + md->bl.m == sd->bl.m && pc_isGM(md) && sd != md){ + memcpy(WFIFOP(i,0),buf,packet_len_table[0x107]); + WFIFOSET(i,packet_len_table[0x107]); + } + } + + WBUFW(buf2,0)=0x106; + WBUFL(buf2,2)=sd->status.account_id; + WBUFW(buf2,6)=(sd->status.hp > 0x7fff)? 0x7fff:sd->status.hp; + WBUFW(buf2,8)=(sd->status.max_hp > 0x7fff)? 0x7fff:sd->status.max_hp; + for(i=0;isession_data) && md->state.auth && + md->bl.m == md->bl.m && pc_isGM(md) && sd != md){ + memcpy(WFIFOP(i,0),buf2,packet_len_table[0x106]); + WFIFOSET(i,packet_len_table[0x106]); + } + } + + return 0; +} /*========================================== * パーティ場所移動(未使用) *------------------------------------------ diff --git a/src/map/clif.h b/src/map/clif.h index cf03820b1..01c28a28f 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -218,6 +218,7 @@ int clif_party_message(struct party *p,int account_id,char *mes,int len); int clif_party_move(struct party *p,struct map_session_data *sd,int online); int clif_party_xy(struct party *p,struct map_session_data *sd); int clif_party_hp(struct party *p,struct map_session_data *sd); +int clif_hpmeter(struct map_session_data *sd); // guild int clif_guild_created(struct map_session_data *sd,int flag); diff --git a/src/map/guild.c b/src/map/guild.c index 83da2a809..7d73692c9 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1191,10 +1191,17 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id int flag,const char *name1,const char *name2) { struct guild *g[2]; - int guild_id[2]={guild_id1,guild_id2}; - const char *guild_name[2]={name1,name2}; - struct map_session_data *sd[2]={map_id2sd(account_id1),map_id2sd(account_id2)}; + int guild_id[2]; + const char *guild_name[2]; + struct map_session_data *sd[2]; int j,i; + + guild_id[0] = guild_id1; + guild_id[1] = guild_id2; + guild_name[0] = name1; + guild_name[1] = name2; + sd[0] = map_id2sd(account_id1); + sd[1] = map_id2sd(account_id2); g[0]=guild_search(guild_id1); g[1]=guild_search(guild_id2); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index a68fb3664..49d2a8387 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -40,6 +40,9 @@ static int itemdb_read_sqldb(void); static int itemdb_read_randomitem(); static int itemdb_read_itemavail(void); static int itemdb_read_itemnametable(void); +static int itemdb_read_itemslottable(void); +static int itemdb_read_itemslotcounttable(void); +static int itemdb_read_cardillustnametable(void); static int itemdb_read_noequip(void); static int itemdb_read_norefine(void); void itemdb_reload(void); @@ -99,14 +102,15 @@ int itemdb_searchrandomid(int flags) struct { int nameid,count; struct random_item_data *list; - } data[] ={ - { 0,0,NULL }, - { blue_box_default ,blue_box_count ,blue_box }, - { violet_box_default,violet_box_count ,violet_box }, - { card_album_default,card_album_count ,card_album }, - { gift_box_default ,gift_box_count ,gift_box }, - { scroll_default ,scroll_count ,scroll }, - }; + } data[6]; + + // for BCC32 compile error + data[0].nameid = 0; data[0].count = 0; data[0].list = NULL; + data[1].nameid = blue_box_default; data[1].count = blue_box_count; data[1].list = blue_box; + data[2].nameid = violet_box_default; data[2].count = violet_box_count; data[2].list = violet_box; + data[3].nameid = card_album_default; data[3].count = card_album_count; data[3].list = card_album; + data[4].nameid = gift_box_default; data[4].count = gift_box_count; data[4].list = gift_box; + data[5].nameid = scroll_default; data[5].count = scroll_count; data[5].list = scroll; if(flags>=1 && flags<=5){ nameid=data[flags].nameid; @@ -239,67 +243,40 @@ int itemdb_isdropable(int nameid) return 1; } -// -// 初期化 -// -/*========================================== - * - *------------------------------------------ - */ -static int itemdb_read_itemslottable(void) -{ - char *buf,*p; - int s; - - buf=grfio_read("data\\itemslottable.txt"); - if(buf==NULL) - return -1; - s=grfio_size("data\\itemslottable.txt"); - buf[s]=0; - for(p=buf;p-bufequip=equip; - p=strchr(p,10); - if(!p) break; - p++; - p=strchr(p,10); - if(!p) break; - p++; - } - free(buf); - - return 0; -} - -#ifndef TXT_ONLY /*==================================== * Removed item_value_db, don't re-add *------------------------------------ */ static void itemdb_read(void) { - itemdb_read_itemslottable(); - - if (db_use_sqldbs) - { - itemdb_read_sqldb(); - } - else - { + #ifndef TXT_ONLY + if (db_use_sqldbs) + { + itemdb_read_sqldb(); + } + else + { + itemdb_readdb(); + } + /* not TXT_ONLY */ + #else itemdb_readdb(); - } + #endif /* TXT_ONLY */ itemdb_read_randomitem(); itemdb_read_itemavail(); itemdb_read_noequip(); itemdb_read_norefine(); - - if (!battle_config.item_name_override_grffile) + if (battle_config.cardillust_read_grffile) + itemdb_read_cardillustnametable(); + if (battle_config.item_equip_override_grffile) + itemdb_read_itemslottable(); + if (battle_config.item_slots_override_grffile) + itemdb_read_itemslotcounttable(); + if (battle_config.item_name_override_grffile) itemdb_read_itemnametable(); } -#endif /* not TXT_ONLY */ /*========================================== * アイテムデータベースの読み込み *------------------------------------------ @@ -559,7 +536,7 @@ static int itemdb_read_itemnametable(void) return 0; } -#ifdef TXT_ONLY + /*========================================== * カードイラストのリソース名前テーブルを読み込む *------------------------------------------ @@ -595,7 +572,74 @@ static int itemdb_read_cardillustnametable(void) return 0; } -#endif /* TXT_ONLY */ + +// +// 初期化 +// +/*========================================== + * + *------------------------------------------ + */ +static int itemdb_read_itemslottable(void) +{ + char *buf,*p; + int s; + + buf=grfio_read("data\\itemslottable.txt"); + if(buf==NULL) + return -1; + s=grfio_size("data\\itemslottable.txt"); + buf[s]=0; + for(p=buf;p-bufequip=equip; + p=strchr(p,10); + if(!p) break; + p++; + p=strchr(p,10); + if(!p) break; + p++; + } + free(buf); + sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\itemslottable.txt"); + ShowStatus(tmp_output); + + return 0; +} + +/*========================================== + * + *------------------------------------------ + */ +static int itemdb_read_itemslotcounttable(void) +{ + char *buf,*p; + int s; + + buf=grfio_read("data\\itemslotcounttable.txt"); + if(buf==NULL) + return -1; + s=grfio_size("data\\itemslotcounttable.txt"); + buf[s]=0; + for(p=buf;p-bufslot=slot; + p=strchr(p,10); + if(!p) break; + p++; + p=strchr(p,10); + if(!p) break; + p++; + } + free(buf); + sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\itemslotcounttable.txt"); + ShowStatus(tmp_output); + + return 0; +} + /*========================================== * 装備制限ファイル読み出し *------------------------------------------ @@ -650,8 +694,18 @@ static int itemdb_read_norefine(void) struct item_data *id; // To-do: let it read from a text file later int cant_refine[] = { - 0, 1243, 1530, 2110, 2112, 2264, 2298, 2352, 2410, 2413, - 2414, 2509, 2510, 5008, 5046, 5049, 5050, 5053, 5055, 5098 + 1243, 1530, 2110, 2112, 2201, 2202, 2203, 2204, 2205, 2210, + 2212, 2218, 2219, 2237, 2238, 2239, 2240, 2241, 2242, 2243, + 2250, 2253, 2260, 2262, 2263, 2264, 2265, 2266, 2267, 2268, + 2269, 2270, 2271, 2276, 2278, 2279, 2281, 2282, 2286, 2288, + 2289, 2290, 2291, 2292, 2293, 2295, 2296, 2297, 2298, 2352, + 2410, 2413, 2414, 2509, 2510, 2601, 2602, 2603, 2604, 2605, + 2607, 2608, 2609, 2610, 2611, 2612, 2613, 2614, 2615, 2616, + 2617, 2618, 2619, 2620, 2621, 2622, 2623, 2624, 2625, 2626, + 2627, 2628, 2629, 2630, 2631, 2634, 2635, 2636, 2637, 2638, + 2639, 2640, 5004, 5005, 5006, 5008, 5014, 5015, 5037, 5039, + 5040, 5043, 5046, 5049, 5050, 5051, 5053, 5054, 5055, 5058, + 5068, 5074, 5085, 5086, 5087, 5088, 5089, 5090, 5096, 5098, 0 }; for (i=0; i < (int)(sizeof(cant_refine) / sizeof(cant_refine[0])); i++) { @@ -885,24 +939,6 @@ void itemdebugtxt() fclose(dfp); } */ -#ifdef TXT_ONLY -/*==================================== - * Removed item_value_db, don't re-add - *------------------------------------ - */ -static void itemdb_read(void) -{ - itemdb_read_itemslottable(); - itemdb_readdb(); - itemdb_read_randomitem(); - itemdb_read_itemavail(); - itemdb_read_noequip(); - itemdb_read_norefine(); - itemdb_read_cardillustnametable(); - if (!battle_config.item_name_override_grffile) - itemdb_read_itemnametable(); -} -#endif /* TXT_ONLY */ /*========================================== * *------------------------------------------ diff --git a/src/map/map.h b/src/map/map.h index e1a2096c6..5067d6928 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -163,6 +163,7 @@ struct map_session_data { struct mmo_charstatus status; struct item_data *inventory_data[MAX_INVENTORY]; short equip_index[11]; + unsigned short unbreakable_equip; int weight,max_weight; int cart_weight,cart_max_weight,cart_num,cart_max_num; char mapname[24]; @@ -237,6 +238,7 @@ struct map_session_data { int watk_,watk_2,atkmods_[3],addele_[10],addrace_[12],addsize_[3]; //二刀流のために追加 int atk_ele_,star_,overrefine_; //二刀流のために追加 int base_atk,atk_rate; + int weapon_atk[16],weapon_atk_rate[16]; int arrow_atk,arrow_ele,arrow_cri,arrow_hit,arrow_range; int arrow_addele[10],arrow_addrace[12],arrow_addsize[3],arrow_addeff[10],arrow_addeff2[10]; int nhealhp,nhealsp,nshealhp,nshealsp,nsshealhp,nsshealsp; @@ -487,6 +489,14 @@ enum { NONE_ATTACKABLE,ATTACKABLE }; enum { ATK_LUCKY=1,ATK_FLEE,ATK_DEF}; // 囲まれペナルティ計算用 +// 装備コード +enum { + EQP_WEAPON = 0x0002, // 右手 + EQP_ARMOR = 0x0010, // 体 + EQP_SHIELD = 0x0020, // 左手 + EQP_HELM = 0x0100, // 頭上段 +}; + struct map_data { char name[24]; unsigned char *gat; // NULLなら下のmap_data_other_serverとして扱う @@ -592,10 +602,12 @@ enum { SP_MAGIC_DAMAGE_RETURN,SP_RANDOM_ATTACK_INCREASE,SP_ALL_STATS,SP_AGI_VIT,SP_AGI_DEX_STR,SP_PERFECT_HIDE, // 1071-1076 SP_DISGUISE,SP_CLASSCHANGE, // 1077-1078 SP_HP_DRAIN_VALUE,SP_SP_DRAIN_VALUE, // 1079-1080 + SP_WEAPON_ATK,SP_WEAPON_ATK_RATE, // 1081-1082 SP_RESTART_FULL_RECORVER=2000,SP_NO_CASTCANCEL,SP_NO_SIZEFIX,SP_NO_MAGIC_DAMAGE,SP_NO_WEAPON_DAMAGE,SP_NO_GEMSTONE, // 2000-2005 - SP_NO_CASTCANCEL2,SP_INFINITE_ENDURE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, // 2006-2010 - SP_LONG_ATK_RATE // 2011 - celest + SP_NO_CASTCANCEL2,SP_INFINITE_ENDURE,SP_UNBREAKABLE_WEAPON,SP_UNBREAKABLE_ARMOR, SP_UNBREAKABLE_HELM, + SP_UNBREAKABLE_SHIELD, // 2006-2011 + SP_LONG_ATK_RATE // 2012 - celest }; enum { diff --git a/src/map/mob.c b/src/map/mob.c index 27cacb377..1b2792df6 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -37,6 +37,8 @@ struct mob_db mob_db[2001]; +#define CLASSCHANGE_BOSS_NUM 21 + /*========================================== * Local prototype declaration (only required thing) *------------------------------------------ @@ -2093,7 +2095,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) int mvp_damage,max_hp; unsigned int tick = gettick(); struct map_session_data *mvp_sd = NULL, *second_sd = NULL,*third_sd = NULL; - double dmg_rate,tdmg,temp; + double tdmg,temp; struct item item; int ret; int drop_rate; @@ -2348,12 +2350,12 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) } } - // [MouseJstr] - if((map[md->bl.m].flag.pvp == 0) || (battle_config.pvp_exp == 1)) { + // [MouseJstr] + if((map[md->bl.m].flag.pvp == 0) || (battle_config.pvp_exp == 1)) { - if((double)max_hp < tdmg) +/* if((double)max_hp < tdmg) dmg_rate = ((double)max_hp) / tdmg; - else dmg_rate = 1; + else dmg_rate = 1;*/ // 経験値の分配 for(i=0;ibl.m != md->bl.m) continue; /* jAthena's exp formula - per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./((double)max_hp) * dmg_rate; + // per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./((double)max_hp) * dmg_rate; + per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./tdmg; temp = ((double)mob_db[md->class].base_exp * (double)battle_config.base_exp_rate / 100. * per); base_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp; if(mob_db[md->class].base_exp > 0 && base_exp < 1) base_exp = 1; @@ -2891,7 +2894,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int flag) if(value[0]<=1000 || value[0]>MAX_MOB_DB) // 値が異常なら召喚を止める return 0; - while(count < 5 && value[count] > 1000 && value[count] <= 2000) count++; + while(count < 21 && value[count] > 1000 && value[count] <= 2000) count++; if(count < 1) return 0; for(k=0;k= 10 && rate < 100) + rate = rate * battle_config.item_rate_10/100; + else if (rate >= 100 && rate < 1000) + rate = rate * battle_config.item_rate_100/100; + else rate = rate * battle_config.item_rate_1000/100; + } + else if (battle_config.item_rate_details == 2) { //ドロップレート詳細項目が2の時 レート=x/100倍 min max 指定 + if (rate >= 1 && rate < 10) { + if (rate * battle_config.item_rate_1/100 < battle_config.item_rate_1_min) + rate = battle_config.item_rate_1_min; + else if (rate * battle_config.item_rate_1/100 > battle_config.item_rate_1_max) + rate = battle_config.item_rate_1_max; + else rate = rate * battle_config.item_rate_1/100; + } + else if (rate >= 10 && rate < 100) { + if (rate * battle_config.item_rate_10/100 < battle_config.item_rate_10_min) + rate = battle_config.item_rate_10_min; + else if (rate * battle_config.item_rate_10/100 > battle_config.item_rate_10_max) + rate = battle_config.item_rate_10_max; + else rate = rate * battle_config.item_rate_10/100; + } + else if (rate >= 100 && rate < 1000) { + if (rate * battle_config.item_rate_100/100 < battle_config.item_rate_100_min) + rate = battle_config.item_rate_100_min; + else if (rate * battle_config.item_rate_100/100 > battle_config.item_rate_100_max) + rate = battle_config.item_rate_100_max; + else rate = rate * battle_config.item_rate_100/100; + } + else if (rate >= 1000) { + if (rate * battle_config.item_rate_1000/100 < battle_config.item_rate_1000_min) + rate = battle_config.item_rate_1000_min; + else if (rate * battle_config.item_rate_1000/100 > battle_config.item_rate_1000_max) + rate = battle_config.item_rate_1000_max; + else rate = rate * battle_config.item_rate_1000/100; + } + } + rate = rate * atoi(str[30+i*2])/100; rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate; mob_db[class].dropitem[i].p = rate; } diff --git a/src/map/npc.c b/src/map/npc.c index e8ead8d29..bb6b9138c 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -2303,7 +2303,8 @@ int do_init_npc(void) char c = '-'; // indoorrswtable.txt and etcinfo.txt [Celest] - npc_read_indoors(); + if (battle_config.indoors_override_grffile) + npc_read_indoors(); //npc_read_weather(); ev_db=strdb_init(24); diff --git a/src/map/pc.c b/src/map/pc.c index 09b8b8c4d..306360ed5 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -588,6 +588,52 @@ int pc_isequip(struct map_session_data *sd,int n) return 1; } +//装備破壊 +int pc_break_equip(struct map_session_data *sd, unsigned short where) +{ + struct item_data* item; + int i; + int sc; + char output[255]; + + if(sd == NULL) + return -1; + if(sd->unbreakable_equip & where) + return 0; + switch (where) { + case EQP_WEAPON: + sc = SC_CP_WEAPON; + break; + case EQP_ARMOR: + sc = SC_CP_ARMOR; + break; + case EQP_SHIELD: + sc = SC_CP_SHIELD; + break; + case EQP_HELM: + sc = SC_CP_HELM; + break; + default: + return 0; + } + if( sd->sc_data && sd->sc_data[sc].timer != -1 ) + return 0; + + for (i=0;istatus.inventory[i].equip & where) { + item=sd->inventory_data[i]; + sd->status.inventory[i].attribute = 1; + pc_unequipitem(sd,i,0); + break; + } + } + sprintf(output, "%s has broken.",item->jname); + clif_emotion(&sd->bl,23); + clif_displaymessage(sd->fd, output); + clif_equiplist(sd); + return 0; +} + /*========================================== * Weapon Breaking [Valaris] *------------------------------------------ @@ -1230,8 +1276,8 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->matk1 =0; sd->matk2 =0; sd->speed = DEFAULT_WALK_SPEED ; - sd->hprate=100; - sd->sprate=100; + sd->hprate=battle_config.hp_rate; + sd->sprate=battle_config.sp_rate; sd->castrate=100; sd->dsprate=100; sd->base_atk=0; @@ -1254,6 +1300,8 @@ int pc_calcstatus(struct map_session_data* sd,int first) memset(&sd->special_state,0,sizeof(sd->special_state)); memset(sd->weapon_coma_ele,0,sizeof(sd->weapon_coma_ele)); memset(sd->weapon_coma_race,0,sizeof(sd->weapon_coma_race)); + memset(sd->weapon_atk,0,sizeof(sd->weapon_atk)); + memset(sd->weapon_atk_rate,0,sizeof(sd->weapon_atk_rate)); sd->watk_ = 0; //二刀流用(?) sd->watk_2 = 0; @@ -1307,6 +1355,9 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->short_weapon_damage_return = sd->long_weapon_damage_return = 0; sd->magic_damage_return = 0; //AppleGirl Was Here sd->random_attack_increase_add = sd->random_attack_increase_per = 0; + sd->hp_drain_value = sd->hp_drain_value_ = sd->sp_drain_value = sd->sp_drain_value_ = 0; + sd->unbreakable_equip = 0; + if(!sd->disguiseflag && sd->disguise) { sd->disguise=0; @@ -1549,6 +1600,10 @@ int pc_calcstatus(struct map_session_data* sd,int first) if(sd->sc_data[SC_CHASEWALK].val4) sd->paramb[0] += (1<<(sd->sc_data[SC_CHASEWALK].val1-1)); // increases strength after 10 seconds } + if(sd->sc_data[SC_SLOWDOWN].timer!=-1) + sd->speed = sd->speed*150/100; + if(sd->sc_data[SC_SPEEDUP0].timer!=-1) + sd->speed -= sd->speed*25/100; if(sd->sc_data[SC_BLESSING].timer!=-1){ // ブレッシング sd->paramb[0]+= sd->sc_data[SC_BLESSING].val1; sd->paramb[3]+= sd->sc_data[SC_BLESSING].val1; @@ -2210,6 +2265,10 @@ int pc_calcspeed (struct map_session_data *sd) } if(sd->sc_data[SC_CURSE].timer!=-1) sd->speed += 450; + if(sd->sc_data[SC_SLOWDOWN].timer!=-1) + sd->speed = sd->speed*150/100; + if(sd->sc_data[SC_SPEEDUP0].timer!=-1) + sd->speed -= sd->speed*25/100; } if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 ) @@ -2546,6 +2605,22 @@ int pc_bonus(struct map_session_data *sd,int type,int val) if(sd->state.lr_flag != 2) sd->special_state.infinite_endure = 1; break; + case SP_UNBREAKABLE_WEAPON: + if(sd->state.lr_flag != 2) + sd->unbreakable_equip |= EQP_WEAPON; + break; + case SP_UNBREAKABLE_ARMOR: + if(sd->state.lr_flag != 2) + sd->unbreakable_equip |= EQP_ARMOR; + break; + case SP_UNBREAKABLE_HELM: + if(sd->state.lr_flag != 2) + sd->unbreakable_equip |= EQP_HELM; + break; + case SP_UNBREAKABLE_SHIELD: + if(sd->state.lr_flag != 2) + sd->unbreakable_equip |= EQP_SHIELD; + break; case SP_SPLASH_RANGE: if(sd->state.lr_flag != 2 && sd->splash_range < val) sd->splash_range = val; @@ -2837,6 +2912,14 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->random_attack_increase_per += val; } break; + case SP_WEAPON_ATK: + if(sd->state.lr_flag != 2) + sd->weapon_atk[type2]+=val; + break; + case SP_WEAPON_ATK_RATE: + if(sd->state.lr_flag != 2) + sd->weapon_atk_rate[type2]+=val; + break; default: if(battle_config.error_log) printf("pc_bonus2: unknown type %d %d %d!\n",type,type2,val); @@ -3203,7 +3286,8 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) sd->status.inventory[n].amount < amount || sd->trade_partner != 0 || sd->vender_id != 0 || sd->status.inventory[n].amount <= 0 || - itemdb_isdropable(sd->status.inventory[n].nameid) == 0) // Celest + itemdb_isdropable(sd->status.inventory[n].nameid) == 0 || // Celest + pc_candrop(sd,sd->status.inventory[n].nameid)) return 1; map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, NULL, NULL, NULL, 0); pc_delitem(sd, n, amount, 0); @@ -3279,6 +3363,8 @@ int pc_isUseitem(struct map_session_data *sd,int n) if(item == NULL) return 0; + if(item->type != 0 && item->type != 2) + return 0; if((nameid == 605) && map[sd->bl.m].flag.gvg) return 0; if(nameid == 601 && (map[sd->bl.m].flag.noteleport || map[sd->bl.m].flag.gvg)) { @@ -3432,6 +3518,10 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) { nullpo_retr(0, sd); nullpo_retr(0, item_data = &sd->status.inventory[idx]); + if(itemdb_isdropable(sd->status.inventory[idx].nameid) == 0) + return 1; + if(pc_candrop(sd,sd->status.inventory[idx].nameid)==1) + return 1; if (item_data->nameid==0 || item_data->amountvender_id) return 1; if (pc_cart_additem(sd,item_data,amount) == 0) @@ -3836,6 +3926,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt intif_save_petdata(sd->status.account_id,&sd->pet); chrif_save(sd); storage_storage_save(sd); + storage_delete(sd->status.account_id); chrif_changemapserver(sd, mapname, x, y, ip, port); return 0; } @@ -4174,6 +4265,8 @@ static int pc_walk(int tid,unsigned int tick,int id,int data) i = 1; sd->walktimer=add_timer(tick+i,pc_walk,id,sd->walkpath.path_pos); } + if(battle_config.disp_hpmeter) + clif_hpmeter(sd); return 0; } @@ -5498,6 +5591,18 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) clif_updatestatus(sd,SP_HP); pc_calcstatus(sd,0); + if(battle_config.bone_drop==2 + || (battle_config.bone_drop==1 && map[sd->bl.m].flag.pvp)){ // ドクロドロップ + struct item item_tmp; + memset(&item_tmp,0,sizeof(item_tmp)); + item_tmp.nameid=7005; + item_tmp.identify=1; + item_tmp.card[0]=0x00fe; + item_tmp.card[1]=0; + *((unsigned long *)(&item_tmp.card[2]))=sd->char_id; /* キャラID */ + map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); + } + // activate Steel body if a super novice dies at 99+% exp [celest] if (s_class.job == 23) { if ((i=pc_nextbaseexp(sd))<=0) @@ -6286,6 +6391,18 @@ int pc_setriding(struct map_session_data *sd) return 0; } +/*========================================== + * アイテムドロップ可不可判定 + *------------------------------------------ + */ +int pc_candrop(struct map_session_data *sd,int item_id) +{ + int level; + if((level=pc_isGM(sd))>0 && level < battle_config.gm_can_drop_lv) // search only once [Celest] + return 1; + return 0; +} + /*========================================== * script用??の値を?む *------------------------------------------ diff --git a/src/map/pc.h b/src/map/pc.h index b40b11ac2..1f294ce92 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -162,7 +162,8 @@ int pc_divorce(struct map_session_data *sd); struct map_session_data *pc_get_partner(struct map_session_data *sd); int pc_set_gm_level(int account_id, int level); void pc_setstand(struct map_session_data *sd); - +int pc_break_equip(struct map_session_data *sd, unsigned short where); +int pc_candrop(struct map_session_data *sd,int item_id); struct pc_base_job{ int job; //職業、ただし転生職や養子職の場合は元の職業を返す(廃プリ→プリ) diff --git a/src/map/script.c b/src/map/script.c index 5c6b89092..5d9d60385 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -274,6 +274,7 @@ int buildin_petloot(struct script_state *st); // pet looting [Valaris] int buildin_petheal(struct script_state *st); // pet healing [Valaris] int buildin_petmag(struct script_state *st); // pet magnificat [Valaris] int buildin_petskillattack(struct script_state *st); // pet skill attacks [Valaris] +int buildin_skilleffect(struct script_state *st); // skill effects [Celest] int buildin_npcskilleffect(struct script_state *st); // skill effects for npcs [Valaris] int buildin_specialeffect(struct script_state *st); // special effect script [Valaris] int buildin_specialeffect2(struct script_state *st); // special effect script [Valaris] @@ -292,6 +293,8 @@ int buildin_getmapxy(struct script_state *st); //get map position for player/np int buildin_checkoption1(struct script_state *st); // [celest] int buildin_checkoption2(struct script_state *st); // [celest] int buildin_guildgetexp(struct script_state *st); // [celest] +int buildin_skilluseid(struct script_state *st); // originally by Qamera [celest] +int buildin_skillusepos(struct script_state *st); // originally by Qamera [celest] void push_val(struct script_stack *stack,int type,int val); int run_func(struct script_state *st); @@ -481,6 +484,7 @@ struct { {buildin_petheal,"petheal","iii"}, // [Valaris] {buildin_petmag,"petmag","iiii"}, // [Valaris] {buildin_petskillattack,"petskillattack","iiii"}, // [Valaris] + {buildin_skilleffect,"skilleffect","ii"}, // skill effect [Celest] {buildin_npcskilleffect,"npcskilleffect","iiii"}, // npc skill effect [Valaris] {buildin_specialeffect,"specialeffect","i"}, // npc skill effect [Valaris] {buildin_specialeffect2,"specialeffect2","i"}, // skill effect on players[Valaris] @@ -504,6 +508,9 @@ struct { {buildin_checkoption1,"checkoption1","i"}, {buildin_checkoption2,"checkoption2","i"}, {buildin_guildgetexp,"guildgetexp","i"}, + {buildin_skilluseid,"skilluseid","ii"}, // originally by Qamera [Celest] + {buildin_skilluseid,"doskill","ii"}, // since a lot of scripts would already use 'doskill'... + {buildin_skillusepos,"skillusepos","iiii"}, // [Celest] {NULL,NULL,NULL}, }; int buildin_message(struct script_state *st); // [MouseJstr] @@ -2323,7 +2330,8 @@ int buildin_getitem(struct script_state *st) return 0; if((flag = pc_additem(sd,&item_tmp,amount))) { clif_additem(sd,0,0,flag); - map_addflooritem(&item_tmp,amount,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); + if(!pc_candrop(sd,nameid)) + map_addflooritem(&item_tmp,amount,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); } } @@ -5827,6 +5835,24 @@ int buildin_petskillattack(struct script_state *st) return 0; } + +/*========================================== + * Scripted skill effects [Celest] + *------------------------------------------ + */ +int buildin_skilleffect(struct script_state *st) +{ + struct map_session_data *sd; + + int skillid=conv_num(st,& (st->stack->stack_data[st->start+2])); + int skilllv=conv_num(st,& (st->stack->stack_data[st->start+3])); + sd=script_rid2sd(st); + + clif_skill_nodamage(&sd->bl,&sd->bl,skillid,skilllv,1); + + return 0; +} + /*========================================== * NPC skill effects [Valaris] *------------------------------------------ @@ -6284,6 +6310,42 @@ int buildin_getmapxy(struct script_state *st){ return 0; } +/*===================================================== + * Allows players to use a skill - by Qamera + *----------------------------------------------------- + */ +int buildin_skilluseid (struct script_state *st) +{ + int skid,sklv; + struct map_session_data *sd; + + skid=conv_num(st,& (st->stack->stack_data[st->start+2])); + sklv=conv_num(st,& (st->stack->stack_data[st->start+3])); + sd=script_rid2sd(st); + skill_use_id(sd,sd->status.account_id,skid,sklv); + + return 0; +} + +/*===================================================== + * Allows players to use a skill on a position [Celest] + *----------------------------------------------------- + */ +int buildin_skillusepos(struct script_state *st) +{ + int skid,sklv,x,y; + struct map_session_data *sd; + + skid=conv_num(st,& (st->stack->stack_data[st->start+2])); + sklv=conv_num(st,& (st->stack->stack_data[st->start+3])); + x=conv_num(st,& (st->stack->stack_data[st->start+4])); + y=conv_num(st,& (st->stack->stack_data[st->start+5])); + + sd=script_rid2sd(st); + skill_use_pos(sd,x,y,skid,sklv); + + return 0; +} // // 実行部main diff --git a/src/map/skill.c b/src/map/skill.c index dacd08e88..21c5bd954 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -231,7 +231,8 @@ int SkillStatusChangeTable[]={ /* skill.h SC_BASILICA, -1,-1,-1, SC_MAGICPOWER, - -1,-1, + -1, + SC_SACRIFICE, SC_GOSPEL, /* 370- */ -1,-1,-1,-1,-1,-1,-1,-1, @@ -2335,7 +2336,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case LK_HEADCRUSH: /* ヘッドクラッシュ */ case LK_JOINTBEAT: /* ジョイントビ?ト */ case PA_PRESSURE: /* プレッシャ? */ - case PA_SACRIFICE: /* サクリファイス */ +// case PA_SACRIFICE: /* サクリファイス */ case SN_SHARPSHOOTING: /* シャ?プシュ?ティング */ case CG_ARROWVULCAN: /* アロ?バルカン */ case ASC_BREAKER: /* ソウルブレ?カ? */ @@ -2538,12 +2539,11 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s /* 個別にダメ?ジを?える */ if(bl->id!=skill_area_temp[1]) skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0x0500); - } - else { - int damage; + } else { +/* int damage; map_freeblock_lock(); damage = skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0); - if(damage > 0) { + if(damage > 0) {*/ int i,c; /* 他人から聞いた動きなので間違ってる可能性大&?率が?いっす>< */ c = skill_get_blewcount(skillid,skilllv); if(map[bl->m].flag.gvg) c = 0; @@ -2565,16 +2565,18 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s skill_area_temp[1]=bl->id; skill_area_temp[2]=bl->x; skill_area_temp[3]=bl->y; + skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0); + /* その後タ?ゲット以外の範??の敵全?に?理を行う */ map_foreachinarea(skill_area_sub, bl->m,bl->x-1,bl->y-1,bl->x+1,bl->y+1,0, src,skillid,skilllv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); - battle_damage(src,bl,damage,1); +/* battle_damage(src,bl,damage,1); if(rdamage > 0) battle_damage(bl,src,rdamage,0); } - map_freeblock_unlock(); + map_freeblock_unlock();*/ } break; @@ -2597,7 +2599,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case WZ_EARTHSPIKE: /* アーススパイク */ case AL_HEAL: /* ヒール */ case AL_HOLYLIGHT: /* ホーリーライト */ - case MG_FROSTDIVER: /* フロストダイバー */ +// case MG_FROSTDIVER: /* フロストダイバー */ case WZ_JUPITEL: /* ユピテルサンダー */ case NPC_DARKJUPITEL: /*闇ユピテル*/ case NPC_MAGICALATTACK: /* MOB:魔法打?攻? */ @@ -2606,6 +2608,28 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); break; + case MG_FROSTDIVER: /* フロストダイバー */ + { + struct status_change *sc_data = battle_get_sc_data(bl); + int sc_def_mdef, rate, damage; + sc_def_mdef = 100 - (3 + battle_get_mdef(bl) + battle_get_luk(bl)/3); + rate = (skilllv*3+35)*sc_def_mdef/100-(battle_get_int(bl)+battle_get_luk(bl))/15; + rate = rate<=5?5:rate; + if (sc_data && sc_data[SC_FREEZE].timer != -1) { + skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + } else if (sd) { + clif_skill_fail(sd,skillid,0,0); + break; + } + damage = skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); + if (battle_get_hp(bl) > 0 && damage > 0 && rand()%100 < rate) { + skill_status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + } else if (sd) { + clif_skill_fail(sd,skillid,0,0); + } + break; + } + case WZ_WATERBALL: /* ウォ?タ?ボ?ル */ skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); if(skilllv>1) @@ -2849,7 +2873,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int struct mob_data *md=NULL; struct mob_data *dstmd=NULL; int i,abra_skillid=0,abra_skilllv; - int sc_def_vit,sc_def_mdef,strip_fix,strip_time,strip_per; + int sc_def_vit,sc_def_mdef,strip_time,strip_per; int sc_dex,sc_luk; //クラスチェンジ用ボスモンスタ?ID int changeclass[]={1038,1039,1046,1059,1086,1087,1112,1115 @@ -2872,7 +2896,6 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int sc_def_vit = 100 - (3 + battle_get_vit(bl) + battle_get_luk(bl)/3); //sc_def_vit = 100 - (3 + battle_get_vit(bl) + battle_get_luk(bl)/3); sc_def_mdef = 100 - (3 + battle_get_mdef(bl) + battle_get_luk(bl)/3); - strip_fix = battle_get_dex(src) - battle_get_dex(bl); if(bl->type==BL_PC){ nullpo_retr(1, dstsd=(struct map_session_data *)bl); @@ -2887,8 +2910,6 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int sc_def_vit=0; if(sc_def_mdef < 0) sc_def_mdef=0; - if(strip_fix < 0) - strip_fix=0; if(bl == NULL || bl->prev == NULL) return 1; @@ -3231,6 +3252,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case ST_REJECTSWORD: /* リジェクトソ?ド */ case HW_MAGICPOWER: /* 魔法力?幅 */ case PF_MEMORIZE: /* メモライズ */ + case PA_SACRIFICE: case ASC_EDP: // [Celest] clif_skill_nodamage(src,bl,skillid,skilllv,1); skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); @@ -3713,6 +3735,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case MG_STONECURSE: /* スト?ンカ?ス */ { + struct status_change *sc_data = battle_get_sc_data(bl); // Level 6-10 doesn't consume a red gem if it fails [celest] int i, gem_flag = 1; if (bl->type==BL_MOB && battle_get_mode(bl)&0x20) { @@ -3722,7 +3745,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int clif_skill_nodamage(src,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - if( rand()%100 < skilllv*4+20 && !battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))) + if (sc_data && sc_data[SC_STONE].timer != -1) { + skill_status_change_end(bl,SC_STONE,-1); + if (sd) + clif_skill_fail(sd,skillid,0,0); + } + else if( rand()%100 < skilllv*4+20 && !battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))) skill_status_change_start(bl,SC_STONE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); else if(sd) { if (skilllv > 5) gem_flag = 0; @@ -3876,105 +3904,67 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; case RG_STRIPWEAPON: /* ストリップウェポン */ - { - struct status_change *tsc_data = battle_get_sc_data(bl); - - if(tsc_data && tsc_data[SC_CP_WEAPON].timer != -1 ) + case RG_STRIPSHIELD: /* ストリップシールド */ + case RG_STRIPARMOR: /* ストリップアーマー */ + case RG_STRIPHELM: /* ストリップヘルム */ + { + struct status_change *tsc_data = battle_get_sc_data(bl); + int scid, equip, strip_fix; + scid = SkillStatusChangeTable[skillid]; + switch (skillid) { + case RG_STRIPWEAPON: + equip = EQP_WEAPON; break; - strip_per = 5+2*skilllv+strip_fix/5; - strip_time = skill_get_time(skillid,skilllv)+strip_fix/2; - if(rand()%100 < strip_per){ - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,strip_time,0 ); - if(dstsd){ - for(i=0;istatus.inventory[i].equip && dstsd->status.inventory[i].equip & 0x0002){ - pc_unequipitem(dstsd,i,3); - break; - } - } - } - } - } - break; - - case RG_STRIPSHIELD: /* ストリップシ?ルド */ - { - struct status_change *tsc_data = battle_get_sc_data(bl); - - if(tsc_data && tsc_data[SC_CP_SHIELD].timer != -1 ) + case RG_STRIPSHIELD: + equip = EQP_SHIELD; break; - strip_per = 5+2*skilllv+strip_fix/5; - strip_time = skill_get_time(skillid,skilllv)+strip_fix/2; - if(rand()%100 < strip_per){ - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,strip_time,0 ); - if(dstsd){ - for(i=0;istatus.inventory[i].equip && dstsd->status.inventory[i].equip & 0x0020){ - pc_unequipitem(dstsd,i,3); - break; - } - } - } - } - } - break; - - case RG_STRIPARMOR: /* ストリップア?マ? */ - { - struct status_change *tsc_data = battle_get_sc_data(bl); - - if(tsc_data && tsc_data[SC_CP_ARMOR].timer != -1 ) + case RG_STRIPARMOR: + equip = EQP_ARMOR; break; - strip_per = 5+2*skilllv+strip_fix/5; - strip_time = skill_get_time(skillid,skilllv)+strip_fix/2; - if(rand()%100 < strip_per){ - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,strip_time,0 ); - if(dstsd){ - for(i=0;istatus.inventory[i].equip && dstsd->status.inventory[i].equip & 0x0010){ - pc_unequipitem(dstsd,i,3); - break; - } - } - } - } + case RG_STRIPHELM: + equip = EQP_HELM; + break; + default: + return 1; } - break; - case RG_STRIPHELM: /* ストリップヘルム */ - { - struct status_change *tsc_data = battle_get_sc_data(bl); - - if(tsc_data && tsc_data[SC_CP_HELM].timer != -1 ) - break; - strip_per = 5+2*skilllv+strip_fix/5; - strip_time = skill_get_time(skillid,skilllv)+strip_fix/2; - if(rand()%100 < strip_per){ - clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,strip_time,0 ); - if(dstsd){ - for(i=0;istatus.inventory[i].equip && dstsd->status.inventory[i].equip & 0x0100){ - pc_unequipitem(dstsd,i,3); - break; - } - } + if (tsc_data && tsc_data[scid].timer != -1) + break; + + strip_fix = battle_get_dex(src) - battle_get_dex(bl); + if(strip_fix < 0) + strip_fix=0; + strip_per = 5+2*skilllv+strip_fix/5; + if (rand()%100 >= strip_per) + break; + + if (dstsd) { + for (i=0;istatus.inventory[i].equip && dstsd->status.inventory[i].equip & equip){ + pc_unequipitem(dstsd,i,0); + break; } } + if (i == MAX_INVENTORY) + break; } + clif_skill_nodamage(src,bl,skillid,skilllv,1); + strip_time = skill_get_time(skillid,skilllv)+strip_fix/2; + skill_status_change_start(bl,scid,skilllv,0,0,0,strip_time,0 ); break; + } // Full Strip [Celest] case ST_FULLSTRIP: { struct status_change *tsc_data = battle_get_sc_data(bl); - int c=0, i, j; + int c=0, i, j, strip_fix; int striplist[2][4] = { { 0, 0, 0, 0 }, { 0x0002, 0x0020, 0x0010, 0x0100 } }; + strip_fix = battle_get_dex(src) - battle_get_dex(bl); + if(strip_fix < 0) + strip_fix=0; strip_per = 5+2*skilllv+strip_fix/5; strip_time = skill_get_time(skillid,skilllv)+strip_fix/2; for (i=0; i<4; i++) { @@ -5170,13 +5160,14 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma case AL_WARP: /* ワ?プポ?タル */ { - const struct point *p[]={ - &sd->status.save_point,&sd->status.memo_point[0], - &sd->status.memo_point[1],&sd->status.memo_point[2], - }; + const struct point *p[4]; struct skill_unit_group *group; int i; int maxcount=0; + p[0] = &sd->status.save_point; + p[1] = &sd->status.memo_point[0]; + p[2] = &sd->status.memo_point[1]; + p[3] = &sd->status.memo_point[2]; if((maxcount = skill_get_maxcount(sd->skillid)) > 0) { int c; @@ -7390,6 +7381,11 @@ int skill_castfix( struct block_list *bl, int time ) castnodex=skill_get_castnodex(skill, lv); + /* サフラギウム */ + if(sc_data && sc_data[SC_SUFFRAGIUM].timer!=-1 ) + time=time*(100-sc_data[SC_SUFFRAGIUM].val1*15)/100; + skill_status_change_end( bl, SC_SUFFRAGIUM, -1); + if(time==0) return 0; if(castnodex > 0 && bl->type==BL_PC) @@ -7400,17 +7396,10 @@ int skill_castfix( struct block_list *bl, int time ) time=time*battle_config.cast_rate/100; } - /* サフラギウム */ - if(sc_data) { - if ( sc_data[SC_SUFFRAGIUM].timer!=-1 ){ - time=time*(100-sc_data[SC_SUFFRAGIUM].val1*15)/100; - skill_status_change_end( bl, SC_SUFFRAGIUM, -1); - } - /* ブラギの詩 */ - if( sc_data[SC_POEMBRAGI].timer!=-1 ) - time=time*(100-(sc_data[SC_POEMBRAGI].val1*3+sc_data[SC_POEMBRAGI].val2 - +(sc_data[SC_POEMBRAGI].val3>>16)))/100; - } + /* ブラギの詩 */ + if(sc_data && sc_data[SC_POEMBRAGI].timer!=-1) + time=time*(100-(sc_data[SC_POEMBRAGI].val1*3+sc_data[SC_POEMBRAGI].val2 + +(sc_data[SC_POEMBRAGI].val3>>16)))/100; return (time>0)?time:0; } @@ -7426,7 +7415,8 @@ int skill_delayfix( struct block_list *bl, int time ) sc_data = battle_get_sc_data(bl); if(time<=0) - return 0; + return ( battle_get_adelay(bl) / 2 ); + if(bl->type == BL_PC) { if( battle_config.delay_dependon_dex ) /* dexの影響を計算する */ @@ -7629,7 +7619,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, range = skill_get_range(skill_num,skill_lv); if(range < 0) range = battle_get_range(&sd->bl) - (range + 1); - if(!battle_check_range(&sd->bl,bl,range) ) + if(!battle_check_range(&sd->bl,bl,range + 1) ) return 0; if(bl->type==BL_PC) { @@ -7721,6 +7711,9 @@ int skill_use_id( struct map_session_data *sd, int target_id, case PF_MEMORIZE: /* メモライズ */ casttime = 12000; break; + case HW_MAGICPOWER: + casttime = 700; + break; case GD_BATTLEORDER: case GD_REGENERATION: case GD_RESTORE: @@ -7736,11 +7729,6 @@ int skill_use_id( struct map_session_data *sd, int target_id, skill_status_change_end(&sd->bl, SC_MEMORIZE, -1); } - // instant cast attack skills depend on aspd as delay [celest] - if (casttime == 0 && delay == 0 && skill_db[skill_num].skill_type == BF_WEAPON) { - delay = battle_get_adelay (&sd->bl) * battle_config.delay_rate / 100; - } - if(battle_config.pc_skill_log) printf("PC %d skill use target_id=%d skill=%d lv=%d cast=%d\n",sd->bl.id,target_id,skill_num,skill_lv,casttime); @@ -7787,10 +7775,6 @@ int skill_use_id( struct map_session_data *sd, int target_id, skill_castend_id(sd->skilltimer,tick,sd->bl.id,0); } - //マジックパワ?の?果終了 - //if(sc_data && sc_data[SC_MAGICPOWER].timer != -1 && skill_num != HW_MAGICPOWER) - // skill_status_change_end(&sd->bl,SC_MAGICPOWER,-1); // moved - return 0; } @@ -7877,6 +7861,9 @@ int skill_use_pos( struct map_session_data *sd, range = skill_get_range(skill_num,skill_lv); if(range < 0) range = battle_get_range(&sd->bl) - (range + 1); +// be lenient if the skill was cast before we have moved to the correct position [Celest] + if (sd->walktimer != -1) + range += battle_config.skill_range_leniency; if(!battle_check_range(&sd->bl,&bl,range) ) return 0; @@ -8693,6 +8680,7 @@ int skill_status_change_end(struct block_list* bl, int type, int tid) case SC_MARIONETTE: case SC_MARIONETTE2: case SC_SLOWDOWN: + case SC_SPEEDUP0: /* case SC_LEADERSHIP: case SC_GLORYWOUNDS: case SC_SOULCOLD: @@ -8980,23 +8968,10 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) break; case SC_SIGHT: /* サイト */ - { - const int range=7; - map_foreachinarea( skill_status_change_timer_sub, - bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,0, - bl,type,tick); - - if( (--sc_data[type].val2)>0 ){ - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - 250+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - break; case SC_RUWACH: /* ルアフ */ { - const int range=5; + int range = 5; + if ( type == SC_SIGHT ) range = 7; map_foreachinarea( skill_status_change_timer_sub, bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,0, bl,type,tick); @@ -9215,6 +9190,7 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) case SC_MEMORIZE: /* メモライズ */ case SC_BROKNWEAPON: case SC_BROKNARMOR: + case SC_SACRIFICE: // if(sc_data[type].timer==tid) sc_data[type].timer=add_timer( 1000*600+tick,skill_status_change_timer, bl->id, data ); return 0; @@ -9679,6 +9655,13 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val if(sc_data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */ skill_status_change_end(bl,SC_CARTBOOST,-1); break; + case SC_MAGICPOWER: + calc_flag = 1; + val2 = 1; + break; + case SC_SACRIFICE: + val2 = 5; + break; case SC_FLAMELAUNCHER: /* フレ?ムランチャ? */ skill_encchant_eremental_end(bl,SC_FLAMELAUNCHER); break; @@ -9919,9 +9902,29 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val } break; - /* option2 */ - case SC_POISON: /* 毒 */ + /* option2 */ case SC_DPOISON: /* 猛毒 */ + { + int mhp = battle_get_max_hp(bl); + int hp = battle_get_hp(bl); + // MHP?1/4???????? + if (hp > mhp>>2) { + if(bl->type == BL_PC) { + int diff = mhp*10/100; + if (hp - diff < mhp>>2) + hp = hp - (mhp>>2); + pc_heal((struct map_session_data *)bl, -hp, 0); + } else if(bl->type == BL_MOB) { + struct mob_data *md = (struct mob_data *)bl; + hp -= mhp*15/100; + if (hp > mhp>>2) + md->hp = hp; + else + md->hp = mhp>>2; + } + } + } // fall through + case SC_POISON: /* 毒 */ calc_flag = 1; if(!(flag&2)) { int sc_def = 100 - (battle_get_vit(bl) + battle_get_luk(bl)/5); @@ -10127,7 +10130,6 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val case SC_CARTBOOST: /* カ?トブ?スト */ case SC_TRUESIGHT: /* トゥル?サイト */ case SC_SPIDERWEB: /* スパイダ?ウェッブ */ - case SC_MAGICPOWER: /* 魔法力?幅 */ calc_flag = 1; break; @@ -10161,6 +10163,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val break; case SC_SLOWDOWN: + case SC_SPEEDUP0: calc_flag = 1; break; @@ -12049,7 +12052,8 @@ void skill_reload(void) int do_init_skill(void) { skill_readdb(); - skill_read_skillspamount(); + if (battle_config.skill_sp_override_grffile) + skill_read_skillspamount(); add_timer_func_list(skill_unit_timer,"skill_unit_timer"); add_timer_func_list(skill_castend_id,"skill_castend_id"); diff --git a/src/map/skill.h b/src/map/skill.h index 4d1319599..5baf42024 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -313,10 +313,9 @@ enum { // struct map_session_data SC_SPIDERWEB =180, /* スパイダ?ウェッブ */ SC_MEMORIZE =181, /* メモライズ */ -// SC_DPOISON =182, /* 猛毒 */ - -// SC_EDP =183, /* エフェクトが判明したら移動 */ - + SC_DPOISON =182, /* 猛毒 */ + SC_EDP =183, /* エフェクトが判明したら移動 */ + SC_SACRIFICE =184, /* サクリファイス */ SC_WEDDING =187, //結婚用(結婚衣裳になって?くのが?いとか) SC_NOCHAT =188, //赤エモ?態 SC_SPLASHER =189, /* ベナムスプラッシャ? */ @@ -326,25 +325,27 @@ enum { // struct map_session_data // Used by English Team SC_BROKNARMOR =32, SC_BROKNWEAPON =33, + SC_SPEEDUP0 =41, // for skill speedup + SC_SPEEDUP1 =42, // for skill speedup SC_SLOWDOWN =45, // for skill slowdown SC_AUTOBERSERK =46, SC_SIGHTTRASHER =73, // SC_BASILICA =125, // 125 is the same id as joint break SC_BASILICA =102, // temporarily use this before an actual id is found [celest] - SC_EDP =114, // +// SC_EDP =114, // SC_MARIONETTE2 =122, // Marionette target SC_ENSEMBLE =159, SC_FOGWALL =178, SC_GOSPEL =179, - SC_LANDPROTECTOR =182, - SC_ADAPTATION =183, - SC_CHASEWALK =184, SC_ATKPOT =185, // [Valaris] SC_MATKPOT =186, // [Valaris] SC_MINDBREAKER =191, SC_SPELLBREAKER =192, - SC_DPOISON =193, /* 猛毒 */ + SC_LANDPROTECTOR =193, +// SC_DPOISON =193, /* 猛毒 */ SC_BLOCKSKILL =194, // for disallowing the use of a skill for a time period + SC_ADAPTATION =195, + SC_CHASEWALK =196, /* SC_LEADERSHIP =196, // temporarily disabled - they're too buggy =/ SC_GLORYWOUNDS =197, SC_SOULCOLD =198, -- cgit v1.2.3-70-g09d2 From e18d01b53500c4d4744cfe31cacaed56f414f0da Mon Sep 17 00:00:00 2001 From: celest Date: Wed, 22 Dec 2004 08:33:24 +0000 Subject: translated the japanese part in battle_athena.conf git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@722 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 1 + conf-tmpl/battle_athena.conf | 86 +++++++++++++++++++++++++------------------- 2 files changed, 50 insertions(+), 37 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 6a6ef766f..5b7bf426e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Date Added 12/22 + * Translated the japanese part in battle_athena.conf [celest] * Added ignore the new skill delays when chaining monk combos [celest] 12/21 diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index b317575cc..4b740e877 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -144,6 +144,37 @@ item_drop_card_max: 10000 item_drop_mvp_min: 1 item_drop_mvp_max: 10000 +//For fine tuning drop rates for all items +//details = 0: Don't change anything (Default) +// 1: Change drop ratios depending on current rates +// 2: Change drop ratios depending on current rates, but not exceeding minimum +// and maximum values +// Example: details=3 rate_1=1000 min=20 If an item's drops is between 1/10000 - +// 9/10000 it will become at least 1x1000%=10, which is still below 20, +// so it'll be increase to 20/10000 +// +item_rate_details: 0 +// +//Drop rates 1-9 +item_rate_1: 100 +item_rate_1_min: 1 +item_rate_1_max: 9 +// +//Drop rates 10-99 +item_rate_10: 100 +item_rate_10_min: 10 +item_rate_10_max: 99 +// +//Drop rates 100-999 +item_rate_100: 100 +item_rate_100_min: 100 +item_rate_100_max: 999 +// +//Drop rates 1000 and above +item_rate_1000: 100 +item_rate_1000_min: 1000 +item_rate_1000_max: 10000 + // Can the monster's drop rate become 0? (Note 1) drop_rate0item: no @@ -153,7 +184,14 @@ base_exp_rate: 100 // Rate at which job exp. is given. (Note 2) job_exp_rate: 100 -// PVP exp. Do players get exp during pvp +// Players' maximum HP rate? (Default is 100) +hp_rate: 100 + +// Players' maximum SP rate? (Default is 100) +sp_rate: 100 + +// PVP exp. Do players get exp in PvP maps +// (Note: NOT exp from players, but from normal leveling) pvp_exp: no // When a player dies, how should we penalize them? @@ -221,7 +259,7 @@ player_skillup_limit: no // Forging success rate. (Note 2) weapon_produce_rate: 100 -// Prepare Potion succsss rate. (Note 2) +// Prepare Potion success rate. (Note 2) potion_produce_rate: 100 // Allow monsters to be aggresive and attack first? (Note 1) @@ -769,51 +807,25 @@ mobs_level_up: no // Use kRO new steal formula? skill_steal_type: yes -// In some cases when moving to cast a skill the exe will a send a UseSkill packet -// before the server has moved us to the correct position, causing it to fail. -// Setting this at 1 would be enough. +// Sometimes when using skills while walking it'll fail because of range being too +// far, should we allow this to happen? (Setting this at 1 would be enough) skill_range_leniency: 1 // Set this to 1 if your clients have langtype problems and can't display motd properly motd_type: 0 -// キャラのHP?率を設定。(100で正規の値) -hp_rate: 100 - -// キャラのSP?率を設定。(100で正規の値) -sp_rate: 100 - -//GMの行動制限 アイテ?ドロップ・倉庫出し入れ・ItemZeny交換 +// The minimum level for GMs' to drop items on the ground, use the Storage or +// trade Items/Zeny? gm_can_drop_lv: 0 -//全キャラがGMにHPメ???を常に送信するか +// Allow GMs' to see the hp of every player? disp_hpmeter: no -//PC?亡時に、ドクロをドロップするか -//0:しない 1:PvP?ップのみ 2:いつでも +// Players' will drop a 'Bone' when killed? +// 1 - Dropped only in PvP maps +// 2 - Dropped in all situations +// 0 - Disabled bone_drop: 0 -//敵のアイテ?ドロップ率をレ?トごとに個別?率をかけるかどうか -//details = 0:個別設定なし(デフォルト) 1:それぞれ?率指定(百分率) ?detailsが0以外の場合、以前のドロップ?率は無視されます -// 2:それぞれ?率指定(百分率)、ドロップ率上限と下限を設定?ドロップ設定0は無視します -//例 details = 3 rate_1 = 1000 min = 20 ドロップ率1/10000?9/10000の物を10?に指定 10?しても20/10000未満の物は 20/10000に固定 -item_rate_details: 0 -//ドロップ設定1?9 -item_rate_1: 100 -item_rate_1_min: 1 -item_rate_1_max: 9 -//ドロップ設定10?99 -item_rate_10: 100 -item_rate_10_min: 10 -item_rate_10_max: 99 -//ドロップ設定100?999 -item_rate_100: 100 -item_rate_100_min: 100 -item_rate_100_max: 999 -//ドロップ設定1000?10000 -item_rate_1000: 100 -item_rate_1000_min: 1000 -item_rate_1000_max: 10000 - import: conf/import/battle_conf.txt -- cgit v1.2.3-70-g09d2 From 1b41357533c38140578f2e255e411c360b37afa2 Mon Sep 17 00:00:00 2001 From: celest Date: Thu, 23 Dec 2004 05:15:10 +0000 Subject: Added finding_ore_rate git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@746 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 1 + conf-tmpl/battle_athena.conf | 3 +++ src/map/battle.c | 10 ++++++---- src/map/battle.h | 1 + src/map/mob.c | 2 +- 5 files changed, 12 insertions(+), 5 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index aba6f5a0b..4f51bcfa4 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Date Added 12/22 + * Added finding_ore_rate to battle_athena.conf, thanks to orn [celest] * Changed how party exp is passed out to eliminate players current in a chat window or those who havn't moved or attacked in 2 minutes [MouseJstr] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 4b740e877..6d1d8f21e 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -827,5 +827,8 @@ disp_hpmeter: no // 0 - Disabled bone_drop: 0 +// The rate of monsters dropping ores by the skill Ore Discovery (Default is 100) +finding_ore_rate: 100 + import: conf/import/battle_conf.txt diff --git a/src/map/battle.c b/src/map/battle.c index 2ff50cfff..ef05f16a8 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5301,7 +5301,7 @@ static const struct { { "max_cloth_color", &battle_config.max_cloth_color }, // added by [MouseJstr] { "castrate_dex_scale", &battle_config.castrate_dex_scale }, // added by [MouseJstr] { "area_size", &battle_config.area_size }, // added by [MouseJstr] - { "muting_players", &battle_config.muting_players}, // added by [Apple] + { "muting_players", &battle_config.muting_players}, // added by [Apple] { "zeny_from_mobs", &battle_config.zeny_from_mobs}, // [Valaris] { "mobs_level_up", &battle_config.mobs_level_up}, // [Valaris] { "pk_min_level", &battle_config.pk_min_level}, // [celest] @@ -5311,6 +5311,7 @@ static const struct { { "skill_range_leniency", &battle_config.skill_range_leniency}, // [celest] { "motd_type", &battle_config.motd_type}, // [celest] { "allow_atcommand_when_mute", &battle_config.allow_atcommand_when_mute}, // [celest] + { "finding_ore_rate", &battle_config.finding_ore_rate}, // [celest] //SQL-only options start #ifndef TXT_ONLY @@ -5567,10 +5568,8 @@ void battle_set_defaults() { battle_config.skill_range_leniency = 1; battle_config.motd_type = 0; battle_config.allow_atcommand_when_mute = 0; - - + battle_config.finding_ore_rate = 100; battle_config.castrate_dex_scale = 150; - battle_config.area_size = 14; //SQL-only options start @@ -5703,6 +5702,9 @@ void battle_validate_conf() { else if (battle_config.motd_type > 1) battle_config.motd_type = 1; + if (battle_config.finding_ore_rate < 0) + battle_config.finding_ore_rate = 0; + if (battle_config.vending_max_value > 10000000 || battle_config.vending_max_value<=0) // Lupus & Kobra_k88 battle_config.vending_max_value = 10000000; diff --git a/src/map/battle.h b/src/map/battle.h index fb3d3e4e2..bd22b9341 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -355,6 +355,7 @@ extern struct Battle_Config { int skill_range_leniency; // [celest] int motd_type; // [celest] int allow_atcommand_when_mute; // [celest] + int finding_ore_rate; // orn #ifndef TXT_ONLY /* SQL-only options */ int mail_system; // [Valaris] diff --git a/src/map/mob.c b/src/map/mob.c index 1b2792df6..f65e27bc0 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2483,7 +2483,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) #endif // Ore Discovery [Celest] - if (pc_checkskill(sd,BS_FINDINGORE)>0 && 1 >= rand()%1000) { + if (pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/100 >= rand()%1000) { struct delay_item_drop *ditem; int itemid[17] = { 714, 756, 757, 969, 984, 985, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1002 }; ditem=(struct delay_item_drop *)aCalloc(1,sizeof(struct delay_item_drop)); -- cgit v1.2.3-70-g09d2 From 5194d5ea2ad5bb067e044019ddc529907fb48e87 Mon Sep 17 00:00:00 2001 From: celest Date: Fri, 24 Dec 2004 07:30:41 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@773 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 2 ++ conf-tmpl/battle_athena.conf | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index b5ed7d6b2..6fd1dd767 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,8 @@ Date Added 12/24 * Added Dev/GDB_reports.txt, take a look in it devs [Ajarn] + * Corrected description for player_skill_nofootset and monster_skill_nofootset + in battle_athena.conf [celest] 12/23 * Fixed some bugs in the clif.c changes (SVN 766 to SVN 767) [MouseJstr] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 6d1d8f21e..93a427655 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -513,10 +513,12 @@ player_skill_reiteration: no //Whether or not, ground skills of the monsters' will pile up. (Note 1) monster_skill_reiteration: no -//Whether or not ground based skills of a certain type such as traps can be cast straight onto other players. (Note 1) +// Whether or not players can cast ground based skills of a certain type such as traps +// straight onto other players/monsters. (Note 1) player_skill_nofootset: yes -//Whether or not ground based skills of a certain type such as traps can be cast straight onto monsters. (Note 1) +// Whether or not monsters can cast ground based skills of a certain type such as traps +// straight onto players. (Note 1) monster_skill_nofootset: yes // When a player is cloaking, Whether the wall is checked or not. (Note 1) @@ -556,9 +558,6 @@ player_attack_direction_change: yes // Monsters's Direction Changed When Attacking? (Note 1) monster_attack_direction_change: yes -// If the player has Undead Elemental Equipment, should they be frozen or not. (Note 1) -player_undead_nofreeze: no - // Will Player Skills Stay Within Land Limit or not? (Note 1) player_land_skill_limit: yes -- cgit v1.2.3-70-g09d2 From 94034935b0ed5791c0b184b3da00b75ee3d96a0b Mon Sep 17 00:00:00 2001 From: ajarn Date: Mon, 27 Dec 2004 08:55:24 +0000 Subject: common vote git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@809 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 3 +++ conf-tmpl/battle_athena.conf | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 9ea499475..1b0e02e61 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,7 @@ Date Added +12/27 + * Changed the *_override_grffile to no by default, because many were having issues with it [Ajarn] + 12/26 * Fixed ANOTHER pet crash (double free) (SVN: 804) [MouseJstr] * Added a proper #define for MAX_VENDING (SVN: 802) [MouseJstr] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 93a427655..f96fe5403 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -11,7 +11,7 @@ // \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ // //-------------------------------------------------------------- -//eAthena Battle Configuration File +// eAthena Battle Configuration File // Made in to plainer english by Ancyker //-------------------------------------------------------------- //Note 1: Directives can be set using on/off, yes/no or 1/0. @@ -391,20 +391,20 @@ natural_heal_weight_rate: 50 // or if you're experiencing problems with GRF loading // // Override item names from GRF file? (Note 1) -item_name_override_grffile: yes +item_name_override_grffile: no // // Override item equip positions from GRF file? (Note 1) -item_equip_override_grffile: yes +item_equip_override_grffile: no // // Override item slots from GRF file? (Note 1) -item_slots_override_grffile: yes +item_slots_override_grffile: no // // Override 'indoors' mapflags from GRF file? (Note 1) -indoors_override_grffile: yes +indoors_override_grffile: no // // Override SP used per level from GRF file? (Note 1) // Turn this off if you have a customised skill_require_db.txt -skill_sp_override_grffile: yes +skill_sp_override_grffile: no // // Read card illustrations from GRF file? (Note 1) cardillust_read_grffile: yes -- cgit v1.2.3-70-g09d2 From 11cdf0d8533f6e27922f423ba645ddf0ff945c42 Mon Sep 17 00:00:00 2001 From: celest Date: Tue, 28 Dec 2004 04:45:26 +0000 Subject: * Updated description for player_check_cloak_type * Increased skill range limitations in pc_no_footset * Added exp_calc_type git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@831 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 4 +++ conf-tmpl/battle_athena.conf | 4 +-- src/map/battle.c | 2 ++ src/map/battle.h | 1 + src/map/mob.c | 62 +++++++++++++++++++++++++++----------------- src/map/skill.c | 2 +- 6 files changed, 48 insertions(+), 27 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index c375d4c66..ddab0bc2d 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Date Added 12/27 + * Updated description for player_check_cloak_type [celest] + * Increased skill range limitations in pc_no_footset [celest] + * Added exp_calc_type - to alternate between 3 different versions for exp + calculating [celest] * Reinitialized variable 'c' in map_readmap, it's supposed to have a start value. Ex. '-'. [MC Cameri] * Commented out dump_timer_heap() again... [MC Cameri] * Added include of string.h in malloc.c, was causing compile errors/warnings [MC Cameri] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index f96fe5403..a03d3ff81 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -522,8 +522,8 @@ player_skill_nofootset: yes monster_skill_nofootset: yes // When a player is cloaking, Whether the wall is checked or not. (Note 1) -// Note: When set to yes players can still cloak away from walls, but cannot move -// as well as receive movement penalties if the skill level is below 3. +// Note: When set to no players can always cloak away from walls and move around +// freely even if the skill level is below 3. player_cloak_check_type: yes // When a monster is cloaking, Whether the wall is checked or not. (Note 1) diff --git a/src/map/battle.c b/src/map/battle.c index 765ce9443..ea80e803c 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5308,6 +5308,7 @@ static const struct { { "motd_type", &battle_config.motd_type}, // [celest] { "allow_atcommand_when_mute", &battle_config.allow_atcommand_when_mute}, // [celest] { "finding_ore_rate", &battle_config.finding_ore_rate}, // [celest] + { "exp_calc_type", &battle_config.exp_calc_type}, // [celest] //SQL-only options start #ifndef TXT_ONLY @@ -5567,6 +5568,7 @@ void battle_set_defaults() { battle_config.finding_ore_rate = 100; battle_config.castrate_dex_scale = 150; battle_config.area_size = 14; + battle_config.exp_calc_type = 1; //SQL-only options start #ifndef TXT_ONLY diff --git a/src/map/battle.h b/src/map/battle.h index bd22b9341..021346294 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -356,6 +356,7 @@ extern struct Battle_Config { int motd_type; // [celest] int allow_atcommand_when_mute; // [celest] int finding_ore_rate; // orn + int exp_calc_type; #ifndef TXT_ONLY /* SQL-only options */ int mail_system; // [Valaris] diff --git a/src/map/mob.c b/src/map/mob.c index f9b049254..c6b772209 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2369,31 +2369,45 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) struct party *p; if(tmpsd[i]==NULL || tmpsd[i]->bl.m != md->bl.m || pc_isdead(tmpsd[i])) continue; -/* jAthena's exp formula - // per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./((double)max_hp) * dmg_rate; - per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./tdmg; - temp = ((double)mob_db[md->class].base_exp * (double)battle_config.base_exp_rate / 100. * per); - base_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp; - if(mob_db[md->class].base_exp > 0 && base_exp < 1) base_exp = 1; - if(base_exp < 0) base_exp = 0; - temp = ((double)mob_db[md->class].job_exp * (double)battle_config.job_exp_rate / 100. * per); - job_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp; - if(mob_db[md->class].job_exp > 0 && job_exp < 1) job_exp = 1; - if(job_exp < 0) job_exp = 0; -*/ -//eAthena's exp formula rather than jAthena's - per=(double)md->dmglog[i].dmg*256*(9+(double)((count > 6)? 6:count))/10/(double)max_hp; - if(per>512) per=512; - if(per<1) per=1; - base_exp=mob_db[md->class].base_exp*per/256; - - if(base_exp < 1) base_exp = 1; - if(sd && md && battle_config.pk_mode==1 && (mob_db[md->class].lv - sd->status.base_level >= 20)) { - base_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris] + + if (battle_config.exp_calc_type == 0) { + // jAthena's exp formula + // per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./((double)max_hp) * dmg_rate; + per = ((double)md->dmglog[i].dmg)*(9.+(double)((count > 6)? 6:count))/10./tdmg; + temp = (double)mob_db[md->class].base_exp * per; + base_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp; + if(mob_db[md->class].base_exp > 0 && base_exp < 1) base_exp = 1; + if(base_exp < 0) base_exp = 0; + temp = (double)mob_db[md->class].job_exp * per; + job_exp = (temp > 2147483647.)? 0x7fffffff:(int)temp; + if(mob_db[md->class].job_exp > 0 && job_exp < 1) job_exp = 1; + if(job_exp < 0) job_exp = 0; } - job_exp=mob_db[md->class].job_exp*per/256; - if(job_exp < 1) job_exp = 1; - if(sd && md && battle_config.pk_mode==1 && (mob_db[md->class].lv - sd->status.base_level >= 20)) { + else if (battle_config.exp_calc_type == 1) { + //eAthena's exp formula rather than jAthena's + per=(double)md->dmglog[i].dmg*256*(9+(double)((count > 6)? 6:count))/10/(double)max_hp; + if(per>512) per=512; + if(per<1) per=1; + base_exp=mob_db[md->class].base_exp*per/256; + if(base_exp < 1) base_exp = 1; + job_exp=mob_db[md->class].job_exp*per/256; + if(job_exp < 1) job_exp = 1; + } + else { + //eAthena's exp formula rather than jAthena's, but based on total damage dealt + per=(double)md->dmglog[i].dmg*256*(9+(double)((count > 6)? 6:count))/10/tdmg; + if(per>512) per=512; + if(per<1) per=1; + base_exp=mob_db[md->class].base_exp*per/256; + if(base_exp < 1) base_exp = 1; + job_exp=mob_db[md->class].job_exp*per/256; + if(job_exp < 1) job_exp = 1; + } + + if(sd && battle_config.pk_mode && (mob_db[md->class].lv - sd->status.base_level >= 20)) { + base_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris] + } + if(sd && battle_config.pk_mode && (mob_db[md->class].lv - sd->status.base_level >= 20)) { job_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris] } if(md->master_id || (md->state.special_mob_ai >= 1 && battle_config.alchemist_summon_reward != 1)) { // for summoned creatures [Valaris] diff --git a/src/map/skill.c b/src/map/skill.c index 1e1c373cb..711a89f76 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6717,7 +6717,7 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data ) case HT_TALKIEBOX: case PF_SPIDERWEB: /* スパイダ?ウェッブ */ case WZ_ICEWALL: - range = 1; + range = 2; break; case AL_WARP: range = 0; -- cgit v1.2.3-70-g09d2 From 7a6f7402e8247a298fe1e4666678036d44b37390 Mon Sep 17 00:00:00 2001 From: ajarn Date: Wed, 29 Dec 2004 07:33:50 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@855 54d463be-8e91-2dee-dedb-b68131a5f0ec --- conf-tmpl/battle_athena.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index a03d3ff81..ba93edf31 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -192,7 +192,7 @@ sp_rate: 100 // PVP exp. Do players get exp in PvP maps // (Note: NOT exp from players, but from normal leveling) -pvp_exp: no +pvp_exp: yes // When a player dies, how should we penalize them? // 0 = No penalty. -- cgit v1.2.3-70-g09d2 From 27ef242114cf8cca770a1d50db6c3c0f997367f2 Mon Sep 17 00:00:00 2001 From: celest Date: Wed, 5 Jan 2005 08:00:53 +0000 Subject: * Set 'droprate0item''s default to 'yes' * Look at item type other than item ID as well to check whether it is a card git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@911 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 4 ++++ conf-tmpl/battle_athena.conf | 2 +- src/map/script.c | 16 +++++++++------- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index e5759fc06..2c672e79a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Date Added 01/05 + * Set 'droprate0item''s default to 'yes' so that items with 0 rate will never + drop [celest] + * Look at item type other than item ID as well to check whether it is a card + in card-related script commands - better support for custom items [celest] * Reset all skill variables if the skill fails so certain skills can't be abused (such as Warp, thanks to Alex14 for pointing it out) [celest] * Added /mapflag/noreturn.txt for disabling butterfly wings (not fly wings) diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index ba93edf31..35d959261 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -176,7 +176,7 @@ item_rate_1000_min: 1000 item_rate_1000_max: 10000 // Can the monster's drop rate become 0? (Note 1) -drop_rate0item: no +drop_rate0item: yes // Rate at which exp. is given. (Note 2) base_exp_rate: 100 diff --git a/src/map/script.c b/src/map/script.c index dca1fbe12..22ae9f040 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5215,9 +5215,9 @@ int buildin_getequipcardcnt(struct script_state *st) return 0; } do{ - if( (sd->status.inventory[i].card[c-1] > 4000) && - (sd->status.inventory[i].card[c-1] < 5000)){ - + if( (sd->status.inventory[i].card[c-1] > 4000 && + sd->status.inventory[i].card[c-1] < 5000) || + itemdb_type(sd->status.inventory[i].card[c-1]) == 6){ // [Celest] push_val(st->stack,C_INT,(c)); return 0; } @@ -5244,8 +5244,9 @@ int buildin_successremovecards(struct script_state *st) return 0; } do{ - if( (sd->status.inventory[i].card[c-1] > 4000) && - (sd->status.inventory[i].card[c-1] < 5000)){ + if( (sd->status.inventory[i].card[c-1] > 4000 && + sd->status.inventory[i].card[c-1] < 5000) || + itemdb_type(sd->status.inventory[i].card[c-1]) == 6){ // [Celest] cardflag = 1; item_tmp.id=0,item_tmp.nameid=sd->status.inventory[i].card[c-1]; @@ -5297,8 +5298,9 @@ int buildin_failedremovecards(struct script_state *st) return 0; } do{ - if(( sd->status.inventory[i].card[c-1] > 4000) && - (sd->status.inventory[i].card[c-1] < 5000)){ + if( (sd->status.inventory[i].card[c-1] > 4000 && + sd->status.inventory[i].card[c-1] < 5000) || + itemdb_type(sd->status.inventory[i].card[c-1]) == 6){ // [Celest] cardflag = 1; -- cgit v1.2.3-70-g09d2 From 33c337fcfdde9e71a15b4f6856d1c22ce1b6a9bc Mon Sep 17 00:00:00 2001 From: celest Date: Fri, 7 Jan 2005 06:48:34 +0000 Subject: * Added Filougarou's fix for Bowling Bash causing it to only display damage * Set delay_dependon_dex in battle_athena to 'no' by default * Fixed typo in skill_delayfix git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@927 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 11 +++++++++++ conf-tmpl/battle_athena.conf | 3 ++- src/map/skill.c | 27 ++++++++++----------------- 3 files changed, 23 insertions(+), 18 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 76d10d4dc..89d36d8b9 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,15 @@ Date Added +01/07 + * Added Filougarou's fix for Bowling Bash causing it to only display damage, + but doesn't do any - thanks! [celest] + * Set delay_dependon_dex in battle_athena to 'no' by default [celest] + + Note: Just to clarify things, on official servers dex is not supposed to + reduce skill delays, only Poem of Bragi and Berzebub card does! + + * Fixed typo in skill_delayfix - reduce delays only if delaynodex was *not* set, + sorry ^^; [celest] + 01/06 * Fixed various memory corruptions causing crashes (SVN 925) [MouseJstr] * Fixed typo in src/map/map.c causing compile diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 35d959261..42ae8e306 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -43,7 +43,8 @@ casting_rate: 100 delay_rate: 100 // Is the delay time is dependent on the caster's DEX? (Note 1) -delay_dependon_dex: yes +// Note: On Official servers Dex does NOT affect delay time +delay_dependon_dex: no // At what dex does the cast time become zero (instacast) castrate_dex_scale: 150 diff --git a/src/map/skill.c b/src/map/skill.c index 57a66cc08..c767d9f15 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1781,7 +1781,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds map_freeblock_lock(); /* ?際にダメ?ジ?理を行う */ - if(skillid != KN_BOWLINGBASH || flag) + if(skillid || flag) battle_damage(src,bl,damage,0); if(skillid == RG_INTIMIDATE && damage > 0 && !(battle_get_mode(bl)&0x20) && !map[src->m].flag.gvg ) { int s_lv = battle_get_lv(src),t_lv = battle_get_lv(bl); @@ -1863,7 +1863,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds if(hp || sp) pc_heal(sd,hp,sp); } - if((skillid != KN_BOWLINGBASH || flag) && rdamage > 0) + if((skillid || flag) && rdamage > 0) battle_damage(bl,src,rdamage,0); if(attack_type&BF_WEAPON && sc_data && sc_data[SC_AUTOCOUNTER].timer != -1 && sc_data[SC_AUTOCOUNTER].val4 > 0) { @@ -7408,9 +7408,7 @@ int skill_castfix( struct block_list *bl, int time ) nullpo_retr(0, md=(struct mob_data*)bl); skill = md->skillid; lv = md->skilllv; - } - - else { + } else { nullpo_retr(0, sd=(struct map_session_data*)bl); skill = sd->skillid; lv = sd->skilllv; @@ -7470,12 +7468,17 @@ int skill_delayfix( struct block_list *bl, int time ) sc_data = battle_get_sc_data(bl); + // instant cast attack skills depend on aspd as delay [celest] + if (time <= 0 && skill_db[skill].skill_type == BF_WEAPON) + time = battle_get_adelay (bl)/2; + if(sd) { if(battle_config.delay_dependon_dex && /* dexの影響を計算する */ - skill_get_delaynodex(skill, lv) > 0) + !skill_get_delaynodex(skill, lv)) // if skill casttime is allowed to be reduced by dex time=time*(battle_config.castrate_dex_scale - battle_get_dex(bl))/battle_config.castrate_dex_scale; - time=time*battle_config.delay_rate/100; } + + time=time*battle_config.delay_rate/100; /* ブラギの詩 */ if(sc_data && sc_data[SC_POEMBRAGI].timer!=-1 ) @@ -7807,11 +7810,6 @@ int skill_use_id( struct map_session_data *sd, int target_id, if( casttime<=0 ) /* 詠唱の無いものはキャンセルされない */ sd->state.skillcastcancel=0; - // instant cast attack skills depend on aspd as delay [celest] - if (delay <= 0 && skill_db[skill_num].skill_type == BF_WEAPON) { - delay = (battle_get_adelay (&sd->bl)/2) * battle_config.delay_rate / 100; - } - sd->skilltarget = target_id; /* sd->cast_target_bl = bl; */ sd->skillx = 0; @@ -7953,11 +7951,6 @@ int skill_use_pos( struct map_session_data *sd, if( casttime<=0 ) /* 詠唱の無いものはキャンセルされない */ sd->state.skillcastcancel=0; - // instant cast attack skills depend on aspd as delay [celest] - if (delay <= 0 && skill_db[skill_num].skill_type == BF_WEAPON) { - delay = (battle_get_adelay (&sd->bl)/2) * battle_config.delay_rate / 100; - } - sd->skilltarget = 0; /* sd->cast_target_bl = NULL; */ tick=gettick(); -- cgit v1.2.3-70-g09d2 From 689ff4485443705d31f896d057e2cc6701f7b612 Mon Sep 17 00:00:00 2001 From: celest Date: Tue, 11 Jan 2005 10:57:57 +0000 Subject: * Added support for 2005-01-10Sakexe * Updated packet functions for 2004-11-08 and 2004-12-06 * REMOVED support for clients before packet version 10 * Added a check to prevent crashing when trying to log in with 2005-01-10aSakexe in servers that don't support it git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@951 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 11 +++ conf-tmpl/battle_athena.conf | 22 +++--- db/packet_db.txt | 21 ++++- src/map/battle.c | 6 +- src/map/clif.c | 182 ++++++++++++++++++++++++++++++++++++++----- 5 files changed, 207 insertions(+), 35 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index c42ce1f97..42774b03e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,11 +1,22 @@ Date Added 01/11 + * Added support for 2005-01-10Sakexe [celest] + * Updated packet functions for 2004-11-08 and 2004-12-06 (Note: eA *can* + support 12-06, but still doesn't recognise it... so unless we find a way, + it is *not* supported yet) [celest] + * Updated packet_db, thanks to Sara-chan [celest] + * REMOVED support for clients before packet version 10 (2004-08-25 and + earlier) - the client will receive a 'Game Exe not latest version' message + [celest] + * Added a check to prevent crashing when trying to log in with + 2005-01-10aSakexe in servers that don't support it [celest] * Added a fix to @sound where if you forgot the .wav exention, i'd attempt to play the file without it (it adds the .wav) [Codemaster] [SVN 949] * Added @disguiseall / @undisguiseall [Codemaster] [SVN 949] * Added misc. clif.c fixes (jAthena added alot of close(fd)'s, so i added them, too) [Codemaster] [SVN 949] * Added bug reports - Celest, you might want to check one of those out [Codemaster] [SVN 949] * Fixed a bug in clif.c which didn't allow to enther the map-server. It worked under win32, but didn't under Linux. [Lupus] + 01/10 * Completed adding packet DB reading... still needs (a lot) more work in clif.c [celest] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 42ae8e306..9f7bd11a8 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -766,17 +766,17 @@ hack_info_GM_level: 60 any_warp_GM_min_level: 20 // Set here which client version do you accept. Add all values of clients: -// 1: Clients before 2004-07-06 (old clients) -// 2: 2004-07-06 kRO client -// 4: 2004-07-13 kRO client -// 8: 2004-07-26 kRO client -// 16: 2004-08-09 kRO / 2004-08-16aSakray / 2004-08-17aSakray client -// 32: 2004-09-06aSakray client -// 64: 2004-09-21aSakray Client -// 128: 2004-10-18bSakexe Client -// 256: 2004-10-25aSakexe Client -// default value: 511 (all clients) -packet_ver_flag: 511 +// Clients older than accepted versions, and versions not set to 'accepted' +// here will be rejected when logging in +// 1: 2004-09-06aSakray client +// 2: 2004-09-21aSakray Client +// 4: 2004-10-18bSakexe Client +// 8: 2004-10-25aSakexe Client +// 16: 2004-11-01aSakexe Client +// 32: 2004-12-06aSakexe Client +// 64: 2005-01-10aSakexe Client +// default value: 127 (all clients) +packet_ver_flag: 127 // Allow GMs to mute players or not? muting_players: no diff --git a/db/packet_db.txt b/db/packet_db.txt index 136899fb1..8746462f0 100644 --- a/db/packet_db.txt +++ b/db/packet_db.txt @@ -603,4 +603,23 @@ packet_db_ver: 16 0x0222,6 0x0221,-1 0x021d,6 -0x0223,8 \ No newline at end of file +0x0223,8 + +//2005-01-10bSakexe by Sara +0x009b,32,wanttoconnection,3:12:23:27:31 +0x0089,9,ticksend,5 +0x00a7,13,walktoxy,10 +0x0190,20,actionrequest,9:19 +0x00f3,-1,globalmessage,2:4 +0x008c,8,getcharnamerequest,4 +0x0085,23,changedir,12:22 +0x0094,20,movetokafra,10:16 +0x0193,2,closekafra,0 +0x00f7,21,movefromkafra,11:17 +0x009f,17,useitem,5:13 +0x0116,20,dropitem,15:18 +0x00f5,9,takeitem,5 +0x0113,34,useskilltopos,10:18:22:32 +0x0072,26,useskilltoid,8:16:22 +0x007e,114,useskilltopos,9:18:22:32:34 +0x00a2,11,solvecharname,7 \ No newline at end of file diff --git a/src/map/battle.c b/src/map/battle.c index b442405b3..3cff73a18 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5570,7 +5570,7 @@ void battle_set_defaults() { battle_config.ban_spoof_namer = 5; // added by [Yor] (default: 5 minutes) battle_config.hack_info_GM_level = 60; // added by [Yor] (default: 60, GM level) battle_config.any_warp_GM_min_level = 20; // added by [Yor] - battle_config.packet_ver_flag = 511; // added by [Yor] + battle_config.packet_ver_flag = 127; // added by [Yor] battle_config.min_hair_style = 0; battle_config.max_hair_style = 20; battle_config.min_hair_color = 0; @@ -5708,8 +5708,8 @@ void battle_validate_conf() { battle_config.any_warp_GM_min_level = 100; // at least 1 client must be accepted - if ((battle_config.packet_ver_flag & 511) == 0) // added by [Yor] - battle_config.packet_ver_flag = 511; // accept all clients + if ((battle_config.packet_ver_flag & 127) == 0) // added by [Yor] + battle_config.packet_ver_flag = 127; // accept all clients if (battle_config.night_darkness_level > 10) // Celest battle_config.night_darkness_level = 10; diff --git a/src/map/clif.c b/src/map/clif.c index f596b3020..bb91da6fa 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7310,7 +7310,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) else account_id = RFIFOL(fd,12); // 0xF5 - } else { + } else if (RFIFOW(fd,0) == 0xF5) { //printf("Received bytes %d with packet 0xF5.\n", RFIFOREST(fd)); if (RFIFOREST(fd) >= 34 && (RFIFOB(fd,33) == 0 || RFIFOB(fd,33) == 1)) // 00 = Female, 01 = Male account_id = RFIFOL(fd,7); @@ -7320,6 +7320,9 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) account_id = RFIFOL(fd,10); else // 29 28 28 account_id = RFIFOL(fd,5); + // 0x9B + } else { + account_id = RFIFOL(fd,3); } // if same account already connected, we disconnect the 2 sessions @@ -7354,7 +7357,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) pc_setnewpc(sd, account_id, RFIFOL(fd,18), RFIFOL(fd,24), RFIFOL(fd,28), RFIFOB(fd,32), fd); } // 0xF5 - } else { + } else if (RFIFOW(fd,0) == 0xF5) { if (RFIFOREST(fd) >= 34 && (RFIFOB(fd,33) == 0 || RFIFOB(fd,33) == 1)) { // 00 = Female, 01 = Male sd->packet_ver = 10; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) pc_setnewpc(sd, account_id, RFIFOL(fd,15), RFIFOL(fd,25), RFIFOL(fd,29), RFIFOB(fd,33), fd); @@ -7368,6 +7371,10 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) sd->packet_ver = 13; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) pc_setnewpc(sd, account_id, RFIFOL(fd,14), RFIFOL(fd,20), RFIFOL(fd,24), RFIFOB(fd,28), fd); } + // 0x9B + } else { + sd->packet_ver = 16; // 16: 10jan05 + pc_setnewpc(sd, account_id, RFIFOL(fd,12), RFIFOL(fd,23), RFIFOL(fd,27), RFIFOB(fd,31), fd); } WFIFOL(fd,0) = sd->bl.id; @@ -7563,8 +7570,16 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) { sd->client_tick = RFIFOL(fd,6); break; case 13: + case 14: + sd->client_tick = RFIFOL(fd,5); + break; + case 15: + sd->client_tick = RFIFOL(fd,3); + break; + case 16: sd->client_tick = RFIFOL(fd,5); break; + default: // old version by default (and version 6 + 7) sd->client_tick = RFIFOL(fd,2); break; @@ -7648,9 +7663,18 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { y = ((RFIFOB(fd,4) & 0x3f) << 4) + (RFIFOB(fd,5) >> 4); break; case 13: + case 14: x = RFIFOB(fd,3) * 4 + (RFIFOB(fd,4) >> 6); y = ((RFIFOB(fd,4) & 0x3f) << 4) + (RFIFOB(fd,5) >> 4); break; + case 15: + x = RFIFOB(fd,4) * 4 + (RFIFOB(fd,5) >> 6); + y = ((RFIFOB(fd,5) & 0x3f) << 4) + (RFIFOB(fd,6) >> 4); + break; + case 16: + x = RFIFOB(fd,10) * 4 + (RFIFOB(fd,11) >> 6); + y = ((RFIFOB(fd,11) & 0x3f) << 4) + (RFIFOB(fd,12) >> 4); + break; default: // old version by default x = RFIFOB(fd,2) * 4 + (RFIFOB(fd,3) >> 6); y = ((RFIFOB(fd,3) & 0x3f) << 4) + (RFIFOB(fd,4) >> 4); @@ -7716,8 +7740,15 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { account_id = RFIFOL(fd,11); break; case 13: + case 14: account_id = RFIFOL(fd,6); break; + case 15: + account_id = RFIFOL(fd,9); + break; + case 16: + account_id = RFIFOL(fd,4); + break; default: // old version by default (+ packet version 6 and 7) account_id = RFIFOL(fd,2); break; @@ -8004,9 +8035,19 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) { dir = RFIFOB(fd,12); break; case 13: + case 14: headdir = RFIFOW(fd,6); dir = RFIFOB(fd,14); break; + case 15: + headdir = RFIFOW(fd,3); + dir = RFIFOB(fd,7); + break; + case 16: + headdir = RFIFOW(fd,12); + dir = RFIFOB(fd,22); + break; + default: // old version by default (and packet version 6) headdir = RFIFOW(fd,2); dir = RFIFOB(fd,4); @@ -8099,9 +8140,19 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) { action_type = RFIFOB(fd,8); break; case 13: + case 14: target_id = RFIFOL(fd,4); action_type = RFIFOB(fd,14); break; + case 15: + target_id = RFIFOL(fd,6); + action_type = RFIFOB(fd,17); + break; + case 16: + target_id = RFIFOL(fd,9); + action_type = RFIFOB(fd,19); + break; + default: // old version by default (and packet version 6 and 7) target_id = RFIFOL(fd,2); action_type = RFIFOB(fd,6); @@ -8290,6 +8341,13 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) { map_object_id = RFIFOL(fd,6); break; case 13: + case 14: + map_object_id = RFIFOL(fd,5); + break; + case 15: + map_object_id = RFIFOL(fd,3); + break; + case 16: map_object_id = RFIFOL(fd,5); break; default: // old version by default (and packet version 6) @@ -8357,9 +8415,18 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) { item_amount = RFIFOW(fd,12); break; case 13: + case 14: item_index = RFIFOW(fd,6) - 2; item_amount = RFIFOW(fd,10); break; + case 15: + item_index = RFIFOW(fd,4) - 2; + item_amount = RFIFOW(fd,10); + break; + case 16: + item_index = RFIFOW(fd,15) - 2; + item_amount = RFIFOW(fd,18); + break; default: // old version by default (+ packet version 6 and 7) item_index = RFIFOW(fd,2) - 2; item_amount = RFIFOW(fd,4); @@ -8413,6 +8480,13 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) { pc_useitem(sd,RFIFOW(fd,6)-2); break; case 13: + case 14: + pc_useitem(sd,RFIFOW(fd,5)-2); + break; + case 15: + pc_useitem(sd,RFIFOW(fd,3)-2); + break; + case 16: pc_useitem(sd,RFIFOW(fd,5)-2); break; default: // old version by default @@ -8799,10 +8873,21 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { target_id = RFIFOL(fd,16); break; case 13: + case 14: skilllv = RFIFOW(fd,4); skillnum = RFIFOW(fd,10); target_id = RFIFOL(fd,22); break; + case 15: + skilllv = RFIFOW(fd,8); + skillnum = RFIFOW(fd,12); + target_id = RFIFOL(fd,18); + break; + case 16: + skilllv = RFIFOW(fd,8); + skillnum = RFIFOW(fd,16); + target_id = RFIFOL(fd,22); + break; default: // old version by default skilllv = RFIFOW(fd,2); skillnum = RFIFOW(fd,4); @@ -8936,6 +9021,7 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) { skillmoreinfo = 23; break; case 13: + case 14: skilllv = RFIFOW(fd,6); skillnum = RFIFOW(fd,9); x = RFIFOW(fd,23); @@ -8943,6 +9029,22 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) { if (RFIFOW(fd,0) == 0x08c) skillmoreinfo = 28; break; + case 15: + skilllv = RFIFOW(fd,4); + skillnum = RFIFOW(fd,9); + x = RFIFOW(fd,22); + y = RFIFOW(fd,28); + if (RFIFOW(fd,0) == 0x113) + skillmoreinfo = 30; + break; + case 16: + skilllv = RFIFOW(fd,9); + skillnum = RFIFOW(fd,18); + x = RFIFOW(fd,22); + y = RFIFOW(fd,32); + if (RFIFOW(fd,0) == 0x07e) + skillmoreinfo = 34; + break; default: // old version by default skilllv = RFIFOW(fd,2); skillnum = RFIFOW(fd,4); @@ -9174,8 +9276,15 @@ void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { char_id = RFIFOL(fd,8); break; case 13: + case 14: char_id = RFIFOL(fd,12); break; + case 15: + char_id = RFIFOL(fd,10); + break; + case 16: + char_id = RFIFOL(fd,7); + break; default: // old version by default (+ packet version 6 and 7) char_id = RFIFOL(fd,2); break; @@ -9256,9 +9365,18 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) { item_amount = RFIFOL(fd,12); break; case 13: + case 14: item_index = RFIFOW(fd,6) - 2; item_amount = RFIFOL(fd,9); break; + case 15: + item_index = RFIFOW(fd,4) - 2; + item_amount = RFIFOL(fd,10); + break; + case 16: + item_index = RFIFOW(fd,10) - 2; + item_amount = RFIFOL(fd,16); + break; default: // old version by default (+ packet version 6 and 7) item_index = RFIFOW(fd,2) - 2; item_amount = RFIFOL(fd,4); @@ -9308,9 +9426,18 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) { item_amount = RFIFOL(fd,22); break; case 13: + case 14: item_index = RFIFOW(fd,12) - 1; item_amount = RFIFOL(fd,18); break; + case 15: + item_index = RFIFOW(fd,4) - 1; + item_amount = RFIFOL(fd,17); + break; + case 16: + item_index = RFIFOW(fd,11) - 1; + item_amount = RFIFOL(fd,17); + break; default: // old version by default (+ packet version 6 and 7) item_index = RFIFOW(fd,2) - 1; item_amount = RFIFOL(fd,4); @@ -10364,58 +10491,73 @@ static int clif_parse(int fd) { // 0x72 if (cmd == 0x72) { if (RFIFOREST(fd) >= 39 && (RFIFOB(fd,38) == 0 || RFIFOB(fd,38) == 1)) // 00 = Female, 01 = Male - packet_ver = 7; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 7; // 7: 13july04 else if (RFIFOREST(fd) >= 22 && (RFIFOB(fd,21) == 0 || RFIFOB(fd,21) == 1)) // 00 = Female, 01 = Male - packet_ver = 6; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 6; // 6: 7july04 else if (RFIFOREST(fd) >= 19 && (RFIFOB(fd,18) == 0 || RFIFOB(fd,18) == 1)) // 00 = Female, 01 = Male - packet_ver = 5; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 5; // 5: old // else probably incomplete packet else if (RFIFOREST(fd) < 19) return 0; // 0x7E } else if (cmd == 0x7E) { if (RFIFOREST(fd) >= 37 && (RFIFOB(fd,36) == 0 || RFIFOB(fd,36) == 1)) // 00 = Female, 01 = Male - packet_ver = 9; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 9; // 9: 9aug04/16aug04/17aug04 else if (RFIFOREST(fd) >= 33 && (RFIFOB(fd,32) == 0 || RFIFOB(fd,32) == 1)) // 00 = Female, 01 = Male - packet_ver = 8; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 8; // 8: 26july04 // else probably incomplete packet else if (RFIFOREST(fd) < 33) return 0; // 0xF5 - } else { + } else if (cmd == 0xF5) { if (RFIFOREST(fd) >= 34 && (RFIFOB(fd,33) == 0 || RFIFOB(fd,33) == 1)) // 00 = Female, 01 = Male - packet_ver = 10; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 10; // 10: 6sept04 else if (RFIFOREST(fd) >= 33 && (RFIFOB(fd,32) == 0 || RFIFOB(fd,32) == 1)) // 00 = Female, 01 = Male - packet_ver = 12; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 12; // 12: 18oct04 else if (RFIFOREST(fd) >= 32 && (RFIFOB(fd,31) == 0 || RFIFOB(fd,31) == 1)) // 00 = Female, 01 = Male - packet_ver = 11; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 11; // 11: 21sept04 else if (RFIFOREST(fd) >= 29 && (RFIFOB(fd,28) == 0 || RFIFOB(fd,28) == 1)) // 00 = Female, 01 = Male - packet_ver = 13; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + packet_ver = 13; // 13: 25oct04 (by [Yor]) + // -- some way to identify version 14 and 15? -- // else probably incomplete packet else if (RFIFOREST(fd) < 29) return 0; + // 0x9B + } else if (cmd == 0x9B) { + if (RFIFOREST(fd) >= 32 && (RFIFOB(fd,31) == 0 || RFIFOB(fd,31) == 1)) // 00 = Female, 01 = Male + packet_ver = 16; // 16: 10jan05 + else if (RFIFOREST(fd) < 32) + return 0; + } else { + // unknown client? leave packet ver as 0 so it'll disconnect anyway } // check if version is accepted - if ((packet_ver == 5 && (battle_config.packet_ver_flag & 1) == 0) || + if (packet_ver <= 9 || // reject any client versions older than 6sept04 +/* if (packet_ver < 5 || + (packet_ver == 5 && (battle_config.packet_ver_flag & 1) == 0) || (packet_ver == 6 && (battle_config.packet_ver_flag & 2) == 0) || (packet_ver == 7 && (battle_config.packet_ver_flag & 4) == 0) || (packet_ver == 8 && (battle_config.packet_ver_flag & 8) == 0) || - (packet_ver == 9 && (battle_config.packet_ver_flag & 16) == 0) || - (packet_ver == 10 && (battle_config.packet_ver_flag & 32) == 0) || - (packet_ver == 11 && (battle_config.packet_ver_flag & 64) == 0) || - (packet_ver == 12 && (battle_config.packet_ver_flag & 128) == 0) || - (packet_ver == 13 && (battle_config.packet_ver_flag & 256) == 0)) { + (packet_ver == 9 && (battle_config.packet_ver_flag & 16) == 0) ||*/ + (packet_ver == 10 && (battle_config.packet_ver_flag & 1) == 0) || + (packet_ver == 11 && (battle_config.packet_ver_flag & 2) == 0) || + (packet_ver == 12 && (battle_config.packet_ver_flag & 4) == 0) || + (packet_ver == 13 && (battle_config.packet_ver_flag & 8) == 0) || + (packet_ver == 14 && (battle_config.packet_ver_flag & 16) == 0) || + (packet_ver == 15 && (battle_config.packet_ver_flag & 32) == 0) || + (packet_ver == 16 && (battle_config.packet_ver_flag & 64) == 0) || + packet_ver > 16) { // no support yet WFIFOW(fd,0) = 0x6a; WFIFOB(fd,2) = 5; // 05 = Game's EXE is not the latest version WFIFOSET(fd,23); + close(fd); session[fd]->eof = 1; return 0; } } // ゲーム用以外パケットか、認証を終える前に0072以外が来たら、切断する - if (packet_ver < 5 || packet_ver > 13 || // if packet is not inside these values: session is incorrect?? or auth packet is unknown - cmd >= MAX_PACKET_DB || packet_size_table[packet_ver-5][cmd] == 0) { + if (cmd >= MAX_PACKET_DB || packet_size_table[packet_ver-5][cmd] == 0) { // if packet is not inside these values: session is incorrect?? or auth packet is unknown if (!fd) return 0; close(fd); -- cgit v1.2.3-70-g09d2 From 2c5fabbc0b492cb5456e670ce9eb2352a11d5e3b Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> Date: Sun, 23 Jan 2005 20:38:44 +0000 Subject: update git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@968 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 138 +++++++ Dev/bugs.txt | 8 +- conf-tmpl/battle_athena.conf | 4 + db/packet_db.txt | 318 ++++++++------- db/skill_cast_db.txt | 2 +- npc/mobs/fields/yuno.txt | 170 +++++--- sql-files/database.sql | 3 - sql-files/mail.sql | 2 - src/char/char.c | 120 +++--- src/char/char.h | 6 +- src/char/int_guild.c | 24 +- src/char/int_party.c | 8 +- src/char/int_pet.c | 8 +- src/char/int_storage.c | 16 +- src/char/inter.c | 12 +- src/char_sql/char.c | 96 ++--- src/char_sql/char.h | 6 +- src/char_sql/int_guild.c | 196 ++++----- src/char_sql/int_party.c | 2 +- src/char_sql/int_pet.c | 2 +- src/char_sql/int_storage.c | 4 +- src/char_sql/inter.c | 4 +- src/char_sql/itemdb.c | 8 +- src/char_sql/itemdb.h | 2 +- src/common/core.c | 1 + src/common/db.c | 6 +- src/common/grfio.c | 68 ++-- src/common/grfio.h | 4 +- src/common/malloc.c | 23 +- src/common/malloc.h | 20 + src/common/mmo.h | 32 +- src/common/showmsg.c | 5 +- src/common/socket.c | 64 +-- src/common/socket.h | 3 +- src/common/strlib.c | 22 +- src/common/strlib.h | 6 +- src/common/timer.c | 10 +- src/common/utils.c | 9 +- src/common/utils.h | 6 + src/ladmin/ladmin.c | 10 +- src/login/login.c | 90 +++-- src/login/login.h | 2 +- src/login_sql/login.c | 26 +- src/login_sql/login.h | 2 +- src/map/atcommand.c | 164 ++++---- src/map/atcommand.h | 10 +- src/map/battle.c | 169 +++++--- src/map/battle.h | 7 +- src/map/charcommand.c | 4 +- src/map/chat.c | 6 +- src/map/clif.c | 388 ++++++++++-------- src/map/clif.h | 14 +- src/map/guild.c | 36 +- src/map/guild.h | 2 +- src/map/intif.c | 10 +- src/map/intif.h | 2 +- src/map/itemdb.c | 14 +- src/map/mail.c | 56 +-- src/map/map.c | 195 ++++----- src/map/map.h | 11 +- src/map/mob.c | 636 +++++++++++++++--------------- src/map/mob.h | 6 +- src/map/npc.c | 226 +++++------ src/map/party.c | 2 +- src/map/pc.c | 246 ++++++++---- src/map/pet.c | 4 +- src/map/script.c | 240 +++++------ src/map/skill.c | 536 ++++++++++++++++++------- src/map/skill.h | 15 +- src/map/storage.c | 12 +- src/map/vending.c | 6 +- src/txt-converter/char/char-converter.c | 106 ++--- src/txt-converter/char/char.h | 6 +- src/txt-converter/common/mmo.h | 10 +- src/txt-converter/login/login-converter.c | 8 +- 75 files changed, 2740 insertions(+), 1975 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 6c019b932..4defcf648 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,142 @@ Date Added + +01/23 + * Forgot a couple small changes [SVN 35] [Ajarn] + * Changed map_data.gat and map_data_other_server.gat from unsigned char* + to char* (this might be needed, because of unicode or something, please + correct me if I'm wrong) [SVN 34] [Ajarn] + * Converted decode_zip, enconde_zip, remove_control_chars, mapif_sendall*, + and e_mail_check to use char* instead of unsigned char* (again, please test) + [SVN 34] [Ajarn] + * Modified skill unit group checking in skill_unit_onplace that might have + been causing crashes [celest] + * Updated packet 0x143 length's for version 14 (2004-11-01Sakexe) and version + 16 (2005-01-10Sakexe), thanks to jathena and ice2big [celest] + * Fixed login-server compile error with the "new" -> "new_" changes [celest] + +01/22 + * Fixed an error that was in my last commit (optimising g++ build) [SVN 29] + [Ajarn] + * Made strlib functions char*, instead of unsigned char*. Strings are meant + to be char. (Shouldn't break anyhting, but might, please test this for me) + [SVN 26] [Ajarn] + * Added cast for TXT version [SVN 25] [Ajarn] + * Added cast from allocation calls, from void* to intended type [SVN 24] [Ajarn] + * Changed bool -> bool_. Still need to make convertions between + char* and unsigned char* valid, and some other convertions too. + Also, sizeof is being used wierd in map.c, at least g++ + complains [SVN 22] [Ajarn] + * Changed the rest of the class variable names to class_ and all the new + variable names to new_, for futher g++ support [SVN 21] [Ajarn] + * Update both caster and target's SP after using Soul Change -- thanks to Aalye + / Freya [celest] + * Force a monster to switch attack target when being casted Provoke [celest] + * Corrected description for @enablenpc -- "@npcon" -> "@enablenpc" [celest] + * Since job normalising is still buggy require all 1st class skills to check + for Basic Skill level when calculating the skill tree [celest] + +01/21 + * Updated packet DB configurations : enable_packet_db, packet_db_ver, + -- check the .txt for description [celest] + + Note: For people having connection problems try setting 'enable_packet_db' + to 'no'... and use the latest client (01-10Sakexe) + + * Fixed a small typo in 12-06's packets -- 21b => 21d [celest] + * Updated packet_db.txt to only contain the latest version, like jAthena, + since there's not much point to re-read packets eA already supports + (although if you remove all the //'s it can still read multiple versions) + [celest] + * Added clif_config in clif.c - for keeping packet/client connections related + stuff [celest] + * Send 'Game Exe not latest version' to a client if it hasn't been authentified + yet, but is sending a non-connection-related packet to prevent crashing + -- assume the client is using an unknown exe [celest] + +01/20 + * Fixed compile time problems with the non-GC case [MouseJstr] + * Introduced aMallocA and aCallocA + + These two functions allocate "atomic" memory which means + "memory that does not contain references to other memory". + + This lets the garbage collector ignore these objects when searching + memory for references to other objects dramatically increasing + performance of the GC. + + When in doubt, use aMalloc and aCalloc. It is better to add + a tiny bit of work to the GC then do cause a crash due to memory + being cleaned up when it shouldn't. + [MouseJstr] + * Modified all calls to aMalloc and aCalloc that reference + atomic memory to use aMallocA and aCallocA + [MouseJstr] + * Modified the socket buffer allocator to use "atomic" memory + for the fifo data buffers [MouseJstr] +01/19 + * added support for the Hans-J. Boehm libC garbage collector + (A copy is in http://amber.stormbirds.org/~joshs/gc6.3.tar). + + It is ABSOLUTELY critical for people to use + aFree/aMalloc/aCalloc/aStrdup for this to work. If somebody + has just used free or malloc, this will crash when used with + the garbage collector. + + A amusing environmental variable to set is GC_PRINT_STATS (to 1) + so that you see real time statistics of leaked data being + recovered. + + grab a copy of the gc6.3.tar.. build it .. install it.. + modify the Makefile to have the + + CC = gcc -pipe -DGCOLLECT + GCLIB = -lgc + + lines... and make the sql servers (the txt server doesn't + build using this right now due to stupid Makefile issues) + + [MouseJstr] + * SVN 3 on http://svn.stormbirds.org/svn/eathena will be what + I diff against when I merge back into delta.. if we ever merge + back into delta [MouseJstr] + * Removed 12-06 Sakexe detection, since it doesn't seem to work, and + might be conflicting with 10-25 clients [celest] + * Update the Soul Burn target's SP when it has been successfully reduced to 0, + thanks to Aalye / Freya [celest] + * Moved SC_PRESERVE and SC_BATTLEORDERS's id so they'll display a status icon + when cast, thanks XiaoLin of cAthena [celest] + * Added missing code for Preserve -- i totally forgot to add it ^^; [celest] + +01/18 + * Added some skill bug fixes, thanks to Aalye / Freya [celest] + - stop player attacking if the target goes into hiding + - fixed Sword Reject not working against swords, only daggers + - additional check in case Marionette Control doesn't end properly even + when one of the partners has logged off + * Added stun, bleeding and SP loss effect for Pressure, thanks to DracoRpg + [celest] + * TEST: Fixed more compile warnings in MSVC [celest] + * TEST: Fixed some compile errors in MS Visual C++, thanks to Ser [celest] + +01/17 + * Some rewrites in skill_delayfix [celest] + - If the delay is < 0, add the weapon aspd delay to it + - If the skill is not weapon type, and has 0 delay, add 300ms as default + * Added min_skill_delay_limit as the minimum allowed delay for any skills + [celest] + * Some tidying up in battle_get_ functions [celest] + * Set exp table and job bonus table to 0 before reading - might solve some + memory bugs [celest] + * Updated skill range leniency code - If possible try and move towards the + skill target so that when casting it no longer falls out of range [celest] + +01/15 + * Added effects to enemies for Gospel [celest] + * Added mobs spawn to all Yuno fields (according to 4th Jan patch) [Lupus] + +01/14 + * Added party supporting effects for Gospel [celest] + 01/13 * Added and testing support for 2004-12-06Sakexe [celest] * Removed emblem changing requiring Glory of Guild limited to TXT only [celest] diff --git a/Dev/bugs.txt b/Dev/bugs.txt index bc85d6272..a1108f3a3 100644 --- a/Dev/bugs.txt +++ b/Dev/bugs.txt @@ -221,9 +221,7 @@ Problem: Berzebub, etc cards don't decrease aftercast delays Assigned: N/A Progress: 0% -Problem: Some clients that are able to log into eAthena servers properly are not able to when custom items are used. - I believe Celest may have accidentially "broken" a few things when she was attempting to create new packet - compatibility and removed old ones. +Problem: Older Clients are unable to log into the server, period. + Even if the packet_db is set to use the older clients, they still are unable to connect. Assigned: Celest -Progress: 0% - Celest: What version was the client using? \ No newline at end of file +Progress: 0% \ No newline at end of file diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 9f7bd11a8..35b20f7d9 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -46,6 +46,10 @@ delay_rate: 100 // Note: On Official servers Dex does NOT affect delay time delay_dependon_dex: no +// Minimum allowed delay for ANY skills after casting (in miliseconds) (Note 1) +// Note: Setting this to anything above 0 can stop speedhacks. +min_skill_delay_limit: 100 + // At what dex does the cast time become zero (instacast) castrate_dex_scale: 150 diff --git a/db/packet_db.txt b/db/packet_db.txt index 28ae52fee..95591eacf 100644 --- a/db/packet_db.txt +++ b/db/packet_db.txt @@ -1,11 +1,23 @@ // The packet database allows you to add support for new clients, -// because packets change every release. -// This only allows 1 type of client at a time, make sure your +// because packets change every release. +// By default this only allows 1 type of client at a time, make sure your // client is the last one in the list // EX: You have client 628 and it goes up to 1021, // delete or comment (use //) till your client is last. -packet_ver: 5 + +// Whether to allow identifying clients via the packet DB +enable_packet_db: yes + +// Main packet version of the DB (default = Auto Detect) +packet_db_ver: default + +// Whether the packet DB takes higher precedence over the hardcoded packet +// length and functions, and whether to overwrite them when reading +prefer_packet_db: yes + + +// packet_ver: 5 0x0064,55 0x0065,17 0x0066,3 @@ -438,182 +450,182 @@ packet_ver: 5 //jROはここまで //2004-07-06kRO -packet_ver: 6 -0x0072,22,wanttoconnection,5:9:13:17:21 -0x0085,8,walktoxy,5 -0x00a7,13,useitem,5:9 -0x0113,15,useskilltoid,4:9:11 -0x0116,15,useskilltopos,4:9:11:13 -0x0190,95,useskilltopos,4:9:11:13:15 +// packet_ver: 6 +// 0x0072,22,wanttoconnection,5:9:13:17:21 +// 0x0085,8,walktoxy,5 +// 0x00a7,13,useitem,5:9 +// 0x0113,15,useskilltoid,4:9:11 +// 0x0116,15,useskilltopos,4:9:11:13 +// 0x0190,95,useskilltopos,4:9:11:13:15 //2004-07-13kRO -packet_ver: 7 -0x0072,39,wanttoconnection,12:22:30:34:38 -0x0085,9,walktoxy,6 -0x009b,13,changedir,5:12 -0x009f,10,takeitem,6 -0x00a7,17,useitem,6:13 -0x0113,19,useskilltoid,7:9:15 -0x0116,19,useskilltopos,7:9:15:17 -0x0190,99,useskilltopos,7:9:15:17:19 +// packet_ver: 7 +// 0x0072,39,wanttoconnection,12:22:30:34:38 +// 0x0085,9,walktoxy,6 +// 0x009b,13,changedir,5:12 +// 0x009f,10,takeitem,6 +// 0x00a7,17,useitem,6:13 +// 0x0113,19,useskilltoid,7:9:15 +// 0x0116,19,useskilltopos,7:9:15:17 +// 0x0190,99,useskilltopos,7:9:15:17:19 //2004-07-26kRO -packet_ver: 8 -0x0072,14,dropitem,5:12 -0x007e,33,wanttoconnection,12:18:24:28:32 -0x0085,20,useskilltoid,7:12:16 -0x0089,15,getcharnamerequest,11 -0x008c,23,useskilltopos,3:6:17:21 -0x0094,10,takeitem,6 -0x009b,6,walktoxy,3 -0x009f,13,changedir,5:12 -0x00a2,103,useskilltopos,3:6:17:21:23 -0x00a7,12,solvecharname,8 -0x00f3,-1,globalmessage,2:4 -0x00f5,17,useitem,6:12 -0x00f7,10,ticksend,6 -0x0113,16,movetokafra,5:12 -0x0116,2,closekafra,0 -0x0190,26,movefromkafra,10:22 -0x0193,9,actionrequest,3:8 +// packet_ver: 8 +// 0x0072,14,dropitem,5:12 +// 0x007e,33,wanttoconnection,12:18:24:28:32 +// 0x0085,20,useskilltoid,7:12:16 +// 0x0089,15,getcharnamerequest,11 +// 0x008c,23,useskilltopos,3:6:17:21 +// 0x0094,10,takeitem,6 +// 0x009b,6,walktoxy,3 +// 0x009f,13,changedir,5:12 +// 0x00a2,103,useskilltopos,3:6:17:21:23 +// 0x00a7,12,solvecharname,8 +// 0x00f3,-1,globalmessage,2:4 +// 0x00f5,17,useitem,6:12 +// 0x00f7,10,ticksend,6 +// 0x0113,16,movetokafra,5:12 +// 0x0116,2,closekafra,0 +// 0x0190,26,movefromkafra,10:22 +// 0x0193,9,actionrequest,3:8 //2004-08-09kRO -packet_ver: 9 -0x0072,17,dropitem,8:15 +// packet_ver: 9 +// 0x0072,17,dropitem,8:15 //9, +12, +7, +4, +4 -0x007e,37,wanttoconnection,9:21:28:32:36 -0x0085,26,useskilltoid,11:18:22 -0x0089,12,getcharnamerequest,8 -0x008c,40,useskilltopos,5:15:29:38 -0x0094,13,takeitem,9 -0x009b,15,walktoxy,12 -0x009f,12,changedir,7:11 -0x00a2,120,useskilltopos,5:15:29:38:40 -0x00a7,11,solvecharname,7 -0x00f5,24,useitem,9:20 -0x00f7,13,ticksend,9 -0x0113,23,movetokafra,5:19 -0x0190,26,movefromkafra,11:22 -0x0193,18,actionrequest,7:17 +// 0x007e,37,wanttoconnection,9:21:28:32:36 +// 0x0085,26,useskilltoid,11:18:22 +// 0x0089,12,getcharnamerequest,8 +// 0x008c,40,useskilltopos,5:15:29:38 +// 0x0094,13,takeitem,9 +// 0x009b,15,walktoxy,12 +// 0x009f,12,changedir,7:11 +// 0x00a2,120,useskilltopos,5:15:29:38:40 +// 0x00a7,11,solvecharname,7 +// 0x00f5,24,useitem,9:20 +// 0x00f7,13,ticksend,9 +// 0x0113,23,movetokafra,5:19 +// 0x0190,26,movefromkafra,11:22 +// 0x0193,18,actionrequest,7:17 //2004-08-16aSakexe -0x020f,0 -0x0210,0 -0x0211,0 -0x0212,26 -0x0213,26 -0x0214,42 +// 0x020f,0 +// 0x0210,0 +// 0x0211,0 +// 0x0212,26 +// 0x0213,26 +// 0x0214,42 //2004-08-17aSakexe -0x020f,10 -0x0210,22 +// 0x020f,10 +// 0x0210,22 //2004-09-06aSakexe -packet_ver: 10 +// packet_ver: 10 //0x0072,20,useitem,9:20 -0x007e,19,movetokafra,3:15 -0x0085,23,actionrequest,9:22 -0x0089,9,walktoxy,6 -0x008c,105,useskilltopos,10:14:18:23:25 -0x0094,17,dropitem,6:15 -0x009b,14,getcharnamerequest,10 -0x009f,-1,globalmessage,2:4 -0x00a2,14,solvecharname,10 -0x00a7,25,useskilltopos,10:14:18:23 -0x00f3,10,changedir,4:9 +// 0x007e,19,movetokafra,3:15 +// 0x0085,23,actionrequest,9:22 +// 0x0089,9,walktoxy,6 +// 0x008c,105,useskilltopos,10:14:18:23:25 +// 0x0094,17,dropitem,6:15 +// 0x009b,14,getcharnamerequest,10 +// 0x009f,-1,globalmessage,2:4 +// 0x00a2,14,solvecharname,10 +// 0x00a7,25,useskilltopos,10:14:18:23 +// 0x00f3,10,changedir,4:9 //7, +7, +10, +4, +6 -0x00f5,34,wanttoconnection,7:15:25:29:33 -0x00f7,2,closekafra,0 -0x0113,11,takeitem,7 -0x0116,11,ticksend,7 -0x0190,22,useskilltoid,9:15:18 -0x0193,17,movefromkafra,3:13 +// 0x00f5,34,wanttoconnection,7:15:25:29:33 +// 0x00f7,2,closekafra,0 +// 0x0113,11,takeitem,7 +// 0x0116,11,ticksend,7 +// 0x0190,22,useskilltoid,9:15:18 +// 0x0193,17,movefromkafra,3:13 //2004-09-21aSakexe by Sara -packet_ver: 11 -0x0072,18,useitem,10:14 -0x007e,25,movetokafra,6:21 -0x0085,9,actionrequest,3:8 -0x0089,14,walktoxy,11 -0x008c,109,useskilltopos,16:20:23:27:29 -0x0094,19,dropitem,12:17 -0x00a2,10,solvecharname,6 -0x00a7,29,useskilltopos,6:20:23:27 -0x00f3,18,changedir,8:17 -0x00f5,32,wanttoconnection,10:17:23:27:31 -0x009b,10,getcharnamerequest,6 -0x0113,14,takeitem,10 -0x0116,14,ticksend,10 -0x0190,14,useskilltoid,4:7:10 -0x0193,12,movefromkafra,4:8 +// packet_ver: 11 +// 0x0072,18,useitem,10:14 +// 0x007e,25,movetokafra,6:21 +// 0x0085,9,actionrequest,3:8 +// 0x0089,14,walktoxy,11 +// 0x008c,109,useskilltopos,16:20:23:27:29 +// 0x0094,19,dropitem,12:17 +// 0x00a2,10,solvecharname,6 +// 0x00a7,29,useskilltopos,6:20:23:27 +// 0x00f3,18,changedir,8:17 +// 0x00f5,32,wanttoconnection,10:17:23:27:31 +// 0x009b,10,getcharnamerequest,6 +// 0x0113,14,takeitem,10 +// 0x0116,14,ticksend,10 +// 0x0190,14,useskilltoid,4:7:10 +// 0x0193,12,movefromkafra,4:8 //2004-10-11aSakexe by Sara -packet_ver: 12 -0x0072,17,useitem,6:13 -0x007e,16,movetokafra,5:12 -0x0089,6,walktoxy,3 -0x008c,103,useskilltopos,2:6:17:21:23 -0x0094,14,dropitem,5:12 -0x009b,15,getcharnamerequest,11 -0x00a2,12,solvecharname,8 -0x00a7,23,useskilltopos,3:6:17:21 -0x00f3,13,changedir,5:12 -0x00f5,33,wanttoconnection,12:18:24:28:32 -0x0113,10,takeitem,6 -0x0116,10,ticksend,6 -0x0190,20,useskilltoid,7:12:16 -0x0193,26,movefromkafra,10:22 +// packet_ver: 12 +// 0x0072,17,useitem,6:13 +// 0x007e,16,movetokafra,5:12 +// 0x0089,6,walktoxy,3 +// 0x008c,103,useskilltopos,2:6:17:21:23 +// 0x0094,14,dropitem,5:12 +// 0x009b,15,getcharnamerequest,11 +// 0x00a2,12,solvecharname,8 +// 0x00a7,23,useskilltopos,3:6:17:21 +// 0x00f3,13,changedir,5:12 +// 0x00f5,33,wanttoconnection,12:18:24:28:32 +// 0x0113,10,takeitem,6 +// 0x0116,10,ticksend,6 +// 0x0190,20,useskilltoid,7:12:16 +// 0x0193,26,movefromkafra,10:22 //2004-10-25aSakexe by Sara -packet_ver: 13 -0x0072,13,useitem,5:9 -0x007e,13,movetokafra,6:9 -0x0085,15,actionrequest,4:14 -0x008c,108,useskilltopos,6:9:23:26:28 -0x0094,12,dropitem,6:10 -0x009b,10,getcharnamerequest,6 -0x00a2,16,solvecharname,12 -0x00a7,28,useskilltopos,6:9:23:26 -0x00f3,15,changedir,6:14 -0x00f5,29,wanttoconnection,5:14:20:24:28 -0x0113,9,takeitem,5 -0x0116,9,ticksend,5 -0x0190,26,useskilltoid,4:10:22 -0x0193,22,movefromkafra,12:18 +// packet_ver: 13 +// 0x0072,13,useitem,5:9 +// 0x007e,13,movetokafra,6:9 +// 0x0085,15,actionrequest,4:14 +// 0x008c,108,useskilltopos,6:9:23:26:28 +// 0x0094,12,dropitem,6:10 +// 0x009b,10,getcharnamerequest,6 +// 0x00a2,16,solvecharname,12 +// 0x00a7,28,useskilltopos,6:9:23:26 +// 0x00f3,15,changedir,6:14 +// 0x00f5,29,wanttoconnection,5:14:20:24:28 +// 0x0113,9,takeitem,5 +// 0x0116,9,ticksend,5 +// 0x0190,26,useskilltoid,4:10:22 +// 0x0193,22,movefromkafra,12:18 //2004-11-01aSakexe by Sara -packet_ver: 14 -0x0215,6 -0x0143,23,npcamountinput,2:6 -0x0145,19 +// packet_ver: 14 +// 0x0215,6 +// 0x0143,23,npcamountinput,2:6 +// 0x0145,19 //0x01f9,6,adopt,5 //2004-12-06aSakexe -packet_ver: 15 -0x0190,15,useitem,3:11 -0x0094,14,movetokafra,4:10 -0x009f,18,actionrequest,6:17 -0x00a7,7,walktoxy,4 -0x007e,30,useskilltopos,4:9:22:28 -0x0116,12,dropitem,4:10 -0x008c,13,getcharnamerequest,9 -0x0085,-1,globalmessage,2:4 -0x00f7,14,solvecharname,10 -0x0113,110,useskilltopos,4:9:22:28:30 -0x00f3,8,changedir,3:7 -0x00f5,29,wanttoconnection,3:10:20:24:28 -0x00a2,7,takeitem,3 -0x0089,7,ticksend,3 -0x0072,22,useskilltoid,8:12:18 -0x0193,21,movefromkafra,4:17 -0x009b,2,closekafra,0 -0x0222,6 -0x0221,-1 -0x021d,6 -0x0223,8 +// packet_ver: 15 +// 0x0190,15,useitem,3:11 +// 0x0094,14,movetokafra,4:10 +// 0x009f,18,actionrequest,6:17 +// 0x00a7,7,walktoxy,4 +// 0x007e,30,useskilltopos,4:9:22:28 +// 0x0116,12,dropitem,4:10 +// 0x008c,13,getcharnamerequest,9 +// 0x0085,-1,globalmessage,2:4 +// 0x00f7,14,solvecharname,10 +// 0x0113,110,useskilltopos,4:9:22:28:30 +// 0x00f3,8,changedir,3:7 +// 0x00f5,29,wanttoconnection,3:10:20:24:28 +// 0x00a2,7,takeitem,3 +// 0x0089,7,ticksend,3 +// 0x0072,22,useskilltoid,8:12:18 +// 0x0193,21,movefromkafra,4:17 +// 0x009b,2,closekafra,0 +// 0x0222,6 +// 0x0221,-1 +// 0x021d,6 +// 0x0223,8 //2005-01-10bSakexe by Sara -packet_ver: 16 +// packet_ver: 16 0x009b,32,wanttoconnection,3:12:23:27:31 0x0089,9,ticksend,5 0x00a7,13,walktoxy,10 @@ -631,5 +643,7 @@ packet_ver: 16 0x0072,26,useskilltoid,8:16:22 0x007e,114,useskilltopos,9:18:22:32:34 0x00a2,11,solvecharname,7 +0x0143,10,npcamountinput,2:6 -packet_ver: 17 \ No newline at end of file +// packet_ver: 17 +// Add new packets here \ No newline at end of file diff --git a/db/skill_cast_db.txt b/db/skill_cast_db.txt index af93d845d..774ca5aa0 100644 --- a/db/skill_cast_db.txt +++ b/db/skill_cast_db.txt @@ -32,7 +32,7 @@ 35,0,1000,0,0 //AL_CURE#キュアー# 45,0,0,60000:80000:100000:120000:140000:160000:180000:200000:220000:240000,0 //AC_CONCENTRATION#集中力向上# -46,0,1500,100,0 //AC_DOUBLE +46,0,-300,100,0 //AC_DOUBLE 47,0,1500,100,0 //AC_SHOWER 51,0,0,30000:60000:90000:120000:150000:180000:210000:240000:270000:300000,0 //TF_HIDING#ハイディング# diff --git a/npc/mobs/fields/yuno.txt b/npc/mobs/fields/yuno.txt index 7b0cbbb27..dd0f67335 100644 --- a/npc/mobs/fields/yuno.txt +++ b/npc/mobs/fields/yuno.txt @@ -3,58 +3,136 @@ //===== By: ================================================== //= Athena (1.0) //===== Current Version: ===================================== -//= 1.1 +//= 1.3 //===== Compatible With: ===================================== //= Any Athena Version //===== Additional Comments: ================================= //= 1.1 fixed tabs, names [Lupus] +//= 1.2 New/Better Spawn [Muad_Dib] +//= 1.3 Fix Up [Darkchild] //============================================================ -//(yuno_fild04.gat)* -yuno_fild04.gat,0,0,0,0 monster Goat 1372,40,0,0,0 -yuno_fild04.gat,0,0,0,0 monster Sleeper 1386,5,0,0,0 -yuno_fild04.gat,0,0,0,0 monster The Paper 1375,3,0,0,0 -yuno_fild04.gat,0,0,0,0 monster Geographer 1368,20,0,0,0 -yuno_fild04.gat,0,0,0,0 monster Driller 1380,10,0,0,0 -yuno_fild04.gat,0,0,0,0 monster Poring 1002,20,0,0,0 +//======================================================================================== +// - Yuno Field 01 +//======================================================================================== + +yuno_fild01.gat,0,0,0,0 monster Poring 1002,55,0,0,0 +yuno_fild01.gat,0,0,0,0 monster Poporing 1031,35,0,0,0 +yuno_fild01.gat,0,0,0,0 monster Dustiness 1114,25,0,0,0 +yuno_fild01.gat,0,0,0,0 monster Green Plant 1080,10,180000,90000,1 +yuno_fild01.gat,0,0,0,0 monster Red Plant 1078,15,180000,90000,1 +yuno_fild01.gat,0,0,0,0 monster Shining Plant 1083,5,1800000,900000,1 +yuno_fild01.gat,0,0,0,0 monster Yellow Plant 1081,20,360000,180000,1 + +//======================================================================================== +// - Yuno Field 02 +//======================================================================================== + +yuno_fild02.gat,0,0,0,0 monster Sageworm 1281,5,0,0,0 +yuno_fild02.gat,0,0,0,0 monster Dustiness 1114,15,0,0,0 +yuno_fild02.gat,0,0,0,0 monster Kind of Beetle 1494,15,0,0,0 +yuno_fild02.gat,0,0,0,0 monster Horn 1128,35,0,0,0 +yuno_fild02.gat,0,0,0,0 monster Stainer 1174,25,0,0,0 +yuno_fild02.gat,0,0,0,0 monster Wild Rose 1261,15,0,0,0 +yuno_fild02.gat,0,0,0,0 monster Red Plant 1078,15,180000,90000,1 +yuno_fild02.gat,0,0,0,0 monster Yellow Plant 1081,20,360000,180000,1 +yuno_fild02.gat,0,0,0,0 monster Green Plant 1080,15,180000,90000,1 + +//======================================================================================== +// - Yuno Field 03 +//======================================================================================== + +yuno_fild03.gat,0,0,0,0 monster Drops 1113,30,0,0,0 +yuno_fild03.gat,0,0,0,0 monster Poring 1002,40,0,0,0 +yuno_fild03.gat,0,0,0,0 monster Sidewinder 1037,5,0,0,0 +yuno_fild03.gat,0,0,0,0 monster Poporing 1031,20,0,0,0 +yuno_fild03.gat,0,0,0,0 monster Marin 1242,20,0,0,0 +yuno_fild03.gat,0,0,0,0 monster Geographer 1368,15,0,0,0 +yuno_fild03.gat,0,0,0,0 monster Archangeling 1388,1,3600000,1800000,1 +yuno_fild03.gat,0,0,0,0 monster Red Plant 1078,15,180000,90000,1 +yuno_fild03.gat,0,0,0,0 monster Green Plant 1080,50,180000,90000,1 +yuno_fild03.gat,0,0,0,0 monster Yellow Plant 1081,20,360000,180000,1 + +//======================================================================================== +// - Yuno Field 04 +//======================================================================================== + +yuno_fild04.gat,0,0,0,0 monster Poring 1002,50,0,0,0 +yuno_fild04.gat,0,0,0,0 monster Pupa 1008,15,0,0,0 +yuno_fild04.gat,0,0,0,0 monster Drops 1113,30,0,0,0 +yuno_fild04.gat,0,0,0,0 monster Condor 1009,15,0,0,0 +yuno_fild04.gat,0,0,0,0 monster Creamy 1018,10,0,0,0 yuno_fild04.gat,0,0,0,0 monster Green Plant 1080,10,180000,90000,1 yuno_fild04.gat,0,0,0,0 monster Red Plant 1078,10,180000,90000,1 yuno_fild04.gat,0,0,0,0 monster Yellow Plant 1081,10,360000,180000,1 -yuno_fild04.gat,0,0,0,0 monster Harpy 1376,1,0,0,0 - -//(yuno_fild03.gat)* -yuno_fild03.gat,0,0,0,0 monster Goat 1372,60,0,0,0 -yuno_fild03.gat,0,0,0,0 monster Sleeper 1386,30,0,0,0 -yuno_fild03.gat,0,0,0,0 monster The Paper 1375,3,0,0,0 -yuno_fild03.gat,0,0,0,0 monster Geographer 1368,20,0,0,0 -yuno_fild03.gat,0,0,0,0 monster Demon Pungus 1378,30,0,0,0 -yuno_fild03.gat,0,0,0,0 monster Red Plant 1078,15,180000,90000,1 -yuno_fild03.gat,0,0,0,0 monster Shining Plant 1083,2,1800000,900000,1 -yuno_fild03.gat,0,0,0,0 monster Blue Plant 1079,4,360000,180000,1 -yuno_fild03.gat,0,0,0,0 monster Yellow Plant 1081,20,360000,180000,1 -yuno_fild03.gat,0,0,0,0 monster Harpy 1376,2,0,0,0 - -//(yuno_fild02.gat)* -yuno_fild02.gat,0,0,0,0 monster Sleeper 1386,10,0,0,0 -yuno_fild02.gat,0,0,0,0 monster Grand Peco 1369,70,0,0,0 -yuno_fild02.gat,0,0,0,0 monster The Paper 1375,1,0,0,0 -yuno_fild02.gat,0,0,0,0 monster Geographer 1368,20,0,0,0 -yuno_fild02.gat,0,0,0,0 monster Driller 1380,30,0,0,0 -yuno_fild02.gat,0,0,0,0 monster Dustiness 1114,20,0,0,0 -yuno_fild02.gat,0,0,0,0 monster Poring 1002,20,0,0,0 -yuno_fild02.gat,0,0,0,0 monster Red Plant 1078,20,180000,90000,1 -yuno_fild02.gat,0,0,0,0 monster Shining Plant 1083,1,1800000,900000,1 -yuno_fild02.gat,0,0,0,0 monster Blue Plant 1079,3,360000,180000,1 -yuno_fild02.gat,0,0,0,0 monster Yellow Plant 1081,20,360000,180000,1 -yuno_fild02.gat,0,0,0,0 monster Archangeling 1388,1,3600000,1800000,1 - -//(yuno_fild01.gat)* -yuno_fild01.gat,0,0,0,0 monster Grand Peco 1369,3,0,0,0 -yuno_fild01.gat,0,0,0,0 monster Dustiness 1114,50,0,0,0 -yuno_fild01.gat,0,0,0,0 monster Poporing 1031,20,0,0,0 -yuno_fild01.gat,0,0,0,0 monster Poring 1002,20,0,0,0 -yuno_fild01.gat,0,0,0,0 monster Green Plant 1080,20,180000,90000,1 -yuno_fild01.gat,0,0,0,0 monster Red Plant 1078,15,180000,90000,1 -yuno_fild01.gat,0,0,0,0 monster Shining Plant 1083,3,1800000,900000,1 -yuno_fild01.gat,0,0,0,0 monster Blue Plant 1079,2,360000,180000,1 -yuno_fild01.gat,0,0,0,0 monster Yellow Plant 1081,23,360000,180000,1 + +//======================================================================================== +// - Yuno Field 05 +//======================================================================================== + +yuno_fild05.gat,0,0,0,0 monster Geographer 1368,20,0,0,0 +yuno_fild05.gat,0,0,0,0 monster Goat 1372,5,0,0,0 +yuno_fild05.gat,0,0,0,0 monster Demon Pungus 1378,20,0,0,0 +yuno_fild05.gat,0,0,0,0 monster Sleeper 1386,45,0,0,0 +yuno_fild05.gat,0,0,0,0 monster The Paper 1375,15,0,0,0 +yuno_fild05.gat,0,0,0,0 monster Green Plant 1080,5,180000,90000,1 +yuno_fild05.gat,0,0,0,0 monster Yellow Plant 1081,10,360000,180000,1 +yuno_fild05.gat,0,0,0,0 monster Red Plant 1078,5,180000,90000,1 + +//======================================================================================== +// - Yuno Field 07 +//======================================================================================== + +yuno_fild07.gat,0,0,0,0 monster Geographer 1368,20,0,0,0 +yuno_fild07.gat,0,0,0,0 monster Goat 1372,60,0,0,0 +yuno_fild07.gat,0,0,0,0 monster Green Plant 1080,10,180000,90000,1 +yuno_fild07.gat,0,0,0,0 monster Red Plant 1078,10,180000,90000,1 +yuno_fild07.gat,0,0,0,0 monster Yellow Plant 1081,15,360000,180000,1 + +//======================================================================================== +// - Yuno Field 08 +//======================================================================================== + +yuno_fild08.gat,0,0,0,0 monster Grand Peco 1369,20,0,0,0 +yuno_fild08.gat,0,0,0,0 monster Dustiness 1114,30,0,0,0 +yuno_fild08.gat,0,0,0,0 monster Geographer 1368,20,0,0,0 +yuno_fild08.gat,0,0,0,0 monster Wild Rose 1261,15,0,0,0 +yuno_fild08.gat,0,0,0,0 monster Red Plant 1078,15,180000,90000,1 +yuno_fild08.gat,0,0,0,0 monster Yellow Plant 1081,20,360000,180000,1 +yuno_fild08.gat,0,0,0,0 monster Green Plant 1080,10,180000,90000,1 + +//======================================================================================== +// - Yuno Field 09 +//======================================================================================== + +yuno_fild09.gat,0,0,0,0 monster Gargoyle 1253,10,0,0,0 +yuno_fild09.gat,0,0,0,0 monster Dustiness 1114,20,0,0,0 +yuno_fild09.gat,0,0,0,0 monster Goblin 1122,10,0,0,0 +yuno_fild09.gat,0,0,0,0 monster Goblin 1123,5,0,0,0 +yuno_fild09.gat,0,0,0,0 monster Goblin 1124,10,0,0,0 +yuno_fild09.gat,0,0,0,0 monster Goblin 1125,5,0,0,0 +yuno_fild09.gat,0,0,0,0 monster Goblin 1126,5,0,0,0 +yuno_fild09.gat,0,0,0,0 monster Horn 1128,25,0,0,0 +yuno_fild09.gat,0,0,0,0 monster Red Plant 1078,10,180000,90000,1 +yuno_fild09.gat,0,0,0,0 monster Yellow Plant 1081,15,360000,180000,1 +yuno_fild09.gat,0,0,0,0 monster Green Plant 1080,15,180000,90000,1 + +//======================================================================================== +// - Yuno Field 11 +//======================================================================================== + +yuno_fild11.gat,0,0,0,0 monster Sleeper 1386,55,0,0,0 +yuno_fild11.gat,0,0,0,0 monster Geographer 1368,20,0,0,0 +yuno_fild11.gat,0,0,0,0 monster Red Plant 1078,10,180000,90000,1 +yuno_fild11.gat,0,0,0,0 monster Green Plant 1080,10,180000,90000,1 +yuno_fild11.gat,0,0,0,0 monster Yellow Plant 1081,15,360000,180000,1 + +//======================================================================================== +// - Yuno Field 12 +//======================================================================================== + +yuno_fild12.gat,0,0,0,0 monster Dustiness 1114,35,0,0,0 +yuno_fild12.gat,0,0,0,0 monster Demon Pungus 1378,20,0,0,0 +yuno_fild12.gat,0,0,0,0 monster Green Plant 1080,10,180000,90000,1 +yuno_fild12.gat,0,0,0,0 monster Red Plant 1078,5,180000,90000,1 +yuno_fild12.gat,0,0,0,0 monster Yellow Plant 1081,10,360000,180000,1 diff --git a/sql-files/database.sql b/sql-files/database.sql index 9700ddb3a..1c379859f 100644 --- a/sql-files/database.sql +++ b/sql-files/database.sql @@ -1,6 +1,3 @@ -DROP DATABASE erag; -CREATE DATABASE erag; -USE erag; CREATE TABLE `item_db` ( `id` smallint(5) unsigned NOT NULL default '0', `name_english` varchar(24) NOT NULL default '', diff --git a/sql-files/mail.sql b/sql-files/mail.sql index 201142d59..62cc9d65d 100644 --- a/sql-files/mail.sql +++ b/sql-files/mail.sql @@ -1,5 +1,3 @@ -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `ragnarok`; -USE `ragnarok`; CREATE TABLE `mail` ( `message_id` int(11) NOT NULL auto_increment, `to_account_id` int(11) NOT NULL default '0', diff --git a/src/char/char.c b/src/char/char.c index 6aaae27b0..56d070e5d 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -166,7 +166,7 @@ int char_log(char *fmt, ...) { //----------------------------------------------------- // Function to suppress control characters in a string. //----------------------------------------------------- -int remove_control_chars(unsigned char *str) { +int remove_control_chars(char *str) { int i; int change = 0; @@ -244,7 +244,7 @@ int mmo_friends_list_data_str(char *str, struct mmo_charstatus *p) { int i; char *str_p = str; str_p += sprintf(str_p, "%d", p->char_id); - + for (i=0;i<20;i++) { str_p += sprintf(str_p, ",%d,%s", p->friend_id[i],p->friend_name[i]); @@ -575,16 +575,16 @@ int parse_friend_txt(struct mmo_charstatus *p) char line[1024]; int i,cid=0,temp[20]; FILE *fp; - + // Open the file and look for the ID fp = fopen(friends_txt, "r"); if(fp == NULL) return 1; - + while(fgets(line, sizeof(line)-1, fp)) { - + if(line[0] == '/' && line[1] == '/') continue; @@ -612,7 +612,7 @@ int parse_friend_txt(struct mmo_charstatus *p) if (cid == p->char_id) break; } - + // No register of friends list if (cid == 0) { fclose(fp); @@ -638,12 +638,12 @@ int mmo_char_init(void) { FILE *fp; char_max = 256; - char_dat = calloc(sizeof(struct mmo_charstatus) * 256, 1); + char_dat = (struct mmo_charstatus*)aCalloc(sizeof(struct mmo_charstatus) * 256, 1); if (!char_dat) { printf("out of memory: mmo_char_init (calloc of char_dat).\n"); exit(1); } - online_chars = calloc(sizeof(struct online_chars) * 256, 1); + online_chars = (struct online_chars*)aCalloc(sizeof(struct online_chars) * 256, 1); if (!online_chars) { printf("out of memory: mmo_char_init (calloc of online_chars).\n"); exit(1); @@ -683,13 +683,13 @@ int mmo_char_init(void) { if (char_num >= char_max) { char_max += 256; - char_dat = realloc(char_dat, sizeof(struct mmo_charstatus) * char_max); + char_dat = (struct mmo_charstatus*)aRealloc(char_dat, sizeof(struct mmo_charstatus) * char_max); if (!char_dat) { printf("Out of memory: mmo_char_init (realloc of char_dat).\n"); char_log("Out of memory: mmo_char_init (realloc of char_dat)." RETCODE); exit(1); } - online_chars = realloc(online_chars, sizeof(struct online_chars) * char_max); + online_chars = (struct online_chars*)aRealloc(online_chars, sizeof(struct online_chars) * char_max); if (!online_chars) { printf("Out of memory: mmo_char_init (realloc of online_chars).\n"); char_log("Out of memory: mmo_char_init (realloc of online_chars)." RETCODE); @@ -703,10 +703,10 @@ int mmo_char_init(void) { } ret = mmo_char_fromstr(line, &char_dat[char_num]); - + // Initialize friends list parse_friend_txt(&char_dat[char_num]); // Grab friends for the character - + if (ret > 0) { // negative value or zero for errors if (char_dat[char_num].char_id >= char_id_count) char_id_count = char_dat[char_num].char_id + 1; @@ -769,7 +769,7 @@ void mmo_char_sync(void) { int i, j, k; int lock; FILE *fp,*f_fp; - int id[char_num]; + int *id = (int *) aMalloc(sizeof(int) * char_num); // Sorting before save (by [Yor]) for(i = 0; i < char_num; i++) { @@ -825,9 +825,11 @@ void mmo_char_sync(void) { mmo_friends_list_data_str(f_line, &char_dat[id[i]]); fprintf(f_fp, "%s" RETCODE, f_line); } - + lock_fclose(f_fp, friends_txt, &lock); - + + aFree(id); + return; } @@ -847,7 +849,7 @@ int make_new_char(int fd, unsigned char *dat) { int i, j; struct char_session_data *sd; - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; // remove control characters from the name dat[23] = '\0'; @@ -921,13 +923,13 @@ int make_new_char(int fd, unsigned char *dat) { if (char_num >= char_max) { char_max += 256; - char_dat = realloc(char_dat, sizeof(struct mmo_charstatus) * char_max); + char_dat = (struct mmo_charstatus*)aRealloc(char_dat, sizeof(struct mmo_charstatus) * char_max); if (!char_dat) { printf("Out of memory: make_new_char (realloc of char_dat).\n"); char_log("Out of memory: make_new_char (realloc of char_dat)." RETCODE); exit(1); } - online_chars = realloc(online_chars, sizeof(struct online_chars) * char_max); + online_chars = (struct online_chars*)aRealloc(online_chars, sizeof(struct online_chars) * char_max); if (!online_chars) { printf("Out of memory: make_new_char (realloc of online_chars).\n"); char_log("Out of memory: make_new_char (realloc of online_chars)." RETCODE); @@ -998,8 +1000,8 @@ int make_new_char(int fd, unsigned char *dat) { //---------------------------------------------------- // This function return the name of the job (by [Yor]) //---------------------------------------------------- -char * job_name(int class) { - switch (class) { +char * job_name(int class_) { + switch (class_) { case 0: return "Novice"; case 1: return "Swordsman"; case 2: return "Mage"; @@ -1550,7 +1552,7 @@ int disconnect_player(int accound_id) { // disconnect player if online on char-server for(i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data)) { + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) { if (sd->account_id == accound_id) { session[i]->eof = 1; return 1; @@ -1612,7 +1614,7 @@ int parse_tologin(int fd) { return 0; } - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; while(RFIFOREST(fd) >= 2) { // printf("parse_tologin: connection #%d, packet: 0x%x (with being read: %d bytes).\n", fd, RFIFOW(fd,0), RFIFOREST(fd)); @@ -1645,7 +1647,7 @@ int parse_tologin(int fd) { return 0; // printf("parse_tologin 2713 : %d\n", RFIFOB(fd,6)); for(i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd->account_id == RFIFOL(fd,2)) { + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == RFIFOL(fd,2)) { if (RFIFOB(fd,6) != 0) { WFIFOW(i,0) = 0x6c; WFIFOB(i,2) = 0x42; @@ -1683,7 +1685,7 @@ int parse_tologin(int fd) { if (RFIFOREST(fd) < 50) return 0; for(i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data)) { + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) { if (sd->account_id == RFIFOL(fd,2)) { memcpy(sd->email, RFIFOP(fd,6), 40); if (e_mail_check(sd->email) == 0) @@ -1891,7 +1893,7 @@ int parse_tologin(int fd) { int j, k; struct char_session_data *sd2; for (j = 0; j < fd_max; j++) { - if (session[j] && (sd2 = session[j]->session_data) && + if (session[j] && (sd2 = (struct char_session_data*)session[j]->session_data) && sd2->account_id == char_dat[char_num-1].account_id) { for (k = 0; k < 9; k++) { if (sd2->found_char[k] == char_num-1) { @@ -1946,8 +1948,8 @@ int parse_tologin(int fd) { { char buf[32000]; if (gm_account != NULL) - free(gm_account); - gm_account = calloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1); + aFree(gm_account); + gm_account = (struct gm_account*)aCalloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1); GM_num = 0; for (i = 4; i < RFIFOW(fd,2); i = i + 5) { gm_account[GM_num].account_id = RFIFOL(fd,i); @@ -2158,7 +2160,7 @@ int parse_frommap(int fd) { if (j == online_players_max) { // create 256 new slots online_players_max += 256; - online_chars = realloc(online_chars, sizeof(struct online_chars) * online_players_max); + online_chars = (struct online_chars*)aRealloc(online_chars, sizeof(struct online_chars) * online_players_max); if (!online_chars) { printf("out of memory: parse_frommap - online_chars (realloc).\n"); exit(1); @@ -2515,7 +2517,7 @@ int parse_char(int fd) { return 0; } - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; while (RFIFOREST(fd) >= 2) { cmd = RFIFOW(fd,0); @@ -2539,7 +2541,7 @@ int parse_char(int fd) { // if (sd == NULL && cmd != 0x65 && cmd != 0x20b && cmd != 0x187 && // cmd != 0x2af8 && cmd != 0x7530 && cmd != 0x7532) // cmd = 0xffff; // パケットダンプを表示させる - + switch(cmd){ case 0x20b: //20040622暗号化ragexe対応 if (RFIFOREST(fd) < 19) @@ -2557,7 +2559,7 @@ int parse_char(int fd) { else printf("Account Logged On; Account ID: %d.\n", RFIFOL(fd,2)); if (sd == NULL) { - sd = session[fd]->session_data = calloc(sizeof(struct char_session_data), 1); + sd = session[fd]->session_data = (struct char_session_data*)aCalloc(sizeof(struct char_session_data), 1); memset(sd, 0, sizeof(struct char_session_data)); memcpy(sd->email, "no mail", 40); // put here a mail without '@' to refuse deletion if we don't receive the e-mail sd->connect_until_time = 0; // unknow or illimited (not displaying on map-server) @@ -2837,7 +2839,7 @@ int parse_char(int fd) { int j, k; struct char_session_data *sd2; for (j = 0; j < fd_max; j++) { - if (session[j] && (sd2 = session[j]->session_data) && + if (session[j] && (sd2 = (struct char_session_data*)session[j]->session_data) && sd2->account_id == char_dat[char_num-1].account_id) { for (k = 0; k < 9; k++) { if (sd2->found_char[k] == char_num-1) { @@ -2947,29 +2949,29 @@ int parse_char(int fd) { // Console Command Parser [Wizputer] int parse_console(char *buf) { char *type,*command; - - type = (char *)malloc(64); - command = (char *)malloc(64); - + + type = (char *)aMalloc(64); + command = (char *)aMalloc(64); + memset(type,0,64); memset(command,0,64); - + printf("Console: %s\n",buf); - + if ( sscanf(buf, "%[^:]:%[^\n]", type , command ) < 2 ) sscanf(buf,"%[^\n]",type); - + printf("Type of command: %s || Command: %s \n",type,command); - - if(buf) free(buf); - if(type) free(type); - if(command) free(command); - + + if(buf) aFree(buf); + if(type) aFree(type); + if(command) aFree(command); + return 0; } // 全てのMAPサーバーにデータ送信(送信したmap鯖の数を返す) -int mapif_sendall(unsigned char *buf, unsigned int len) { +int mapif_sendall(char *buf, unsigned int len) { int i, c; c = 0; @@ -2985,7 +2987,7 @@ int mapif_sendall(unsigned char *buf, unsigned int len) { } // 自分以外の全てのMAPサーバーにデータ送信(送信したmap鯖の数を返す) -int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) { +int mapif_sendallwos(int sfd, char *buf, unsigned int len) { int i, c; c = 0; @@ -3000,7 +3002,7 @@ int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) { return c; } // MAPサーバーにデータ送信(map鯖生存確認有り) -int mapif_send(int fd, unsigned char *buf, unsigned int len) { +int mapif_send(int fd, char *buf, unsigned int len) { int i; if (fd >= 0) { @@ -3349,19 +3351,19 @@ void do_final(void) { } create_online_files(); - if(online_chars) free(online_chars); + if(online_chars) aFree(online_chars); mmo_char_sync(); inter_save(); - if(gm_account) free(gm_account); - if(char_dat) free(char_dat); + if(gm_account) aFree(gm_account); + if(char_dat) aFree(char_dat); delete_session(login_fd); delete_session(char_fd); for(i = 0; i < fd_max; i++) - if(session[i] != NULL) free(session[i]); + if(session[i] != NULL) aFree(session[i]); char_log("----End of char-server (normal end with closing of all files)." RETCODE); } @@ -3377,14 +3379,14 @@ int do_init(int argc, char **argv) { // moved behind char_config_read in case we changed the filename [celest] char_log("The char-server starting..." RETCODE); - if ((naddr_ != 0) && (login_ip_set_ == 0 || char_ip_set_ == 0)) { + if ((naddr_ != 0) && (login_ip_set_ == 0 || char_ip_set_ == 0)) { // The char server should know what IP address it is running on // - MouseJstr int localaddr = ntohl(addr_[0]); unsigned char *ptr = (unsigned char *) &localaddr; char buf[16]; sprintf(buf, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]);; - if (naddr_ != 1) + if (naddr_ != 1) printf("Multiple interfaces detected.. using %s as our IP address\n", buf); else printf("Defaulting to %s as our IP address\n", buf); @@ -3393,9 +3395,9 @@ int do_init(int argc, char **argv) { if (char_ip_set_ == 0) strcpy(char_ip_str, buf); - if (ptr[0] == 192 && ptr[1] == 168) + if (ptr[0] == 192 && ptr[1] == 168) printf("Firewall detected.. edit lan_support.conf and char_athena.conf\n"); - } + } login_ip = inet_addr(login_ip_str); char_ip = inet_addr(char_ip_str); @@ -3406,7 +3408,7 @@ int do_init(int argc, char **argv) { } online_players_max = 256; - online_chars = calloc(sizeof(struct online_chars) * 256, 1); + online_chars = (struct online_chars*)aCalloc(sizeof(struct online_chars) * 256, 1); if (!online_chars) { printf("out of memory: do_init (calloc).\n"); exit(1); @@ -3432,7 +3434,7 @@ int do_init(int argc, char **argv) { add_timer_func_list(check_connect_login_server, "check_connect_login_server"); add_timer_func_list(send_users_tologin, "send_users_tologin"); add_timer_func_list(mmo_char_sync_timer, "mmo_char_sync_timer"); - + i = add_timer_interval(gettick() + 1000, check_connect_login_server, 0, 0, 10 * 1000); i = add_timer_interval(gettick() + 1000, send_users_tologin, 0, 0, 5 * 1000); i = add_timer_interval(gettick() + autosave_interval, mmo_char_sync_timer, 0, 0, autosave_interval); @@ -3446,12 +3448,12 @@ int do_init(int argc, char **argv) { add_timer_interval(gettick()+10, flush_timer,0,0,flush_time); - + if(anti_freeze_enable > 0) { add_timer_func_list(map_anti_freeze_system, "map_anti_freeze_system"); i = add_timer_interval(gettick() + 1000, map_anti_freeze_system, 0, 0, ANTI_FREEZE_INTERVAL * 1000); // checks every X seconds user specifies } - + if(console) { set_defaultconsoleparse(parse_console); start_console(); diff --git a/src/char/char.h b/src/char/char.h index 3ee2f9f6d..c70facba1 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -20,9 +20,9 @@ struct mmo_map_server{ int search_character_index(char* character_name); char * search_character_name(int index); -int mapif_sendall(unsigned char *buf, unsigned int len); -int mapif_sendallwos(int fd,unsigned char *buf, unsigned int len); -int mapif_send(int fd,unsigned char *buf, unsigned int len); +int mapif_sendall(char *buf, unsigned int len); +int mapif_sendallwos(int fd,char *buf, unsigned int len); +int mapif_send(int fd,char *buf, unsigned int len); int char_log(char *fmt, ...); diff --git a/src/char/int_guild.c b/src/char/int_guild.c index 0ee4476fc..348008e1d 100644 --- a/src/char/int_guild.c +++ b/src/char/int_guild.c @@ -398,7 +398,7 @@ int inter_guild_init() { continue; } - g = calloc(sizeof(struct guild), 1); + g = aCalloc(sizeof(struct guild), 1); if(g == NULL){ printf("int_guild: out of memory!\n"); exit(0); @@ -412,7 +412,7 @@ int inter_guild_init() { guild_calcinfo(g); } else { printf("int_guild: broken data [%s] line %d\n", guild_txt, c); - free(g); + aFree(g); } c++; } @@ -426,7 +426,7 @@ int inter_guild_init() { } while(fgets(line, sizeof(line)-1, fp)) { - gc = calloc(sizeof(struct guild_castle), 1); + gc = aCalloc(sizeof(struct guild_castle), 1); if(gc == NULL){ printf("int_guild: out of memory!\n"); exit(0); @@ -436,7 +436,7 @@ int inter_guild_init() { numdb_insert(castle_db, gc->castle_id, gc); } else { printf("int_guild: broken data [%s] line %d\n", castle_txt, c); - free(gc); + aFree(gc); } c++; } @@ -445,7 +445,7 @@ int inter_guild_init() { printf(" %s - making Default Data...\n", castle_txt); //デフォルトデータを作成 for(i = 0; i < MAX_GUILDCASTLE; i++) { - gc = calloc(sizeof(struct guild_castle), 1); + gc = aCalloc(sizeof(struct guild_castle), 1); if (gc == NULL) { printf("int_guild: out of memory!\n"); exit(0); @@ -577,7 +577,7 @@ int guild_check_empty(struct guild *g) { numdb_erase(guild_db, g->guild_id); inter_guild_storage_delete(g->guild_id); mapif_guild_broken(g->guild_id, 0); - free(g); + aFree(g); return 1; } @@ -765,7 +765,7 @@ int mapif_guild_memberinfoshort(struct guild *g, int idx) { WBUFL(buf, 2) = g->guild_id; WBUFL(buf, 6) = g->member[idx].account_id; WBUFL(buf,10) = g->member[idx].char_id; - WBUFB(buf,14) = g->member[idx].online; + WBUFB(buf,14) = (unsigned char)g->member[idx].online; WBUFW(buf,15) = g->member[idx].lv; WBUFW(buf,17) = g->member[idx].class_; mapif_sendall(buf, 19); @@ -965,7 +965,7 @@ int mapif_parse_CreateGuild(int fd, int account_id, char *name, struct guild_mem mapif_guild_created(fd, account_id, NULL); return 0; } - g = calloc(sizeof(struct guild), 1); + g = aCalloc(sizeof(struct guild), 1); if (g == NULL) { printf("int_guild: CreateGuild: out of memory !\n"); mapif_guild_created(fd, account_id, NULL); @@ -1085,7 +1085,7 @@ int mapif_parse_GuildLeave(int fd, int guild_id, int account_id, int char_id, in } // オンライン/Lv更新 -int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class) { +int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, int char_id, int online, int lv, int class_) { struct guild *g; int i, alv, c; @@ -1101,7 +1101,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, if (g->member[i].account_id == account_id && g->member[i].char_id == char_id) { g->member[i].online = online; g->member[i].lv = lv; - g->member[i].class_ = class; + g->member[i].class_ = class_; mapif_guild_memberinfoshort(g, i); } if (g->member[i].account_id > 0) { @@ -1111,7 +1111,7 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd, int guild_id, int account_id, if (g->member[i].online) g->connect_member++; } - + if (c) // 平均レベル g->average_lv = alv / c; @@ -1147,7 +1147,7 @@ int mapif_parse_BreakGuild(int fd, int guild_id) { if(log_inter) inter_log("guild %s (id=%d) broken" RETCODE, g->name, guild_id); - free(g); + aFree(g); return 0; } diff --git a/src/char/int_party.c b/src/char/int_party.c index 194e96707..6b7f4361e 100644 --- a/src/char/int_party.c +++ b/src/char/int_party.c @@ -94,7 +94,7 @@ int inter_party_init() { continue; } - p = calloc(sizeof(struct party), 1); + p = aCalloc(sizeof(struct party), 1); if (p == NULL){ printf("int_party: out of memory!\n"); exit(0); @@ -107,7 +107,7 @@ int inter_party_init() { party_check_empty(p); } else { printf("int_party: broken data [%s] line %d\n", party_txt, c + 1); - free(p); + aFree(p); } c++; } @@ -199,7 +199,7 @@ int party_check_empty(struct party *p) { // 誰もいないので解散 mapif_party_broken(p->party_id, 0); numdb_erase(party_db, p->party_id); - free(p); + aFree(p); return 1; } @@ -391,7 +391,7 @@ int mapif_parse_CreateParty(int fd, int account_id, char *name, char *nick, char mapif_party_created(fd, account_id, NULL); return 0; } - p = calloc(sizeof(struct party), 1); + p = aCalloc(sizeof(struct party), 1); if (p == NULL) { printf("int_party: out of memory !\n"); mapif_party_created(fd,account_id,NULL); diff --git a/src/char/int_pet.c b/src/char/int_pet.c index c08c4ccf3..0dd334514 100644 --- a/src/char/int_pet.c +++ b/src/char/int_pet.c @@ -88,7 +88,7 @@ int inter_pet_init() if( (fp=fopen(pet_txt,"r"))==NULL ) return 1; while(fgets(line,sizeof(line),fp)){ - p=calloc(sizeof(struct s_pet), 1); + p=aCalloc(sizeof(struct s_pet), 1); if(p==NULL){ printf("int_pet: out of memory!\n"); exit(0); @@ -100,7 +100,7 @@ int inter_pet_init() numdb_insert(pet_db,p->pet_id,p); }else{ printf("int_pet: broken data [%s] line %d\n",pet_txt,c); - free(p); + aFree(p); } c++; } @@ -210,7 +210,7 @@ int mapif_create_pet(int fd,int account_id,int char_id,short pet_class,short pet short pet_equip,short intimate,short hungry,char rename_flag,char incuvate,char *pet_name) { struct s_pet *p; - p=malloc(sizeof(struct s_pet)); + p=aMalloc(sizeof(struct s_pet)); if(p==NULL){ printf("int_pet: out of memory !\n"); mapif_pet_created(fd,account_id,NULL); @@ -282,7 +282,7 @@ int mapif_save_pet(int fd,int account_id,struct s_pet *data) pet_id = data->pet_id; p=numdb_search(pet_db,pet_id); if(p == NULL) { - p=malloc(sizeof(struct s_pet)); + p=aMalloc(sizeof(struct s_pet)); if(p==NULL){ printf("int_pet: out of memory !\n"); mapif_save_pet_ack(fd,account_id,1); diff --git a/src/char/int_storage.c b/src/char/int_storage.c index 7a4022a55..73d50f323 100644 --- a/src/char/int_storage.c +++ b/src/char/int_storage.c @@ -192,7 +192,7 @@ struct storage *account2storage(int account_id) struct storage *s; s=numdb_search(storage_db,account_id); if(s == NULL) { - s = calloc(sizeof(struct storage), 1); + s = aCalloc(sizeof(struct storage), 1); if(s==NULL){ printf("int_storage: out of memory!\n"); exit(0); @@ -210,7 +210,7 @@ struct guild_storage *guild2storage(int guild_id) if(inter_guild_search(guild_id) != NULL) { gs=numdb_search(guild_storage_db,guild_id); if(gs == NULL) { - gs = calloc(sizeof(struct guild_storage), 1); + gs = aCalloc(sizeof(struct guild_storage), 1); if(gs==NULL){ printf("int_storage: out of memory!\n"); exit(0); @@ -242,7 +242,7 @@ int inter_storage_init() } while(fgets(line,65535,fp)){ sscanf(line,"%d",&tmp_int); - s=calloc(sizeof(struct storage), 1); + s=aCalloc(sizeof(struct storage), 1); if(s==NULL){ printf("int_storage: out of memory!\n"); exit(0); @@ -254,7 +254,7 @@ int inter_storage_init() } else{ printf("int_storage: broken data [%s] line %d\n",storage_txt,c); - free(s); + aFree(s); } c++; } @@ -270,7 +270,7 @@ int inter_storage_init() } while(fgets(line,65535,fp)){ sscanf(line,"%d",&tmp_int); - gs=calloc(sizeof(struct guild_storage), 1); + gs=aCalloc(sizeof(struct guild_storage), 1); if(gs==NULL){ printf("int_storage: out of memory!\n"); exit(0); @@ -282,7 +282,7 @@ int inter_storage_init() } else{ printf("int_storage: broken data [%s] line %d\n",guild_storage_txt,c); - free(gs); + aFree(gs); } c++; } @@ -356,7 +356,7 @@ int inter_storage_delete(int account_id) inter_pet_delete(*((long *)(&s->storage[i].card[2]))); } numdb_erase(storage_db,account_id); - free(s); + aFree(s); } return 0; } @@ -372,7 +372,7 @@ int inter_guild_storage_delete(int guild_id) inter_pet_delete(*((long *)(&gs->storage[i].card[2]))); } numdb_erase(guild_storage_db,guild_id); - free(gs); + aFree(gs); } return 0; } diff --git a/src/char/inter.c b/src/char/inter.c index a6e2a4199..f0fe38f60 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -114,7 +114,7 @@ int inter_accreg_init() { while(fgets(line, sizeof(line)-1, fp)){ line[sizeof(line)-1] = '\0'; - reg = calloc(sizeof(struct accreg), 1); + reg = aCalloc(sizeof(struct accreg), 1); if (reg == NULL) { printf("inter: accreg: out of memory!\n"); exit(0); @@ -123,7 +123,7 @@ int inter_accreg_init() { numdb_insert(accreg_db, reg->account_id, reg); } else { printf("inter: accreg: broken data [%s] line %d\n", accreg_txt, c); - free(reg); + aFree(reg); } c++; } @@ -371,7 +371,7 @@ int check_ttl_wisdata() { // removed. not send information after a timeout. Just no answer for the player //mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target numdb_erase(wis_db, wd->id); - free(wd); + aFree(wd); } } while(wis_delnum >= WISDELLIST_MAX); @@ -423,7 +423,7 @@ int mapif_parse_WisRequest(int fd) { mapif_send(fd, buf, 27); } else { - wd = (struct WisData *)calloc(sizeof(struct WisData), 1); + wd = (struct WisData *)aCalloc(sizeof(struct WisData), 1); if (wd == NULL){ printf("inter: WisRequest: out of memory !\n"); return 0; @@ -458,7 +458,7 @@ int mapif_parse_WisReply(int fd) { if ((--wd->count) <= 0 || flag != 1) { mapif_wis_end(wd, flag); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target numdb_erase(wis_db, id); - free(wd); + aFree(wd); } return 0; @@ -481,7 +481,7 @@ int mapif_parse_AccReg(int fd) { struct accreg *reg = numdb_search(accreg_db, RFIFOL(fd,4)); if (reg == NULL) { - if ((reg = calloc(sizeof(struct accreg), 1)) == NULL) { + if ((reg = aCalloc(sizeof(struct accreg), 1)) == NULL) { printf("inter: accreg: out of memory !\n"); exit(0); } diff --git a/src/char_sql/char.c b/src/char_sql/char.c index d7f17515b..876ea991d 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -73,7 +73,7 @@ char login_db_level[32] = "level"; int lowest_gm_level = 1; -unsigned char *SQL_CONF_NAME = "conf/inter_athena.conf"; +char *SQL_CONF_NAME = "conf/inter_athena.conf"; struct mmo_map_server server[MAX_MAP_SERVERS]; int server_fd[MAX_MAP_SERVERS]; @@ -206,9 +206,9 @@ void set_char_offline(int char_id, int account_id) { if ( char_id == 99 ) sprintf(tmp_sql,"UPDATE `%s` SET `online`='0' WHERE `account_id`='%d'", char_db, account_id); else { - cp = numdb_search(char_db_,char_id); + cp = (struct mmo_charstatus*)numdb_search(char_db_,char_id); if (cp != NULL) { - free(cp); + aFree(cp); numdb_erase(char_db_,char_id); } @@ -229,7 +229,7 @@ void set_char_offline(int char_id, int account_id) { //----------------------------------------------------- // Function to suppress control characters in a string. //----------------------------------------------------- -int remove_control_chars(unsigned char *str) { +int remove_control_chars(char *str) { int i; int change = 0; @@ -259,7 +259,7 @@ int isGM(int account_id) { void read_gm_account(void) { if (gm_account != NULL) - free(gm_account); + aFree(gm_account); GM_num = 0; sprintf(tmp_lsql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,login_db,login_db_level,lowest_gm_level); @@ -268,7 +268,7 @@ void read_gm_account(void) { } lsql_res = mysql_store_result(&lmysql_handle); if (lsql_res) { - gm_account = aCalloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1); + gm_account = (struct gm_account*)aCalloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1); while ((lsql_row = mysql_fetch_row(lsql_res))) { gm_account[GM_num].account_id = atoi(lsql_row[0]); gm_account[GM_num].level = atoi(lsql_row[1]); @@ -329,7 +329,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ if (char_id!=p->char_id) return 0; - cp = numdb_search(char_db_,char_id); + cp = (struct mmo_charstatus*)numdb_search(char_db_,char_id); if (cp == NULL) { cp = (struct mmo_charstatus *) aMalloc(sizeof(struct mmo_charstatus)); @@ -441,7 +441,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ //===================================================================================================== - if ((p->base_exp != cp->base_exp) || (p->class_ != cp->class_) || + if ((p->base_exp != cp->base_exp) || (p->class_ != cp->class_) || (p->base_level != cp->base_level) || (p->job_level != cp->job_level) || (p->job_exp != cp->job_exp) || (p->zeny != cp->zeny) || (p->last_point.x != cp->last_point.x) || (p->last_point.y != cp->last_point.y) || @@ -457,7 +457,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ (p->shield != cp->shield) || (p->head_top != cp->head_top) || (p->head_mid != cp->head_mid) || (p->head_bottom != cp->head_bottom) || (p->partner_id != cp->partner_id)) { - + //}//---------------------------test count------------------------------ //check party_exist party_exist=0; @@ -546,7 +546,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ diff = 0; for(i=0;iskill[i].lv != 0) && (p->skill[i].id == 0)) + if ((p->skill[i].lv != 0) && (p->skill[i].id == 0)) p->skill[i].id = i; // Fix skill tree if((p->skill[i].id != cp->skill[i].id) || (p->skill[i].lv != cp->skill[i].lv) || @@ -589,7 +589,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ break; } } - + if (diff) { //printf("- Save global_reg_value data to MySQL!\n"); //`global_reg_value` (`char_id`, `str`, `value`) @@ -603,7 +603,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ if (p->global_reg[i].str) { if(p->global_reg[i].value !=0){ sprintf(tmp_sql,"INSERT INTO `%s` (`char_id`, `str`, `value`) VALUES ('%d', '%s','%d')", - reg_db, char_id, jstrescapecpy(temp_str,(unsigned char*)p->global_reg[i].str), p->global_reg[i].value); + reg_db, char_id, jstrescapecpy(temp_str,p->global_reg[i].str), p->global_reg[i].value); if(mysql_query(&mysql_handle, tmp_sql)) { printf("DB server Error (insert `global_reg_value`)- %s\n", mysql_error(&mysql_handle)); } @@ -612,9 +612,9 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ } } - // Friends list + // Friends list // account_id, friend_id0, name0, ... - + tmp_p += sprintf(tmp_p, "REPLACE INTO `%s` (`id`, `account_id`",friend_db); diff = 0; @@ -623,7 +623,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ tmp_p += sprintf(tmp_p, ", `friend_id%d`, `name%d`", i, i); tmp_p += sprintf(tmp_p, ") VALUES (NULL, '%d'", char_id); - + for (i=0;i<20;i++) { tmp_p += sprintf(tmp_p, ", '%d', '%s'", p->friend_id[i], p->friend_name[i]); if ((p->friend_id[i] != cp->friend_id[i]) || @@ -633,7 +633,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ tmp_p += sprintf(tmp_p, ")"); - if (diff) + if (diff) mysql_query(&mysql_handle, tmp_sql); printf("saving char is done.\n"); @@ -882,9 +882,9 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){ char *tmp_p = tmp_sql; struct mmo_charstatus *cp; - cp = numdb_search(char_db_,char_id); + cp = (struct mmo_charstatus*)numdb_search(char_db_,char_id); if (cp != NULL) - free(cp); + aFree(cp); memset(p, 0, sizeof(struct mmo_charstatus)); @@ -966,10 +966,10 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){ } else printf("char2 - failed\n"); //Error?! ERRRRRR WHAT THAT SAY!? - if (p->last_point.x == 0 || p->last_point.y == 0 || p->last_point.map[0] == '\0') + if (p->last_point.x == 0 || p->last_point.y == 0 || p->last_point.map[0] == '\0') memcpy(&p->last_point, &start_point, sizeof(start_point)); - if (p->save_point.x == 0 || p->save_point.y == 0 || p->save_point.map[0] == '\0') + if (p->save_point.x == 0 || p->save_point.y == 0 || p->save_point.map[0] == '\0') memcpy(&p->save_point, &start_point, sizeof(start_point)); printf("char2 "); @@ -1102,10 +1102,10 @@ int mmo_char_fromsql(int char_id, struct mmo_charstatus *p, int online){ sql_row = mysql_fetch_row(sql_res); i=mysql_num_rows(sql_res); - + // debugg //printf("mysql: %d\n",i); - + // Create an entry for the character if it doesnt already have one if(!i) { @@ -1188,15 +1188,15 @@ int mmo_char_sql_init(void) { printf("set char_id_count: %d.......\n",char_id_count); sprintf(tmp_sql , "REPLACE INTO `%s` SET `online`=0", char_db); - if (mysql_query(&mysql_handle, tmp_sql)) + if (mysql_query(&mysql_handle, tmp_sql)) printf("DB server Error - %s\n", mysql_error(&mysql_handle)); sprintf(tmp_sql , "REPLACE INTO `%s` SET `online`=0", guild_member_db); - if (mysql_query(&mysql_handle, tmp_sql)) + if (mysql_query(&mysql_handle, tmp_sql)) printf("DB server Error - %s\n", mysql_error(&mysql_handle)); sprintf(tmp_sql , "REPLACE INTO `%s` SET `connect_member`=0", guild_db); - if (mysql_query(&mysql_handle, tmp_sql)) + if (mysql_query(&mysql_handle, tmp_sql)) printf("DB server Error - %s\n", mysql_error(&mysql_handle)); printf("init end.......\n"); @@ -1212,10 +1212,10 @@ int make_new_char_sql(int fd, unsigned char *dat) { int i; //aphostropy error check! - fixed! - jstrescapecpy(t_name, dat); + jstrescapecpy(t_name, (char*)dat); printf("making new char -"); - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; // Check Authorised letters/symbols in the name of the character if (char_name_option == 1) { // only letters/symbols in char_name_letters are authorised @@ -1477,7 +1477,7 @@ int parse_tologin(int fd) { return 0; } - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; // hehe. no need to set user limite on SQL version. :P // but char limitation is good way to maintain server. :D @@ -1513,7 +1513,7 @@ int parse_tologin(int fd) { if(RFIFOREST(fd)<51) return 0; for(i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data) && sd->account_id == RFIFOL(fd,2)) { + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data) && sd->account_id == RFIFOL(fd,2)) { if (RFIFOB(fd,6) != 0) { WFIFOW(i,0) = 0x6c; WFIFOB(i,2) = 0x42; @@ -1546,7 +1546,7 @@ int parse_tologin(int fd) { if (RFIFOREST(fd) < 50) return 0; for(i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data)) { + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) { if (sd->account_id == RFIFOL(fd,2)) { sd->connect_until_time = (time_t)RFIFOL(fd,46); break; @@ -1606,22 +1606,22 @@ int parse_tologin(int fd) { sql_res = mysql_store_result(&mysql_handle); if (sql_res) { - int char_id, jobclass, skill_point, class; + int char_id, jobclass, skill_point, class_; sql_row = mysql_fetch_row(sql_res); char_id = atoi(sql_row[0]); jobclass = atoi(sql_row[1]); skill_point = atoi(sql_row[2]); - class = jobclass; + class_ = jobclass; if (jobclass == 19 || jobclass == 20 || jobclass == 4020 || jobclass == 4021 || jobclass == 4042 || jobclass == 4043) { // job modification if (jobclass == 19 || jobclass == 20) { - class = (sex) ? 19 : 20; + class_ = (sex) ? 19 : 20; } else if (jobclass == 4020 || jobclass == 4021) { - class = (sex) ? 4020 : 4021; + class_ = (sex) ? 4020 : 4021; } else if (jobclass == 4042 || jobclass == 4043) { - class = (sex) ? 4042 : 4043; + class_ = (sex) ? 4042 : 4043; } // remove specifical skills of classes 19,20 4020,4021 and 4042,4043 sprintf(tmp_sql, "SELECT `lv` FROM `%s` WHERE `char_id` = '%d' AND `id` >= '315' AND `id` <= '330'",skill_db, char_id); @@ -1644,7 +1644,7 @@ int parse_tologin(int fd) { if (mysql_query(&mysql_handle, tmp_sql)) { printf("DB server Error (select `char`)- %s\n", mysql_error(&mysql_handle)); } - sprintf(tmp_sql, "UPDATE `%s` SET `class`='%d' , `skill_point`='%d' , `weapon`='0' , `shield='0' , `head_top`='0' , `head_mid`='0' , `head_bottom`='0' WHERE `char_id` = '%d'",char_db, class, skill_point, char_id); + sprintf(tmp_sql, "UPDATE `%s` SET `class`='%d' , `skill_point`='%d' , `weapon`='0' , `shield='0' , `head_top`='0' , `head_mid`='0' , `head_bottom`='0' WHERE `char_id` = '%d'",char_db, class_, skill_point, char_id); if (mysql_query(&mysql_handle, tmp_sql)) { printf("DB server Error (select `char`)- %s\n", mysql_error(&mysql_handle)); } @@ -1652,7 +1652,7 @@ int parse_tologin(int fd) { } // disconnect player if online on char-server for(i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data)) { + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) { if (sd->account_id == acc) { session[i]->eof = 1; break; @@ -1706,7 +1706,7 @@ int parse_tologin(int fd) { } // disconnect player if online on char-server for(i = 0; i < fd_max; i++) { - if (session[i] && (sd = session[i]->session_data)) { + if (session[i] && (sd = (struct char_session_data*)session[i]->session_data)) { if (sd->account_id == RFIFOL(fd,2)) { session[i]->eof = 1; break; @@ -2296,7 +2296,7 @@ int parse_char(int fd) { struct char_session_data *sd; unsigned char *p = (unsigned char *) &session[fd]->client_addr.sin_addr; - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; if(login_fd < 0) session[fd]->eof = 1; @@ -2353,7 +2353,7 @@ int parse_char(int fd) { */ if (sd == NULL) { CREATE(session[fd]->session_data, struct char_session_data, 1); - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; sd->connect_until_time = 0; // unknow or illimited (not displaying on map-server) } sd->account_id = RFIFOL(fd, 2); @@ -2843,15 +2843,15 @@ int parse_console(char *buf) { printf("Type of command: %s || Command: %s \n",type,command); - if(buf) free(buf); - if(type) free(type); - if(command) free(command); + if(buf) aFree(buf); + if(type) aFree(type); + if(command) aFree(command); return 0; } // MAP send all -int mapif_sendall(unsigned char *buf, unsigned int len) { +int mapif_sendall(char *buf, unsigned int len) { int i, c; int fd; @@ -2867,7 +2867,7 @@ int mapif_sendall(unsigned char *buf, unsigned int len) { return c; } -int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) { +int mapif_sendallwos(int sfd, char *buf, unsigned int len) { int i, c; int fd; @@ -2883,7 +2883,7 @@ int mapif_sendallwos(int sfd, unsigned char *buf, unsigned int len) { return c; } -int mapif_send(int fd, unsigned char *buf, unsigned int len) { +int mapif_send(int fd, char *buf, unsigned int len) { int i; if (fd >= 0) { @@ -3016,12 +3016,12 @@ void do_final(void) { printf("DB server Error (insert `char`)- %s\n", mysql_error(&mysql_handle)); if(gm_account) { - free(gm_account); + aFree(gm_account); gm_account = 0; } if(char_dat) { - free(char_dat); + aFree(char_dat); char_dat = 0; } diff --git a/src/char_sql/char.h b/src/char_sql/char.h index c7261650b..17a938780 100644 --- a/src/char_sql/char.h +++ b/src/char_sql/char.h @@ -41,9 +41,9 @@ struct itemtemp{ struct itemtmp equip[MAX_GUILD_STORAGE],notequip[MAX_GUILD_STORAGE]; }; int memitemdata_to_sql(struct itemtemp mapitem, int eqcount, int noteqcount, int char_id,int tableswitch); -int mapif_sendall(unsigned char *buf,unsigned int len); -int mapif_sendallwos(int fd,unsigned char *buf,unsigned int len); -int mapif_send(int fd,unsigned char *buf,unsigned int len); +int mapif_sendall(char *buf,unsigned int len); +int mapif_sendallwos(int fd,char *buf,unsigned int len); +int mapif_send(int fd,char *buf,unsigned int len); extern int autosave_interval; extern char db_path[]; diff --git a/src/char_sql/int_guild.c b/src/char_sql/int_guild.c index 3f9243bfe..e3b8d30a8 100644 --- a/src/char_sql/int_guild.c +++ b/src/char_sql/int_guild.c @@ -46,7 +46,7 @@ static int _erase_guild(void *key, void *data, va_list ap) { int guild = va_arg(ap, int); struct guild_castle * castle = (struct guild_castle *) data; if (castle->guild_id == guild) { - free(castle); + aFree(castle); db_erase(castle_db_, key); } @@ -60,21 +60,21 @@ int inter_guild_tosql(struct guild *g,int flag) // 2 `guild_member` (`guild_id`,`account_id`,`char_id`,`hair`,`hair_color`,`gender`,`class`,`lv`,`exp`,`exp_payper`,`online`,`position`,`rsv1`,`rsv2`,`name`) // 4 `guild_position` (`guild_id`,`position`,`name`,`mode`,`exp_mode`) // 8 `guild_alliance` (`guild_id`,`opposition`,`alliance_id`,`name`) - // 16 `guild_expulsion` (`guild_id`,`name`,`mes`,`acc`,`account_id`,`rsv1`,`rsv2`,`rsv3`) + // 16 `guild_expulsion` (`guild_id`,`name`,`mes`,`acc`,`account_id`,`rsv1`,`rsv2`,`rsv3`) // 32 `guild_skill` (`guild_id`,`id`,`lv`) - + char t_name[100],t_master[24],t_mes1[60],t_mes2[240],t_member[24],t_position[24],t_alliance[24]; // temporay storage for str convertion; char t_ename[24],t_emes[40]; char emblem_data[4096]; int i=0; int guild_exist=0,guild_member=0,guild_online_member=0; - + if (g->guild_id<=0) return -1; - + printf("(\033[1;35m%d\033[0m) Request save guild -(flag 0x%x) ",g->guild_id, flag); - + jstrescapecpy(t_name, g->name); - + //printf("- Check if guild %d exists\n",g->guild_id); sprintf(tmp_sql, "SELECT count(*) FROM `%s` WHERE `guild_id`='%d'",guild_db,g->guild_id); if(mysql_query(&mysql_handle, tmp_sql) ) { @@ -87,7 +87,7 @@ int inter_guild_tosql(struct guild *g,int flag) //printf("- Check if guild %d exists : %s\n",g->guild_id,((guild_exist==0)?"No":"Yes")); } mysql_free_result(sql_res) ; //resource free - + if (guild_exist >0){ // Check members in party sprintf(tmp_sql,"SELECT count(*) FROM `%s` WHERE `guild_id`='%d'",guild_member_db, g->guild_id); @@ -98,13 +98,13 @@ int inter_guild_tosql(struct guild *g,int flag) sql_res = mysql_store_result(&mysql_handle) ; if (sql_res!=NULL && mysql_num_rows(sql_res)>0) { sql_row = mysql_fetch_row(sql_res); - + guild_member = atoi (sql_row[0]); // printf("- Check members in guild %d : %d \n",g->guild_id,guild_member); } mysql_free_result(sql_res) ; //resource free - + // Delete old guild from sql if (flag&1||guild_member==0){ // printf("- Delete guild %d from guild\n",g->guild_id); @@ -164,7 +164,7 @@ int inter_guild_tosql(struct guild *g,int flag) sprintf(tmp_sql, "DELETE FROM `%s` WHERE `guild_id`='%d'",guild_castle_db, g->guild_id); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (delete `guild_castle`)- %s\n", mysql_error(&mysql_handle) ); - } + } db_foreach(castle_db_, _erase_guild, g->guild_id); } } @@ -175,14 +175,14 @@ int inter_guild_tosql(struct guild *g,int flag) if (g->member[i].account_id>0) guild_online_member++; i++; } - + // No member in guild , no need to create it in sql if (guild_member <= 0 && guild_online_member <=0) { inter_guild_storage_delete(g->guild_id); printf("No member in guild %d , break it! \n",g->guild_id); return -2; } - + // Insert new guild to sqlserver if (flag&1||guild_member==0){ int len=0; @@ -190,7 +190,7 @@ int inter_guild_tosql(struct guild *g,int flag) for(i=0;iemblem_len;i++){ len+=sprintf(emblem_data+len,"%02x",(unsigned char)(g->emblem_data[i])); //printf("%02x",(unsigned char)(g->emblem_data[i])); - } + } emblem_data[len] = '\0'; //printf("- emblem_len = %d \n",g->emblem_len); sprintf(tmp_sql,"INSERT INTO `%s` " @@ -204,7 +204,7 @@ int inter_guild_tosql(struct guild *g,int flag) printf("DB server Error (insert `guild`)- %s\n", mysql_error(&mysql_handle) ); } } - + if (flag&2||guild_member==0){ struct StringBuf sbuf; struct StringBuf sbuf2; @@ -238,16 +238,16 @@ int inter_guild_tosql(struct guild *g,int flag) } StringBuf_Printf(&sbuf2,")"); - if(mysql_query(&mysql_handle, StringBuf_Value(&sbuf))) + if(mysql_query(&mysql_handle, StringBuf_Value(&sbuf))) printf("DB server Error - %s\n", mysql_error(&mysql_handle) ); - if(mysql_query(&mysql_handle, StringBuf_Value(&sbuf2))) + if(mysql_query(&mysql_handle, StringBuf_Value(&sbuf2))) printf("DB server Error - %s\n", mysql_error(&mysql_handle) ); StringBuf_Destroy(&sbuf2); StringBuf_Destroy(&sbuf); } - + if (flag&4||guild_member==0){ //printf("- Insert guild %d to guild_position\n",g->guild_id); for(i=0;i0) { sql_row = mysql_fetch_row(sql_res); if (sql_row==NULL) { mysql_free_result(sql_res); - free(g); + aFree(g); return 0; } - + g->guild_id=atoi(sql_row[0]); strncpy(g->name,sql_row[1],24); strncpy(g->master,sql_row[2],24); @@ -382,7 +382,7 @@ struct guild * inter_guild_fromsql(int guild_id) if(c2>='a' && c2<='f')x2=c2-'a'+10; if(c2>='A' && c2<='F')x2=c2-'A'+10; g->emblem_data[i]=(x1<<4)|x2; - } + } } mysql_free_result(sql_res); @@ -392,7 +392,7 @@ struct guild * inter_guild_fromsql(int guild_id) //printf(" %s\n",tmp_sql); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (select `guild_member`)- %s\n", mysql_error(&mysql_handle) ); - free(g); + aFree(g); return 0; } sql_res = mysql_store_result(&mysql_handle) ; @@ -415,33 +415,33 @@ struct guild * inter_guild_fromsql(int guild_id) } } mysql_free_result(sql_res); - + //printf("- Read guild_position %d from sql \n",guild_id); sprintf(tmp_sql,"SELECT `guild_id`,`position`,`name`,`mode`,`exp_mode` FROM `%s` WHERE `guild_id`='%d'",guild_position_db, guild_id); //printf(" %s\n",tmp_sql); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (select `guild_position`)- %s\n", mysql_error(&mysql_handle) ); - free(g); + aFree(g); return 0; } sql_res = mysql_store_result(&mysql_handle) ; if (sql_res!=NULL && mysql_num_rows(sql_res)>0) { int i; for(i=0;((sql_row = mysql_fetch_row(sql_res))&&iposition[position]; - strncpy(p->name,sql_row[2],24); + strncpy(p->name,sql_row[2],24); p->mode=atoi(sql_row[3]); - p->exp_mode=atoi(sql_row[4]); + p->exp_mode=atoi(sql_row[4]); } } - mysql_free_result(sql_res); + mysql_free_result(sql_res); //printf("- Read guild_alliance %d from sql \n",guild_id); sprintf(tmp_sql,"SELECT `guild_id`,`opposition`,`alliance_id`,`name` FROM `%s` WHERE `guild_id`='%d'",guild_alliance_db, guild_id); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (select `guild_alliance`)- %s\n", mysql_error(&mysql_handle) ); - free(g); + aFree(g); return 0; } sql_res = mysql_store_result(&mysql_handle) ; @@ -455,12 +455,12 @@ struct guild * inter_guild_fromsql(int guild_id) } } mysql_free_result(sql_res); - + //printf("- Read guild_expulsion %d from sql \n",guild_id); sprintf(tmp_sql,"SELECT `guild_id`,`name`,`mes`,`acc`,`account_id`,`rsv1`,`rsv2`,`rsv3` FROM `%s` WHERE `guild_id`='%d'",guild_expulsion_db, guild_id); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (select `guild_expulsion`)- %s\n", mysql_error(&mysql_handle) ); - free(g); + aFree(g); return 0; } sql_res = mysql_store_result(&mysql_handle) ; @@ -476,16 +476,16 @@ struct guild * inter_guild_fromsql(int guild_id) e->rsv1=atoi(sql_row[5]); e->rsv2=atoi(sql_row[6]); e->rsv3=atoi(sql_row[7]); - + } } mysql_free_result(sql_res); - + //printf("- Read guild_skill %d from sql \n",guild_id); sprintf(tmp_sql,"SELECT `guild_id`,`id`,`lv` FROM `%s` WHERE `guild_id`='%d' ORDER BY `id`",guild_skill_db, guild_id); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (select `guild_skill`)- %s\n", mysql_error(&mysql_handle) ); - free(g); + aFree(g); return 0; } sql_res = mysql_store_result(&mysql_handle) ; @@ -497,7 +497,7 @@ struct guild * inter_guild_fromsql(int guild_id) } } mysql_free_result(sql_res); - + // printf("Successfully retrieve guild information from sql!\n"); numdb_insert(guild_db_, guild_id,g); @@ -542,8 +542,8 @@ int inter_guildcastle_tosql(struct guild_castle *gc) "(`castle_id`, `guild_id`, `economy`, `defense`, `triggerE`, `triggerD`, `nextTime`, `payTime`, `createTime`," "`visibleC`, `visibleG0`, `visibleG1`, `visibleG2`, `visibleG3`, `visibleG4`, `visibleG5`, `visibleG6`, `visibleG7`," "`Ghp0`, `Ghp1`, `Ghp2`, `Ghp3`, `Ghp4`, `Ghp5`, `Ghp6`, `Ghp7`)" - "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d')", - guild_castle_db, gc->castle_id, gc->guild_id, gc->economy, gc->defense, gc->triggerE, gc->triggerD, gc->nextTime, gc->payTime, + "VALUES ('%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d','%d')", + guild_castle_db, gc->castle_id, gc->guild_id, gc->economy, gc->defense, gc->triggerE, gc->triggerD, gc->nextTime, gc->payTime, gc->createTime, gc->visibleC, gc->visibleG0, gc->visibleG1, gc->visibleG2, gc->visibleG3, gc->visibleG4, gc->visibleG5, gc->visibleG6, gc->visibleG7, gc->Ghp0, gc->Ghp1, gc->Ghp2, gc->Ghp3, gc->Ghp4, gc->Ghp5, gc->Ghp6, gc->Ghp7); //printf(" %s\n",tmp_sql); @@ -558,7 +558,7 @@ int inter_guildcastle_tosql(struct guild_castle *gc) printf("DB server Error - %s\n", mysql_error(&mysql_handle) ); return 0; } - + sprintf(tmp_sql,"UPDATE `%s` SET `castle_id`='%d' WHERE `guild_id`='%d'",guild_db, gc->castle_id,gc->guild_id); //printf(" %s\n",tmp_sql); if(mysql_query(&mysql_handle, tmp_sql) ) { @@ -567,7 +567,7 @@ int inter_guildcastle_tosql(struct guild_castle *gc) } db_foreach(guild_db_, _set_guild_castle, gc->castle_id,gc->guild_id); - + return 0; } // Read guild_castle from sql @@ -603,7 +603,7 @@ int inter_guildcastle_fromsql(int castle_id,struct guild_castle *gc) mysql_free_result(sql_res); return 0; } - + gc->guild_id = atoi (sql_row[1]); gc->economy = atoi (sql_row[2]); gc->defense = atoi (sql_row[3]); @@ -629,7 +629,7 @@ int inter_guildcastle_fromsql(int castle_id,struct guild_castle *gc) gc->Ghp5 = atoi (sql_row[23]); gc->Ghp6 = atoi (sql_row[24]); gc->Ghp7 = atoi (sql_row[25]); - + //printf("Read Castle %d of guild %d from sql \n",castle_id,gc->guild_id); } @@ -647,7 +647,7 @@ int inter_guild_readdb() FILE *fp; char line[1024]; for (i=0;i<100;i++) guild_exp[i]=0; - + fp=fopen("db/exp_guild.txt","r"); if(fp==NULL){ printf("can't read db/exp_guild.txt\n"); @@ -676,14 +676,14 @@ int inter_guild_sql_init() guild_expcache_db_=numdb_init(); guild_infoevent_db_=numdb_init(); guild_castleinfoevent_db_=numdb_init(); - + printf("interserver guild memory initialize.... (%d byte)\n",sizeof(struct guild)); guild_pt = aCalloc(sizeof(struct guild), 1); guild_pt2= aCalloc(sizeof(struct guild), 1); guildcastle_pt=aCalloc(sizeof(struct guild_castle), 1); - + inter_guild_readdb(); // Read exp - + sprintf (tmp_sql , "SELECT count(*) FROM `%s`",guild_db); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error - %s\n", mysql_error(&mysql_handle) ); @@ -702,13 +702,13 @@ int inter_guild_sql_init() printf("DB server Error - %s\n", mysql_error(&mysql_handle) ); exit(0); } - + sql_res = mysql_store_result(&mysql_handle) ; sql_row = mysql_fetch_row(sql_res); guild_newid = atoi(sql_row[0])+1; mysql_free_result(sql_res); } - + printf("set guild_newid: %d.......\n",guild_newid); return 0; @@ -743,7 +743,7 @@ int guild_check_empty(struct guild *g) return 0; } } - + // 誰もいないので解散 mapif_guild_broken(g->guild_id,0); inter_guild_storage_delete(g->guild_id); @@ -795,7 +795,7 @@ int guild_calcinfo(struct guild *g) nextexp = guild_nextexp(g->guild_lv); } } - + // ギルドの次の経験値 g->next_exp = guild_nextexp(g->guild_lv); @@ -809,13 +809,13 @@ int guild_calcinfo(struct guild *g) if(g->member[i].account_id>0){ g->average_lv+=g->member[i].lv; c++; - + if(g->member[i].online>0) g->connect_member++; } } if(c) g->average_lv/=c; - + // 全データを送る必要がありそう if( g->max_member!=before.max_member || g->guild_lv!=before.guild_lv || @@ -823,7 +823,7 @@ int guild_calcinfo(struct guild *g) mapif_guild_info(-1,g); return 1; } - + return 0; } @@ -906,7 +906,7 @@ int mapif_guild_memberinfoshort(struct guild *g,int idx) WBUFL(buf, 2)=g->guild_id; WBUFL(buf, 6)=g->member[idx].account_id; WBUFL(buf,10)=g->member[idx].char_id; - WBUFB(buf,14)=g->member[idx].online; + WBUFB(buf,14)=(unsigned char)g->member[idx].online; WBUFW(buf,15)=g->member[idx].lv; WBUFW(buf,17)=g->member[idx].class_; mapif_sendall(buf,19); @@ -1121,7 +1121,7 @@ int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member { struct guild *g; int i; - + printf("CreateGuild\n"); g=search_guildname(name); if(g!=NULL&&g->guild_id>0){ @@ -1135,38 +1135,38 @@ int mapif_parse_CreateGuild(int fd,int account_id,char *name,struct guild_member memcpy(g->name,name,24); memcpy(g->master,master->name,24); memcpy(&g->member[0],master,sizeof(struct guild_member)); - + g->position[0].mode=0x11; strcpy(g->position[ 0].name,"GuildMaster"); strcpy(g->position[MAX_GUILDPOSITION-1].name,"Newbie"); for(i=1;iposition[i].name,"Position %d",i+1); - + // Initialize guild property g->max_member=16; g->average_lv=master->lv; g->castle_id=-1; for(i=0;iskill[i].id=i + GD_SKILLBASE; - + // Save to sql printf("Create initialize OK!\n"); i=inter_guild_tosql(g,255); - + if (i<0) { mapif_guild_created(fd,account_id,NULL); return 0; } - + // Report to client mapif_guild_created(fd,account_id,g); mapif_guild_info(fd,g); - + if(log_inter) inter_log("guild %s (id=%d) created by master %s (id=%d)" RETCODE, name, g->guild_id, master->name, master->account_id ); - - + + return 0; } // Return guild info to client @@ -1191,10 +1191,10 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m) mapif_guild_memberadded(fd,guild_id,m->account_id,m->char_id,1); return 0; } - + for(i=0;imax_member;i++){ if(g->member[i].account_id==0){ - + memcpy(&g->member[i],m,sizeof(struct guild_member)); mapif_guild_memberadded(fd,guild_id,m->account_id,m->char_id,0); guild_calcinfo(g); @@ -1211,7 +1211,7 @@ int mapif_parse_GuildAddMember(int fd,int guild_id,struct guild_member *m) int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int flag,const char *mes) { struct guild *g= inter_guild_fromsql(guild_id); - + if(g!=NULL&&g->guild_id>0){ int i; for(i=0;imax_member;i++){ @@ -1219,7 +1219,7 @@ int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int fl g->member[i].char_id==char_id){ printf("%d %d\n",i, (int)(&g->member[i])); printf("%d %s\n",i, g->member[i].name); - + if(flag){ // 追放の場合追放リストに入れる int j; for(j=0;jexplusion[j].name,g->member[i].name,24); memcpy(g->explusion[j].mes,mes,40); } - + mapif_guild_leaved(guild_id,account_id,char_id,flag,g->member[i].name,mes); printf("%d %d\n",i, (int)(&g->member[i])); printf("%d %s\n",i, (&g->member[i])->name); memset(&g->member[i],0,sizeof(struct guild_member)); - + if( guild_check_empty(g)==0 ) mapif_guild_info(-1,g);// まだ人がいるのでデータ送信 /* @@ -1259,12 +1259,12 @@ int mapif_parse_GuildLeave(int fd,int guild_id,int account_id,int char_id,int fl } /* mapif_guild_leaved(guild_id,account_id,char_id,flag,g->member[i].name,mes); */ } - + return 0; } // Change member info int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id, - int account_id,int char_id,int online,int lv,int class) + int account_id,int char_id,int online,int lv,int class_) { // Could speed up by manipulating only guild_member struct guild * g= inter_guild_fromsql(guild_id); @@ -1272,18 +1272,18 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id, if(g==NULL||g->guild_id<=0) return 0; - + g->connect_member=0; idx = -1; - + for(i=0,alv=0,c=0;imax_member;i++){ if( g->member[i].account_id==account_id && g->member[i].char_id==char_id){ - + g->member[i].online=online; g->member[i].lv=lv; - g->member[i].class_=class; + g->member[i].class_=class_; mapif_guild_memberinfoshort(g,i); idx = i; } @@ -1300,13 +1300,13 @@ int mapif_parse_GuildChangeMemberInfoShort(int fd,int guild_id, g->average_lv=alv/c; sprintf(tmp_sql, "UPDATE `%s` SET `connect_member`=%d,`average_lv`=%d WHERE `guild_id`='%d'", guild_db, g->connect_member, g->average_lv, g->guild_id); - if(mysql_query(&mysql_handle, tmp_sql) ) + if(mysql_query(&mysql_handle, tmp_sql) ) printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) ); sprintf(tmp_sql, "UPDATE `%s` SET `online`=%d,`lv`=%d,`class`=%d WHERE `char_id`=%d", guild_member_db, g->member[idx].online, g->member[idx].lv, g->member[idx].class_, g->member[idx].char_id); - if(mysql_query(&mysql_handle, tmp_sql) ) + if(mysql_query(&mysql_handle, tmp_sql) ) printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) ); - + return 0; } @@ -1316,7 +1316,7 @@ int mapif_parse_BreakGuild(int fd,int guild_id) struct guild *g= inter_guild_fromsql(guild_id); if(g==NULL) return 0; - + // Delete guild from sql //printf("- Delete guild %d from guild\n",guild_id); sprintf(tmp_sql, "DELETE FROM `%s` WHERE `guild_id`='%d'",guild_db, guild_id); @@ -1348,7 +1348,7 @@ int mapif_parse_BreakGuild(int fd,int guild_id) if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (delete `guild_position`)- %s\n", mysql_error(&mysql_handle) ); } - + //printf("- Delete guild %d from guild_castle\n",guild_id); sprintf(tmp_sql, "DELETE FROM `%s` WHERE `guild_id`='%d'",guild_castle_db, guild_id); if(mysql_query(&mysql_handle, tmp_sql) ) { @@ -1356,19 +1356,19 @@ int mapif_parse_BreakGuild(int fd,int guild_id) } db_foreach(castle_db_, _erase_guild, guild_id); - + //printf("- Update guild %d of char\n",guild_id); sprintf(tmp_sql, "UPDATE `%s` SET `guild_id`='0' WHERE `guild_id`='%d'",char_db, guild_id); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (delete `guild_position`)- %s\n", mysql_error(&mysql_handle) ); } - + inter_guild_storage_delete(guild_id); mapif_guild_broken(guild_id,0); - + if(log_inter) inter_log("guild %s (id=%d) broken" RETCODE,g->name,guild_id); - + return 0; } @@ -1416,7 +1416,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha struct guild * g = inter_guild_fromsql(guild_id); //printf("GuildMemberInfoChange %s \n",(type==GMI_EXP)?"GMI_EXP":"OTHER"); - + if(g==NULL){ return 0; } @@ -1437,7 +1437,7 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha inter_guild_tosql(g,3); // Change guild & guild_member break; } - case GMI_EXP: + case GMI_EXP: { // EXP int exp,oldexp=g->member[i].exp; exp=g->member[i].exp=*((unsigned int *)data); @@ -1447,11 +1447,11 @@ int mapif_parse_GuildMemberInfoChange(int fd,int guild_id,int account_id,int cha mapif_guild_memberinfochanged(guild_id,account_id,char_id,type,data,len); sprintf(tmp_sql, "UPDATE `%s` SET `guild_lv`=%d,`connect_member`=%d,`max_member`=%d,`average_lv`=%d,`exp`=%d,`next_exp`=%d,`skill_point`=%d WHERE `guild_id`='%d'", guild_db, g->guild_lv, g->connect_member, g->max_member, g->average_lv, g->exp, g->next_exp, g->skill_point, g->guild_id); - if(mysql_query(&mysql_handle, tmp_sql) ) + if(mysql_query(&mysql_handle, tmp_sql) ) printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) ); sprintf(tmp_sql, "UPDATE `%s` SET `exp`=%d WHERE `char_id`=%d", guild_member_db, g->member[i].exp, g->member[i].char_id); - if(mysql_query(&mysql_handle, tmp_sql) ) + if(mysql_query(&mysql_handle, tmp_sql) ) printf("DB server Error: %s - %s\n", tmp_sql, mysql_error(&mysql_handle) ); break; } @@ -1488,7 +1488,7 @@ int mapif_parse_GuildSkillUp(int fd,int guild_id,int skill_num,int account_id) if(g == NULL || idx < 0 || idx >= MAX_GUILDSKILL) return 0; //printf("GuildSkillUp\n"); - + if( g->skill_point>0 && g->skill[idx].id>0 && g->skill[idx].lv<10 ){ g->skill[idx].lv++; @@ -1511,10 +1511,10 @@ int mapif_parse_GuildAlliance(int fd,int guild_id1,int guild_id2, int j,i; g[0]= inter_guild_fromsql(guild_id1); g[1]= inter_guild_fromsql(guild_id2); - + if(g[0]==NULL || g[1]==NULL || g[0]->guild_id ==0 || g[1]->guild_id==0) return 0; - + if(!(flag&0x8)){ for(i=0;i<2-(flag&1);i++){ for(j=0;jguild_id<=0) return 0; memcpy(g->mes1,mes1,60); @@ -1557,7 +1557,7 @@ int mapif_parse_GuildNotice(int fd,int guild_id,const char *mes1,const char *mes int mapif_parse_GuildEmblem(int fd,int len,int guild_id,int dummy,const char *data) { struct guild * g= inter_guild_fromsql(guild_id); - + if(g==NULL||g->guild_id<=0) return 0; memcpy(g->emblem_data,data,len); diff --git a/src/char_sql/int_party.c b/src/char_sql/int_party.c index af3ad7dc3..9ea3a5635 100644 --- a/src/char_sql/int_party.c +++ b/src/char_sql/int_party.c @@ -207,7 +207,7 @@ int inter_party_sql_init(){ //memory alloc printf("interserver party memory initialize.... (%d byte)\n",sizeof(struct party)); - party_pt = calloc(sizeof(struct party), 1); + party_pt = aCalloc(sizeof(struct party), 1); sprintf (tmp_sql , "SELECT count(*) FROM `%s`",party_db); if(mysql_query(&mysql_handle, tmp_sql) ) { diff --git a/src/char_sql/int_pet.c b/src/char_sql/int_pet.c index 44151c8e4..18172b066 100644 --- a/src/char_sql/int_pet.c +++ b/src/char_sql/int_pet.c @@ -105,7 +105,7 @@ int inter_pet_sql_init(){ //memory alloc printf("interserver pet memory initialize.... (%d byte)\n",sizeof(struct s_pet)); - pet_pt = calloc(sizeof(struct s_pet), 1); + pet_pt = aCalloc(sizeof(struct s_pet), 1); sprintf (tmp_sql , "SELECT count(*) FROM `%s`", pet_db); if(mysql_query(&mysql_handle, tmp_sql) ) { diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c index 69eaf2469..e2d4010a1 100644 --- a/src/char_sql/int_storage.c +++ b/src/char_sql/int_storage.c @@ -191,8 +191,8 @@ int inter_storage_sql_init(){ //memory alloc printf("interserver storage memory initialize....(%d byte)\n",sizeof(struct storage)); - storage_pt=calloc(sizeof(struct storage), 1); - guild_storage_pt=calloc(sizeof(struct guild_storage), 1); + storage_pt=aCalloc(sizeof(struct storage), 1); + guild_storage_pt=aCalloc(sizeof(struct guild_storage), 1); memset(storage_pt,0,sizeof(struct storage)); memset(guild_storage_pt,0,sizeof(struct guild_storage)); diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c index 52a53f702..92a002898 100644 --- a/src/char_sql/inter.c +++ b/src/char_sql/inter.c @@ -402,7 +402,7 @@ int check_ttl_wisdata() { // removed. not send information after a timeout. Just no answer for the player //mapif_wis_end(wd, 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target numdb_erase(wis_db, wd->id); - free(wd); + aFree(wd); } } while(wis_delnum >= WISDELLIST_MAX); @@ -490,7 +490,7 @@ int mapif_parse_WisReply(int fd) { if ((--wd->count) <= 0 || flag != 1) { mapif_wis_end(wd, flag); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target numdb_erase(wis_db, id); - free(wd); + aFree(wd); } return 0; diff --git a/src/char_sql/itemdb.c b/src/char_sql/itemdb.c index 0bed07c23..efd3df84b 100644 --- a/src/char_sql/itemdb.c +++ b/src/char_sql/itemdb.c @@ -172,7 +172,7 @@ static int itemdb_read_sqldb(void) // sql item_db read, shortened version of map // Insert a new row into the item database /* - id = calloc(sizeof(struct item_data), 1); + id = aCalloc(sizeof(struct item_data), 1); if (id == NULL) { printf("out of memory : itemdb_read_sqldb\n"); @@ -214,10 +214,10 @@ static int itemdb_final(void *key,void *data,va_list ap) id=data; if(id->use_script) - free(id->use_script); + aFree(id->use_script); if(id->equip_script) - free(id->equip_script); - free(id); + aFree(id->equip_script); + aFree(id); return 0; } diff --git a/src/char_sql/itemdb.h b/src/char_sql/itemdb.h index dea835e78..762873c8e 100644 --- a/src/char_sql/itemdb.h +++ b/src/char_sql/itemdb.h @@ -6,7 +6,7 @@ struct item_data { char name[24],jname[24]; int value_buy,value_sell,value_notdc,value_notoc; int type; - int class; + int class_; int sex; int equip; int weight; diff --git a/src/common/core.c b/src/common/core.c index 493aab850..a8c922fc3 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -9,6 +9,7 @@ #include #include +#include "../common/mmo.h" #include "core.h" #include "socket.h" #include "timer.h" diff --git a/src/common/db.c b/src/common/db.c index bc4e8451b..d76b7a44c 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -424,7 +424,7 @@ void* db_erase(struct dbt *table,void* key) #ifdef MALLOC_DBN free_dbn(p); #else - free(p); + aFree(p); #endif return data; } @@ -497,11 +497,11 @@ void db_final(struct dbt *table,int (*func)(void*,void*,va_list),...) #ifdef MALLOC_DBN free_dbn(p); #else - free(p); + aFree(p); #endif p=pn; } } - free(table); + aFree(table); va_end(ap); } diff --git a/src/common/grfio.c b/src/common/grfio.c index 440c3b2a3..6afd1d668 100644 --- a/src/common/grfio.c +++ b/src/common/grfio.c @@ -25,8 +25,6 @@ #include #include -#include - #include "utils.h" #include "grfio.h" #include "mmo.h" @@ -284,7 +282,7 @@ static void decode_des_etc(BYTE *buf,int len,int type,int cycle) * Grf data decode sub : zip *------------------------------------------ */ -int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen) +int decode_zip(char *dest, unsigned long* destLen, const char* source, unsigned long sourceLen) { z_stream stream; int err; @@ -301,21 +299,21 @@ int decode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* stream.zalloc = (alloc_func)0; stream.zfree = (free_func)0; - err = inflateInit(&stream); + err = zlib_inflateInit(&stream); if (err != Z_OK) return err; - err = inflate(&stream, Z_FINISH); + err = zlib_inflate(&stream, Z_FINISH); if (err != Z_STREAM_END) { - inflateEnd(&stream); + zlib_inflateEnd(&stream); return err == Z_OK ? Z_BUF_ERROR : err; } *destLen = stream.total_out; - err = inflateEnd(&stream); + err = zlib_inflateEnd(&stream); return err; } -int encode_zip(unsigned char *dest, unsigned long* destLen, const unsigned char* source, unsigned long sourceLen) { +int encode_zip(char *dest, unsigned long* destLen, const char* source, unsigned long sourceLen) { z_stream stream; int err; @@ -513,14 +511,14 @@ int grfio_size(char *fname) char lfname[256],*rname,*p; FILELIST lentry; struct stat st; - + if(strcmp(data_dir, "") != 0 && (rname=grfio_resnametable(fname,lfname))!=NULL) { //printf("%s\t",fname); //sprintf(rname,"%s",grfio_resnametable(fname,lfname)); //printf("%s\n",rname); sprintf(lfname,"%s%s",data_dir,rname); //printf("%s\n",lfname); - } + } for(p=&lfname[0];*p!=0;p++) if (*p=='\\') *p = '/'; // * At the time of Unix @@ -557,7 +555,7 @@ void* grfio_reads(char *fname, int *size) strncpy(lfname,fname,255); // i hope this is the correct way =p [celest] - if ((rname=grfio_resnametable(fname,lfname))!=NULL) { + if ((rname=grfio_resnametable(fname,lfname))!=NULL) { char tbuf[255]; //sprintf(rname,"%s",grfio_resnametable(fname,lfname)); sprintf(tbuf,"%s%s",data_dir,rname); @@ -576,7 +574,7 @@ void* grfio_reads(char *fname, int *size) lentry.declen = ftell(in); } fseek(in,0,0); // SEEK_SET - buf2 = (unsigned char *) aCalloc(lentry.declen+1024, 1); + buf2 = (unsigned char *) aCallocA(lentry.declen+1024, 1); if (buf2==NULL) { printf("file read memory allocate error : declen\n"); goto errret; @@ -592,13 +590,13 @@ void* grfio_reads(char *fname, int *size) } else { printf("%s not found (grfio_reads)\n", fname); //goto errret; - free(buf2); + aFree(buf2); return NULL; } } } if (entry!=NULL && entry->gentry>0) { // Archive[GRF] File Read - buf = (unsigned char *) aCalloc(entry->srclen_aligned+1024, 1); + buf = (unsigned char *) aCallocA(entry->srclen_aligned+1024, 1); if (buf==NULL) { printf("file read memory allocate error : srclen_aligned\n"); goto errret; @@ -608,13 +606,13 @@ void* grfio_reads(char *fname, int *size) if(in==NULL) { printf("%s not found (grfio_reads)\n",gfname); //goto errret; - free(buf); + aFree(buf); return NULL; } fseek(in,entry->srcpos,0); fread(buf,1,entry->srclen_aligned,in); fclose(in); - buf2 = (unsigned char *) aCalloc(entry->declen+1024, 1); + buf2 = (unsigned char *) aCallocA(entry->declen+1024, 1); if (buf2==NULL) { printf("file decode memory allocate error\n"); goto errret; @@ -633,14 +631,14 @@ void* grfio_reads(char *fname, int *size) } else { memcpy(buf2,buf,entry->declen); } - free(buf); + aFree(buf); } if (size!=NULL && entry!=NULL) *size = entry->declen; return buf2; errret: - if (buf!=NULL) free(buf); - if (buf2!=NULL) free(buf2); + if (buf!=NULL) aFree(buf); + if (buf2!=NULL) aFree(buf2); if (in!=NULL) fclose(in); return NULL; } @@ -704,7 +702,7 @@ static int grfio_entryread(char *gfname,int gentry) if (grf_version==0x01) { //****** Grf version 01xx ****** list_size = grf_size-ftell(fp); - grf_filelist = (unsigned char *) aCalloc(list_size, 1); + grf_filelist = (unsigned char *) aCallocA(list_size, 1); if(grf_filelist==NULL){ fclose(fp); printf("out of memory : grf_filelist\n"); @@ -727,7 +725,7 @@ static int grfio_entryread(char *gfname,int gentry) fname = decode_filename(grf_filelist+ofs+6,grf_filelist[ofs]-6); if(strlen((const char *) fname)>sizeof(aentry.fn)-1){ printf("file name too long : %s\n",fname); - free(grf_filelist); + aFree(grf_filelist); exit(1); } srclen=0; @@ -762,7 +760,7 @@ static int grfio_entryread(char *gfname,int gentry) } ofs = ofs2 + 17; } - free(grf_filelist); + aFree(grf_filelist); } else if (grf_version==0x02) { //****** Grf version 02xx ****** unsigned char eheader[8]; @@ -779,15 +777,15 @@ static int grfio_entryread(char *gfname,int gentry) return 4; } - rBuf = (unsigned char *) aCalloc( rSize , 1); // Get a Read Size + rBuf = (unsigned char *) aCallocA( rSize , 1); // Get a Read Size if (rBuf==NULL) { fclose(fp); printf("out of memory : grf compress entry table buffer\n"); return 3; } - grf_filelist = (unsigned char *) aCalloc( eSize , 1); // Get a Extend Size + grf_filelist = (unsigned char *) aCallocA( eSize , 1); // Get a Extend Size if (grf_filelist==NULL) { - free(rBuf); + aFree(rBuf); fclose(fp); printf("out of memory : grf extract entry table buffer\n"); return 3; @@ -796,7 +794,7 @@ static int grfio_entryread(char *gfname,int gentry) fclose(fp); decode_zip(grf_filelist,&eSize,rBuf,rSize); // Decode function list_size = eSize; - free(rBuf); + aFree(rBuf); entrys = getlong(grf_header+0x26) - 7; @@ -808,7 +806,7 @@ static int grfio_entryread(char *gfname,int gentry) fname = grf_filelist+ofs; if (strlen((const char *) fname)>sizeof(aentry.fn)-1) { printf("grf : file name too long : %s\n",fname); - free(grf_filelist); + aFree(grf_filelist); exit(1); } ofs2 = ofs+strlen(grf_filelist+ofs)+1; @@ -839,7 +837,7 @@ static int grfio_entryread(char *gfname,int gentry) } ofs = ofs2 + 17; } - free(grf_filelist); + aFree(grf_filelist); } else { //****** Grf Other version ****** fclose(fp); @@ -859,11 +857,11 @@ static int grfio_entryread(char *gfname,int gentry) static void grfio_resourcecheck() { int size; - unsigned char *buf,*ptr; + char *buf,*ptr; char w1[256],w2[256],src[256],dst[256]; FILELIST *entry; - buf=grfio_reads("data\\resnametable.txt",&size); + buf = (char*)grfio_reads("data\\resnametable.txt",&size); buf[size] = 0; for(ptr=buf;ptr-buf #include #include #include "malloc.h" +#if !defined(DMALLOC) && !defined(GCOLLECT) && !defined(BCHECK) + void* aMalloc_( size_t size, const char *file, int line, const char *func ) { void *ret; @@ -45,9 +46,27 @@ void* aRealloc_( void *p, size_t size, const char *file, int line, const char *f return ret; } +#endif + + +#if defined(GCOLLECT) + +void * _bcallocA(size_t size, size_t cnt) { + void *ret = aMallocA(size * cnt); + memset(ret, 0, size * cnt); + return ret; +} + void * _bcalloc(size_t size, size_t cnt) { - void *ret = malloc(size * cnt); + void *ret = aMalloc(size * cnt); memset(ret, 0, size * cnt); return ret; } #endif + +char * _bstrdup(const char *chr) { + int len = strlen(chr); + char *ret = aMalloc(len + 1); + strcpy(ret, chr); + return ret; +} diff --git a/src/common/malloc.h b/src/common/malloc.h index 860f8dd7b..b37c3b799 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -9,23 +9,39 @@ #define aMalloc(size) \ dmalloc_malloc(__FILE__, __LINE__, (size), DMALLOC_FUNC_MALLOC, 0, 0) +#define aMallocA(size) \ + dmalloc_malloc(__FILE__, __LINE__, (size), DMALLOC_FUNC_MALLOC, 0, 0) +#define aCallocA(count,size) \ + dmalloc_malloc(__FILE__, __LINE__, (count)*(size), DMALLOC_FUNC_CALLOC, 0, 0) #define aCalloc(count,size) \ dmalloc_malloc(__FILE__, __LINE__, (count)*(size), DMALLOC_FUNC_CALLOC, 0, 0) #define aRealloc(ptr,size) \ dmalloc_realloc(__FILE__, __LINE__, (ptr), (size), DMALLOC_FUNC_REALLOC, 0) +#define aFree(ptr) free(ptr) +#define aStrdup(ptr) strdup(ptr) #elif defined(GCOLLECT) #include "gc.h" #define aMalloc(n) GC_MALLOC(n) +#define aMallocA(n) GC_MALLOC_ATOMIC(n) +#define aCallocA(m,n) _bcallocA(m,n) #define aCalloc(m,n) _bcalloc(m,n) #define aRealloc(p,n) GC_REALLOC(p,n) +#define aFree(n) GC_FREE(n) +#define aStrdup(n) _bstrdup(n) extern void * _bcalloc(size_t, size_t); +extern void * _bcallocA(size_t, size_t); +extern char * _bstrdup(const char *); #elif defined(BCHECK) #define aMalloc(n) malloc(n) +#define aMallocA(n) malloc(n) #define aCalloc(m,n) calloc(m,n) +#define aCallocA(m,n) calloc(m,n) #define aRealloc(p,n) realloc(p,n) +#define aFree(n) free(n) +#define aStrdup(n) strdup(n) #else #if __STDC_VERSION__ < 199901L @@ -43,8 +59,12 @@ void* aCalloc_( size_t num, size_t size, const char *file, int line, const char void* aRealloc_( void *p, size_t size, const char *file, int line, const char *func ); #define aMalloc(n) aMalloc_(n,ALC_MARK) +#define aMallocA(n) aMalloc_(n,ALC_MARK) #define aCalloc(m,n) aCalloc_(m,n,ALC_MARK) +#define aCallocA(m,n) aCalloc_(m,n,ALC_MARK) #define aRealloc(p,n) aRealloc_(p,n,ALC_MARK) +#define aFree(ptr) free(ptr) +#define aStrdup(ptr) strdup(ptr) #endif diff --git a/src/common/mmo.h b/src/common/mmo.h index 41598509e..a8722e53e 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -326,19 +326,25 @@ enum { GD_DEVELOPMENT=10014, }; -#ifndef _WIN32 -#ifndef strcmpi -#define strcmpi strcasecmp -#endif -#ifndef stricmp -#define stricmp strcasecmp -#endif -#ifndef strncmpi -#define strncmpi strncasecmp -#endif -#ifndef strnicmp -#define strnicmp strncasecmp -#endif +#ifndef __WIN32 + #ifndef strcmpi + #define strcmpi strcasecmp + #endif + #ifndef stricmp + #define stricmp strcasecmp + #endif + #ifndef strncmpi + #define strncmpi strncasecmp + #endif + #ifndef strnicmp + #define strnicmp strncasecmp + #endif +#else + #define snprintf _snprintf + #define vsnprintf _vsnprintf + #ifndef strncmpi + #define strncmpi strnicmp + #endif #endif #endif // _MMO_H_ diff --git a/src/common/showmsg.c b/src/common/showmsg.c index 857a819bb..ddaae3a52 100644 --- a/src/common/showmsg.c +++ b/src/common/showmsg.c @@ -2,6 +2,7 @@ #include #include #include "showmsg.h" +#include "malloc.h" char tmp_output[1024] = {"\0"}; @@ -47,7 +48,7 @@ int _ShowMessage(const char *string, enum msg_type flag){ // by MC Cameri return 1; } if (!(flag == MSG_DEBUG && !SHOW_DEBUG_MSG)) { - output = (char*)malloc(sizeof(char)*(strlen(prefix)+strlen(string)+2)); // prefix+string+two chars(space and \0) + output = (char*)aMalloc(sizeof(char)*(strlen(prefix)+strlen(string)+2)); // prefix+string+two chars(space and \0) if (output == NULL) { return 1; // exit(1); // Kill server? Deadly @@ -58,7 +59,7 @@ int _ShowMessage(const char *string, enum msg_type flag){ // by MC Cameri strcat(output,string); printf(output); fflush(stdout); - free(output); + aFree(output); } /* if ((core_config.debug_output_level > -1) && (flag >= core_config.debug_output_level)) { diff --git a/src/common/socket.c b/src/common/socket.c index 764d4d821..72e7e3f22 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -3,11 +3,13 @@ #include #include #include +#include #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include #include +#include #else #include #include @@ -16,7 +18,6 @@ #include #include #include -#include #ifndef SIOCGIFCONF #include // SIOCGIFCONF on Solaris, maybe others? [Shinomori] @@ -151,11 +152,11 @@ static int send_from_fifo(int fd) return 0; } -void flush_fifos() +void flush_fifos() { int i; for(i=0;ifunc_send == send_from_fifo) send_from_fifo(i); } @@ -177,20 +178,22 @@ static int connect_client(int listen_fd) int fd; struct sockaddr_in client_address; int len; +#ifndef _WIN32 int result; +#endif //printf("connect_client : %d\n",listen_fd); len=sizeof(client_address); - fd=accept(listen_fd,(struct sockaddr*)&client_address,&len); + fd = accept(listen_fd,(struct sockaddr*)&client_address,(socklen_t*)&len); if(fd_max<=fd) fd_max=fd+1; setsocketopts(fd); if(fd==-1) perror("accept"); - else + else FD_SET(fd,&readfds); #ifdef _WIN32 @@ -203,8 +206,8 @@ static int connect_client(int listen_fd) #endif CREATE(session[fd], struct socket_data, 1); - CREATE(session[fd]->rdata, unsigned char, rfifo_size); - CREATE(session[fd]->wdata, unsigned char, wfifo_size); + CREATE_A(session[fd]->rdata, unsigned char, rfifo_size); + CREATE_A(session[fd]->wdata, unsigned char, wfifo_size); session[fd]->max_rdata = rfifo_size; session[fd]->max_wdata = wfifo_size; @@ -240,7 +243,7 @@ int make_listen_port(int port) server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = htonl( INADDR_ANY ); - server_address.sin_port = htons(port); + server_address.sin_port = htons((unsigned short)port); result = bind(fd, (struct sockaddr*)&server_address, sizeof(server_address)); if( result == -1 ) { @@ -271,12 +274,13 @@ int make_listen_port(int port) int console_recieve(int i) { int n; char *buf; - - CREATE(buf, char , 64); - + + CREATE_A(buf, char , 64); + memset(buf,0,sizeof(64)); n = read(0, buf , 64); + if ( n < 0 ) printf("Console input read error\n"); else @@ -298,21 +302,21 @@ static int null_console_parse(char *buf) // Console Input [Wizputer] int start_console(void) { FD_SET(0,&readfds); - + CREATE(session[0], struct socket_data, 1); if(session[0]==NULL){ printf("out of memory : start_console\n"); exit(1); } - + memset(session[0],0,sizeof(*session[0])); - + session[0]->func_recv = console_recieve; session[0]->func_console = default_console_parse; - + return 0; -} - +} + int make_connection(long ip,int port) { struct sockaddr_in server_address; @@ -320,14 +324,14 @@ int make_connection(long ip,int port) int result; fd = socket( AF_INET, SOCK_STREAM, 0 ); - if(fd_max<=fd) + if(fd_max<=fd) fd_max=fd+1; setsocketopts(fd); server_address.sin_family = AF_INET; server_address.sin_addr.s_addr = ip; - server_address.sin_port = htons(port); + server_address.sin_port = htons((unsigned short)port); #ifdef _WIN32 { @@ -343,8 +347,8 @@ int make_connection(long ip,int port) FD_SET(fd,&readfds); CREATE(session[fd], struct socket_data, 1); - CREATE(session[fd]->rdata, unsigned char, rfifo_size); - CREATE(session[fd]->wdata, unsigned char, wfifo_size); + CREATE_A(session[fd]->rdata, unsigned char, rfifo_size); + CREATE_A(session[fd]->wdata, unsigned char, wfifo_size); session[fd]->max_rdata = rfifo_size; session[fd]->max_wdata = wfifo_size; @@ -363,12 +367,12 @@ int delete_session(int fd) FD_CLR(fd,&readfds); if(session[fd]){ if(session[fd]->rdata) - free(session[fd]->rdata); + aFree(session[fd]->rdata); if(session[fd]->wdata) - free(session[fd]->wdata); + aFree(session[fd]->wdata); if(session[fd]->session_data) - free(session[fd]->session_data); - free(session[fd]); + aFree(session[fd]->session_data); + aFree(session[fd]); } session[fd]=NULL; //printf("delete_session:%d\n",fd); @@ -401,7 +405,7 @@ int WFIFOSET(int fd,int len) } s->wdata_size=(s->wdata_size+(len)+2048 < s->max_wdata) ? s->wdata_size+len : (printf("socket: %d wdata lost !!\n",fd),s->wdata_size); - if (s->wdata_size > (TCP_FRAME_LEN)) + if (s->wdata_size > (TCP_FRAME_LEN)) send_from_fifo(fd); return 0; } @@ -456,7 +460,7 @@ int do_parsepacket(void) for(i=0;irdata_tick != 0) && ((tick_ - session[i]->rdata_tick) > stall_time_)) + if ((session[i]->rdata_tick != 0) && ((tick_ - session[i]->rdata_tick) > stall_time_)) session[i]->eof = 1; if(session[i]->rdata_size==0 && session[i]->eof==0) continue; @@ -500,7 +504,7 @@ int Net_Init(void) unsigned int i; char fullhost[255]; struct hostent* hent; - + /* Start up the windows networking */ WSADATA wsaData; @@ -512,7 +516,7 @@ int Net_Init(void) if(gethostname(fullhost, sizeof(fullhost)) == SOCKET_ERROR) { printf("Ugg.. no hostname defined!\n"); return 0; - } + } // XXX This should look up the local IP addresses in the registry // instead of calling gethostbyname. However, the way IP addresses @@ -545,7 +549,7 @@ int Net_Init(void) return 0; } - for(pos = 0; pos < ic.ifc_len;) + for(pos = 0; pos < ic.ifc_len;) { struct ifreq * ir = (struct ifreq *) (ic.ifc_buf + pos); diff --git a/src/common/socket.h b/src/common/socket.h index 172712d26..68b204862 100644 --- a/src/common/socket.h +++ b/src/common/socket.h @@ -5,8 +5,9 @@ #include -#ifdef _WIN32 +#ifdef __WIN32 #include +#define close(fd) closesocket(fd) #else #include #include diff --git a/src/common/strlib.c b/src/common/strlib.c index 9114c3d03..ca6e38761 100644 --- a/src/common/strlib.c +++ b/src/common/strlib.c @@ -8,15 +8,15 @@ //----------------------------------------------- // string lib. -unsigned char* jstrescape (unsigned char* pt) { +char* jstrescape (char* pt) { //copy from here unsigned char * ptr; int i =0, j=0; - + //copy string to temporary - CREATE(ptr, char, J_MAX_MALLOC_SIZE); + CREATE_A(ptr, char, J_MAX_MALLOC_SIZE); strcpy (ptr,pt); - + while (ptr[i] != '\0') { switch (ptr[i]) { case '\'': @@ -32,14 +32,14 @@ unsigned char* jstrescape (unsigned char* pt) { } } pt[j++] = '\0'; - free (ptr); - return (unsigned char*) &pt[0]; + aFree (ptr); + return &pt[0]; } -unsigned char* jstrescapecpy (unsigned char* pt,unsigned char* spt) { +char* jstrescapecpy (char* pt,char* spt) { //copy from here int i =0, j=0; - + while (spt[i] != '\0') { switch (spt[i]) { case '\'': @@ -55,12 +55,12 @@ unsigned char* jstrescapecpy (unsigned char* pt,unsigned char* spt) { } } pt[j++] = '\0'; - return (unsigned char*) &pt[0]; + return &pt[0]; } -int jmemescapecpy (unsigned char* pt,unsigned char* spt, int size) { +int jmemescapecpy (char* pt,char* spt, int size) { //copy from here int i =0, j=0; - + while (i < size) { switch (spt[i]) { case '\'': diff --git a/src/common/strlib.h b/src/common/strlib.h index 6b6169083..54c52cf94 100644 --- a/src/common/strlib.h +++ b/src/common/strlib.h @@ -4,7 +4,7 @@ // String function library. // code by Jioh L. Jung (ziozzang@4wish.net) // This code is under license "BSD" -unsigned char* jstrescape (unsigned char* pt); -unsigned char* jstrescapecpy (unsigned char* pt,unsigned char* spt); -int jmemescapecpy (unsigned char* pt,unsigned char* spt, int size); +char* jstrescape (char* pt); +char* jstrescapecpy (char* pt,char* spt); +int jmemescapecpy (char* pt,char* spt, int size); #endif diff --git a/src/common/timer.c b/src/common/timer.c index 4c602b51e..8b52811b8 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -262,7 +262,7 @@ int add_timer(unsigned int tick,int (*func)(int,unsigned int,int,int),int id,int int j; if (timer_data_max == 0) { timer_data_max = 256; - CREATE(timer_data, struct TimerData, timer_data_max); + CREATE_A(timer_data, struct TimerData, timer_data_max); //timer_data[0] = NULL; } else { timer_data_max += 256; @@ -403,13 +403,13 @@ void timer_final(void) for(tfl = tfl_root; tfl; tfl = tfl_next) { tfl_next = tfl->next; - free(tfl); + aFree(tfl); tfl = NULL; } if(timer_heap) - free(timer_heap); + aFree(timer_heap); if(free_timer_list) - free(free_timer_list); + aFree(free_timer_list); if(timer_data) - free(timer_data); + aFree(timer_data); } diff --git a/src/common/utils.c b/src/common/utils.c index 9a7722478..732b1d366 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -4,6 +4,7 @@ #include #include #include "malloc.h" +#include "mmo.h" void dump(unsigned char *buffer, int num) { @@ -112,7 +113,7 @@ void str_lower(char *name) // Allocate a StringBuf [MouseJstr] struct StringBuf * StringBuf_Malloc() { - struct StringBuf * ret = (struct StringBuf *) malloc(sizeof(struct StringBuf)); + struct StringBuf * ret = (struct StringBuf *) aMallocA(sizeof(struct StringBuf)); StringBuf_Init(ret); return ret; } @@ -120,7 +121,7 @@ struct StringBuf * StringBuf_Malloc() // Initialize a previously allocated StringBuf [MouseJstr] void StringBuf_Init(struct StringBuf * sbuf) { sbuf->max_ = 1024; - sbuf->ptr_ = sbuf->buf_ = (char *) malloc(sbuf->max_ + 1); + sbuf->ptr_ = sbuf->buf_ = (char *) aMallocA(sbuf->max_ + 1); } // printf into a StringBuf, moving the pointer [MouseJstr] @@ -169,7 +170,7 @@ int StringBuf_Append(struct StringBuf *buf1,const struct StringBuf *buf2) // Destroy a StringBuf [MouseJstr] void StringBuf_Destroy(struct StringBuf *sbuf) { - free(sbuf->buf_); + aFree(sbuf->buf_); sbuf->ptr_ = sbuf->buf_ = 0; } @@ -177,7 +178,7 @@ void StringBuf_Destroy(struct StringBuf *sbuf) void StringBuf_Free(struct StringBuf *sbuf) { StringBuf_Destroy(sbuf); - free(sbuf); + aFree(sbuf); } // Return the built string from the StringBuf [MouseJstr] diff --git a/src/common/utils.h b/src/common/utils.h index 0ac880a50..63c3f21ec 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -30,6 +30,12 @@ if (!((result) = (type *) aCalloc ((number), sizeof(type)))) \ { perror("SYSERR: malloc failure"); abort(); } } while(0) +#define CREATE_A(result, type, number) do {\ + if ((number) * sizeof(type) <= 0) \ + printf("SYSERR: Zero bytes or less requested at %s:%d.\n", __FILE__, __LINE__); \ + if (!((result) = (type *) aCallocA ((number), sizeof(type)))) \ + { perror("SYSERR: malloc failure"); abort(); } } while(0) + #define RECREATE(result,type,number) do {\ if (!((result) = (type *) aRealloc ((result), sizeof(type) * (number))))\ { printf("SYSERR: realloc failure"); abort(); } } while(0) diff --git a/src/ladmin/ladmin.c b/src/ladmin/ladmin.c index c8b0d60f0..66f5b837f 100644 --- a/src/ladmin/ladmin.c +++ b/src/ladmin/ladmin.c @@ -280,7 +280,7 @@ int ladmin_log(char *fmt, ...) { fprintf(logfp, RETCODE); else { gettimeofday(&tv, NULL); - strftime(tmpstr, 24, date_format, localtime(&(tv.tv_sec))); + strftime(tmpstr, 24, date_format, localtime((const time_t*)&(tv.tv_sec))); sprintf(tmpstr + strlen(tmpstr), ".%03d: %s", (int)tv.tv_usec / 1000, fmt); vfprintf(logfp, tmpstr, ap); } @@ -294,7 +294,7 @@ int ladmin_log(char *fmt, ...) { //----------------------------------------------------- // Function to suppress control characters in a string. //----------------------------------------------------- -int remove_control_chars(unsigned char *str) { +int remove_control_chars(char *str) { int i; int change = 0; @@ -381,9 +381,9 @@ int verify_accountname(char* account_name) { //--------------------------------------------------- // E-mail check: return 0 (not correct) or 1 (valid). //--------------------------------------------------- -int e_mail_check(unsigned char *email) { +int e_mail_check(char *email) { char ch; - unsigned char* last_arobas; + char* last_arobas; // athena limits if (strlen(email) < 3 || strlen(email) > 39) @@ -3266,7 +3266,7 @@ int parse_fromlogin(int fd) { } // printf("parse_fromlogin : %d %d %d\n", fd, RFIFOREST(fd), RFIFOW(fd,0)); - sd = session[fd]->session_data; + sd = (struct char_session_data*)session[fd]->session_data; while(RFIFOREST(fd) >= 2) { switch(RFIFOW(fd,0)) { diff --git a/src/login/login.c b/src/login/login.c index 5f8bde598..11c970aca 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -2,7 +2,7 @@ // new version of the login-server by [Yor] #include -#ifdef WIN32 +#ifdef __WIN32 #define WIN32_LEAN_AND_MEAN #include #include @@ -232,12 +232,12 @@ void addGM(int account_id, int level) { } return; } - + // if new account if (i == GM_num && do_add) { if (GM_num >= GM_max) { GM_max += 256; - gm_account_db = realloc(gm_account_db, sizeof(struct gm_account) * GM_max); + gm_account_db = (struct gm_account*)aRealloc(gm_account_db, sizeof(struct gm_account) * GM_max); memset(gm_account_db + (GM_max - 256), 0, sizeof(struct gm_account) * 256); } gm_account_db[GM_num].account_id = account_id; @@ -261,7 +261,7 @@ int read_gm_account() { struct stat file_stat; int start_range = 0, end_range = 0, is_range = 0, current_id = 0; - if(gm_account_db) free(gm_account_db); + if(gm_account_db) aFree(gm_account_db); GM_num = 0; if(GM_max < 0) GM_max = 256; gm_account_db = (struct gm_account*)aCalloc(GM_max, sizeof(struct gm_account)); @@ -302,7 +302,7 @@ int read_gm_account() { printf("read_gm_account: file [%s] invalid range, beginning of range is equal to end of range (line #%d).\n", GM_account_filename, line_counter); else if (start_range>end_range) printf("read_gm_account: file [%s] invalid range, beginning of range must be lower than end of range (line #%d).\n", GM_account_filename, line_counter); - else + else for (current_id = start_range;current_id<=end_range;current_id++) addGM(current_id,level); } else { @@ -620,7 +620,7 @@ int mmo_auth_init(void) { if (auth_num >= auth_max) { auth_max += 256; - auth_dat = realloc(auth_dat, sizeof(struct auth_dat) * auth_max); + auth_dat = (struct auth_dat*)aRealloc(auth_dat, sizeof(struct auth_dat) * auth_max); } memset(&auth_dat[auth_num], '\0', sizeof(struct auth_dat)); @@ -745,7 +745,7 @@ int mmo_auth_init(void) { if (auth_num >= auth_max) { auth_max += 256; - auth_dat = realloc(auth_dat, sizeof(struct auth_dat) * auth_max); + auth_dat = (struct auth_dat*)aRealloc(auth_dat, sizeof(struct auth_dat) * auth_max); } memset(&auth_dat[auth_num], '\0', sizeof(struct auth_dat)); @@ -871,7 +871,8 @@ void mmo_auth_sync(void) { FILE *fp; int i, j, k, lock; int account_id; - int id[auth_num]; + //int id[auth_num]; + int *id = (int *)aCalloc(auth_num, sizeof(int)); char line[65536]; // Sorting before save @@ -889,8 +890,10 @@ void mmo_auth_sync(void) { } // Data save - if ((fp = lock_fopen(account_filename, &lock)) == NULL) + if ((fp = lock_fopen(account_filename, &lock)) == NULL) { + if (id) free(id); return; + } fprintf(fp, "// Accounts file: here are saved all information about the accounts.\n"); fprintf(fp, "// Structure: ID, account name, password, last login time, sex, # of logins, state, email, error message for state 7, validity time, last (accepted) login ip, memo field, ban timestamp, repeated(register text, register value)\n"); @@ -921,6 +924,8 @@ void mmo_auth_sync(void) { if (auth_before_save_file < AUTH_BEFORE_SAVE_FILE) auth_before_save_file = AUTH_BEFORE_SAVE_FILE; + if (id) aFree(id); + return; } @@ -1019,7 +1024,7 @@ int mmo_auth_new(struct mmo_account* account, char sex, char* email) { if (auth_num >= auth_max) { auth_max += 256; - auth_dat = realloc(auth_dat, sizeof(struct auth_dat) * auth_max); + auth_dat = (struct auth_dat*)aRealloc(auth_dat, sizeof(struct auth_dat) * auth_max); memset(auth_dat, 0, sizeof(struct auth_dat) * auth_max); } @@ -1132,7 +1137,7 @@ int mmo_auth(struct mmo_account* account, int fd) { memcpy(user_password, account->passwd, 25); encpasswdok = 0; #ifdef PASSWORDENC - ld = session[fd]->session_data; + ld = (struct login_session_data*)session[fd]->session_data; if (account->passwdenc > 0) { int j = account->passwdenc; if (!ld) { @@ -1392,7 +1397,7 @@ int parse_fromchar(int fd) { break; // we receive a e-mail creation of an account with a default e-mail (no answer) - case 0x2715: + case 0x2715: if (RFIFOREST(fd) < 46) return 0; { @@ -1701,7 +1706,9 @@ int parse_fromchar(int fd) { acc = RFIFOL(fd,4); for(i = 0; i < auth_num; i++) { if (auth_dat[i].account_id == acc) { - unsigned char buf[RFIFOW(fd,2)+1]; + //unsigned char buf[RFIFOW(fd,2)+1]; + unsigned char *buf; + buf = (unsigned char*)aCalloc(RFIFOW(fd,2)+1, sizeof(unsigned char)); login_log("Char-server '%s': receiving (from the char-server) of account_reg2 (account: %d, ip: %s)." RETCODE, server[id].name, acc, ip); for(p = 8, j = 0; p < RFIFOW(fd,2) && j < ACCOUNT_REG2_NUM; p += 36, j++) { @@ -1718,6 +1725,7 @@ int parse_fromchar(int fd) { // Save mmo_auth_sync(); // printf("parse_fromchar: receiving (from the char-server) of account_reg2 (account id: %d).\n", acc); + if (buf) free(buf); break; } } @@ -1883,7 +1891,8 @@ int parse_admin(int fd) { return 0; { int st, ed, len; - int id[auth_num]; + //int id[auth_num]; + int *id=(int *)aCalloc(auth_num, sizeof(int)); st = RFIFOL(fd,2); ed = RFIFOL(fd,6); RFIFOSKIP(fd,10); @@ -1927,6 +1936,7 @@ int parse_admin(int fd) { } WFIFOW(fd,2) = len; WFIFOSET(fd,len); + if (id) free(id); } break; @@ -2114,7 +2124,7 @@ int parse_admin(int fd) { memcpy(WFIFOP(fd,4+server_num*32+6), server[i].name, 20); WFIFOW(fd,4+server_num*32+26) = server[i].users; WFIFOW(fd,4+server_num*32+28) = server[i].maintenance; - WFIFOW(fd,4+server_num*32+30) = server[i].new; + WFIFOW(fd,4+server_num*32+30) = server[i].new_; server_num++; } } @@ -2845,7 +2855,7 @@ int parse_login(int fd) { } else printf("parse_login: connection #%d, packet: 0x%x (with being read: %d).\n", fd, RFIFOW(fd,0), RFIFOREST(fd)); } - + switch(RFIFOW(fd,0)) { case 0x200: // New alive packet: structure: 0x200 .24B. used to verify if client is always alive. if (RFIFOREST(fd) < 26) @@ -2920,7 +2930,7 @@ int parse_login(int fd) { memcpy(WFIFOP(fd,47+server_num*32+6), server[i].name, 20); WFIFOW(fd,47+server_num*32+26) = server[i].users; WFIFOW(fd,47+server_num*32+28) = server[i].maintenance; - WFIFOW(fd,47+server_num*32+30) = server[i].new; + WFIFOW(fd,47+server_num*32+30) = server[i].new_; server_num++; } } @@ -2984,7 +2994,7 @@ int parse_login(int fd) { session[fd]->eof = 1; return 0; } - ld = session[fd]->session_data = (struct login_session_data*)aCalloc(1, sizeof(struct login_session_data)); + ld = (struct login_session_data*)session[fd]->session_data = (struct login_session_data*)aCalloc(1, sizeof(struct login_session_data)); if (!ld) { printf("login: Request for md5 key: memory allocation failure (malloc)!\n"); session[fd]->eof = 1; @@ -3036,7 +3046,7 @@ int parse_login(int fd) { memcpy(server[account.account_id].name, server_name, 20); server[account.account_id].users = 0; server[account.account_id].maintenance = RFIFOW(fd,82); - server[account.account_id].new = RFIFOW(fd,84); + server[account.account_id].new_ = RFIFOW(fd,84); server_fd[account.account_id] = fd; if(anti_freeze_enable) server_freezeflag[account.account_id] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed @@ -3105,7 +3115,7 @@ int parse_login(int fd) { if (!check_ladminip(session[fd]->client_addr.sin_addr.s_addr)) { login_log("'ladmin'-login: Connection in administration mode refused: IP isn't authorised (ladmin_allow, ip: %s)." RETCODE, ip); } else { - struct login_session_data *ld = session[fd]->session_data; + struct login_session_data *ld = (struct login_session_data*)session[fd]->session_data; if (RFIFOW(fd,2) == 0) { // non encrypted password unsigned char* password=""; memcpy(password, RFIFOP(fd,4), 24); @@ -3205,9 +3215,9 @@ int parse_console(char *buf) { char command[256]; memset(command,0,sizeof(command)); - + sscanf(buf, "%[^\n]", command); - + login_log("Console command :%s" RETCODE, command); if(strcmpi("shutdown", command) == 0 || @@ -3372,22 +3382,22 @@ int login_config_read(const char *cfgName) { admin_pass[sizeof(admin_pass)-1] = '\0'; } else if (strcmpi(w1, "ladminallowip") == 0) { if (strcmpi(w2, "clear") == 0) { - if (access_ladmin_allow) - free(access_ladmin_allow); + if (access_ladmin_allow) + aFree(access_ladmin_allow); access_ladmin_allow = NULL; access_ladmin_allownum = 0; } else { if (strcmpi(w2, "all") == 0) { // reset all previous values if (access_ladmin_allow) - free(access_ladmin_allow); + aFree(access_ladmin_allow); // set to all access_ladmin_allow = (char*)aCalloc(ACO_STRSIZE, sizeof(char)); access_ladmin_allownum = 1; access_ladmin_allow[0] = '\0'; } else if (w2[0] && !(access_ladmin_allownum == 1 && access_ladmin_allow[0] == '\0')) { // don't add IP if already 'all' if (access_ladmin_allow) - access_ladmin_allow = realloc(access_ladmin_allow, (access_ladmin_allownum+1) * ACO_STRSIZE); + access_ladmin_allow = (char*)aRealloc(access_ladmin_allow, (access_ladmin_allownum+1) * ACO_STRSIZE); else access_ladmin_allow = (char*)aCalloc(ACO_STRSIZE, sizeof(char)); strncpy(access_ladmin_allow + (access_ladmin_allownum++) * ACO_STRSIZE, w2, ACO_STRSIZE); @@ -3469,21 +3479,21 @@ int login_config_read(const char *cfgName) { } else if (strcmpi(w1, "allow") == 0) { if (strcmpi(w2, "clear") == 0) { if (access_allow) - free(access_allow); + aFree(access_allow); access_allow = NULL; access_allownum = 0; } else { if (strcmpi(w2, "all") == 0) { // reset all previous values if (access_allow) - free(access_allow); + aFree(access_allow); // set to all access_allow = (char*)aCalloc(ACO_STRSIZE, sizeof(char)); access_allownum = 1; access_allow[0] = '\0'; } else if (w2[0] && !(access_allownum == 1 && access_allow[0] == '\0')) { // don't add IP if already 'all' if (access_allow) - access_allow = realloc(access_allow, (access_allownum+1) * ACO_STRSIZE); + access_allow = (char*)aRealloc(access_allow, (access_allownum+1) * ACO_STRSIZE); else access_allow = (char*)aCalloc(ACO_STRSIZE, sizeof(char)); strncpy(access_allow + (access_allownum++) * ACO_STRSIZE, w2, ACO_STRSIZE); @@ -3493,21 +3503,21 @@ int login_config_read(const char *cfgName) { } else if (strcmpi(w1, "deny") == 0) { if (strcmpi(w2, "clear") == 0) { if (access_deny) - free(access_deny); + aFree(access_deny); access_deny = NULL; access_denynum = 0; } else { if (strcmpi(w2, "all") == 0) { // reset all previous values if (access_deny) - free(access_deny); + aFree(access_deny); // set to all access_deny = (char*)aCalloc(ACO_STRSIZE, sizeof(char)); access_denynum = 1; access_deny[0] = '\0'; } else if (w2[0] && !(access_denynum == 1 && access_deny[0] == '\0')) { // don't add IP if already 'all' if (access_deny) - access_deny = realloc(access_deny, (access_denynum+1) * ACO_STRSIZE); + access_deny = (char*)aRealloc(access_deny, (access_denynum+1) * ACO_STRSIZE); else access_deny = (char*)aCalloc(ACO_STRSIZE, sizeof(char)); strncpy(access_deny + (access_denynum++) * ACO_STRSIZE, w2, ACO_STRSIZE); @@ -3877,18 +3887,18 @@ void do_final(void) { fflush(stdout); mmo_auth_sync(); - if(auth_dat) free(auth_dat); - if(gm_account_db) free(gm_account_db); - if(access_ladmin_allow) free(access_ladmin_allow); - if(access_allow) free(access_allow); - if(access_deny) free(access_deny); + if(auth_dat) aFree(auth_dat); + if(gm_account_db) aFree(gm_account_db); + if(access_ladmin_allow) aFree(access_ladmin_allow); + if(access_allow) aFree(access_allow); + if(access_deny) aFree(access_deny); for (i = 0; i < MAX_SERVERS; i++) { if ((fd = server_fd[i]) >= 0) { server_fd[i] = -1; memset(&server[i], 0, sizeof(struct mmo_char_server)); close(fd); delete_session(fd); - if(session[fd]) free(session[fd]); + if(session[fd]) aFree(session[fd]); } } close(login_fd); @@ -3929,7 +3939,7 @@ int do_init(int argc, char **argv) { // set_termfunc(mmo_auth_sync); set_defaultparse(parse_login); login_fd = make_listen_port(login_port); - + if(anti_freeze_enable > 0) { add_timer_func_list(char_anti_freeze_system, "char_anti_freeze_system"); i = add_timer_interval(gettick() + 1000, char_anti_freeze_system, 0, 0, ANTI_FREEZE_INTERVAL * 1000); @@ -3957,7 +3967,7 @@ int do_init(int argc, char **argv) { set_defaultconsoleparse(parse_console); start_console(); } - + login_log("The login-server is ready (Server is listening on the port %d)." RETCODE, login_port); printf("The login-server is \033[1;32mready\033[0m (Server is listening on the port %d).\n\n", login_port); diff --git a/src/login/login.h b/src/login/login.h index 7370f5238..4a5b5be0c 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -33,7 +33,7 @@ struct mmo_char_server { short port; int users; int maintenance; - int new; + int new_; }; extern struct mmo_char_server server[MAX_SERVERS]; diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 25df5310d..302e78b9e 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -161,7 +161,7 @@ struct dbt *online_db; void add_online_user(int account_id) { int *p; - p = aMalloc(sizeof(int)); + p = (int*)aMalloc(sizeof(int)); if (p == NULL) { printf("add_online_user: memory allocation failure (malloc)!\n"); exit(0); @@ -173,7 +173,7 @@ void add_online_user(int account_id) { int is_user_online(int account_id) { int *p; - p = numdb_search(online_db, account_id); + p = (int*)numdb_search(online_db, account_id); if (p == NULL) return 0; printf("Acccount %d\n",*p); @@ -182,8 +182,8 @@ int is_user_online(int account_id) { void remove_online_user(int account_id) { int *p; - p = numdb_erase(online_db,account_id); - free(p); + p = (int*)numdb_erase(online_db,account_id); + aFree(p); } //----------------------------------------------------- @@ -238,9 +238,9 @@ int remove_control_chars(unsigned char *str) { //--------------------------------------------------- // E-mail check: return 0 (not correct) or 1 (valid). //--------------------------------------------------- -int e_mail_check(unsigned char *email) { +int e_mail_check(char *email) { char ch; - unsigned char* last_arobas; + char* last_arobas; // athena limits if (strlen(email) < 3 || strlen(email) > 39) @@ -394,7 +394,7 @@ int mmo_auth( struct mmo_account* account , int fd){ // auth start : time seed gettimeofday(&tv, NULL); - strftime(tmpstr, 24, "%Y-%m-%d %H:%M:%S",localtime(&(tv.tv_sec))); + strftime(tmpstr, 24, "%Y-%m-%d %H:%M:%S",localtime((const time_t*)&(tv.tv_sec))); sprintf(tmpstr+19, ".%03d", (int)tv.tv_usec/1000); jstrescapecpy(t_uid,account->userid); @@ -1217,7 +1217,7 @@ int parse_login(int fd) { memcpy(WFIFOP(fd,47+server_num*32+6), server[i].name, 20); WFIFOW(fd,47+server_num*32+26) = server[i].users; WFIFOW(fd,47+server_num*32+28) = server[i].maintenance; - WFIFOW(fd,47+server_num*32+30) = server[i].new; + WFIFOW(fd,47+server_num*32+30) = server[i].new_; server_num++; } } @@ -1407,7 +1407,7 @@ int parse_login(int fd) { memcpy(server[account.account_id].name,RFIFOP(fd,60),20); server[account.account_id].users=0; server[account.account_id].maintenance=RFIFOW(fd,82); - server[account.account_id].new=RFIFOW(fd,84); + server[account.account_id].new_=RFIFOW(fd,84); server_fd[account.account_id]=fd; if(anti_freeze_enable) server_freezeflag[account.account_id] = 5; // Char-server anti-freeze system. Counter. 5 ok, 4...0 freezed @@ -1480,9 +1480,9 @@ int parse_console(char *buf) { printf("Type of command: %s || Command: %s \n",type,command); - if(buf) free(buf); - if(type) free(type); - if(command) free(command); + if(buf) aFree(buf); + if(type) aFree(type); + if(command) aFree(command); return 0; } @@ -1841,7 +1841,7 @@ int do_init(int argc,char **argv){ } // Online user database init - free(online_db); + aFree(online_db); online_db = numdb_init(); printf("The login-server is \033[1;32mready\033[0m (Server is listening on the port %d).\n\n", login_port); diff --git a/src/login_sql/login.h b/src/login_sql/login.h index 6335168d7..73892f4ef 100644 --- a/src/login_sql/login.h +++ b/src/login_sql/login.h @@ -34,7 +34,7 @@ struct mmo_char_server { short port; int users; int maintenance; - int new; + int new_; }; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 4b245fd0b..c1f491910 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8,6 +8,7 @@ #include "../common/socket.h" #include "../common/timer.h" #include "../common/nullpo.h" +#include "../common/mmo.h" #include "log.h" #include "clif.h" @@ -465,7 +466,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_Send, "@send", 60, atcommand_send }, { AtCommand_SetBattleFlag, "@setbattleflag", 60, atcommand_setbattleflag }, { AtCommand_UnMute, "@unmute", 60, atcommand_unmute }, // [Valaris] - { AtCommand_Clearweather, "@clearweather", 99, atcommand_clearweather }, // Dexity + { AtCommand_Clearweather, "@clearweather", 99, atcommand_clearweather }, // Dexity { AtCommand_UpTime, "@uptime", 0, atcommand_uptime }, // by MC Cameri // { AtCommand_ChangeSex, "@changesex", 1, atcommand_changesex }, // by MC Cameri { AtCommand_Mute, "@mute", 99, atcommand_mute }, // [celest] @@ -531,8 +532,8 @@ static AtCommandInfo atcommand_info[] = { * This function return the name of the job (by [Yor]) *---------------------------------------------------- */ -char * job_name(int class) { - switch (class) { +char * job_name(int class_) { + switch (class_) { case 0: return "Novice"; case 1: return "Swordsman"; case 2: return "Mage"; @@ -833,18 +834,18 @@ static int atmobsearch_sub(struct block_list *bl,va_list ap) static int number=0; struct mob_data *md; char output[128]; - + nullpo_retr(0, bl); - + if(!ap){ number=0; return 0; } mob_id = va_arg(ap,int); fd = va_arg(ap,int); - + md = (struct mob_data *)bl; - + if(md && fd && (mob_id==-1 || (md->class_==mob_id))){ snprintf(output, sizeof output, "%2d[%3d:%3d] %s", ++number,bl->x, bl->y,md->name); @@ -894,7 +895,7 @@ void rehash( const int fd, struct map_session_data* sd ) int map_id = 0; int LOADED_MAPS = map_num; - + for (map_id = 0; map_id < LOADED_MAPS;map_id++) { if (map_id > LOADED_MAPS) @@ -1023,7 +1024,7 @@ int atcommand_send( WBUFW(buf,0)=0x18f; case 4: WBUFW(buf,0)=0x190; - } + } } return 0; } @@ -1113,7 +1114,7 @@ int atcommand_where( snprintf(output, sizeof output, "%s %s %d %d", character, pl_sd->mapname, pl_sd->bl.x, pl_sd->bl.y); clif_displaymessage(fd, output); - + return 0; } @@ -1135,7 +1136,7 @@ int atcommand_jumpto( clif_displaymessage(fd, "Please, enter a player name (usage: @jumpto/@warpto/@goto )."); return -1; } - + memset(character, '\0', sizeof character); if (sscanf(message, "%99[^\n]", character) < 1) return -1; @@ -1677,8 +1678,10 @@ int atcommand_whozeny( int i, j, count,c; char match_text[100]; char player_name[24]; - int zeny[clif_countusers()]; - int counted[clif_countusers()]; + //int zeny[clif_countusers()]; + //int counted[clif_countusers()]; + int *zeny = (int *)aCallocA(clif_countusers(), sizeof(int)); + int *counted = (int *)aCallocA(clif_countusers(), sizeof(int)); nullpo_retr(-1, sd); @@ -1732,6 +1735,9 @@ int atcommand_whozeny( clif_displaymessage(fd, output); } + free(zeny); + free(counted); + return 0; } @@ -1749,7 +1755,7 @@ int atcommand_happyhappyjoyjoy( for (i = 0; i < fd_max; i++) { if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) { e=rand()%40; - if(e==34) + if(e==34) e = 0; clif_emotion(&pl_sd->bl,e); } @@ -2177,7 +2183,7 @@ int atcommand_alive( clif_resurrection(&sd->bl, 1); clif_displaymessage(fd, msg_table[16]); // You've been revived! It's a miracle! return 0; - } + } return -1; } @@ -2296,8 +2302,8 @@ int atcommand_item( if (pet_id >= 0) { sd->catch_target_class = pet_db[pet_id].class_; intif_create_pet(sd->status.account_id, sd->status.char_id, - pet_db[pet_id].class_, mob_db[pet_db[pet_id].class_].lv, - pet_db[pet_id].EggID, 0, pet_db[pet_id].intimate, + (short)pet_db[pet_id].class_, (short)mob_db[pet_db[pet_id].class_].lv, + (short)pet_db[pet_id].EggID, 0, (short)pet_db[pet_id].intimate, 100, 0, 1, pet_db[pet_id].jname); // if not pet egg } else { @@ -2447,7 +2453,7 @@ int atcommand_baselevelup( clif_displaymessage(fd, msg_table[47]); // Base level can't go any higher. return -1; } // End Addition - if (level > battle_config.maximum_level || level > (battle_config.maximum_level - sd->status.base_level)) // fix positiv overflow + if ((unsigned int)level > battle_config.maximum_level || (unsigned int)level > (battle_config.maximum_level - sd->status.base_level)) // fix positiv overflow level = battle_config.maximum_level - sd->status.base_level; for (i = 1; i <= level; i++) sd->status.status_point += (sd->status.base_level + i + 14) / 5; @@ -2464,7 +2470,7 @@ int atcommand_baselevelup( clif_displaymessage(fd, msg_table[158]); // Base level can't go any lower. return -1; } - if (level < -battle_config.maximum_level || level < (1 - sd->status.base_level)) // fix negativ overflow + if (level < -(int)battle_config.maximum_level || level < (1 - (int)sd->status.base_level)) // fix negativ overflow level = 1 - sd->status.base_level; if (sd->status.status_point > 0) { for (i = 0; i > level; i--) @@ -2491,7 +2497,8 @@ int atcommand_joblevelup( const int fd, struct map_session_data* sd, const char* command, const char* message) { - int up_level = 50, level; + unsigned int up_level = 50; + int level; struct pc_base_job s_class; nullpo_retr(-1, sd); s_class = pc_calc_base_job(sd->status.class_); @@ -2514,7 +2521,7 @@ int atcommand_joblevelup( clif_displaymessage(fd, msg_table[23]); // Job level can't go any higher. return -1; } - if (level > up_level || level > (up_level - sd->status.job_level)) // fix positiv overflow + if ((unsigned int)level > up_level || (unsigned int)level > (up_level - sd->status.job_level)) // fix positiv overflow level = up_level - sd->status.job_level; sd->status.job_level += level; clif_updatestatus(sd, SP_JOBLEVEL); @@ -2529,7 +2536,7 @@ int atcommand_joblevelup( clif_displaymessage(fd, msg_table[159]); // Job level can't go any lower. return -1; } - if (level < -up_level || level < (1 - sd->status.job_level)) // fix negativ overflow + if (level < -(int)up_level || level < (1 - (int)sd->status.job_level)) // fix negativ overflow level = 1 - sd->status.job_level; sd->status.job_level += level; clif_updatestatus(sd, SP_JOBLEVEL); @@ -3117,7 +3124,7 @@ int atcommand_monster( printf("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, x, y); count = 0; - range = sqrt(number) / 2; + range = (int)sqrt(number) / 2; range = range * 2 + 5; // calculation of an odd number (+ 4 area around) for (i = 0; i < number; i++) { j = 0; @@ -3209,7 +3216,7 @@ int atcommand_spawn( printf("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, x, y); count = 0; - range = sqrt(number) / 2; + range = (int)sqrt(number) / 2; range = range * 2 + 5; // calculation of an odd number (+ 4 area around) for (i = 0; i < number; i++) { j = 0; @@ -3848,9 +3855,9 @@ int atcommand_param( } new_value = (int)*status[index] + value; - if (value > 0 && (value > battle_config.max_parameter || new_value > battle_config.max_parameter)) // fix positiv overflow + if (value > 0 && ((unsigned int)value > battle_config.max_parameter || (unsigned int)new_value > battle_config.max_parameter)) // fix positiv overflow new_value = battle_config.max_parameter; - else if (value < 0 && (value < -battle_config.max_parameter || new_value < 1)) // fix negativ overflow + else if (value < 0 && (value < -(int)battle_config.max_parameter || new_value < 1)) // fix negativ overflow new_value = 1; if (new_value != (int)*status[index]) { @@ -3893,9 +3900,9 @@ int atcommand_stat_all( for (index = 0; index < (int)(sizeof(status) / sizeof(status[0])); index++) { new_value = (int)*status[index] + value; - if (value > 0 && (value > battle_config.max_parameter || new_value > battle_config.max_parameter)) // fix positiv overflow + if (value > 0 && ((unsigned int)value > battle_config.max_parameter || (unsigned int)new_value > battle_config.max_parameter)) // fix positiv overflow new_value = battle_config.max_parameter; - else if (value < 0 && (value < -battle_config.max_parameter || new_value < 1)) // fix negativ overflow + else if (value < 0 && (value < -(int)battle_config.max_parameter || new_value < 1)) // fix negativ overflow new_value = 1; if (new_value != (int)*status[index]) { @@ -3993,8 +4000,8 @@ int atcommand_makeegg( sd->catch_target_class = pet_db[pet_id].class_; intif_create_pet( sd->status.account_id, sd->status.char_id, - pet_db[pet_id].class_, mob_db[pet_db[pet_id].class_].lv, - pet_db[pet_id].EggID, 0, pet_db[pet_id].intimate, + (short)pet_db[pet_id].class_, (short)mob_db[pet_db[pet_id].class_].lv, + (short)pet_db[pet_id].EggID, 0, (short)pet_db[pet_id].intimate, 100, 0, 1, pet_db[pet_id].jname); } else { clif_displaymessage(fd, msg_table[180]); // The monter/egg name/id doesn't exist. @@ -4149,14 +4156,14 @@ atcommand_recall( char character[100]; char output[200]; struct map_session_data *pl_sd = NULL; - + nullpo_retr(-1, sd); if (!message || !*message || sscanf(message, "%99[^\n]", character) < 1) { clif_displaymessage(fd, "Please, enter a player name (usage: @recall )."); return -1; } - + memset(character, '\0', sizeof character); if(sscanf(message, "%99[^\n]", character) < 1) return -1; @@ -4658,7 +4665,7 @@ int atcommand_character_baselevel( clif_displaymessage(fd, msg_table[91]); // Character's base level can't go any higher. return 0; } // End Addition - if (level > battle_config.maximum_level || level > (battle_config.maximum_level - pl_sd->status.base_level)) // fix positiv overflow + if ((unsigned int)level > battle_config.maximum_level || (unsigned int)level > (battle_config.maximum_level - pl_sd->status.base_level)) // fix positiv overflow level = battle_config.maximum_level - pl_sd->status.base_level; for (i = 1; i <= level; i++) pl_sd->status.status_point += (pl_sd->status.base_level + i + 14) / 5; @@ -4675,7 +4682,7 @@ int atcommand_character_baselevel( clif_displaymessage(fd, msg_table[193]); // Character's base level can't go any lower. return -1; } - if (level < -battle_config.maximum_level || level < (1 - pl_sd->status.base_level)) // fix negativ overflow + if (level < -(int)battle_config.maximum_level || level < (1 - (int)pl_sd->status.base_level)) // fix negativ overflow level = 1 - pl_sd->status.base_level; if (pl_sd->status.status_point > 0) { for (i = 0; i > level; i--) @@ -4712,7 +4719,8 @@ int atcommand_character_joblevel( { struct map_session_data *pl_sd; char character[100]; - int max_level = 50, level = 0; + unsigned int max_level = 50; + int level = 0; //転生や養子の場合の元の職業を算出する struct pc_base_job pl_s_class; nullpo_retr(-1, sd); @@ -5195,7 +5203,7 @@ int atcommand_idsearch( { char item_name[100]; char output[200]; - int i, match; + unsigned int i, match; struct item_data *item; nullpo_retr(-1, sd); @@ -5652,7 +5660,7 @@ int atcommand_reloadscript( nullpo_retr(-1, sd); atcommand_broadcast( fd, sd, "@broadcast", "eAthena SQL Server is Rehashing..." ); atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" ); - + rehash( fd, sd ); atcommand_broadcast( fd, sd, "@broadcast", "Reloading NPCs..." ); @@ -6090,7 +6098,7 @@ int atcommand_enablenpc(const int fd, struct map_session_data* sd, memset(NPCname, '\0', sizeof(NPCname)); if (!message || !*message || sscanf(message, "%99[^\n]", NPCname) < 1) { - clif_displaymessage(fd, "Please, enter a NPC name (usage: @npcon )."); + clif_displaymessage(fd, "Please, enter a NPC name (usage: @enablenpc )."); return -1; } @@ -6961,7 +6969,7 @@ atcommand_npcmove(const int fd, struct map_session_data* sd, int x = 0, y = 0; struct npc_data *nd = 0; nullpo_retr(-1, sd); - + if (!message || !*message) return -1; @@ -7010,7 +7018,7 @@ atcommand_addwarp(const int fd, struct map_session_data* sd, ret = npc_parse_warp(w1, "warp", w3, w4); - sprintf(output, "New warp NPC => %s",w3); + sprintf(output, "New warp NPC => %s",w3); clif_displaymessage(fd, output); @@ -7063,7 +7071,7 @@ atcommand_dropall(const int fd, struct map_session_data* sd, } /*========================================== * @chardropall by [MouseJstr] - * + * * Throw all the characters possessions on the ground. Normally * done in response to them being disrespectful of a GM *------------------------------------------ @@ -7139,7 +7147,7 @@ atcommand_charstoreall(const int fd, struct map_session_data* sd, if (!message || !*message) return -1; - if((pl_sd=map_nick2sd((char *) message)) == NULL) + if((pl_sd=map_nick2sd((char *) message)) == NULL) return -1; if (storage_storageopen(pl_sd) == 1) { @@ -7254,7 +7262,7 @@ atcommand_skilltree(const int fd, struct map_session_data* sd, clif_displaymessage(fd, "Usage: @skilltree "); return -1; } - if((pl_sd=map_nick2sd(target)) == NULL) + if((pl_sd=map_nick2sd(target)) == NULL) return -1; s_class = pc_calc_base_job(pl_sd->status.class_); @@ -7265,8 +7273,8 @@ atcommand_skilltree(const int fd, struct map_session_data* sd, tbl = job_name(c); - sprintf(output, "Player is using %s %s skill tree (%d basic points)", - s_class.upper ? "upper" : "lower", + sprintf(output, "Player is using %s %s skill tree (%d basic points)", + s_class.upper ? "upper" : "lower", tbl, pc_checkskill(pl_sd, 1)); clif_displaymessage(fd, output); @@ -7276,7 +7284,7 @@ atcommand_skilltree(const int fd, struct map_session_data* sd, break; } } - + if (skillidx == -1) { sprintf(output, "I do not believe the player can use that skill"); clif_displaymessage(fd, output); @@ -7285,19 +7293,19 @@ atcommand_skilltree(const int fd, struct map_session_data* sd, ent = &skill_tree[s][c][skillidx]; - for(j=0;j<5;j++) + for(j=0;j<5;j++) if( ent->need[j].id && - pc_checkskill(sd,ent->need[j].id) < ent->need[j].lv) + pc_checkskill(sd,ent->need[j].id) < ent->need[j].lv) { int idx = 0; char *desc; - while (skill_names[idx].id != 0 && skill_names[idx].id != ent->need[j].id) + while (skill_names[idx].id != 0 && skill_names[idx].id != ent->need[j].id) idx++; if (skill_names[idx].id == 0) desc = "Unknown skill"; else desc = skill_names[idx].desc; - sprintf(output, "player requires level %d of skill %s", + sprintf(output, "player requires level %d of skill %s", ent->need[j].lv, desc); clif_displaymessage(fd, output); meets = 0; @@ -7307,7 +7315,7 @@ atcommand_skilltree(const int fd, struct map_session_data* sd, sprintf(output, "I believe the player meets all the requirements for that skill"); clif_displaymessage(fd, output); } - + return 0; } @@ -7392,7 +7400,7 @@ atcommand_rings(const int fd, struct map_session_data* sd, { struct item item_tmp; int flag; - + memset(&item_tmp, 0, sizeof(item_tmp)); item_tmp.nameid = 2634; @@ -7456,7 +7464,7 @@ atcommand_grind(const int fd, struct map_session_data* sd, clif_displaymessage(fd, "Usage: @grind "); return -1; } - if((pl_sd=map_nick2sd(target)) == NULL) + if((pl_sd=map_nick2sd(target)) == NULL) return -1; for (skillnum = 1; skillnum < 500; skillnum++) { @@ -7512,7 +7520,7 @@ atcommand_rain( } else { map[sd->bl.m].flag.rain=1; clif_specialeffect(&sd->bl,effno,2); - clif_displaymessage(fd, "It is made to rain."); + clif_displaymessage(fd, "It is made to rain."); } return 0; } @@ -7536,7 +7544,7 @@ atcommand_snow( clif_specialeffect(&sd->bl,effno,2); clif_displaymessage(fd, "It is made to snow."); } - + return 0; } @@ -7629,7 +7637,7 @@ atcommand_clearweather( map[sd->bl.m].flag.leaves=0; //clif_specialeffect(&sd->bl,effno,2); // not required. [celest] return 0; -} +} /*=============================================================== * Sound Command - plays a sound for everyone! [Codemaster] @@ -7720,7 +7728,7 @@ atcommand_cleanmap( } /*========================================== - * + * *------------------------------------------ */ int @@ -7735,14 +7743,14 @@ atcommand_summon( int id = 0; struct mob_data *md; unsigned int tick=gettick(); - + nullpo_retr(-1, sd); if (!message || !*message) return -1; if (sscanf(message, "%99s", name) < 1) return -1; - + if ((mob_id = atoi(name)) == 0) mob_id = mobdb_searchname(name); if(mob_id == 0) @@ -7823,7 +7831,7 @@ atcommand_adjgmlvl( return -1; } - if((pl_sd=map_nick2sd((char *) user)) == NULL) + if((pl_sd=map_nick2sd((char *) user)) == NULL) return -1; pc_set_gm_level(pl_sd->status.account_id, newlev); @@ -7837,7 +7845,7 @@ atcommand_adjgmlvl( * * Open a trade window with a remote player * - * If I have to jump to a remote player one more time, I am + * If I have to jump to a remote player one more time, I am * gonna scream! *------------------------------------------ */ @@ -7876,7 +7884,7 @@ atcommand_setbattleflag( return -1; } - if (battle_set_value(flag, value) == 0) + if (battle_set_value(flag, value) == 0) clif_displaymessage(fd, "unknown battle_config flag"); else clif_displaymessage(fd, "battle_config set as requested"); @@ -7901,7 +7909,7 @@ int atcommand_unmute( if((pl_sd=map_nick2sd((char *) message)) != NULL) { if(pl_sd->sc_data[SC_NOCHAT].timer!=-1) { pl_sd->status.manner = 0; // have to set to 0 first [celest] - skill_status_change_end(&pl_sd->bl,SC_NOCHAT,-1); + skill_status_change_end(&pl_sd->bl,SC_NOCHAT,-1); clif_displaymessage(sd->fd,"Player unmuted"); } else @@ -7932,7 +7940,7 @@ atcommand_uptime( seconds -= (seconds/hour>0)?(seconds/hour)*hour:0; minutes = seconds/minute; seconds -= (seconds/minute>0)?(seconds/minute)*minute:0; - + snprintf(output, sizeof(output), msg_table[245], days, hours, minutes, seconds); clif_displaymessage(fd,output); @@ -8013,7 +8021,7 @@ atcommand_petid(const int fd, struct map_session_data* sd, char temp0[100]; char temp1[100]; int cnt = 0, i = 0; - + nullpo_retr(-1, sd); if (!message || !*message) @@ -8066,7 +8074,7 @@ atcommand_identify( } } if (num > 0) { - clif_item_identify_list(sd); + clif_item_identify_list(sd); } else { clif_displaymessage(fd,"There are no items to appraise."); } @@ -8074,7 +8082,7 @@ atcommand_identify( } /*========================================== - * @gmotd (Global MOTD) + * @gmotd (Global MOTD) * by davidsiaw :P *------------------------------------------ */ @@ -8113,7 +8121,7 @@ int atcommand_misceffect( if (sscanf(message, "%d", &effect) < 1) return -1; clif_misceffect(&sd->bl,effect); - + return 0; } @@ -8128,7 +8136,7 @@ int charid2sessionid(int charid) if (pl_sd->status.char_id==charid) { session_id = i; break; } } } - + return session_id; } @@ -8143,7 +8151,7 @@ int accountid2sessionid(int accountid) if (pl_sd->status.account_id==accountid) { session_id = i; break; } } } - + return session_id; } @@ -8696,9 +8704,9 @@ atcommand_charkillableid( { if((pl_sd=session[session_id]->session_data) == NULL) return -1; - + pl_sd->special_state.killable = !pl_sd->special_state.killable; - + if(pl_sd->special_state.killable) clif_displaymessage(fd, "The player is now killable"); else @@ -8737,9 +8745,9 @@ atcommand_charkillableid2( { if((pl_sd=session[session_id]->session_data) == NULL) return -1; - + pl_sd->special_state.killable = !pl_sd->special_state.killable; - + if(pl_sd->special_state.killable) clif_displaymessage(fd, "The player is now killable"); else @@ -8762,7 +8770,7 @@ atcommand_charkillableid2( int atcommand_listmail( const int fd, struct map_session_data* sd, const char* command, const char* message) -{ +{ if(!battle_config.mail_system) return 0; @@ -8772,7 +8780,7 @@ int atcommand_listmail( mail_check(sd,3); else if(strlen(command)==9) mail_check(sd,2); - else + else mail_check(sd,1); return 0; } @@ -8823,7 +8831,7 @@ int atcommand_sendmail( if(strlen(command)==17) mail_send(sd,name,text,1); - else + else mail_send(sd,name,text,0); return 0; @@ -8842,7 +8850,7 @@ int atcommand_refreshonline( nullpo_retr(-1, sd); char_online_check(); - + return 0; } diff --git a/src/map/atcommand.h b/src/map/atcommand.h index f639d8c33..754a741b7 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -112,9 +112,9 @@ enum AtCommandType { AtCommand_CharSkReset, AtCommand_CharStReset, //by chbrules - AtCommand_CharModel, + AtCommand_CharModel, AtCommand_CharSKPoint, - AtCommand_CharSTPoint, + AtCommand_CharSTPoint, // AtCommand_CharZeny, //now #zeny AtCommand_RecallAll, AtCommand_ReloadItemDB, @@ -198,7 +198,7 @@ enum AtCommandType { AtCommand_CleanMap, // SQL-only commands start -#ifndef TXT_ONLY +#ifndef TXT_ONLY AtCommand_CheckMail, // [Valaris] AtCommand_ListMail, // [Valaris] AtCommand_ListNewMail, // [Valaris] @@ -206,7 +206,7 @@ enum AtCommandType { AtCommand_SendMail, // [Valaris] AtCommand_DeleteMail, // [Valaris] AtCommand_SendPriorityMail, // [Valaris] -// AtCommand_Sound, // [Valaris] +// AtCommand_Sound, // [Valaris] AtCommand_RefreshOnline, // [Valaris] // SQL-only commands end #endif @@ -272,7 +272,7 @@ int msg_config_read(const char *cfgName); char *estr_lower(char *str); -char * job_name(int class); +char * job_name(int class_); int e_mail_check(unsigned char *email); #endif diff --git a/src/map/battle.c b/src/map/battle.c index 3cff73a18..ce691158c 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -179,6 +179,10 @@ int battle_get_max_hp(struct block_list *bl) if(sc_data[SC_APPLEIDUN].timer!=-1) max_hp += ((5+sc_data[SC_APPLEIDUN].val1*2+((sc_data[SC_APPLEIDUN].val2+1)>>1) +sc_data[SC_APPLEIDUN].val3/10) * max_hp)/100; + if(sc_data[SC_GOSPEL].timer!=-1 && + sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 4) + max_hp += max_hp * 25 / 100; } if(max_hp < 1) max_hp = 1; return max_hp; @@ -429,16 +433,24 @@ int battle_get_flee(struct block_list *bl) else flee=battle_get_agi(bl) + battle_get_lv(bl); - if(sc_data) { - if(sc_data[SC_WHISTLE].timer!=-1 && bl->type != BL_PC) + if(bl->type != BL_PC && sc_data){ + if(sc_data[SC_WHISTLE].timer!=-1) flee += flee*(sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2 +(sc_data[SC_WHISTLE].val3>>16))/100; - if(sc_data[SC_BLIND].timer!=-1 && bl->type != BL_PC) + if(sc_data[SC_BLIND].timer!=-1) flee -= flee*25/100; - if(sc_data[SC_WINDWALK].timer!=-1 && bl->type != BL_PC) // ウィンドウォーク + if(sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォーク flee += flee*(sc_data[SC_WINDWALK].val2)/100; - if(sc_data[SC_SPIDERWEB].timer!=-1 && bl->type != BL_PC) //スパイダーウェブ + if(sc_data[SC_SPIDERWEB].timer!=-1) //スパイダーウェブ flee -= flee*50/100; + if(sc_data[SC_GOSPEL].timer!=-1) { + if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 13) + flee += flee*5/100; + else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 7) + flee = 0; + } } if(flee < 1) flee = 1; return flee; @@ -460,16 +472,20 @@ int battle_get_hit(struct block_list *bl) else hit=battle_get_dex(bl) + battle_get_lv(bl); - if(sc_data) { - if(sc_data[SC_HUMMING].timer!=-1 && bl->type != BL_PC) // + if(bl->type != BL_PC && sc_data) { + if(sc_data[SC_HUMMING].timer!=-1) // hit += hit*(sc_data[SC_HUMMING].val1*2+sc_data[SC_HUMMING].val2 +sc_data[SC_HUMMING].val3)/100; - if(sc_data[SC_BLIND].timer!=-1 && bl->type != BL_PC) // 呪い + if(sc_data[SC_BLIND].timer!=-1) // 呪い hit -= hit*25/100; - if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト + if(sc_data[SC_TRUESIGHT].timer!=-1) // トゥルーサイト hit += 3*(sc_data[SC_TRUESIGHT].val1); - if(sc_data[SC_CONCENTRATION].timer!=-1 && bl->type != BL_PC) //コンセントレーション + if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション hit += (hit*(10*(sc_data[SC_CONCENTRATION].val1)))/100; + if(sc_data[SC_GOSPEL].timer!=-1 && + sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 14) + hit += hit*5/100; } if(hit < 1) hit = 1; return hit; @@ -560,7 +576,7 @@ int battle_get_baseatk(struct block_list *bl) if(sc_data[SC_CURSE].timer!=-1 ) //呪われていたら batk -= batk*25/100; //base_atkが25%減少 if(sc_data[SC_CONCENTRATION].timer!=-1 && bl->type != BL_PC) //コンセントレーション - batk += batk*(5*sc_data[SC_CONCENTRATION].val1)/100; + batk += batk*(5*sc_data[SC_CONCENTRATION].val1)/100; } if(batk < 1) batk = 1; //base_atkは最低でも1 return batk; @@ -584,13 +600,22 @@ int battle_get_atk(struct block_list *bl) else if(bl->type==BL_PET && (struct pet_data *)bl) atk = mob_db[((struct pet_data*)bl)->class_].atk1; - if(sc_data) { - if(sc_data[SC_PROVOKE].timer!=-1 && bl->type != BL_PC) + if(bl->type != BL_PC && sc_data) { + if(sc_data[SC_PROVOKE].timer!=-1) atk = atk*(100+2*sc_data[SC_PROVOKE].val1)/100; - if(sc_data[SC_CURSE].timer!=-1 ) + if(sc_data[SC_CURSE].timer!=-1) atk -= atk*25/100; - if(sc_data[SC_CONCENTRATION].timer!=-1 && bl->type != BL_PC) //コンセントレーション + if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション atk += atk*(5*sc_data[SC_CONCENTRATION].val1)/100; + + if(sc_data[SC_GOSPEL].timer!=-1) { + if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 12) + atk += atk*8/100; + else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 6) + atk = 0; + } } if(atk < 0) atk = 0; return atk; @@ -605,9 +630,6 @@ int battle_get_atk_(struct block_list *bl) nullpo_retr(0, bl); if(bl->type==BL_PC && (struct map_session_data *)bl){ int atk=((struct map_session_data*)bl)->watk_; - - if(((struct map_session_data *)bl)->sc_data[SC_CURSE].timer!=-1 ) - atk -= atk*25/100; return atk; } else @@ -780,10 +802,19 @@ int battle_get_def(struct block_list *bl) def = def * (100 - sc_data[SC_SIGNUMCRUCIS].val2)/100; //永遠の混沌時はDEF0になる if(sc_data[SC_ETERNALCHAOS].timer!=-1) - def = 0; + def = 0; //コンセントレーション時は減算 if( sc_data[SC_CONCENTRATION].timer!=-1) def = (def*(100 - 5*sc_data[SC_CONCENTRATION].val1))/100; + + if(sc_data[SC_GOSPEL].timer!=-1) { + if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 11) + def += def*25/100; + else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 5) + def = 0; + } } } //詠唱中は詠唱時減算率に基づいて減算 @@ -859,6 +890,15 @@ int battle_get_def2(struct block_list *bl) //コンセントレーション時は減算 if( sc_data[SC_CONCENTRATION].timer!=-1) def2 = def2*(100 - 5*sc_data[SC_CONCENTRATION].val1)/100; + + if(sc_data[SC_GOSPEL].timer!=-1) { + if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 11) + def2 += def2*25/100; + else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 5) + def2 = 0; + } } if(def2 < 1) def2 = 1; return def2; @@ -942,6 +982,10 @@ int battle_get_speed(struct block_list *bl) speed = speed*150/100; if(sc_data[SC_SPEEDUP0].timer!=-1) speed -= speed*25/100; + if(sc_data[SC_GOSPEL].timer!=-1 && + sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 8) + speed = speed*125/100; } if(speed < 1) speed = 1; return speed; @@ -1002,6 +1046,10 @@ int battle_get_adelay(struct block_list *bl) //ディフェンダー時は加算 if(sc_data[SC_DEFENDER].timer != -1) adelay += (1100 - sc_data[SC_DEFENDER].val1*100); + if(sc_data[SC_GOSPEL].timer!=-1 && + sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 8) + aspd_rate = aspd_rate*125/100; } if(aspd_rate != 100) adelay = adelay*aspd_rate/100; @@ -1315,7 +1363,7 @@ int battle_delay_damage_sub(int tid,unsigned int tick,int id,int data) struct battle_delay_damage_ *dat=(struct battle_delay_damage_ *)data; if( dat && map_id2bl(id)==dat->src && dat->target->prev!=NULL) battle_damage(dat->src,dat->target,dat->damage,dat->flag); - free(dat); + aFree(dat); return 0; } int battle_delay_damage(unsigned int tick,struct block_list *src,struct block_list *target,int damage,int flag) @@ -1487,11 +1535,11 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i struct mob_data *md=NULL; struct status_change *sc_data,*sc; short *sc_count; - int class; + int class_; nullpo_retr(0, bl); - class = battle_get_class(bl); + class_ = battle_get_class(bl); if(bl->type==BL_MOB) md=(struct mob_data *)bl; else sd=(struct map_session_data *)bl; @@ -1612,7 +1660,10 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i } // リジェクトソード if(sc_data[SC_REJECTSWORD].timer!=-1 && damage > 0 && flag&BF_WEAPON && - ((src->type==BL_PC && ((struct map_session_data *)src)->status.weapon == (1 || 2 || 3)) || src->type==BL_MOB )){ + // Fixed the condition check [Aalye] + (src->type==BL_MOB || (src->type==BL_PC && (((struct map_session_data *)src)->status.weapon == 1 || + ((struct map_session_data *)src)->status.weapon == 2 || + ((struct map_session_data *)src)->status.weapon == 3)))){ if(rand()%100 < (15*sc_data[SC_REJECTSWORD].val1)){ //反射確率は15*Lv damage = damage*50/100; clif_damage(bl,src,gettick(),0,0,damage,0,0,0); @@ -1630,22 +1681,22 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i damage<<=1; skill_status_change_end(bl, SC_SPIDERWEB, -1); } - + if(sc_data[SC_FOGWALL].timer != -1 && flag&BF_MAGIC) if(rand()%100 < sc_data[SC_FOGWALL].val2) damage = 0; } - if(class == 1288 || class == 1287 || class == 1286 || class == 1285) { -// if(class == 1288) { - if(class == 1288 && flag&BF_SKILL) + if(class_ == 1288 || class_ == 1287 || class_ == 1286 || class_ == 1285) { +// if(class_ == 1288) { + if(class_ == 1288 && flag&BF_SKILL) damage=0; if(src->type == BL_PC) { struct guild *g=guild_search(((struct map_session_data *)src)->status.guild_id); struct guild_castle *gc=guild_mapname2gc(map[bl->m].name); if(!((struct map_session_data *)src)->status.guild_id) damage=0; - if(gc && agit_flag==0 && class != 1288) // guardians cannot be damaged during non-woe [Valaris] + if(gc && agit_flag==0 && class_ != 1288) // guardians cannot be damaged during non-woe [Valaris] damage=0; // end woe check [Valaris] if(g == NULL) damage=0;//ギルド未加入ならダメージ無し @@ -2010,7 +2061,7 @@ static struct Damage battle_calc_pet_weapon_attack( blewcount=0; break; case AS_GRIMTOOTH: - damage = damage*(100+ 20*skill_lv)/100; + damage = damage*(100+ 20*skill_lv)/100; break; case AS_POISONREACT: // celest s_ele = 0; @@ -2208,7 +2259,7 @@ static struct Damage battle_calc_pet_weapon_attack( hitrate -= 50; if (t_sc_data[SC_SLEEP].timer!=-1 || // 睡眠は必中 t_sc_data[SC_STAN].timer!=-1 || // スタンは必中 - t_sc_data[SC_FREEZE].timer!=-1 || + t_sc_data[SC_FREEZE].timer!=-1 || (t_sc_data[SC_STONE].timer!=-1 && t_sc_data[SC_STONE].val2==0)) // 凍結は必中 hitrate = 1000000; } @@ -2221,7 +2272,7 @@ static struct Damage battle_calc_pet_weapon_attack( dmg_lv = ATK_DEF; } - + if(t_sc_data) { int cardfix=100; if(t_sc_data[SC_DEFENDER].timer != -1 && flag&BF_LONG) @@ -2507,7 +2558,7 @@ static struct Damage battle_calc_mob_weapon_attack( flag=(flag&~BF_SKILLMASK)|BF_NORMAL; break; case AS_GRIMTOOTH: - damage = damage*(100+ 20*skill_lv)/100; + damage = damage*(100+ 20*skill_lv)/100; break; case AS_POISONREACT: // celest s_ele = 0; @@ -2710,7 +2761,7 @@ static struct Damage battle_calc_mob_weapon_attack( hitrate -= 50; if (t_sc_data[SC_SLEEP].timer!=-1 || // 睡眠は必中 t_sc_data[SC_STAN].timer!=-1 || // スタンは必中 - t_sc_data[SC_FREEZE].timer!=-1 || + t_sc_data[SC_FREEZE].timer!=-1 || (t_sc_data[SC_STONE].timer!=-1 && t_sc_data[SC_STONE].val2==0)) // 凍結は必中 hitrate = 1000000; } @@ -2762,8 +2813,8 @@ static struct Damage battle_calc_mob_weapon_attack( if(damage < 0) damage = 0; // 属 性の適用 - if (!((battle_config.mob_ghostring_fix == 1) && - (battle_get_elem_type(target) == 8) && + if (!((battle_config.mob_ghostring_fix == 1) && + (battle_get_elem_type(target) == 8) && (target->type==BL_PC))) // [MouseJstr] if(skill_num != 0 || s_ele != 0 || !battle_config.mob_attack_attr_none) damage=battle_attr_fix(damage, s_ele, battle_get_element(target) ); @@ -3506,7 +3557,7 @@ static struct Damage battle_calc_pc_weapon_attack( /* int mdef1=battle_get_mdef(target); int mdef2=battle_get_mdef2(target); int imdef_flag=0; - + damage = ((damage * 5) + (skill_lv * battle_get_int(src) * 5) + rand()%500 + 500) /2; damage2 = ((damage2 * 5) + (skill_lv * battle_get_int(src) * 5) + rand()%500 + 500) /2; damage3 = damage; @@ -3520,7 +3571,7 @@ static struct Damage battle_calc_pc_weapon_attack( // calculate magic part of damage damage3 = skill_lv * battle_get_int(src) * 5; - + // ignores magic defense now [Celest] /*if(sd->ignore_mdef_ele & (1<ignore_mdef_race & (1<status.weapon > 16) {// 二刀流か? int dmg = damage, dmg2 = damage2; @@ -4258,7 +4309,7 @@ struct Damage battle_calc_magic_attack( } else if (target->type == BL_PC) { damage = ((struct map_session_data *)target)->status.sp * 2; matk_flag = 0; // don't consider matk and matk2 - } + } break; } } @@ -4554,6 +4605,7 @@ struct Damage battle_calc_attack( int attack_type, default: if(battle_config.error_log) printf("battle_calc_attack: unknwon attack type ! %d\n",attack_type); + memset(&d,0,sizeof(d)); break; } return d; @@ -4596,7 +4648,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, } if(battle_check_target(src,target,BCT_ENEMY) <= 0 && - !battle_check_range(src,target,0)) + !battle_check_range(src,target,0)) return 0; // 攻撃対象外 race = battle_get_race(target); @@ -4810,8 +4862,8 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, --t_sc_data[SC_POISONREACT].val2; } if (t_sc_data[SC_POISONREACT].val2<=0) - skill_status_change_end(target,SC_POISONREACT,-1); - } + skill_status_change_end(target,SC_POISONREACT,-1); + } } if (t_sc_data && t_sc_data[SC_BLADESTOP_WAIT].timer != -1 && !(battle_get_mode(src)&0x20)) { // ボスには無効 @@ -4911,7 +4963,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return -1; if(ss->prev == NULL) return -1; - if(inf2&0x80 && + if(inf2&0x80 && (map[src->m].flag.pvp || pc_iskiller((struct map_session_data *)src, (struct map_session_data *)target)) && // [MouseJstr] !(target->type == BL_PC && pc_isinvisible((struct map_session_data *)target))) return 0; @@ -5037,7 +5089,7 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range) int dx,dy; struct walkpath_data wpd; int arange; - + nullpo_retr(0, src); nullpo_retr(0, bl); @@ -5182,7 +5234,7 @@ static const struct { { "item_slots_override_grffile", &battle_config.item_slots_override_grffile}, // [Celest] { "indoors_override_grffile", &battle_config.indoors_override_grffile}, // [Celest] { "skill_sp_override_grffile", &battle_config.skill_sp_override_grffile}, // [Celest] - { "cardillust_read_grffile", &battle_config.cardillust_read_grffile}, // [Celest] + { "cardillust_read_grffile", &battle_config.cardillust_read_grffile}, // [Celest] { "arrow_decrement", &battle_config.arrow_decrement }, { "max_aspd", &battle_config.max_aspd }, { "max_hp", &battle_config.max_hp }, @@ -5329,10 +5381,10 @@ static const struct { { "allow_atcommand_when_mute", &battle_config.allow_atcommand_when_mute}, // [celest] { "finding_ore_rate", &battle_config.finding_ore_rate}, // [celest] { "exp_calc_type", &battle_config.exp_calc_type}, // [celest] - { "double_login_system", &battle_config.double_login_system}, // [celest] + { "min_skill_delay_limit", &battle_config.min_skill_delay_limit}, // [celest] //SQL-only options start -#ifndef TXT_ONLY +#ifndef TXT_ONLY { "mail_system", &battle_config.mail_system }, // added by [Valaris] //SQL-only options end #endif @@ -5442,7 +5494,7 @@ void battle_set_defaults() { battle_config.item_slots_override_grffile=0; // [Celest] battle_config.indoors_override_grffile=0; // [Celest] battle_config.skill_sp_override_grffile=0; // [Celest] - battle_config.cardillust_read_grffile=0; // [Celest] + battle_config.cardillust_read_grffile=0; // [Celest] battle_config.arrow_decrement=1; battle_config.max_aspd = 199; battle_config.max_hp = 32500; @@ -5590,10 +5642,10 @@ void battle_set_defaults() { battle_config.castrate_dex_scale = 150; battle_config.area_size = 14; battle_config.exp_calc_type = 1; - battle_config.double_login_system = 0; + battle_config.min_skill_delay_limit = 100; //SQL-only options start -#ifndef TXT_ONLY +#ifndef TXT_ONLY battle_config.mail_system = 0; //SQL-only options end #endif @@ -5710,13 +5762,13 @@ void battle_validate_conf() { // at least 1 client must be accepted if ((battle_config.packet_ver_flag & 127) == 0) // added by [Yor] battle_config.packet_ver_flag = 127; // accept all clients - + if (battle_config.night_darkness_level > 10) // Celest battle_config.night_darkness_level = 10; if (battle_config.skill_range_leniency < 0) // Celest battle_config.skill_range_leniency = 0; - + if (battle_config.motd_type < 0) battle_config.motd_type = 0; else if (battle_config.motd_type > 1) @@ -5728,22 +5780,21 @@ void battle_validate_conf() { if (battle_config.vending_max_value > 10000000 || battle_config.vending_max_value<=0) // Lupus & Kobra_k88 battle_config.vending_max_value = 10000000; - if (battle_config.double_login_system < 0) - battle_config.double_login_system = 0; - + if (battle_config.min_skill_delay_limit < 10) + battle_config.min_skill_delay_limit = 10; // minimum delay of 10ms } /*========================================== * 設定ファイルを読み込む *------------------------------------------ */ -int battle_config_read(const char *cfgName) +int battle_config_read(const char *cfgName) { char line[1024], w1[1024], w2[1024]; FILE *fp; static int count = 0; - if ((count++) == 0) + if ((count++) == 0) battle_set_defaults(); fp = fopen(cfgName,"r"); diff --git a/src/map/battle.h b/src/map/battle.h index 29b537080..d88ea54c1 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -115,6 +115,7 @@ enum { BCT_NOPARTY =0x50000, BCT_ALL =0x20000, BCT_NOONE =0x60000, + BCT_SELF =0x60000, }; int battle_check_undead(int race,int element); @@ -291,7 +292,7 @@ extern struct Battle_Config { int prevent_logout; // Added by RoVeRT int alchemist_summon_reward; // [Valaris] - int maximum_level; + unsigned int maximum_level; int drops_by_luk; int monsters_ignore_gm; int equipment_breaking; @@ -348,7 +349,7 @@ extern struct Battle_Config { int zeny_from_mobs; // [Valaris] int mobs_level_up; // [Valaris] - int pk_min_level; // [celest] + unsigned int pk_min_level; // [celest] int skill_steal_type; // [celest] int skill_steal_rate; // [celest] int night_darkness_level; // [celest] @@ -357,7 +358,7 @@ extern struct Battle_Config { int allow_atcommand_when_mute; // [celest] int finding_ore_rate; // orn int exp_calc_type; - int double_login_system; + int min_skill_delay_limit; #ifndef TXT_ONLY /* SQL-only options */ int mail_system; // [Valaris] diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 1ced08777..5d65c8f01 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -1063,8 +1063,8 @@ int charcommand_item( if (pet_id >= 0) { sd->catch_target_class = pet_db[pet_id].class_; intif_create_pet(sd->status.account_id, sd->status.char_id, - pet_db[pet_id].class_, mob_db[pet_db[pet_id].class_].lv, - pet_db[pet_id].EggID, 0, pet_db[pet_id].intimate, + (short)pet_db[pet_id].class_, (short)mob_db[pet_db[pet_id].class_].lv, + (short)pet_db[pet_id].EggID, 0, (short)pet_db[pet_id].intimate, 100, 0, 1, pet_db[pet_id].jname); // if not pet egg } else { diff --git a/src/map/chat.c b/src/map/chat.c index c7ec13a5f..cfd2660e0 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -49,7 +49,7 @@ int chat_createchat(struct map_session_data *sd,int limit,int pub,char* pass,cha cd->bl.id = map_addobject(&cd->bl); if(cd->bl.id==0){ clif_createchat(sd,1); - free(cd); + aFree(cd); return 0; } pc_setchatid(sd,cd->bl.id); @@ -82,7 +82,7 @@ int chat_joinchat(struct map_session_data *sd,int chatid,char* pass) clif_joinchatfail(sd,1); return 0; } - if(chatid == sd->chatID) //Double Chat fix by Alex14, thx CHaNGeTe + if(chatid == (int)sd->chatID) //Double Chat fix by Alex14, thx CHaNGeTe { clif_joinchatfail(sd,1); return 0; @@ -290,7 +290,7 @@ int chat_createnpcchat(struct npc_data *nd,int limit,int pub,int trigger,char* t cd->bl.id = map_addobject(&cd->bl); if(cd->bl.id==0){ - free(cd); + aFree(cd); return 0; } nd->chat_id=cd->bl.id; diff --git a/src/map/clif.c b/src/map/clif.c index b72192690..38aa8ab26 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -53,11 +53,15 @@ #define STATE_BLIND 0x10 -int packet_db_ver = -1; // the packet version used by packet_db -int packet_db_connect_cmd = 0xF5; // the default packet used for connecting to the server - +struct Clif_Config clif_config; struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB]; +#define USE_PACKET_DB(sd) \ + clif_config.enable_packet_db && sd->packet_ver == clif_config.packet_db_ver + +#define IS_PACKET_DB_VER(cmd) \ + cmd == clif_config.connect_cmd + static const int packet_len_table[MAX_PACKET_DB] = { 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -66,7 +70,7 @@ static const int packet_len_table[MAX_PACKET_DB] = { //#0x0040 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2, + 0, 0, 0, 0, 55, 17, 3, 37, 46, -1, 23, -1, 3,108, 3, 2, #if PACKETVER < 2 3, 28, 19, 11, 3, -1, 9, 5, 52, 51, 56, 58, 41, 2, 6, 6, #else // 78-7b 亀島以降 lv99エフェクト用 @@ -155,7 +159,7 @@ char talkie_mes[80]; * map鯖のip設定 *------------------------------------------ */ -void clif_setip(char *ip) +void clif_setip(char *ip) { memcpy(map_ip_str, ip, 16); map_ip = inet_addr(map_ip_str); @@ -165,7 +169,7 @@ void clif_setip(char *ip) * map鯖のport設定 *------------------------------------------ */ -void clif_setport(int port) +void clif_setport(int port) { map_port = port; } @@ -174,7 +178,7 @@ void clif_setport(int port) * map鯖のip読み出し *------------------------------------------ */ -in_addr_t clif_getip(void) +in_addr_t clif_getip(void) { return map_ip; } @@ -183,7 +187,7 @@ in_addr_t clif_getip(void) * map鯖のport読み出し *------------------------------------------ */ -int clif_getport(void) +int clif_getport(void) { return map_port; } @@ -192,7 +196,7 @@ int clif_getport(void) * *------------------------------------------ */ -int clif_countusers(void) +int clif_countusers(void) { int users = 0, i; struct map_session_data *sd; @@ -209,7 +213,7 @@ int clif_countusers(void) * 全てのclientに対してfunc()実行 *------------------------------------------ */ -int clif_foreachclient(int (*func)(struct map_session_data*, va_list),...) +int clif_foreachclient(int (*func)(struct map_session_data*, va_list),...) { int i; va_list ap; @@ -228,7 +232,7 @@ int clif_foreachclient(int (*func)(struct map_session_data*, va_list),...) * clif_sendでAREA*指定時用 *------------------------------------------ */ -int clif_send_sub(struct block_list *bl, va_list ap) +int clif_send_sub(struct block_list *bl, va_list ap) { unsigned char *buf; int len; @@ -902,17 +906,17 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) { * クラスチェンジ typeはMobの場合は1で他は0? *------------------------------------------ */ -int clif_class_change(struct block_list *bl,int class,int type) +int clif_class_change(struct block_list *bl,int class_,int type) { char buf[16]; nullpo_retr(0, bl); - if(class >= MAX_PC_CLASS) { + if(class_ >= MAX_PC_CLASS) { WBUFW(buf,0)=0x1b0; WBUFL(buf,2)=bl->id; WBUFB(buf,6)=type; - WBUFL(buf,7)=class; + WBUFL(buf,7)=class_; clif_send(buf,packet_len_table[0x1b0],bl,AREA); } @@ -922,9 +926,9 @@ int clif_class_change(struct block_list *bl,int class,int type) * *------------------------------------------ */ -int clif_mob_class_change(struct mob_data *md, int class) { +int clif_mob_class_change(struct mob_data *md, int class_) { char buf[16]; - int view = mob_get_viewclass(class); + int view = mob_get_viewclass(class_); nullpo_retr(0, md); @@ -961,7 +965,7 @@ int clif_mob_equip(struct mob_data *md, int nameid) { * MOB表示1 *------------------------------------------ */ -static int clif_mob0078(struct mob_data *md, unsigned char *buf) +static int clif_mob0078(struct mob_data *md, unsigned char *buf) { int level; @@ -3730,7 +3734,7 @@ void clif_getareachar_mob(struct map_session_data* sd,struct mob_data* md) int len; nullpo_retv(sd); nullpo_retv(md); - + if (session[sd->fd] == NULL) return; @@ -3749,7 +3753,7 @@ void clif_getareachar_mob(struct map_session_data* sd,struct mob_data* md) clif_specialeffect(&md->bl,423,0); else if(md->size==1) clif_specialeffect(&md->bl,421,0); - + } @@ -4049,8 +4053,8 @@ int clif_moboutsight(struct block_list *bl,va_list ap) nullpo_retr(0, ap); nullpo_retr(0, md=va_arg(ap,struct mob_data*)); - if(bl->type==BL_PC - && ((sd = (struct map_session_data*) bl) != NULL) + if(bl->type==BL_PC + && ((sd = (struct map_session_data*) bl) != NULL) && session[sd->fd] != NULL) { clif_clearchar_id(md->bl.id,0,sd->fd); } @@ -4071,8 +4075,8 @@ int clif_mobinsight(struct block_list *bl,va_list ap) nullpo_retr(0, ap); md=va_arg(ap,struct mob_data*); - if(bl->type==BL_PC - && ((sd = (struct map_session_data*) bl) != NULL) + if(bl->type==BL_PC + && ((sd = (struct map_session_data*) bl) != NULL) && session[sd->fd] != NULL) { clif_getareachar_mob(sd,md); } @@ -4093,8 +4097,8 @@ int clif_petoutsight(struct block_list *bl,va_list ap) nullpo_retr(0, ap); nullpo_retr(0, pd=va_arg(ap,struct pet_data*)); - if(bl->type==BL_PC - && ((sd = (struct map_session_data*) bl) != NULL) + if(bl->type==BL_PC + && ((sd = (struct map_session_data*) bl) != NULL) && session[sd->fd] != NULL) { clif_clearchar_id(pd->bl.id,0,sd->fd); } @@ -4112,8 +4116,8 @@ int clif_npcoutsight(struct block_list *bl,va_list ap) nullpo_retr(0, ap); nullpo_retr(0, nd=va_arg(ap,struct npc_data*)); - if(bl->type==BL_PC - && ((sd = (struct map_session_data*) bl) != NULL) + if(bl->type==BL_PC + && ((sd = (struct map_session_data*) bl) != NULL) && session[sd->fd] != NULL) { clif_clearchar_id(nd->bl.id,0,sd->fd); } @@ -4134,8 +4138,8 @@ int clif_petinsight(struct block_list *bl,va_list ap) nullpo_retr(0, ap); pd=va_arg(ap,struct pet_data*); - if(bl->type==BL_PC - && ((sd = (struct map_session_data*) bl) != NULL) + if(bl->type==BL_PC + && ((sd = (struct map_session_data*) bl) != NULL) && session[sd->fd] != NULL) { clif_getareachar_pet(sd,pd); } @@ -4153,8 +4157,8 @@ int clif_npcinsight(struct block_list *bl,va_list ap) nullpo_retr(0, ap); nd=va_arg(ap,struct npc_data*); - if(bl->type==BL_PC - && ((sd = (struct map_session_data*) bl) != NULL) + if(bl->type==BL_PC + && ((sd = (struct map_session_data*) bl) != NULL) && session[sd->fd] != NULL) { clif_getareachar_npc(sd,nd); } @@ -4701,7 +4705,7 @@ int clif_status_change(struct block_list *bl,int type,int flag) * Send message (modified by [Yor]) *------------------------------------------ */ -int clif_displaymessage(const int fd, char* mes) +int clif_displaymessage(const int fd, char* mes) { //Console [Wizputer] if (fd == 0) @@ -4724,13 +4728,13 @@ int clif_displaymessage(const int fd, char* mes) * 天の声を送信する *------------------------------------------ */ -int clif_GMmessage(struct block_list *bl, char* mes, int len, int flag) +int clif_GMmessage(struct block_list *bl, char* mes, int len, int flag) { unsigned char *buf; int lp; lp = (flag & 0x10) ? 8 : 4; - buf = (unsigned char*)aCalloc(len + lp, sizeof(unsigned char)); + buf = (unsigned char*)aCallocA(len + lp, sizeof(unsigned char)); WBUFW(buf,0) = 0x9a; WBUFW(buf,2) = len + lp; @@ -4743,7 +4747,7 @@ int clif_GMmessage(struct block_list *bl, char* mes, int len, int flag) (flag == 3) ? SELF : ALL_CLIENT); - if(buf) free(buf); + if(buf) aFree(buf); return 0; } @@ -4893,7 +4897,7 @@ int clif_wis_message(int fd, char *nick, char *mes, int mes_len) // R 0097 *------------------------------------------ */ int clif_wis_end(int fd, int flag) // R 0098 .B: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target -{ +{ WFIFOW(fd,0) = 0x98; WFIFOW(fd,2) = flag; WFIFOSET(fd,packet_len_table[0x98]); @@ -5794,7 +5798,7 @@ int clif_hpmeter(struct map_session_data *sd) unsigned char buf[16]; unsigned char buf2[16]; int i; - + nullpo_retr(0, sd); WBUFW(buf,0)=0x107; @@ -5809,7 +5813,7 @@ int clif_hpmeter(struct map_session_data *sd) WFIFOSET(i,packet_len_table[0x107]); } } - + WBUFW(buf2,0)=0x106; WBUFL(buf2,2)=sd->status.account_id; WBUFW(buf2,6)=(sd->status.hp > 0x7fff)? 0x7fff:sd->status.hp; @@ -5821,7 +5825,7 @@ int clif_hpmeter(struct map_session_data *sd) WFIFOSET(i,packet_len_table[0x106]); } } - + return 0; } /*================================================== @@ -5834,7 +5838,7 @@ int clif_update_mobhp(struct mob_data *md) char mobhp[50]; nullpo_retr(0, md); - + WBUFW(buf,0) = 0x95; WBUFL(buf,2) = md->bl.id; @@ -5845,7 +5849,7 @@ int clif_update_mobhp(struct mob_data *md) WBUFL(buf,54) = 0; WBUFL(buf,78) = 0; clif_send(buf,packet_len_table[0x195],&md->bl,AREA); - + return 0; } /*========================================== @@ -6206,7 +6210,7 @@ int clif_combo_delay(struct block_list *bl,int wait) *------------------------------------------ */ int clif_bladestop(struct block_list *src,struct block_list *dst, - int bool) + int _bool) { unsigned char buf[32]; @@ -6216,7 +6220,7 @@ int clif_bladestop(struct block_list *src,struct block_list *dst, WBUFW(buf,0)=0x1d1; WBUFL(buf,2)=src->id; WBUFL(buf,6)=dst->id; - WBUFL(buf,10)=bool; + WBUFL(buf,10)=_bool; clif_send(buf,packet_len_table[0x1d1],src,AREA); @@ -6837,7 +6841,7 @@ int clif_guild_message(struct guild *g,int account_id,const char *mes,int len) struct map_session_data *sd; unsigned char *buf; - buf = (unsigned char*)aCalloc(len + 4, sizeof(unsigned char)); + buf = (unsigned char*)aCallocA(len + 4, sizeof(unsigned char)); WBUFW(buf, 0) = 0x17f; WBUFW(buf, 2) = len + 4; @@ -6846,7 +6850,7 @@ int clif_guild_message(struct guild *g,int account_id,const char *mes,int len) if ((sd = guild_getavailablesd(g)) != NULL) clif_send(buf, WBUFW(buf,2), &sd->bl, GUILD); - if(buf) free(buf); + if(buf) aFree(buf); return 0; } @@ -7043,7 +7047,7 @@ void clif_callpartner(struct map_session_data *sd) * Adopt baby [Celest] *------------------------------------------ */ -void clif_adopt_process(struct map_session_data *sd) +void clif_adopt_process(struct map_session_data *sd) { int fd; nullpo_retv(sd); @@ -7054,7 +7058,7 @@ void clif_adopt_process(struct map_session_data *sd) } /*========================================== - * + * *------------------------------------------ */ void clif_parse_ReqAdopt(int fd, struct map_session_data *sd) { @@ -7067,7 +7071,7 @@ void clif_parse_ReqAdopt(int fd, struct map_session_data *sd) { * 座る *------------------------------------------ */ -void clif_sitting(struct map_session_data *sd) +void clif_sitting(struct map_session_data *sd) { unsigned char buf[64]; @@ -7083,13 +7087,13 @@ void clif_sitting(struct map_session_data *sd) * *------------------------------------------ */ -int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len) +int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len) { unsigned char *buf; nullpo_retr(0, sd); - buf = (unsigned char*)aCalloc(len + 8, sizeof(unsigned char)); + buf = (unsigned char*)aCallocA(len + 8, sizeof(unsigned char)); WBUFW(buf, 0) = 0x17f; WBUFW(buf, 2) = len + 8; @@ -7097,7 +7101,7 @@ int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len) clif_send(buf, WBUFW(buf,2), &sd->bl, SELF); - if(buf) free(buf); + if(buf) aFree(buf); return 0; } @@ -7107,7 +7111,7 @@ int clif_disp_onlyself(struct map_session_data *sd, char *mes, int len) *------------------------------------------ */ -int clif_GM_kickack(struct map_session_data *sd, int id) +int clif_GM_kickack(struct map_session_data *sd, int id) { int fd; @@ -7142,7 +7146,7 @@ int clif_GM_kick(struct map_session_data *sd,struct map_session_data *tsd,int ty *------------------------------------------ */ -int clif_timedout(struct map_session_data *sd) +int clif_timedout(struct map_session_data *sd) { nullpo_retr(0, sd); @@ -7247,8 +7251,8 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) { struct map_session_data *pl_sd; int i; for(i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) != NULL && - pl_sd->state.auth && + if (session[i] && (pl_sd = session[i]->session_data) != NULL && + pl_sd->state.auth && (pc_isGM((struct map_session_data *)&bl) > pc_isGM((struct map_session_data *)&pl_sd->bl))) clif_specialeffect(&pl_sd->bl, type, 1); } @@ -7278,10 +7282,10 @@ int clif_specialeffect(struct block_list *bl, int type, int flag) { * *------------------------------------------ */ -void clif_parse_WantToConnection(int fd, struct map_session_data *sd) +void clif_parse_WantToConnection(int fd, struct map_session_data *sd) { struct map_session_data *old_sd; - int account_id; // account_id in the packet 0x72 or 0x7E + int cmd, account_id; // account_id in the packet 0x72 or 0x7E if (sd) { if (battle_config.error_log) @@ -7289,12 +7293,14 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) return; } + cmd = RFIFOW(fd,0); + // packet DB - if (RFIFOW(fd,0) == packet_db_connect_cmd) { + if (IS_PACKET_DB_VER(cmd)) { //printf("Received bytes %d with packet 0x72.\n", RFIFOREST(fd)); - account_id = RFIFOL(fd,packet_db[packet_db_ver][packet_db_connect_cmd].pos[0]); + account_id = RFIFOL(fd,packet_db[clif_config.packet_db_ver][clif_config.connect_cmd].pos[0]); // 0x72 - } else if (RFIFOW(fd,0) == 0x72) { + } else if (cmd == 0x72) { //printf("Received bytes %d with packet 0x72.\n", RFIFOREST(fd)); if (RFIFOREST(fd) >= 39 && (RFIFOB(fd,38) == 0 || RFIFOB(fd,38) == 1)) // 00 = Female, 01 = Male account_id = RFIFOL(fd,12); @@ -7303,14 +7309,14 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) else // old packet version account_id = RFIFOL(fd,2); // 0x7E - } else if (RFIFOW(fd,0) == 0x7E) { + } else if (cmd == 0x7E) { //printf("Received bytes %d with packet 0x7E.\n", RFIFOREST(fd)); if (RFIFOREST(fd) >= 37 && (RFIFOB(fd,36) == 0 || RFIFOB(fd,36) == 1)) // 00 = Female, 01 = Male account_id = RFIFOL(fd,9); else account_id = RFIFOL(fd,12); // 0xF5 - } else if (RFIFOW(fd,0) == 0xF5) { + } else if (cmd == 0xF5) { //printf("Received bytes %d with packet 0xF5.\n", RFIFOREST(fd)); if (RFIFOREST(fd) >= 34 && (RFIFOB(fd,33) == 0 || RFIFOB(fd,33) == 1)) // 00 = Female, 01 = Male account_id = RFIFOL(fd,7); @@ -7319,9 +7325,9 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) else if (RFIFOREST(fd) >= 32 && (RFIFOB(fd,31) == 0 || RFIFOB(fd,31) == 1)) // 00 = Female, 01 = Male account_id = RFIFOL(fd,10); else { // 29 28 28 - if (RFIFOW(fd,1) == 0) // testing ^^; + /*if (RFIFOW(fd,1) == 0) // testing ^^; account_id = RFIFOL(fd,3); - else + else*/ account_id = RFIFOL(fd,5); } // 0x9B @@ -7339,14 +7345,14 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) sd = session[fd]->session_data = (struct map_session_data*)aCalloc(1, sizeof(struct map_session_data)); sd->fd = fd; + if (IS_PACKET_DB_VER(cmd)) { + sd->packet_ver = clif_config.packet_db_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) + pc_setnewpc(sd, account_id, RFIFOL(fd,packet_db[clif_config.packet_db_ver][clif_config.connect_cmd].pos[1]), + RFIFOL(fd,packet_db[clif_config.packet_db_ver][clif_config.connect_cmd].pos[2]), + RFIFOL(fd,packet_db[clif_config.packet_db_ver][clif_config.connect_cmd].pos[3]), + RFIFOL(fd,packet_db[clif_config.packet_db_ver][clif_config.connect_cmd].pos[4]), fd); // 0x72 - if (RFIFOW(fd,0) == packet_db_connect_cmd) { - sd->packet_ver = packet_db_ver; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) - pc_setnewpc(sd, account_id, RFIFOL(fd,packet_db[packet_db_ver][packet_db_connect_cmd].pos[1]), - RFIFOL(fd,packet_db[packet_db_ver][packet_db_connect_cmd].pos[2]), - RFIFOL(fd,packet_db[packet_db_ver][packet_db_connect_cmd].pos[3]), - RFIFOL(fd,packet_db[packet_db_ver][packet_db_connect_cmd].pos[4]), fd); - } else if (RFIFOW(fd,0) == 0x72) { + } else if (cmd == 0x72) { if (RFIFOREST(fd) >= 39 && (RFIFOB(fd,38) == 0 || RFIFOB(fd,38) == 1)) { // 00 = Female, 01 = Male sd->packet_ver = 7; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) pc_setnewpc(sd, account_id, RFIFOL(fd,22), RFIFOL(fd,30), RFIFOL(fd,34), RFIFOB(fd,38), fd); @@ -7358,7 +7364,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) pc_setnewpc(sd, account_id, RFIFOL(fd,6), RFIFOL(fd,10), RFIFOL(fd,14), RFIFOB(fd,18), fd); } // 0x7E - } else if (RFIFOW(fd,0) == 0x7E) { + } else if (cmd == 0x7E) { if (RFIFOREST(fd) >= 37 && (RFIFOB(fd,36) == 0 || RFIFOB(fd,36) == 1)) { // 00 = Female, 01 = Male sd->packet_ver = 9; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) pc_setnewpc(sd, account_id, RFIFOL(fd,21), RFIFOL(fd,28), RFIFOL(fd,32), RFIFOB(fd,36), fd); @@ -7367,7 +7373,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data *sd) pc_setnewpc(sd, account_id, RFIFOL(fd,18), RFIFOL(fd,24), RFIFOL(fd,28), RFIFOB(fd,32), fd); } // 0xF5 - } else if (RFIFOW(fd,0) == 0xF5) { + } else if (cmd == 0xF5) { if (RFIFOREST(fd) >= 34 && (RFIFOB(fd,33) == 0 || RFIFOB(fd,33) == 1)) { // 00 = Female, 01 = Male sd->packet_ver = 10; // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) pc_setnewpc(sd, account_id, RFIFOL(fd,15), RFIFOL(fd,25), RFIFOL(fd,29), RFIFOB(fd,33), fd); @@ -7522,7 +7528,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 )) // オートバーサーク発動 skill_status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0); - + // if(time(&timer) < ((weddingtime=pc_readglobalreg(sd,"PC_WEDDING_TIME")) + 3600)) // skill_status_change_start(&sd->bl,SC_WEDDING,0,weddingtime,0,0,36000,0); @@ -7568,9 +7574,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) void clif_parse_TickSend(int fd, struct map_session_data *sd) { nullpo_retv(sd); - if (sd->packet_ver == packet_db_ver) { - sd->client_tick=RFIFOL(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0]); - } else { + if (USE_PACKET_DB(sd)) { + sd->client_tick=RFIFOL(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0]); + } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 8: sd->client_tick = RFIFOL(fd,6); @@ -7597,7 +7603,7 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) { case 16: sd->client_tick = RFIFOL(fd,5); break; - + default: // old version by default (and version 6 + 7) sd->client_tick = RFIFOL(fd,2); break; @@ -7614,7 +7620,7 @@ void clif_parse_TickSend(int fd, struct map_session_data *sd) { */ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { int x, y; - + nullpo_retv(sd); if (pc_isdead(sd)) { @@ -7642,6 +7648,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { sd->sc_data[SC_BLADESTOP].timer !=-1 || //白刃取り sd->sc_data[SC_SPIDERWEB].timer !=-1 || //スパイダーウェッブ (sd->sc_data[SC_DANCING].timer !=-1 && sd->sc_data[SC_DANCING].val4) || //合奏スキル演奏中は動けない + (sd->sc_data[SC_GOSPEL].timer !=-1 && sd->sc_data[SC_GOSPEL].val4 == BCT_SELF) || // cannot move while gospel is in effect sd->sc_data[SC_CONFUSION].timer !=-1) return; if ((sd->status.option & 2) && pc_checkskill(sd, RG_TUNNELDRIVE) <= 0) @@ -7652,10 +7659,12 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { pc_stopattack(sd); - if (sd->packet_ver == packet_db_ver) { + if (USE_PACKET_DB(sd)) { int cmd = RFIFOW(fd,0); - x = RFIFOB(fd,packet_db[packet_db_ver][cmd].pos[0]) * 4 + (RFIFOB(fd,packet_db[packet_db_ver][cmd].pos[0] + 1) >> 6); - y = ((RFIFOB(fd,packet_db[packet_db_ver][cmd].pos[0]+1) & 0x3f) << 4) + (RFIFOB(fd,packet_db[packet_db_ver][cmd].pos[0] + 2) >> 4); + x = RFIFOB(fd,packet_db[clif_config.packet_db_ver][cmd].pos[0]) * 4 + + (RFIFOB(fd,packet_db[clif_config.packet_db_ver][cmd].pos[0] + 1) >> 6); + y = ((RFIFOB(fd,packet_db[clif_config.packet_db_ver][cmd].pos[0]+1) & 0x3f) << 4) + + (RFIFOB(fd,packet_db[clif_config.packet_db_ver][cmd].pos[0] + 2) >> 4); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 6: @@ -7748,8 +7757,8 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { struct block_list *bl; int account_id; - if (sd->packet_ver == packet_db_ver) { - account_id = RFIFOL(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0]); + if (USE_PACKET_DB(sd)) { + account_id = RFIFOL(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 8: @@ -7785,7 +7794,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) { bl = map_id2bl(account_id); if (bl == NULL) return; - + WFIFOW(fd,0) = 0x95; WFIFOL(fd,2) = account_id; @@ -7881,13 +7890,13 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c < nullpo_retv(sd); if ((is_atcommand(fd, sd, RFIFOP(fd,4), 0) != AtCommand_None) || (is_charcommand(fd, sd, RFIFOP(fd,4),0)!= CharCommand_None) || - (sd->sc_data && + (sd->sc_data && (sd->sc_data[SC_BERSERK].timer != -1 || //バーサーク時は会話も不可 sd->sc_data[SC_NOCHAT].timer != -1 ))) //チャット禁止 return; - message = (char*)aCalloc(RFIFOW(fd,2) + 128, sizeof(char)); - buf = (char*)aCalloc(RFIFOW(fd,2) + 4, sizeof(char)); + message = (char*)aCallocA(RFIFOW(fd,2) + 128, sizeof(char)); + buf = (char*)aCallocA(RFIFOW(fd,2) + 4, sizeof(char)); //printf("clif_parse_GlobalMessage: message: '%s'.\n", RFIFOP(fd,4)); if (strncmp(RFIFOP(fd,4), sd->status.name, strlen(sd->status.name)) != 0) { @@ -7912,9 +7921,9 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c < if (battle_config.ban_spoof_namer > 0) { chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, 0, battle_config.ban_spoof_namer, 0); // type: 2 - ban (year, month, day, hour, minute, second) clif_setwaitclose(fd); // forced to disconnect because of the hack - - if(message) free(message); - if(buf) free(buf); + + if(message) aFree(message); + if(buf) aFree(buf); return; } @@ -7958,8 +7967,8 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c < } } - if(message) free(message); - if(buf) free(buf); + if(message) aFree(message); + if(buf) aFree(buf); return; } @@ -8038,9 +8047,9 @@ void clif_parse_ChangeDir(int fd, struct map_session_data *sd) { nullpo_retv(sd); - if (sd->packet_ver == packet_db_ver) { - headdir = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0]); - dir = RFIFOB(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[1]); + if (USE_PACKET_DB(sd)) { + headdir = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0]); + dir = RFIFOB(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[1]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 7: @@ -8152,9 +8161,9 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) { pc_stop_walking(sd, 0); pc_stopattack(sd); - if (sd->packet_ver == packet_db_ver) { - target_id = RFIFOL(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0]); - action_type = RFIFOB(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[1]); + if (USE_PACKET_DB(sd)) { + target_id = RFIFOL(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0]); + action_type = RFIFOB(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[1]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 8: @@ -8283,20 +8292,20 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 .w status.name, RFIFOP(fd,28)); if ((is_charcommand(fd, sd, gm_command, 0) != CharCommand_None) || (is_atcommand(fd, sd, gm_command, 0) != AtCommand_None) || - (sd && sd->sc_data && + (sd && sd->sc_data && (sd->sc_data[SC_BERSERK].timer!=-1 || //バーサーク時は会話も不可 sd->sc_data[SC_NOCHAT].timer != -1))) //チャット禁止 { - if(gm_command) free(gm_command); + if(gm_command) aFree(gm_command); return; } - if(gm_command) free(gm_command); + if(gm_command) aFree(gm_command); // searching destination character dstsd = map_nick2sd(RFIFOP(fd,4)); @@ -8360,8 +8369,8 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) { nullpo_retv(sd); - if (sd->packet_ver == packet_db_ver) { - map_object_id = RFIFOL(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0]); + if (USE_PACKET_DB(sd)) { + map_object_id = RFIFOL(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 7: @@ -8436,9 +8445,9 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd) { sd->sc_data[SC_BERSERK].timer != -1)) ) //バーサーク return; - if (sd->packet_ver == packet_db_ver) { - item_index = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0])-2; - item_amount = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[1]); + if (USE_PACKET_DB(sd)) { + item_index = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[1]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 8: @@ -8505,8 +8514,8 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) { if (sd->invincible_timer != -1) pc_delinvincibletimer(sd); - if (sd->packet_ver == packet_db_ver) { - pc_useitem(sd,RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0])-2); + if (USE_PACKET_DB(sd)) { + pc_useitem(sd,RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0])-2); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 6: @@ -8888,10 +8897,10 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { if (sd->chatID || sd->npc_id != 0 || sd->vender_id != 0) return; - if (sd->packet_ver == packet_db_ver) { - skilllv = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0]); - skillnum = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[1]); - target_id = RFIFOL(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[2]); + if (USE_PACKET_DB(sd)) { + skilllv = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0]); + skillnum = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[1]); + target_id = RFIFOL(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[2]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 6: @@ -8972,7 +8981,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { return; } - if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) || + if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) || sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer != -1 || sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class == 22) return; @@ -9021,11 +9030,11 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) { if(sd->chatID) return; skillmoreinfo = -1; - if (sd->packet_ver == packet_db_ver) { - skilllv = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0]); - skillnum = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[1]); - x = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[2]); - y = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[3]); + if (USE_PACKET_DB(sd)) { + skilllv = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0]); + skillnum = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[1]); + x = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[2]); + y = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[3]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 6: @@ -9146,7 +9155,7 @@ void clif_parse_UseSkillToPos(int fd, struct map_session_data *sd) { return; } - if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) || + if ((sd->sc_data[SC_TRICKDEAD].timer != -1 && skillnum != NV_TRICKDEAD) || sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_NOCHAT].timer != -1 || sd->sc_data[SC_WEDDING].timer != -1 || sd->view_class == 22) return; @@ -9176,7 +9185,7 @@ void clif_parse_UseSkillMap(int fd,struct map_session_data *sd) if(sd->chatID) return; - if (sd->npc_id!=0 || sd->vender_id != 0 || (sd->sc_data && + if (sd->npc_id!=0 || sd->vender_id != 0 || (sd->sc_data && (sd->sc_data[SC_TRICKDEAD].timer != -1 || sd->sc_data[SC_BERSERK].timer!=-1 || sd->sc_data[SC_NOCHAT].timer!=-1 || @@ -9324,8 +9333,8 @@ void clif_parse_InsertCard(int fd,struct map_session_data *sd) void clif_parse_SolveCharName(int fd, struct map_session_data *sd) { int char_id; - if (sd->packet_ver == packet_db_ver) { - char_id = RFIFOL(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0]); + if (USE_PACKET_DB(sd)) { + char_id = RFIFOL(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 8: @@ -9412,9 +9421,9 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) { if (sd->npc_id != 0 || sd->vender_id != 0) return; - if (sd->packet_ver == packet_db_ver) { - item_index = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0])-2; - item_amount = RFIFOL(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[1]); + if (USE_PACKET_DB(sd)) { + item_index = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0])-2; + item_amount = RFIFOL(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[1]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 8: @@ -9478,9 +9487,9 @@ void clif_parse_MoveFromKafra(int fd,struct map_session_data *sd) { nullpo_retv(sd); - if (sd->packet_ver == packet_db_ver) { - item_index = RFIFOW(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[0])-1; - item_amount = RFIFOL(fd,packet_db[packet_db_ver][RFIFOW(fd,0)].pos[1]); + if (USE_PACKET_DB(sd)) { + item_index = RFIFOW(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[0])-1; + item_amount = RFIFOL(fd,packet_db[clif_config.packet_db_ver][RFIFOW(fd,0)].pos[1]); } else { switch (sd->packet_ver) { // 5: old, 6: 7july04, 7: 13july04, 8: 26july04, 9: 9aug04/16aug04/17aug04, 10: 6sept04, 11: 21sept04, 12: 18oct04, 13: 25oct04 (by [Yor]) case 8: @@ -9649,7 +9658,7 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) { void clif_parse_PartyMessage(int fd, struct map_session_data *sd) { nullpo_retv(sd); if (is_charcommand(fd, sd, RFIFOP(fd,4), 0) != CharCommand_None) - return; + return; if (is_atcommand(fd, sd, RFIFOP(fd,4), 0) != AtCommand_None) return; if(sd->sc_data && @@ -10093,7 +10102,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data *sd) { // Rewritten by WFIFOW(fd,0) = 0x0d1; // R 00d1 .B .B: type: 0: deny, 1: allow, fail: 0: success, 1: fail WFIFOB(fd,2) = RFIFOB(fd,26); // do nothing only if nick can not exist - if (strlen(nick) < 4) { + if (strlen(nick) < 4) { WFIFOB(fd,3) = 1; // fail WFIFOSET(fd, packet_len_table[0x0d1]); if (RFIFOB(fd,26) == 0) // type @@ -10239,7 +10248,7 @@ void clif_parse_sn_doridori(int fd, struct map_session_data *sd) { * スパノビの爆裂波動 *------------------------------------------ */ -void clif_parse_sn_explosionspirits(int fd, struct map_session_data *sd) +void clif_parse_sn_explosionspirits(int fd, struct map_session_data *sd) { if(sd){ int nextbaseexp=pc_nextbaseexp(sd); @@ -10369,9 +10378,6 @@ void clif_parse_debug(int fd,struct map_session_data *sd) { int i, cmd; - if (packet_db_ver < 0) - return; - cmd = RFIFOW(fd,0); printf("packet debug 0x%4X\n",cmd); @@ -10562,11 +10568,12 @@ static int clif_parse(int fd) { packet_ver = sd->packet_ver; // check authentification packet to know packet version else { - // packet DB - if (cmd == packet_db_connect_cmd) { - if (RFIFOREST(fd) >= packet_db[packet_db_ver][cmd].len && - (RFIFOB(fd,packet_db[packet_db_ver][cmd].pos[4]) == 0 || RFIFOB(fd,packet_db[packet_db_ver][cmd].pos[4]) == 1)) {// 00 = Female, 01 = Male - packet_ver = packet_db_ver; + // packet DB + if (IS_PACKET_DB_VER (cmd)) { + if (RFIFOREST(fd) >= packet_db[clif_config.packet_db_ver][cmd].len && + (RFIFOB(fd,packet_db[clif_config.packet_db_ver][cmd].pos[4]) == 0 || + RFIFOB(fd,packet_db[clif_config.packet_db_ver][cmd].pos[4]) == 1)) {// 00 = Female, 01 = Male + packet_ver = clif_config.packet_db_ver; } // 0x72 } else if (cmd == 0x72) { @@ -10597,9 +10604,9 @@ static int clif_parse(int fd) { else if (RFIFOREST(fd) >= 32 && (RFIFOB(fd,31) == 0 || RFIFOB(fd,31) == 1)) // 00 = Female, 01 = Male packet_ver = 11; // 11: 21sept04 else if (RFIFOREST(fd) >= 29 && (RFIFOB(fd,28) == 0 || RFIFOB(fd,28) == 1)) { // 00 = Female, 01 = Male - if (RFIFOW(fd,1) == 0) // testing ^^; + /*if (RFIFOW(fd,1) == 0) // testing ^^; packet_ver = 15; - else + else*/ packet_ver = 13; // 13: 25oct04 (by [Yor]) } // -- some way to identify version 14 and 15? -- @@ -10625,7 +10632,9 @@ static int clif_parse(int fd) { (packet_ver == 14 && (battle_config.packet_ver_flag & 16) == 0) || (packet_ver == 15 && (battle_config.packet_ver_flag & 32) == 0) || (packet_ver == 16 && (battle_config.packet_ver_flag & 64) == 0) || - packet_ver > MAX_PACKET_VER) { // no support yet + packet_ver > MAX_PACKET_VER || // no packet version support yet + // identified version, but unknown client? + (!sd && packet_db[packet_ver][cmd].func != clif_parse_WantToConnection)) { WFIFOW(fd,0) = 0x6a; WFIFOB(fd,2) = 5; // 05 = Game's EXE is not the latest version WFIFOSET(fd,23); @@ -10731,8 +10740,8 @@ static int packetdb_readdb(void) FILE *fp; char line[1024]; int ln=0; - int cmd,j,packet_ver = 0; - char *str[32],*p,*str2[32],*p2; + int cmd,j,k,packet_ver; + char *str[32],*p,*str2[32],*p2,w1[24],w2[24]; struct { void (*func)(); @@ -10861,18 +10870,51 @@ static int packetdb_readdb(void) return 1; } - packet_db_ver = MAX_PACKET_VER; - + clif_config.packet_db_ver = MAX_PACKET_VER; + packet_ver = MAX_PACKET_VER; // read into packet_db's version by default + while(fgets(line,1020,fp)){ if(line[0]=='/' && line[1]=='/') continue; - if (sscanf(line,"packet_ver: %d",&packet_ver) == 1) { - memcpy(&packet_db[packet_ver], &packet_db[packet_ver - 1], sizeof(packet_db[0])); // copy into new version and continue - // i hope this isn't the wrong way to do things ^^; - continue; + if (sscanf(line,"%[^:]: %[^\r\n]",w1,w2) == 2) { + if(strcmpi(w1,"packet_ver")==0) { + packet_ver = atoi(w2); + // copy from previous version into new version and continue + // - indicating all following packets should be read into the newer version + // -- on 2nd thought, rereading everything isn't the best thing to do... + // memcpy(&packet_db[packet_ver], &packet_db[packet_ver - 1], sizeof(packet_db[0])); + continue; + } else if(strcmpi(w1,"packet_db_ver")==0) { + // optional: if you do not wish to read multiple versions from the packet_db, + // remove all "packet_ver: ##" lines, and define the packet DB version with this + if(strcmpi(w2,"default")==0) + clif_config.packet_db_ver = MAX_PACKET_VER; + else { + // to manually set the packet DB version + clif_config.packet_db_ver = atoi(w2); + // check for invalid version + if (clif_config.packet_db_ver > MAX_PACKET_VER || + clif_config.packet_db_ver < 0) + clif_config.packet_db_ver = MAX_PACKET_VER; + } + continue; + } else if(strcmpi(w1,"enable_packet_db")==0) { + // whether we want to allow identifying clients via the packet DB + clif_config.enable_packet_db = battle_config_switch(w2); + // if we don't want to read the packet DB, and use hardcoded values only + if (!clif_config.enable_packet_db) + return 0; + continue; + } else if(strcmpi(w1,"prefer_packet_db")==0) { + // whether the packet DB takes higher precedence over the hardcoded one (type 1) + // and whether to overwrite predefined packet length and functions when reading + // from the DB (type 2) + clif_config.prefer_packet_db = battle_config_switch(w2); // not used for now + continue; + } } - memset(str,0,sizeof(str)); + memset(str,0,sizeof(str)); for(j=0,p=line;j<4 && p;j++){ str[j]=p; p=strchr(p,','); @@ -10888,7 +10930,9 @@ static int packetdb_readdb(void) ShowError(tmp_output); continue; } - packet_db[packet_ver][cmd].len = atoi(str[1]); + k = atoi(str[1]); + // if (packet_db[packet_ver][cmd].len != k && clif_config.prefer_packet_db) // not used for now + packet_db[packet_ver][cmd].len = k; if(str[2]==NULL){ ln++; @@ -10897,13 +10941,15 @@ static int packetdb_readdb(void) for(j=0;j 2 /* && packet_db[cmd].pos[0] == 0 */) +// if(packet_db[clif_config.packet_db_ver][cmd].len > 2 /* && packet_db[cmd].pos[0] == 0 */) // printf("packet_db ver %d: %d 0x%x %d %s %p\n",packet_ver,ln,cmd,packet_db[packet_ver][cmd].len,str[2],packet_db[packet_ver][cmd].func); } - + fclose(fp); - sprintf(tmp_output,"Done reading packet version '"CL_WHITE"%d"CL_RESET"' in '"CL_WHITE"%s"CL_RESET"'.\n", packet_db_ver, "db/packet_db.txt"); + sprintf(tmp_output,"Done reading packet version '"CL_WHITE"%d"CL_RESET"' in '"CL_WHITE"%s"CL_RESET"'.\n", clif_config.packet_db_ver, "db/packet_db.txt"); ShowStatus(tmp_output); return 0; @@ -10936,6 +10984,11 @@ static int packetdb_readdb(void) int do_init_clif(void) { int i; + clif_config.enable_packet_db = 1; // whether to use the packet DB for client connection + clif_config.packet_db_ver = -1; // the main packet version of the DB + clif_config.prefer_packet_db = 1; // whether the packet version takes precedence + clif_config.connect_cmd = 0xF5; // the default packet used for connecting to the server + memset(packet_db,0,sizeof(packet_db)); // size of packet version 5 (old) @@ -11163,6 +11216,7 @@ int do_init_clif(void) { packet_db[14][0x21a].len = 282; packet_db[14][0x21b].len = 10; packet_db[14][0x21c].len = 10; +// packet_db[14][0x143].len = 23; // is this required? uncomment if it is // Init packet function calls for packet ver 15 memcpy(packet_db[15], packet_db[14], sizeof(packet_db[0])); packet_db[15][0x072].func = clif_parse_UseSkillToId; @@ -11200,7 +11254,7 @@ int do_init_clif(void) { packet_db[15][0x116].len = 12; packet_db[15][0x190].len = 15; packet_db[15][0x193].len = 21; - packet_db[15][0x21b].len = 6; + packet_db[15][0x21d].len = 6; packet_db[15][0x222].len = 6; packet_db[15][0x221].len = -1; packet_db[15][0x223].len = 8; @@ -11241,12 +11295,14 @@ int do_init_clif(void) { packet_db[16][0x116].len = 20; packet_db[16][0x09f].len = 17; packet_db[16][0x0f7].len = 21; - // Init packet function calls for packet ver 17 (packet db) - memcpy(packet_db[17], packet_db[16], sizeof(packet_db[0])); + packet_db[16][0x143].len = 10; + // Init packet function calls for the packet_db.txt (17) + memcpy(packet_db[MAX_PACKET_VER], packet_db[MAX_PACKET_VER - 1], sizeof(packet_db[0])); #endif - packetdb_readdb(); - + if (clif_config.enable_packet_db) + packetdb_readdb(); + set_defaultparse(clif_parse); #ifdef __WIN32 if (!make_listen_port(map_port)) { diff --git a/src/map/clif.h b/src/map/clif.h index d0cd2e86e..99e0752d1 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -16,7 +16,6 @@ typedef unsigned int in_addr_t; #define MAX_PACKET_DB 0x224 #define MAX_PACKET_VER 17 -extern int packet_db_ver; struct packet_db { short len; void (*func)(); @@ -24,6 +23,13 @@ struct packet_db { }; extern struct packet_db packet_db[MAX_PACKET_VER + 1][MAX_PACKET_DB]; +extern struct Clif_Config { + int enable_packet_db; + int packet_db_ver; + int prefer_packet_db; + int connect_cmd; +} clif_config; + void clif_setip(char*); void clif_setport(int); @@ -137,8 +143,8 @@ int clif_petinsight(struct block_list *bl,va_list ap); int clif_npcoutsight(struct block_list *bl,va_list ap); int clif_npcinsight(struct block_list *bl,va_list ap); -int clif_class_change(struct block_list *bl,int class,int type); -int clif_mob_class_change(struct mob_data *md,int class); +int clif_class_change(struct block_list *bl,int class_,int type); +int clif_mob_class_change(struct mob_data *md,int class_); int clif_mob_equip(struct mob_data *md,int nameid); // [Valaris] int clif_skillinfo(struct map_session_data *sd,int skillid,int type,int range); @@ -177,7 +183,7 @@ int clif_autospell(struct map_session_data *sd,int skilllv); int clif_devotion(struct map_session_data *sd,int target); int clif_spiritball(struct map_session_data *sd); int clif_combo_delay(struct block_list *src,int wait); -int clif_bladestop(struct block_list *src,struct block_list *dst,int bool); +int clif_bladestop(struct block_list *src,struct block_list *dst,int bool_); int clif_changemapcell(int m,int x,int y,int cell_type,int type); int clif_status_change(struct block_list *bl,int type,int flag); diff --git a/src/map/guild.c b/src/map/guild.c index 5f9e31794..8099ac934 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -284,7 +284,7 @@ int guild_payexp_timer_sub(void *key,void *data,va_list ap) c->exp=0; dellist[(*delp)++]=dataid; - free(c); + aFree(c); return 0; } int guild_payexp_timer(int tid,unsigned int tick,int id,int data) @@ -476,7 +476,7 @@ int guild_recv_info(struct guild *sg) // イベントの発生 if( (ev=numdb_search(guild_infoevent_db,sg->guild_id))!=NULL ){ numdb_erase(guild_infoevent_db,sg->guild_id); - for(;ev;ev2=ev->next,free(ev),ev=ev2){ + for(;ev;ev2=ev->next,aFree(ev),ev=ev2){ npc_event_do(ev->name); } } @@ -750,7 +750,7 @@ int guild_send_memberinfoshort(struct map_session_data *sd,int online) return 0; } // ギルドメンバのオンライン状態/Lv更新通知 -int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class) +int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_) { int i,alv,c,idx=0,om=0,oldonline=-1; struct guild *g=guild_search(guild_id); @@ -762,7 +762,7 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin oldonline=m->online; m->online=online; m->lv=lv; - m->class_=class; + m->class_=class_; idx=i; } if(m->account_id>0){ @@ -938,7 +938,7 @@ int guild_payexp(struct map_session_data *sd,int exp) return 0; if( (c=numdb_search(guild_expcache_db,sd->status.char_id))==NULL ){ - c=(struct guild_expcache *)aCalloc(1,sizeof(struct guild_expcache)); + c=(struct guild_expcache *)aCallocA(1,sizeof(struct guild_expcache)); c->guild_id=sd->status.guild_id; c->account_id=sd->status.account_id; c->char_id=sd->status.char_id; @@ -960,9 +960,9 @@ int guild_getexp(struct map_session_data *sd,int exp) if(sd->status.guild_id==0 || (g=guild_search(sd->status.guild_id))==NULL ) return 0; - + if( (c=numdb_search(guild_expcache_db,sd->status.char_id))==NULL ){ - c=(struct guild_expcache *)aCalloc(1,sizeof(struct guild_expcache)); + c=(struct guild_expcache *)aCallocA(1,sizeof(struct guild_expcache)); c->guild_id=sd->status.guild_id; c->account_id=sd->status.account_id; c->char_id=sd->status.char_id; @@ -1191,7 +1191,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id const char *guild_name[2]; struct map_session_data *sd[2]; int j,i; - + guild_id[0] = guild_id1; guild_id[1] = guild_id2; guild_name[0] = name1; @@ -1300,7 +1300,7 @@ int guild_broken(int guild_id,int flag) numdb_foreach(guild_db,guild_broken_sub,guild_id); numdb_erase(guild_db,guild_id); guild_storage_delete(guild_id); - free(g); + aFree(g); return 0; } @@ -1396,7 +1396,7 @@ int guild_castledataloadack(int castle_id,int index,int value) } if( (ev=numdb_search(guild_castleinfoevent_db,code))!=NULL ){ numdb_erase(guild_castleinfoevent_db,code); - for(;ev;ev2=ev->next,free(ev),ev=ev2){ + for(;ev;ev2=ev->next,aFree(ev),ev=ev2){ npc_event_do(ev->name); } } @@ -1500,7 +1500,7 @@ int guild_agit_end(void) int guild_gvg_eliminate_timer(int tid,unsigned int tick,int id,int data) { // Run One NPC_Event[OnAgitEliminate] size_t len = strlen((const char*)data); - char *evname=(char*)aCalloc(len + 4,sizeof(char)); + char *evname=(char*)aCallocA(len + 4,sizeof(char)); int c=0; if(!agit_flag) return 0; // Agit already End @@ -1517,7 +1517,7 @@ int guild_agit_break(struct mob_data *md) nullpo_retr(0, md); - evname=(char *)aCalloc(strlen(md->npc_event) + 1, sizeof(char)); + evname=(char *)aCallocA(strlen(md->npc_event) + 1, sizeof(char)); strcpy(evname,md->npc_event); // Now By User to Run [OnAgitBreak] NPC Event... @@ -1539,7 +1539,7 @@ int guild_checkcastles(struct guild *g) { for(i=0;iguild_id; - if(g->guild_id==cas_id) + if(g->guild_id==cas_id) nb_cas=nb_cas+1; } //end for return nb_cas; @@ -1570,12 +1570,12 @@ int guild_isallied(struct guild *g, struct guild_castle *gc) return 0; } - + static int guild_db_final(void *key,void *data,va_list ap) { struct guild *g=data; - free(g); + aFree(g); return 0; } @@ -1583,7 +1583,7 @@ static int castle_db_final(void *key,void *data,va_list ap) { struct guild_castle *gc=data; - free(gc); + aFree(gc); return 0; } @@ -1591,7 +1591,7 @@ static int guild_expcache_db_final(void *key,void *data,va_list ap) { struct guild_expcache *c=data; - free(c); + aFree(c); return 0; } @@ -1599,7 +1599,7 @@ static int guild_infoevent_db_final(void *key,void *data,va_list ap) { struct eventlist *ev=data; - free(ev); + aFree(ev); return 0; } diff --git a/src/map/guild.h b/src/map/guild.h index eefdcb04e..8f5243a8c 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -56,7 +56,7 @@ int guild_delalliance(struct map_session_data *sd,int guild_id,int flag); int guild_opposition(struct map_session_data *sd,int char_id); int guild_send_memberinfoshort(struct map_session_data *sd,int online); -int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class); +int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_); int guild_change_memberposition(int guild_id,int account_id,int char_id,int idx); int guild_memberposition_changed(struct guild *g,int idx,int pos); int guild_change_position(struct map_session_data *sd,int idx, diff --git a/src/map/intif.c b/src/map/intif.c index 9ba9b1ebb..3f1bbfe88 100644 --- a/src/map/intif.c +++ b/src/map/intif.c @@ -457,7 +457,7 @@ int intif_guild_leave(int guild_id,int account_id,int char_id,int flag,const cha } // ギルドメンバのオンライン状況/Lv更新要求 int intif_guild_memberinfoshort(int guild_id, - int account_id,int char_id,int online,int lv,int class) + int account_id,int char_id,int online,int lv,int class_) { if (CheckForCharServer()) return 0; @@ -467,7 +467,7 @@ int intif_guild_memberinfoshort(int guild_id, WFIFOL(inter_fd,10) = char_id; WFIFOB(inter_fd,14) = online; WFIFOW(inter_fd,15) = lv; - WFIFOW(inter_fd,17) = class; + WFIFOW(inter_fd,17) = class_; WFIFOSET(inter_fd,19); return 0; } @@ -640,7 +640,7 @@ int intif_parse_WisMessage(int fd) { // rewritten by [Yor] // if(battle_config.etc_log) // printf("intif_parse_wismessage: %d %s %s %s\n",id,RFIFOP(fd,6),RFIFOP(fd,30),RFIFOP(fd,54) ); - + sd=map_nick2sd(RFIFOP(fd,32)); // 送信先を探す if(sd!=NULL && strcmp(sd->status.name, RFIFOP(fd,32)) == 0){ /* @@ -698,7 +698,7 @@ int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 .w .24B struct map_session_data *pl_sd; char Wisp_name[24]; char mbuf[255]; - char *message = ((RFIFOW(fd,2) - 30) >= sizeof(mbuf)) ? (char *) aMalloc((RFIFOW(fd,2) - 30)) : mbuf; + char *message = ((RFIFOW(fd,2) - 30) >= sizeof(mbuf)) ? (char *) aMallocA((RFIFOW(fd,2) - 30)) : mbuf; min_gm_level = (int)RFIFOW(fd,28); memcpy(Wisp_name, RFIFOP(fd,4), 24); @@ -712,7 +712,7 @@ int mapif_parse_WisToGM(int fd) { // 0x3003/0x3803 .w .24B clif_wis_message(i, Wisp_name, message, strlen(message) + 1); if (message != mbuf) - free(message); + aFree(message); return 0; } diff --git a/src/map/intif.h b/src/map/intif.h index 5077dbe18..761c1ea63 100644 --- a/src/map/intif.h +++ b/src/map/intif.h @@ -33,7 +33,7 @@ int intif_guild_create(const char *name, const struct guild_member *master); int intif_guild_request_info(int guild_id); int intif_guild_addmember(int guild_id, struct guild_member *m); int intif_guild_leave(int guild_id, int account_id, int char_id, int flag, const char *mes); -int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class); +int intif_guild_memberinfoshort(int guild_id, int account_id, int char_id, int online, int lv, int class_); int intif_guild_break(int guild_id); int intif_guild_message(int guild_id, int account_id, char *mes, int len); int intif_guild_checkconflict(int guild_id, int account_id, int char_id); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index e6a997976..dd8de15d4 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -530,7 +530,7 @@ static int itemdb_read_itemnametable(void) if(!p) break; p++; } - free(buf); + aFree(buf); sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\idnum2itemdisplaynametable.txt"); ShowStatus(tmp_output); @@ -566,7 +566,7 @@ static int itemdb_read_cardillustnametable(void) if(!p) break; p++; } - free(buf); + aFree(buf); sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\num2cardillustnametable.txt"); ShowStatus(tmp_output); @@ -604,7 +604,7 @@ static int itemdb_read_itemslottable(void) if(!p) break; p++; } - free(buf); + aFree(buf); sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\itemslottable.txt"); ShowStatus(tmp_output); @@ -636,7 +636,7 @@ static int itemdb_read_itemslotcounttable(void) if(!p) break; p++; } - free(buf); + aFree(buf); sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\itemslotcounttable.txt"); ShowStatus(tmp_output); @@ -896,10 +896,10 @@ static int itemdb_final(void *key,void *data,va_list ap) nullpo_retr(0, id=data); if(id->use_script) - free(id->use_script); + aFree(id->use_script); if(id->equip_script) - free(id->equip_script); - free(id); + aFree(id->equip_script); + aFree(id); return 0; } diff --git a/src/map/mail.c b/src/map/mail.c index 5d63b6f80..74d2bf7c0 100644 --- a/src/map/mail.c +++ b/src/map/mail.c @@ -30,12 +30,12 @@ extern char msg_table[1000][256]; // Server messages (0-499 reserved for GM comm int mail_check(struct map_session_data *sd,int type) { - int i=0,new=0,priority=0; + int i=0,new_=0,priority=0; char message[50]; if(sd==NULL) return 0; - + sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`from_char_name`,`read_flag`,`priority`,`check_flag` FROM `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id`", mail_db, sd->status.account_id); if (mysql_query(&mail_handle, tmp_msql)) { @@ -64,7 +64,7 @@ int mail_check(struct map_session_data *sd,int type) } if(!atoi(mail_row[3])) { - new++; + new_++; if(atoi(mail_row[4])) priority++; if(type==2 || type==3) { @@ -88,28 +88,28 @@ int mail_check(struct map_session_data *sd,int type) sprintf(message, msg_table[513], i, mail_row[2]); clif_displaymessage(sd->fd, jstrescape(message)); } - + } - + mysql_free_result(mail_res); - + } else { printf("MySQL error (storing query result for %s): %s\n", mail_db, mysql_error(&mail_handle)); return 0; } - if(i>0 && new>0 && type==1) { - //sprintf(message, "You have %d new messages.", new); - sprintf(message, msg_table[514], new); + if(i>0 && new_>0 && type==1) { + //sprintf(message, "You have %d new messages.", new_); + sprintf(message, msg_table[514], new_); clif_displaymessage(sd->fd, jstrescape(message)); } - if(i>0 && new>0 && priority>0 && type==1) { + if(i>0 && new_>0 && priority>0 && type==1) { //sprintf(message, "You have %d unread priority messages.", priority); sprintf(message, msg_table[515], priority); clif_displaymessage(sd->fd, jstrescape(message)); } - if(!new) { + if(!new_) { //clif_displaymessage(sd->fd, "You have no new messages."); clif_displaymessage(sd->fd, msg_table[516]); } @@ -124,7 +124,7 @@ int mail_read(struct map_session_data *sd, int message_id) if(sd==NULL) return 0; - + sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`from_char_name`,`message`,`read_flag`,`priority`,`check_flag` from `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id` LIMIT %d, 1",mail_db,sd->status.account_id,message_id-1); if (mysql_query(&mail_handle, tmp_msql)) { @@ -162,9 +162,9 @@ int mail_read(struct map_session_data *sd, int message_id) printf("DB server Error (update Read `%s`)- %s\n", mail_db, mysql_error(&mail_handle) ); } } - + mysql_free_result(mail_res); - + } else { printf("MySQL error (storing query result for %s): %s\n", mail_db, mysql_error(&mail_handle)); return 0; @@ -177,7 +177,7 @@ int mail_delete(struct map_session_data *sd, int message_id) { if(sd==NULL) return 0; - + sprintf(tmp_msql,"SELECT `message_id`,`to_account_id`,`read_flag`,`priority`,`check_flag` from `%s` WHERE `to_account_id` = \"%d\" ORDER by `message_id` LIMIT %d, 1",mail_db,sd->status.account_id,message_id-1); if (mysql_query(&mail_handle, tmp_msql)) { @@ -217,9 +217,9 @@ int mail_delete(struct map_session_data *sd, int message_id) //else clif_displaymessage(sd->fd,"Message deleted."); else clif_displaymessage(sd->fd,msg_table[521]); } - + mysql_free_result(mail_res); - + } else { printf("MySQL error (delete query result for %s): %s\n", mail_db, mysql_error(&mail_handle)); return 0; @@ -232,7 +232,7 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag) { if(sd==NULL) return 0; - + if(pc_isGM(sd) < 80 && sd->mail_counter > 0) { //clif_displaymessage(sd->fd,"You must wait 10 minutes before sending another message"); clif_displaymessage(sd->fd,msg_table[522]); @@ -254,8 +254,8 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag) if (mysql_query(&mail_handle, tmp_msql)) { printf("Database server error (executing query for %s): %s\n", char_db, mysql_error(&mail_handle)); return 0; - } - + } + mail_res = mysql_store_result(&mail_handle); if(mail_res) { if (mysql_num_rows(mail_res) == 0) { @@ -268,7 +268,7 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag) while ((mail_row = mysql_fetch_row(mail_res))) { if(strcmp(name,"*")==0) { sprintf(tmp_msql, "INSERT DELAYED INTO `%s` (`to_account_id`,`from_account_id`,`from_char_name`,`message`,`priority`)" - " VALUES ('%d', '%d', '%s', '%s', '%d')",mail_db, atoi(mail_row[0]), sd->status.account_id, sd->status.name, jstrescape(message), flag); + " VALUES ('%d', '%d', '%s', '%s', '%d')",mail_db, atoi(mail_row[0]), sd->status.account_id, sd->status.name, jstrescape(message), flag); } else { sprintf(tmp_msql, "INSERT DELAYED INTO `%s` (`to_account_id`,`to_char_name`,`from_account_id`,`from_char_name`,`message`,`priority`)" @@ -276,7 +276,7 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag) if(pc_isGM(sd) < 80) sd->mail_counter=5; } - + if(mysql_query(&mail_handle, tmp_msql) ) { mysql_free_result(mail_res); printf("DB server Error (insert `mail_db`)- %s\n", mysql_error(&mail_handle) ); @@ -295,18 +295,18 @@ int mail_send(struct map_session_data *sd, char *name, char *message, int flag) int mail_check_timer(int tid,unsigned int tick,int id,int data) { struct map_session_data *sd = NULL; - int i; + int i; if(mail_timer != tid) return 0; sprintf(tmp_msql,"SELECT DISTINCT `to_account_id` FROM `%s` WHERE `read_flag` = '0' AND `check_flag` = '0'", mail_db); - + if (mysql_query(&mail_handle, tmp_msql)) { printf("Database server error (executing query for %s): %s\n", char_db, mysql_error(&mail_handle)); mail_timer=add_timer(gettick()+MAIL_CHECK_TIME,mail_check_timer,0,0); return 0; - } + } mail_res = mysql_store_result(&mail_handle); @@ -324,8 +324,8 @@ int mail_check_timer(int tid,unsigned int tick,int id,int data) if(pc_isGM(sd) < 80 && sd->mail_counter > 0) sd->mail_counter--; if(sd->status.account_id==atoi(mail_row[0])) - //clif_displaymessage(sd->fd, "You have new mail."); - clif_displaymessage(sd->fd, msg_table[526]); + //clif_displaymessage(sd->fd, "You have new mail."); + clif_displaymessage(sd->fd, msg_table[526]); } } } @@ -341,7 +341,7 @@ int mail_check_timer(int tid,unsigned int tick,int id,int data) } int do_init_mail(void) -{ +{ add_timer_func_list(mail_check_timer,"mail_check_timer"); mail_timer=add_timer(gettick()+MAIL_CHECK_TIME,mail_check_timer,0,0); return 0; diff --git a/src/map/map.c b/src/map/map.c index a591c97a2..55d571767 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -193,7 +193,7 @@ int map_getusers(void) { int map_freeblock( void *bl ) { if(block_free_lock==0){ - free(bl); + aFree(bl); bl = NULL; } else{ @@ -229,7 +229,7 @@ int map_freeblock_unlock(void) { // printf("map_freeblock_unlock: free %d object\n",block_free_count); // } for(i=0;ibl.id = map_addobject(&fitem->bl); if(fitem->bl.id==0){ - free(fitem); + aFree(fitem); return 0; } @@ -894,9 +894,9 @@ void map_addchariddb(int charid, char *name) { struct charid2nick *p=NULL; int req=0; - p=numdb_search(charid_db,charid); + p = (struct charid2nick*)numdb_search(charid_db,charid); if(p==NULL){ // デ?タベ?スにない - p = (struct charid2nick *)aCalloc(1,sizeof(struct charid2nick)); + p = (struct charid2nick *)aCallocA(1,sizeof(struct charid2nick)); p->req_id=0; }else numdb_erase(charid_db,charid); @@ -921,7 +921,7 @@ int map_reqchariddb(struct map_session_data * sd,int charid) { nullpo_retr(0, sd); - p=numdb_search(charid_db,charid); + p = (struct charid2nick*)numdb_search(charid_db,charid); if(p!=NULL) // デ?タベ?スにすでにある return 0; p = (struct charid2nick *)aCalloc(1,sizeof(struct charid2nick)); @@ -1005,7 +1005,7 @@ int map_quit(struct map_session_data *sd) { // check if we've been authenticated [celest] if (sd->state.auth) skill_castcancel(&sd->bl,0); // 詠唱を中?する - + skill_stop_dancing(&sd->bl,1);// ダンス/演奏中? if(sd->sc_data && sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中の終了はHPを100に @@ -1052,7 +1052,7 @@ int map_quit(struct map_session_data *sd) { storage_storage_save(sd); if( sd->npc_stackbuf && sd->npc_stackbuf != NULL) { - free( sd->npc_stackbuf ); + aFree( sd->npc_stackbuf ); sd->npc_stackbuf = NULL; } @@ -1092,7 +1092,7 @@ struct map_session_data * map_id2sd(int id) { struct map_session_data *sd=NULL; for(i = 0; i < fd_max; i++) - if (session[i] && (sd = session[i]->session_data) && sd->bl.id == id) + if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) && sd->bl.id == id) return sd; return NULL; @@ -1103,7 +1103,7 @@ struct map_session_data * map_id2sd(int id) { *------------------------------------------ */ char * map_charid2nick(int id) { - struct charid2nick *p=numdb_search(charid_db,id); + struct charid2nick *p = (struct charid2nick*)numdb_search(charid_db,id); if(p==NULL) return NULL; @@ -1130,7 +1130,7 @@ struct map_session_data * map_nick2sd(char *nick) { nicklen = strlen(nick); for (i = 0; i < fd_max; i++) { - if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth) + if (session[i] && (pl_sd = (struct map_session_data*)session[i]->session_data) && pl_sd->state.auth) // Without case sensitive check (increase the number of similar character names found) if (strnicmp(pl_sd->status.name, nick, nicklen) == 0) { // Strict comparison (if found, we finish the function immediatly with correct value) @@ -1160,7 +1160,7 @@ struct block_list * map_id2bl(int id) if(idbl); numdb_erase(id_db,map[m].npc[i]->bl.id); if(map[m].npc[i]->bl.subtype==SCRIPT) { -// free(map[m].npc[i]->u.scr.script); -// free(map[m].npc[i]->u.scr.label_list); +// aFree(map[m].npc[i]->u.scr.script); +// aFree(map[m].npc[i]->u.scr.label_list); } - free(map[m].npc[i]); + aFree(map[m].npc[i]); map[m].npc[i] = NULL; n++; } @@ -1238,7 +1238,7 @@ void map_removenpc(void) { int map_mapname2mapid(char *name) { struct map_data *md=NULL; - md=strdb_search(map_db,name); + md = (struct map_data*)strdb_search(map_db,name); #ifdef USE_AFM // If we can't find the .gat map try .afm instead [celest] @@ -1246,7 +1246,7 @@ int map_mapname2mapid(char *name) { char afm_name[16] = ""; strncpy(afm_name, name, strlen(name) - 4); strcat(afm_name, ".afm"); - md = strdb_search(map_db,afm_name); + md = (struct map_data*)strdb_search(map_db,afm_name); } #endif @@ -1262,7 +1262,7 @@ int map_mapname2mapid(char *name) { int map_mapname2ipport(char *name,int *ip,int *port) { struct map_data_other_server *mdos=NULL; - mdos=strdb_search(map_db,name); + mdos = (struct map_data_other_server*)strdb_search(map_db,name); if(mdos==NULL || mdos->gat) return -1; *ip=mdos->ip; @@ -1385,7 +1385,7 @@ int map_getcellp(struct map_data* m,int x,int y,CELL_CHK cellchk) case CELL_CHKTYPE: return m->gat[j]; default: return 0; - } + } return 0; } @@ -1396,7 +1396,7 @@ int map_getcellp(struct map_data* m,int x,int y,CELL_CHK cellchk) int map_setcell(int m,int x,int y,CELL_SET cellset) { int i,j; - + if(x<0 || x>=map[m].xs || y<0 || y>=map[m].ys) return 0; j=x+y*map[m].xs; @@ -1431,7 +1431,7 @@ int map_setipport(char *name,unsigned long ip,int port) { struct map_data *md=NULL; struct map_data_other_server *mdos=NULL; - md=strdb_search(map_db,name); + md = (struct map_data*)strdb_search(map_db,name); if(md==NULL){ // not exist -> add new data mdos=(struct map_data_other_server *)aCalloc(1,sizeof(struct map_data_other_server)); memcpy(mdos->name,name,24); @@ -1459,7 +1459,7 @@ int map_setipport(char *name,unsigned long ip,int port) { * 水場高さ設定 *------------------------------------------ */ -static struct { +static struct waterlist_ { char mapname[24]; int waterheight; } *waterlist=NULL; @@ -1487,7 +1487,7 @@ static void map_readwater(char *watertxt) { return; } if(waterlist==NULL) - waterlist=aCalloc(MAX_MAP_PER_SERVER,sizeof(*waterlist)); + waterlist = (struct waterlist_*)aCallocA(MAX_MAP_PER_SERVER,sizeof(*waterlist)); while(fgets(line,1020,fp) && n < MAX_MAP_PER_SERVER){ int wh,count; if(line[0] == '/' && line[1] == '/') @@ -1554,7 +1554,7 @@ static int map_cache_open(char *fn) { map_cache.head.filesize == ftell(map_cache.fp) ) { // キャッシュ読み込み成功 - map_cache.map = aMalloc(sizeof(struct MAP_CACHE_INFO) * map_cache.head.nmaps); + map_cache.map = (struct MAP_CACHE_INFO*)aMallocA(sizeof(struct MAP_CACHE_INFO) * map_cache.head.nmaps); fseek(map_cache.fp,sizeof(struct MAP_CACHE_HEAD),SEEK_SET); fread(map_cache.map,sizeof(struct MAP_CACHE_INFO),map_cache.head.nmaps,map_cache.fp); return 1; @@ -1567,7 +1567,7 @@ static int map_cache_open(char *fn) { map_cache.fp = fopen(fn,"wb"); if(map_cache.fp) { memset(&map_cache.head,0,sizeof(struct MAP_CACHE_HEAD)); - map_cache.map = aCalloc(sizeof(struct MAP_CACHE_INFO),MAX_CAHCE_MAX); + map_cache.map = (struct MAP_CACHE_INFO*)aCallocA(sizeof(struct MAP_CACHE_INFO),MAX_CAHCE_MAX); map_cache.head.nmaps = MAX_CAHCE_MAX; map_cache.head.sizeof_header = sizeof(struct MAP_CACHE_HEAD); map_cache.head.sizeof_map = sizeof(struct MAP_CACHE_INFO); @@ -1589,7 +1589,7 @@ static void map_cache_close(void) { fwrite(map_cache.map,map_cache.head.nmaps,sizeof(struct MAP_CACHE_INFO),map_cache.fp); } fclose(map_cache.fp); - free(map_cache.map); + aFree(map_cache.map); map_cache.fp = NULL; return; } @@ -1607,14 +1607,14 @@ int map_cache_read(struct map_data *m) { int size = map_cache.map[i].xs * map_cache.map[i].ys; m->xs = map_cache.map[i].xs; m->ys = map_cache.map[i].ys; - m->gat = (unsigned char *)aCalloc(m->xs * m->ys,sizeof(unsigned char)); + m->gat = (unsigned char *)aCallocA(m->xs * m->ys,sizeof(unsigned char)); fseek(map_cache.fp,map_cache.map[i].pos,SEEK_SET); if(fread(m->gat,1,size,map_cache.fp) == size) { // 成功 return 1; } else { // なぜかファイル後半が欠けてるので読み直し - m->xs = 0; m->ys = 0; m->gat = NULL; free(m->gat); + m->xs = 0; m->ys = 0; m->gat = NULL; aFree(m->gat); return 0; } } else if(map_cache.map[i].compressed == 1) { @@ -1624,14 +1624,14 @@ int map_cache_read(struct map_data *m) { int size_compress = map_cache.map[i].compressed_len; m->xs = map_cache.map[i].xs; m->ys = map_cache.map[i].ys; - m->gat = (unsigned char *)aMalloc(m->xs * m->ys * sizeof(unsigned char)); - buf = (unsigned char*)aMalloc(size_compress); + m->gat = (unsigned char *)aMallocA(m->xs * m->ys * sizeof(unsigned char)); + buf = (unsigned char*)aMallocA(size_compress); fseek(map_cache.fp,map_cache.map[i].pos,SEEK_SET); if(fread(buf,1,size_compress,map_cache.fp) != size_compress) { // なぜかファイル後半が欠けてるので読み直し printf("fread error\n"); m->xs = 0; m->ys = 0; m->gat = NULL; - free(m->gat); free(buf); + aFree(m->gat); aFree(buf); return 0; } dest_len = m->xs * m->ys; @@ -1639,10 +1639,10 @@ int map_cache_read(struct map_data *m) { if(dest_len != map_cache.map[i].xs * map_cache.map[i].ys) { // 正常に解凍が出来てない m->xs = 0; m->ys = 0; m->gat = NULL; - free(m->gat); free(buf); + aFree(m->gat); aFree(buf); return 0; } - free(buf); + aFree(buf); return 1; } } @@ -1669,7 +1669,7 @@ static int map_cache_write(struct map_data *m) { if(map_read_flag >= READ_FROM_BITMAP_COMPRESSED) { // 圧縮保存 // さすがに2倍に膨れる事はないという事で - write_buf = aMalloc(m->xs * m->ys * 2); + write_buf = (char*)aMallocA(m->xs * m->ys * 2); len_new = m->xs * m->ys * 2; encode_zip(write_buf,&len_new,m->gat,m->xs * m->ys); map_cache.map[i].compressed = 1; @@ -1678,7 +1678,7 @@ static int map_cache_write(struct map_data *m) { len_new = m->xs * m->ys; write_buf = m->gat; map_cache.map[i].compressed = 0; - map_cache.map[i].compressed_len = 0; + map_cache.map[i].compressed_len = 0; } if(len_new <= len_old) { // サイズが同じか小さくなったので場所は変わらない @@ -1696,7 +1696,7 @@ static int map_cache_write(struct map_data *m) { map_cache.map[i].water_height = map_waterheight(m->name); map_cache.dirty = 1; if(map_read_flag >= READ_FROM_BITMAP_COMPRESSED) { - free(write_buf); + aFree(write_buf); } return 0; } @@ -1706,7 +1706,7 @@ static int map_cache_write(struct map_data *m) { if(map_cache.map[i].fn[0] == 0) { // 新しい場所に登録 if(map_read_flag >= READ_FROM_BITMAP_COMPRESSED) { - write_buf = aMalloc(m->xs * m->ys * 2); + write_buf = (char*)aMallocA(m->xs * m->ys * 2); len_new = m->xs * m->ys * 2; encode_zip(write_buf,&len_new,m->gat,m->xs * m->ys); map_cache.map[i].compressed = 1; @@ -1727,7 +1727,7 @@ static int map_cache_write(struct map_data *m) { map_cache.head.filesize += len_new; map_cache.dirty = 1; if(map_read_flag >= READ_FROM_BITMAP_COMPRESSED) { - free(write_buf); + aFree(write_buf); } return 0; } @@ -1819,7 +1819,8 @@ static int map_readafm(int m,char *fn) { map[m].m = m; xs = map[m].xs = afm_size[0]; ys = map[m].ys = afm_size[1]; - map[m].gat = aCalloc(s = map[m].xs * map[m].ys, 1); + // check this, unsigned where it might not need to be + map[m].gat = (unsigned char*)aCallocA(s = map[m].xs * map[m].ys, 1); if(map[m].gat==NULL){ printf("out of memory : map_readmap gat\n"); @@ -1842,14 +1843,14 @@ static int map_readafm(int m,char *fn) { map[m].bxs=(xs+BLOCK_SIZE-1)/BLOCK_SIZE; map[m].bys=(ys+BLOCK_SIZE-1)/BLOCK_SIZE; size = map[m].bxs * map[m].bys * sizeof(struct block_list*); - map[m].block = aCalloc(size, 1); + map[m].block = (struct block_list**)aCalloc(size, 1); if(map[m].block == NULL){ printf("out of memory : map_readmap block\n"); exit(1); } - map[m].block_mob = aCalloc(size, 1); + map[m].block_mob = (struct block_list**)aCalloc(size, 1); if (map[m].block_mob == NULL) { printf("out of memory : map_readmap block_mob\n"); exit(1); @@ -1857,14 +1858,14 @@ static int map_readafm(int m,char *fn) { size = map[m].bxs*map[m].bys*sizeof(int); - map[m].block_count = aCalloc(size, 1); + map[m].block_count = (int*)aCallocA(size, 1); if(map[m].block_count==NULL){ printf("out of memory : map_readmap block\n"); exit(1); } memset(map[m].block_count,0,size); - map[m].block_mob_count=aCalloc(size, 1); + map[m].block_mob_count = (int*)aCallocA(size, 1); if(map[m].block_mob_count==NULL){ printf("out of memory : map_readmap block_mob\n"); exit(1); @@ -1885,9 +1886,9 @@ static int map_readafm(int m,char *fn) { * マップ1枚読み込み * ===================================================*/ static int map_readmap(int m,char *fn, char *alias, int *map_cache, int maxmap) { - unsigned char *gat=""; + char *gat=""; size_t size; - + int i = 0; int e = 0; char progress[21] = " "; @@ -1925,19 +1926,20 @@ static int map_readmap(int m,char *fn, char *alias, int *map_cache, int maxmap) int s; int wh; int x,y,xs,ys; - struct gat_1cell {float high[4]; int type;} *p=NULL; + struct gat_1cell {float high[4]; int type;} *p=NULL; // read & convert fn - gat=grfio_read(fn); + // again, might not need to be unsigned char + gat = grfio_read(fn); if(gat==NULL) { return -1; // さすがにマップが読めないのはまずいので終了する //printf("Can't load map %s\n",fn); //exit(1); } - + xs=map[m].xs=*(int*)(gat+6); ys=map[m].ys=*(int*)(gat+10); - map[m].gat = (unsigned char *)aCalloc(s = map[m].xs * map[m].ys,sizeof(unsigned char)); + map[m].gat = (char *)aCallocA(s = map[m].xs * map[m].ys,sizeof(char)); wh=map_waterheight(map[m].name); for(y=0;y= READ_FROM_BITMAP) { map_cache_open(map_bitmap_filename); @@ -2032,7 +2034,7 @@ int map_readallmap(void) { char buf[64]; *p++ = '\0'; sprintf(buf,"data\\%s", p); - map[i].alias = strdup(buf); + map[i].alias = aStrdup(buf); } else map[i].alias = NULL; @@ -2041,20 +2043,20 @@ int map_readallmap(void) { map_delmap(map[i].name); maps_removed++; i--; - } + } } } - free(waterlist); + aFree(waterlist); printf("\r"); snprintf(tmp_output,sizeof(tmp_output),"Successfully loaded '"CL_WHITE"%d"CL_RESET"' maps.%30s\n",map_num,""); ShowInfo(tmp_output); - + map_cache_close(); if(map_read_flag == CREATE_BITMAP || map_read_flag == CREATE_BITMAP_COMPRESSED) { --map_read_flag; } - + if (maps_removed) { snprintf(tmp_output,sizeof(tmp_output),"Maps Removed: '"CL_WHITE"%d"CL_RESET"'\n",maps_removed); ShowNotice(tmp_output); @@ -2119,15 +2121,15 @@ int parse_console(char *buf) { int m, n; struct map_session_data *sd; - sd = aCalloc(sizeof(*sd), 1); + sd = (struct map_session_data*)aCalloc(sizeof(*sd), 1); sd->fd = 0; strcpy( sd->status.name , "console"); - type = (char *)aMalloc(64); - command = (char *)aMalloc(64); - map = (char *)aMalloc(64); - buf2 = (char *)aMalloc(72); + type = (char *)aMallocA(64); + command = (char *)aMallocA(64); + map = (char *)aMallocA(64); + buf2 = (char *)aMallocA(72); memset(type,0,64); memset(command,0,64); @@ -2184,12 +2186,12 @@ int parse_console(char *buf) { } end: - free(buf); - free(type); - free(command); - free(map); - free(buf2); - free(sd); + aFree(buf); + aFree(type); + aFree(command); + aFree(map); + aFree(buf2); + aFree(sd); return 0; } @@ -2317,7 +2319,7 @@ int inter_config_read(char *cfgName) if(i!=2) continue; if(strcmpi(w1,"stall_time")==0){ - stall_time_ = atoi(w2); + stall_time_ = atoi(w2); #ifndef TXT_ONLY } else if(strcmpi(w1,"item_db_db")==0){ strcpy(item_db_db,w2); @@ -2484,7 +2486,7 @@ void char_online_check(void) chrif_char_reset_offline(); for(i=0;isession_data) && sd && sd->state.auth && + if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) && sd && sd->state.auth && !(battle_config.hide_GM_session && pc_isGM(sd))) if(sd->status.char_id) { chrif_char_online(sd); @@ -2523,21 +2525,22 @@ int flush_timer(int tid, unsigned int tick, int id, int data){ int id_db_final(void *k,void *d,va_list ap) { struct mob_data *id; - nullpo_retr(0, id=d); + nullpo_retr(0, id = (struct mob_data*)d); if(id->lootitem) - free(id->lootitem); + aFree(id->lootitem); if(id) - free(id); + aFree(id); return 0; } + int map_db_final(void *k,void *d,va_list ap) { struct map_data *id; - nullpo_retr(0, id=d); + nullpo_retr(0, id = (struct map_data*)d); if(id->gat) - free(id->gat); + aFree(id->gat); if(id) - free(id); + aFree(id); return 0; } int nick_db_final(void *k,void *d,va_list ap){ return 0; } @@ -2607,14 +2610,14 @@ void do_final(void) { do_final_guild(); /* for(i=0;i= (sizeof(mob_db) / sizeof(mob_db[0])) || mob_db[id].name[0] == '\0') return 0; @@ -85,28 +85,28 @@ int mobdb_checkid(const int id) * The minimum data set for MOB spawning *------------------------------------------ */ -int mob_spawn_dataset(struct mob_data *md,const char *mobname,int class) +int mob_spawn_dataset(struct mob_data *md,const char *mobname,int class_) { nullpo_retr(0, md); md->bl.prev=NULL; md->bl.next=NULL; if(strcmp(mobname,"--en--")==0) - memcpy(md->name,mob_db[class].name,24); + memcpy(md->name,mob_db[class_].name,24); else if(strcmp(mobname,"--ja--")==0) - memcpy(md->name,mob_db[class].jname,24); + memcpy(md->name,mob_db[class_].jname,24); else memcpy(md->name,mobname,24); md->n = 0; - md->base_class = md->class_ = class; + md->base_class = md->class_ = class_; md->bl.id= npc_get_new_npc_id(); memset(&md->state,0,sizeof(md->state)); md->timer = -1; md->target_id=0; md->attacked_id=0; - md->speed=mob_db[class].speed; + md->speed=mob_db[class_].speed; return 0; } @@ -117,10 +117,10 @@ int mob_spawn_dataset(struct mob_data *md,const char *mobname,int class) *------------------------------------------ */ int mob_once_spawn(struct map_session_data *sd,char *mapname, - int x,int y,const char *mobname,int class,int amount,const char *event) + int x,int y,const char *mobname,int class_,int amount,const char *event) { struct mob_data *md=NULL; - int m,count,lv=255,r=class; + int m,count,lv=255,r=class_; if( sd ) lv=sd->status.base_level; @@ -130,27 +130,27 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, else m=map_mapname2mapid(mapname); - if(m<0 || amount<=0 || (class>=0 && class<=1000) || class>6000) // 値が異常なら召喚を止める + if(m<0 || amount<=0 || (class_>=0 && class_<=1000) || class_>MAX_MOB_DB) // 値が異常なら召喚を止める return 0; - if(class<0){ // ランダムに召喚 + if(class_<0){ // ランダムに召喚 int i=0; - int j=-class-1; + int j=-class_-1; int k; if(j>=0 && j=2000){ - class=mob_db[0].summonper[j]; + class_=mob_db[0].summonper[j]; } }else{ return 0; } // if(battle_config.etc_log) -// printf("mobclass=%d try=%d\n",class,i); +// printf("mobclass=%d try=%d\n",class_,i); } if(sd){ if(x<=0) x=sd->bl.x; @@ -163,21 +163,21 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, md=(struct mob_data *)aCalloc(1,sizeof(struct mob_data)); memset(md, '\0', sizeof *md); - if(class>4000) { // large/tiny mobs [Valaris] + if(class_>4000) { // large/tiny mobs [Valaris] md->size=2; - class-=4000; + class_-=4000; } - else if(class>MAX_MOB_DB) { + else if(class_>MAX_MOB_DB) { md->size=1; - class-=MAX_MOB_DB; + class_-=MAX_MOB_DB; } - if(mob_db[class].mode&0x02) + if(mob_db[class_].mode&0x02) md->lootitem=(struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); else md->lootitem=NULL; - mob_spawn_dataset(md,mobname,class); + mob_spawn_dataset(md,mobname,class_); md->bl.m=m; md->bl.x=x; md->bl.y=y; @@ -195,15 +195,15 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, md->bl.type=BL_MOB; map_addiddb(&md->bl); mob_spawn(md->bl.id); - - if(class==1288) { // emperium hp based on defense level [Valaris] + + if(class_==1288) { // emperium hp based on defense level [Valaris] struct guild_castle *gc=guild_mapname2gc(map[md->bl.m].name); if(gc) { - mob_db[class].max_hp+=2000*gc->defense; - md->hp=mob_db[class].max_hp; + mob_db[class_].max_hp+=2000*gc->defense; + md->hp=mob_db[class_].max_hp; } } // end addition [Valaris] - + } return (amount>0)?md->bl.id:0; @@ -214,7 +214,7 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, */ int mob_once_spawn_area(struct map_session_data *sd,char *mapname, int x0,int y0,int x1,int y1, - const char *mobname,int class,int amount,const char *event) + const char *mobname,int class_,int amount,const char *event) { int x,y,i,max,lx=-1,ly=-1,id=0; int m; @@ -227,7 +227,7 @@ int mob_once_spawn_area(struct map_session_data *sd,char *mapname, max=(y1-y0+1)*(x1-x0+1)*3; if(max>1000)max=1000; - if(m<0 || amount<=0 || (class>=0 && class<=1000) || class>6000) // A summon is stopped if a value is unusual + if(m<0 || amount<=0 || (class_>=0 && class_<=1000) || class_>MAX_MOB_DB) // A summon is stopped if a value is unusual return 0; for(i=0;i=0 && class<=1000) || class>MAX_MOB_DB) // Invalid monster classes + if(m<0 || amount<=0 || (class_>=0 && class_<=1000) || class_>MAX_MOB_DB) // Invalid monster classes return 0; - if(class<0) + if(class_<0) return 0; - + if(sd){ if(x<=0) x=sd->bl.x; if(y<=0) y=sd->bl.y; } - + else if(x<=0 || y<=0) printf("mob_spawn_guardian: ??\n"); - + for(count=0;countbl.m=m; md->bl.x=x; md->bl.y=y; @@ -315,7 +315,7 @@ int mob_spawn_guardian(struct map_session_data *sd,char *mapname, gc=guild_mapname2gc(map[md->bl.m].name); if(gc) { - mob_db[class].max_hp+=2000*gc->defense; + mob_db[class_].max_hp+=2000*gc->defense; if(guardian==0) { md->hp=gc->Ghp0; gc->GID0=md->bl.id; } if(guardian==1) { md->hp=gc->Ghp1; gc->GID1=md->bl.id; } if(guardian==2) { md->hp=gc->Ghp2; gc->GID2=md->bl.id; } @@ -324,7 +324,7 @@ int mob_spawn_guardian(struct map_session_data *sd,char *mapname, if(guardian==5) { md->hp=gc->Ghp5; gc->GID5=md->bl.id; } if(guardian==6) { md->hp=gc->Ghp6; gc->GID6=md->bl.id; } if(guardian==7) { md->hp=gc->Ghp7; gc->GID7=md->bl.id; } - + } } @@ -373,49 +373,49 @@ int mob_exclusion_check(struct mob_data *md,struct map_session_data *sd) * Appearance income of mob *------------------------------------------ */ -int mob_get_viewclass(int class) +int mob_get_viewclass(int class_) { - return mob_db[class].view_class; + return mob_db[class_].view_class; } -int mob_get_sex(int class) +int mob_get_sex(int class_) { - return mob_db[class].sex; + return mob_db[class_].sex; } -short mob_get_hair(int class) +short mob_get_hair(int class_) { - return mob_db[class].hair; + return mob_db[class_].hair; } -short mob_get_hair_color(int class) +short mob_get_hair_color(int class_) { - return mob_db[class].hair_color; + return mob_db[class_].hair_color; } -short mob_get_weapon(int class) +short mob_get_weapon(int class_) { - return mob_db[class].weapon; + return mob_db[class_].weapon; } -short mob_get_shield(int class) +short mob_get_shield(int class_) { - return mob_db[class].shield; + return mob_db[class_].shield; } -short mob_get_head_top(int class) +short mob_get_head_top(int class_) { - return mob_db[class].head_top; + return mob_db[class_].head_top; } -short mob_get_head_mid(int class) +short mob_get_head_mid(int class_) { - return mob_db[class].head_mid; + return mob_db[class_].head_mid; } -short mob_get_head_buttom(int class) +short mob_get_head_buttom(int class_) { - return mob_db[class].head_buttom; + return mob_db[class_].head_buttom; } -short mob_get_clothes_color(int class) // Add for player monster dye - Valaris +short mob_get_clothes_color(int class_) // Add for player monster dye - Valaris { - return mob_db[class].clothes_color; // End + return mob_db[class_].clothes_color; // End } -int mob_get_equip(int class) // mob equip [Valaris] +int mob_get_equip(int class_) // mob equip [Valaris] { - return mob_db[class].equip; + return mob_db[class_].equip; } /*========================================== * Is MOB in the state in which the present movement is possible or not? @@ -432,7 +432,7 @@ int mob_can_move(struct mob_data *md) md->sc_data[SC_AUTOCOUNTER].timer != -1 || //オートカウンター md->sc_data[SC_BLADESTOP].timer != -1 || //白刃取り md->sc_data[SC_SPIDERWEB].timer != -1 //スパイダーウェッブ - ) + ) return 0; return 1; @@ -536,7 +536,7 @@ static int mob_walk(struct mob_data *md,unsigned int tick,int data) if(md->walkpath.path_pos>=md->walkpath.path_len) clif_fixmobpos(md); // とまったときに位置の再送信 - } + } return 0; } @@ -613,7 +613,7 @@ static int mob_attack(struct mob_data *md,unsigned int tick,int data) if(tsd && !(mode&0x20) && (tsd->sc_data[SC_TRICKDEAD].timer != -1 || tsd->sc_data[SC_BASILICA].timer != -1 || ((pc_ishiding(tsd) || tsd->state.gangsterparadise) && !((race == 4 || race == 6) && !tsd->perfect_hiding) ) ) ) { md->target_id=0; - md->state.targettype = NONE_ATTACKABLE; + md->state.targettype = NONE_ATTACKABLE; return 0; } @@ -739,7 +739,7 @@ static int mob_timer(int tid,unsigned int tick,int id,int data) if( (bl=map_id2bl(id)) == NULL ){ //攻撃してきた敵がもういないのは正常のようだ return 1; } - + if(!bl || !bl->type || bl->type!=BL_MOB) return 1; @@ -904,7 +904,7 @@ int mob_spawn(int id) if(!md || !md->bl.type || md->bl.type!=BL_MOB) return -1; - + md->last_spawntime=tick; if( md->bl.prev!=NULL ){ // clif_clearchar_area(&md->bl,3); @@ -969,7 +969,7 @@ int mob_spawn(int id) if(gc) md->guild_id = gc->guild_id; } - + md->deletetimer=-1; md->skilltimer=-1; @@ -1042,7 +1042,7 @@ int mob_stop_walking(struct mob_data *md,int type) if(md->state.state == MS_WALK || md->state.state == MS_IDLE) { int dx=0,dy=0; - + md->walkpath.path_len=0; if(type&4){ dx=md->to_x-md->bl.x; @@ -1101,7 +1101,7 @@ int mob_can_reach(struct mob_data *md,struct block_list *bl,int range) if(gc && agit_flag==0) // Guardians will not attack during non-woe time [Valaris] return 0; // end addition [Valaris] - + if(bl && bl->type == BL_PC){ nullpo_retr(0, sd=(struct map_session_data *)bl); if(!gc) @@ -1183,7 +1183,9 @@ int mob_target(struct mob_data *md,struct block_list *bl,int dist) return 0; } // Nothing will be carried out if there is no mind of changing TAGE by TAGE ending. - if( (md->target_id > 0 && md->state.targettype == ATTACKABLE) && ( !(mode&0x04) || rand()%100>25) ) + if( (md->target_id > 0 && md->state.targettype == ATTACKABLE) && (!(mode&0x04) || rand()%100>25) && + // if the monster was provoked ignore the above rule [celest] + !(md->state.provoke_flag && md->state.provoke_flag == bl->id)) return 0; if(mode&0x20 || // Coercion is exerted if it is MVPMOB. @@ -1197,11 +1199,13 @@ int mob_target(struct mob_data *md,struct block_list *bl,int dist) return 0; } - md->target_id=bl->id; // Since there was no disturbance, it locks on to target. + md->target_id = bl->id; // Since there was no disturbance, it locks on to target. if(bl->type == BL_PC || bl->type == BL_MOB) md->state.targettype = ATTACKABLE; else md->state.targettype = NONE_ATTACKABLE; + if (md->state.provoke_flag) + md->state.provoke_flag = 0; md->min_chase=dist+13; if(md->min_chase>26) md->min_chase=26; @@ -1245,9 +1249,9 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap) race=mob_db[smd->class_].race; //対象がPCの場合 if(tsd && - !pc_isdead(tsd) && - tsd->bl.m == smd->bl.m && - tsd->invincible_timer == -1 && + !pc_isdead(tsd) && + tsd->bl.m == smd->bl.m && + tsd->invincible_timer == -1 && !pc_isinvisible(tsd) && (dist=distance(smd->bl.x,smd->bl.y,tsd->bl.x,tsd->bl.y))<9 ) @@ -1259,7 +1263,7 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap) rand()%1000<1000/(++(*pcc)) ){ // 範囲内PCで等確率にする smd->target_id=tsd->bl.id; smd->state.targettype = ATTACKABLE; - smd->min_chase=13; + smd->min_chase=13; } } } @@ -1298,7 +1302,7 @@ static int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) mode=mob_db[md->class_].mode; else mode=md->mode; - + if( !md->target_id && mode&0x02){ if(!md->lootitem || (battle_config.monster_loot_type == 1 && md->lootitem_count >= LOOTITEM_SIZE) ) @@ -1393,7 +1397,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) } // Although there is the master, since it is somewhat far, it approaches. - if((!md->target_id || md->state.targettype == NONE_ATTACKABLE) && mob_can_move(md) && + if((!md->target_id || md->state.targettype == NONE_ATTACKABLE) && mob_can_move(md) && (md->walkpath.path_pos>=md->walkpath.path_len || md->walkpath.path_len==0) && md->master_dist<15){ int i=0,dx,dy,ret; if(md->master_dist>4) { @@ -1716,7 +1720,7 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap) ret=mob_walktoxy(md,md->bl.x+dx,md->bl.y+dy,0); i++; } while(ret && i<5); - + if(ret){ // 移動不可能な所からの攻撃なら2歩下る if(dx<0) dx=2; else if(dx>0) dx=-2; @@ -1969,13 +1973,13 @@ static int mob_delay_item_drop(int tid,unsigned int tick,int id,int data) clif_additem(ditem->first_sd,0,0,flag); map_addflooritem(&temp_item,1,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0); } - free(ditem); + aFree(ditem); return 0; } map_addflooritem(&temp_item,1,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0); - free(ditem); + aFree(ditem); return 0; } @@ -1995,13 +1999,13 @@ static int mob_delay_item_drop2(int tid,unsigned int tick,int id,int data) clif_additem(ditem->first_sd,0,0,flag); map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0); } - free(ditem); + aFree(ditem); return 0; } map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0); - free(ditem); + aFree(ditem); return 0; } @@ -2219,71 +2223,71 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) } md->hp-=damage; - + if(md->class_ >= 1285 && md->class_ <=1287) { // guardian hp update [Valaris] struct guild_castle *gc=guild_mapname2gc(map[md->bl.m].name); if(gc) { - if(md->bl.id==gc->GID0) { + if(md->bl.id==gc->GID0) { gc->Ghp0=md->hp; if(gc->Ghp0<=0) { guild_castledatasave(gc->castle_id,10,0); guild_castledatasave(gc->castle_id,18,0); } - } - if(md->bl.id==gc->GID1) { + } + if(md->bl.id==gc->GID1) { gc->Ghp1=md->hp; if(gc->Ghp1<=0) { guild_castledatasave(gc->castle_id,11,0); guild_castledatasave(gc->castle_id,19,0); } } - if(md->bl.id==gc->GID2) { + if(md->bl.id==gc->GID2) { gc->Ghp2=md->hp; if(gc->Ghp2<=0) { guild_castledatasave(gc->castle_id,12,0); guild_castledatasave(gc->castle_id,20,0); } } - if(md->bl.id==gc->GID3) { + if(md->bl.id==gc->GID3) { gc->Ghp3=md->hp; if(gc->Ghp3<=0) { guild_castledatasave(gc->castle_id,13,0); guild_castledatasave(gc->castle_id,21,0); } } - if(md->bl.id==gc->GID4) { + if(md->bl.id==gc->GID4) { gc->Ghp4=md->hp; if(gc->Ghp4<=0) { guild_castledatasave(gc->castle_id,14,0); guild_castledatasave(gc->castle_id,22,0); } } - if(md->bl.id==gc->GID5) { + if(md->bl.id==gc->GID5) { gc->Ghp5=md->hp; if(gc->Ghp5<=0) { guild_castledatasave(gc->castle_id,15,0); guild_castledatasave(gc->castle_id,23,0); } } - if(md->bl.id==gc->GID6) { + if(md->bl.id==gc->GID6) { gc->Ghp6=md->hp; if(gc->Ghp6<=0) { guild_castledatasave(gc->castle_id,16,0); guild_castledatasave(gc->castle_id,24,0); } } - if(md->bl.id==gc->GID7) { + if(md->bl.id==gc->GID7) { gc->Ghp7=md->hp; if(gc->Ghp7<=0) { guild_castledatasave(gc->castle_id,17,0); guild_castledatasave(gc->castle_id,25,0); - + } } } } // end addition [Valaris] - + if(md->option&2 ) skill_status_change_end(&md->bl, SC_HIDING, -1); if(md->option&4 ) @@ -2291,7 +2295,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(md->state.special_mob_ai == 2){//スフィアーマイン int skillidx=0; - + if((skillidx=mob_skillid2skillidx(md->class_,NPC_SELFDESTRUCTION2))>=0){ md->mode |= 0x1; md->next_walktime=tick; @@ -2403,10 +2407,10 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) job_exp=mob_db[md->class_].job_exp*per/256; if(job_exp < 1) job_exp = 1; } - + if(sd && battle_config.pk_mode && (mob_db[md->class_].lv - sd->status.base_level >= 20)) { base_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris] - } + } if(sd && battle_config.pk_mode && (mob_db[md->class_].lv - sd->status.base_level >= 20)) { job_exp*=1.15; // pk_mode additional exp if monster >20 levels [Valaris] } @@ -2415,7 +2419,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) job_exp = 0; } else { - if(battle_config.zeny_from_mobs) { + if(battle_config.zeny_from_mobs) { if(md->level > 0) zeny=(md->level+rand()%md->level)*per/256; // zeny calculation moblv + random moblv [Valaris] if(mob_db[md->class_].mexp > 0) zeny*=rand()%250; @@ -2425,7 +2429,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) base_exp+=((md->level-mob_db[md->class_].lv)*mob_db[md->class_].base_exp*.03)*per/256; } } - + if((pid=tmpsd[i]->status.party_id)>0){ // パーティに入っている int j=0; for(j=0;jbl); if(sd->monster_drop_itemid[i] <= 0) continue; - if(sd->monster_drop_race[i] & (1<monster_drop_race[i] & (1<class_].mode & 0x20 && sd->monster_drop_race[i] & 1<<10) || (!(mob_db[md->class_].mode & 0x20) && sd->monster_drop_race[i] & 1<<11) ) { if(sd->monster_drop_itemrate[i] <= rand()%10000) @@ -2572,7 +2576,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) int log_mvp[2] = {0}; int j; int mexp; - temp = ((double)mob_db[md->class_].mexp * (9.+(double)count)/10.); //[Gengar] + temp = ((double)mob_db[md->class_].mexp * (9.+(double)count)/10.); //[Gengar] mexp = (temp > 2147483647.)? 0x7fffffff:(int)temp; if(mexp < 1) mexp = 1; clif_mvp_effect(mvp_sd); // エフェクト @@ -2617,7 +2621,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(md->npc_event[0] && strcmp(((md->npc_event)+strlen(md->npc_event)-13),"::OnAgitBreak") == 0) { printf("MOB.C: Run NPC_Event[OnAgitBreak].\n"); if (agit_flag == 1) //Call to Run NPC_Event[OnAgitBreak] - guild_agit_break(md); + guild_agit_break(md); } // SCRIPT実行 @@ -2665,7 +2669,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) int mob_class_change(struct mob_data *md,int *value) { unsigned int tick = gettick(); - int i,c,hp_rate,max_hp,class,count = 0; + int i,c,hp_rate,max_hp,class_,count = 0; nullpo_retr(0, md); nullpo_retr(0, value); @@ -2677,13 +2681,13 @@ int mob_class_change(struct mob_data *md,int *value) while(count < 5 && value[count] > 1000 && value[count] <= MAX_MOB_DB) count++; if(count < 1) return 0; - class = value[rand()%count]; - if(class<=1000 || class>MAX_MOB_DB) return 0; + class_ = value[rand()%count]; + if(class_<=1000 || class_>MAX_MOB_DB) return 0; max_hp = battle_get_max_hp(&md->bl); hp_rate = md->hp*100/max_hp; - clif_mob_class_change(md,class); - md->class_ = class; + clif_mob_class_change(md,class_); + md->class_ = class_; max_hp = battle_get_max_hp(&md->bl); if(battle_config.monster_class_change_full_recover==1) { md->hp = max_hp; @@ -2694,7 +2698,7 @@ int mob_class_change(struct mob_data *md,int *value) if(md->hp > max_hp) md->hp = max_hp; else if(md->hp < 1) md->hp = 1; - memcpy(md->name,mob_db[class].jname,24); + memcpy(md->name,mob_db[class_].jname,24); memset(&md->state,0,sizeof(md->state)); md->attacked_id = 0; md->target_id = 0; @@ -2710,13 +2714,13 @@ int mob_class_change(struct mob_data *md,int *value) md->next_walktime = tick+rand()%50+5000; md->attackabletime = tick; md->canmove_tick = tick; - + for(i=0,c=tick-1000*3600*10;iskilldelay[i] = c; md->skillid=0; md->skilllv=0; - if(md->lootitem == NULL && mob_db[class].mode&0x02) + if(md->lootitem == NULL && mob_db[class_].mode&0x02) md->lootitem=(struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); skill_clear_unitgroup(&md->bl); @@ -2902,7 +2906,7 @@ int mob_countslave(struct mob_data *md) int mob_summonslave(struct mob_data *md2,int *value,int amount,int flag) { struct mob_data *md; - int bx,by,m,count = 0,class,k,a = amount; + int bx,by,m,count = 0,class_,k,a = amount; nullpo_retr(0, md2); nullpo_retr(0, value); @@ -2918,12 +2922,12 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int flag) for(k=0;kMAX_MOB_DB) continue; + class_ = value[k]; + if(class_<=1000 || class_>MAX_MOB_DB) continue; for(;amount>0;amount--){ int x=0,y=0,i=0; md=(struct mob_data *)aCalloc(1,sizeof(struct mob_data)); - if(mob_db[class].mode&0x02) + if(mob_db[class_].mode&0x02) md->lootitem=(struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); else md->lootitem=NULL; @@ -2937,7 +2941,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int flag) y=by; } - mob_spawn_dataset(md,"--ja--",class); + mob_spawn_dataset(md,"--ja--",class_); md->bl.m=m; md->bl.x=x; md->bl.y=y; @@ -3018,15 +3022,15 @@ int mob_counttargeted(struct mob_data *md,struct block_list *src,int target_lv) *MOBskillから該当skillidのskillidxを返す *------------------------------------------ */ -int mob_skillid2skillidx(int class,int skillid) +int mob_skillid2skillidx(int class_,int skillid) { int i; - struct mob_skill *ms=mob_db[class].skill; - + struct mob_skill *ms=mob_db[class_].skill; + if(ms==NULL) return -1; - for(i=0;ibl.type!=BL_MOB || md->bl.prev==NULL ) return 0; @@ -3259,7 +3263,7 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx) nullpo_retr(0, md); nullpo_retr(0, ms=&mob_db[md->class_].skill[skill_idx]); - + if( target==NULL && (target=map_id2bl(md->target_id))==NULL ) return 0; @@ -3692,10 +3696,10 @@ int mobskill_event(struct mob_data *md,int flag) int mob_gvmobcheck(struct map_session_data *sd, struct block_list *bl) { struct mob_data *md=NULL; - + nullpo_retr(0,sd); nullpo_retr(0,bl); - + if(bl->type==BL_MOB && (md=(struct mob_data *)bl) && (md->class_ == 1288 || md->class_ == 1287 || md->class_ == 1286 || md->class_ == 1285)) { @@ -3712,7 +3716,7 @@ int mob_gvmobcheck(struct map_session_data *sd, struct block_list *bl) return 0;//正規ギルド承認がないとダメージ無し } - + return 1; } /*========================================== @@ -3739,53 +3743,53 @@ int mobskill_deltimer(struct mob_data *md ) * Since un-setting [ mob ] up was used, it is an initial provisional value setup. *------------------------------------------ */ -static int mob_makedummymobdb(int class) +static int mob_makedummymobdb(int class_) { int i; - sprintf(mob_db[class].name,"mob%d",class); - sprintf(mob_db[class].jname,"mob%d",class); - mob_db[class].lv=1; - mob_db[class].max_hp=1000; - mob_db[class].max_sp=1; - mob_db[class].base_exp=2; - mob_db[class].job_exp=1; - mob_db[class].range=1; - mob_db[class].atk1=7; - mob_db[class].atk2=10; - mob_db[class].def=0; - mob_db[class].mdef=0; - mob_db[class].str=1; - mob_db[class].agi=1; - mob_db[class].vit=1; - mob_db[class].int_=1; - mob_db[class].dex=6; - mob_db[class].luk=2; - mob_db[class].range2=10; - mob_db[class].range3=10; - mob_db[class].size=0; - mob_db[class].race=0; - mob_db[class].element=0; - mob_db[class].mode=0; - mob_db[class].speed=300; - mob_db[class].adelay=1000; - mob_db[class].amotion=500; - mob_db[class].dmotion=500; - mob_db[class].dropitem[0].nameid=909; // Jellopy - mob_db[class].dropitem[0].p=1000; + sprintf(mob_db[class_].name,"mob%d",class_); + sprintf(mob_db[class_].jname,"mob%d",class_); + mob_db[class_].lv=1; + mob_db[class_].max_hp=1000; + mob_db[class_].max_sp=1; + mob_db[class_].base_exp=2; + mob_db[class_].job_exp=1; + mob_db[class_].range=1; + mob_db[class_].atk1=7; + mob_db[class_].atk2=10; + mob_db[class_].def=0; + mob_db[class_].mdef=0; + mob_db[class_].str=1; + mob_db[class_].agi=1; + mob_db[class_].vit=1; + mob_db[class_].int_=1; + mob_db[class_].dex=6; + mob_db[class_].luk=2; + mob_db[class_].range2=10; + mob_db[class_].range3=10; + mob_db[class_].size=0; + mob_db[class_].race=0; + mob_db[class_].element=0; + mob_db[class_].mode=0; + mob_db[class_].speed=300; + mob_db[class_].adelay=1000; + mob_db[class_].amotion=500; + mob_db[class_].dmotion=500; + mob_db[class_].dropitem[0].nameid=909; // Jellopy + mob_db[class_].dropitem[0].p=1000; for(i=1;i<8;i++){ - mob_db[class].dropitem[i].nameid=0; - mob_db[class].dropitem[i].p=0; + mob_db[class_].dropitem[i].nameid=0; + mob_db[class_].dropitem[i].p=0; } // Item1,Item2 - mob_db[class].mexp=0; - mob_db[class].mexpper=0; + mob_db[class_].mexp=0; + mob_db[class_].mexpper=0; for(i=0;i<3;i++){ - mob_db[class].mvpitem[i].nameid=0; - mob_db[class].mvpitem[i].p=0; + mob_db[class_].mvpitem[i].nameid=0; + mob_db[class_].mvpitem[i].p=0; } for(i=0;iMAX_MOB_DB) + class_=atoi(str[0]); + if(class_<=1000 || class_>MAX_MOB_DB) continue; - mob_db[class].view_class=class; - memcpy(mob_db[class].name,str[1],24); - memcpy(mob_db[class].jname,str[2],24); - mob_db[class].lv=atoi(str[3]); - mob_db[class].max_hp=atoi(str[4]); - mob_db[class].max_sp=atoi(str[5]); - - mob_db[class].base_exp=atoi(str[6]); - if(mob_db[class].base_exp < 0) - mob_db[class].base_exp = 0; - else if(mob_db[class].base_exp > 0 && (mob_db[class].base_exp*battle_config.base_exp_rate/100 > 1000000000 || - mob_db[class].base_exp*battle_config.base_exp_rate/100 < 0)) - mob_db[class].base_exp=1000000000; - else - mob_db[class].base_exp*= battle_config.base_exp_rate/100; - - mob_db[class].job_exp=atoi(str[7]); - if(mob_db[class].job_exp < 0) - mob_db[class].job_exp = 0; - else if(mob_db[class].job_exp > 0 && (mob_db[class].job_exp*battle_config.job_exp_rate/100 > 1000000000 || - mob_db[class].job_exp*battle_config.job_exp_rate/100 < 0)) - mob_db[class].job_exp=1000000000; - else - mob_db[class].job_exp*=battle_config.job_exp_rate/100; - - mob_db[class].range=atoi(str[8]); - mob_db[class].atk1=atoi(str[9]); - mob_db[class].atk2=atoi(str[10]); - mob_db[class].def=atoi(str[11]); - mob_db[class].mdef=atoi(str[12]); - mob_db[class].str=atoi(str[13]); - mob_db[class].agi=atoi(str[14]); - mob_db[class].vit=atoi(str[15]); - mob_db[class].int_=atoi(str[16]); - mob_db[class].dex=atoi(str[17]); - mob_db[class].luk=atoi(str[18]); - mob_db[class].range2=atoi(str[19]); - mob_db[class].range3=atoi(str[20]); - mob_db[class].size=atoi(str[21]); - mob_db[class].race=atoi(str[22]); - mob_db[class].element=atoi(str[23]); - mob_db[class].mode=atoi(str[24]); - mob_db[class].speed=atoi(str[25]); - mob_db[class].adelay=atoi(str[26]); - mob_db[class].amotion=atoi(str[27]); - mob_db[class].dmotion=atoi(str[28]); + mob_db[class_].view_class=class_; + memcpy(mob_db[class_].name,str[1],24); + memcpy(mob_db[class_].jname,str[2],24); + mob_db[class_].lv=atoi(str[3]); + mob_db[class_].max_hp=atoi(str[4]); + mob_db[class_].max_sp=atoi(str[5]); + + mob_db[class_].base_exp=atoi(str[6]); + if(mob_db[class_].base_exp < 0) + mob_db[class_].base_exp = 0; + else if(mob_db[class_].base_exp > 0 && (mob_db[class_].base_exp*battle_config.base_exp_rate/100 > 1000000000 || + mob_db[class_].base_exp*battle_config.base_exp_rate/100 < 0)) + mob_db[class_].base_exp=1000000000; + else + mob_db[class_].base_exp*= battle_config.base_exp_rate/100; + + mob_db[class_].job_exp=atoi(str[7]); + if(mob_db[class_].job_exp < 0) + mob_db[class_].job_exp = 0; + else if(mob_db[class_].job_exp > 0 && (mob_db[class_].job_exp*battle_config.job_exp_rate/100 > 1000000000 || + mob_db[class_].job_exp*battle_config.job_exp_rate/100 < 0)) + mob_db[class_].job_exp=1000000000; + else + mob_db[class_].job_exp*=battle_config.job_exp_rate/100; + + mob_db[class_].range=atoi(str[8]); + mob_db[class_].atk1=atoi(str[9]); + mob_db[class_].atk2=atoi(str[10]); + mob_db[class_].def=atoi(str[11]); + mob_db[class_].mdef=atoi(str[12]); + mob_db[class_].str=atoi(str[13]); + mob_db[class_].agi=atoi(str[14]); + mob_db[class_].vit=atoi(str[15]); + mob_db[class_].int_=atoi(str[16]); + mob_db[class_].dex=atoi(str[17]); + mob_db[class_].luk=atoi(str[18]); + mob_db[class_].range2=atoi(str[19]); + mob_db[class_].range3=atoi(str[20]); + mob_db[class_].size=atoi(str[21]); + mob_db[class_].race=atoi(str[22]); + mob_db[class_].element=atoi(str[23]); + mob_db[class_].mode=atoi(str[24]); + mob_db[class_].speed=atoi(str[25]); + mob_db[class_].adelay=atoi(str[26]); + mob_db[class_].amotion=atoi(str[27]); + mob_db[class_].dmotion=atoi(str[28]); for(i=0;i<8;i++){ int rate = 0,type,ratemin,ratemax; - mob_db[class].dropitem[i].nameid=atoi(str[29+i*2]); - type = itemdb_type(mob_db[class].dropitem[i].nameid); + mob_db[class_].dropitem[i].nameid=atoi(str[29+i*2]); + type = itemdb_type(mob_db[class_].dropitem[i].nameid); if (type == 0) { // Added [Valaris] rate = battle_config.item_rate_heal; ratemin = battle_config.item_drop_heal_min; @@ -3947,28 +3951,28 @@ static int mob_readdb(void) } rate = rate * atoi(str[30+i*2])/100; rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate; - mob_db[class].dropitem[i].p = rate; + mob_db[class_].dropitem[i].p = rate; } // Item1,Item2 - mob_db[class].mexp=atoi(str[45])*battle_config.mvp_exp_rate/100; - mob_db[class].mexpper=atoi(str[46]); + mob_db[class_].mexp=atoi(str[45])*battle_config.mvp_exp_rate/100; + mob_db[class_].mexpper=atoi(str[46]); for(i=0;i<3;i++){ - mob_db[class].mvpitem[i].nameid=atoi(str[47+i*2]); - mob_db[class].mvpitem[i].p=atoi(str[48+i*2])*battle_config.mvp_item_rate/100; + mob_db[class_].mvpitem[i].nameid=atoi(str[47+i*2]); + mob_db[class_].mvpitem[i].p=atoi(str[48+i*2])*battle_config.mvp_item_rate/100; } for(i=0;iMAX_MOB_DB) // 値が異常なら処理しない。 + if(class_<=1000 || class_>MAX_MOB_DB) // 値が異常なら処理しない。 continue; k=atoi(str[1]); if(k >= 0) - mob_db[class].view_class=k; - - if((mob_db[class].view_class < 24) || (mob_db[class].view_class > 4000)) { - mob_db[class].sex=atoi(str[2]); - mob_db[class].hair=atoi(str[3]); - mob_db[class].hair_color=atoi(str[4]); - mob_db[class].weapon=atoi(str[5]); - mob_db[class].shield=atoi(str[6]); - mob_db[class].head_top=atoi(str[7]); - mob_db[class].head_mid=atoi(str[8]); - mob_db[class].head_buttom=atoi(str[9]); - mob_db[class].option=atoi(str[10])&~0x46; - mob_db[class].clothes_color=atoi(str[11]); // Monster player dye option - Valaris + mob_db[class_].view_class=k; + + if((mob_db[class_].view_class < 24) || (mob_db[class_].view_class > 4000)) { + mob_db[class_].sex=atoi(str[2]); + mob_db[class_].hair=atoi(str[3]); + mob_db[class_].hair_color=atoi(str[4]); + mob_db[class_].weapon=atoi(str[5]); + mob_db[class_].shield=atoi(str[6]); + mob_db[class_].head_top=atoi(str[7]); + mob_db[class_].head_mid=atoi(str[8]); + mob_db[class_].head_buttom=atoi(str[9]); + mob_db[class_].option=atoi(str[10])&~0x46; + mob_db[class_].clothes_color=atoi(str[11]); // Monster player dye option - Valaris } - else if(atoi(str[2]) > 0) mob_db[class].equip=atoi(str[2]); // mob equipment [Valaris] + else if(atoi(str[2]) > 0) mob_db[class_].equip=atoi(str[2]); // mob equipment [Valaris] ln++; } @@ -4066,7 +4070,7 @@ static int mob_read_randommonster(void) return -1; } while(fgets(line,1020,fp)){ - int class,per; + int class_,per; if(line[0] == '/' && line[1] == '/') continue; memset(str,0,sizeof(str)); @@ -4079,10 +4083,10 @@ static int mob_read_randommonster(void) if(str[0]==NULL || str[2]==NULL) continue; - class = atoi(str[0]); + class_ = atoi(str[0]); per=atoi(str[2]); - if((class>1000 && class<=MAX_MOB_DB) || class==0) - mob_db[class].summonper[i]=per; + if((class_>1000 && class_<=MAX_MOB_DB) || class_==0) + mob_db[class_].summonper[i]=per; } fclose(fp); sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n",mobfile[i]); @@ -4267,12 +4271,12 @@ void mob_reload(void) static int mob_read_sqldb(void) { char line[1024]; - int i,class; + int i,class_; long unsigned int ln=0; char *str[55],*p,*np; - + memset(mob_db,0,sizeof(mob_db)); - + sprintf (tmp_sql, "SELECT * FROM `%s`",mob_db_db); if(mysql_query(&mmysql_handle, tmp_sql) ) { printf("DB server Error (select %s to Memory)- %s\n",mob_db_db,mysql_error(&mmysql_handle) ); @@ -4301,53 +4305,53 @@ static int mob_read_sqldb(void) } else str[i]=p; } - - class=atoi(str[0]); - if(class<=1000 || class>MAX_MOB_DB) + + class_=atoi(str[0]); + if(class_<=1000 || class_>MAX_MOB_DB) continue; - + ln++; - - mob_db[class].view_class=class; - memcpy(mob_db[class].name,str[1],24); - memcpy(mob_db[class].jname,str[2],24); - mob_db[class].lv=atoi(str[3]); - mob_db[class].max_hp=atoi(str[4]); - mob_db[class].max_sp=atoi(str[5]); - mob_db[class].base_exp=atoi(str[6])* + + mob_db[class_].view_class=class_; + memcpy(mob_db[class_].name,str[1],24); + memcpy(mob_db[class_].jname,str[2],24); + mob_db[class_].lv=atoi(str[3]); + mob_db[class_].max_hp=atoi(str[4]); + mob_db[class_].max_sp=atoi(str[5]); + mob_db[class_].base_exp=atoi(str[6])* battle_config.base_exp_rate/100; - if(mob_db[class].base_exp <= 0) - mob_db[class].base_exp = 1; - mob_db[class].job_exp=atoi(str[7])* + if(mob_db[class_].base_exp <= 0) + mob_db[class_].base_exp = 1; + mob_db[class_].job_exp=atoi(str[7])* battle_config.job_exp_rate/100; - if(mob_db[class].job_exp <= 0) - mob_db[class].job_exp = 1; - mob_db[class].range=atoi(str[8]); - mob_db[class].atk1=atoi(str[9]); - mob_db[class].atk2=atoi(str[10]); - mob_db[class].def=atoi(str[11]); - mob_db[class].mdef=atoi(str[12]); - mob_db[class].str=atoi(str[13]); - mob_db[class].agi=atoi(str[14]); - mob_db[class].vit=atoi(str[15]); - mob_db[class].int_=atoi(str[16]); - mob_db[class].dex=atoi(str[17]); - mob_db[class].luk=atoi(str[18]); - mob_db[class].range2=atoi(str[19]); - mob_db[class].range3=atoi(str[20]); - mob_db[class].size=atoi(str[21]); - mob_db[class].race=atoi(str[22]); - mob_db[class].element=atoi(str[23]); - mob_db[class].mode=atoi(str[24]); - mob_db[class].speed=atoi(str[25]); - mob_db[class].adelay=atoi(str[26]); - mob_db[class].amotion=atoi(str[27]); - mob_db[class].dmotion=atoi(str[28]); + if(mob_db[class_].job_exp <= 0) + mob_db[class_].job_exp = 1; + mob_db[class_].range=atoi(str[8]); + mob_db[class_].atk1=atoi(str[9]); + mob_db[class_].atk2=atoi(str[10]); + mob_db[class_].def=atoi(str[11]); + mob_db[class_].mdef=atoi(str[12]); + mob_db[class_].str=atoi(str[13]); + mob_db[class_].agi=atoi(str[14]); + mob_db[class_].vit=atoi(str[15]); + mob_db[class_].int_=atoi(str[16]); + mob_db[class_].dex=atoi(str[17]); + mob_db[class_].luk=atoi(str[18]); + mob_db[class_].range2=atoi(str[19]); + mob_db[class_].range3=atoi(str[20]); + mob_db[class_].size=atoi(str[21]); + mob_db[class_].race=atoi(str[22]); + mob_db[class_].element=atoi(str[23]); + mob_db[class_].mode=atoi(str[24]); + mob_db[class_].speed=atoi(str[25]); + mob_db[class_].adelay=atoi(str[26]); + mob_db[class_].amotion=atoi(str[27]); + mob_db[class_].dmotion=atoi(str[28]); for(i=0;i<8;i++){ int rate = 0,type,ratemin,ratemax; - mob_db[class].dropitem[i].nameid=atoi(str[29+i*2]); - type = itemdb_type(mob_db[class].dropitem[i].nameid); + mob_db[class_].dropitem[i].nameid=atoi(str[29+i*2]); + type = itemdb_type(mob_db[class_].dropitem[i].nameid); if (type == 0) { // Added by Valaris rate = battle_config.item_rate_heal; ratemin = battle_config.item_drop_heal_min; @@ -4375,27 +4379,27 @@ static int mob_read_sqldb(void) } rate = (rate / 100) * atoi(str[30+i*2]); rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate; - mob_db[class].dropitem[i].p = rate; + mob_db[class_].dropitem[i].p = rate; } - - mob_db[class].mexp=atoi(str[45])*battle_config.mvp_exp_rate/100; - mob_db[class].mexpper=atoi(str[46]); + + mob_db[class_].mexp=atoi(str[45])*battle_config.mvp_exp_rate/100; + mob_db[class_].mexpper=atoi(str[46]); for(i=0;i<3;i++){ - mob_db[class].mvpitem[i].nameid=atoi(str[47+i*2]); - mob_db[class].mvpitem[i].p=atoi(str[48+i*2])*battle_config.mvp_item_rate/100; + mob_db[class_].mvpitem[i].nameid=atoi(str[47+i*2]); + mob_db[class_].mvpitem[i].p=atoi(str[48+i*2])*battle_config.mvp_item_rate/100; } for(i=0;iareanpc_id=nd->bl.id; npc_event(sd,strcat(name,"::OnTouch"),0); } - free(name); + aFree(name); return 0; } int npc_enable(const char *name,int flag) @@ -92,7 +92,7 @@ int npc_enable(const char *name,int flag) struct npc_data *nd=strdb_search(npcname_db,name); if (nd==NULL) return 0; - + if (flag&1) { // 有効化 nd->flag&=~1; clif_spawnnpc(nd); @@ -132,7 +132,7 @@ int npc_event_dequeue(struct map_session_data *sd) sd->npc_id=0; if (sd->eventqueue[0][0]) { // キューのイベント処理 - char *name=(char *)aCalloc(50,sizeof(char)); + char *name=(char *)aCallocA(50,sizeof(char)); int i; memcpy(name,sd->eventqueue[0],50); @@ -164,9 +164,9 @@ int npc_event_timer(int tid,unsigned int tick,int id,int data) struct map_session_data *sd=map_id2sd(id); if (sd==NULL) return 0; - + npc_event(sd,(const char *)data,0); - free((void*)data); + aFree((void*)data); return 0; } @@ -226,7 +226,7 @@ int npc_timer(int tid,unsigned int tick,int id,int data) // Added by RoVeRT { strdb_foreach(npcname_db,npc_timer_sub); - free((void*)data); + aFree((void*)data); return 0; }*/ /*========================================== @@ -239,14 +239,14 @@ int npc_event_export(void *key,void *data,va_list ap) char *lname=(char *)key; int pos=(int)data; struct npc_data *nd=va_arg(ap,struct npc_data *); - + if ((lname[0]=='O' || lname[0]=='o')&&(lname[1]=='N' || lname[1]=='n')) { struct event_data *ev; char *buf; char *p=strchr(lname,':'); // エクスポートされる ev=aCalloc(sizeof(struct event_data), 1); - buf=aCalloc(50, 1); + buf=aCallocA(50, 1); if (ev==NULL || buf==NULL) { printf("npc_event_export: out of memory !\n"); exit(1); @@ -344,17 +344,17 @@ int npc_event_doall_sub(void *key,void *data,va_list ap) run_script(ev->nd->u.scr.script,ev->pos,0,ev->nd->bl.id); (*c)++; } - + return 0; } int npc_event_doall(const char *name) { int c=0; char buf[64]="::"; - + strncpy(buf+2,name,62); strdb_foreach(ev_db,npc_event_doall_sub,&c,buf); - return c; + return c; } int npc_event_do_sub(void *key,void *data,va_list ap) @@ -380,7 +380,7 @@ int npc_event_do_sub(void *key,void *data,va_list ap) int npc_event_do(const char *name) { int c=0; - + if (*name==':' && name[1]==':') { return npc_event_doall(name+2); } @@ -400,7 +400,7 @@ int npc_event_do_clock(int tid,unsigned int tick,int id,int data) char buf[64]; char *day=""; int c=0; - + time(&timer); t=localtime(&timer); @@ -413,7 +413,7 @@ int npc_event_do_clock(int tid,unsigned int tick,int id,int data) case 5: day = "Fri"; break; case 6: day = "Sat"; break; } - + if (t->tm_min != ev_tm_b.tm_min ) { sprintf(buf,"OnMinute%02d",t->tm_min); c+=npc_event_doall(buf); @@ -460,7 +460,7 @@ int npc_addeventtimer(struct npc_data *nd,int tick,const char *name) if( nd->eventtimer[i]==-1 ) break; if(iu.scr.timer_event; int j,i=nd->u.scr.timeramount; - if(te==NULL) te=aMalloc(sizeof(struct npc_timerevent_list)); + if(te==NULL) te=aMallocA(sizeof(struct npc_timerevent_list)); else te=aRealloc( te, sizeof(struct npc_timerevent_list) * (i+1) ); if(te==NULL){ printf("npc_timerevent_import: out of memory !\n"); @@ -581,7 +581,7 @@ int npc_timerevent(int tid,unsigned int tick,int id,int data) nd->u.scr.timertick=tick; te=nd->u.scr.timer_event+ nd->u.scr.nexttimer; nd->u.scr.timerid = -1; - + t = nd->u.scr.timer+=data; nd->u.scr.nexttimer++; if( nd->u.scr.timeramount>nd->u.scr.nexttimer ){ @@ -605,7 +605,7 @@ int npc_timerevent_start(struct npc_data *nd, int rid) n=nd->u.scr.timeramount; if( nd->u.scr.nexttimer>=0 || n==0 ) return 0; - + for(j=0;ju.scr.timer_event[j].timer > nd->u.scr.timer ) break; @@ -617,7 +617,7 @@ int npc_timerevent_start(struct npc_data *nd, int rid) nd->u.scr.timertick=gettick(); if (rid >= 0) nd->u.scr.rid=rid; // changed to: attaching to given rid by default [Shinomori] // if rid is less than 0 leave it unchanged [celest] - + next = nd->u.scr.timer_event[j].timer - nd->u.scr.timer; nd->u.scr.timerid = add_timer(gettick()+next,npc_timerevent,nd->bl.id,next); return 0; @@ -743,7 +743,7 @@ int npc_event(struct map_session_data *sd,const char *eventname,int mob_kill) npc_event_dequeue(sd); return 0; } - + sd->npc_id=nd->bl.id; sd->npc_pos=run_script(nd->u.scr.script,ev->pos,sd->bl.id,nd->bl.id); return 0; @@ -764,7 +764,7 @@ int npc_command_sub(void *key,void *data,va_list ap) if (strcmp(command,temp)==0) run_script(ev->nd->u.scr.script,ev->pos,0,ev->nd->bl.id); } - + return 0; } @@ -793,7 +793,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y) f=0; continue; } - + switch(map[m].npc[i]->bl.subtype) { case WARP: xs=map[m].npc[i]->u.warp.xs; @@ -824,7 +824,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y) break; case SCRIPT: { - char *name=(char *)aCalloc(50,sizeof(char)); + char *name=(char *)aCallocA(50,sizeof(char)); memcpy(name,map[m].npc[i]->name,50); if(sd->areanpc_id==map[m].npc[i]->bl.id) @@ -832,7 +832,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y) sd->areanpc_id=map[m].npc[i]->bl.id; if(npc_event(sd,strcat(name,"::OnTouch"),0)>0) npc_click(sd,map[m].npc[i]->bl.id); - free(name); + aFree(name); break; } } @@ -855,7 +855,7 @@ int npc_checknear(struct map_session_data *sd,int id) printf("no such npc : %d\n",id); return 1; } - + if (nd->class_<0) // イベント系は常にOK return 0; @@ -968,7 +968,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list) { struct npc_data *nd; double z; - int i,j,w,skill,itemamount=0,new=0; + int i,j,w,skill,itemamount=0,new_=0; nullpo_retr(3, sd); nullpo_retr(3, item_list); @@ -998,7 +998,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list) case ADDITEM_EXIST: break; case ADDITEM_NEW: - new++; + new_++; break; case ADDITEM_OVERAMOUNT: return 2; @@ -1010,7 +1010,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list) return 1; // zeny不足 if (w+sd->weight > sd->max_weight) return 2; // 重量超過 - if (pc_inventoryblank(sd)walkpath.path_pos>=nd->walkpath.path_len) clif_fixnpcpos(nd); // When npc stops, retransmission current of a position. - + } return 0; } @@ -1237,7 +1237,7 @@ static int npc_walktimer(int tid,unsigned int tick,int id,int data) if(nd->walktimer != tid){ return 0; } - + nd->walktimer=-1; if(nd->bl.prev == NULL) @@ -1302,7 +1302,7 @@ int npc_stop_walking(struct npc_data *nd,int type) if(nd->state.state == MS_WALK || nd->state.state == MS_IDLE) { int dx=0,dy=0; - + nd->walkpath.path_len=0; if(type&4){ dx=nd->to_x-nd->bl.x; @@ -1352,7 +1352,7 @@ void npc_clearsrcfile() while( p ) { struct npc_src_list *p2=p; p=p->next; - free(p2); + aFree(p2); } npc_src_first=NULL; npc_src_last=NULL; @@ -1363,7 +1363,7 @@ void npc_clearsrcfile() */ void npc_addsrcfile(char *name) { - struct npc_src_list *new; + struct npc_src_list *new_; size_t len; if ( strcmpi(name,"clear")==0 ) { @@ -1382,16 +1382,16 @@ void npc_addsrcfile(char *name) } } - len = sizeof(*new) + strlen(name); - new=(struct npc_src_list *)aCalloc(1,len); - new->next = NULL; - strncpy(new->name,name,strlen(name)+1); + len = sizeof(*new_) + strlen(name); + new_=(struct npc_src_list *)aCalloc(1,len); + new_->next = NULL; + strncpy(new_->name,name,strlen(name)+1); if (npc_src_first==NULL) - npc_src_first = new; + npc_src_first = new_; if (npc_src_last) - npc_src_last->next = new; + npc_src_last->next = new_; - npc_src_last=new; + npc_src_last=new_; } /*========================================== * 読み込むnpcファイルの削除 @@ -1411,7 +1411,7 @@ void npc_delsrcfile(char *name) *lp=p->next; if ( npc_src_last==p ) npc_src_last=pp; - free(p); + aFree(p); break; } } @@ -1525,7 +1525,7 @@ static int npc_parse_shop(char *w1,char *w2,char *w3,char *w4) p=strchr(p,','); } if (pos == 0) { - free(nd); + aFree(nd); return 1; } nd->u.shop_item[pos++].nameid = 0; @@ -1545,7 +1545,7 @@ static int npc_parse_shop(char *w1,char *w2,char *w3,char *w4) nd->opt1 = 0; nd->opt2 = 0; nd->opt3 = 0; - + nd = (struct npc_data *)aRealloc(nd, sizeof(struct npc_data) + sizeof(nd->u.shop_item[0]) * pos); @@ -1572,14 +1572,14 @@ int npc_convertlabel_db(void *key,void *data,va_list ap) struct npc_label_list *lst; int num; char *p=strchr(lname,':'); - + nullpo_retr(0, ap); nullpo_retr(0, nd=va_arg(ap,struct npc_data *)); lst=nd->u.scr.label_list; num=nd->u.scr.label_list_num; if(!lst){ - lst=(struct npc_label_list *)aCalloc(1,sizeof(struct npc_label_list)); + lst=(struct npc_label_list *)aCallocA(1,sizeof(struct npc_label_list)); num=0; }else lst=(struct npc_label_list *)aRealloc(lst,sizeof(struct npc_label_list)*(num+1)); @@ -1598,7 +1598,7 @@ int npc_convertlabel_db(void *key,void *data,va_list ap) */ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line,FILE *fp,int *lines) { - int x,y,dir=0,m,xs=0,ys=0,class=0; // [Valaris] thanks to fov + int x,y,dir=0,m,xs=0,ys=0,class_=0; // [Valaris] thanks to fov char mapname[24]; unsigned char *srcbuf=NULL,*script; int srcsize=65536; @@ -1627,7 +1627,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line if(strcmp(w2,"script")==0){ // スクリプトの解析 - srcbuf=(char *)aCalloc(srcsize,sizeof(char)); + srcbuf=(char *)aCallocA(srcsize,sizeof(char)); if (strchr(first_line,'{')) { strcpy(srcbuf,strchr(first_line,'{')); startline=*lines; @@ -1657,13 +1657,13 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line script=parse_script(srcbuf,startline); if (script==NULL) { // script parse error? - free(srcbuf); + aFree(srcbuf); return 1; } }else{ // duplicateする - + char srcname[128]; struct npc_data *nd2; if( sscanf(w2,"duplicate(%[^)])",srcname)!=1 ){ @@ -1678,22 +1678,22 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line label_dup=nd2->u.scr.label_list; label_dupnum=nd2->u.scr.label_list_num; src_id=nd2->bl.id; - + }// end of スクリプト解析 nd=(struct npc_data *)aCalloc(1,sizeof(struct npc_data)); if(m==-1){ // スクリプトコピー用のダミーNPC - - }else if( sscanf(w4,"%d,%d,%d",&class,&xs,&ys)==3) { + + }else if( sscanf(w4,"%d,%d,%d",&class_,&xs,&ys)==3) { // 接触型NPC int i,j; - + if (xs>=0)xs=xs*2+1; if (ys>=0)ys=ys*2+1; - - if (class>=0) { + + if (class_>=0) { for(i=0;iu.scr.xs=xs; nd->u.scr.ys=ys; } else { // クリック型NPC - class=atoi(w4); + class_=atoi(w4); nd->u.scr.xs=0; nd->u.scr.ys=0; } - - if (class<0 && m>=0) { // イベント型NPC + + if (class_<0 && m>=0) { // イベント型NPC evflag=1; } @@ -1735,7 +1735,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line nd->bl.id=npc_get_new_npc_id(); nd->dir = dir; nd->flag=0; - nd->class_=class; + nd->class_=class_; nd->speed=200; nd->u.scr.script=script; nd->u.scr.src_id=src_id; @@ -1766,21 +1766,21 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line //----------------------------------------- - // ラベルデータの準備 + // ラベルデータの準備 if(srcbuf){ // script本体がある場合の処理 - + // ラベルデータのコンバート label_db=script_get_label_db(); strdb_foreach(label_db,npc_convertlabel_db,nd); - + // もう使わないのでバッファ解放 - free(srcbuf); + aFree(srcbuf); }else{ // duplicate -// nd->u.scr.label_list=aMalloc(sizeof(struct npc_label_list)*label_dupnum); +// nd->u.scr.label_list=aMallocA(sizeof(struct npc_label_list)*label_dupnum); // memcpy(nd->u.scr.label_list,label_dup,sizeof(struct npc_label_list)*label_dupnum); nd->u.scr.label_list=label_dup; // ラベルデータ共有 @@ -1792,13 +1792,13 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line for(i=0;iu.scr.label_list_num;i++){ char *lname=nd->u.scr.label_list[i].name; int pos=nd->u.scr.label_list[i].pos; - + if ((lname[0]=='O' || lname[0]=='o')&&(lname[1]=='N' || lname[1]=='n')) { struct event_data *ev; char *buf; // エクスポートされる ev=(struct event_data *)aCalloc(1,sizeof(struct event_data)); - buf=(char *)aCalloc(50,sizeof(char)); + buf=(char *)aCallocA(50,sizeof(char)); if (strlen(lname)>24) { printf("npc_parse_script: label name error !\n"); exit(1); @@ -1810,7 +1810,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line } } } - + //----------------------------------------- // ラベルデータからタイマーイベント取り込み for(i=0;iu.scr.label_list_num;i++){ @@ -1822,7 +1822,7 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line struct npc_timerevent_list *te=nd->u.scr.timer_event; int j,k=nd->u.scr.timeramount; if(te==NULL) - te=(struct npc_timerevent_list *)aCalloc(1,sizeof(struct npc_timerevent_list)); + te=(struct npc_timerevent_list *)aCallocA(1,sizeof(struct npc_timerevent_list)); else te=(struct npc_timerevent_list *)aRealloc( te, sizeof(struct npc_timerevent_list) * (k+1) ); for(j=0;ju.scr.nexttimer=-1; nd->u.scr.timerid=-1; - + return 0; } @@ -1859,7 +1859,7 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li char *p; // スクリプトの解析 - srcbuf=(char *)aCalloc(srcsize,sizeof(char)); + srcbuf=(char *)aCallocA(srcsize,sizeof(char)); if (strchr(first_line,'{')) { strcpy(srcbuf,strchr(first_line,'{')); startline=*lines; @@ -1889,11 +1889,11 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li script=parse_script(srcbuf,startline); if (script==NULL) { // script parse error? - free(srcbuf); + aFree(srcbuf); return 1; } - p=(char *)aCalloc(50,sizeof(char)); + p=(char *)aCallocA(50,sizeof(char)); strncpy(p,w3,50); strdb_insert(script_get_userfunc_db(),p,script); @@ -1901,10 +1901,10 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li // label_db=script_get_label_db(); // もう使わないのでバッファ解放 - free(srcbuf); - + aFree(srcbuf); + // printf("function %s => %p\n",p,script); - + return 0; } @@ -1915,7 +1915,7 @@ static int npc_parse_function(char *w1,char *w2,char *w3,char *w4,char *first_li */ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4) { - int m,x,y,xs,ys,class,num,delay1,delay2,level; + int m,x,y,xs,ys,class_,num,delay1,delay2,level; int i; char mapname[24]; char mobname[24]; @@ -1926,7 +1926,7 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4) delay1=delay2=0; // 引数の個数チェック if (sscanf(w1,"%[^,],%d,%d,%d,%d",mapname,&x,&y,&xs,&ys) < 3 || - sscanf(w4,"%d,%d,%d,%d,%s",&class,&num,&delay1,&delay2,eventname) < 2 ) { + sscanf(w4,"%d,%d,%d,%d,%s",&class_,&num,&delay1,&delay2,eventname) < 2 ) { printf("bad monster line : %s\n",w3); return 1; } @@ -1941,13 +1941,13 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4) for(i=0;i4000) { // large/tiny mobs [Valaris] + if(class_>4000) { // large/tiny mobs [Valaris] md->size=2; - class-=4000; + class_-=4000; } - else if(class>2000) { + else if(class_>2000) { md->size=1; - class-=2000; + class_-=2000; } md->bl.prev=NULL; @@ -1958,9 +1958,9 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4) if(sscanf(w3,"%[^,],%d",mobname,&level) > 1) { if(strcmp(mobname,"--en--")==0) - memcpy(md->name,mob_db[class].name,24); + memcpy(md->name,mob_db[class_].name,24); else if(strcmp(mobname,"--ja--")==0) - memcpy(md->name,mob_db[class].jname,24); + memcpy(md->name,mob_db[class_].jname,24); md->level=level; } @@ -1968,7 +1968,7 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4) memcpy(md->name,w3,24); md->n = i; - md->base_class = md->class_ = class; + md->base_class = md->class_ = class_; md->bl.id=npc_get_new_npc_id(); md->m =m; md->x0=x; @@ -1982,9 +1982,9 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4) md->timer = -1; md->target_id=0; md->attacked_id=0; - md->speed=mob_db[class].speed; + md->speed=mob_db[class_].speed; - if (mob_db[class].mode&0x02) + if (mob_db[class_].mode&0x02) md->lootitem=(struct item *)aCalloc(LOOTITEM_SIZE,sizeof(struct item)); else md->lootitem=NULL; @@ -2122,19 +2122,19 @@ static int npc_parse_mapflag(char *w1,char *w2,char *w3,char *w4) } else if (strcmpi(w3,"noicewall")==0) { // noicewall [Valaris] map[m].flag.noicewall=1; - } + } else if (strcmpi(w3,"snow")==0) { // snow [Valaris] map[m].flag.snow=1; - } + } else if (strcmpi(w3,"fog")==0) { // fog [Valaris] map[m].flag.fog=1; - } + } else if (strcmpi(w3,"sakura")==0) { // sakura [Valaris] map[m].flag.sakura=1; - } + } else if (strcmpi(w3,"leaves")==0) { // leaves [Valaris] map[m].flag.leaves=1; - } + } else if (strcmpi(w3,"rain")==0) { // rain [Valaris] map[m].flag.rain=1; } @@ -2144,7 +2144,7 @@ static int npc_parse_mapflag(char *w1,char *w2,char *w3,char *w4) else if (strcmpi(w3,"nogo")==0) { // celest map[m].flag.nogo=1; } - + return 0; } @@ -2169,12 +2169,12 @@ static int npc_read_indoors(void) if ((m = map_mapname2mapid(map_name)) >= 0) map[m].flag.indoors=1; } - + p=strchr(p,10); if(!p) break; p++; } - free(buf); + aFree(buf); sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","data\\indoorrswtable.txt"); ShowStatus(tmp_output); @@ -2183,9 +2183,9 @@ static int npc_read_indoors(void) static int ev_db_final(void *key,void *data,va_list ap) { - free(data); + aFree(data); if(strstr(key,"::")!=NULL) - free(key); + aFree(key); return 0; } static int npcname_db_final(void *key,void *data,va_list ap) @@ -2214,49 +2214,49 @@ int do_final_npc(void) if((bl=map_id2bl(i))){ if(bl->type == BL_NPC && (nd = (struct npc_data *)bl)){ if(nd->chat_id && (cd=(struct chat_data*)map_id2bl(nd->chat_id))){ - free(cd); + aFree(cd); cd = NULL; } if(nd->bl.subtype == SCRIPT){ if(nd->u.scr.timer_event) - free(nd->u.scr.timer_event); + aFree(nd->u.scr.timer_event); if(nd->u.scr.src_id==0){ if(nd->u.scr.script){ - free(nd->u.scr.script); + aFree(nd->u.scr.script); nd->u.scr.script=NULL; } if(nd->u.scr.label_list){ - free(nd->u.scr.label_list); + aFree(nd->u.scr.label_list); nd->u.scr.label_list = NULL; } } } - free(nd); + aFree(nd); nd = NULL; }else if(bl->type == BL_MOB && (md = (struct mob_data *)bl)){ if(md->lootitem){ - free(md->lootitem); + aFree(md->lootitem); md->lootitem = NULL; } - free(md); + aFree(md); md = NULL; }else if(bl->type == BL_PET && (pd = (struct pet_data *)bl)){ - free(pd); + aFree(pd); pd = NULL; } } } - + return 0; } -void ev_release(struct dbn *db, int which) +void ev_release(struct dbn *db, int which) { if (which & 0x1) - free(db->key); + aFree(db->key); if (which & 0x2) - free(db->data); + aFree(db->data); } /*========================================== @@ -2281,12 +2281,12 @@ int do_init_npc(void) npcname_db=strdb_init(24); ev_db->release = ev_release; - + memset(&ev_tm_b,-1,sizeof(ev_tm_b)); for(nsl=npc_src_first;nsl;nsl=nsl->next) { /*if(nsl->prev){ // [Shinomori] - free(nsl->prev); + aFree(nsl->prev); nsl->prev = NULL; }*/ fp=fopen(nsl->name,"r"); diff --git a/src/map/party.c b/src/map/party.c index 28f05bab9..3c3c12886 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -30,7 +30,7 @@ int party_send_xyhp_timer(int tid,unsigned int tick,int id,int data); */ static int party_db_final(void *key,void *data,va_list ap) { - free(data); + aFree(data); return 0; } void do_final_party(void) diff --git a/src/map/pc.c b/src/map/pc.c index 2954dfddf..c17e8677b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -87,11 +87,11 @@ int pc_isGM(struct map_session_data *sd) { if (p == NULL) return 0; return p->level;*/ - + //For console [Wizputer] if ( sd->fd == 0 ) return 99; - + for(i = 0; i < GM_num; i++) if (gm_account[i].account_id == sd->status.account_id) return gm_account[i].level; @@ -218,7 +218,7 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max) { sd->spiritball = 0; if(sd->spiritball >= max) { - if(sd->spirit_timer[0] != -1) + if(sd->spirit_timer[0] != -1) delete_timer(sd->spirit_timer[0],pc_spiritball_timer); memcpy( &sd->spirit_timer[0], &sd->spirit_timer[1], sizeof(sd->spirit_timer[0]) * (sd->spiritball - 1)); } else @@ -554,7 +554,7 @@ int pc_isequip(struct map_session_data *sd,int n) item = sd->inventory_data[n]; sc_data = battle_get_sc_data(&sd->bl); - //s_class = pc_calc_base_job(sd->status.class); + //s_class = pc_calc_base_job(sd->status.class_); if( battle_config.gm_allequip>0 && pc_isGM(sd)>=battle_config.gm_allequip ) return 1; @@ -599,7 +599,7 @@ int pc_break_equip(struct map_session_data *sd, unsigned short where) struct item_data* item; int i; int sc; - char output[255]; + char output[255]; if(sd == NULL) return -1; @@ -669,7 +669,7 @@ int pc_breakweapon(struct map_session_data *sd) return 1; } } - + return 0; } /*========================================== @@ -755,7 +755,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars sd->skillitem = -1; sd->skillitemlv = -1; sd->invincible_timer = -1; - + sd->deal_locked = 0; sd->trade_partner = 0; @@ -772,7 +772,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars sd->doridori_counter = 0; - sd->change_level = pc_readglobalreg(sd,"jobchange_level"); + sd->change_level = pc_readglobalreg(sd,"jobchange_level"); #ifndef TXT_ONLY // mail system [Valaris] if(battle_config.mail_system) @@ -790,7 +790,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars sd->dev.val1[i] = 0; sd->dev.val2[i] = 0; } - + // アカウント??の送信要求 intif_request_accountreg(sd); @@ -876,7 +876,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars sd->state.event_death = pc_readglobalreg(sd,"PCDieEvent"); sd->state.event_kill = pc_readglobalreg(sd,"PCKillEvent"); sd->state.event_disconnect = pc_readglobalreg(sd,"PCLogoffEvent"); - + if (night_flag == 1 && !map[sd->bl.m].flag.indoors) { char tmpstr[1024]; strcpy(tmpstr, msg_txt(500)); // Actually, it's the night... @@ -1016,7 +1016,7 @@ int pc_calc_skilltree(struct map_session_data *sd) for(i=0;istatus.skill[i].flag != 13) + if (sd->status.skill[i].flag != 13) sd->status.skill[i].id=0; if (sd->status.skill[i].flag && sd->status.skill[i].flag != 13){ // cardスキルなら、 sd->status.skill[i].lv=(sd->status.skill[i].flag==1)?0:sd->status.skill[i].flag-2; // 本?のlvに @@ -1030,13 +1030,13 @@ int pc_calc_skilltree(struct map_session_data *sd) sd->status.skill[i].id=i; for(i=210;i<291;i++) sd->status.skill[i].id=i; - for(i=304;i<337;i++){ + for(i=304;i<338;i++){ if(i==331) continue; sd->status.skill[i].id=i; } if(battle_config.enable_upper_class){ //confで無?でなければ?み?む - for(i=355;istatus.skill[i].id=i; + for(i=355;i<411;i++) + sd->status.skill[i].id=i; } }else{ do { @@ -1052,6 +1052,8 @@ int pc_calc_skilltree(struct map_session_data *sd) break; } } + if (id >= 2 && id <= 53 && pc_checkskill(sd, NV_BASIC) < 9) + f=0; } if(f && sd->status.skill[id].id==0 ){ sd->status.skill[id].id=id; @@ -1073,7 +1075,7 @@ int pc_calc_skilltree_normalize_job(int c, struct map_session_data *sd) { c = 0; //else if((sd->status.skill_point >= sd->status.job_level && skill_point < 58) && ((c > 6 && c < 23) || (c > 4007 && c < 4023) || (c > 4029 && c < 4045))) { //else if ((sd->status.skill_point >= sd->status.job_level && skill_point < 58) && (c > 6 && c < 23)) { - else if ((sd->status.skill_point >= sd->status.job_level && skill_point < sd->change_level+8) && (c > 6 && c < 23)) { + else if (sd->status.skill_point >= sd->status.job_level && ((sd->change_level > 0 && skill_point < sd->change_level+8) || skill_point < 58) && (c > 6 && c < 23)) { switch(c) { case 7: case 13: @@ -1178,7 +1180,7 @@ int pc_checkweighticon(struct map_session_data *sd) flag=1; if(sd->weight*10 >= sd->max_weight*9) flag=2; - + if(flag==1){ if(sd->sc_data[SC_WEIGHT50].timer==-1) skill_status_change_start(&sd->bl,SC_WEIGHT50,0,0,0,0,0,0); @@ -1670,6 +1672,16 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->paramb[5] += sd->status.luk+psd->status.luk/2 > 99 ? 99-sd->status.luk : psd->status.luk/2; } } + if(sd->sc_data[SC_GOSPEL].timer!=-1 && sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){ + if (sd->sc_data[SC_GOSPEL].val3 == 6) { + sd->paramb[0]+= 2; + sd->paramb[1]+= 2; + sd->paramb[2]+= 2; + sd->paramb[3]+= 2; + sd->paramb[4]+= 2; + sd->paramb[5]+= 2; + } + } } //1度も死んでないJob70スパノビに+10 @@ -1769,7 +1781,7 @@ int pc_calcstatus(struct map_session_data* sd,int first) else if (pc_isriding(sd)) { // ペコペコ?りによる速度?加 sd->speed -= (0.25 * DEFAULT_WALK_SPEED); sd->max_weight += 10000; - } + } if((skill=pc_checkskill(sd,CR_TRUST))>0) { // フェイス sd->status.max_hp += skill*200; sd->subele[6] += skill*5; @@ -1788,7 +1800,7 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->status.max_hp = sd->status.max_hp * 130/100; else if (s_class.upper==2) sd->status.max_hp = sd->status.max_hp * 70/100; - + if(sd->hprate!=100) sd->status.max_hp = sd->status.max_hp*sd->hprate/100; @@ -1910,6 +1922,13 @@ int pc_calcstatus(struct map_session_data* sd,int first) } if(sd->sc_data[SC_POISON].timer!=-1) // 毒?態 sd->def2 = sd->def2*75/100; + if(sd->sc_data[SC_CURSE].timer!=-1){ + sd->base_atk = sd->base_atk*75/100; + sd->watk = sd->watk*75/100; + index = sd->equip_index[8]; + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) + sd->watk_ = sd->watk_*75/100; + } if(sd->sc_data[SC_DRUMBATTLE].timer!=-1){ // ?太鼓の響き sd->watk += sd->sc_data[SC_DRUMBATTLE].val2; sd->def += sd->sc_data[SC_DRUMBATTLE].val3; @@ -2113,8 +2132,62 @@ int pc_calcstatus(struct map_session_data* sd,int first) sd->def = 100; if(sd->sc_data[SC_BARRIER].timer!=-1) sd->mdef = 100; + + if(sd->sc_data[SC_GOSPEL].timer!=-1) { + if (sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){ + switch (sd->sc_data[SC_GOSPEL].val3) + { + case 4: + sd->status.max_hp += sd->status.max_hp * 25 / 100; + if(sd->status.max_hp > battle_config.max_hp) + sd->status.max_hp = battle_config.max_hp; + break; + case 5: + sd->status.max_sp += sd->status.max_sp * 25 / 100; + if(sd->status.max_sp > battle_config.max_sp) + sd->status.max_sp = battle_config.max_sp; + break; + case 11: + sd->def += sd->def * 25 / 100; + sd->def2 += sd->def2 * 25 / 100; + break; + case 12: + sd->base_atk += sd->base_atk * 8 / 100; + break; + case 13: + sd->flee += sd->flee * 5 / 100; + break; + case 14: + sd->hit += sd->hit * 5 / 100; + break; + } + } else if (sd->sc_data[SC_GOSPEL].val4 == BCT_ENEMY){ + switch (sd->sc_data[SC_GOSPEL].val3) + { + case 5: + sd->def = 0; + sd->def2 = 0; + break; + case 6: + sd->base_atk = 0; + sd->watk = 0; + sd->watk2 = 0; + break; + case 7: + sd->flee = 0; + break; + case 8: + sd->speed_rate += 75; + aspd_rate += 75; + break; + } + } + } } + if (sd->speed_rate <= 0) + sd->speed_rate = 1; + if(sd->speed_rate != 100) sd->speed = sd->speed*sd->speed_rate/100; if(sd->speed < 1) sd->speed = 1; @@ -2216,7 +2289,7 @@ int pc_calcstatus(struct map_session_data* sd,int first) clif_updatestatus(sd,SP_CARTINFO);*/ //if(sd->status.hpstatus.max_hp>>2 && pc_checkskill(sd,SM_AUTOBERSERK)>0 && - if(sd->status.hpstatus.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 && + if(sd->status.hpstatus.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 && (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 ) && !pc_isdead(sd)) // オ?トバ?サ?ク?動 skill_status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0); @@ -2239,7 +2312,7 @@ int pc_calcspeed (struct map_session_data *sd) b_speed = sd->speed; sd->speed = DEFAULT_WALK_SPEED ; - + if(sd->sc_count){ if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){ // 速度?加 sd->speed -= sd->speed *25/100; @@ -2303,7 +2376,7 @@ int pc_calcspeed (struct map_session_data *sd) if(sd->speed_rate != 100) sd->speed = sd->speed*sd->speed_rate/100; if(sd->speed < 1) sd->speed = 1; - + if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) { sd->prev_speed = sd->speed; sd->speed = sd->speed*(175 - skill*5)/100; @@ -2932,7 +3005,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) if(sd->state.lr_flag !=2){ sd->random_attack_increase_add = type2; sd->random_attack_increase_per += val; - } + } break; case SP_WEAPON_ATK: if(sd->state.lr_flag != 2) @@ -3662,7 +3735,7 @@ int pc_item_refine(struct map_session_data *sd,int idx) int flag = 1, i = 0, ep = 0, per; int material[5] = { 0, 1010, 1011, 984, 984 }; struct item *item; - + nullpo_retr(0, sd); item = &sd->status.inventory[idx]; @@ -3681,7 +3754,7 @@ int pc_item_refine(struct map_session_data *sd,int idx) per = percentrefinery [itemdb_wlv (item->nameid)][(int)item->refine]; //per += pc_checkskill(sd,BS_WEAPONRESEARCH); per *= (75 + sd->status.job_level/2)/100; - + if (per > rand() % 100) { flag = 0; item->refine++; @@ -3691,7 +3764,7 @@ int pc_item_refine(struct map_session_data *sd,int idx) pc_unequipitem(sd,idx,3); } clif_refine(sd->fd,sd,0,idx,item->refine); - clif_delitem(sd,idx,1); + clif_delitem(sd,idx,1); clif_additem(sd,idx,1,0); if (ep) pc_equipitem(sd,idx,ep); @@ -3777,7 +3850,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl) if(itemid > 0 && itemdb_type(itemid) != 6) { rate = (mob_db[md->class_].dropitem[i].p / battle_config.item_rate_common * 100 * skill)/100; - + if(rand()%10000 < rate) { struct item tmp_item; @@ -3882,7 +3955,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt if(sd->sc_data[SC_DANCING].timer!=-1) // clear dance effect when warping [Valaris] skill_stop_dancing(&sd->bl,0); } - + if(sd->status.option&2) skill_status_change_end(&sd->bl, SC_HIDING, -1); if(sd->status.option&4) @@ -3894,7 +3967,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt pet_stopattack(sd->pd); pet_changestate(sd->pd,MS_IDLE,0); } - + if(sd->disguise) { // clear disguises when warping [Valaris] clif_clearchar(&sd->bl, 9); disguise=sd->disguise; @@ -4000,13 +4073,13 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt if(disguise) // disguise teleport fix [Valaris] sd->disguise=disguise; - + memcpy(sd->mapname,mapname,24); sd->bl.m = m; sd->to_x = x; sd->to_y = y; - // moved and changed dance effect stopping + // moved and changed dance effect stopping sd->bl.x = x; sd->bl.y = y; @@ -4336,19 +4409,19 @@ int pc_walktoxy(struct map_session_data *sd,int x,int y) if (sd->sc_data && sd->status.guild_id > 0) { struct skill_unit *su; struct skill_unit_group *sg; - if (sd->state.leadership_flag && (su=(struct skill_unit *)sd->state.leadership_flag) && + if (sd->state.leadership_flag && (su=(struct skill_unit *)sd->state.leadership_flag) && (sg=su->group) && sg->src_id == sd->bl.id) { skill_unit_move_unit_group(sg,sd->bl.m,(x - sd->bl.x),(y - sd->bl.y)); } - if (sd->state.glorywounds_flag && (su=(struct skill_unit *)sd->state.glorywounds_flag) && + if (sd->state.glorywounds_flag && (su=(struct skill_unit *)sd->state.glorywounds_flag) && (sg=su->group) && sg->src_id == sd->bl.id) { skill_unit_move_unit_group(sg,sd->bl.m,(x - sd->bl.x),(y - sd->bl.y)); } - if (sd->state.soulcold_flag && (su=(struct skill_unit *)sd->state.soulcold_flag) && + if (sd->state.soulcold_flag && (su=(struct skill_unit *)sd->state.soulcold_flag) && (sg=su->group) && sg->src_id == sd->bl.id) { skill_unit_move_unit_group(sg,sd->bl.m,(x - sd->bl.x),(y - sd->bl.y)); } - if (sd->state.hawkeyes_flag && (su=(struct skill_unit *)sd->state.hawkeyes_flag) && + if (sd->state.hawkeyes_flag && (su=(struct skill_unit *)sd->state.hawkeyes_flag) && (sg=su->group) && sg->src_id == sd->bl.id) { skill_unit_move_unit_group(sg,sd->bl.m,(x - sd->bl.x),(y - sd->bl.y)); } @@ -4392,7 +4465,7 @@ int pc_randomwalk(struct map_session_data *sd,int tick) { const int retrycount = 20; nullpo_retr(0, sd); - + if(DIFF_TICK(sd->next_walktime,tick)<0){ int i,x,y,d; d = rand()%7+5; @@ -4608,7 +4681,7 @@ struct pc_base_job pc_calc_base_job(int b_class) }else{ bj.type = 2; } - + return bj; } @@ -4624,7 +4697,7 @@ int pc_calc_base_job2 (int b_class) return b_class - 4001; else if(b_class == 4045) return 23; - return b_class - 4023; + return b_class - 4023; } int pc_calc_upper(int b_class) @@ -4668,8 +4741,12 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data) if(bl==NULL || bl->prev == NULL) return 0; - if(bl->type == BL_PC && pc_isdead((struct map_session_data *)bl)) - return 0; + if(bl->type == BL_PC) { + if (pc_isdead((struct map_session_data *)bl)) + return 0; + else if (pc_ishiding((struct map_session_data *)bl)) + return 0; + } // 同じmapでないなら攻?しない // PCが死んでても攻?しない @@ -4685,7 +4762,7 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data) return 0; if(sd->sc_data[SC_BLADESTOP].timer != -1) return 0; - } + } //if((opt = battle_get_option(bl)) != NULL && *opt&0x46) if((opt = battle_get_option(bl)) != NULL && *opt&0x42) @@ -4774,13 +4851,13 @@ int pc_attack(struct map_session_data *sd,int target_id,int type) return 1; sd->idletime = tick_; - + if(bl->type==BL_NPC) { // monster npcs [Valaris] //npc_click(sd,RFIFOL(sd->fd,2)); npc_click(sd,target_id); // submitted by leinsirk10 [Celest] return 0; } - + if(!battle_check_target(&sd->bl,bl,BCT_ENEMY)) return 1; if(sd->attacktimer != -1) @@ -4972,7 +5049,7 @@ int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp) sd->status.base_exp += base_exp; if(sd->status.base_exp < 0) sd->status.base_exp = 0; - + while(pc_checkbaselevelup(sd)) ; clif_updatestatus(sd,SP_BASEEXP); @@ -4985,13 +5062,13 @@ int pc_gainexp(struct map_session_data *sd,int base_exp,int job_exp) sd->status.job_exp += job_exp; if(sd->status.job_exp < 0) sd->status.job_exp = 0; - + while(pc_checkjoblevelup(sd)) ; clif_updatestatus(sd,SP_JOBEXP); if(battle_config.disp_experience){ - sprintf(output, + sprintf(output, "Experienced Gained Base:%d Job:%d",base_exp,job_exp); clif_disp_onlyself(sd,output,strlen(output)); } @@ -5124,7 +5201,7 @@ int pc_need_status_point(struct map_session_data *sd,int type) int pc_statusup(struct map_session_data *sd,int type) { int max, need,val = 0; - + nullpo_retr(0, sd); max = (pc_calc_upper(sd->status.class_)==2) ? 80 : battle_config.max_parameter; @@ -5326,17 +5403,21 @@ int pc_allskillup(struct map_session_data *sd) sd->status.skill[i].lv=skill_get_max(i); for(i=210;i<291;i++) sd->status.skill[i].lv=skill_get_max(i); - for(i=304;istatus.skill[i].lv=skill_get_max(i); } + if(battle_config.enable_upper_class){ //confで無?でなければ?み?む + for(i=355;i<411;i++) + sd->status.skill[i].id=i; + } } else { for(i=0;(id=skill_tree[s][c][i].id)>0;i++){ if(sd->status.skill[id].id==0 && (!(skill_get_inf2(id)&0x01) || battle_config.quest_skill_learn) ) { sd->status.skill[id].id = id; // celest // sd->status.skill[id].lv=skill_get_max(id); - sd->status.skill[id].lv = skill_tree_get_max(id, sd->status.class_); // celest + sd->status.skill[id].lv = skill_tree_get_max(id, sd->status.class_); // celest } } } @@ -5352,9 +5433,9 @@ int pc_allskillup(struct map_session_data *sd) int pc_resetlvl(struct map_session_data* sd,int type) { int i; - + nullpo_retr(0, sd); - + for(i=1;istatus.skill[i].lv = 0; } @@ -5395,7 +5476,7 @@ int pc_resetlvl(struct map_session_data* sd,int type) if(type == 4){ sd->status.job_level=1; sd->status.job_exp=0; - } + } clif_updatestatus(sd,SP_STATUSPOINT); clif_updatestatus(sd,SP_STR); @@ -5444,7 +5525,7 @@ int pc_resetstate(struct map_session_data* sd) sd->status.status_point = atoi (statp[sd->status.base_level - 1]); if(sd->status.class_ >= 4001 && sd->status.class_ <= 4024) sd->status.status_point+=52; // extra 52+48=100 stat points -// End addition +// End addition // Removed by Dexity - old count // add += sumsp(sd->status.str); @@ -5794,7 +5875,7 @@ int pc_readparam(struct map_session_data *sd,int type) { int val=0; struct pc_base_job s_class; - + s_class = pc_calc_base_job(sd->status.class_); nullpo_retr(0, sd); @@ -6208,12 +6289,12 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) int b_class = 0; //?生や養子の場合の元の職業を算出する struct pc_base_job s_class = pc_calc_base_job(sd->status.class_); - + nullpo_retr(0, sd); if (upper < 0 || upper > 2) //現在?生かどうかを判?する upper = s_class.upper; - + b_class = job; //通常職ならjobそのまんま if (job < 23) { if (upper == 1) @@ -6248,8 +6329,8 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) else sd->change_level = 0; - pc_setglobalreg (sd, "jobchange_level", sd->change_level); - + pc_setglobalreg (sd, "jobchange_level", sd->change_level); + sd->status.class_ = sd->view_class = b_class; sd->status.job_level=1; @@ -6276,12 +6357,12 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) clif_equiplist(sd); if(pc_isriding(sd)) { // remove peco status if changing into invalid class [Valaris] - if(!(pc_checkskill(sd,KN_RIDING))) + if(!(pc_checkskill(sd,KN_RIDING))) pc_setoption(sd,sd->status.option|-0x0000); if(pc_checkskill(sd,KN_RIDING)>0) pc_setriding(sd); } - + return 0; } @@ -6418,13 +6499,13 @@ int pc_setriding(struct map_session_data *sd) if(sd->status.class_==7) sd->status.class_=sd->view_class=13; - + if(sd->status.class_==14) sd->status.class_=sd->view_class=21; - + if(sd->status.class_==4008) sd->status.class_=sd->view_class=4014; - + if(sd->status.class_==4015) sd->status.class_=sd->view_class=4022; } @@ -6772,7 +6853,7 @@ int pc_eventtimer(int tid,unsigned int tick,int id,int data) break; } } - free((void *)data); + aFree((void *)data); if(i==MAX_EVENTTIMER) { if(battle_config.error_log) printf("pc_eventtimer: no such event timer\n"); @@ -6795,7 +6876,7 @@ int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name) if( sd->eventtimer[i]==-1 ) break; if(ieventtimer[i]=add_timer(gettick()+tick, pc_eventtimer,sd->bl.id,(int)evname); @@ -7035,7 +7116,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos) */ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { - nullpo_retr(0, sd); + nullpo_retr(0, sd); // -- moonsoul (if player is berserk then cannot unequip) // @@ -7243,7 +7324,7 @@ int pc_calc_pvprank(struct map_session_data *sd) nullpo_retr(0, sd); nullpo_retr(0, m=&map[sd->bl.m]); - + old=sd->pvp_rank; if( !(m->flag.pvp) ) @@ -7385,8 +7466,8 @@ static int pc_spheal(struct map_session_data *sd) if(gc) { struct guild *g; g=guild_search(sd->status.guild_id); - if(g && g->guild_id == gc->guild_id) - a += a; + if(g && g->guild_id == gc->guild_id) + a += a; } // end addition [Valaris] return a; @@ -7415,8 +7496,8 @@ static int pc_hpheal(struct map_session_data *sd) if(gc) { struct guild *g; g=guild_search(sd->status.guild_id); - if(g && g->guild_id == gc->guild_id) - a += a; + if(g && g->guild_id == gc->guild_id) + a += a; } // end addition [Valaris] return a; @@ -7680,8 +7761,8 @@ static int pc_natural_heal_sub(struct map_session_data *sd,va_list ap) { // -- moonsoul (if conditions below altered to disallow natural healing if under berserk status) if ((battle_config.natural_heal_weight_rate > 100 || sd->weight*100/sd->max_weight < battle_config.natural_heal_weight_rate) && - !pc_isdead(sd) && - !pc_ishiding(sd) && + !pc_isdead(sd) && + !pc_ishiding(sd) && //-- cannot regen for 5 minutes after using Berserk --- [Celest] DIFF_TICK (gettick(), sd->canregen_tick)>=0 && (sd->sc_data && !(sd->sc_data[SC_POISON].timer != -1 && sd->sc_data[SC_SLOWPOISON].timer == -1) && @@ -7746,7 +7827,7 @@ static int pc_autosave_sub(struct map_session_data *sd,va_list ap) { nullpo_retr(0, sd); - Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd); + Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd); if(save_flag==0 && sd->fd>last_save_fd){ struct guild_castle *gc=NULL; @@ -7807,10 +7888,10 @@ int pc_read_gm_account(int fd) int i = 0; #endif if (gm_account != NULL) - free(gm_account); + aFree(gm_account); GM_num = 0; #ifdef TXT_ONLY - gm_account = aCalloc(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1); + gm_account = aCallocA(sizeof(struct gm_account) * ((RFIFOW(fd,2) - 4) / 5), 1); for (i = 4; i < RFIFOW(fd,2); i = i + 5) { gm_account[GM_num].account_id = RFIFOL(fd,i); gm_account[GM_num].level = (int)RFIFOB(fd,i+4); @@ -7824,7 +7905,7 @@ int pc_read_gm_account(int fd) } lsql_res = mysql_store_result(&lmysql_handle); if (lsql_res) { - gm_account = aCalloc(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1); + gm_account = aCallocA(sizeof(struct gm_account) * mysql_num_rows(lsql_res), 1); while ((lsql_row = mysql_fetch_row(lsql_res))) { gm_account[GM_num].account_id = atoi(lsql_row[0]); gm_account[GM_num].level = atoi(lsql_row[1]); @@ -7832,7 +7913,7 @@ int pc_read_gm_account(int fd) GM_num++; } } - + mysql_free_result(lsql_res); #endif /* TXT_ONLY */ return GM_num; @@ -7926,7 +8007,7 @@ int pc_readdb(void) char line[1024],*p; // 必要??値?み?み - + memset(exp_table,0,sizeof(exp_table)); fp=fopen("db/exp.txt","r"); if(fp==NULL){ printf("can't read db/exp.txt\n"); @@ -7997,6 +8078,7 @@ int pc_readdb(void) ShowStatus(tmp_output); // JOBボ?ナス + memset(job_bonus,0,sizeof(job_bonus)); fp=fopen("db/job_db2.txt","r"); if(fp==NULL){ printf("can't read db/job_db2.txt\n"); @@ -8076,7 +8158,7 @@ int pc_readdb(void) for(j=0;skill_tree[u][i][j].id;j++); skill_tree[u][i][j].id=atoi(split[1]); skill_tree[u][i][j].max=atoi(split[2]); - + //not required - Celest //skill_tree[2][i][j].id=atoi(split[1]); //養子職は良く分からないので暫定 //skill_tree[2][i][j].max=atoi(split[2]); //養子職は良く分からないので暫定 @@ -8242,7 +8324,7 @@ static void pc_statpointdb(void) end = ftell(stp); rewind(stp); - buf_stat = (char *) malloc (end + 1); + buf_stat = (char *) aMallocA (end + 1); l = fread(buf_stat,1,end,stp); fclose(stp); sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/statpoint.txt"); @@ -8251,7 +8333,7 @@ static void pc_statpointdb(void) for(i=0;i<255;i++) { j=0; - while (*(buf_stat+k)!='\n') { + while (*(buf_stat+k)!='\n') { statp[i][j]=*(buf_stat+k); j++;k++; } @@ -8259,7 +8341,7 @@ static void pc_statpointdb(void) k++; } - free(buf_stat); + aFree(buf_stat); } /*========================================== diff --git a/src/map/pet.c b/src/map/pet.c index c198c1fb5..99f2a4d95 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -1376,7 +1376,7 @@ int pet_lootitem_drop(struct pet_data *pd,struct map_session_data *sd) clif_additem(sd,0,0,flag); map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0); } - free(ditem); + aFree(ditem); } else add_timer(gettick()+540+i,pet_delay_item_drop2,(int)ditem,0); @@ -1399,7 +1399,7 @@ int pet_delay_item_drop2(int tid,unsigned int tick,int id,int data) map_addflooritem(&ditem->item_data,ditem->item_data.amount,ditem->m,ditem->x,ditem->y,ditem->first_sd,ditem->second_sd,ditem->third_sd,0); - free(ditem); + aFree(ditem); return 0; } diff --git a/src/map/script.c b/src/map/script.c index a6b65e213..35645eaab 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -507,7 +507,7 @@ struct { {buildin_npctalk,"npctalk","*"}, // [Valaris] {buildin_hasitems,"hasitems","*"}, // [Valaris] {buildin_mobcount,"mobcount","ss"}, - {buildin_getlook,"getlook","i"}, + {buildin_getlook,"getlook","i"}, {buildin_getsavepoint,"getsavepoint","i"}, {buildin_npcspeed,"npcspeed","i"}, // [Valaris] {buildin_npcwalkto,"npcwalkto","ii"}, // [Valaris] @@ -576,14 +576,14 @@ static int add_str(const unsigned char *p) int i; char *lowcase; - lowcase=strdup(p); + lowcase=aStrdup(p); for(i=0;lowcase[i];i++) lowcase[i]=tolower(lowcase[i]); if((i=search_str(lowcase))>=0){ - free(lowcase); + aFree(lowcase); return i; } - free(lowcase); + aFree(lowcase); i=calc_hash(p); if(str_hash[i]==0){ @@ -605,7 +605,7 @@ static int add_str(const unsigned char *p) str_data=aRealloc(str_data,sizeof(str_data[0])*str_data_size); memset(str_data + (str_data_size - 128), '\0', 128); } - while(str_pos+strlen(p)+1>=str_size){ + while(str_pos+(int)strlen(p)+1>=str_size){ str_size+=256; str_buf=(char *)aRealloc(str_buf,str_size); memset(str_buf + (str_size - 256), '\0', 256); @@ -1159,7 +1159,7 @@ unsigned char* parse_script(unsigned char *src,int line) read_constdb(); } first=0; - script_buf=(unsigned char *)aCalloc(SCRIPT_BLOCK_SIZE,sizeof(unsigned char)); + script_buf=(unsigned char *)aCallocA(SCRIPT_BLOCK_SIZE,sizeof(unsigned char)); script_pos=0; script_size=SCRIPT_BLOCK_SIZE; str_data[LABEL_NEXTLINE].type=C_NOP; @@ -1395,7 +1395,7 @@ char* conv_str(struct script_state *st,struct script_data *data) get_val(st,data); if(data->type==C_INT){ char *buf; - buf=(char *)aCalloc(16,sizeof(char)); + buf=(char *)aCallocA(16,sizeof(char)); sprintf(buf,"%d",data->u.num); data->type=C_STR; data->u.str=buf; @@ -1421,7 +1421,7 @@ int conv_num(struct script_state *st,struct script_data *data) p=data->u.str; data->u.num = atoi(p); if(data->type==C_STR) - free(p); + aFree(p); data->type=C_INT; } return data->u.num; @@ -1478,7 +1478,7 @@ void push_copy(struct script_stack *stack,int pos) push_str(stack,C_CONSTSTR,stack->stack_data[pos].u.str); break; case C_STR: - push_str(stack,C_STR,strdup(stack->stack_data[pos].u.str)); + push_str(stack,C_STR,aStrdup(stack->stack_data[pos].u.str)); break; default: push_val(stack,stack->stack_data[pos].type,stack->stack_data[pos].u.num); @@ -1495,7 +1495,7 @@ void pop_stack(struct script_stack* stack,int start,int end) int i; for(i=start;istack_data[i].type==C_STR){ - free(stack->stack_data[i].u.str); + aFree(stack->stack_data[i].u.str); } } if(stack->sp>end){ @@ -1663,7 +1663,7 @@ int buildin_menu(struct script_state *st) char *buf; int len,i; struct map_session_data *sd; - + sd=script_rid2sd(st); if(sd->state.menu_or_input==0){ @@ -1673,14 +1673,14 @@ int buildin_menu(struct script_state *st) conv_str(st,& (st->stack->stack_data[i])); len+=strlen(st->stack->stack_data[i].u.str)+1; } - buf=(char *)aCalloc(len,sizeof(char)); + buf=(char *)aCallocA(len,sizeof(char)); buf[0]=0; for(i=st->start+2,len=0;iend;i+=2){ strcat(buf,st->stack->stack_data[i].u.str); strcat(buf,":"); } clif_scriptmenu(script_rid2sd(st),st->oid,buf); - free(buf); + aFree(buf); } else if(sd->npc_menu==0xff){ // cansel sd->state.menu_or_input=0; st->state=END; @@ -2522,7 +2522,7 @@ int buildin_delitem(struct script_state *st) if(sd->inventory_data[i]->type==7 && sd->status.inventory[i].card[0] == (short)0xff00 && search_petDB_index(nameid, PET_EGG) >= 0 ){ intif_delete_petdata(*((long *)(&sd->status.inventory[i].card[1]))); //clear egg flag. so it won't be put in IMPORTANT items (eggs look like item with 2 cards ^_^) - sd->status.inventory[i].card[1] = sd->status.inventory[i].card[0] = 0; + sd->status.inventory[i].card[1] = sd->status.inventory[i].card[0] = 0; //now this egg'll be deleted as a common unimportant item } //is this item important? does it have cards? or Player's name? or Refined/Upgraded @@ -2551,7 +2551,7 @@ int buildin_delitem(struct script_state *st) continue; if(sd->status.inventory[i].amount>=amount){ - pc_delitem(sd,i,amount,0); + pc_delitem(sd,i,amount,0); return 0; //we deleted exact amount of items. now exit } else { amount-=sd->status.inventory[i].amount; @@ -2627,7 +2627,7 @@ char *buildin_getpartyname_sub(int party_id) if(p!=NULL){ char *buf; - buf=(char *)aCalloc(24,sizeof(char)); + buf=(char *)aCallocA(24,sizeof(char)); strcpy(buf,p->name); return buf; } @@ -2684,7 +2684,7 @@ char *buildin_getguildname_sub(int guild_id) if(g!=NULL){ char *buf; - buf=(char *)aCalloc(24,sizeof(char)); + buf=(char *)aCallocA(24,sizeof(char)); strcpy(buf,g->name); return buf; } @@ -2713,7 +2713,7 @@ char *buildin_getguildmaster_sub(int guild_id) if(g!=NULL){ char *buf; - buf=(char *)aCalloc(24,sizeof(char)); + buf=(char *)aCallocA(24,sizeof(char)); strncpy(buf,g->master, 23); return buf; } @@ -2763,7 +2763,7 @@ int buildin_strcharinfo(struct script_state *st) num=conv_num(st,& (st->stack->stack_data[st->start+2])); if(num==0){ char *buf; - buf=(char *)aCalloc(24,sizeof(char)); + buf=(char *)aCallocA(24,sizeof(char)); strncpy(buf,sd->status.name, 23); push_str(st->stack,C_STR,buf); } @@ -2830,7 +2830,7 @@ int buildin_getequipname(struct script_state *st) struct item_data* item; char *buf; - buf=(char *)aCalloc(64,sizeof(char)); + buf=(char *)aCallocA(64,sizeof(char)); sd=script_rid2sd(st); num=conv_num(st,& (st->stack->stack_data[st->start+2])); i=pc_checkequip(sd,equip[num-1]); @@ -2856,9 +2856,9 @@ int buildin_getbrokenid(struct script_state *st) { int i,num,id=0,brokencounter=0; struct map_session_data *sd; - + sd=script_rid2sd(st); - + num=conv_num(st,& (st->stack->stack_data[st->start+2])); for(i=0; istatus.inventory[i].attribute==1){ @@ -2869,7 +2869,7 @@ int buildin_getbrokenid(struct script_state *st) } } } - + push_val(st->stack,C_INT,id); return 0; @@ -2887,7 +2887,7 @@ int buildin_repair(struct script_state *st) sd=script_rid2sd(st); - + num=conv_num(st,& (st->stack->stack_data[st->start+2])); for(i=0; istatus.inventory[i].attribute==1){ @@ -2941,7 +2941,7 @@ int buildin_getequipisenableref(struct script_state *st) i=pc_checkequip(sd,equip[num-1]); if(i >= 0 && num<7 && sd->inventory_data[i] && !sd->inventory_data[i]->flag.no_refine) // replaced by Celest - /*(num!=1 + /*(num!=1 || sd->inventory_data[i]->def > 1 || (sd->inventory_data[i]->def==1 && sd->inventory_data[i]->equip_script==NULL) || (sd->inventory_data[i]->def<=0 && sd->inventory_data[i]->equip_script!=NULL)))*/ @@ -3245,15 +3245,15 @@ int buildin_getskilllv(struct script_state *st) return 0; } /*========================================== - * getgdskilllv(Guild_ID, Skill_ID); - * skill_id = 10000 : GD_APPROVAL - * 10001 : GD_KAFRACONTACT - * 10002 : GD_GUARDIANRESEARCH - * 10003 : GD_GUARDUP - * 10004 : GD_EXTENSION + * getgdskilllv(Guild_ID, Skill_ID); + * skill_id = 10000 : GD_APPROVAL + * 10001 : GD_KAFRACONTACT + * 10002 : GD_GUARDIANRESEARCH + * 10003 : GD_GUARDUP + * 10004 : GD_EXTENSION *------------------------------------------ */ -int buildin_getgdskilllv(struct script_state *st) +int buildin_getgdskilllv(struct script_state *st) { int guild_id=conv_num(st,& (st->stack->stack_data[st->start+2])); int skill_id=conv_num(st,& (st->stack->stack_data[st->start+3])); @@ -3590,7 +3590,7 @@ int buildin_gettimestr(struct script_state *st) fmtstr=conv_str(st,& (st->stack->stack_data[st->start+2])); maxlen=conv_num(st,& (st->stack->stack_data[st->start+3])); - tmpstr=(char *)aCalloc(maxlen+1,sizeof(char)); + tmpstr=(char *)aCallocA(maxlen+1,sizeof(char)); strftime(tmpstr,maxlen,fmtstr,localtime(&now)); tmpstr[maxlen]='\0'; @@ -3677,8 +3677,8 @@ int buildin_makepet(struct script_state *st) sd->catch_target_class = pet_db[pet_id].class_; intif_create_pet( sd->status.account_id, sd->status.char_id, - pet_db[pet_id].class_, mob_db[pet_db[pet_id].class_].lv, - pet_db[pet_id].EggID, 0, pet_db[pet_id].intimate, + (short)pet_db[pet_id].class_, (short)mob_db[pet_db[pet_id].class_].lv, + (short)pet_db[pet_id].EggID, 0, (short)pet_db[pet_id].intimate, 100, 0, 1, pet_db[pet_id].jname); } @@ -3727,19 +3727,19 @@ int buildin_guildgetexp(struct script_state *st) */ int buildin_monster(struct script_state *st) { - int class,amount,x,y; + int class_,amount,x,y; char *str,*map,*event=""; map =conv_str(st,& (st->stack->stack_data[st->start+2])); x =conv_num(st,& (st->stack->stack_data[st->start+3])); y =conv_num(st,& (st->stack->stack_data[st->start+4])); str =conv_str(st,& (st->stack->stack_data[st->start+5])); - class=conv_num(st,& (st->stack->stack_data[st->start+6])); + class_=conv_num(st,& (st->stack->stack_data[st->start+6])); amount=conv_num(st,& (st->stack->stack_data[st->start+7])); if( st->end>st->start+8 ) event=conv_str(st,& (st->stack->stack_data[st->start+8])); - mob_once_spawn(map_id2sd(st->rid),map,x,y,str,class,amount,event); + mob_once_spawn(map_id2sd(st->rid),map,x,y,str,class_,amount,event); return 0; } /*========================================== @@ -3748,7 +3748,7 @@ int buildin_monster(struct script_state *st) */ int buildin_areamonster(struct script_state *st) { - int class,amount,x0,y0,x1,y1; + int class_,amount,x0,y0,x1,y1; char *str,*map,*event=""; map =conv_str(st,& (st->stack->stack_data[st->start+2])); @@ -3757,12 +3757,12 @@ int buildin_areamonster(struct script_state *st) x1 =conv_num(st,& (st->stack->stack_data[st->start+5])); y1 =conv_num(st,& (st->stack->stack_data[st->start+6])); str =conv_str(st,& (st->stack->stack_data[st->start+7])); - class=conv_num(st,& (st->stack->stack_data[st->start+8])); + class_=conv_num(st,& (st->stack->stack_data[st->start+8])); amount=conv_num(st,& (st->stack->stack_data[st->start+9])); if( st->end>st->start+10 ) event=conv_str(st,& (st->stack->stack_data[st->start+10])); - mob_once_spawn_area(map_id2sd(st->rid),map,x0,y0,x1,y1,str,class,amount,event); + mob_once_spawn_area(map_id2sd(st->rid),map,x0,y0,x1,y1,str,class_,amount,event); return 0; } /*========================================== @@ -3974,7 +3974,7 @@ int buildin_attachnpctimer(struct script_state *st) struct map_session_data *sd; struct npc_data *nd; - nd=(struct npc_data *)map_id2bl(st->oid); + nd=(struct npc_data *)map_id2bl(st->oid); if( st->end > st->start+2 ) { char *name = conv_str(st,& (st->stack->stack_data[st->start+2])); sd=map_nick2sd(name); @@ -4270,7 +4270,7 @@ int buildin_sc_start(struct script_state *st) bl = map_id2bl(conv_num(st,& (st->stack->stack_data[st->start+5]))); else bl = map_id2bl(st->rid); - + if (bl != 0) { if(bl->type == BL_PC && ((struct map_session_data *)bl)->state.potionpitcher_flag) bl = map_id2bl(((struct map_session_data *)bl)->skilltarget); @@ -5101,7 +5101,7 @@ int buildin_getcastlename(struct script_state *st) for(i=0;imap_name)==0){ - buf=(char *)aCalloc(24,sizeof(char)); + buf=(char *)aCallocA(24,sizeof(char)); strncpy(buf,gc->castle_name,24); break; } @@ -5343,8 +5343,8 @@ int buildin_failedremovecards(struct script_state *st) if( (sd->status.inventory[i].card[c-1] > 4000 && sd->status.inventory[i].card[c-1] < 5000) || itemdb_type(sd->status.inventory[i].card[c-1]) == 6){ // [Celest] - - cardflag = 1; + + cardflag = 1; if(typefail == 2){ // 武具のみ損失なら、カードは受け取らせる item_tmp.id=0,item_tmp.nameid=sd->status.inventory[i].card[c-1]; @@ -5561,39 +5561,39 @@ int buildin_strmobinfo(struct script_state *st) { int num=conv_num(st,& (st->stack->stack_data[st->start+2])); - int class=conv_num(st,& (st->stack->stack_data[st->start+3])); + int class_=conv_num(st,& (st->stack->stack_data[st->start+3])); - if(num<=0 || num>=8 || (class>=0 && class<=1000) || class >2000) + if(num<=0 || num>=8 || (class_>=0 && class_<=1000) || class_ >2000) return 0; if(num==1) { char *buf; - buf=aCalloc(24, 1); -// buf=mob_db[class].name; + buf=aCallocA(24, 1); +// buf=mob_db[class_].name; // for string assignments you would need to go for c++ [Shinomori] - strcpy(buf,mob_db[class].name); + strcpy(buf,mob_db[class_].name); push_str(st->stack,C_STR,buf); return 0; } else if(num==2) { char *buf; - buf=aCalloc(24, 1); -// buf=mob_db[class].jname; + buf=aCallocA(24, 1); +// buf=mob_db[class_].jname; // for string assignments you would need to go for c++ [Shinomori] - strcpy(buf,mob_db[class].jname); + strcpy(buf,mob_db[class_].jname); push_str(st->stack,C_STR,buf); return 0; } else if(num==3) - push_val(st->stack,C_INT,mob_db[class].lv); + push_val(st->stack,C_INT,mob_db[class_].lv); else if(num==4) - push_val(st->stack,C_INT,mob_db[class].max_hp); + push_val(st->stack,C_INT,mob_db[class_].max_hp); else if(num==5) - push_val(st->stack,C_INT,mob_db[class].max_sp); + push_val(st->stack,C_INT,mob_db[class_].max_sp); else if(num==6) - push_val(st->stack,C_INT,mob_db[class].base_exp); + push_val(st->stack,C_INT,mob_db[class_].base_exp); else if(num==7) - push_val(st->stack,C_INT,mob_db[class].job_exp); + push_val(st->stack,C_INT,mob_db[class_].job_exp); return 0; } @@ -5603,20 +5603,20 @@ int buildin_strmobinfo(struct script_state *st) */ int buildin_guardian(struct script_state *st) { - int class=0,amount=1,x=0,y=0,guardian=0; + int class_=0,amount=1,x=0,y=0,guardian=0; char *str,*map,*event=""; map =conv_str(st,& (st->stack->stack_data[st->start+2])); x =conv_num(st,& (st->stack->stack_data[st->start+3])); y =conv_num(st,& (st->stack->stack_data[st->start+4])); str =conv_str(st,& (st->stack->stack_data[st->start+5])); - class=conv_num(st,& (st->stack->stack_data[st->start+6])); + class_=conv_num(st,& (st->stack->stack_data[st->start+6])); amount=conv_num(st,& (st->stack->stack_data[st->start+7])); event=conv_str(st,& (st->stack->stack_data[st->start+8])); if( st->end>st->start+9 ) guardian=conv_num(st,& (st->stack->stack_data[st->start+9])); - mob_spawn_guardian(map_id2sd(st->rid),map,x,y,str,class,amount,event,guardian); + mob_spawn_guardian(map_id2sd(st->rid),map,x,y,str,class_,amount,event,guardian); return 0; } @@ -5657,7 +5657,7 @@ int buildin_getitemname(struct script_state *st) i_data = NULL; i_data = itemdb_search(item_id); - item_name=(char *)aCalloc(24,sizeof(char)); + item_name=(char *)aCallocA(24,sizeof(char)); strncpy(item_name,i_data->jname,23); push_str(st->stack,C_STR,item_name); @@ -5671,12 +5671,12 @@ int buildin_getitemname(struct script_state *st) int buildin_petskillbonus(struct script_state *st) { - int type,val,duration,timer; + int type,val,duration,timer; struct pet_data *pd; - struct map_session_data *sd=script_rid2sd(st); + struct map_session_data *sd=script_rid2sd(st); - if(sd==NULL || sd->pd==NULL) + if(sd==NULL || sd->pd==NULL) return 0; pd=sd->pd; @@ -5691,7 +5691,7 @@ int buildin_petskillbonus(struct script_state *st) pd->skillbonusduration=-1; pd->skillbonustimer=-1; - + pet_skill_bonus(sd,pd,type,val,duration,timer,0); return 0; @@ -5719,7 +5719,7 @@ int buildin_petloot(struct script_state *st) if(!max) return 0; - + pd->loot=1; pd->lootmax=max; @@ -5790,14 +5790,14 @@ int buildin_clearitem(struct script_state *st) */ int buildin_classchange(struct script_state *st) { - int class,type; + int _class,type; struct block_list *bl=map_id2bl(st->oid); - + if(bl==NULL) return 0; - class=conv_num(st,& (st->stack->stack_data[st->start+2])); + _class=conv_num(st,& (st->stack->stack_data[st->start+2])); type=conv_num(st,& (st->stack->stack_data[st->start+3])); - clif_class_change(bl,class,type); + clif_class_change(bl,_class,type); return 0; } @@ -5867,9 +5867,9 @@ int buildin_petrecovery(struct script_state *st) { struct pet_data *pd; - struct map_session_data *sd=script_rid2sd(st); + struct map_session_data *sd=script_rid2sd(st); - if(sd==NULL || sd->pd==NULL) + if(sd==NULL || sd->pd==NULL) return 0; pd=sd->pd; @@ -5893,9 +5893,9 @@ int buildin_petheal(struct script_state *st) { struct pet_data *pd; - struct map_session_data *sd=script_rid2sd(st); + struct map_session_data *sd=script_rid2sd(st); - if(sd==NULL || sd->pd==NULL) + if(sd==NULL || sd->pd==NULL) return 0; pd=sd->pd; @@ -5911,7 +5911,7 @@ int buildin_petheal(struct script_state *st) return 0; } - + /*========================================== * pet magnificat [Valaris] *------------------------------------------ @@ -5919,9 +5919,9 @@ int buildin_petheal(struct script_state *st) int buildin_petmag(struct script_state *st) { struct pet_data *pd; - struct map_session_data *sd=script_rid2sd(st); + struct map_session_data *sd=script_rid2sd(st); - if(sd==NULL || sd->pd==NULL) + if(sd==NULL || sd->pd==NULL) return 0; pd=sd->pd; @@ -5946,9 +5946,9 @@ int buildin_petmag(struct script_state *st) int buildin_petskillattack(struct script_state *st) { struct pet_data *pd; - struct map_session_data *sd=script_rid2sd(st); + struct map_session_data *sd=script_rid2sd(st); - if(sd==NULL || sd->pd==NULL) + if(sd==NULL || sd->pd==NULL) return 0; pd=sd->pd; @@ -5957,7 +5957,7 @@ int buildin_petskillattack(struct script_state *st) return 0; pd->skilltype=conv_num(st,& (st->stack->stack_data[st->start+2])); - pd->skillval=conv_num(st,& (st->stack->stack_data[st->start+3])); + pd->skillval=conv_num(st,& (st->stack->stack_data[st->start+3])); pd->skillduration=conv_num(st,& (st->stack->stack_data[st->start+4])); pd->skilltimer=conv_num(st,& (st->stack->stack_data[st->start+5])); @@ -5973,11 +5973,11 @@ int buildin_petskillattack(struct script_state *st) int buildin_skilleffect(struct script_state *st) { struct map_session_data *sd; - + int skillid=conv_num(st,& (st->stack->stack_data[st->start+2])); int skilllv=conv_num(st,& (st->stack->stack_data[st->start+3])); sd=script_rid2sd(st); - + clif_skill_nodamage(&sd->bl,&sd->bl,skillid,skilllv,1); return 0; @@ -5990,9 +5990,9 @@ int buildin_skilleffect(struct script_state *st) int buildin_npcskilleffect(struct script_state *st) { struct npc_data *nd=(struct npc_data *)map_id2bl(st->oid); - + int skillid=conv_num(st,& (st->stack->stack_data[st->start+2])); - int skilllv=conv_num(st,& (st->stack->stack_data[st->start+3])); + int skilllv=conv_num(st,& (st->stack->stack_data[st->start+3])); int x=conv_num(st,& (st->stack->stack_data[st->start+4])); int y=conv_num(st,& (st->stack->stack_data[st->start+5])); @@ -6036,13 +6036,13 @@ int buildin_specialeffect2(struct script_state *st) int buildin_nude(struct script_state *st) { - struct map_session_data *sd=script_rid2sd(st); + struct map_session_data *sd=script_rid2sd(st); int i; if(sd==NULL) return 0; - - for(i=0;i<11;i++) + + for(i=0;i<11;i++) if(sd->equip_index[i] >= 0) pc_unequipitem(sd,sd->equip_index[i],2); @@ -6118,7 +6118,7 @@ int buildin_message(struct script_state *st) * area) [Valaris] *------------------------------------------ */ - + int buildin_npctalk(struct script_state *st) { char *str; @@ -6148,16 +6148,16 @@ int buildin_hasitems(struct script_state *st) { int i; struct map_session_data *sd; - + sd=script_rid2sd(st); - + for(i=0; istatus.inventory[i].amount) { push_val(st->stack,C_INT,1); return 0; } } - + push_val(st->stack,C_INT,0); return 0; @@ -6262,7 +6262,7 @@ int buildin_getsavepoint(struct script_state *st) sd=script_rid2sd(st); type=conv_num(st,& (st->stack->stack_data[st->start+2])); - mapname=aCalloc(24, 1); + mapname=aCallocA(24, 1); x=sd->status.save_point.x; y=sd->status.save_point.y; @@ -6331,7 +6331,7 @@ int buildin_getmapxy(struct script_state *st){ //??????????? >>> Possible needly check function parameters on C_STR,C_INT,C_INT <<< ???????????// type=conv_num(st,& (st->stack->stack_data[st->start+5])); - mapname=aCalloc(24, 1); + mapname=aCallocA(24, 1); switch (type){ case 0: //Get Character Position @@ -6363,7 +6363,7 @@ int buildin_getmapxy(struct script_state *st){ } x=nd->bl.x; - y=nd->bl.y; + y=nd->bl.y; strncpy(mapname,map[nd->bl.m].name,24); printf(">>>>%s %d %d\n",mapname,x,y); break; @@ -6385,7 +6385,7 @@ int buildin_getmapxy(struct script_state *st){ return 0; } x=pd->bl.x; - y=pd->bl.y; + y=pd->bl.y; strncpy(mapname,map[pd->bl.m].name,24); printf(">>>>%s %d %d\n",mapname,x,y); @@ -6491,7 +6491,7 @@ int buildin_logmes(struct script_state *st) int buildin_summon(struct script_state *st) { - int class, id; + int _class, id; char *str,*event=""; struct map_session_data *sd; struct mob_data *md; @@ -6500,11 +6500,11 @@ int buildin_summon(struct script_state *st) if (sd) { int tick = gettick(); str =conv_str(st,& (st->stack->stack_data[st->start+2])); - class=conv_num(st,& (st->stack->stack_data[st->start+3])); + _class=conv_num(st,& (st->stack->stack_data[st->start+3])); if( st->end>st->start+4 ) event=conv_str(st,& (st->stack->stack_data[st->start+4])); - id=mob_once_spawn(sd, "this", 0, 0, str,class,1,event); + id=mob_once_spawn(sd, "this", 0, 0, str,_class,1,event); if((md=(struct mob_data *)map_id2bl(id))){ md->master_id=sd->bl.id; md->state.special_mob_ai=1; @@ -6608,14 +6608,14 @@ void op_add(struct script_state* st) st->stack->stack_data[st->stack->sp-1].u.num += st->stack->stack_data[st->stack->sp].u.num; } else { // ssの予定 char *buf; - buf=(char *)aCalloc(strlen(st->stack->stack_data[st->stack->sp-1].u.str)+ + buf=(char *)aCallocA(strlen(st->stack->stack_data[st->stack->sp-1].u.str)+ strlen(st->stack->stack_data[st->stack->sp].u.str)+1,sizeof(char)); strcpy(buf,st->stack->stack_data[st->stack->sp-1].u.str); strcat(buf,st->stack->stack_data[st->stack->sp].u.str); if(st->stack->stack_data[st->stack->sp-1].type==C_STR) - free(st->stack->stack_data[st->stack->sp-1].u.str); + aFree(st->stack->stack_data[st->stack->sp-1].u.str); if(st->stack->stack_data[st->stack->sp].type==C_STR) - free(st->stack->stack_data[st->stack->sp].u.str); + aFree(st->stack->stack_data[st->stack->sp].u.str); st->stack->stack_data[st->stack->sp-1].type=C_STR; st->stack->stack_data[st->stack->sp-1].u.str=buf; } @@ -6657,8 +6657,8 @@ void op_2str(struct script_state *st,int op,int sp1,int sp2) push_val(st->stack,C_INT,a); - if(st->stack->stack_data[sp1].type==C_STR) free(s1); - if(st->stack->stack_data[sp2].type==C_STR) free(s2); + if(st->stack->stack_data[sp1].type==C_STR) aFree(s1); + if(st->stack->stack_data[sp2].type==C_STR) aFree(s2); } /*========================================== * 二項演算子(数値) @@ -6672,7 +6672,11 @@ void op_2num(struct script_state *st,int op,int i1,int i2) break; case C_MUL: { + #ifndef _MSC_VER long long res = i1 * i2; + #else + __int64 res = i1 * i2; + #endif if (res > 2147483647 ) i1 = 2147483647; else @@ -6988,7 +6992,7 @@ int run_script_main(unsigned char *script,int pos,int rid,int oid,struct script_ struct map_session_data *sd=map_id2sd(st->rid); if(sd/* && sd->npc_stackbuf==NULL*/){ if( sd->npc_stackbuf ) - free( sd->npc_stackbuf ); + aFree( sd->npc_stackbuf ); sd->npc_stackbuf = (char *)aCalloc(sizeof(stack->stack_data[0])*stack->sp_max,sizeof(char)); memcpy(sd->npc_stackbuf, stack->stack_data, sizeof(stack->stack_data[0]) * stack->sp_max); sd->npc_stack = stack->sp; @@ -7022,7 +7026,7 @@ int run_script(unsigned char *script,int pos,int rid,int oid) stack.sp_max=sd->npc_stackmax; stack.stack_data=(struct script_data *)aCalloc(stack.sp_max,sizeof(stack.stack_data[0])); memcpy(stack.stack_data,sd->npc_stackbuf,sizeof(stack.stack_data[0])*stack.sp_max); - free(sd->npc_stackbuf); + aFree(sd->npc_stackbuf); sd->npc_stackbuf=NULL; }else{ // スタック初期化 @@ -7036,7 +7040,7 @@ int run_script(unsigned char *script,int pos,int rid,int oid) st.oid=oid; run_script_main(script,pos,rid,oid,&st,rootscript); - free(stack.stack_data); + aFree(stack.stack_data); stack.stack_data=NULL; return st.pos; } @@ -7065,14 +7069,14 @@ int mapreg_setregstr(int num,const char *str) char *p; if( (p=numdb_search(mapregstr_db,num))!=NULL ) - free(p); + aFree(p); if( str==NULL || *str==0 ){ numdb_erase(mapregstr_db,num); mapreg_dirty=1; return 0; } - p=(char *)aCalloc(strlen(str)+1, sizeof(char)); + p=(char *)aCallocA(strlen(str)+1, sizeof(char)); strcpy(p,str); numdb_insert(mapregstr_db,num,p); mapreg_dirty=1; @@ -7102,7 +7106,7 @@ static int script_load_mapreg() printf("%s: %s broken data !\n",mapreg_txt,buf1); continue; } - p=(char *)aCalloc(strlen(buf2) + 1,sizeof(char)); + p=(char *)aCallocA(strlen(buf2) + 1,sizeof(char)); strcpy(p,buf2); s=add_str(buf1); numdb_insert(mapregstr_db,(i<<24)|s,p); @@ -7170,7 +7174,7 @@ static int script_autosave_mapreg(int tid,unsigned int tick,int id,int data) } /*========================================== - * + * *------------------------------------------ */ static int set_posword(char *p) @@ -7256,7 +7260,7 @@ static int mapreg_db_final(void *key,void *data,va_list ap) } static int mapregstr_db_final(void *key,void *data,va_list ap) { - free(data); + aFree(data); return 0; } static int scriptlabel_db_final(void *key,void *data,va_list ap) @@ -7265,8 +7269,8 @@ static int scriptlabel_db_final(void *key,void *data,va_list ap) } static int userfunc_db_final(void *key,void *data,va_list ap) { - free(key); - free(data); + aFree(key); + aFree(data); return 0; } int do_final_script() @@ -7274,7 +7278,7 @@ int do_final_script() if(mapreg_dirty>=0) script_save_mapreg(); if(script_buf) - free(script_buf); + aFree(script_buf); if(mapreg_db) numdb_final(mapreg_db,mapreg_db_final); @@ -7286,9 +7290,9 @@ int do_final_script() strdb_final(userfunc_db,userfunc_db_final); if (str_data) - free(str_data); + aFree(str_data); if (str_buf) - free(str_buf); + aFree(str_buf); return 0; } diff --git a/src/map/skill.c b/src/map/skill.c index 8ede774e3..16cb26c06 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -730,7 +730,7 @@ const struct skill_name_db skill_names[] = { { WZ_STORMGUST, "STORMGUST", "Storm_Gust" } , { WZ_VERMILION, "VERMILION", "Lord_of_Vermilion" } , { WZ_WATERBALL, "WATERBALL", "Water_Ball" } , - { 0, 0, 0 } + { 0, 0, 0 } }; static const int dirx[8]={0,-1,-1,-1,0,1,1,1}; @@ -890,8 +890,8 @@ int skillnotok(int skillid, struct map_session_data *sd) { if (sd == 0) return 0; - if (!(skillid >= 10000 && skillid < 10015)) - if ((skillid > MAX_SKILL) || (skillid < 0)) + if (!(skillid >= 10000 && skillid < 10015)) + if ((skillid > MAX_SKILL) || (skillid < 0)) return 1; if (pc_isGM(sd) >= 20) @@ -1055,12 +1055,12 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s //if(skilllv <= 0) return 0; if(skillid > 0 && skilllv <= 0) return 0; // don't forget auto attacks! - celest - if(src->type==BL_PC){ - nullpo_retr(0, sd=(struct map_session_data *)src); - }else if(src->type==BL_MOB){ - nullpo_retr(0, md=(struct mob_data *)src); //未使用? - }else if(src->type==BL_PET){ - nullpo_retr(0, pd=(struct pet_data *)src); // [Valaris] + if (src->type == BL_PC){ + nullpo_retr(0, sd = (struct map_session_data *)src); + } else if (src->type == BL_MOB){ + nullpo_retr(0, md = (struct mob_data *)src); //未使用? + } else if (src->type == BL_PET){ + nullpo_retr(0, pd = (struct pet_data *)src); // [Valaris] } //?象の耐性 @@ -1088,6 +1088,13 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s if(sc_def_luk<50) sc_def_luk=50; } + if (dstsd && dstsd->sc_count && dstsd->sc_data[SC_GOSPEL].timer != -1 && + dstsd->sc_data[SC_GOSPEL].val4 == BCT_PARTY && + dstsd->sc_data[SC_GOSPEL].val3 == 3) { + sc_def_mdef -= 25; + sc_def_vit -= 25; + sc_def_int -= 25; + } if(sc_def_mdef<0) sc_def_mdef=0; if(sc_def_vit<0) @@ -1291,18 +1298,18 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s // case WZ_METEOR: if(rand()%100 < sc_def_vit) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case WZ_VERMILION: if(rand()%100 < sc_def_int) - skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; // -- moonsoul (stun ability of new champion skill tigerfist) // case CH_TIGERFIST: if( rand()%100 < (10 + skilllv*10)*sc_def_vit/100 ) { - int sec = skill_get_time2 (skillid,skilllv) - (double)battle_get_agi(bl)*0.1; + int sec = skill_get_time2 (skillid,skilllv) - battle_get_agi(bl)/10; skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,sec,0); } break; @@ -1577,7 +1584,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds return 0; if(bl->type == BL_PC && pc_isdead((struct map_session_data *)bl)) //?象がPCですでに死んでいたら何もしない return 0; - if(bl->type == BL_PC && skillnotok(skillid, (struct map_session_data *) bl)) + if(bl->type == BL_PC && skillnotok(skillid, (struct map_session_data *) bl)) return 0; // [MouseJstr] if(sc_data && sc_data[SC_HIDING].timer != -1) { //ハイディング?態で if(skill_get_pl(skillid) != 2) //スキルの?性が地?性でなければ何もしない @@ -2297,7 +2304,7 @@ int skill_cleartimerskill(struct block_list *src) */ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag ) { - struct map_session_data *sd=NULL; + struct map_session_data *sd = NULL; struct status_change *sc_data = battle_get_sc_data(src); int i; @@ -2374,7 +2381,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case LK_SPIRALPIERCE: /* スパイラルピア?ス */ case LK_HEADCRUSH: /* ヘッドクラッシュ */ case LK_JOINTBEAT: /* ジョイントビ?ト */ - case PA_PRESSURE: /* プレッシャ? */ +// case PA_PRESSURE: /* プレッシャ? */ // case PA_SACRIFICE: /* サクリファイス */ case SN_SHARPSHOOTING: /* シャ?プシュ?ティング */ case CG_ARROWVULCAN: /* アロ?バルカン */ @@ -2383,6 +2390,22 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case ITM_TOMAHAWK: skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); break; + case PA_PRESSURE: /* プレッシャ? */ + skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); + if (rand()%100 < 50) + skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(PA_PRESSURE,skilllv),0); + else + skill_status_change_start(bl,SC_BLEEDING,skilllv,0,0,0,skill_get_time2(PA_PRESSURE,skilllv),0); + if (bl->type == BL_PC) { + int sp; + struct map_session_data *tsd = (struct map_session_data *)bl; + nullpo_retb (tsd); + sp = tsd->status.max_sp * 10 * skilllv / 100; + if (sp > tsd->status.sp) sp = tsd->status.sp; + tsd->status.sp -= sp; + pc_heal(sd,0,-sp); + } + break; case NPC_DARKBREATH: clif_emotion(src,7); skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag); @@ -2429,7 +2452,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s else if (bl->type == BL_MOB) ((struct mob_data *)bl)->dir=dir; clif_changed_dir(bl); - //skill_blown(src,bl,skill_get_blewcount(skillid,skilllv)); + //skill_blown(src,bl,skill_get_blewcount(skillid,skilllv)); } else if(src->type == BL_PC) clif_skill_fail(sd,sd->skillid,0,0); @@ -2558,7 +2581,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s if (skillid == ASC_METEORASSAULT) clif_skill_nodamage(src,bl,skillid,skilllv,1); - + skill_area_temp[1]=bl->id; skill_area_temp[2]=x; skill_area_temp[3]=y; @@ -2752,7 +2775,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case WZ_FROSTNOVA: /* フロストノヴァ */ skill_castend_pos2(src,bl->x,bl->y,skillid,skilllv,tick,0); //skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); - map_foreachinarea(skill_attack_area,src->m,src->x-5,bl->y-5,bl->x+5,bl->y+5,0,BF_MAGIC,src,src,skillid,skilllv,tick,flag,BCT_ENEMY); + map_foreachinarea(skill_attack_area,src->m,src->x-5,bl->y-5,bl->x+5,bl->y+5,0,BF_MAGIC,src,src,skillid,skilllv,tick,flag,BCT_ENEMY); break; case WZ_SIGHTRASHER: @@ -2806,8 +2829,10 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s clif_skill_nodamage(src,bl,skillid,skilllv,1); if (skilllv == 5) skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,0 ); - if (bl->type == BL_PC) + if (bl->type == BL_PC) { ((struct map_session_data *)bl)->status.sp = 0; + clif_updatestatus((struct map_session_data *)bl,SP_SP); + } } else { clif_skill_nodamage(src,src,skillid,skilllv,1); if (skilllv == 5) @@ -2961,7 +2986,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int return 1; if (skillnotok(skillid, (struct map_session_data *)bl)) // [MouseJstr] return 0; - + map_freeblock_lock(); switch(skillid) { @@ -2971,7 +2996,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int int heal_get_jobexp; int skill; struct pc_base_job s_class; - + if( dstsd && dstsd->special_state.no_magic_damage ) heal=0; /* ?金蟲カ?ド(ヒ?ル量0) */ if (sd){ @@ -2981,7 +3006,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(sd && dstsd && sd->status.partner_id == dstsd->status.char_id && s_class.job == 23 && sd->status.sex == 0) //自分も?象もPC、?象が自分のパ?トナ?、自分がスパノビ、自分が♀なら heal = heal*2; //スパノビの嫁が旦那にヒ?ルすると2倍になる } - + clif_skill_nodamage(src,bl,skillid,heal,1); heal_get_jobexp = battle_heal(NULL,bl,heal,0,0); @@ -3192,11 +3217,11 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int struct status_change *tsc_data = battle_get_sc_data(bl); int sc = SkillStatusChangeTable[skillid]; int sc2 = SC_MARIONETTE2; - + if((dstsd->bl.type!=BL_PC) || (sd->bl.id == dstsd->bl.id) || (!sd->status.party_id) - || (sd->status.party_id != dstsd->status.party_id)) { + || (sd->status.party_id != dstsd->status.party_id)) { clif_skill_fail(sd,skillid,0,0); map_freeblock_unlock(); return 1; @@ -3218,7 +3243,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } clif_skill_nodamage(src,bl,skillid,skilllv,1); } - } + } break; case SA_FLAMELAUNCHER: // added failure chance and chance to break weapon if turned on [Valaris] @@ -3303,7 +3328,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,10000,0 ); break; - + case SM_AUTOBERSERK: // Celest { struct status_change *tsc_data = battle_get_sc_data(bl); @@ -3317,7 +3342,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } } break; - + case AS_ENCHANTPOISON: // Prevent spamming [Valaris] if(bl->type==BL_PC) { struct map_session_data *sd2=(struct map_session_data *)bl; @@ -3385,11 +3410,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int skill_status_change_end(bl,SC_SLEEP,-1); } - if(bl->type==BL_MOB) { + if(dstmd) { int range = skill_get_range(skillid,skilllv); if(range < 0) range = battle_get_range(src) - (range + 1); - mob_target((struct mob_data *)bl,src,range); + md->state.provoke_flag = src->id; + mob_target(dstmd,src,range); } } break; @@ -3506,7 +3532,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int clif_skill_produce_mix_list(sd,256); clif_skill_nodamage(src,bl,skillid,skilllv,1); } - break; + break; case BS_HAMMERFALL: /* ハンマ?フォ?ル */ clif_skill_nodamage(src,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_weapon_damage ) @@ -3733,6 +3759,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int skill_clear_unitgroup(src); clif_skill_nodamage(src,bl,skillid,skilllv,1); skill_unitsetting(src,skillid,skilllv,src->x,src->y,0); + skill_status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,BCT_SELF,skill_get_time(skillid,skilllv),0); break; case BD_ADAPTATION: /* アドリブ */ @@ -4402,20 +4429,20 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(bl->type == BL_PC && rand()%100 < skilllv && battle_config.equipment_breaking) pc_breakweapon((struct map_session_data *)bl); break; - + case NPC_BREAKARMOR: clif_skill_nodamage(src,bl,skillid,skilllv,1); if(bl->type == BL_PC && rand()%100 < skilllv && battle_config.equipment_breaking) pc_breakarmor((struct map_session_data *)bl); break; - + case NPC_BREAKHELM: clif_skill_nodamage(src,bl,skillid,skilllv,1); if(bl->type == BL_PC && rand()%100 < skilllv && battle_config.equipment_breaking) // since we don't have any code for helm breaking yet... pc_breakweapon((struct map_session_data *)bl); break; - + case NPC_BREAKSHIELD: clif_skill_nodamage(src,bl,skillid,skilllv,1); if(bl->type == BL_PC && rand()%100 < skilllv && battle_config.equipment_breaking) @@ -4449,7 +4476,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(map[sd->bl.m].flag.nomemo || map[sd->bl.m].flag.nowarpto || map[dstsd->bl.m].flag.nowarp){ clif_skill_teleportmessage(sd,1); return 0; - } + } skill_unitsetting(src,skillid,skilllv,sd->bl.x,sd->bl.y,0); } break; @@ -4500,7 +4527,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,NULL,NULL,NULL,0); } } - + } if(su->group->unit_id == 0x91 && su->group->val2){ struct block_list *target=map_id2bl(su->group->val2); @@ -4595,7 +4622,9 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int sd->status.sp = sp2; dstsd->status.sp = sp1; clif_heal(sd->fd,SP_SP,sp2); + clif_updatestatus(sd,SP_SP); clif_heal(dstsd->fd,SP_SP,sp1); + clif_updatestatus(dstsd,SP_SP); } else if (dstmd) { if (dstmd->state.soul_change_flag) { clif_skill_fail(sd,skillid,0,0); @@ -4607,6 +4636,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int sp2 = sd->status.max_sp - sd->status.sp; sd->status.sp += sp2; clif_heal(sd->fd,SP_SP,sp2); + clif_updatestatus(sd,SP_SP); dstmd->state.soul_change_flag = 1; } } @@ -4661,6 +4691,15 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } } break; + case ST_PRESERVE: + if (sd){ + if (sd->sc_count && sd->sc_data[SC_PRESERVE].timer != -1) + skill_status_change_end(src, SC_PRESERVE, -1 ); + else + skill_status_change_start(src,SC_PRESERVE,skilllv,0,0,0,skill_get_time(skillid, skilllv),0 ); + clif_skill_nodamage(src,src,skillid,skilllv,1); + } + break; // New guild skills [Celest] case GD_BATTLEORDER: @@ -4713,7 +4752,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } } break; - case GD_RESTORE: + case GD_RESTORE: { struct guild *g = NULL; // Only usable during WoE @@ -4725,8 +4764,8 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(flag&1) { if (dstsd && dstsd->status.guild_id == sd->status.guild_id) { int hp, sp; - hp = dstsd->status.max_hp*0.9; - sp = dstsd->status.max_sp*0.9; + hp = dstsd->status.max_hp*9/10; + sp = dstsd->status.max_sp*9/10; sp = dstsd->status.sp + sp <= dstsd->status.max_sp ? sp : dstsd->status.max_sp - dstsd->status.sp; clif_skill_nodamage(src,bl,AL_HEAL,hp,1); battle_heal(NULL,bl,hp,sp,0); @@ -4937,8 +4976,8 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil if(src->type==BL_PC){ nullpo_retr(0, sd=(struct map_session_data *)src); } - if( skillid != WZ_METEOR && - skillid != WZ_SIGHTRASHER && + if( skillid != WZ_METEOR && + skillid != WZ_SIGHTRASHER && skillid != AM_CANNIBALIZE && skillid != AM_SPHEREMINE) clif_skill_poseffect(src,skillid,skilllv,x,y,tick); @@ -5015,7 +5054,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil case HT_TALKIEBOX: /* ト?キ?ボックス */ skill_unitsetting(src,skillid,skilllv,x,y,0); break; - + case RG_GRAFFITI: /* Graffiti [Valaris] */ skill_clear_unitgroup(src); skill_unitsetting(src,skillid,skilllv,x,y,0); @@ -5088,7 +5127,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil mx = x;// + (rand()%10 - 5); my = y;// + (rand()%10 - 5); - + id=mob_once_spawn(sd,"this",mx,my,"--ja--", summons[skilllv-1] ,1,""); if( (md=(struct mob_data *)map_id2bl(id)) !=NULL ){ md->master_id=sd->bl.id; @@ -5138,7 +5177,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil map_foreachinarea(skill_area_sub, src->m,x-3,y-3,x+3,y+3,0, src,skillid,skilllv,tick,flag|BCT_ALL|1, - skill_castend_nodamage_id); + skill_castend_nodamage_id); } } } @@ -5175,7 +5214,7 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma sd->sc_data[SC_BERSERK].timer != -1 || sd->sc_data[SC_MARIONETTE].timer != -1) return 0; - + if (sd->sc_data[SC_BLOCKSKILL].timer!=-1) if (skill_num == sd->sc_data[SC_BLOCKSKILL].val3) return 0; @@ -5243,7 +5282,7 @@ int skill_castend_map( struct map_session_data *sd,int skill_num, const char *ma return 0; if((group=skill_unitsetting(&sd->bl,sd->skillid,sd->skilllv,sd->skillx,sd->skilly,0))==NULL) return 0; - group->valstr=(char *)aCalloc(24,sizeof(char)); + group->valstr=(char *)aCallocA(24,sizeof(char)); memcpy(group->valstr,map,24); group->val2=(x<<16)|y; } @@ -5287,7 +5326,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, else count=3; limit=skill_get_time(skillid,skilllv); if(sc_data) { - if (sc_data[SC_VIOLENTGALE].timer!=-1) limit *= 1.5; + if (sc_data[SC_VIOLENTGALE].timer!=-1) limit = limit*3/2; } // check for sc_data first - Celest // if (((struct map_session_data *)src)->sc_data[SC_VIOLENTGALE].timer!=-1) @@ -5337,7 +5376,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, if(skilllv < 6) range=1; else - range=2; + range=2; break; case MG_THUNDERSTORM: /* サンダ?スト?ム */ @@ -5629,7 +5668,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, group->range=range; if(skillid==HT_TALKIEBOX || skillid==RG_GRAFFITI){ - group->valstr=aCalloc(80, 1); + group->valstr=aCallocA(80, 1); if(group->valstr==NULL){ printf("skill_castend_map: out of memory !\n"); exit(1); @@ -6079,13 +6118,13 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int { struct status_change *sc_data=battle_get_sc_data(bl); if(sg->val2==0 && sc_data && sc_data[SC_ANKLE].timer==-1){ - int moveblock = ( bl->x/BLOCK_SIZE != src->bl.x/BLOCK_SIZE || bl->y/BLOCK_SIZE != src->bl.y/BLOCK_SIZE); - int sec=skill_get_time2(sg->skill_id,sg->skill_lv) - (double)battle_get_agi(bl)*0.1; + int moveblock = ( bl->x/BLOCK_SIZE != src->bl.x/BLOCK_SIZE || bl->y/BLOCK_SIZE != src->bl.y/BLOCK_SIZE); + int sec = skill_get_time2(sg->skill_id,sg->skill_lv) - battle_get_agi(bl)/10; if(battle_get_mode(bl)&0x20) sec = sec/5; battle_stopwalking(bl,1); skill_status_change_start(bl,SC_ANKLE,sg->skill_lv,0,0,0,sec,0); - + if(moveblock) map_delblock(bl); bl->x = src->bl.x; bl->y = src->bl.y; @@ -6127,7 +6166,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0x8e: /* クァグマイア */ { struct status_change *sc_data=battle_get_sc_data(bl); - int type=SkillStatusChangeTable[sg->skill_id]; + int type=SkillStatusChangeTable[sg->skill_id]; if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; if(sc_data && sc_data[type].timer==-1) @@ -6153,7 +6192,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int if (sc_data[type].timer==-1) skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); else if((unit2=(struct skill_unit *)sc_data[type].val2) && unit2 != src ){ - if( unit2->group != 0 && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) + if( unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); ts->tick-=sg->interval; } @@ -6210,7 +6249,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int skill_status_change_start(bl,type,sg->skill_lv,(sg->val1)>>16,(sg->val1)&0xffff, (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0); else if((unit2=(struct skill_unit *)sc_data[type].val4) && unit2 != src ){ - if( unit2->group != 0 && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) + if( unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) skill_status_change_start(bl,type,sg->skill_lv,(sg->val1)>>16,(sg->val1)&0xffff, (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0); ts->tick-=sg->interval; @@ -6489,7 +6528,7 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t { struct map_session_data *sd; if (bl->type == BL_PC && (sd=(struct map_session_data *)bl) && sd->state.hawkeyes_flag > 0) - sd->state.hawkeyes_flag = 0; + sd->state.hawkeyes_flag = 0; } break; @@ -6578,7 +6617,7 @@ int skill_unit_onlimit(struct skill_unit *src,unsigned int tick) src->bl.x,src->bl.y,1); if(group == NULL) return 0; - group->valstr=aCalloc(24, 1); + group->valstr=aCallocA(24, 1); if(group->valstr==NULL){ printf("skill_unit_onlimit: out of memory !\n"); exit(1); @@ -6619,7 +6658,7 @@ int skill_unit_onlimit(struct skill_unit *src,unsigned int tick) struct map_session_data *sd; if ((sd = (struct map_session_data *)(map_id2bl(sg->src_id)))!= NULL) { sd->state.glorywounds_flag = 0; - } + } } break; case 0xc3: // GD_SOULCOLD @@ -6627,7 +6666,7 @@ int skill_unit_onlimit(struct skill_unit *src,unsigned int tick) struct map_session_data *sd; if ((sd = (struct map_session_data *)(map_id2bl(sg->src_id)))!= NULL) { sd->state.soulcold_flag = 0; - } + } } break; case 0xc4: // GD_HAWKEYES @@ -6905,7 +6944,7 @@ static int skill_check_condition_use_sub(struct block_list *bl,va_list ap) nullpo_retr(0, ssd=(struct map_session_data*)src); s_class = pc_calc_base_job(sd->status.class_); - + //チェックしない設定ならcにありえない大きな?字を返して終了 if(!battle_config.player_skill_partner_check){ //本?はforeachの前にやりたいけど設定適用箇所をまとめるためにここへ (*c)=99; @@ -7034,7 +7073,7 @@ int skill_check_condition(struct map_session_data *sd,int type) (sd->sc_data[SC_MARIONETTE].timer != -1 && sd->skillid != CG_MARIONETTE)){ clif_skill_fail(sd,sd->skillid,0,0); return 0; /* ?態異常や沈?など */ - } + } } skill = sd->skillid; lv = sd->skilllv; @@ -7192,7 +7231,7 @@ int skill_check_condition(struct map_session_data *sd,int type) break; case MG_FIREWALL: /* ファイア?ウォ?ル */ case WZ_QUAGMIRE: - case WZ_FIREPILLAR: // celest + case WZ_FIREPILLAR: // celest case PF_FOGWALL: /* ?制限 */ if(battle_config.pc_land_skill_limit) { @@ -7340,7 +7379,7 @@ int skill_check_condition(struct map_session_data *sd,int type) if(((itemid[i] >= 715 && itemid[i] <= 717) || itemid[i] == 1065) && sd->sc_data[SC_INTOABYSS].timer != -1) continue; if(skill == WZ_FIREPILLAR && lv<=5) - continue; // no gemstones for 1-5 [Celest] + continue; // no gemstones for 1-5 [Celest] if(skill == AM_POTIONPITCHER && i != x) continue; @@ -7357,7 +7396,7 @@ int skill_check_condition(struct map_session_data *sd,int type) if(!(type&1)) return 1; - if(skill != AM_POTIONPITCHER && + if(skill != AM_POTIONPITCHER && skill != CR_SLIMPITCHER && skill != MG_STONECURSE) { if(skill == AL_WARP && !(type&2)) @@ -7408,7 +7447,7 @@ int skill_castfix( struct block_list *bl, int time ) nullpo_retr(0, md=(struct mob_data*)bl); skill = md->skillid; lv = md->skilllv; - } else { + } else { nullpo_retr(0, sd=(struct map_session_data*)bl); skill = sd->skillid; lv = sd->skilllv; @@ -7451,13 +7490,13 @@ int skill_delayfix( struct block_list *bl, int time ) { struct status_change *sc_data; struct map_session_data *sd = NULL; - int skill,lv = 0; - int delayrate=100; - + int skill = 0,lv = 0; + int delayrate = 100; + nullpo_retr(0, bl); - if(bl->type==BL_PC){ - nullpo_retr(0, sd=(struct map_session_data*)bl); + if(bl->type == BL_PC){ + nullpo_retr(0, sd = (struct map_session_data*)bl); skill = sd->skillid; lv = sd->skilllv; } @@ -7466,24 +7505,32 @@ int skill_delayfix( struct block_list *bl, int time ) sc_data = battle_get_sc_data(bl); - // instant cast attack skills depend on aspd as delay [celest] - if (time <= 0 && skill_db[skill].skill_type == BF_WEAPON) - time = battle_get_adelay (bl)/2; - if(sd) { delayrate=((struct map_session_data *)bl)->delayrate; + // instant cast attack skills depend on aspd as delay [celest] + if (time == 0) { + if (skill_db[skill].skill_type == BF_WEAPON) + time = battle_get_adelay (bl)/2; + else + time = 300; // default delay, according to official servers + } else if (time < 0) + time = abs(time) + battle_get_adelay (bl)/2; // if set to <0, the aspd delay will be added + if(battle_config.delay_dependon_dex && /* dexの影響を計算する */ !skill_get_delaynodex(skill, lv)) // if skill casttime is allowed to be reduced by dex - time=time*(battle_config.castrate_dex_scale - battle_get_dex(bl))/(battle_config.castrate_dex_scale); + time = time * (battle_config.castrate_dex_scale - battle_get_dex(bl)) / (battle_config.castrate_dex_scale); - time=time*delayrate*battle_config.delay_rate/10000; + time = time * delayrate * battle_config.delay_rate / 10000; + + if (time < battle_config.min_skill_delay_limit) // check minimum skill delay + time = battle_config.min_skill_delay_limit; } /* ブラギの詩 */ - if(sc_data && sc_data[SC_POEMBRAGI].timer!=-1 ) - time=time*(100-(sc_data[SC_POEMBRAGI].val1*3+sc_data[SC_POEMBRAGI].val2 - +(sc_data[SC_POEMBRAGI].val3&0xffff)))/100; + if(sc_data && sc_data[SC_POEMBRAGI].timer != -1 ) + time = time * (100 - (sc_data[SC_POEMBRAGI].val1 * 3 + sc_data[SC_POEMBRAGI].val2 + + (sc_data[SC_POEMBRAGI].val3 & 0xffff))) / 100; return (time>0)?time:0; } @@ -7512,10 +7559,10 @@ int skill_use_id( struct map_session_data *sd, int target_id, } if(sd->bl.m != bl->m || pc_isdead(sd)) return 0; - + if(skillnotok(skill_num, sd)) // [MouseJstr] return 0; - + sc_data=sd->sc_data; /* 沈?や異常(ただし、グリムなどの判定をする) */ @@ -7598,7 +7645,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, case ST_CHASEWALK: return 0; } - }*/ + }*/ if(skill_get_inf2(skill_num)&0x200 && sd->bl.id == target_id) return 0; @@ -7671,15 +7718,27 @@ int skill_use_id( struct map_session_data *sd, int target_id, if(!skill_check_condition(sd,0)) return 0; - /* 射程と障害物チェック */ - range = skill_get_range(skill_num,skill_lv); - if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); - // be lenient if the skill was cast before we have moved to the correct position [Celest] - if (sd->walktimer != -1) - range += battle_config.skill_range_leniency; - if(!battle_check_range(&sd->bl,bl,range) ) - return 0; + { + int check_range_flag = 0; + + /* 射程と障害物チェック */ + range = skill_get_range(skill_num,skill_lv); + if(range < 0) + range = battle_get_range(&sd->bl) - (range + 1); + // be lenient if the skill was cast before we have moved to the correct position [Celest] + if (sd->walktimer != -1) + range += battle_config.skill_range_leniency; + else check_range_flag = 1; + if(!battle_check_range(&sd->bl,bl,range)) { + if (check_range_flag && battle_check_range(&sd->bl,bl,range + battle_config.skill_range_leniency)) { + int dir, mask[8][2] = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}}; + dir = map_calc_dir(&sd->bl,bl->x,bl->y); + pc_walktoxy (sd, sd->bl.x + mask[dir][0] * battle_config.skill_range_leniency, + sd->bl.y + mask[dir][1] * battle_config.skill_range_leniency); + } else + return 0; + } + } if(bl->type==BL_PC) { target_sd=(struct map_session_data*)bl; @@ -7745,13 +7804,12 @@ int skill_use_id( struct map_session_data *sd, int target_id, case WE_MALE: case WE_FEMALE: { + struct map_session_data *p_sd = pc_get_partner(sd); + nullpo_retr (0, p_sd) if(skill_num == WE_MALE && sd->status.hp <= ((15*sd->status.max_hp)/100)) // Requires more than 15% of Max HP for WE_MALE return 0; if(skill_num == WE_FEMALE && sd->status.sp <= ((15*sd->status.max_sp)/100)) // Requires more than 15% of Max SP for WE_FEMALE return 0; - struct map_session_data *p_sd = NULL; - if((p_sd = pc_get_partner(sd)) == NULL) - return 0; target_id = p_sd->bl.id; //rangeをもう1回?査 range = skill_get_range(skill_num,skill_lv); @@ -7905,7 +7963,7 @@ int skill_use_pos( struct map_session_data *sd, /* if(map[sd->bl.m].flag.gvg && (skill_num == SM_ENDURE || skill_num == AL_TELEPORT || - skill_num == AL_WARP || skill_num == WZ_ICEWALL || + skill_num == AL_WARP || skill_num == WZ_ICEWALL || skill_num == TF_BACKSLIDING)) return 0;*/ @@ -8023,7 +8081,7 @@ int skill_castcancel(struct block_list *bl,int type) } sd->skilltimer=-1; clif_skillcastcancel(bl); - } + } return 0; }else if(bl->type==BL_MOB){ @@ -8695,12 +8753,14 @@ int skill_status_change_timer_sub(struct block_list *bl, va_list ap ) break; case SC_RUWACH: /* ルアフ */ if( (*battle_get_option(bl))&6 ){ - skill_status_change_end( bl, SC_HIDING, -1); - skill_status_change_end( bl, SC_CLOAKING, -1); if(battle_check_target( src,bl, BCT_ENEMY ) > 0) { - struct status_change *sc_data = battle_get_sc_data(bl); - if (sc_data) + struct status_change *sc_data = battle_get_sc_data(bl); // check whether the target is hiding/cloaking [celest] + if (sc_data && (sc_data[SC_HIDING].timer != -1 || // if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother + sc_data[SC_CLOAKING].timer != -1)) { + skill_status_change_end( bl, SC_HIDING, -1); + skill_status_change_end( bl, SC_CLOAKING, -1); skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,sc_data[type].val1,tick,0); + } } } break; @@ -8712,7 +8772,7 @@ int skill_status_change_timer_sub(struct block_list *bl, va_list ap ) * ステ?タス異常終了 *------------------------------------------ */ -int skill_status_change_end(struct block_list* bl, int type, int tid) +int skill_status_change_end(struct block_list* bl, int type, int tid) { struct status_change* sc_data; int opt_flag=0, calc_flag = 0; @@ -8798,8 +8858,6 @@ int skill_status_change_end(struct block_list* bl, int type, int tid) case SC_MELTDOWN: /* メルトダウン */ // Celest case SC_EDP: - case SC_MARIONETTE: - case SC_MARIONETTE2: case SC_SLOWDOWN: case SC_SPEEDUP0: /* case SC_LEADERSHIP: @@ -8816,7 +8874,7 @@ int skill_status_change_end(struct block_list* bl, int type, int tid) break; case SC_BERSERK: /* バ?サ?ク */ calc_flag = 1; - clif_status_change(bl,SC_INCREASEAGI,0); /* アイコン消去 */ + clif_status_change(bl,SC_INCREASEAGI,0); /* アイコン消去 */ break; case SC_DEVOTION: /* ディボ?ション */ { @@ -8900,14 +8958,32 @@ int skill_status_change_end(struct block_list* bl, int type, int tid) case SC_CONFUSION: { struct map_session_data *sd=NULL; - if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){ + if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){ sd->next_walktime = -1; } } break; - } - if(bl->type==BL_PC && type 0 && + (sc_data = battle_get_sc_data(pbl)) && + sc_data[type2].timer != -1) + skill_status_change_end(pbl, type2, -1); + } + calc_flag = 1; + } + break; + } + + if(bl->type==BL_PC && + (type 0) { sc_data[type].timer = add_timer( 500 + tick, skill_status_change_timer, @@ -9437,7 +9513,7 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) 1000 + tick, skill_status_change_timer, bl->id, data); return 0; - } + } } break; @@ -9451,7 +9527,7 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) bl->id, data); } break;*/ - + // Celest case SC_CONFUSION: { @@ -9475,7 +9551,159 @@ int skill_status_change_timer(int tid, unsigned int tick, int id, int data) } } break; - } + + case SC_GOSPEL: + { + int calc_flag = 0; + if (sc_data[type].val3 > 0) { + sc_data[type].val3 = 0; + calc_flag = 1; + } + if(sd && sc_data[type].val4 == BCT_SELF){ + int hp, sp; + hp = (sc_data[type].val1 > 5) ? 45 : 30; + sp = (sc_data[type].val1 > 5) ? 35 : 20; + if(sd->status.hp - hp > 0 && + sd->status.sp - sp > 0){ + sd->status.hp -= hp; + sd->status.sp -= sp; + clif_updatestatus(sd,SP_HP); + clif_updatestatus(sd,SP_SP); + if ((sc_data[type].val2 -= 10000) > 0) { + sc_data[type].timer = add_timer( + 10000+tick, skill_status_change_timer, + bl->id, data); + return 0; + } + } + } else if (sd && sc_data[type].val4 == BCT_PARTY) { + int i; + switch ((i = rand() % 12)) { + case 1: // heal between 100-1000 + { + struct block_list tbl; + int heal = rand() % 900 + 100; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,AL_HEAL,heal,1); + battle_heal(NULL,bl,heal,0,0); + } + break; + case 2: // end negative status + { + int j; + for (j=0; j<4; j++) + if(sc_data[i + SC_POISON].timer!=-1) { + skill_status_change_end(bl,j,-1); + break; + } + } + break; + case 3: // +25% resistance to negative status + case 4: // +25% max hp + case 5: // +25% max sp + case 6: // +2 to all stats + case 11: // +25% armor and vit def + case 12: // +8% atk + case 13: // +5% flee + case 14: // +5% hit + sc_data[type].val3 = i; + if (i == 6 || + (i >= 11 && i <= 14)) + calc_flag = 1; + break; + case 7: // level 5 bless + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,AL_BLESSING,5,1); + skill_status_change_start(bl,SkillStatusChangeTable[AL_BLESSING],5,0,0,0,10000,0 ); + } + break; + case 8: // level 5 increase agility + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,AL_INCAGI,5,1); + skill_status_change_start(bl,SkillStatusChangeTable[AL_INCAGI],5,0,0,0,10000,0 ); + } + break; + case 9: // holy element to weapon + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,PR_ASPERSIO,1,1); + skill_status_change_start(bl,SkillStatusChangeTable[PR_ASPERSIO],1,0,0,0,10000,0 ); + } + break; + case 10: // holy element to armour + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,PR_BENEDICTIO,1,1); + skill_status_change_start(bl,SkillStatusChangeTable[PR_BENEDICTIO],1,0,0,0,10000,0 ); + } + break; + default: + break; + } + } else if (sc_data[type].val4 == BCT_ENEMY) { + int i; + switch ((i = rand() % 8)) { + case 1: // damage between 300-800 + case 2: // damage between 150-550 (ignore def) + battle_damage(NULL, bl, rand() % 500,0); // temporary damage + break; + case 3: // random status effect + { + int effect[3] = { + SC_CURSE, + SC_BLIND, + SC_POISON }; + skill_status_change_start(bl,effect[rand()%3],1,0,0,0,10000,0 ); + } + break; + case 4: // level 10 provoke + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,SM_PROVOKE,1,1); + skill_status_change_start(bl,SkillStatusChangeTable[SM_PROVOKE],10,0,0,0,10000,0 ); + } + break; + case 5: // 0 def + case 6: // 0 atk + case 7: // 0 flee + case 8: // -75% move speed and aspd + sc_data[type].val3 = i; + calc_flag = 1; + break; + default: + break; + } + } + if (sd && calc_flag) + pc_calcstatus (sd, 0); + } + break; + } return skill_status_change_end( bl,type,tid ); } @@ -9510,7 +9738,7 @@ int skill_encchant_eremental_end(struct block_list *bl,int type) * ステ?タス異常開始 *------------------------------------------ */ -int skill_status_change_start(struct block_list *bl, int type, int val1, int val2, int val3, int val4, int tick, int flag) +int skill_status_change_start(struct block_list *bl, int type, int val1, int val2, int val3, int val4, int tick, int flag) { struct map_session_data *sd = NULL; struct status_change* sc_data; @@ -9660,7 +9888,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val break; case SC_DECREASEAGI: /* 速度減少 */ if (bl->type == BL_PC) // Celest - tick>>=1; + tick>>=1; calc_flag = 1; if(sc_data[SC_INCREASEAGI].timer!=-1 ) skill_status_change_end(bl,SC_INCREASEAGI,-1); @@ -9718,7 +9946,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val calc_flag = 1; break; case SC_POISONREACT: /* ポイズンリアクト */ - val2=val1/2 + val1%2; // [Celest] + val2=val1/2 + val1%2; // [Celest] break; case SC_IMPOSITIO: /* インポシティオマヌス */ calc_flag = 1; @@ -9756,7 +9984,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val case SC_TRICKDEAD: /* 死んだふり */ if (bl->type == BL_PC) { pc_stopattack((struct map_session_data *)sd); - } + } break; case SC_QUAGMIRE: /* クァグマイア */ calc_flag = 1; @@ -9814,7 +10042,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val case SC_STRIPSHIELD: if (val2==0) val2=85; break; - case SC_STRIPARMOR: + case SC_STRIPARMOR: case SC_STRIPHELM: case SC_CP_WEAPON: case SC_CP_SHIELD: @@ -9970,7 +10198,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) { time_t timer; - + calc_flag = 1; tick = 10000; if(!val2) @@ -9983,7 +10211,7 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val if(!battle_config.muting_players) break; - + tick = 60000; if(!val2) val2 = time(&timer); @@ -10243,6 +10471,30 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val case SC_BASILICA: // [celest] break; + case SC_GOSPEL: + if (val4 == BCT_SELF) { // self effect + int i; + if (sd) { + sd->canact_tick += tick; + sd->canmove_tick += tick; + } + val2 = tick; + tick = 1000; + for (i=0; i<=26; i++) { + if(sc_data[i].timer!=-1) + skill_status_change_end(bl,i,-1); + } + for (i=58; i<=62; i++) { + if(sc_data[i].timer!=-1) + skill_status_change_end(bl,i,-1); + } + for (i=132; i<=136; i++) { + if(sc_data[i].timer!=-1) + skill_status_change_end(bl,i,-1); + } + } + break; + case SC_MARIONETTE: /* マリオネットコントロ?ル */ case SC_MARIONETTE2: val2 = tick; @@ -10284,6 +10536,9 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val // calc_flag = 1; // not sure of effects yet [celest] break; + case SC_PRESERVE: + break; + case SC_BLOCKSKILL: if (!tick) tick = 60000; if (!val3) val3 = -1; @@ -10307,7 +10562,8 @@ int skill_status_change_start(struct block_list *bl, int type, int val1, int val return 0; } - if(bl->type==BL_PC && typetype==BL_PC && + (typevalstr=NULL; } - map_freeblock(group->unit); /* free()の替わり */ + map_freeblock(group->unit); /* aFree()の替わり */ group->unit=NULL; group->src_id=0; group->group_id=0; @@ -11243,9 +11491,9 @@ int skill_unit_move_unit_group( struct skill_unit_group *group, int m,int dx,int int i,j, *r_flag, *s_flag, *m_flag; struct skill_unit *unit1; struct skill_unit *unit2; - r_flag = (int *) aMalloc(sizeof(int) * group->unit_count); - s_flag = (int *) aMalloc(sizeof(int) * group->unit_count); - m_flag = (int *) aMalloc(sizeof(int) * group->unit_count); + r_flag = (int *) aMallocA(sizeof(int) * group->unit_count); + s_flag = (int *) aMallocA(sizeof(int) * group->unit_count); + m_flag = (int *) aMallocA(sizeof(int) * group->unit_count); memset(r_flag,0, sizeof(int) * group->unit_count);// ?承フラグ memset(s_flag,0, sizeof(int) * group->unit_count);// ?承フラグ memset(m_flag,0, sizeof(int) * group->unit_count);// ?承フラグ @@ -11316,9 +11564,9 @@ int skill_unit_move_unit_group( struct skill_unit_group *group, int m,int dx,int } } } - free(r_flag); - free(s_flag); - free(m_flag); + aFree(r_flag); + aFree(s_flag); + aFree(m_flag); } } return 0; @@ -11470,7 +11718,7 @@ int skill_produce_mix( struct map_session_data *sd, else make_per = 1000 + sd->status.base_level*30 + sd->paramc[3]*20 + sd->paramc[4]*15 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300; } else if (skill_produce_db[idx].req_skill == ASC_CDP) { - make_per = 2000 + 40*sd->paramc[4] + 20*sd->paramc[5]; + make_per = 2000 + 40*sd->paramc[4] + 20*sd->paramc[5]; //make_per = 20 + (20*sd->paramc[4])/50 + (20*sd->paramc[5])/100; } else { if(nameid == 998) @@ -11493,7 +11741,7 @@ int skill_produce_mix( struct map_session_data *sd, if(make_per < 1) make_per = 1; - if(skill_produce_db[idx].req_skill==AM_PHARMACY || + if(skill_produce_db[idx].req_skill==AM_PHARMACY || skill_produce_db[idx].req_skill==ASC_CDP) { if( battle_config.pp_rate!=100 ) make_per=make_per*battle_config.pp_rate/100; @@ -12059,7 +12307,7 @@ int skill_readdb(void) i -= 9500; else if(i<=0 || i>MAX_SKILL_DB) continue; - + memset(split2,0,sizeof(split2)); for(j=0,p=split[1];j blank) + new_++; + if (new_ > blank) return; // 種類数超過 break; case ADDITEM_OVERAMOUNT: diff --git a/src/txt-converter/char/char-converter.c b/src/txt-converter/char/char-converter.c index 7b35fda63..1c5028d7e 100644 --- a/src/txt-converter/char/char-converter.c +++ b/src/txt-converter/char/char-converter.c @@ -16,16 +16,16 @@ #define STORAGE_MEMINC 16 - + #include "char.h" #include "../../common/strlib.h" #ifdef MEMWATCH #include "memwatch.h" #endif - + char pet_txt[256]="save/pet.txt"; -char storage_txt[256]="save/storage.txt"; +char storage_txt[256]="save/storage.txt"; MYSQL mysql_handle; MYSQL_RES* sql_res ; @@ -89,18 +89,18 @@ int inter_pet_fromstr(char *str, struct s_pet *p) int s; int tmp_int[16]; char tmp_str[256]; - + memset(p, 0, sizeof(struct s_pet)); - + // printf("sscanf pet main info\n"); s=sscanf(str,"%d, %d,%[^\t]\t%d, %d, %d, %d, %d, %d, %d, %d, %d", &tmp_int[0], &tmp_int[1], tmp_str, &tmp_int[2], &tmp_int[3], &tmp_int[4], &tmp_int[5], &tmp_int[6], &tmp_int[7], &tmp_int[8], &tmp_int[9], &tmp_int[10]); if(s!=12) return 1; - + p->pet_id = tmp_int[0]; - p->class = tmp_int[1]; + p->class_ = tmp_int[1]; memcpy(p->name, tmp_str, 24); p->account_id = tmp_int[2]; p->char_id = tmp_int[3]; @@ -126,11 +126,11 @@ int inter_pet_fromstr(char *str, struct s_pet *p) //--------------------------------------------------------- int inter_pet_tosql(int pet_id, struct s_pet *p) { //`pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`) - + char tmp_sql[65535]; MYSQL_RES* sql_res ; MYSQL_ROW sql_row ; - + jstrescapecpy (t_name, p->name); if(p->hungry < 0) p->hungry = 0; @@ -148,19 +148,19 @@ int inter_pet_tosql(int pet_id, struct s_pet *p) { sql_row = mysql_fetch_row(sql_res); //row fetching if (!sql_row) //no row -> insert sprintf(tmp_sql,"INSERT INTO `pet` (`pet_id`, `class`,`name`,`account_id`,`char_id`,`level`,`egg_id`,`equip`,`intimate`,`hungry`,`rename_flag`,`incuvate`) VALUES ('%d', '%d', '%s', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", - p->pet_id, p->class, t_name, p->account_id, p->char_id, p->level, p->egg_id, + p->pet_id, p->class_, t_name, p->account_id, p->char_id, p->level, p->egg_id, p->equip, p->intimate, p->hungry, p->rename_flag, p->incuvate); else //row reside -> updating sprintf(tmp_sql, "UPDATE `pet` SET `class`='%d',`name`='%s',`account_id`='%d',`char_id`='%d',`level`='%d',`egg_id`='%d',`equip`='%d',`intimate`='%d',`hungry`='%d',`rename_flag`='%d',`incuvate`='%d' WHERE `pet_id`='%d'", - p->class, t_name, p->account_id, p->char_id, p->level, p->egg_id, + p->class_, t_name, p->account_id, p->char_id, p->level, p->egg_id, p->equip, p->intimate, p->hungry, p->rename_flag, p->incuvate, p->pet_id); mysql_free_result(sql_res) ; //resource free if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error - %s\n", mysql_error(&mysql_handle) ); } - + printf ("pet dump success! - %d:%s\n", pet_id, p->name); - + return 0; } @@ -168,22 +168,22 @@ int storage_tosql(int account_id,struct storage *p){ // id -> DB dump // storage {`account_id`/`id`/`nameid`/`amount`/`equip`/`identify`/`refine`/`attribute`/`card0`/`card1`/`card2`/`card3`} int i,j; - + j=0; - + //printf ("starting storage dump to DB - id: %d\n", account_id); - + //delete old data. sprintf(tmp_sql,"DELETE FROM `storage` WHERE `account_id`='%d'",account_id); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error - %s\n", mysql_error(&mysql_handle) ); } - + //printf ("all storage item was deleted ok\n"); - + for(i=0;istorage[i].nameid , p->storage[i].amount); - + if( (p->storage[i].nameid) && (p->storage[i].amount) ){ sprintf(tmp_sql,"INSERT INTO `storage` (`account_id`,`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`broken`) VALUES ('%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d')", p->account_id, p->storage[i].nameid, p->storage[i].amount, p->storage[i].equip, @@ -212,7 +212,7 @@ int storage_fromstr(char *str, struct storage *p) if(set!=2) return 0; if(str[next]=='\n' || str[next]=='\r') - return 1; + return 1; next++; for(i=0;str[next] && str[next]!='\t';i++){ if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n", @@ -233,7 +233,7 @@ int storage_fromstr(char *str, struct storage *p) p->storage[i].broken = tmp_int[11]; next += len; if (str[next] == ' ') - next++; + next++; } else if(sscanf(str + next, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d%n", @@ -251,12 +251,12 @@ int storage_fromstr(char *str, struct storage *p) p->storage[i].card[1] = tmp_int[8]; p->storage[i].card[2] = tmp_int[9]; p->storage[i].card[3] = tmp_int[10]; - p->storage[i].broken = 0; + p->storage[i].broken = 0; next += len; if (str[next] == ' ') - next++; + next++; } - + else return 0; } return 1; @@ -337,7 +337,7 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) { p->char_id = tmp_int[0]; p->account_id = tmp_int[1]; p->char_num = tmp_int[2]; - p->class = tmp_int[3]; + p->class_ = tmp_int[3]; p->base_level = tmp_int[4]; p->job_level = tmp_int[5]; p->base_exp = tmp_int[6]; @@ -508,10 +508,10 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p) { //========================================================================================================== int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ int i,save_flag; - + save_flag = char_id; printf("request save char data... (%d)\n",char_id); - + //`char`( `char_id`,`account_id`,`char_num`,`name`,`class`,`base_level`,`job_level`,`base_exp`,`job_exp`,`zeny`, //9 //`str`,`agi`,`vit`,`int`,`dex`,`luk`, //15 //`max_hp`,`hp`,`max_sp`,`sp`,`status_point`,`skill_point`, //21 @@ -525,7 +525,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ "`option`='%d',`karma`='%d',`manner`='%d',`party_id`='%d',`guild_id`='%d',`pet_id`='%d'," "`hair`='%d',`hair_color`='%d',`clothes_color`='%d',`weapon`='%d',`shield`='%d',`head_top`='%d',`head_mid`='%d',`head_bottom`='%d'," "`last_map`='%s',`last_x`='%d',`last_y`='%d',`save_map`='%s',`save_x`='%d',`save_y`='%d', `partner_id` = '%d'", - char_id,p->account_id,p->char_num,p->name,p->class, p->base_level, p->job_level, + char_id,p->account_id,p->char_num,p->name,p->class_, p->base_level, p->job_level, p->base_exp, p->job_exp, p->zeny, p->max_hp, p->hp, p->max_sp, p->sp, p->status_point, p->skill_point, p->str, p->agi, p->vit, p->int_, p->dex, p->luk, @@ -535,17 +535,17 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ p->last_point.map, p->last_point.x, p->last_point.y, p->save_point.map, p->save_point.x, p->save_point.y, p->partner_id ); - + if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (update `char`)- %s\n", mysql_error(&mysql_handle) ); } - + //`memo` (`memo_id`,`char_id`,`map`,`x`,`y`) sprintf(tmp_sql,"DELETE FROM `memo` WHERE `char_id`='%d'",char_id); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (delete `memo`)- %s\n", mysql_error(&mysql_handle) ); } - + //insert here. for(i=0;i<10;i++){ if(p->memo_point[i].map[0]){ @@ -560,7 +560,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (delete `inventory`)- %s\n", mysql_error(&mysql_handle) ); } - + //insert here. for(i=0;iinventory[i].nameid){ @@ -579,7 +579,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (delete `cart_inventory`)- %s\n", mysql_error(&mysql_handle) ); } - + //insert here. for(i=0;icart[i].nameid){ @@ -593,14 +593,14 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ } } } - - + + //`skill` (`char_id`, `id`, `lv`) sprintf(tmp_sql,"DELETE FROM `skill` WHERE `char_id`='%d'",char_id); if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (delete `skill`)- %s\n", mysql_error(&mysql_handle) ); } - + //insert here. for(i=0;iskill[i].id){ @@ -618,7 +618,7 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ if(mysql_query(&mysql_handle, tmp_sql) ) { printf("DB server Error (delete `global_reg_value`)- %s\n", mysql_error(&mysql_handle) ); } - + //insert here. for(i=0;iglobal_reg_num;i++){ if(p->global_reg[i].value !=0){ @@ -629,10 +629,10 @@ int mmo_char_tosql(int char_id, struct mmo_charstatus *p){ } } } - + printf("saving char is done... (%d)\n",char_id); save_flag = 0; - + return 0; } //========================================================================================================== @@ -645,7 +645,7 @@ int mmo_char_init(void){ char input; FILE *fp; - + //DB connection initialized mysql_init(&mysql_handle); printf("Connect DB server.... (inter server)\n"); @@ -658,7 +658,7 @@ int mmo_char_init(void){ else { printf ("connect success! (inter server)\n"); } - + printf("Warning : Make sure you backup your databases before continuing!\n"); @@ -667,14 +667,14 @@ int mmo_char_init(void){ if(input == 'y' || input == 'Y'){ printf("\nConverting Character Database...\n"); fp=fopen("save/athena.txt","r"); - char_dat=malloc(sizeof(char_dat[0])*256); + char_dat = (struct mmo_charstatus*)malloc(sizeof(char_dat[0])*256); char_max=256; if(fp==NULL) return 0; while(fgets(line, 65535, fp)){ if(char_num>=char_max){ char_max+=256; - char_dat=realloc(char_dat, sizeof(char_dat[0]) *char_max); + char_dat = (struct mmo_charstatus*)realloc(char_dat, sizeof(char_dat[0]) *char_max); } memset(&char_dat[char_num], 0, sizeof(char_dat[0])); ret=mmo_char_fromstr(line, &char_dat[char_num]); @@ -689,8 +689,8 @@ int mmo_char_init(void){ printf("char data convert end\n"); fclose(fp); } - - while(getchar() != '\n'); + + while(getchar() != '\n'); printf("\nDo you wish to convert your Storage Database to SQL? (y/n) : "); input=getchar(); if(input == 'y' || input == 'Y') { @@ -700,14 +700,14 @@ int mmo_char_init(void){ printf("cant't read : %s\n",storage_txt); return 0; } - + while(fgets(line,65535,fp)){ set=sscanf(line,"%d,%d",&tmp_int[0],&tmp_int[1]); if(set==2) { if(i==0){ - storage=malloc(sizeof(struct storage)); + storage = (struct storage*)malloc(sizeof(struct storage)); }else{ - storage=realloc(storage,sizeof(struct storage)*(i+1)); + storage = (struct storage*)realloc(storage,sizeof(struct storage)*(i+1)); } memset(&storage[i],0,sizeof(struct storage)); storage[i].account_id=tmp_int[0]; @@ -718,7 +718,7 @@ int mmo_char_init(void){ } fclose(fp); } - + while(getchar() != '\n'); printf("\nDo you wish to convert your Pet Database to SQL? (y/n) : "); input=getchar(); @@ -726,8 +726,8 @@ int mmo_char_init(void){ printf("\nConverting Pet Database...\n"); if( (fp=fopen(pet_txt,"r")) ==NULL ) return 1; - - p=malloc(sizeof(struct s_pet)); + + p = (struct s_pet*)malloc(sizeof(struct s_pet)); while(fgets(line, sizeof(line), fp)){ if(p==NULL){ printf("int_pet: out of memory!\n"); @@ -792,7 +792,7 @@ int inter_config_read(const char *cfgName) { } } fclose(fp); - + printf("Reading interserver configuration: Done\n"); return 0; @@ -825,7 +825,7 @@ int char_config_read(const char *cfgName) { } fclose(fp); printf("Reading configuration: Done\n"); - + return 0; } diff --git a/src/txt-converter/char/char.h b/src/txt-converter/char/char.h index b5864b31c..e1d5c90dc 100644 --- a/src/txt-converter/char/char.h +++ b/src/txt-converter/char/char.h @@ -24,9 +24,9 @@ struct mmo_map_server{ char map[MAX_MAP_PER_SERVER][16]; }; -int mapif_sendall(unsigned char *buf,unsigned int len); -int mapif_sendallwos(int fd,unsigned char *buf,unsigned int len); -int mapif_send(int fd,unsigned char *buf,unsigned int len); +int mapif_sendall(char *buf,unsigned int len); +int mapif_sendallwos(int fd,char *buf,unsigned int len); +int mapif_send(int fd,char *buf,unsigned int len); extern int autosave_interval; diff --git a/src/txt-converter/common/mmo.h b/src/txt-converter/common/mmo.h index eb02b6879..e8ef2b987 100644 --- a/src/txt-converter/common/mmo.h +++ b/src/txt-converter/common/mmo.h @@ -87,7 +87,7 @@ struct s_pet { int account_id; int char_id; int pet_id; - short class; + short class_; short level; short egg_id;//pet egg id short equip;//pet equip name_id @@ -105,7 +105,7 @@ struct mmo_charstatus { int base_exp,job_exp,zeny; - short class; + short class_; short status_point,skill_point; int hp,max_hp,sp,max_sp; short option,karma,manner; @@ -168,7 +168,7 @@ struct party { struct guild_member { int account_id, char_id; - short hair,hair_color,gender,class,lv; + short hair,hair_color,gender,class_,lv; int exp,exp_payper; short online,position; int rsv1,rsv2; @@ -237,8 +237,8 @@ struct guild_castle { int Ghp4; int Ghp5; int Ghp6; - int Ghp7; - int GID0; + int Ghp7; + int GID0; int GID1; int GID2; int GID3; diff --git a/src/txt-converter/login/login-converter.c b/src/txt-converter/login/login-converter.c index a277ca949..f452d70aa 100644 --- a/src/txt-converter/login/login-converter.c +++ b/src/txt-converter/login/login-converter.c @@ -40,7 +40,7 @@ struct { int sex,delflag; } auth_fifo[AUTH_FIFO_SIZE]; int auth_fifo_pos=0; -struct { +struct auth_dat_ { int account_id, sex; char userid[24], pass[24], lastlogin[24]; int logincount; @@ -72,7 +72,7 @@ char db_server_logindb[32] = "ragnarok"; int isGM(int account_id) { struct gm_account *p; - p = numdb_search(gm_account_db,account_id); + p = (struct gm_account*)numdb_search(gm_account_db,account_id); if( p == NULL) return 0; return p->level; @@ -95,7 +95,7 @@ int read_gm_account() if(line[0] == '/' || line[1] == '/' || line[2] == '/') continue; - p=malloc(sizeof(struct gm_account)); + p = (struct gm_account*)malloc(sizeof(struct gm_account)); if(p==NULL){ printf("gm_account: out of memory!\n"); exit(0); @@ -145,7 +145,7 @@ int mmo_auth_init(void) fp=fopen("save/account.txt","r"); - auth_dat=malloc(sizeof(auth_dat[0])*256); + auth_dat = (struct auth_dat_*)malloc(sizeof(auth_dat[0])*256); auth_max=256; if(fp==NULL) return 0; -- cgit v1.2.3-70-g09d2 From 6bd2b81c4f1b71fcbc7d0a34d0c617b5251a4f04 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> Date: Tue, 25 Jan 2005 15:43:48 +0000 Subject: git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@991 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 13 +++++ Makefile | 8 +-- conf-tmpl/battle_athena.conf | 19 +++---- src/char/Makefile | 2 +- src/login/Makefile | 2 +- src/map/Makefile | 2 +- src/map/battle.c | 6 +-- src/map/clif.c | 17 ++++--- src/map/skill.c | 115 ++++++++++++------------------------------- 9 files changed, 73 insertions(+), 111 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 81b9d5db2..9bff594ee 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,18 @@ Date Added +01/25 + * Fixed TXT compile problems with libGC [celest] + * Added "Clients older than 2004-09-06aSakray" option to packet_ver_flag in + battle_athena, just in case server owners still prefer the older clients. + With so many changes to Sakray over the past months its much better upgrading + to the newer clients (November or higher recommended) available ;P [celest] + * Merged Full Strip into jA's tidier stripping skills code -- also fixes + a typo that was causing Full Strip to do the reverse effect instead, + and the skill not updating the target's status after successfully unequipping + items [celest] + * Tidy up the 4 chemical protection skills into one code block [celest] + * Corrected Slim Pitcher's code -- sorry, i missed a few things ^^; [celest] + 01/24 * Fixed a typo in Provoke that was causing crashes [celest] * Fixed another compile warning in src/char/char.c diff --git a/Makefile b/Makefile index fe096d619..292c3ff2c 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ -CC = gcc -pipe +# CC = gcc -pipe # CC = g++ -# CC = gcc -pipe -DGCOLLECT +CC = gcc -pipe -DGCOLLECT # CC = gcc -pipe -DDMALLOC -DDMALLOC_FUNC_CHECK # CC = /usr/local/bin/gcc -fbounds-checking -pipe -DBCHECK -# GCLIB = -lgc -GCLIB = +GCLIB = -L/usr/local/lib -lgc +# GCLIB = # GCLIB = -ldmalloc PACKETDEF = -DPACKETVER=6 -DNEW_006b -DSO_REUSEPORT diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 35b20f7d9..3b2b93c94 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -772,15 +772,16 @@ any_warp_GM_min_level: 20 // Set here which client version do you accept. Add all values of clients: // Clients older than accepted versions, and versions not set to 'accepted' // here will be rejected when logging in -// 1: 2004-09-06aSakray client -// 2: 2004-09-21aSakray Client -// 4: 2004-10-18bSakexe Client -// 8: 2004-10-25aSakexe Client -// 16: 2004-11-01aSakexe Client -// 32: 2004-12-06aSakexe Client -// 64: 2005-01-10aSakexe Client -// default value: 127 (all clients) -packet_ver_flag: 127 +// 1: Clients older than 2004-09-06aSakray +// 2: 2004-09-06aSakray client +// 4: 2004-09-21aSakray Client +// 8: 2004-10-18bSakexe Client +// 16: 2004-10-25aSakexe Client +// 32: 2004-11-01aSakexe Client +// 64: 2004-12-06aSakexe Client +// 128: 2005-01-10aSakexe Client +// default value: 255 (all clients) +packet_ver_flag: 255 // Allow GMs to mute players or not? muting_players: no diff --git a/src/char/Makefile b/src/char/Makefile index 877f83c5a..3c09db92c 100644 --- a/src/char/Makefile +++ b/src/char/Makefile @@ -4,7 +4,7 @@ txt: char-server COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db.o ../common/lock.o ../common/malloc.o ../common/showmsg.o ../common/strlib.o COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/lock.h ../common/timer.h ../common/malloc.h ../common/showmsg.h ../common/strlib.h char-server: char.o inter.o int_party.o int_guild.o int_storage.o int_pet.o $(COMMON_OBJ) - $(CC) -o ../../$@ $> + $(CC) -o ../../$@ $> $(LIB_S) char.o: char.c char.h inter.h int_pet.h $(COMMON_H) ../common/version.h inter.o: inter.c inter.h int_party.h int_guild.h int_storage.h int_pet.h char.h $(COMMON_H) diff --git a/src/login/Makefile b/src/login/Makefile index 191a015cb..482503969 100644 --- a/src/login/Makefile +++ b/src/login/Makefile @@ -5,7 +5,7 @@ COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/db. COMMON_H = ../common/core.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/db.h ../common/lock.h ../common/malloc.h ../common/showmsg.h ../common/strlib.h login-server: login.o md5calc.o $(COMMON_OBJ) - $(CC) -o ../../$@ login.o md5calc.o $(COMMON_OBJ) + $(CC) -o ../../$@ login.o md5calc.o $(COMMON_OBJ) $(LIB_S) login.o: login.c login.h md5calc.h $(COMMON_H) md5calc.o: md5calc.c md5calc.h diff --git a/src/map/Makefile b/src/map/Makefile index 0dddf6132..ac9ba9bf7 100644 --- a/src/map/Makefile +++ b/src/map/Makefile @@ -14,7 +14,7 @@ COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grf LIBS = -lz -lm map-server: txtobj/map.o txtobj/chrif.o txtobj/clif.o txtobj/pc.o txtobj/npc.o txtobj/chat.o txtobj/path.o txtobj/itemdb.o txtobj/mob.o txtobj/script.o txtobj/storage.o txtobj/skill.o txtobj/atcommand.o txtobj/charcommand.o txtobj/battle.o txtobj/intif.o txtobj/trade.o txtobj/party.o txtobj/vending.o txtobj/guild.o txtobj/pet.o txtobj/log.o $(COMMON_OBJ) - $(CC) -o ../../$@ $> $(LIBS) + $(CC) -o ../../$@ $> $(LIBS) $(LIB_S) map-server_sql: sqlobj/map.o sqlobj/chrif.o sqlobj/clif.o sqlobj/pc.o sqlobj/npc.o sqlobj/chat.o sqlobj/path.o sqlobj/itemdb.o sqlobj/mob.o sqlobj/script.o sqlobj/storage.o sqlobj/skill.o sqlobj/atcommand.o sqlobj/charcommand.o sqlobj/battle.o sqlobj/intif.o sqlobj/trade.o sqlobj/party.o sqlobj/vending.o sqlobj/guild.o sqlobj/pet.o sqlobj/mail.o sqlobj/log.o $(COMMON_OBJ) $(CC) -o ../../$@ $> $(LIB_S) diff --git a/src/map/battle.c b/src/map/battle.c index ce691158c..a11facfc9 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -5622,7 +5622,7 @@ void battle_set_defaults() { battle_config.ban_spoof_namer = 5; // added by [Yor] (default: 5 minutes) battle_config.hack_info_GM_level = 60; // added by [Yor] (default: 60, GM level) battle_config.any_warp_GM_min_level = 20; // added by [Yor] - battle_config.packet_ver_flag = 127; // added by [Yor] + battle_config.packet_ver_flag = 255; // added by [Yor] battle_config.min_hair_style = 0; battle_config.max_hair_style = 20; battle_config.min_hair_color = 0; @@ -5760,8 +5760,8 @@ void battle_validate_conf() { battle_config.any_warp_GM_min_level = 100; // at least 1 client must be accepted - if ((battle_config.packet_ver_flag & 127) == 0) // added by [Yor] - battle_config.packet_ver_flag = 127; // accept all clients + if ((battle_config.packet_ver_flag & 255) == 0) // added by [Yor] + battle_config.packet_ver_flag = 255; // accept all clients if (battle_config.night_darkness_level > 10) // Celest battle_config.night_darkness_level = 10; diff --git a/src/map/clif.c b/src/map/clif.c index d15fdf3a1..eeae87439 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10626,14 +10626,15 @@ static int clif_parse(int fd) { } // check if version is accepted - if (packet_ver <= 9 || // reject any client versions older than 6sept04 - (packet_ver == 10 && (battle_config.packet_ver_flag & 1) == 0) || - (packet_ver == 11 && (battle_config.packet_ver_flag & 2) == 0) || - (packet_ver == 12 && (battle_config.packet_ver_flag & 4) == 0) || - (packet_ver == 13 && (battle_config.packet_ver_flag & 8) == 0) || - (packet_ver == 14 && (battle_config.packet_ver_flag & 16) == 0) || - (packet_ver == 15 && (battle_config.packet_ver_flag & 32) == 0) || - (packet_ver == 16 && (battle_config.packet_ver_flag & 64) == 0) || + if (packet_ver <= 5 || // reject really old client versions + (packet_ver <= 9 && (battle_config.packet_ver_flag & 1) == 0) || // older than 6sept04 + (packet_ver == 10 && (battle_config.packet_ver_flag & 2) == 0) || + (packet_ver == 11 && (battle_config.packet_ver_flag & 4) == 0) || + (packet_ver == 12 && (battle_config.packet_ver_flag & 8) == 0) || + (packet_ver == 13 && (battle_config.packet_ver_flag & 16) == 0) || + (packet_ver == 14 && (battle_config.packet_ver_flag & 32) == 0) || + (packet_ver == 15 && (battle_config.packet_ver_flag & 64) == 0) || + (packet_ver == 16 && (battle_config.packet_ver_flag & 128) == 0) || packet_ver > MAX_PACKET_VER || // no packet version support yet // identified version, but unknown client? (!sd && packet_db[packet_ver][cmd].func != clif_parse_WantToConnection)) { diff --git a/src/map/skill.c b/src/map/skill.c index 964354c53..55d3ce175 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -3975,9 +3975,10 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case RG_STRIPSHIELD: /* ストリップシールド */ case RG_STRIPARMOR: /* ストリップアーマー */ case RG_STRIPHELM: /* ストリップヘルム */ + case ST_FULLSTRIP: // Celest { struct status_change *tsc_data = battle_get_sc_data(bl); - int scid, equip, strip_fix; + int scid, equip, strip_fix, strip_num = 0; scid = SkillStatusChangeTable[skillid]; switch (skillid) { case RG_STRIPWEAPON: @@ -3992,6 +3993,10 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case RG_STRIPHELM: equip = EQP_HELM; break; + case ST_FULLSTRIP: + equip = EQP_WEAPON | EQP_SHIELD | EQP_ARMOR | EQP_HELM; + strip_num = 3; + break; default: return 1; } @@ -4009,8 +4014,9 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if (dstsd) { for (i=0;istatus.inventory[i].equip && dstsd->status.inventory[i].equip & equip){ - pc_unequipitem(dstsd,i,0); - break; + pc_unequipitem(dstsd,i,3); + if ((--strip_num) <= 0) + break; } } if (i == MAX_INVENTORY) @@ -4022,49 +4028,6 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; } - // Full Strip [Celest] - case ST_FULLSTRIP: - { - struct status_change *tsc_data = battle_get_sc_data(bl); - int c=0, i, j, strip_fix; - int striplist[2][4] = { { 0, 0, 0, 0 }, - { 0x0002, 0x0020, 0x0010, 0x0100 } }; - - strip_fix = battle_get_dex(src) - battle_get_dex(bl); - if(strip_fix < 0) - strip_fix=0; - strip_per = 5+2*skilllv+strip_fix/5; - strip_time = skill_get_time(skillid,skilllv)+strip_fix/2; - for (i=0; i<4; i++) { - if(tsc_data && tsc_data[SC_CP_WEAPON + i].timer != -1) - break; - if(rand()%100 < strip_per) { - striplist[0][i] = 1; - c++; - } - } - - if (c > 0) { - clif_skill_nodamage(src,bl,skillid,skilllv,1); - for (j=0; j<4 && c > 0; j++) { - if (striplist[0][j]) { - skill_status_change_start(bl,SC_STRIPWEAPON + i,skilllv,0,0,0,strip_time,0 ); - if(dstsd){ - for(i=0;istatus.inventory[i].equip && dstsd->status.inventory[i].equip & striplist[1][j]){ - pc_unequipitem(dstsd,i,3); - --c; - break; - } - } - } - } - } - } - } - break; - - /* PotionPitcher */ case AM_POTIONPITCHER: /* ポ?ションピッチャ? */ { @@ -4135,38 +4098,15 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } break; case AM_CP_WEAPON: - { - struct status_change *tsc_data = battle_get_sc_data(bl); - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(tsc_data && tsc_data[SC_STRIPWEAPON].timer != -1) - skill_status_change_end(bl, SC_STRIPWEAPON, -1 ); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); - } - break; case AM_CP_SHIELD: - { - struct status_change *tsc_data = battle_get_sc_data(bl); - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(tsc_data && tsc_data[SC_STRIPSHIELD].timer != -1) - skill_status_change_end(bl, SC_STRIPSHIELD, -1 ); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); - } - break; case AM_CP_ARMOR: - { - struct status_change *tsc_data = battle_get_sc_data(bl); - clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(tsc_data && tsc_data[SC_STRIPARMOR].timer != -1) - skill_status_change_end(bl, SC_STRIPARMOR, -1 ); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); - } - break; case AM_CP_HELM: { + int scid = SC_STRIPWEAPON + (skillid - AM_CP_WEAPON); struct status_change *tsc_data = battle_get_sc_data(bl); clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(tsc_data && tsc_data[SC_STRIPHELM].timer != -1) - skill_status_change_end(bl, SC_STRIPHELM, -1 ); + if(tsc_data && tsc_data[scid].timer != -1) + skill_status_change_end(bl, SC_STRIPWEAPON, -1 ); skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); } break; @@ -4654,12 +4594,18 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case CR_SLIMPITCHER: { if (sd && flag&1) { + struct block_list tbl; int hp = sd->potion_hp * (100 + pc_checkskill(sd,CR_SLIMPITCHER)*10 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)/100; hp = hp * (100 + (battle_get_vit(bl)<<1))/100; - if (dstsd) + if (dstsd) { hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10)/100; - clif_skill_nodamage(src,bl,skillid,skilllv,1); - battle_heal(src,bl,hp,0,0); + } + tbl.id = 0; + tbl.m = src->m; + tbl.x = src->x; + tbl.y = src->y; + clif_skill_nodamage(&tbl,bl,AL_HEAL,hp,1); + battle_heal(NULL,bl,hp,0,0); } } break; @@ -5160,23 +5106,23 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil case CR_SLIMPITCHER: { if (sd) { - int x = skilllv%11 - 1; - int i = pc_search_inventory(sd,skill_db[skillid].itemid[x]); - if(i < 0 || skill_db[skillid].itemid[x] <= 0 || sd->inventory_data[i] == NULL || - sd->status.inventory[i].amount < skill_db[skillid].amount[x]) { + int i = skilllv%11 - 1; + int j = pc_search_inventory(sd,skill_db[skillid].itemid[i]); + if(j < 0 || skill_db[skillid].itemid[i] <= 0 || sd->inventory_data[j] == NULL || + sd->status.inventory[j].amount < skill_db[skillid].amount[i]) { clif_skill_fail(sd,skillid,0,0); - map_freeblock_unlock(); return 1; } sd->state.potionpitcher_flag = 1; sd->potion_hp = 0; - run_script(sd->inventory_data[i]->use_script,0,sd->bl.id,0); - pc_delitem(sd,i,skill_db[skillid].amount[x],0); + run_script(sd->inventory_data[j]->use_script,0,sd->bl.id,0); + pc_delitem(sd,j,skill_db[skillid].amount[i],0); sd->state.potionpitcher_flag = 0; + clif_skill_poseffect(src,skillid,skilllv,x,y,tick); if(sd->potion_hp > 0) { map_foreachinarea(skill_area_sub, src->m,x-3,y-3,x+3,y+3,0, - src,skillid,skilllv,tick,flag|BCT_ALL|1, + src,skillid,skilllv,tick,flag|BCT_PARTY|1, skill_castend_nodamage_id); } } @@ -7380,7 +7326,8 @@ int skill_check_condition(struct map_session_data *sd,int type) continue; if(skill == WZ_FIREPILLAR && lv<=5) continue; // no gemstones for 1-5 [Celest] - if(skill == AM_POTIONPITCHER && i != x) + if((skill == AM_POTIONPITCHER || + skill == CR_SLIMPITCHER) && i != x) continue; index[i] = pc_search_inventory(sd,itemid[i]); -- cgit v1.2.3-70-g09d2 From 317ba93ee42b32c369f7aa7f669f4acb3ac72e60 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> Date: Wed, 26 Jan 2005 04:54:22 +0000 Subject: * Added status.c and status.h of jA 1091 update and moved some functions into the new source files * Updated auto_counter_type's description in battle_athena * Removed some unnecessary skill level checks in battle.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@996 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 15 +- conf-tmpl/battle_athena.conf | 6 +- src/common/malloc.h | 88 +- src/map/Makefile | 6 +- src/map/atcommand.c | 33 +- src/map/battle.c | 1699 ++------------- src/map/battle.h | 44 - src/map/charcommand.c | 9 +- src/map/clif.c | 85 +- src/map/guild.c | 3 +- src/map/map.c | 6 +- src/map/mob.c | 67 +- src/map/npc.c | 7 +- src/map/pc.c | 1576 +------------- src/map/pc.h | 5 +- src/map/pet.c | 37 +- src/map/script.c | 17 +- src/map/skill.c | 2665 ++++-------------------- src/map/skill.h | 6 +- src/map/status.c | 4699 ++++++++++++++++++++++++++++++++++++++++++ src/map/status.h | 75 + 21 files changed, 5626 insertions(+), 5522 deletions(-) create mode 100644 src/map/status.c create mode 100644 src/map/status.h (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 8f8394b29..102db3014 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,8 +1,19 @@ Date Added 01/26 - * Removed my changes to /stable/Makefile that i've accidentally commited, sorry - ^^; [celest] + * Added status.c and status.h of jA 1091 update and moved some functions into + the new source files: + -- skill_status_change_ -> status_change_ + -- battle_get_ -> status_get_ + -- pc_calc_ -> status_calc_ + -- pc_getrefinebonus and pc_percentrefinery -> status_getrefinebonus and + status_percentrefinery + + * Updated auto_counter_type's description in battle_athena, thanks to + akusarujin for pointing it out [celest] + * Removed some unnecessary skill level checks in battle.c [celest] + * Removed my changes to /stable/Makefile which has libGC enabled by default + that i've accidentally commited, sorry ^^; [celest] * Removed an unnecessary "cloneskill_lv" from map_session_data [celest] * Removed WATER.TXT (this file wasn't used at all. There's no such mapflag as WATER even). [Lupus] * Added Water Height of New Yuno Fileds 9 and 11. diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 3b2b93c94..10df2b7ee 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -467,9 +467,11 @@ save_clothcolor: yes undead_detect_type: 2 // Operational mode of automatic counter. -// 0 = disregard DEF and HIT+20 . CRI*2, 1 = 100% critical +// 0 = 100% critical +// 1 = disregard DEF and HIT+20, CRI*2 +// 2 = Same as 0, but can counter skills (?) // Players -player_auto_counter_type: 0 +player_auto_counter_type: 1 // Monsters monster_auto_counter_type: 0 diff --git a/src/common/malloc.h b/src/common/malloc.h index b37c3b799..d90665487 100644 --- a/src/common/malloc.h +++ b/src/common/malloc.h @@ -5,43 +5,45 @@ #if defined(DMALLOC) -#include "dmalloc.h" - -#define aMalloc(size) \ - dmalloc_malloc(__FILE__, __LINE__, (size), DMALLOC_FUNC_MALLOC, 0, 0) -#define aMallocA(size) \ - dmalloc_malloc(__FILE__, __LINE__, (size), DMALLOC_FUNC_MALLOC, 0, 0) -#define aCallocA(count,size) \ - dmalloc_malloc(__FILE__, __LINE__, (count)*(size), DMALLOC_FUNC_CALLOC, 0, 0) -#define aCalloc(count,size) \ - dmalloc_malloc(__FILE__, __LINE__, (count)*(size), DMALLOC_FUNC_CALLOC, 0, 0) -#define aRealloc(ptr,size) \ - dmalloc_realloc(__FILE__, __LINE__, (ptr), (size), DMALLOC_FUNC_REALLOC, 0) -#define aFree(ptr) free(ptr) -#define aStrdup(ptr) strdup(ptr) +# include "dmalloc.h" +# define aMalloc(size) \ + dmalloc_malloc(__FILE__, __LINE__, (size), DMALLOC_FUNC_MALLOC, 0, 0) +# define aMallocA(size) \ + dmalloc_malloc(__FILE__, __LINE__, (size), DMALLOC_FUNC_MALLOC, 0, 0) +# define aCallocA(count,size) \ + dmalloc_malloc(__FILE__, __LINE__, (count)*(size), DMALLOC_FUNC_CALLOC, 0, 0) +# define aCalloc(count,size) \ + dmalloc_malloc(__FILE__, __LINE__, (count)*(size), DMALLOC_FUNC_CALLOC, 0, 0) +# define aRealloc(ptr,size) \ + dmalloc_realloc(__FILE__, __LINE__, (ptr), (size), DMALLOC_FUNC_REALLOC, 0) +# define aFree(ptr) free(ptr) +# define aStrdup(ptr) strdup(ptr) #elif defined(GCOLLECT) -#include "gc.h" -#define aMalloc(n) GC_MALLOC(n) -#define aMallocA(n) GC_MALLOC_ATOMIC(n) -#define aCallocA(m,n) _bcallocA(m,n) -#define aCalloc(m,n) _bcalloc(m,n) -#define aRealloc(p,n) GC_REALLOC(p,n) -#define aFree(n) GC_FREE(n) -#define aStrdup(n) _bstrdup(n) -extern void * _bcalloc(size_t, size_t); -extern void * _bcallocA(size_t, size_t); -extern char * _bstrdup(const char *); +# include "gc.h" +# define aMalloc(n) GC_MALLOC(n) +# define aMallocA(n) GC_MALLOC_ATOMIC(n) +# define aCallocA(m,n) _bcallocA(m,n) +# define aCalloc(m,n) _bcalloc(m,n) +# define aRealloc(p,n) GC_REALLOC(p,n) +# define aFree(n) GC_FREE(n) +# define aStrdup(n) _bstrdup(n) + + extern void * _bcalloc(size_t, size_t); + extern void * _bcallocA(size_t, size_t); + extern char * _bstrdup(const char *); #elif defined(BCHECK) -#define aMalloc(n) malloc(n) -#define aMallocA(n) malloc(n) -#define aCalloc(m,n) calloc(m,n) -#define aCallocA(m,n) calloc(m,n) -#define aRealloc(p,n) realloc(p,n) -#define aFree(n) free(n) -#define aStrdup(n) strdup(n) + +# define aMalloc(n) malloc(n) +# define aMallocA(n) malloc(n) +# define aCalloc(m,n) calloc(m,n) +# define aCallocA(m,n) calloc(m,n) +# define aRealloc(p,n) realloc(p,n) +# define aFree(n) free(n) +# define aStrdup(n) strdup(n) + #else #if __STDC_VERSION__ < 199901L @@ -52,19 +54,19 @@ extern char * _bstrdup(const char *); # endif #endif -#define ALC_MARK __FILE__, __LINE__, __func__ +# define ALC_MARK __FILE__, __LINE__, __func__ -void* aMalloc_( size_t size, const char *file, int line, const char *func ); -void* aCalloc_( size_t num, size_t size, const char *file, int line, const char *func ); -void* aRealloc_( void *p, size_t size, const char *file, int line, const char *func ); + void* aMalloc_( size_t size, const char *file, int line, const char *func ); + void* aCalloc_( size_t num, size_t size, const char *file, int line, const char *func ); + void* aRealloc_( void *p, size_t size, const char *file, int line, const char *func ); -#define aMalloc(n) aMalloc_(n,ALC_MARK) -#define aMallocA(n) aMalloc_(n,ALC_MARK) -#define aCalloc(m,n) aCalloc_(m,n,ALC_MARK) -#define aCallocA(m,n) aCalloc_(m,n,ALC_MARK) -#define aRealloc(p,n) aRealloc_(p,n,ALC_MARK) -#define aFree(ptr) free(ptr) -#define aStrdup(ptr) strdup(ptr) +# define aMalloc(n) aMalloc_(n,ALC_MARK) +# define aMallocA(n) aMalloc_(n,ALC_MARK) +# define aCalloc(m,n) aCalloc_(m,n,ALC_MARK) +# define aCallocA(m,n) aCalloc_(m,n,ALC_MARK) +# define aRealloc(p,n) aRealloc_(p,n,ALC_MARK) +# define aFree(ptr) free(ptr) +# define aStrdup(ptr) strdup(ptr) #endif diff --git a/src/map/Makefile b/src/map/Makefile index ac9ba9bf7..3a05cd7a8 100644 --- a/src/map/Makefile +++ b/src/map/Makefile @@ -13,10 +13,10 @@ sqlobj: COMMON_OBJ = ../common/core.o ../common/socket.o ../common/timer.o ../common/grfio.o ../common/db.o ../common/lock.o ../common/nullpo.o ../common/malloc.o ../common/showmsg.o ../common/utils.o ../common/strlib.o LIBS = -lz -lm -map-server: txtobj/map.o txtobj/chrif.o txtobj/clif.o txtobj/pc.o txtobj/npc.o txtobj/chat.o txtobj/path.o txtobj/itemdb.o txtobj/mob.o txtobj/script.o txtobj/storage.o txtobj/skill.o txtobj/atcommand.o txtobj/charcommand.o txtobj/battle.o txtobj/intif.o txtobj/trade.o txtobj/party.o txtobj/vending.o txtobj/guild.o txtobj/pet.o txtobj/log.o $(COMMON_OBJ) +map-server: txtobj/map.o txtobj/chrif.o txtobj/clif.o txtobj/pc.o txtobj/status.o txtobj/npc.o txtobj/chat.o txtobj/path.o txtobj/itemdb.o txtobj/mob.o txtobj/script.o txtobj/storage.o txtobj/skill.o txtobj/atcommand.o txtobj/charcommand.o txtobj/battle.o txtobj/intif.o txtobj/trade.o txtobj/party.o txtobj/vending.o txtobj/guild.o txtobj/pet.o txtobj/log.o $(COMMON_OBJ) $(CC) -o ../../$@ $> $(LIBS) $(LIB_S) -map-server_sql: sqlobj/map.o sqlobj/chrif.o sqlobj/clif.o sqlobj/pc.o sqlobj/npc.o sqlobj/chat.o sqlobj/path.o sqlobj/itemdb.o sqlobj/mob.o sqlobj/script.o sqlobj/storage.o sqlobj/skill.o sqlobj/atcommand.o sqlobj/charcommand.o sqlobj/battle.o sqlobj/intif.o sqlobj/trade.o sqlobj/party.o sqlobj/vending.o sqlobj/guild.o sqlobj/pet.o sqlobj/mail.o sqlobj/log.o $(COMMON_OBJ) +map-server_sql: sqlobj/map.o sqlobj/chrif.o sqlobj/clif.o sqlobj/pc.o sqlobj/status.o sqlobj/npc.o sqlobj/chat.o sqlobj/path.o sqlobj/itemdb.o sqlobj/mob.o sqlobj/script.o sqlobj/storage.o sqlobj/skill.o sqlobj/atcommand.o sqlobj/charcommand.o sqlobj/battle.o sqlobj/intif.o sqlobj/trade.o sqlobj/party.o sqlobj/vending.o sqlobj/guild.o sqlobj/pet.o sqlobj/mail.o sqlobj/log.o $(COMMON_OBJ) $(CC) -o ../../$@ $> $(LIB_S) txtobj/%.o: %.c @@ -29,6 +29,7 @@ txtobj/map.o: map.c map.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb. txtobj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/showmsg.h txtobj/clif.o: clif.c map.h chrif.h clif.h mob.h intif.h pc.h npc.h itemdb.h chat.h script.h storage.h party.h guild.h atcommand.h pet.h charcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/showmsg.h txtobj/pc.o: pc.c map.h clif.h intif.h pc.h npc.h mob.h itemdb.h battle.h skill.h script.h party.h guild.h pet.h trade.h storage.h chat.h vending.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/showmsg.h +txtobj/status.o: status.c pc.h map.h clif.h status.h mob.h itemdb.h battle.h skill.h script.h pet.h guild.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/showmsg.h txtobj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h ../common/showmsg.h txtobj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h ../common/showmsg.h txtobj/path.o: path.c map.h battle.h ../common/mmo.h ../common/showmsg.h @@ -52,6 +53,7 @@ sqlobj/map.o: map.c map.h chrif.h clif.h npc.h pc.h mob.h chat.h skill.h itemdb. sqlobj/chrif.o: chrif.c map.h battle.h chrif.h clif.h intif.h pc.h npc.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/showmsg.h sqlobj/clif.o: clif.c map.h chrif.h clif.h mob.h intif.h pc.h npc.h itemdb.h chat.h script.h storage.h party.h guild.h atcommand.h pet.h charcommand.h ../common/socket.h ../common/timer.h ../common/mmo.h ../common/version.h ../common/showmsg.h sqlobj/pc.o: pc.c map.h clif.h intif.h pc.h npc.h mob.h itemdb.h battle.h skill.h script.h party.h guild.h pet.h trade.h storage.h chat.h vending.h log.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/showmsg.h +sqlobj/status.o: status.c pc.h map.h clif.h status.h mob.h itemdb.h battle.h skill.h script.h pet.h guild.h ../common/timer.h ../common/mmo.h ../common/db.h ../common/showmsg.h sqlobj/npc.o: npc.c map.h npc.h clif.h pc.h script.h mob.h itemdb.h battle.h ../common/db.h ../common/timer.h ../common/mmo.h ../common/showmsg.h sqlobj/chat.o: chat.c map.h clif.h pc.h chat.h ../common/db.h ../common/mmo.h ../common/showmsg.h sqlobj/path.o: path.c map.h battle.h ../common/mmo.h ../common/showmsg.h diff --git a/src/map/atcommand.c b/src/map/atcommand.c index c1f491910..ba21a9f08 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -17,6 +17,7 @@ #include "itemdb.h" #include "map.h" #include "pc.h" +#include "status.h" #include "skill.h" #include "mob.h" #include "pet.h" @@ -1935,7 +1936,7 @@ int atcommand_option( } clif_changeoption(&sd->bl); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); clif_displaymessage(fd, msg_table[9]); // Options changed. return 0; @@ -2079,7 +2080,7 @@ int atcommand_jobchange( sd->status.class_ = sd->view_class = 4015; sd->status.option &= ~0x0020; clif_changeoption(&sd->bl); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); } } else { if (!pc_isriding(sd)) { @@ -2461,7 +2462,7 @@ int atcommand_baselevelup( clif_updatestatus(sd, SP_BASELEVEL); clif_updatestatus(sd, SP_NEXTBASEEXP); clif_updatestatus(sd, SP_STATUSPOINT); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); pc_heal(sd, sd->status.max_hp, sd->status.max_sp); clif_misceffect(&sd->bl, 0); clif_displaymessage(fd, msg_table[21]); // Base level raised. @@ -2482,7 +2483,7 @@ int atcommand_baselevelup( sd->status.base_level += level; clif_updatestatus(sd, SP_BASELEVEL); clif_updatestatus(sd, SP_NEXTBASEEXP); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); clif_displaymessage(fd, msg_table[22]); // Base level lowered. } @@ -2528,7 +2529,7 @@ int atcommand_joblevelup( clif_updatestatus(sd, SP_NEXTJOBEXP); sd->status.skill_point += level; clif_updatestatus(sd, SP_SKILLPOINT); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); clif_misceffect(&sd->bl, 1); clif_displaymessage(fd, msg_table[24]); // Job level raised. } else { @@ -2547,7 +2548,7 @@ int atcommand_joblevelup( sd->status.skill_point = 0; clif_updatestatus(sd, SP_SKILLPOINT); } // to add: remove status points from skills - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); clif_displaymessage(fd, msg_table[25]); // Job level lowered. } @@ -3864,7 +3865,7 @@ int atcommand_param( *status[index] = new_value; clif_updatestatus(sd, SP_STR + index); clif_updatestatus(sd, SP_USTR + index); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); clif_displaymessage(fd, msg_table[42]); // Stat changed. } else { if (value < 0) @@ -3909,7 +3910,7 @@ int atcommand_stat_all( *status[index] = new_value; clif_updatestatus(sd, SP_STR + index); clif_updatestatus(sd, SP_USTR + index); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); count++; } } @@ -4057,9 +4058,9 @@ int atcommand_petfriendly( if ((sd->pet.intimate > 0 && t <= 0) || (sd->pet.intimate <= 0 && t > 0)) { if (sd->bl.prev != NULL) - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); else - pc_calcstatus(sd, 2); + status_calc_pc(sd, 2); } } clif_displaymessage(fd, msg_table[182]); // Pet friendly value changed! @@ -4673,7 +4674,7 @@ int atcommand_character_baselevel( clif_updatestatus(pl_sd, SP_BASELEVEL); clif_updatestatus(pl_sd, SP_NEXTBASEEXP); clif_updatestatus(pl_sd, SP_STATUSPOINT); - pc_calcstatus(pl_sd, 0); + status_calc_pc(pl_sd, 0); pc_heal(pl_sd, pl_sd->status.max_hp, pl_sd->status.max_sp); clif_misceffect(&pl_sd->bl, 0); clif_displaymessage(fd, msg_table[65]); // Character's base level raised. @@ -4694,7 +4695,7 @@ int atcommand_character_baselevel( pl_sd->status.base_level += level; clif_updatestatus(pl_sd, SP_BASELEVEL); clif_updatestatus(pl_sd, SP_NEXTBASEEXP); - pc_calcstatus(pl_sd, 0); + status_calc_pc(pl_sd, 0); clif_displaymessage(fd, msg_table[66]); // Character's base level lowered. } } else { @@ -4755,7 +4756,7 @@ int atcommand_character_joblevel( clif_updatestatus(pl_sd, SP_NEXTJOBEXP); pl_sd->status.skill_point += level; clif_updatestatus(pl_sd, SP_SKILLPOINT); - pc_calcstatus(pl_sd, 0); + status_calc_pc(pl_sd, 0); clif_misceffect(&pl_sd->bl, 1); clif_displaymessage(fd, msg_table[68]); // character's job level raised. } else { @@ -4774,7 +4775,7 @@ int atcommand_character_joblevel( pl_sd->status.skill_point = 0; clif_updatestatus(pl_sd, SP_SKILLPOINT); } // to add: remove status points from skills - pc_calcstatus(pl_sd, 0); + status_calc_pc(pl_sd, 0); clif_displaymessage(fd, msg_table[69]); // Character's job level lowered. } } else { @@ -7909,7 +7910,7 @@ int atcommand_unmute( if((pl_sd=map_nick2sd((char *) message)) != NULL) { if(pl_sd->sc_data[SC_NOCHAT].timer!=-1) { pl_sd->status.manner = 0; // have to set to 0 first [celest] - skill_status_change_end(&pl_sd->bl,SC_NOCHAT,-1); + status_change_end(&pl_sd->bl,SC_NOCHAT,-1); clif_displaymessage(sd->fd,"Player unmuted"); } else @@ -7985,7 +7986,7 @@ int atcommand_mute( if ((pl_sd = map_nick2sd(character)) != NULL) { pl_sd->status.manner -= manner; if(pl_sd->status.manner < 0) - skill_status_change_start(&pl_sd->bl,SC_NOCHAT,0,0,0,0,0,0); + status_change_start(&pl_sd->bl,SC_NOCHAT,0,0,0,0,0,0); } else { clif_displaymessage(fd, msg_table[3]); // Character not found. diff --git a/src/map/battle.c b/src/map/battle.c index a11facfc9..31041f405 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -12,6 +12,7 @@ #include "map.h" #include "pc.h" +#include "status.h" #include "skill.h" #include "mob.h" #include "itemdb.h" @@ -55,1302 +56,6 @@ int battle_counttargeted(struct block_list *bl,struct block_list *src,int target return mob_counttargeted((struct mob_data *)bl,src,target_lv); return 0; } -/*========================================== - * 対象のClassを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_class(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return ((struct mob_data *)bl)->class_; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->status.class_; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return ((struct pet_data *)bl)->class_; - else - return 0; -} -/*========================================== - * 対象の方向を返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_dir(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return ((struct mob_data *)bl)->dir; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->dir; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return ((struct pet_data *)bl)->dir; - else - return 0; -} -/*========================================== - * 対象のレベルを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_lv(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return ((struct mob_data *)bl)->level; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->status.base_level; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return ((struct pet_data *)bl)->msd->pet.level; - else - return 0; -} -/*========================================== - * 対象の射程を返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_range(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return mob_db[((struct mob_data *)bl)->class_].range; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->attackrange; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class_].range; - else - return 0; -} -/*========================================== - * 対象のHPを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_hp(struct block_list *bl) -{ - nullpo_retr(1, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return ((struct mob_data *)bl)->hp; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->status.hp; - else - return 1; -} -/*========================================== - * 対象のMHPを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_max_hp(struct block_list *bl) -{ - nullpo_retr(1, bl); - if(bl->type==BL_PC && ((struct map_session_data *)bl)) - return ((struct map_session_data *)bl)->status.max_hp; - else { - struct status_change *sc_data=battle_get_sc_data(bl); - int max_hp=1; - if(bl->type==BL_MOB && ((struct mob_data*)bl)) { - max_hp = mob_db[((struct mob_data*)bl)->class_].max_hp; - if(battle_config.mobs_level_up) // mobs leveling up increase [Valaris] - max_hp+=(((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv)*battle_get_vit(bl); - if(mob_db[((struct mob_data*)bl)->class_].mexp > 0) { - if(battle_config.mvp_hp_rate != 100) - max_hp = (max_hp * battle_config.mvp_hp_rate)/100; - } - else { - if(battle_config.monster_hp_rate != 100) - max_hp = (max_hp * battle_config.monster_hp_rate)/100; - } - } - else if(bl->type==BL_PET && ((struct pet_data*)bl)) { - max_hp = mob_db[((struct pet_data*)bl)->class_].max_hp; - if(mob_db[((struct pet_data*)bl)->class_].mexp > 0) { - if(battle_config.mvp_hp_rate != 100) - max_hp = (max_hp * battle_config.mvp_hp_rate)/100; - } - else { - if(battle_config.monster_hp_rate != 100) - max_hp = (max_hp * battle_config.monster_hp_rate)/100; - } - } - if(sc_data) { - if(sc_data[SC_APPLEIDUN].timer!=-1) - max_hp += ((5+sc_data[SC_APPLEIDUN].val1*2+((sc_data[SC_APPLEIDUN].val2+1)>>1) - +sc_data[SC_APPLEIDUN].val3/10) * max_hp)/100; - if(sc_data[SC_GOSPEL].timer!=-1 && - sc_data[SC_GOSPEL].val4 == BCT_PARTY && - sc_data[SC_GOSPEL].val3 == 4) - max_hp += max_hp * 25 / 100; - } - if(max_hp < 1) max_hp = 1; - return max_hp; - } - return 1; -} -/*========================================== - * 対象のStrを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_str(struct block_list *bl) -{ - int str=0; - struct status_change *sc_data; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_MOB && ((struct mob_data *)bl)) { - str = mob_db[((struct mob_data *)bl)->class_].str; - if(battle_config.mobs_level_up) // mobs leveling up increase [Valaris] - str+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; - } - else if(bl->type==BL_PC && ((struct map_session_data *)bl)) - return ((struct map_session_data *)bl)->paramc[0]; - else if(bl->type==BL_PET && ((struct pet_data *)bl)) - str = mob_db[((struct pet_data *)bl)->class_].str; - - if(sc_data) { - if(sc_data[SC_LOUD].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && bl->type != BL_PC) - str += 4; - if( sc_data[SC_BLESSING].timer != -1 && bl->type != BL_PC){ // ブレッシング - int race=battle_get_race(bl); - if(battle_check_undead(race,battle_get_elem_type(bl)) || race==6 ) str >>= 1; // 悪 魔/不死 - else str += sc_data[SC_BLESSING].val1; // その他 - } - if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト - str += 5; - } - if(str < 0) str = 0; - return str; -} -/*========================================== - * 対象のAgiを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ - -int battle_get_agi(struct block_list *bl) -{ - int agi=0; - struct status_change *sc_data; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) { - agi=mob_db[((struct mob_data *)bl)->class_].agi; - if(battle_config.mobs_level_up) // increase of mobs leveling up [Valaris] - agi+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; - } - else if(bl->type==BL_PC && (struct map_session_data *)bl) - agi=((struct map_session_data *)bl)->paramc[1]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - agi=mob_db[((struct pet_data *)bl)->class_].agi; - - if(sc_data) { - if( sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1 && - bl->type != BL_PC) // 速度増加(PCはpc.cで) - agi += 2+sc_data[SC_INCREASEAGI].val1; - - if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && bl->type != BL_PC) - agi += agi*(2+sc_data[SC_CONCENTRATE].val1)/100; - - if(sc_data[SC_DECREASEAGI].timer!=-1) // 速度減少 - agi -= 2+sc_data[SC_DECREASEAGI].val1; - - if(sc_data[SC_QUAGMIRE].timer!=-1 ) { // クァグマイア - //agi >>= 1; - //int agib = agi*(sc_data[SC_QUAGMIRE].val1*10)/100; - //agi -= agib > 50 ? 50 : agib; - agi -= (bl->type == BL_PC) ? sc_data[SC_QUAGMIRE].val1*5 : sc_data[SC_QUAGMIRE].val1*10; - } - if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト - agi += 5; - } - if(agi < 0) agi = 0; - return agi; -} -/*========================================== - * 対象のVitを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_vit(struct block_list *bl) -{ - int vit=0; - struct status_change *sc_data; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) { - vit=mob_db[((struct mob_data *)bl)->class_].vit; - if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] - vit+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; - } - else if(bl->type==BL_PC && (struct map_session_data *)bl) - vit=((struct map_session_data *)bl)->paramc[2]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - vit=mob_db[((struct pet_data *)bl)->class_].vit; - if(sc_data) { - if(sc_data[SC_STRIPARMOR].timer != -1 && bl->type!=BL_PC) - vit = vit*60/100; - if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト - vit += 5; - } - - if(vit < 0) vit = 0; - return vit; -} -/*========================================== - * 対象のIntを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_int(struct block_list *bl) -{ - int int_=0; - struct status_change *sc_data; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_MOB && (struct mob_data *)bl){ - int_=mob_db[((struct mob_data *)bl)->class_].int_; - if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] - int_+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; - } - else if(bl->type==BL_PC && (struct map_session_data *)bl) - int_=((struct map_session_data *)bl)->paramc[3]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - int_=mob_db[((struct pet_data *)bl)->class_].int_; - - if(sc_data) { - if( sc_data[SC_BLESSING].timer != -1 && bl->type != BL_PC){ // ブレッシング - int race=battle_get_race(bl); - if(battle_check_undead(race,battle_get_elem_type(bl)) || race==6 ) int_ >>= 1; // 悪 魔/不死 - else int_ += sc_data[SC_BLESSING].val1; // その他 - } - if( sc_data[SC_STRIPHELM].timer != -1 && bl->type != BL_PC) - int_ = int_*60/100; - if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト - int_ += 5; - } - if(int_ < 0) int_ = 0; - return int_; -} -/*========================================== - * 対象のDexを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_dex(struct block_list *bl) -{ - int dex=0; - struct status_change *sc_data; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) { - dex=mob_db[((struct mob_data *)bl)->class_].dex; - if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] - dex+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; - } - else if(bl->type==BL_PC && (struct map_session_data *)bl) - dex=((struct map_session_data *)bl)->paramc[4]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - dex=mob_db[((struct pet_data *)bl)->class_].dex; - - if(sc_data) { - if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && bl->type != BL_PC) - dex += dex*(2+sc_data[SC_CONCENTRATE].val1)/100; - - if( sc_data[SC_BLESSING].timer != -1 && bl->type != BL_PC){ // ブレッシング - int race=battle_get_race(bl); - if(battle_check_undead(race,battle_get_elem_type(bl)) || race==6 ) dex >>= 1; // 悪 魔/不死 - else dex += sc_data[SC_BLESSING].val1; // その他 - } - - if(sc_data[SC_QUAGMIRE].timer!=-1 ) { // クァグマイア - // dex >>= 1; - //int dexb = dex*(sc_data[SC_QUAGMIRE].val1*10)/100; - //dex -= dexb > 50 ? 50 : dexb; - dex -= (bl->type == BL_PC) ? sc_data[SC_QUAGMIRE].val1*5 : sc_data[SC_QUAGMIRE].val1*10; - } - if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト - dex += 5; - } - if(dex < 0) dex = 0; - return dex; -} -/*========================================== - * 対象のLukを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_luk(struct block_list *bl) -{ - int luk=0; - struct status_change *sc_data; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) { - luk=mob_db[((struct mob_data *)bl)->class_].luk; - if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] - luk+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; - } - else if(bl->type==BL_PC && (struct map_session_data *)bl) - luk=((struct map_session_data *)bl)->paramc[5]; - else if(bl->type==BL_PET && (struct pet_data *)bl) - luk=mob_db[((struct pet_data *)bl)->class_].luk; - - if(sc_data) { - if(sc_data[SC_GLORIA].timer!=-1 && bl->type != BL_PC) // グロリア(PCはpc.cで) - luk += 30; - if(sc_data[SC_CURSE].timer!=-1 ) // 呪い - luk=0; - if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト - luk += 5; - } - if(luk < 0) luk = 0; - return luk; -} - -/*========================================== - * 対象のFleeを返す(汎用) - * 戻りは整数で1以上 - *------------------------------------------ - */ -int battle_get_flee(struct block_list *bl) -{ - int flee=1; - struct status_change *sc_data; - - nullpo_retr(1, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - flee=((struct map_session_data *)bl)->flee; - else - flee=battle_get_agi(bl) + battle_get_lv(bl); - - if(bl->type != BL_PC && sc_data){ - if(sc_data[SC_WHISTLE].timer!=-1) - flee += flee*(sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2 - +(sc_data[SC_WHISTLE].val3>>16))/100; - if(sc_data[SC_BLIND].timer!=-1) - flee -= flee*25/100; - if(sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォーク - flee += flee*(sc_data[SC_WINDWALK].val2)/100; - if(sc_data[SC_SPIDERWEB].timer!=-1) //スパイダーウェブ - flee -= flee*50/100; - if(sc_data[SC_GOSPEL].timer!=-1) { - if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && - sc_data[SC_GOSPEL].val3 == 13) - flee += flee*5/100; - else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && - sc_data[SC_GOSPEL].val3 == 7) - flee = 0; - } - } - if(flee < 1) flee = 1; - return flee; -} -/*========================================== - * 対象のHitを返す(汎用) - * 戻りは整数で1以上 - *------------------------------------------ - */ -int battle_get_hit(struct block_list *bl) -{ - int hit=1; - struct status_change *sc_data; - - nullpo_retr(1, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - hit=((struct map_session_data *)bl)->hit; - else - hit=battle_get_dex(bl) + battle_get_lv(bl); - - if(bl->type != BL_PC && sc_data) { - if(sc_data[SC_HUMMING].timer!=-1) // - hit += hit*(sc_data[SC_HUMMING].val1*2+sc_data[SC_HUMMING].val2 - +sc_data[SC_HUMMING].val3)/100; - if(sc_data[SC_BLIND].timer!=-1) // 呪い - hit -= hit*25/100; - if(sc_data[SC_TRUESIGHT].timer!=-1) // トゥルーサイト - hit += 3*(sc_data[SC_TRUESIGHT].val1); - if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション - hit += (hit*(10*(sc_data[SC_CONCENTRATION].val1)))/100; - if(sc_data[SC_GOSPEL].timer!=-1 && - sc_data[SC_GOSPEL].val4 == BCT_PARTY && - sc_data[SC_GOSPEL].val3 == 14) - hit += hit*5/100; - } - if(hit < 1) hit = 1; - return hit; -} -/*========================================== - * 対象の完全回避を返す(汎用) - * 戻りは整数で1以上 - *------------------------------------------ - */ -int battle_get_flee2(struct block_list *bl) -{ - int flee2=1; - struct status_change *sc_data; - - nullpo_retr(1, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl){ - flee2 = battle_get_luk(bl) + 10; - flee2 += ((struct map_session_data *)bl)->flee2 - (((struct map_session_data *)bl)->paramc[5] + 10); - } - else - flee2=battle_get_luk(bl)+1; - - if(sc_data) { - if(sc_data[SC_WHISTLE].timer!=-1 && bl->type != BL_PC) - flee2 += (sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2 - +(sc_data[SC_WHISTLE].val3&0xffff))*10; - } - if(flee2 < 1) flee2 = 1; - return flee2; -} -/*========================================== - * 対象のクリティカルを返す(汎用) - * 戻りは整数で1以上 - *------------------------------------------ - */ -int battle_get_critical(struct block_list *bl) -{ - int critical=1; - struct status_change *sc_data; - - nullpo_retr(1, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl){ - critical = battle_get_luk(bl)*3 + 10; - critical += ((struct map_session_data *)bl)->critical - ((((struct map_session_data *)bl)->paramc[5]*3) + 10); - } - else - critical=battle_get_luk(bl)*3 + 1; - - if(sc_data) { - if(sc_data[SC_FORTUNE].timer!=-1 && bl->type != BL_PC) - critical += (10+sc_data[SC_FORTUNE].val1+sc_data[SC_FORTUNE].val2 - +sc_data[SC_FORTUNE].val3)*10; - if(sc_data[SC_EXPLOSIONSPIRITS].timer!=-1 && bl->type != BL_PC) - critical += sc_data[SC_EXPLOSIONSPIRITS].val2; - if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) //トゥルーサイト - critical += critical*sc_data[SC_TRUESIGHT].val1/100; - } - if(critical < 1) critical = 1; - return critical; -} -/*========================================== - * base_atkの取得 - * 戻りは整数で1以上 - *------------------------------------------ - */ -int battle_get_baseatk(struct block_list *bl) -{ - struct status_change *sc_data; - int batk=1; - - nullpo_retr(1, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) { - batk = ((struct map_session_data *)bl)->base_atk; //設定されているbase_atk - if (((struct map_session_data *)bl)->status.weapon < 16) - batk += ((struct map_session_data *)bl)->weapon_atk[((struct map_session_data *)bl)->status.weapon]; - } else { //それ以外なら - int str,dstr; - str = battle_get_str(bl); //STR - dstr = str/10; - batk = dstr*dstr + str; //base_atkを計算する - } - if(sc_data) { //状態異常あり - if(sc_data[SC_PROVOKE].timer!=-1 && bl->type != BL_PC) //PCでプロボック(SM_PROVOKE)状態 - batk = batk*(100+2*sc_data[SC_PROVOKE].val1)/100; //base_atk増加 - if(sc_data[SC_CURSE].timer!=-1 ) //呪われていたら - batk -= batk*25/100; //base_atkが25%減少 - if(sc_data[SC_CONCENTRATION].timer!=-1 && bl->type != BL_PC) //コンセントレーション - batk += batk*(5*sc_data[SC_CONCENTRATION].val1)/100; - } - if(batk < 1) batk = 1; //base_atkは最低でも1 - return batk; -} -/*========================================== - * 対象のAtkを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_atk(struct block_list *bl) -{ - struct status_change *sc_data; - int atk=0; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - atk = ((struct map_session_data*)bl)->watk; - else if(bl->type==BL_MOB && (struct mob_data *)bl) - atk = mob_db[((struct mob_data*)bl)->class_].atk1; - else if(bl->type==BL_PET && (struct pet_data *)bl) - atk = mob_db[((struct pet_data*)bl)->class_].atk1; - - if(bl->type != BL_PC && sc_data) { - if(sc_data[SC_PROVOKE].timer!=-1) - atk = atk*(100+2*sc_data[SC_PROVOKE].val1)/100; - if(sc_data[SC_CURSE].timer!=-1) - atk -= atk*25/100; - if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション - atk += atk*(5*sc_data[SC_CONCENTRATION].val1)/100; - - if(sc_data[SC_GOSPEL].timer!=-1) { - if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && - sc_data[SC_GOSPEL].val3 == 12) - atk += atk*8/100; - else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && - sc_data[SC_GOSPEL].val3 == 6) - atk = 0; - } - } - if(atk < 0) atk = 0; - return atk; -} -/*========================================== - * 対象の左手Atkを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_atk_(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl){ - int atk=((struct map_session_data*)bl)->watk_; - return atk; - } - else - return 0; -} -/*========================================== - * 対象のAtk2を返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_atk2(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data*)bl)->watk2; - else { - struct status_change *sc_data=battle_get_sc_data(bl); - int atk2=0; - if(bl->type==BL_MOB && (struct mob_data *)bl) - atk2 = mob_db[((struct mob_data*)bl)->class_].atk2; - else if(bl->type==BL_PET && (struct pet_data *)bl) - atk2 = mob_db[((struct pet_data*)bl)->class_].atk2; - if(sc_data) { - if( sc_data[SC_IMPOSITIO].timer!=-1) - atk2 += sc_data[SC_IMPOSITIO].val1*5; - if( sc_data[SC_PROVOKE].timer!=-1 ) - atk2 = atk2*(100+2*sc_data[SC_PROVOKE].val1)/100; - if( sc_data[SC_CURSE].timer!=-1 ) - atk2 -= atk2*25/100; - if(sc_data[SC_DRUMBATTLE].timer!=-1) - atk2 += sc_data[SC_DRUMBATTLE].val2; - if(sc_data[SC_NIBELUNGEN].timer!=-1 && (battle_get_element(bl)/10) >= 8 ) - atk2 += sc_data[SC_NIBELUNGEN].val3; - if(sc_data[SC_STRIPWEAPON].timer!=-1) - atk2 = atk2*sc_data[SC_STRIPWEAPON].val2/100; - if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション - atk2 += atk2*(5*sc_data[SC_CONCENTRATION].val1)/100; - } - if(atk2 < 0) atk2 = 0; - return atk2; - } - return 0; -} -/*========================================== - * 対象の左手Atk2を返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_atk_2(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data*)bl)->watk_2; - else - return 0; -} -/*========================================== - * 対象のMAtk1を返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_matk1(struct block_list *bl) -{ - struct status_change *sc_data; - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_MOB){ - int matk,int_=battle_get_int(bl); - matk = int_+(int_/5)*(int_/5); - - if(sc_data) - if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) - matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; - return matk; - } - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->matk1; - else if(bl->type==BL_PET){ - int matk,int_=battle_get_int(bl); - matk = int_+(int_/5)*(int_/5); - - if(sc_data) - if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) - matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; - return matk; - } - else - return 0; -} -/*========================================== - * 対象のMAtk2を返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_matk2(struct block_list *bl) -{ - struct status_change *sc_data=battle_get_sc_data(bl); - nullpo_retr(0, bl); - if(bl->type==BL_MOB){ - int matk,int_=battle_get_int(bl); - matk = int_+(int_/7)*(int_/7); - - if(sc_data) - if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) - matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; - return matk; - } - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->matk2; - else if(bl->type==BL_PET){ - int matk,int_=battle_get_int(bl); - matk = int_+(int_/7)*(int_/7); - if(sc_data) - if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) - matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; - return matk; - } - else - return 0; -} -/*========================================== - * 対象のDefを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_def(struct block_list *bl) -{ - struct status_change *sc_data; - int def=0,skilltimer=-1,skillid=0; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl){ - def = ((struct map_session_data *)bl)->def; - skilltimer = ((struct map_session_data *)bl)->skilltimer; - skillid = ((struct map_session_data *)bl)->skillid; - } - else if(bl->type==BL_MOB && (struct mob_data *)bl) { - def = mob_db[((struct mob_data *)bl)->class_].def; - skilltimer = ((struct mob_data *)bl)->skilltimer; - skillid = ((struct mob_data *)bl)->skillid; - } - else if(bl->type==BL_PET && (struct pet_data *)bl) - def = mob_db[((struct pet_data *)bl)->class_].def; - - if(def < 1000000) { - if(sc_data) { - //凍結、石化時は右シフト - if(sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0)) - def >>= 1; - - if (bl->type != BL_PC) { - //キーピング時はDEF100 - if( sc_data[SC_KEEPING].timer!=-1) - def = 100; - //プロボック時は減算 - if( sc_data[SC_PROVOKE].timer!=-1) - def = (def*(100 - 6*sc_data[SC_PROVOKE].val1)+50)/100; - //戦太鼓の響き時は加算 - if( sc_data[SC_DRUMBATTLE].timer!=-1) - def += sc_data[SC_DRUMBATTLE].val3; - //毒にかかっている時は減算 - if(sc_data[SC_POISON].timer!=-1) - def = def*75/100; - //ストリップシールド時は減算 - if(sc_data[SC_STRIPSHIELD].timer!=-1) - def = def*sc_data[SC_STRIPSHIELD].val2/100; - //シグナムクルシス時は減算 - if(sc_data[SC_SIGNUMCRUCIS].timer!=-1) - def = def * (100 - sc_data[SC_SIGNUMCRUCIS].val2)/100; - //永遠の混沌時はDEF0になる - if(sc_data[SC_ETERNALCHAOS].timer!=-1) - def = 0; - //コンセントレーション時は減算 - if( sc_data[SC_CONCENTRATION].timer!=-1) - def = (def*(100 - 5*sc_data[SC_CONCENTRATION].val1))/100; - - if(sc_data[SC_GOSPEL].timer!=-1) { - if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && - sc_data[SC_GOSPEL].val3 == 11) - def += def*25/100; - else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && - sc_data[SC_GOSPEL].val3 == 5) - def = 0; - } - } - } - //詠唱中は詠唱時減算率に基づいて減算 - if(skilltimer != -1) { - int def_rate = skill_get_castdef(skillid); - if(def_rate != 0) - def = (def * (100 - def_rate))/100; - } - } - if(def < 0) def = 0; - return def; -} -/*========================================== - * 対象のMDefを返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_mdef(struct block_list *bl) -{ - struct status_change *sc_data; - int mdef=0; - - nullpo_retr(0, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - mdef = ((struct map_session_data *)bl)->mdef; - else if(bl->type==BL_MOB && (struct mob_data *)bl) - mdef = mob_db[((struct mob_data *)bl)->class_].mdef; - else if(bl->type==BL_PET && (struct pet_data *)bl) - mdef = mob_db[((struct pet_data *)bl)->class_].mdef; - - if(mdef < 1000000) { - if(sc_data) { - //バリアー状態時はMDEF100 - if(sc_data[SC_BARRIER].timer != -1) - mdef = 100; - //凍結、石化時は1.25倍 - if(sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0)) - mdef = mdef*125/100; - if( sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) - mdef -= (mdef*6*sc_data[SC_MINDBREAKER].val1)/100; - } - } - if(mdef < 0) mdef = 0; - return mdef; -} -/*========================================== - * 対象のDef2を返す(汎用) - * 戻りは整数で1以上 - *------------------------------------------ - */ -int battle_get_def2(struct block_list *bl) -{ - struct status_change *sc_data; - int def2=1; - - nullpo_retr(1, bl); - sc_data=battle_get_sc_data(bl); - if(bl->type==BL_PC) - def2 = ((struct map_session_data *)bl)->def2; - else if(bl->type==BL_MOB) - def2 = mob_db[((struct mob_data *)bl)->class_].vit; - else if(bl->type==BL_PET) - def2 = mob_db[((struct pet_data *)bl)->class_].vit; - - if(bl->type != BL_PC && sc_data) { - if( sc_data[SC_ANGELUS].timer!=-1) - def2 = def2*(110+5*sc_data[SC_ANGELUS].val1)/100; - if( sc_data[SC_PROVOKE].timer!=-1) - def2 = (def2*(100 - 6*sc_data[SC_PROVOKE].val1)+50)/100; - if(sc_data[SC_POISON].timer!=-1) - def2 = def2*75/100; - //コンセントレーション時は減算 - if( sc_data[SC_CONCENTRATION].timer!=-1) - def2 = def2*(100 - 5*sc_data[SC_CONCENTRATION].val1)/100; - - if(sc_data[SC_GOSPEL].timer!=-1) { - if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && - sc_data[SC_GOSPEL].val3 == 11) - def2 += def2*25/100; - else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && - sc_data[SC_GOSPEL].val3 == 5) - def2 = 0; - } - } - if(def2 < 1) def2 = 1; - return def2; -} -/*========================================== - * 対象のMDef2を返す(汎用) - * 戻りは整数で0以上 - *------------------------------------------ - */ -int battle_get_mdef2(struct block_list *bl) -{ - int mdef2=0; - struct status_change *sc_data=battle_get_sc_data(bl); - - nullpo_retr(0, bl); - if(bl->type==BL_MOB) - mdef2 = mob_db[((struct mob_data *)bl)->class_].int_ + (mob_db[((struct mob_data *)bl)->class_].vit>>1); - else if(bl->type==BL_PC) - mdef2 = ((struct map_session_data *)bl)->mdef2 + (((struct map_session_data *)bl)->paramc[2]>>1); - else if(bl->type==BL_PET) - mdef2 = mob_db[((struct pet_data *)bl)->class_].int_ + (mob_db[((struct pet_data *)bl)->class_].vit>>1); - if(sc_data) { - if( sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) - mdef2 -= (mdef2*6*sc_data[SC_MINDBREAKER].val1)/100; - } - if(mdef2 < 0) mdef2 = 0; - return mdef2; -} -/*========================================== - * 対象のSpeed(移動速度)を返す(汎用) - * 戻りは整数で1以上 - * Speedは小さいほうが移動速度が速い - *------------------------------------------ - */ -int battle_get_speed(struct block_list *bl) -{ - nullpo_retr(1000, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->speed; - else { - struct status_change *sc_data=battle_get_sc_data(bl); - int speed = 1000; - if(bl->type==BL_MOB && (struct mob_data *)bl) { - speed = ((struct mob_data *)bl)->speed; - if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] - speed-=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; - } - else if(bl->type==BL_PET && (struct pet_data *)bl) - speed = ((struct pet_data *)bl)->msd->petDB->speed; - - if(sc_data) { - //速度増加時は25%減算 - if(sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_DONTFORGETME].timer == -1) - speed -= speed*25/100; - //速度減少時は25%加算 - if(sc_data[SC_DECREASEAGI].timer!=-1) - speed = speed*125/100; - //クァグマイア時は50%加算 - if(sc_data[SC_QUAGMIRE].timer!=-1) - speed = speed*3/2; - //私を忘れないで…時は加算 - if(sc_data[SC_DONTFORGETME].timer!=-1) - speed = speed*(100+sc_data[SC_DONTFORGETME].val1*2 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3&0xffff))/100; - //金剛時は25%加算 - if(sc_data[SC_STEELBODY].timer!=-1) - speed = speed*125/100; - //ディフェンダー時は加算 - // removed as of 12/14's patch [celest] - /*if(sc_data[SC_DEFENDER].timer!=-1) - speed = (speed * (155 - sc_data[SC_DEFENDER].val1*5)) / 100;*/ - //踊り状態は4倍遅い - if(sc_data[SC_DANCING].timer!=-1 ) - speed *= 6; - //呪い時は450加算 - if(sc_data[SC_CURSE].timer!=-1) - speed = speed + 450; - //ウィンドウォーク時はLv*2%減算 - if(sc_data[SC_WINDWALK].timer!=-1 && sc_data[SC_INCREASEAGI].timer==-1) - speed -= (speed*(sc_data[SC_WINDWALK].val1*2))/100; - if(sc_data[SC_SLOWDOWN].timer!=-1) - speed = speed*150/100; - if(sc_data[SC_SPEEDUP0].timer!=-1) - speed -= speed*25/100; - if(sc_data[SC_GOSPEL].timer!=-1 && - sc_data[SC_GOSPEL].val4 == BCT_ENEMY && - sc_data[SC_GOSPEL].val3 == 8) - speed = speed*125/100; - } - if(speed < 1) speed = 1; - return speed; - } - - return 1000; -} -/*========================================== - * 対象のaDelay(攻撃時ディレイ)を返す(汎用) - * aDelayは小さいほうが攻撃速度が速い - *------------------------------------------ - */ -int battle_get_adelay(struct block_list *bl) -{ - nullpo_retr(4000, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - return (((struct map_session_data *)bl)->aspd<<1); - else { - struct status_change *sc_data=battle_get_sc_data(bl); - int adelay=4000,aspd_rate = 100,i; - if(bl->type==BL_MOB && (struct mob_data *)bl) - adelay = mob_db[((struct mob_data *)bl)->class_].adelay; - else if(bl->type==BL_PET && (struct pet_data *)bl) - adelay = mob_db[((struct pet_data *)bl)->class_].adelay; - - if(sc_data) { - //ツーハンドクイッケン使用時でクァグマイアでも私を忘れないで…でもない時は3割減算 - if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // 2HQ - aspd_rate -= 30; - //アドレナリンラッシュ使用時でツーハンドクイッケンでもクァグマイアでも私を忘れないで…でもない時は - if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 && - sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ - //使用者とパーティメンバーで格差が出る設定でなければ3割減算 - if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) - aspd_rate -= 30; - //そうでなければ2.5割減算 - else - aspd_rate -= 25; - } - //スピアクィッケン時は減算 - if(sc_data[SC_SPEARSQUICKEN].timer != -1 && sc_data[SC_ADRENALINE].timer == -1 && - sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // スピアクィッケン - aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2; - //夕日のアサシンクロス時は減算 - if(sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス - sc_data[SC_TWOHANDQUICKEN].timer==-1 && sc_data[SC_ADRENALINE].timer==-1 && sc_data[SC_SPEARSQUICKEN].timer==-1 && - sc_data[SC_DONTFORGETME].timer == -1) - aspd_rate -= 5+sc_data[SC_ASSNCROS].val1+sc_data[SC_ASSNCROS].val2+sc_data[SC_ASSNCROS].val3; - //私を忘れないで…時は加算 - if(sc_data[SC_DONTFORGETME].timer!=-1) // 私を忘れないで - aspd_rate += sc_data[SC_DONTFORGETME].val1*3 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3>>16); - //金剛時25%加算 - if(sc_data[SC_STEELBODY].timer!=-1) // 金剛 - aspd_rate += 25; - //増速ポーション使用時は減算 - if( sc_data[i=SC_SPEEDPOTION3].timer!=-1 || sc_data[i=SC_SPEEDPOTION2].timer!=-1 || sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sc_data[i=SC_SPEEDPOTION0].timer!=-1) - aspd_rate -= sc_data[i].val2; - //ディフェンダー時は加算 - if(sc_data[SC_DEFENDER].timer != -1) - adelay += (1100 - sc_data[SC_DEFENDER].val1*100); - if(sc_data[SC_GOSPEL].timer!=-1 && - sc_data[SC_GOSPEL].val4 == BCT_ENEMY && - sc_data[SC_GOSPEL].val3 == 8) - aspd_rate = aspd_rate*125/100; - } - if(aspd_rate != 100) - adelay = adelay*aspd_rate/100; - if(adelay < battle_config.monster_max_aspd<<1) adelay = battle_config.monster_max_aspd<<1; - return adelay; - } - return 4000; -} -int battle_get_amotion(struct block_list *bl) -{ - nullpo_retr(2000, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->amotion; - else { - struct status_change *sc_data=battle_get_sc_data(bl); - int amotion=2000,aspd_rate = 100,i; - if(bl->type==BL_MOB && (struct mob_data *)bl) - amotion = mob_db[((struct mob_data *)bl)->class_].amotion; - else if(bl->type==BL_PET && (struct pet_data *)bl) - amotion = mob_db[((struct pet_data *)bl)->class_].amotion; - - if(sc_data) { - if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // 2HQ - aspd_rate -= 30; - if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 && - sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ - if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) - aspd_rate -= 30; - else - aspd_rate -= 25; - } - if(sc_data[SC_SPEARSQUICKEN].timer != -1 && sc_data[SC_ADRENALINE].timer == -1 && - sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // スピアクィッケン - aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2; - if(sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス - sc_data[SC_TWOHANDQUICKEN].timer==-1 && sc_data[SC_ADRENALINE].timer==-1 && sc_data[SC_SPEARSQUICKEN].timer==-1 && - sc_data[SC_DONTFORGETME].timer == -1) - aspd_rate -= 5+sc_data[SC_ASSNCROS].val1+sc_data[SC_ASSNCROS].val2+sc_data[SC_ASSNCROS].val3; - if(sc_data[SC_DONTFORGETME].timer!=-1) // 私を忘れないで - aspd_rate += sc_data[SC_DONTFORGETME].val1*3 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3>>16); - if(sc_data[SC_STEELBODY].timer!=-1) // 金剛 - aspd_rate += 25; - if( sc_data[i=SC_SPEEDPOTION3].timer!=-1 || sc_data[i=SC_SPEEDPOTION2].timer!=-1 || sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sc_data[i=SC_SPEEDPOTION0].timer!=-1) - aspd_rate -= sc_data[i].val2; - if(sc_data[SC_DEFENDER].timer != -1) - amotion += (550 - sc_data[SC_DEFENDER].val1*50); - } - if(aspd_rate != 100) - amotion = amotion*aspd_rate/100; - if(amotion < battle_config.monster_max_aspd) amotion = battle_config.monster_max_aspd; - return amotion; - } - return 2000; -} -int battle_get_dmotion(struct block_list *bl) -{ - int ret; - struct status_change *sc_data; - - nullpo_retr(0, bl); - sc_data = battle_get_sc_data(bl); - if(bl->type==BL_MOB && (struct mob_data *)bl){ - ret=mob_db[((struct mob_data *)bl)->class_].dmotion; - if(battle_config.monster_damage_delay_rate != 100) - ret = ret*battle_config.monster_damage_delay_rate/400; - } - else if(bl->type==BL_PC && (struct map_session_data *)bl){ - ret=((struct map_session_data *)bl)->dmotion; - if(battle_config.pc_damage_delay_rate != 100) - ret = ret*battle_config.pc_damage_delay_rate/400; - } - else if(bl->type==BL_PET && (struct pet_data *)bl) - ret=mob_db[((struct pet_data *)bl)->class_].dmotion; - else - return 2000; - - if((sc_data && (sc_data[SC_ENDURE].timer!=-1 || sc_data[SC_BERSERK].timer!=-1)) || - (bl->type == BL_PC && ((struct map_session_data *)bl)->special_state.infinite_endure)) - ret=0; - - return ret; -} -int battle_get_element(struct block_list *bl) -{ - int ret = 20; - struct status_change *sc_data; - - nullpo_retr(ret, bl); - sc_data = battle_get_sc_data(bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) // 10の位=Lv*2、1の位=属性 - ret=((struct mob_data *)bl)->def_ele; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - ret=20+((struct map_session_data *)bl)->def_ele; // 防御属性Lv1 - else if(bl->type==BL_PET && (struct pet_data *)bl) - ret = mob_db[((struct pet_data *)bl)->class_].element; - - if(sc_data) { - if( sc_data[SC_BENEDICTIO].timer!=-1 ) // 聖体降福 - ret=26; - if( sc_data[SC_FREEZE].timer!=-1 ) // 凍結 - ret=21; - if( sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0) - ret=22; - } - - return ret; -} -int battle_get_attack_element(struct block_list *bl) -{ - int ret = 0; - struct status_change *sc_data=battle_get_sc_data(bl); - - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - ret=0; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - ret=((struct map_session_data *)bl)->atk_ele; - else if(bl->type==BL_PET && (struct pet_data *)bl) - ret=0; - - if(sc_data) { - if( sc_data[SC_FROSTWEAPON].timer!=-1) // フロストウェポン - ret=1; - if( sc_data[SC_SEISMICWEAPON].timer!=-1) // サイズミックウェポン - ret=2; - if( sc_data[SC_FLAMELAUNCHER].timer!=-1) // フレームランチャー - ret=3; - if( sc_data[SC_LIGHTNINGLOADER].timer!=-1) // ライトニングローダー - ret=4; - if( sc_data[SC_ENCPOISON].timer!=-1) // エンチャントポイズン - ret=5; - if( sc_data[SC_ASPERSIO].timer!=-1) // アスペルシオ - ret=6; - } - - return ret; -} -int battle_get_attack_element2(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) { - int ret = ((struct map_session_data *)bl)->atk_ele_; - struct status_change *sc_data = ((struct map_session_data *)bl)->sc_data; - - if(sc_data) { - if( sc_data[SC_FROSTWEAPON].timer!=-1) // フロストウェポン - ret=1; - if( sc_data[SC_SEISMICWEAPON].timer!=-1) // サイズミックウェポン - ret=2; - if( sc_data[SC_FLAMELAUNCHER].timer!=-1) // フレームランチャー - ret=3; - if( sc_data[SC_LIGHTNINGLOADER].timer!=-1) // ライトニングローダー - ret=4; - if( sc_data[SC_ENCPOISON].timer!=-1) // エンチャントポイズン - ret=5; - if( sc_data[SC_ASPERSIO].timer!=-1) // アスペルシオ - ret=6; - } - return ret; - } - return 0; -} -int battle_get_party_id(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->status.party_id; - else if(bl->type==BL_MOB && (struct mob_data *)bl){ - struct mob_data *md=(struct mob_data *)bl; - if( md->master_id>0 ) - return -md->master_id; - return -md->bl.id; - } - else if(bl->type==BL_SKILL && (struct skill_unit *)bl) - return ((struct skill_unit *)bl)->group->party_id; - else - return 0; -} -int battle_get_guild_id(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data *)bl)->status.guild_id; - else if(bl->type==BL_MOB && (struct mob_data *)bl) - return ((struct mob_data *)bl)->class_; - else if(bl->type==BL_SKILL && (struct skill_unit *)bl) - return ((struct skill_unit *)bl)->group->guild_id; - else - return 0; -} -int battle_get_race(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return mob_db[((struct mob_data *)bl)->class_].race; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return 7; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class_].race; - else - return 0; -} -int battle_get_size(struct block_list *bl) -{ - nullpo_retr(1, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return mob_db[((struct mob_data *)bl)->class_].size; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return 1; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class_].size; - else - return 1; -} -int battle_get_mode(struct block_list *bl) -{ - nullpo_retr(0x01, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return mob_db[((struct mob_data *)bl)->class_].mode; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class_].mode; - else - return 0x01; // とりあえず動くということで1 -} - -int battle_get_mexp(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return mob_db[((struct mob_data *)bl)->class_].mexp; - else if(bl->type==BL_PET && (struct pet_data *)bl) - return mob_db[((struct pet_data *)bl)->class_].mexp; - else - return 0; -} - -// StatusChange系の所得 -struct status_change *battle_get_sc_data(struct block_list *bl) -{ - nullpo_retr(NULL, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return ((struct mob_data*)bl)->sc_data; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return ((struct map_session_data*)bl)->sc_data; - return NULL; -} -short *battle_get_sc_count(struct block_list *bl) -{ - nullpo_retr(NULL, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return &((struct mob_data*)bl)->sc_count; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return &((struct map_session_data*)bl)->sc_count; - return NULL; -} -short *battle_get_opt1(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return &((struct mob_data*)bl)->opt1; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return &((struct map_session_data*)bl)->opt1; - else if(bl->type==BL_NPC && (struct npc_data *)bl) - return &((struct npc_data*)bl)->opt1; - return 0; -} -short *battle_get_opt2(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return &((struct mob_data*)bl)->opt2; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return &((struct map_session_data*)bl)->opt2; - else if(bl->type==BL_NPC && (struct npc_data *)bl) - return &((struct npc_data*)bl)->opt2; - return 0; -} -short *battle_get_opt3(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return &((struct mob_data*)bl)->opt3; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return &((struct map_session_data*)bl)->opt3; - else if(bl->type==BL_NPC && (struct npc_data *)bl) - return &((struct npc_data*)bl)->opt3; - return 0; -} -short *battle_get_option(struct block_list *bl) -{ - nullpo_retr(0, bl); - if(bl->type==BL_MOB && (struct mob_data *)bl) - return &((struct mob_data*)bl)->option; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return &((struct map_session_data*)bl)->status.option; - else if(bl->type==BL_NPC && (struct npc_data *)bl) - return &((struct npc_data*)bl)->option; - return 0; -} - -//------------------------------------------------------------------- // ダメージの遅延 struct battle_delay_damage_ { @@ -1386,7 +91,7 @@ int battle_delay_damage(unsigned int tick,struct block_list *src,struct block_li int battle_damage(struct block_list *bl,struct block_list *target,int damage,int flag) { struct map_session_data *sd=NULL; - struct status_change *sc_data=battle_get_sc_data(target); + struct status_change *sc_data=status_get_sc_data(target); short *sc_count; int i; @@ -1409,14 +114,14 @@ int battle_damage(struct block_list *bl,struct block_list *target,int damage,int if(damage<0) return battle_heal(bl,target,-damage,0,flag); - if(!flag && (sc_count=battle_get_sc_count(target))!=NULL && *sc_count>0){ + if(!flag && (sc_count=status_get_sc_count(target))!=NULL && *sc_count>0){ // 凍結、石化、睡眠を消去 if(sc_data[SC_FREEZE].timer!=-1) - skill_status_change_end(target,SC_FREEZE,-1); + status_change_end(target,SC_FREEZE,-1); if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0) - skill_status_change_end(target,SC_STONE,-1); + status_change_end(target,SC_STONE,-1); if(sc_data[SC_SLEEP].timer!=-1) - skill_status_change_end(target,SC_SLEEP,-1); + status_change_end(target,SC_SLEEP,-1); } if(target->type==BL_MOB){ // MOB @@ -1539,12 +244,12 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i nullpo_retr(0, bl); - class_ = battle_get_class(bl); + class_ = status_get_class(bl); if(bl->type==BL_MOB) md=(struct mob_data *)bl; else sd=(struct map_session_data *)bl; - sc_data=battle_get_sc_data(bl); - sc_count=battle_get_sc_count(bl); + sc_data=status_get_sc_data(bl); + sc_count=status_get_sc_count(bl); if(sc_count!=NULL && *sc_count>0){ @@ -1570,28 +275,28 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i if(sc_data[SC_AETERNA].timer!=-1 && damage>0){ // レックスエーテルナ damage<<=1; - skill_status_change_end( bl,SC_AETERNA,-1 ); + status_change_end( bl,SC_AETERNA,-1 ); } //属性場のダメージ増加 if(sc_data[SC_VOLCANO].timer!=-1){ // ボルケーノ if(flag&BF_SKILL && skill_get_pl(skill_num)==3) damage += damage*sc_data[SC_VOLCANO].val4/100; - else if(!flag&BF_SKILL && battle_get_attack_element(bl)==3) + else if(!flag&BF_SKILL && status_get_attack_element(bl)==3) damage += damage*sc_data[SC_VOLCANO].val4/100; } if(sc_data[SC_VIOLENTGALE].timer!=-1){ // バイオレントゲイル if(flag&BF_SKILL && skill_get_pl(skill_num)==4) damage += damage*sc_data[SC_VIOLENTGALE].val4/100; - else if(!flag&BF_SKILL && battle_get_attack_element(bl)==4) + else if(!flag&BF_SKILL && status_get_attack_element(bl)==4) damage += damage*sc_data[SC_VIOLENTGALE].val4/100; } if(sc_data[SC_DELUGE].timer!=-1){ // デリュージ if(flag&BF_SKILL && skill_get_pl(skill_num)==1) damage += damage*sc_data[SC_DELUGE].val4/100; - else if(!flag&BF_SKILL && battle_get_attack_element(bl)==1) + else if(!flag&BF_SKILL && status_get_attack_element(bl)==1) damage += damage*sc_data[SC_DELUGE].val4/100; } @@ -1605,7 +310,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i clif_updatestatus(sd,SP_SP); } if(sd->status.sp<=0) - skill_status_change_end( bl,SC_ENERGYCOAT,-1 ); + status_change_end( bl,SC_ENERGYCOAT,-1 ); } else damage -= damage * (sc_data[SC_ENERGYCOAT].val1 * 6) / 100; @@ -1619,7 +324,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i else damage=-sc->val2; } if((--sc->val3)<=0 || (sc->val2<=0) || skill_num == AL_HOLYLIGHT) - skill_status_change_end(bl, SC_KYRIE, -1); + status_change_end(bl, SC_KYRIE, -1); } if(sc_data[SC_BASILICA].timer!=-1 && damage > 0){ @@ -1672,14 +377,14 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i //エフェクトもこれでいいのかわかんねぇ clif_skill_nodamage(bl,bl,ST_REJECTSWORD,sc_data[SC_REJECTSWORD].val1,1); if((--sc_data[SC_REJECTSWORD].val2)<=0) - skill_status_change_end(bl, SC_REJECTSWORD, -1); + status_change_end(bl, SC_REJECTSWORD, -1); } } if(sc_data[SC_SPIDERWEB].timer!=-1 && damage > 0) // [Celest] if ((flag&BF_SKILL && skill_get_pl(skill_num)==3) || - (!flag&BF_SKILL && battle_get_attack_element(src)==3)) { + (!flag&BF_SKILL && status_get_attack_element(src)==3)) { damage<<=1; - skill_status_change_end(bl, SC_SPIDERWEB, -1); + status_change_end(bl, SC_SPIDERWEB, -1); } if(sc_data[SC_FOGWALL].timer != -1 && flag&BF_MAGIC) @@ -1777,14 +482,14 @@ int battle_calc_drain(int damage, int rate, int per, int val) int battle_addmastery(struct map_session_data *sd,struct block_list *target,int dmg,int type) { int damage,skill; - int race=battle_get_race(target); + int race=status_get_race(target); int weapon; damage = 0; nullpo_retr(0, sd); // デーモンベイン(+3 〜 +30) vs 不死 or 悪魔 (死人は含めない?) - if((skill = pc_checkskill(sd,AL_DEMONBANE)) > 0 && (battle_check_undead(race,battle_get_elem_type(target)) || race==6) ) + if((skill = pc_checkskill(sd,AL_DEMONBANE)) > 0 && (battle_check_undead(race,status_get_elem_type(target)) || race==6) ) damage += (skill*(int)(3+(sd->status.base_level+1)*0.05)); // submitted by orn //damage += (skill * 3); @@ -1903,9 +608,9 @@ static struct Damage battle_calc_pet_weapon_attack( struct mob_data *tmd=NULL; int hitrate,flee,cri = 0,atkmin,atkmax; int luk,target_count = 1; - int def1 = battle_get_def(target); - int def2 = battle_get_def2(target); - int t_vit = battle_get_vit(target); + int def1 = status_get_def(target); + int def2 = status_get_def2(target); + int t_vit = status_get_vit(target); struct Damage wd; int damage,damage2=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv); int flag,dmg_lv=0; @@ -1919,8 +624,8 @@ static struct Damage battle_calc_pet_weapon_attack( return wd; } - s_race=battle_get_race(src); - s_ele=battle_get_attack_element(src); + s_race=status_get_race(src); + s_ele=status_get_attack_element(src); // ターゲット if(target->type == BL_MOB) @@ -1929,15 +634,15 @@ static struct Damage battle_calc_pet_weapon_attack( memset(&wd,0,sizeof(wd)); return wd; } - t_race=battle_get_race( target ); - t_size=battle_get_size( target ); - t_mode=battle_get_mode( target ); - t_sc_data=battle_get_sc_data( target ); + t_race=status_get_race( target ); + t_size=status_get_size( target ); + t_mode=status_get_mode( target ); + t_sc_data=status_get_sc_data( target ); flag=BF_SHORT|BF_WEAPON|BF_NORMAL; // 攻撃の種類の設定 // 回避率計算、回避判定は後で - flee = battle_get_flee(target); + flee = status_get_flee(target); if(battle_config.agi_penalty_type > 0 || battle_config.vit_penalty_type > 0) target_count += battle_counttargeted(target,src,battle_config.agi_penalty_count_lv); if(battle_config.agi_penalty_type > 0) { @@ -1949,32 +654,32 @@ static struct Damage battle_calc_pet_weapon_attack( if(flee < 1) flee = 1; } } - hitrate=battle_get_hit(src) - flee + 80; + hitrate=status_get_hit(src) - flee + 80; type=0; // normal div_ = 1; // single attack - luk=battle_get_luk(src); + luk=status_get_luk(src); if(battle_config.pet_str) - damage = battle_get_baseatk(src); + damage = status_get_baseatk(src); else damage = 0; if(skill_num==HW_MAGICCRASHER){ /* マジッククラッシャーはMATKで殴る */ - atkmin = battle_get_matk1(src); - atkmax = battle_get_matk2(src); + atkmin = status_get_matk1(src); + atkmax = status_get_matk2(src); }else{ - atkmin = battle_get_atk(src); - atkmax = battle_get_atk2(src); + atkmin = status_get_atk(src); + atkmax = status_get_atk2(src); } if(mob_db[pd->class_].range>3 ) flag=(flag&~BF_RANGEMASK)|BF_LONG; if(atkmin > atkmax) atkmin = atkmax; - cri = battle_get_critical(src); - cri -= battle_get_luk(target) * 2; // luk/5*10 => target_luk*2 not target_luk*3 + cri = status_get_critical(src); + cri -= status_get_luk(target) * 2; // luk/5*10 => target_luk*2 not target_luk*3 if(battle_config.enemy_critical_rate != 100) { cri = cri*battle_config.enemy_critical_rate/100; if(cri < 1) @@ -2286,22 +991,22 @@ static struct Damage battle_calc_pet_weapon_attack( // 属 性の適用 if(skill_num != 0 || s_ele != 0 || !battle_config.pet_attack_attr_none) - damage=battle_attr_fix(damage, s_ele, battle_get_element(target) ); + damage=battle_attr_fix(damage, s_ele, status_get_element(target) ); if(skill_num==PA_PRESSURE) /* プレッシャー 必中? */ damage = 500+300*skill_lv; // インベナム修正 if(skill_num==TF_POISON){ - damage = battle_attr_fix(damage + 15*skill_lv, s_ele, battle_get_element(target) ); + damage = battle_attr_fix(damage + 15*skill_lv, s_ele, status_get_element(target) ); } if(skill_num==MC_CARTREVOLUTION){ - damage = battle_attr_fix(damage, 0, battle_get_element(target) ); + damage = battle_attr_fix(damage, 0, status_get_element(target) ); } // 完全回避の判定 if(battle_config.enemy_perfect_flee) { - if(skill_num == 0 && tmd!=NULL && rand()%1000 < battle_get_flee2(target) ){ + if(skill_num == 0 && tmd!=NULL && rand()%1000 < status_get_flee2(target) ){ damage=0; type=0x0b; dmg_lv = ATK_LUCKY; @@ -2319,10 +1024,10 @@ static struct Damage battle_calc_pet_weapon_attack( wd.damage2=0; wd.type=type; wd.div_=div_; - wd.amotion=battle_get_amotion(src); + wd.amotion=status_get_amotion(src); if(skill_num == KN_AUTOCOUNTER) wd.amotion >>= 1; - wd.dmotion=battle_get_dmotion(target); + wd.dmotion=status_get_dmotion(target); wd.blewcount=blewcount; wd.flag=flag; wd.dmg_lv=dmg_lv; @@ -2337,9 +1042,9 @@ static struct Damage battle_calc_mob_weapon_attack( struct mob_data* md=(struct mob_data *)src,*tmd=NULL; int hitrate,flee,cri = 0,atkmin,atkmax; int luk,target_count = 1; - int def1 = battle_get_def(target); - int def2 = battle_get_def2(target); - int t_vit = battle_get_vit(target); + int def1 = status_get_def(target); + int def2 = status_get_def2(target); + int t_vit = status_get_vit(target); struct Damage wd; int damage,damage2=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv); int flag,skill,ac_flag = 0,dmg_lv = 0; @@ -2355,35 +1060,35 @@ static struct Damage battle_calc_mob_weapon_attack( return wd; } - s_race=battle_get_race(src); - s_ele=battle_get_attack_element(src); - sc_data=battle_get_sc_data(src); - sc_count=battle_get_sc_count(src); - option=battle_get_option(src); - opt1=battle_get_opt1(src); - opt2=battle_get_opt2(src); + s_race = status_get_race(src); + s_ele = status_get_attack_element(src); + sc_data = status_get_sc_data(src); + sc_count = status_get_sc_count(src); + option = status_get_option(src); + opt1 = status_get_opt1(src); + opt2 = status_get_opt2(src); // ターゲット - if(target->type==BL_PC) - tsd=(struct map_session_data *)target; - else if(target->type==BL_MOB) - tmd=(struct mob_data *)target; - t_race=battle_get_race( target ); - t_size=battle_get_size( target ); - t_mode=battle_get_mode( target ); - t_sc_data=battle_get_sc_data( target ); - - if((skill_num == 0 || (target->type == BL_PC && battle_config.pc_auto_counter_type&2) || - (target->type == BL_MOB && battle_config.monster_auto_counter_type&2)) && skill_lv >= 0) { + if(target->type == BL_PC) + tsd = (struct map_session_data *)target; + else if(target->type == BL_MOB) + tmd = (struct mob_data *)target; + t_race = status_get_race( target ); + t_size = status_get_size( target ); + t_mode = status_get_mode( target ); + t_sc_data = status_get_sc_data( target ); + + if(skill_num == 0 || (target->type == BL_PC && battle_config.pc_auto_counter_type&2) || + (target->type == BL_MOB && battle_config.monster_auto_counter_type&2)) { if(skill_num != CR_GRANDCROSS && t_sc_data && t_sc_data[SC_AUTOCOUNTER].timer != -1) { - int dir = map_calc_dir(src,target->x,target->y),t_dir = battle_get_dir(target); + int dir = map_calc_dir(src,target->x,target->y),t_dir = status_get_dir(target); int dist = distance(src->x,src->y,target->x,target->y); if(dist <= 0 || map_check_dir(dir,t_dir) ) { memset(&wd,0,sizeof(wd)); t_sc_data[SC_AUTOCOUNTER].val3 = 0; t_sc_data[SC_AUTOCOUNTER].val4 = 1; if(sc_data && sc_data[SC_AUTOCOUNTER].timer == -1) { - int range = battle_get_range(target); + int range = status_get_range(target); if((target->type == BL_PC && ((struct map_session_data *)target)->status.weapon != 11 && dist <= range+1) || (target->type == BL_MOB && range <= 3 && dist <= range+1) ) t_sc_data[SC_AUTOCOUNTER].val3 = src->id; @@ -2400,7 +1105,7 @@ static struct Damage battle_calc_mob_weapon_attack( flag=BF_SHORT|BF_WEAPON|BF_NORMAL; // 攻撃の種類の設定 // 回避率計算、回避判定は後で - flee = battle_get_flee(target); + flee = status_get_flee(target); if(battle_config.agi_penalty_type > 0 || battle_config.vit_penalty_type > 0) target_count += battle_counttargeted(target,src,battle_config.agi_penalty_count_lv); if(battle_config.agi_penalty_type > 0) { @@ -2412,23 +1117,23 @@ static struct Damage battle_calc_mob_weapon_attack( if(flee < 1) flee = 1; } } - hitrate=battle_get_hit(src) - flee + 80; + hitrate=status_get_hit(src) - flee + 80; type=0; // normal div_ = 1; // single attack - luk=battle_get_luk(src); + luk=status_get_luk(src); if(battle_config.enemy_str) - damage = battle_get_baseatk(src); + damage = status_get_baseatk(src); else damage = 0; if(skill_num==HW_MAGICCRASHER){ /* マジッククラッシャーはMATKで殴る */ - atkmin = battle_get_matk1(src); - atkmax = battle_get_matk2(src); + atkmin = status_get_matk1(src); + atkmax = status_get_matk2(src); }else{ - atkmin = battle_get_atk(src); - atkmax = battle_get_atk2(src); + atkmin = status_get_atk(src); + atkmax = status_get_atk2(src); } if(mob_db[md->class_].range>3 ) flag=(flag&~BF_RANGEMASK)|BF_LONG; @@ -2439,8 +1144,8 @@ static struct Damage battle_calc_mob_weapon_attack( atkmin=atkmax; } - cri = battle_get_critical(src); - cri -= battle_get_luk(target) * 3; + cri = status_get_critical(src); + cri -= status_get_luk(target) * 3; if(battle_config.enemy_critical_rate != 100) { cri = cri*battle_config.enemy_critical_rate/100; if(cri < 1) @@ -2736,7 +1441,7 @@ static struct Damage battle_calc_mob_weapon_attack( } } t_def = def2*8/10; - if(battle_check_undead(s_race,battle_get_elem_type(src)) || s_race==6) + if(battle_check_undead(s_race,status_get_elem_type(src)) || s_race==6) if(tsd && (skill=pc_checkskill(tsd,AL_DP)) > 0 ) t_def += skill* (int) (3 + (tsd->status.base_level+1)*0.04); // submitted by orn //t_def += skill*3; @@ -2814,10 +1519,10 @@ static struct Damage battle_calc_mob_weapon_attack( // 属 性の適用 if (!((battle_config.mob_ghostring_fix == 1) && - (battle_get_elem_type(target) == 8) && + (status_get_elem_type(target) == 8) && (target->type==BL_PC))) // [MouseJstr] if(skill_num != 0 || s_ele != 0 || !battle_config.mob_attack_attr_none) - damage=battle_attr_fix(damage, s_ele, battle_get_element(target) ); + damage=battle_attr_fix(damage, s_ele, status_get_element(target) ); //if(sc_data && sc_data[SC_AURABLADE].timer!=-1) /* オーラブレード 必中 */ // damage += sc_data[SC_AURABLADE].val1 * 10; @@ -2826,21 +1531,21 @@ static struct Damage battle_calc_mob_weapon_attack( // インベナム修正 if(skill_num==TF_POISON){ - damage = battle_attr_fix(damage + 15*skill_lv, s_ele, battle_get_element(target) ); + damage = battle_attr_fix(damage + 15*skill_lv, s_ele, status_get_element(target) ); } if(skill_num==MC_CARTREVOLUTION){ - damage = battle_attr_fix(damage, 0, battle_get_element(target) ); + damage = battle_attr_fix(damage, 0, status_get_element(target) ); } // 完全回避の判定 - if(skill_num == 0 && tsd!=NULL && rand()%1000 < battle_get_flee2(target) ){ + if(skill_num == 0 && tsd!=NULL && rand()%1000 < status_get_flee2(target) ){ damage=0; type=0x0b; dmg_lv = ATK_LUCKY; } if(battle_config.enemy_perfect_flee) { - if(skill_num == 0 && tmd!=NULL && rand()%1000 < battle_get_flee2(target) ){ + if(skill_num == 0 && tmd!=NULL && rand()%1000 < status_get_flee2(target) ){ damage=0; type=0x0b; dmg_lv = ATK_LUCKY; @@ -2861,10 +1566,10 @@ static struct Damage battle_calc_mob_weapon_attack( wd.damage2=0; wd.type=type; wd.div_=div_; - wd.amotion=battle_get_amotion(src); + wd.amotion=status_get_amotion(src); if(skill_num == KN_AUTOCOUNTER) wd.amotion >>= 1; - wd.dmotion=battle_get_dmotion(target); + wd.dmotion=status_get_dmotion(target); wd.blewcount=blewcount; wd.flag=flag; wd.dmg_lv=dmg_lv; @@ -2883,10 +1588,10 @@ static struct Damage battle_calc_pc_weapon_attack( int hitrate,flee,cri = 0,atkmin,atkmax; int dex,luk,target_count = 1; int no_cardfix=0; - int def1 = battle_get_def(target); - int def2 = battle_get_def2(target); + int def1 = status_get_def(target); + int def2 = status_get_def2(target); // int mdef1, mdef2; - int t_vit = battle_get_vit(target); + int t_vit = status_get_vit(target); struct Damage wd; int damage,damage2,damage3=0,damage4=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv); int flag,skill,dmg_lv = 0; @@ -2908,14 +1613,14 @@ static struct Damage battle_calc_pc_weapon_attack( // アタッカー - s_race=battle_get_race(src); //種族 - s_ele=battle_get_attack_element(src); //属性 - s_ele_=battle_get_attack_element2(src); //左手属性 - sc_data=battle_get_sc_data(src); //ステータス異常 - sc_count=battle_get_sc_count(src); //ステータス異常の数 - option=battle_get_option(src); //鷹とかペコとかカートとか - opt1=battle_get_opt1(src); //石化、凍結、スタン、睡眠、暗闇 - opt2=battle_get_opt2(src); //毒、呪い、沈黙、暗闇? + s_race=status_get_race(src); //種族 + s_ele=status_get_attack_element(src); //属性 + s_ele_=status_get_attack_element2(src); //左手属性 + sc_data=status_get_sc_data(src); //ステータス異常 + sc_count=status_get_sc_count(src); //ステータス異常の数 + option=status_get_option(src); //鷹とかペコとかカートとか + opt1=status_get_opt1(src); //石化、凍結、スタン、睡眠、暗闇 + opt2=status_get_opt2(src); //毒、呪い、沈黙、暗闇? if(skill_num != CR_GRANDCROSS) //グランドクロスでないなら sd->state.attack_type = BF_WEAPON; //攻撃タイプは武器攻撃 @@ -2925,24 +1630,24 @@ static struct Damage battle_calc_pc_weapon_attack( tsd=(struct map_session_data *)target; //tsdに代入(tmdはNULL) else if(target->type==BL_MOB) //対象がMobなら tmd=(struct mob_data *)target; //tmdに代入(tsdはNULL) - t_race=battle_get_race( target ); //対象の種族 - t_ele=battle_get_elem_type(target); //対象の属性 - t_size=battle_get_size( target ); //対象のサイズ - t_mode=battle_get_mode( target ); //対象のMode - t_sc_data=battle_get_sc_data( target ); //対象のステータス異常 + t_race=status_get_race( target ); //対象の種族 + t_ele=status_get_elem_type(target); //対象の属性 + t_size=status_get_size( target ); //対象のサイズ + t_mode=status_get_mode( target ); //対象のMode + t_sc_data=status_get_sc_data( target ); //対象のステータス異常 //オートカウンター処理ここから - if((skill_num == 0 || (target->type == BL_PC && battle_config.pc_auto_counter_type&2) || - (target->type == BL_MOB && battle_config.monster_auto_counter_type&2)) && skill_lv >= 0) { + if(skill_num == 0 || (target->type == BL_PC && battle_config.pc_auto_counter_type&2) || + (target->type == BL_MOB && battle_config.monster_auto_counter_type&2)) { if(skill_num != CR_GRANDCROSS && t_sc_data && t_sc_data[SC_AUTOCOUNTER].timer != -1) { //グランドクロスでなく、対象がオートカウンター状態の場合 - int dir = map_calc_dir(src,target->x,target->y),t_dir = battle_get_dir(target); + int dir = map_calc_dir(src,target->x,target->y),t_dir = status_get_dir(target); int dist = distance(src->x,src->y,target->x,target->y); if(dist <= 0 || map_check_dir(dir,t_dir) ) { //対象との距離が0以下、または対象の正面? memset(&wd,0,sizeof(wd)); t_sc_data[SC_AUTOCOUNTER].val3 = 0; t_sc_data[SC_AUTOCOUNTER].val4 = 1; if(sc_data && sc_data[SC_AUTOCOUNTER].timer == -1) { //自分がオートカウンター状態 - int range = battle_get_range(target); + int range = status_get_range(target); if((target->type == BL_PC && ((struct map_session_data *)target)->status.weapon != 11 && dist <= range+1) || //対象がPCで武器が弓矢でなく射程内 (target->type == BL_MOB && range <= 3 && dist <= range+1) ) //または対象がMobで射程が3以下で射程内 t_sc_data[SC_AUTOCOUNTER].val3 = src->id; @@ -2961,7 +1666,7 @@ static struct Damage battle_calc_pc_weapon_attack( flag=BF_SHORT|BF_WEAPON|BF_NORMAL; // 攻撃の種類の設定 // 回避率計算、回避判定は後で - flee = battle_get_flee(target); + flee = status_get_flee(target); if(battle_config.agi_penalty_type > 0 || battle_config.vit_penalty_type > 0) //AGI、VITペナルティ設定が有効 target_count += battle_counttargeted(target,src,battle_config.agi_penalty_count_lv); //対象の数を算出 if(battle_config.agi_penalty_type > 0) { @@ -2973,20 +1678,20 @@ static struct Damage battle_calc_pc_weapon_attack( if(flee < 1) flee = 1; //回避率は最低でも1 } } - hitrate=battle_get_hit(src) - flee + 80; //命中率計算 + hitrate=status_get_hit(src) - flee + 80; //命中率計算 type=0; // normal div_ = 1; // single attack - dex=battle_get_dex(src); //DEX - luk=battle_get_luk(src); //LUK - watk = battle_get_atk(src); //ATK - watk_ = battle_get_atk_(src); //ATK左手 + dex=status_get_dex(src); //DEX + luk=status_get_luk(src); //LUK + watk = status_get_atk(src); //ATK + watk_ = status_get_atk_(src); //ATK左手 if(skill_num==HW_MAGICCRASHER){ /* マジッククラッシャーはMATKで殴る */ - damage = damage2 = battle_get_matk1(src); //damega,damega2初登場、base_atkの取得 + damage = damage2 = status_get_matk1(src); //damega,damega2初登場、base_atkの取得 }else{ - damage = damage2 = battle_get_baseatk(&sd->bl); //damega,damega2初登場、base_atkの取得 + damage = damage2 = status_get_baseatk(&sd->bl); //damega,damega2初登場、base_atkの取得 } atkmin = atkmin_ = dex; //最低ATKはDEXで初期化? sd->state.arrow_atk = 0; //arrow_atk初期化 @@ -3050,14 +1755,14 @@ static struct Damage battle_calc_pc_weapon_attack( if(da == 0){ //ダブルアタックが発動していない // クリティカル計算 - cri = battle_get_critical(src); + cri = status_get_critical(src); if(sd->state.arrow_atk) cri += sd->arrow_cri; if(sd->status.weapon == 16) // カタールの場合、クリティカルを倍に cri <<=1; - cri -= battle_get_luk(target) * 3; + cri -= status_get_luk(target) * 3; if(t_sc_data != NULL && t_sc_data[SC_SLEEP].timer!=-1 ) // 睡眠中はクリティカルが倍に cri <<=1; if(ac_flag) cri = 1000; @@ -3554,12 +2259,12 @@ static struct Damage battle_calc_pc_weapon_attack( break; case ASC_BREAKER: // -- moonsoul (special damage for ASC_BREAKER skill) if(sd){ -/* int mdef1=battle_get_mdef(target); - int mdef2=battle_get_mdef2(target); +/* int mdef1=status_get_mdef(target); + int mdef2=status_get_mdef2(target); int imdef_flag=0; - damage = ((damage * 5) + (skill_lv * battle_get_int(src) * 5) + rand()%500 + 500) /2; - damage2 = ((damage2 * 5) + (skill_lv * battle_get_int(src) * 5) + rand()%500 + 500) /2; + damage = ((damage * 5) + (skill_lv * status_get_int(src) * 5) + rand()%500 + 500) /2; + damage2 = ((damage2 * 5) + (skill_lv * status_get_int(src) * 5) + rand()%500 + 500) /2; damage3 = damage; // physical damage can miss hitrate = 1000000;*/ @@ -3570,7 +2275,7 @@ static struct Damage battle_calc_pc_weapon_attack( // element modifier added right after this // calculate magic part of damage - damage3 = skill_lv * battle_get_int(src) * 5; + damage3 = skill_lv * status_get_int(src) * 5; // ignores magic defense now [Celest] /*if(sd->ignore_mdef_ele & (1<ignore_mdef_race & (1<equip_index[8] >= 0) { int index = sd->equip_index[8]; if(sd->inventory_data[index] && sd->inventory_data[index]->type == 5) { damage += sd->inventory_data[index]->weight/10; - damage += sd->status.inventory[index].refine * pc_getrefinebonus(0,1); + damage += sd->status.inventory[index].refine * status_getrefinebonus(0,1); } } } @@ -3712,7 +2417,7 @@ static struct Damage battle_calc_pc_weapon_attack( int index = sd->equip_index[9]; if(sd->inventory_data[index] && sd->inventory_data[index]->type == 4) { damage += (int)(double)(sd->inventory_data[index]->weight*(0.8*skill_lv*4/10)); - damage += sd->status.inventory[index].refine * pc_getrefinebonus(0,1); + damage += sd->status.inventory[index].refine * status_getrefinebonus(0,1); } } } @@ -3805,7 +2510,7 @@ static struct Damage battle_calc_pc_weapon_attack( cardfix=cardfix*(100+sd->addrace[11]+sd->arrow_addrace[11])/100; //ボス以外モンスターに追加ダメージ(弓矢による追加あり) } //特定Class用補正処理(少女の日記→ボンゴン用?) - t_class = battle_get_class(target); + t_class = status_get_class(target); for(i=0;iadd_damage_class_count;i++) { if(sd->add_damage_classid[i] == t_class) { cardfix=cardfix*(100+sd->add_damage_classrate[i])/100; @@ -3851,7 +2556,7 @@ static struct Damage battle_calc_pc_weapon_attack( cardfix=100; cardfix=cardfix*(100-tsd->subrace[s_race])/100; // 種族によるダメージ耐性 cardfix=cardfix*(100-tsd->subele[s_ele])/100; // 属性によるダメージ耐性 - if(battle_get_mode(src) & 0x20) + if(status_get_mode(src) & 0x20) cardfix=cardfix*(100-tsd->subrace[10])/100; //ボスからの攻撃はダメージ減少 else cardfix=cardfix*(100-tsd->subrace[11])/100; //ボス以外からの攻撃はダメージ減少 @@ -3898,8 +2603,8 @@ static struct Damage battle_calc_pc_weapon_attack( if(damage2 < 0) damage2 = 0; // 属 性の適用 - damage=battle_attr_fix(damage,s_ele, battle_get_element(target) ); - damage2=battle_attr_fix(damage2,s_ele_, battle_get_element(target) ); + damage=battle_attr_fix(damage,s_ele, status_get_element(target) ); + damage2=battle_attr_fix(damage2,s_ele_, status_get_element(target) ); // 星のかけら、気球の適用 damage += sd->star; @@ -3918,9 +2623,9 @@ static struct Damage battle_calc_pc_weapon_attack( // >二刀流の左右ダメージ計算誰かやってくれぇぇぇぇえええ! // >map_session_data に左手ダメージ(atk,atk2)追加して - // >pc_calcstatus()でやるべきかな? + // >status_calc_pc()でやるべきかな? // map_session_data に左手武器(atk,atk2,ele,star,atkmods)追加して - // pc_calcstatus()でデータを入力しています + // status_calc_pc()でデータを入力しています //左手のみ武器装備 if(sd->weapontype1 == 0 && sd->weapontype2 > 0) { @@ -3959,14 +2664,14 @@ static struct Damage battle_calc_pc_weapon_attack( // インベナム修正 if(skill_num==TF_POISON){ - damage = battle_attr_fix(damage + 15*skill_lv, s_ele, battle_get_element(target) ); + damage = battle_attr_fix(damage + 15*skill_lv, s_ele, status_get_element(target) ); } if(skill_num==MC_CARTREVOLUTION){ - damage = battle_attr_fix(damage, 0, battle_get_element(target) ); + damage = battle_attr_fix(damage, 0, status_get_element(target) ); } // 完全回避の判定 - if(skill_num == 0 && tsd!=NULL && div_ < 255 && rand()%1000 < battle_get_flee2(target) ){ + if(skill_num == 0 && tsd!=NULL && div_ < 255 && rand()%1000 < status_get_flee2(target) ){ damage=damage2=0; type=0x0b; dmg_lv = ATK_LUCKY; @@ -3974,7 +2679,7 @@ static struct Damage battle_calc_pc_weapon_attack( // 対象が完全回避をする設定がONなら if(battle_config.enemy_perfect_flee) { - if(skill_num == 0 && tmd!=NULL && div_ < 255 && rand()%1000 < battle_get_flee2(target) ) { + if(skill_num == 0 && tmd!=NULL && div_ < 255 && rand()%1000 < status_get_flee2(target) ) { damage=damage2=0; type=0x0b; dmg_lv = ATK_LUCKY; @@ -4054,10 +2759,10 @@ static struct Damage battle_calc_pc_weapon_attack( wd.damage2=damage2; wd.type=type; wd.div_=div_; - wd.amotion=battle_get_amotion(src); + wd.amotion=status_get_amotion(src); if(skill_num == KN_AUTOCOUNTER) wd.amotion >>= 1; - wd.dmotion=battle_get_dmotion(target); + wd.dmotion=status_get_dmotion(target); wd.blewcount=blewcount; wd.flag=flag; wd.dmg_lv=dmg_lv; @@ -4105,7 +2810,7 @@ struct Damage battle_calc_weapon_attack( if (target->type == BL_PC) pc_breakweapon((struct map_session_data *)target); else - skill_status_change_start(target,SC_STRIPWEAPON,1,75,0,0,skill_get_time2(WS_MELTDOWN,1),0 ); + status_change_start(target,SC_STRIPWEAPON,1,75,0,0,skill_get_time2(WS_MELTDOWN,1),0 ); } breakrate_ = 70*sd->sc_data[SC_MELTDOWN].val1; @@ -4113,7 +2818,7 @@ struct Damage battle_calc_weapon_attack( if (target->type == BL_PC) pc_breakarmor((struct map_session_data *)target); else - skill_status_change_start(target,SC_STRIPSHIELD,1,75,0,0,skill_get_time2(WS_MELTDOWN,1),0 ); + status_change_start(target,SC_STRIPSHIELD,1,75,0,0,skill_get_time2(WS_MELTDOWN,1),0 ); } } if(sd->sc_data[SC_OVERTHRUST].timer!=-1) @@ -4138,8 +2843,8 @@ struct Damage battle_calc_weapon_attack( struct Damage battle_calc_magic_attack( struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag) { - int mdef1=battle_get_mdef(target); - int mdef2=battle_get_mdef2(target); + int mdef1=status_get_mdef(target); + int mdef2=status_get_mdef2(target); int matk1,matk2,damage=0,div_=1,blewcount=skill_get_blewcount(skill_num,skill_lv),rdamage = 0; struct Damage md; int aflag; @@ -4162,13 +2867,13 @@ struct Damage battle_calc_magic_attack( return md; } - matk1=battle_get_matk1(bl); - matk2=battle_get_matk2(bl); + matk1=status_get_matk1(bl); + matk2=status_get_matk2(bl); ele = skill_get_pl(skill_num); - race = battle_get_race(bl); - t_ele = battle_get_elem_type(target); - t_race = battle_get_race(target); - t_mode = battle_get_mode(target); + race = status_get_race(bl); + t_ele = status_get_elem_type(target); + t_race = status_get_race(target); + t_mode = status_get_mode(target); #define MATK_FIX( a,b ) { matk1=matk1*(a)/(b); matk2=matk2*(a)/(b); } @@ -4206,10 +2911,10 @@ struct Damage battle_calc_magic_attack( case PR_TURNUNDEAD: // 攻撃リザレクションとターンアンデッド if(target->type != BL_PC && battle_check_undead(t_race,t_ele)){ int hp, mhp, thres; - hp = battle_get_hp(target); - mhp = battle_get_max_hp(target); - thres = (skill_lv * 20) + battle_get_luk(bl)+ - battle_get_int(bl) + battle_get_lv(bl)+ + hp = status_get_hp(target); + mhp = status_get_max_hp(target); + thres = (skill_lv * 20) + status_get_luk(bl)+ + status_get_int(bl) + status_get_lv(bl)+ ((200 - hp * 200 / mhp)); if(thres > 700) thres = 700; // if(battle_config.battle_log) @@ -4217,7 +2922,7 @@ struct Damage battle_calc_magic_attack( if(rand()%1000 < thres && !(t_mode&0x20)) // 成功 damage = hp; else // 失敗 - damage = battle_get_lv(bl) + battle_get_int(bl) + skill_lv * 10; + damage = status_get_lv(bl) + status_get_int(bl) + skill_lv * 10; } normalmagic_flag=0; break; @@ -4355,7 +3060,7 @@ struct Damage battle_calc_magic_attack( cardfix=cardfix*(100+sd->magic_addrace[10])/100; else cardfix=cardfix*(100+sd->magic_addrace[11])/100; - t_class = battle_get_class(target); + t_class = status_get_class(target); for(i=0;iadd_magic_damage_class_count;i++) { if(sd->add_magic_damage_classid[i] == t_class) { cardfix=cardfix*(100+sd->add_magic_damage_classrate[i])/100; @@ -4366,12 +3071,12 @@ struct Damage battle_calc_magic_attack( } if( tsd ){ - int s_class = battle_get_class(bl); + int s_class = status_get_class(bl); cardfix=100; cardfix=cardfix*(100-tsd->subele[ele])/100; // 属 性によるダメージ耐性 cardfix=cardfix*(100-tsd->subrace[race])/100; // 種族によるダメージ耐性 cardfix=cardfix*(100-tsd->magic_subrace[race])/100; - if(battle_get_mode(bl) & 0x20) + if(status_get_mode(bl) & 0x20) cardfix=cardfix*(100-tsd->magic_subrace[10])/100; else cardfix=cardfix*(100-tsd->magic_subrace[11])/100; @@ -4386,13 +3091,13 @@ struct Damage battle_calc_magic_attack( } if(damage < 0) damage = 0; - damage=battle_attr_fix(damage, ele, battle_get_element(target) ); // 属 性修正 + damage=battle_attr_fix(damage, ele, status_get_element(target) ); // 属 性修正 if(skill_num == CR_GRANDCROSS) { // グランドクロス struct Damage wd; wd=battle_calc_weapon_attack(bl,target,skill_num,skill_lv,flag); damage = (damage + wd.damage) * (100 + 40*skill_lv)/100; - if(battle_config.gx_dupele) damage=battle_attr_fix(damage, ele, battle_get_element(target) ); //属性2回かかる + if(battle_config.gx_dupele) damage=battle_attr_fix(damage, ele, status_get_element(target) ); //属性2回かかる if(bl==target) damage=damage/2; //反動は半分 } @@ -4426,8 +3131,8 @@ struct Damage battle_calc_magic_attack( md.damage=damage; md.div_=div_; - md.amotion=battle_get_amotion(bl); - md.dmotion=battle_get_dmotion(target); + md.amotion=status_get_amotion(bl); + md.dmotion=status_get_dmotion(target); md.damage2=0; md.type=0; md.blewcount=blewcount; @@ -4443,9 +3148,9 @@ struct Damage battle_calc_magic_attack( struct Damage battle_calc_misc_attack( struct block_list *bl,struct block_list *target,int skill_num,int skill_lv,int flag) { - int int_=battle_get_int(bl); -// int luk=battle_get_luk(bl); - int dex=battle_get_dex(bl); + int int_=status_get_int(bl); +// int luk=status_get_luk(bl); + int dex=status_get_dex(bl); int skill,ele,race,cardfix; struct map_session_data *sd=NULL,*tsd=NULL; int damage=0,div_=1,blewcount=skill_get_blewcount(skill_num,skill_lv); @@ -4494,7 +3199,7 @@ struct Damage battle_calc_misc_attack( damage=(dex/10+int_/2+skill*3+40)*2; if(flag > 1) damage /= flag; - if(battle_get_mode(target) & 0x40) + if(status_get_mode(target) & 0x40) damage = 1; break; @@ -4508,7 +3213,7 @@ struct Damage battle_calc_misc_attack( break; case NPC_SELFDESTRUCTION: // 自爆 - damage=battle_get_hp(bl)-(bl==target?1:0); + damage=status_get_hp(bl)-(bl==target?1:0); damagefix=0; break; @@ -4519,8 +3224,8 @@ struct Damage battle_calc_misc_attack( case NPC_DARKBREATH: { - struct status_change *sc_data = battle_get_sc_data(target); - int hitrate=battle_get_hit(bl) - battle_get_flee(target) + 80; + struct status_change *sc_data = status_get_sc_data(target); + int hitrate=status_get_hit(bl) - status_get_flee(target) + 80; hitrate = ( (hitrate>95)?95: ((hitrate<5)?5:hitrate) ); if(sc_data && (sc_data[SC_SLEEP].timer!=-1 || sc_data[SC_STAN].timer!=-1 || sc_data[SC_FREEZE].timer!=-1 || (sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0) ) ) @@ -4543,13 +3248,13 @@ struct Damage battle_calc_misc_attack( #endif if(flag > 1) damage /= flag; - if(battle_get_mode(target) & 0x40) + if(status_get_mode(target) & 0x40) damage = 1; break; } ele = skill_get_pl(skill_num); - race = battle_get_race(bl); + race = status_get_race(bl); if(damagefix){ if(damage<1 && skill_num != NPC_DARKBREATH) @@ -4563,14 +3268,14 @@ struct Damage battle_calc_misc_attack( damage=damage*cardfix/100; } if(damage < 0) damage = 0; - damage=battle_attr_fix(damage, ele, battle_get_element(target) ); // 属性修正 + damage=battle_attr_fix(damage, ele, status_get_element(target) ); // 属性修正 } div_=skill_get_num( skill_num,skill_lv ); if(div_>1) damage*=div_; - if(damage > 0 && (damage < div_ || (battle_get_def(target) >= 1000000 && battle_get_mdef(target) >= 1000000) ) ) { + if(damage > 0 && (damage < div_ || (status_get_def(target) >= 1000000 && status_get_mdef(target) >= 1000000) ) ) { damage = div_; } @@ -4578,8 +3283,8 @@ struct Damage battle_calc_misc_attack( md.damage=damage; md.div_=div_; - md.amotion=battle_get_amotion(bl); - md.dmotion=battle_get_dmotion(target); + md.amotion=status_get_amotion(bl); + md.dmotion=status_get_dmotion(target); md.damage2=0; md.type=0; md.blewcount=blewcount; @@ -4618,7 +3323,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, unsigned int tick,int flag) { struct map_session_data *sd=NULL; - struct status_change *sc_data = battle_get_sc_data(src),*t_sc_data=battle_get_sc_data(target); + struct status_change *sc_data = status_get_sc_data(src),*t_sc_data=status_get_sc_data(target); short *opt1; int race = 7, ele = 0; int damage,rdamage = 0; @@ -4637,7 +3342,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, if(target->type == BL_PC && pc_isdead((struct map_session_data *)target)) return 0; - opt1=battle_get_opt1(src); + opt1=status_get_opt1(src); if(opt1 && *opt1 > 0) { battle_stopattack(src); return 0; @@ -4651,8 +3356,8 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, !battle_check_range(src,target,0)) return 0; // 攻撃対象外 - race = battle_get_race(target); - ele = battle_get_elem_type(target); + race = status_get_race(target); + ele = status_get_elem_type(target); if(battle_check_target(src,target,BCT_ENEMY) > 0 && battle_check_range(src,target,0)){ // 攻撃対象となりうるので攻撃 @@ -4706,13 +3411,13 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, } if (wd.div_ == 255 && sd) { //三段掌 - int delay = 1000 - 4 * battle_get_agi(src) - 2 * battle_get_dex(src); + int delay = 1000 - 4 * status_get_agi(src) - 2 * status_get_dex(src); int skilllv; - if(wd.damage+wd.damage2 < battle_get_hp(target)) { + if(wd.damage+wd.damage2 < status_get_hp(target)) { if((skilllv = pc_checkskill(sd, MO_CHAINCOMBO)) > 0) delay += 300 * battle_config.combo_delay_rate /100; //追加ディレイをconfにより調整 - skill_status_change_start(src,SC_COMBO,MO_TRIPLEATTACK,skilllv,0,0,delay,0); + status_change_start(src,SC_COMBO,MO_TRIPLEATTACK,skilllv,0,0,delay,0); } sd->attackabletime = sd->canmove_tick = tick + delay; clif_combo_delay(src,delay); @@ -4736,16 +3441,16 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, skill_additional_effect(src,target,0,0,BF_WEAPON,tick); if(sd) { if(sd->weapon_coma_ele[ele] > 0 && rand()%10000 < sd->weapon_coma_ele[ele]) - battle_damage(src,target,battle_get_max_hp(target),1); + battle_damage(src,target,status_get_max_hp(target),1); if(sd->weapon_coma_race[race] > 0 && rand()%10000 < sd->weapon_coma_race[race]) - battle_damage(src,target,battle_get_max_hp(target),1); - if(battle_get_mode(target) & 0x20) { + battle_damage(src,target,status_get_max_hp(target),1); + if(status_get_mode(target) & 0x20) { if(sd->weapon_coma_race[10] > 0 && rand()%10000 < sd->weapon_coma_race[10]) - battle_damage(src,target,battle_get_max_hp(target),1); + battle_damage(src,target,status_get_max_hp(target),1); } else { if(sd->weapon_coma_race[11] > 0 && rand()%10000 < sd->weapon_coma_race[11]) - battle_damage(src,target,battle_get_max_hp(target),1); + battle_damage(src,target,status_get_max_hp(target),1); } } } @@ -4849,12 +3554,12 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, if(t_sc_data && t_sc_data[SC_AUTOCOUNTER].timer != -1 && t_sc_data[SC_AUTOCOUNTER].val4 > 0) { if(t_sc_data[SC_AUTOCOUNTER].val3 == src->id) battle_weapon_attack(target,src,tick,0x8000|t_sc_data[SC_AUTOCOUNTER].val1); - skill_status_change_end(target,SC_AUTOCOUNTER,-1); + status_change_end(target,SC_AUTOCOUNTER,-1); } if(t_sc_data && t_sc_data[SC_POISONREACT].timer != -1 && t_sc_data[SC_POISONREACT].val4 > 0) { // poison react [Celest] if(t_sc_data[SC_POISONREACT].val3 == src->id) { struct map_session_data *tsd = (struct map_session_data *)target; - if ((src->type == BL_MOB && battle_get_elem_type(src)==5) || (src->type == BL_PC && battle_get_attack_element(src)==5)) { + if ((src->type == BL_MOB && status_get_elem_type(src)==5) || (src->type == BL_PC && status_get_attack_element(src)==5)) { t_sc_data[SC_POISONREACT].val2 = 0; battle_weapon_attack(target,src,tick,flag|AS_POISONREACT); } else { @@ -4862,18 +3567,18 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, --t_sc_data[SC_POISONREACT].val2; } if (t_sc_data[SC_POISONREACT].val2<=0) - skill_status_change_end(target,SC_POISONREACT,-1); + status_change_end(target,SC_POISONREACT,-1); } } if (t_sc_data && t_sc_data[SC_BLADESTOP_WAIT].timer != -1 && - !(battle_get_mode(src)&0x20)) { // ボスには無効 + !(status_get_mode(src)&0x20)) { // ボスには無効 int lv = t_sc_data[SC_BLADESTOP_WAIT].val1; - skill_status_change_end(target,SC_BLADESTOP_WAIT,-1); - skill_status_change_start(src,SC_BLADESTOP,lv,1,(int)src,(int)target,skill_get_time2(MO_BLADESTOP,lv),0); - skill_status_change_start(target,SC_BLADESTOP,lv,2,(int)target,(int)src,skill_get_time2(MO_BLADESTOP,lv),0); + status_change_end(target,SC_BLADESTOP_WAIT,-1); + status_change_start(src,SC_BLADESTOP,lv,1,(int)src,(int)target,skill_get_time2(MO_BLADESTOP,lv),0); + status_change_start(target,SC_BLADESTOP,lv,2,(int)target,(int)src,skill_get_time2(MO_BLADESTOP,lv),0); } if(t_sc_data && t_sc_data[SC_SPLASHER].timer!=-1) //殴ったので対象のベナムスプラッシャー状態を解除 - skill_status_change_end(target,SC_SPLASHER,-1); + status_change_end(target,SC_SPLASHER,-1); map_freeblock_unlock(); } @@ -4937,8 +3642,8 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f return -1; // Celest - sc_data = battle_get_sc_data(src); - tsc_data = battle_get_sc_data(target); + sc_data = status_get_sc_data(src); + tsc_data = status_get_sc_data(target); if ((sc_data && sc_data[SC_BASILICA].timer != -1) || (tsc_data && tsc_data[SC_BASILICA].timer != -1)) return -1; @@ -5017,11 +3722,11 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f if(ss->type == BL_PET && target->type==BL_MOB) return 0; - s_p=battle_get_party_id(ss); - s_g=battle_get_guild_id(ss); + s_p=status_get_party_id(ss); + s_g=status_get_guild_id(ss); - t_p=battle_get_party_id(target); - t_g=battle_get_guild_id(target); + t_p=status_get_party_id(target); + t_g=status_get_guild_id(target); if(flag&0x10000) { if(s_p && t_p && s_p == t_p) // 同じパーティなら肯定(味方) diff --git a/src/map/battle.h b/src/map/battle.h index d88ea54c1..4a75dfe1e 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -63,50 +63,6 @@ int battle_weapon_attack( struct block_list *bl,struct block_list *target, // 各種パラメータを得る int battle_counttargeted(struct block_list *bl,struct block_list *src,int target_lv); -int battle_get_class(struct block_list *bl); -int battle_get_dir(struct block_list *bl); -int battle_get_lv(struct block_list *bl); -int battle_get_range(struct block_list *bl); -int battle_get_hp(struct block_list *bl); -int battle_get_max_hp(struct block_list *bl); -int battle_get_str(struct block_list *bl); -int battle_get_agi(struct block_list *bl); -int battle_get_vit(struct block_list *bl); -int battle_get_int(struct block_list *bl); -int battle_get_dex(struct block_list *bl); -int battle_get_luk(struct block_list *bl); -int battle_get_hit(struct block_list *bl); -int battle_get_flee(struct block_list *bl); -int battle_get_def(struct block_list *bl); -int battle_get_mdef(struct block_list *bl); -int battle_get_flee2(struct block_list *bl); -int battle_get_def2(struct block_list *bl); -int battle_get_mdef2(struct block_list *bl); -int battle_get_baseatk(struct block_list *bl); -int battle_get_atk(struct block_list *bl); -int battle_get_atk2(struct block_list *bl); -int battle_get_speed(struct block_list *bl); -int battle_get_adelay(struct block_list *bl); -int battle_get_amotion(struct block_list *bl); -int battle_get_dmotion(struct block_list *bl); -int battle_get_element(struct block_list *bl); -int battle_get_attack_element(struct block_list *bl); -int battle_get_attack_element2(struct block_list *bl); //左手武器属性取得 -#define battle_get_elem_type(bl) (battle_get_element(bl)%10) -#define battle_get_elem_level(bl) (battle_get_element(bl)/10/2) -int battle_get_party_id(struct block_list *bl); -int battle_get_guild_id(struct block_list *bl); -int battle_get_race(struct block_list *bl); -int battle_get_size(struct block_list *bl); -int battle_get_mode(struct block_list *bl); -int battle_get_mexp(struct block_list *bl); - -struct status_change *battle_get_sc_data(struct block_list *bl); -short *battle_get_sc_count(struct block_list *bl); -short *battle_get_opt1(struct block_list *bl); -short *battle_get_opt2(struct block_list *bl); -short *battle_get_opt3(struct block_list *bl); -short *battle_get_option(struct block_list *bl); enum { BCT_NOENEMY =0x00000, diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 5d65c8f01..40961f39e 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -15,6 +15,7 @@ #include "itemdb.h" #include "map.h" #include "pc.h" +#include "status.h" #include "skill.h" #include "mob.h" #include "pet.h" @@ -319,7 +320,7 @@ int charcommand_jobchange( pl_sd->status.class_ = pl_sd->view_class = 4015; pl_sd->status.option &= ~0x0020; clif_changeoption(&pl_sd->bl); - pc_calcstatus(pl_sd, 0); + status_calc_pc(pl_sd, 0); } } else { if (!pc_isriding(sd)) { @@ -433,9 +434,9 @@ int charcommand_petfriendly( if ((pl_sd->pet.intimate > 0 && t <= 0) || (pl_sd->pet.intimate <= 0 && t > 0)) { if (pl_sd->bl.prev != NULL) - pc_calcstatus(pl_sd, 0); + status_calc_pc(pl_sd, 0); else - pc_calcstatus(pl_sd, 2); + status_calc_pc(pl_sd, 2); } } clif_displaymessage(pl_sd->fd, msg_table[182]); // Pet friendly value changed! @@ -612,7 +613,7 @@ int charcommand_option( } } clif_changeoption(&pl_sd->bl); - pc_calcstatus(pl_sd, 0); + status_calc_pc(pl_sd, 0); clif_displaymessage(fd, msg_table[58]); // Character's options changed. } else { clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. diff --git a/src/map/clif.c b/src/map/clif.c index eeae87439..d0bf86e27 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -30,6 +30,7 @@ #include "chrif.h" #include "clif.h" #include "pc.h" +#include "status.h" #include "npc.h" #include "itemdb.h" #include "chat.h" @@ -695,7 +696,7 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) { WBUFW(buf,0) = 0x78; WBUFL(buf,2) = sd->bl.id; - WBUFW(buf,6) = battle_get_speed(&sd->bl); + WBUFW(buf,6) = status_get_speed(&sd->bl); WBUFW(buf,8) = sd->opt1; WBUFW(buf,10) = sd->opt2; WBUFW(buf,12) = sd->status.option; @@ -707,7 +708,7 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) { WBUFB(buf,49) = 5; WBUFB(buf,50) = 5; WBUFB(buf,51) = 0; - WBUFW(buf,52) = ((level = battle_get_lv(&sd->bl)) > battle_config.max_lv) ? battle_config.max_lv : level; + WBUFW(buf,52) = ((level = status_get_lv(&sd->bl)) > battle_config.max_lv) ? battle_config.max_lv : level; return packet_len_table[0x78]; } @@ -785,7 +786,7 @@ static int clif_set0078(struct map_session_data *sd, unsigned char *buf) { WBUFB(buf,49) = 5; WBUFB(buf,50) = 5; WBUFB(buf,51) = sd->state.dead_sit; - WBUFW(buf,52) = ((level = battle_get_lv(&sd->bl)) > battle_config.max_lv) ? battle_config.max_lv : level; + WBUFW(buf,52) = ((level = status_get_lv(&sd->bl)) > battle_config.max_lv) ? battle_config.max_lv : level; return packet_len_table[0x1d8]; #endif @@ -804,7 +805,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) { WBUFW(buf,0)=0x7b; WBUFL(buf,2)=sd->bl.id; - WBUFW(buf,6)=battle_get_speed(&sd->bl); + WBUFW(buf,6)=status_get_speed(&sd->bl); WBUFW(buf,8)=sd->opt1; WBUFW(buf,10)=sd->opt2; WBUFW(buf,12)=sd->status.option; @@ -816,7 +817,7 @@ static int clif_set007b(struct map_session_data *sd,unsigned char *buf) { WBUFB(buf,55)=0; WBUFB(buf,56)=5; WBUFB(buf,57)=5; - WBUFW(buf,58)=((level = battle_get_lv(&sd->bl))>battle_config.max_lv)? battle_config.max_lv:level; + WBUFW(buf,58)=((level = status_get_lv(&sd->bl))>battle_config.max_lv)? battle_config.max_lv:level; return packet_len_table[0x7b]; } @@ -975,7 +976,7 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf) WBUFW(buf,0)=0x78; WBUFL(buf,2)=md->bl.id; - WBUFW(buf,6)=battle_get_speed(&md->bl); + WBUFW(buf,6)=status_get_speed(&md->bl); WBUFW(buf,8)=md->opt1; WBUFW(buf,10)=md->opt2; WBUFW(buf,12)=md->option; @@ -1009,7 +1010,7 @@ static int clif_mob0078(struct mob_data *md, unsigned char *buf) WBUFB(buf,48)|=md->dir&0x0f; WBUFB(buf,49)=5; WBUFB(buf,50)=5; - WBUFW(buf,52)=((level = battle_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level; + WBUFW(buf,52)=((level = status_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level; return packet_len_table[0x78]; } @@ -1027,7 +1028,7 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) { WBUFW(buf,0)=0x7b; WBUFL(buf,2)=md->bl.id; - WBUFW(buf,6)=battle_get_speed(&md->bl); + WBUFW(buf,6)=status_get_speed(&md->bl); WBUFW(buf,8)=md->opt1; WBUFW(buf,10)=md->opt2; WBUFW(buf,12)=md->option; @@ -1062,7 +1063,7 @@ static int clif_mob007b(struct mob_data *md, unsigned char *buf) { WBUFPOS2(buf,50,md->bl.x,md->bl.y,md->to_x,md->to_y); WBUFB(buf,56)=5; WBUFB(buf,57)=5; - WBUFW(buf,58)=((level = battle_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level; + WBUFW(buf,58)=((level = status_get_lv(&md->bl))>battle_config.max_lv)? battle_config.max_lv:level; return packet_len_table[0x7b]; } @@ -1156,7 +1157,7 @@ static int clif_pet0078(struct pet_data *pd, unsigned char *buf) { WBUFB(buf,48)|=pd->dir&0x0f; WBUFB(buf,49)=0; WBUFB(buf,50)=0; - WBUFW(buf,52)=((level = battle_get_lv(&pd->bl))>battle_config.max_lv)? battle_config.max_lv:level; + WBUFW(buf,52)=((level = status_get_lv(&pd->bl))>battle_config.max_lv)? battle_config.max_lv:level; return packet_len_table[0x78]; } @@ -1199,7 +1200,7 @@ static int clif_pet007b(struct pet_data *pd, unsigned char *buf) { WBUFPOS2(buf,50,pd->bl.x,pd->bl.y,pd->to_x,pd->to_y); WBUFB(buf,56)=0; WBUFB(buf,57)=0; - WBUFW(buf,58)=((level = battle_get_lv(&pd->bl))>battle_config.max_lv)? battle_config.max_lv:level; + WBUFW(buf,58)=((level = status_get_lv(&pd->bl))>battle_config.max_lv)? battle_config.max_lv:level; return packet_len_table[0x7b]; } @@ -2884,13 +2885,13 @@ int clif_changeoption(struct block_list* bl) nullpo_retr(0, bl); - option = *battle_get_option(bl); - sc_data = battle_get_sc_data(bl); + option = *status_get_option(bl); + sc_data = status_get_sc_data(bl); WBUFW(buf,0) = 0x119; WBUFL(buf,2) = bl->id; - WBUFW(buf,6) = *battle_get_opt1(bl); - WBUFW(buf,8) = *battle_get_opt2(bl); + WBUFW(buf,6) = *status_get_opt1(bl); + WBUFW(buf,8) = *status_get_opt2(bl); WBUFW(buf,10) = option; WBUFB(buf,12) = 0; // ?? @@ -2908,9 +2909,9 @@ int clif_changeoption(struct block_list* bl) for(i=0;itype == BL_PC && ((struct map_session_data *)dst)->special_state.infinite_endure) type = 9; @@ -4191,7 +4192,7 @@ int clif_skillinfo(struct map_session_data *sd,int skillid,int type,int range) if(range < 0) { range = skill_get_range(id,sd->status.skill[skillid].lv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); WFIFOW(fd,12)= range; } else WFIFOW(fd,12)= range; @@ -4228,7 +4229,7 @@ int clif_skillinfoblock(struct map_session_data *sd) WFIFOW(fd,len+8) = skill_get_sp(id,sd->status.skill[i].lv); range = skill_get_range(id,sd->status.skill[i].lv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); WFIFOW(fd,len+10)= range; memset(WFIFOP(fd,len+12),0,24); if(!(skill_get_inf2(id)&0x01) || battle_config.quest_skill_learn == 1 || (battle_config.gm_allskill > 0 && pc_isGM(sd) >= battle_config.gm_allskill) ) @@ -4263,7 +4264,7 @@ int clif_skillup(struct map_session_data *sd,int skill_num) WFIFOW(fd,6) = skill_get_sp(skill_num,sd->status.skill[skill_num].lv); range = skill_get_range(skill_num,sd->status.skill[skill_num].lv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); WFIFOW(fd,8) = range; //WFIFOB(fd,10) = (sd->status.skill[skill_num].lv < skill_get_max(sd->status.skill[skill_num].id)) ? 1 : 0; WFIFOB(fd,10) = (sd->status.skill[skill_num].lv < skill_tree_get_max(sd->status.skill[skill_num].id, sd->status.class_)) ? 1 : 0; @@ -4355,7 +4356,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst, nullpo_retr(0, src); nullpo_retr(0, dst); - sc_data = battle_get_sc_data(dst); + sc_data = status_get_sc_data(dst); if(type != 5 && dst->type == BL_PC && ((struct map_session_data *)dst)->special_state.infinite_endure) type = 9; @@ -4410,7 +4411,7 @@ int clif_skill_damage2(struct block_list *src,struct block_list *dst, nullpo_retr(0, src); nullpo_retr(0, dst); - sc_data = battle_get_sc_data(dst); + sc_data = status_get_sc_data(dst); if(type != 5 && dst->type == BL_PC && ((struct map_session_data *)dst)->special_state.infinite_endure) type = 9; @@ -4639,10 +4640,10 @@ int clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) WBUFW(buf, 4)=md->level; WBUFW(buf, 6)=mob_db[md->class_].size; WBUFL(buf, 8)=md->hp; - WBUFW(buf,12)=battle_get_def2(&md->bl); + WBUFW(buf,12)=status_get_def2(&md->bl); WBUFW(buf,14)=mob_db[md->class_].race; - WBUFW(buf,16)=battle_get_mdef2(&md->bl) - (mob_db[md->class_].vit>>1); - WBUFW(buf,18)=battle_get_elem_type(&md->bl); + WBUFW(buf,16)=status_get_mdef2(&md->bl) - (mob_db[md->class_].vit>>1); + WBUFW(buf,18)=status_get_elem_type(&md->bl); for(i=0;i<9;i++) WBUFB(buf,20+i)= battle_attr_fix(100,i+1,md->def_ele); @@ -5116,7 +5117,7 @@ int clif_item_skill(struct map_session_data *sd,int skillid,int skilllv,const ch WFIFOW(fd,10)=skill_get_sp(skillid,skilllv); range = skill_get_range(skillid,skilllv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); WFIFOW(fd,12)=range; strncpy((char*)WFIFOP(fd,14),name,24); WFIFOB(fd,38)=0; @@ -7529,13 +7530,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(sd->status.hpstatus.max_hp>>2 && pc_checkskill(sd,SM_AUTOBERSERK)>0 && (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 )) // オートバーサーク発動 - skill_status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0); + status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0); // if(time(&timer) < ((weddingtime=pc_readglobalreg(sd,"PC_WEDDING_TIME")) + 3600)) -// skill_status_change_start(&sd->bl,SC_WEDDING,0,weddingtime,0,0,36000,0); +// status_change_start(&sd->bl,SC_WEDDING,0,weddingtime,0,0,36000,0); if(battle_config.muting_players && sd->status.manner < 0) - skill_status_change_start(&sd->bl,SC_NOCHAT,0,0,0,0,0,0); + status_change_start(&sd->bl,SC_NOCHAT,0,0,0,0,0,0); if (night_flag) { if (battle_config.night_darkness_level > 0 && !map[sd->bl.m].flag.indoors) @@ -7554,16 +7555,16 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) // option clif_changeoption(&sd->bl); if(sd->sc_data[SC_TRICKDEAD].timer != -1) - skill_status_change_end(&sd->bl,SC_TRICKDEAD,-1); + status_change_end(&sd->bl,SC_TRICKDEAD,-1); if(sd->sc_data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele)) - skill_status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1); + status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1); if(sd->special_state.infinite_endure && sd->sc_data[SC_ENDURE].timer == -1) - skill_status_change_start(&sd->bl,SC_ENDURE,10,1,0,0,0,0); + status_change_start(&sd->bl,SC_ENDURE,10,1,0,0,0,0); for(i=0;istatus.inventory[i].equip && sd->status.inventory[i].equip & 0x0002 && sd->status.inventory[i].attribute==1) - skill_status_change_start(&sd->bl,SC_BROKNWEAPON,0,0,0,0,0,0); + status_change_start(&sd->bl,SC_BROKNWEAPON,0,0,0,0,0,0); if(sd->status.inventory[i].equip && sd->status.inventory[i].equip & 0x0010 && sd->status.inventory[i].attribute==1) - skill_status_change_start(&sd->bl,SC_BROKNARMOR,0,0,0,0,0,0); + status_change_start(&sd->bl,SC_BROKNARMOR,0,0,0,0,0,0); } map_foreachinarea(clif_getareachar,sd->bl.m,sd->bl.x-AREA_SIZE,sd->bl.y-AREA_SIZE,sd->bl.x+AREA_SIZE,sd->bl.y+AREA_SIZE,0,sd); @@ -7961,7 +7962,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c < sd->state.snovice_flag = 3; else if (sd->state.snovice_flag == 3) { int i; - skill_status_change_start(&sd->bl,SkillStatusChangeTable[MO_EXPLOSIONSPIRITS],1,0,0,0,skill_get_time(MO_EXPLOSIONSPIRITS,1),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[MO_EXPLOSIONSPIRITS],1,0,0,0,skill_get_time(MO_EXPLOSIONSPIRITS,1),0 ); for(i=0;i<5;i++) pc_addspiritball(sd,skill_get_time(MO_CALLSPIRITS,1),5); sd->state.snovice_flag = 0; @@ -8031,7 +8032,7 @@ void clif_changed_dir(struct block_list *bl) { WBUFL(buf,2) = bl->id; if (sd) WBUFW(buf,6) = sd->head_dir; - WBUFB(buf,8) = battle_get_dir(bl); + WBUFB(buf,8) = status_get_dir(bl); if (sd && sd->disguise > 23 && sd->disguise < 4001) // mob disguises [Valaris] clif_send(buf, packet_len_table[0x9c], &sd->bl, AREA); else @@ -8610,9 +8611,9 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd) index = RFIFOW(fd,2)-2; /*if(sd->status.inventory[index].attribute == 1 && sd->sc_data && sd->sc_data[SC_BROKNWEAPON].timer!=-1) - skill_status_change_end(&sd->bl,SC_BROKNWEAPON,-1); + status_change_end(&sd->bl,SC_BROKNWEAPON,-1); if(sd->status.inventory[index].attribute == 1 && sd->sc_data && sd->sc_data[SC_BROKNARMOR].timer!=-1) - skill_status_change_end(&sd->bl,SC_BROKNARMOR,-1); + status_change_end(&sd->bl,SC_BROKNARMOR,-1); if(sd->sc_count && ( sd->sc_data[SC_BLADESTOP].timer!=-1 || sd->sc_data[SC_BERSERK].timer!=-1 )) return;*/ @@ -10062,10 +10063,10 @@ void clif_parse_GMReqNoChat(int fd,struct map_session_data *sd) WFIFOSET(dstfd,packet_len_table[0x14b]); dstsd->status.manner -= limit; if(dstsd->status.manner < 0) - skill_status_change_start(bl,SC_NOCHAT,0,0,0,0,0,0); + status_change_start(bl,SC_NOCHAT,0,0,0,0,0,0); else{ dstsd->status.manner = 0; - skill_status_change_end(bl,SC_NOCHAT,-1); + status_change_end(bl,SC_NOCHAT,-1); } printf("name:%s type:%d limit:%d manner:%d\n",dstsd->status.name,type,limit,dstsd->status.manner); } @@ -10263,7 +10264,7 @@ void clif_parse_sn_explosionspirits(int fd, struct map_session_data *sd) } if(s_class.job == 23 && sd->status.base_exp > 0 && nextbaseexp > 0 && (int)((double)1000*sd->status.base_exp/nextbaseexp)%100==0){ clif_skill_nodamage(&sd->bl,&sd->bl,MO_EXPLOSIONSPIRITS,5,1); - skill_status_change_start(&sd->bl,SkillStatusChangeTable[MO_EXPLOSIONSPIRITS],5,0,0,0,skill_get_time(MO_EXPLOSIONSPIRITS,5),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[MO_EXPLOSIONSPIRITS],5,0,0,0,skill_get_time(MO_EXPLOSIONSPIRITS,5),0 ); } } return; diff --git a/src/map/guild.c b/src/map/guild.c index 8099ac934..64e2b29d2 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -13,6 +13,7 @@ #include "battle.h" #include "npc.h" #include "pc.h" +#include "status.h" #include "map.h" #include "mob.h" #include "intif.h" @@ -995,7 +996,7 @@ int guild_skillup(struct map_session_data *sd,int skill_num,int flag) g->skill[idx].lv < guild_skill_get_max(skill_num) ){ intif_guild_skillup(g->guild_id,skill_num,sd->status.account_id,flag); } - pc_calcstatus (sd, 0); // Celest + status_calc_pc (sd, 0); // Celest return 0; } diff --git a/src/map/map.c b/src/map/map.c index 00643faca..2a74e94e8 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -22,6 +22,7 @@ #include "intif.h" #include "npc.h" #include "pc.h" +#include "status.h" #include "mob.h" #include "chat.h" #include "itemdb.h" @@ -1011,7 +1012,7 @@ int map_quit(struct map_session_data *sd) { if(sd->sc_data && sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中の終了はHPを100に sd->status.hp = 100; - skill_status_change_clear(&sd->bl,1); // ステ?タス異常を解除する + status_change_clear(&sd->bl,1); // ステ?タス異常を解除する skill_clear_unitgroup(&sd->bl); // スキルユニットグル?プの削除 skill_cleartimerskill(&sd->bl); @@ -1025,7 +1026,7 @@ int map_quit(struct map_session_data *sd) { skill_gangsterparadise(sd,0); if (sd->state.auth) - pc_calcstatus(sd,4); + status_calc_pc(sd,4); // skill_clear_unitgroup(&sd->bl); // [Sara-chan] clif_clearchar_area(&sd->bl,2); @@ -2808,6 +2809,7 @@ int do_init(int argc, char *argv[]) { do_init_mob(); // npcの初期化時?でmob_spawnして、mob_dbを?照するのでinit_npcより先 do_init_script(); do_init_pc(); + do_init_status(); do_init_party(); do_init_guild(); do_init_storage(); diff --git a/src/map/mob.c b/src/map/mob.c index 741982041..6a2666cf1 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -13,6 +13,7 @@ #include "clif.h" #include "intif.h" #include "pc.h" +#include "status.h" #include "mob.h" #include "guild.h" #include "itemdb.h" @@ -449,8 +450,8 @@ static int calc_next_walk_step(struct mob_data *md) if(md->walkpath.path_pos>=md->walkpath.path_len) return -1; if(md->walkpath.path[md->walkpath.path_pos]&1) - return battle_get_speed(&md->bl)*14/10; - return battle_get_speed(&md->bl); + return status_get_speed(&md->bl)*14/10; + return status_get_speed(&md->bl); } static int mob_walktoxy_sub(struct mob_data *md); @@ -634,9 +635,9 @@ static int mob_attack(struct mob_data *md,unsigned int tick,int data) md->target_lv = battle_weapon_attack(&md->bl,tbl,tick,0); if(!(battle_config.monster_cloak_check_type&2) && md->sc_data[SC_CLOAKING].timer != -1) - skill_status_change_end(&md->bl,SC_CLOAKING,-1); + status_change_end(&md->bl,SC_CLOAKING,-1); - md->attackabletime = tick + battle_get_adelay(&md->bl); + md->attackabletime = tick + status_get_adelay(&md->bl); md->timer=add_timer(md->attackabletime,mob_timer,md->bl.id,0); md->state.state=MS_ATTACK; @@ -693,7 +694,7 @@ int mob_changestate(struct mob_data *md,int state,int type) if(i>0 && i<2000) md->timer=add_timer(md->attackabletime,mob_timer,md->bl.id,0); else if(type) { - md->attackabletime = tick + battle_get_amotion(&md->bl); + md->attackabletime = tick + status_get_amotion(&md->bl); md->timer=add_timer(md->attackabletime,mob_timer,md->bl.id,0); } else { @@ -712,7 +713,7 @@ int mob_changestate(struct mob_data *md,int state,int type) // Since it died, all aggressors' attack to this mob is stopped. clif_foreachclient(mob_stopattacked,md->bl.id); skill_unit_out_all(&md->bl,gettick(),1); - skill_status_change_clear(&md->bl,2); // ステータス異常を解除する + status_change_clear(&md->bl,2); // ステータス異常を解除する skill_clear_unitgroup(&md->bl); // 全てのスキルユニットグループを削除する skill_cleartimerskill(&md->bl); if(md->deletetimer!=-1) @@ -996,10 +997,10 @@ int mob_spawn(int id) memset(md->skillunit,0,sizeof(md->skillunit)); memset(md->skillunittick,0,sizeof(md->skillunittick)); - md->hp = battle_get_max_hp(&md->bl); + md->hp = status_get_max_hp(&md->bl); if(md->hp<=0){ mob_makedummymobdb(md->class_); - md->hp = battle_get_max_hp(&md->bl); + md->hp = status_get_max_hp(&md->bl); } clif_spawnmob(md); @@ -1067,7 +1068,7 @@ int mob_stop_walking(struct mob_data *md,int type) if(type&0x01) clif_fixmobpos(md); if(type&0x02) { - int delay=battle_get_dmotion(&md->bl); + int delay=status_get_dmotion(&md->bl); unsigned int tick = gettick(); if(md->canmove_tick < tick) md->canmove_tick = tick + delay; @@ -1169,8 +1170,8 @@ int mob_target(struct mob_data *md,struct block_list *bl,int dist) nullpo_retr(0, md); nullpo_retr(0, bl); - sc_data = battle_get_sc_data(bl); - option = battle_get_option(bl); + sc_data = status_get_sc_data(bl); + option = status_get_option(bl); race=mob_db[md->class_].race; if(!md->mode) @@ -1502,7 +1503,7 @@ static int mob_randomwalk(struct mob_data *md,int tick) nullpo_retr(0, md); - speed=battle_get_speed(&md->bl); + speed=status_get_speed(&md->bl); if(DIFF_TICK(md->next_walktime,tick)<0){ int i,x,y,c,d=12-md->move_fail_count; int mask[8][2] = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}}; @@ -2110,7 +2111,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) nullpo_retr(0, md); //srcはNULLで呼ばれる場合もあるので、他でチェック - max_hp = battle_get_max_hp(&md->bl); + max_hp = status_get_max_hp(&md->bl); if(src && src->type == BL_PC) { sd = (struct map_session_data *)src; @@ -2289,9 +2290,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) } // end addition [Valaris] if(md->option&2 ) - skill_status_change_end(&md->bl, SC_HIDING, -1); + status_change_end(&md->bl, SC_HIDING, -1); if(md->option&4 ) - skill_status_change_end(&md->bl, SC_CLOAKING, -1); + status_change_end(&md->bl, SC_CLOAKING, -1); if(md->state.special_mob_ai == 2){//スフィアーマイン int skillidx=0; @@ -2321,7 +2322,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) memset(tmpsd,0,sizeof(tmpsd)); memset(pt,0,sizeof(pt)); - max_hp = battle_get_max_hp(&md->bl); + max_hp = status_get_max_hp(&md->bl); if(src && src->type == BL_MOB) mob_unlocktarget((struct mob_data *)src,tick); @@ -2329,7 +2330,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) /* ソウルドレイン */ if(sd && sd->state.attack_type == BF_MAGIC && (skill=pc_checkskill(sd,HW_SOULDRAIN))>0){ clif_skill_nodamage(src,&md->bl,HW_SOULDRAIN,skill,1); - sp = (battle_get_lv(&md->bl))*(65+15*skill)/100; + sp = (status_get_lv(&md->bl))*(65+15*skill)/100; if(sd->status.sp + sp > sd->status.max_sp) sp = sd->status.max_sp - sd->status.sp; sd->status.sp += sp; @@ -2530,7 +2531,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(sd && sd->state.attack_type == BF_WEAPON) { for(i=0;imonster_drop_item_count;i++) { struct delay_item_drop *ditem; - int race = battle_get_race(&md->bl); + int race = status_get_race(&md->bl); if(sd->monster_drop_itemid[i] <= 0) continue; if(sd->monster_drop_race[i] & (1<MAX_MOB_DB) return 0; - max_hp = battle_get_max_hp(&md->bl); + max_hp = status_get_max_hp(&md->bl); hp_rate = md->hp*100/max_hp; clif_mob_class_change(md,class_); md->class_ = class_; - max_hp = battle_get_max_hp(&md->bl); + max_hp = status_get_max_hp(&md->bl); if(battle_config.monster_class_change_full_recover==1) { md->hp = max_hp; memset(md->dmglog,0,sizeof(md->dmglog)); @@ -2738,7 +2739,7 @@ int mob_class_change(struct mob_data *md,int *value) */ int mob_heal(struct mob_data *md,int heal) { - int max_hp = battle_get_max_hp(&md->bl); + int max_hp = status_get_max_hp(&md->bl); nullpo_retr(0, md); @@ -3079,7 +3080,7 @@ int mobskill_castend_id( int tid, unsigned int tick, int id,int data ) return 0; } if(md->skillid != NPC_EMOTION) - md->last_thinktime=tick + battle_get_adelay(&md->bl); + md->last_thinktime=tick + status_get_adelay(&md->bl); if((bl = map_id2bl(md->skilltarget)) == NULL || bl->prev==NULL){ //スキルターゲットが存在しない //printf("mobskill_castend_id nullpo\n");//ターゲットがいないときはnullpoじゃなくて普通に終了 @@ -3089,12 +3090,12 @@ int mobskill_castend_id( int tid, unsigned int tick, int id,int data ) return 0; if(md->skillid == PR_LEXAETERNA) { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); if(sc_data && (sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0))) return 0; } else if(md->skillid == RG_BACKSTAP) { - int dir = map_calc_dir(&md->bl,bl->x,bl->y),t_dir = battle_get_dir(bl); + int dir = map_calc_dir(&md->bl,bl->x,bl->y),t_dir = status_get_dir(bl); int dist = distance(md->bl.x,md->bl.y,bl->x,bl->y); if(bl->type != BL_SKILL && (dist == 0 || map_check_dir(dir,t_dir))) return 0; @@ -3104,7 +3105,7 @@ int mobskill_castend_id( int tid, unsigned int tick, int id,int data ) return 0; range = skill_get_range(md->skillid,md->skilllv); if(range < 0) - range = battle_get_range(&md->bl) - (range + 1); + range = status_get_range(&md->bl) - (range + 1); if(range + battle_config.mob_skill_add_range < distance(md->bl.x,md->bl.y,bl->x,bl->y)) return 0; @@ -3122,7 +3123,7 @@ int mobskill_castend_id( int tid, unsigned int tick, int id,int data ) break; case 1:// 支援系 if(!mob_db[md->class_].skill[md->skillidx].val[0] && - (md->skillid==AL_HEAL || (md->skillid==ALL_RESURRECTION && bl->type != BL_PC)) && battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl)) ) + (md->skillid==AL_HEAL || (md->skillid==ALL_RESURRECTION && bl->type != BL_PC)) && battle_check_undead(status_get_race(bl),status_get_elem_type(bl)) ) skill_castend_damage_id(&md->bl,bl,md->skillid,md->skilllv,tick,0); else skill_castend_nodamage_id(&md->bl,bl,md->skillid,md->skilllv,tick,0); @@ -3236,7 +3237,7 @@ int mobskill_castend_pos( int tid, unsigned int tick, int id,int data ) range = skill_get_range(md->skillid,md->skilllv); if(range < 0) - range = battle_get_range(&md->bl) - (range + 1); + range = status_get_range(&md->bl) - (range + 1); if(range + battle_config.mob_skill_add_range < distance(md->bl.x,md->bl.y,md->skillx,md->skilly)) return 0; md->skilldelay[md->skillidx]=tick; @@ -3300,7 +3301,7 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx) // 射程と障害物チェック range = skill_get_range(skill_id,skill_lv); if(range < 0) - range = battle_get_range(&md->bl) - (range + 1); + range = status_get_range(&md->bl) - (range + 1); if(!battle_check_range(&md->bl,target,range)) return 0; @@ -3312,7 +3313,7 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx) switch(skill_id){ /* 何か特殊な処理が必要 */ case ALL_RESURRECTION: /* リザレクション */ - if(target->type != BL_PC && battle_check_undead(battle_get_race(target),battle_get_elem_type(target))){ /* 敵がアンデッドなら */ + if(target->type != BL_PC && battle_check_undead(status_get_race(target),status_get_elem_type(target))){ /* 敵がアンデッドなら */ forcecast=1; /* ターンアンデットと同じ詠唱時間 */ casttime=skill_castfix(&md->bl, skill_get_cast(PR_TURNUNDEAD,skill_lv) ); } @@ -3358,7 +3359,7 @@ int mobskill_use_id(struct mob_data *md,struct block_list *target,int skill_idx) md->skillidx = skill_idx; if(!(battle_config.monster_cloak_check_type&2) && md->sc_data[SC_CLOAKING].timer != -1 && md->skillid != AS_CLOAKING) - skill_status_change_end(&md->bl,SC_CLOAKING,-1); + status_change_end(&md->bl,SC_CLOAKING,-1); if( casttime>0 ){ md->skilltimer = @@ -3417,7 +3418,7 @@ int mobskill_use_pos( struct mob_data *md, bl.y = skill_y; range = skill_get_range(skill_id,skill_lv); if(range < 0) - range = battle_get_range(&md->bl) - (range + 1); + range = status_get_range(&md->bl) - (range + 1); if(!battle_check_range(&md->bl,&bl,range)) return 0; @@ -3447,7 +3448,7 @@ int mobskill_use_pos( struct mob_data *md, md->skilllv = skill_lv; md->skillidx = skill_idx; if(!(battle_config.monster_cloak_check_type&2) && md->sc_data[SC_CLOAKING].timer != -1) - skill_status_change_end(&md->bl,SC_CLOAKING,-1); + status_change_end(&md->bl,SC_CLOAKING,-1); if( casttime>0 ){ md->skilltimer = add_timer( gettick()+casttime, mobskill_castend_pos, md->bl.id, 0 ); @@ -3553,7 +3554,7 @@ int mobskill_use(struct mob_data *md,unsigned int tick,int event) nullpo_retr(0, md); nullpo_retr(0, ms = mob_db[md->class_].skill); - max_hp = battle_get_max_hp(&md->bl); + max_hp = status_get_max_hp(&md->bl); if(battle_config.mob_skill_use == 0 || md->skilltimer != -1) return 0; diff --git a/src/map/npc.c b/src/map/npc.c index 349514e3b..133ab0ed7 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -15,6 +15,7 @@ #include "clif.h" #include "intif.h" #include "pc.h" +#include "status.h" #include "itemdb.h" #include "script.h" #include "mob.h" @@ -1117,8 +1118,8 @@ static int calc_next_walk_step(struct npc_data *nd) if(nd->walkpath.path_pos>=nd->walkpath.path_len) return -1; if(nd->walkpath.path[nd->walkpath.path_pos]&1) - return battle_get_speed(&nd->bl)*14/10; - return battle_get_speed(&nd->bl); + return status_get_speed(&nd->bl)*14/10; + return status_get_speed(&nd->bl); } @@ -1327,7 +1328,7 @@ int npc_stop_walking(struct npc_data *nd,int type) if(type&0x01) clif_fixnpcpos(nd); if(type&0x02) { - int delay=battle_get_dmotion(&nd->bl); + int delay=status_get_dmotion(&nd->bl); unsigned int tick = gettick(); if(nd->canmove_tick < tick) nd->canmove_tick = tick + delay; diff --git a/src/map/pc.c b/src/map/pc.c index 3713b4409..7f43c88e9 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -15,6 +15,7 @@ #include "clif.h" #include "intif.h" #include "pc.h" +#include "status.h" #include "npc.h" #include "mob.h" #include "pet.h" @@ -43,15 +44,6 @@ #define PVP_CALCRANK_INTERVAL 1000 // PVP順位計算の間隔 -#define STATE_BLIND 0x10 - -static int max_weight_base[MAX_PC_CLASS]; -static int hp_coefficient[MAX_PC_CLASS]; -static int hp_coefficient2[MAX_PC_CLASS]; -static int hp_sigma_val[MAX_PC_CLASS][MAX_LEVEL]; -static int sp_coefficient[MAX_PC_CLASS]; -static int aspd_base[MAX_PC_CLASS][20]; -static char job_bonus[3][MAX_PC_CLASS][MAX_LEVEL]; static int exp_table[14][MAX_LEVEL]; static char statp[255][7]; @@ -61,10 +53,6 @@ struct skill_tree_entry skill_tree[3][MAX_PC_CLASS][100]; int day_timer_tid; int night_timer_tid; -static int atkmods[3][20]; // 武器ATKサイズ修正(size_fix.txt) -static int refinebonus[5][3]; // 精?ボ?ナステ?ブル(refine_db.txt) -static int percentrefinery[5][10]; // 精?成功率(refine_db.txt) - static int dirx[8]={0,-1,-1,-1,0,1,1,1}; static int diry[8]={1,1,0,-1,-1,-1,0,1}; @@ -132,12 +120,6 @@ int pc_set_gm_level(int account_id, int level) { return 0; } -int pc_getrefinebonus(int lv, int type) { - if (lv >= 0 && lv < 5 && type >= 0 && type < 3) - return refinebonus[lv][type]; - return 0; -} - static int distance(int x0, int y0, int x1, int y1) { int dx, dy; @@ -279,7 +261,7 @@ int pc_setrestartvalue(struct map_session_data *sd,int type) { sd->status.sp=sd->status.max_sp; if (sd->state.snovice_flag == 4) { sd->state.snovice_flag = 0; - skill_status_change_start(&sd->bl,SkillStatusChangeTable[MO_STEELBODY],1,0,0,0,skill_get_time(MO_STEELBODY,1),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[MO_STEELBODY],1,0,0,0,skill_get_time(MO_STEELBODY,1),0 ); } } else { @@ -553,7 +535,7 @@ int pc_isequip(struct map_session_data *sd,int n) nullpo_retr(0, sd); item = sd->inventory_data[n]; - sc_data = battle_get_sc_data(&sd->bl); + sc_data = status_get_sc_data(&sd->bl); //s_class = pc_calc_base_job(sd->status.class_); if( battle_config.gm_allequip>0 && pc_isGM(sd)>=battle_config.gm_allequip ) @@ -889,7 +871,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars } // ステ?タス初期計算など - pc_calcstatus(sd,1); + status_calc_pc(sd,1); if (pc_isGM(sd)) sprintf(tmp_output,"GM Character '"CL_WHITE"%s"CL_RESET"' logged in. (Acc. ID: '"CL_WHITE"%d"CL_RESET"', GM Level '"CL_WHITE"%d"CL_RESET"').\n", sd->status.name, sd->status.account_id, pc_isGM(sd)); @@ -1183,1208 +1165,16 @@ int pc_checkweighticon(struct map_session_data *sd) if(flag==1){ if(sd->sc_data[SC_WEIGHT50].timer==-1) - skill_status_change_start(&sd->bl,SC_WEIGHT50,0,0,0,0,0,0); + status_change_start(&sd->bl,SC_WEIGHT50,0,0,0,0,0,0); }else{ - skill_status_change_end(&sd->bl,SC_WEIGHT50,-1); + status_change_end(&sd->bl,SC_WEIGHT50,-1); } if(flag==2){ if(sd->sc_data[SC_WEIGHT90].timer==-1) - skill_status_change_start(&sd->bl,SC_WEIGHT90,0,0,0,0,0,0); + status_change_start(&sd->bl,SC_WEIGHT90,0,0,0,0,0,0); }else{ - skill_status_change_end(&sd->bl,SC_WEIGHT90,-1); - } - return 0; -} - -/*========================================== - * パラメ?タ計算 - * first==0の斬A計算?象のパラメ?タが呼び出し前から - * ? 化した場合自動でsendするが、 - * 能動的に?化させたパラメ?タは自前でsendするように - *------------------------------------------ - */ -int pc_calcstatus(struct map_session_data* sd,int first) -{ - int b_speed,b_max_hp,b_max_sp,b_hp,b_sp,b_weight,b_max_weight,b_paramb[6],b_parame[6],b_hit,b_flee; - int b_aspd,b_watk,b_def,b_watk2,b_def2,b_flee2,b_critical,b_attackrange,b_matk1,b_matk2,b_mdef,b_mdef2,b_class; - int b_base_atk; - struct skill b_skill[MAX_SKILL]; - int i,bl,index; - int skill,aspd_rate,wele,wele_,def_ele,refinedef=0; - int pele=0,pdef_ele=0; - int str,dstr,dex; - struct pc_base_job s_class; - - nullpo_retr(0, sd); - - //?生や養子の場合の元の職業を算出する - s_class = pc_calc_base_job(sd->status.class_); - - b_speed = sd->speed; - b_max_hp = sd->status.max_hp; - b_max_sp = sd->status.max_sp; - b_hp = sd->status.hp; - b_sp = sd->status.sp; - b_weight = sd->weight; - b_max_weight = sd->max_weight; - memcpy(b_paramb,&sd->paramb,sizeof(b_paramb)); - memcpy(b_parame,&sd->paramc,sizeof(b_parame)); - memcpy(b_skill,&sd->status.skill,sizeof(b_skill)); - b_hit = sd->hit; - b_flee = sd->flee; - b_aspd = sd->aspd; - b_watk = sd->watk; - b_def = sd->def; - b_watk2 = sd->watk2; - b_def2 = sd->def2; - b_flee2 = sd->flee2; - b_critical = sd->critical; - b_attackrange = sd->attackrange; - b_matk1 = sd->matk1; - b_matk2 = sd->matk2; - b_mdef = sd->mdef; - b_mdef2 = sd->mdef2; - b_class = sd->view_class; - sd->view_class = sd->status.class_; - b_base_atk = sd->base_atk; - - pc_calc_skilltree(sd); // スキルツリ?の計算 - - sd->max_weight = max_weight_base[s_class.job]+sd->status.str*300; - - if(first&1) { - sd->weight=0; - for(i=0;istatus.inventory[i].nameid==0 || sd->inventory_data[i] == NULL) - continue; - sd->weight += sd->inventory_data[i]->weight*sd->status.inventory[i].amount; - } - sd->cart_max_weight=battle_config.max_cart_weight; - sd->cart_weight=0; - sd->cart_max_num=MAX_CART; - sd->cart_num=0; - for(i=0;istatus.cart[i].nameid==0) - continue; - sd->cart_weight+=itemdb_weight(sd->status.cart[i].nameid)*sd->status.cart[i].amount; - sd->cart_num++; - } - } - - memset(sd->paramb,0,sizeof(sd->paramb)); - memset(sd->parame,0,sizeof(sd->parame)); - sd->hit = 0; - sd->flee = 0; - sd->flee2 = 0; - sd->critical = 0; - sd->aspd = 0; - sd->watk = 0; - sd->def = 0; - sd->mdef = 0; - sd->watk2 = 0; - sd->def2 = 0; - sd->mdef2 = 0; - sd->status.max_hp = 0; - sd->status.max_sp = 0; - sd->attackrange = 0; - sd->attackrange_ = 0; - sd->atk_ele = 0; - sd->def_ele = 0; - sd->star =0; - sd->overrefine =0; - sd->matk1 =0; - sd->matk2 =0; - sd->speed = DEFAULT_WALK_SPEED ; - sd->hprate=battle_config.hp_rate; - sd->sprate=battle_config.sp_rate; - sd->castrate=100; - sd->delayrate=100; - sd->dsprate=100; - sd->base_atk=0; - sd->arrow_atk=0; - sd->arrow_ele=0; - sd->arrow_hit=0; - sd->arrow_range=0; - sd->nhealhp=sd->nhealsp=sd->nshealhp=sd->nshealsp=sd->nsshealhp=sd->nsshealsp=0; - memset(sd->addele,0,sizeof(sd->addele)); - memset(sd->addrace,0,sizeof(sd->addrace)); - memset(sd->addsize,0,sizeof(sd->addsize)); - memset(sd->addele_,0,sizeof(sd->addele_)); - memset(sd->addrace_,0,sizeof(sd->addrace_)); - memset(sd->addsize_,0,sizeof(sd->addsize_)); - memset(sd->subele,0,sizeof(sd->subele)); - memset(sd->subrace,0,sizeof(sd->subrace)); - memset(sd->addeff,0,sizeof(sd->addeff)); - memset(sd->addeff2,0,sizeof(sd->addeff2)); - memset(sd->reseff,0,sizeof(sd->reseff)); - memset(&sd->special_state,0,sizeof(sd->special_state)); - memset(sd->weapon_coma_ele,0,sizeof(sd->weapon_coma_ele)); - memset(sd->weapon_coma_race,0,sizeof(sd->weapon_coma_race)); - memset(sd->weapon_atk,0,sizeof(sd->weapon_atk)); - memset(sd->weapon_atk_rate,0,sizeof(sd->weapon_atk_rate)); - - sd->watk_ = 0; //二刀流用(?) - sd->watk_2 = 0; - sd->atk_ele_ = 0; - sd->star_ = 0; - sd->overrefine_ = 0; - - sd->aspd_rate = 100; - sd->speed_rate = 100; - sd->hprecov_rate = 100; - sd->sprecov_rate = 100; - sd->critical_def = 0; - sd->double_rate = 0; - sd->near_attack_def_rate = sd->long_attack_def_rate = 0; - sd->atk_rate = sd->matk_rate = 100; - sd->ignore_def_ele = sd->ignore_def_race = 0; - sd->ignore_def_ele_ = sd->ignore_def_race_ = 0; - sd->ignore_mdef_ele = sd->ignore_mdef_race = 0; - sd->arrow_cri = 0; - sd->magic_def_rate = sd->misc_def_rate = 0; - memset(sd->arrow_addele,0,sizeof(sd->arrow_addele)); - memset(sd->arrow_addrace,0,sizeof(sd->arrow_addrace)); - memset(sd->arrow_addsize,0,sizeof(sd->arrow_addsize)); - memset(sd->arrow_addeff,0,sizeof(sd->arrow_addeff)); - memset(sd->arrow_addeff2,0,sizeof(sd->arrow_addeff2)); - memset(sd->magic_addele,0,sizeof(sd->magic_addele)); - memset(sd->magic_addrace,0,sizeof(sd->magic_addrace)); - memset(sd->magic_subrace,0,sizeof(sd->magic_subrace)); - sd->perfect_hit = 0; - sd->critical_rate = sd->hit_rate = sd->flee_rate = sd->flee2_rate = 100; - sd->def_rate = sd->def2_rate = sd->mdef_rate = sd->mdef2_rate = 100; - sd->def_ratio_atk_ele = sd->def_ratio_atk_ele_ = 0; - sd->def_ratio_atk_race = sd->def_ratio_atk_race_ = 0; - sd->get_zeny_num = 0; - sd->add_damage_class_count = sd->add_damage_class_count_ = sd->add_magic_damage_class_count = 0; - sd->add_def_class_count = sd->add_mdef_class_count = 0; - sd->monster_drop_item_count = 0; - memset(sd->add_damage_classrate,0,sizeof(sd->add_damage_classrate)); - memset(sd->add_damage_classrate_,0,sizeof(sd->add_damage_classrate_)); - memset(sd->add_magic_damage_classrate,0,sizeof(sd->add_magic_damage_classrate)); - memset(sd->add_def_classrate,0,sizeof(sd->add_def_classrate)); - memset(sd->add_mdef_classrate,0,sizeof(sd->add_mdef_classrate)); - memset(sd->monster_drop_race,0,sizeof(sd->monster_drop_race)); - memset(sd->monster_drop_itemrate,0,sizeof(sd->monster_drop_itemrate)); - sd->speed_add_rate = sd->aspd_add_rate = 100; - sd->double_add_rate = sd->perfect_hit_add = sd->get_zeny_add_num = 0; - sd->splash_range = sd->splash_add_range = 0; - sd->autospell_id = sd->autospell_lv = sd->autospell_rate = 0; - sd->hp_drain_rate = sd->hp_drain_per = sd->sp_drain_rate = sd->sp_drain_per = 0; - sd->hp_drain_rate_ = sd->hp_drain_per_ = sd->sp_drain_rate_ = sd->sp_drain_per_ = 0; - sd->short_weapon_damage_return = sd->long_weapon_damage_return = 0; - sd->magic_damage_return = 0; //AppleGirl Was Here - sd->random_attack_increase_add = sd->random_attack_increase_per = 0; - sd->hp_drain_value = sd->hp_drain_value_ = sd->sp_drain_value = sd->sp_drain_value_ = 0; - sd->unbreakable_equip = 0; - - - if(!sd->disguiseflag && sd->disguise) { - sd->disguise=0; - clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); - clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); - clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom); - clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); - clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); - clif_clearchar(&sd->bl, 9); - pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3); - } - - for(i=0;i<10;i++) { - index = sd->equip_index[i]; - if(index < 0) - continue; - if(i == 9 && sd->equip_index[8] == index) - continue; - if(i == 5 && sd->equip_index[4] == index) - continue; - if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index)) - continue; - - if(sd->inventory_data[index]) { - if(sd->inventory_data[index]->type == 4) { - if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) { - int j; - for(j=0;jinventory_data[index]->slot;j++){ // カ?ド - int c=sd->status.inventory[index].card[j]; - if(c>0){ - if(i == 8 && sd->status.inventory[index].equip == 0x20) - sd->state.lr_flag = 1; - run_script(itemdb_equipscript(c),0,sd->bl.id,0); - sd->state.lr_flag = 0; - } - } - } - } - else if(sd->inventory_data[index]->type==5){ // 防具 - if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) { - int j; - for(j=0;jinventory_data[index]->slot;j++){ // カ?ド - int c=sd->status.inventory[index].card[j]; - if(c>0) - run_script(itemdb_equipscript(c),0,sd->bl.id,0); - } - } - } - } - } - wele = sd->atk_ele; - wele_ = sd->atk_ele_; - def_ele = sd->def_ele; - if(sd->status.pet_id > 0) { - struct pet_data *pd=sd->pd; - if((pd && battle_config.pet_status_support==1) && (battle_config.pet_equip_required==0 || (battle_config.pet_equip_required && pd->equip > 0))) { - if(sd->status.pet_id > 0 && sd->petDB && sd->pet.intimate > 0) - run_script(sd->petDB->script,0,sd->bl.id,0); - pele = sd->atk_ele; - pdef_ele = sd->def_ele; - sd->atk_ele = sd->def_ele = 0; - } - } - memcpy(sd->paramcard,sd->parame,sizeof(sd->paramcard)); - - // ?備品によるステ?タス?化はここで?行 - for(i=0;i<10;i++) { - index = sd->equip_index[i]; - if(index < 0) - continue; - if(i == 9 && sd->equip_index[8] == index) - continue; - if(i == 5 && sd->equip_index[4] == index) - continue; - if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index)) - continue; - if(sd->inventory_data[index]) { - sd->def += sd->inventory_data[index]->def; - if(sd->inventory_data[index]->type == 4) { - int r,wlv = sd->inventory_data[index]->wlv; - if(i == 8 && sd->status.inventory[index].equip == 0x20) { - //二刀流用デ?タ入力 - sd->watk_ += sd->inventory_data[index]->atk; - sd->watk_2 = (r=sd->status.inventory[index].refine)* // 精?攻?力 - refinebonus[wlv][0]; - if( (r-=refinebonus[wlv][2])>0 ) // 過?精?ボ?ナス - sd->overrefine_ = r*refinebonus[wlv][1]; - - if(sd->status.inventory[index].card[0]==0x00ff){ // 製造武器 - sd->star_ = (sd->status.inventory[index].card[1]>>8); // 星のかけら - wele_= (sd->status.inventory[index].card[1]&0x0f); // ? 性 - } - sd->attackrange_ += sd->inventory_data[index]->range; - sd->state.lr_flag = 1; - run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); - sd->state.lr_flag = 0; - } - else { //二刀流武器以外 - sd->watk += sd->inventory_data[index]->atk; - sd->watk2 += (r=sd->status.inventory[index].refine)* // 精?攻?力 - refinebonus[wlv][0]; - if( (r-=refinebonus[wlv][2])>0 ) // 過?精?ボ?ナス - sd->overrefine += r*refinebonus[wlv][1]; - - if(sd->status.inventory[index].card[0]==0x00ff){ // 製造武器 - sd->star += (sd->status.inventory[index].card[1]>>8); // 星のかけら - wele = (sd->status.inventory[index].card[1]&0x0f); // ? 性 - } - sd->attackrange += sd->inventory_data[index]->range; - run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); - } - } - else if(sd->inventory_data[index]->type == 5) { - sd->watk += sd->inventory_data[index]->atk; - refinedef += sd->status.inventory[index].refine*refinebonus[0][0]; - run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); - } - } - } - - if(sd->equip_index[10] >= 0){ // 矢 - index = sd->equip_index[10]; - if(sd->inventory_data[index]){ //まだ?性が入っていない - sd->state.lr_flag = 2; - run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); - sd->state.lr_flag = 0; - sd->arrow_atk += sd->inventory_data[index]->atk; - } - } - sd->def += (refinedef+50)/100; - - if(sd->attackrange < 1) sd->attackrange = 1; - if(sd->attackrange_ < 1) sd->attackrange_ = 1; - if(sd->attackrange < sd->attackrange_) - sd->attackrange = sd->attackrange_; - if(sd->status.weapon == 11) - sd->attackrange += sd->arrow_range; - if(wele > 0) - sd->atk_ele = wele; - if(wele_ > 0) - sd->atk_ele_ = wele_; - if(def_ele > 0) - sd->def_ele = def_ele; - if(battle_config.pet_status_support) { - if(pele > 0 && !sd->atk_ele) - sd->atk_ele = pele; - if(pdef_ele > 0 && !sd->def_ele) - sd->def_ele = pdef_ele; - } - sd->double_rate += sd->double_add_rate; - sd->perfect_hit += sd->perfect_hit_add; - sd->get_zeny_num += sd->get_zeny_add_num; - sd->splash_range += sd->splash_add_range; - if(sd->speed_add_rate != 100) - sd->speed_rate += sd->speed_add_rate - 100; - if(sd->aspd_add_rate != 100) - sd->aspd_rate += sd->aspd_add_rate - 100; - - // 武器ATKサイズ補正 (右手) - sd->atkmods[0] = atkmods[0][sd->weapontype1]; - sd->atkmods[1] = atkmods[1][sd->weapontype1]; - sd->atkmods[2] = atkmods[2][sd->weapontype1]; - //武器ATKサイズ補正 (左手) - sd->atkmods_[0] = atkmods[0][sd->weapontype2]; - sd->atkmods_[1] = atkmods[1][sd->weapontype2]; - sd->atkmods_[2] = atkmods[2][sd->weapontype2]; - - // jobボ?ナス分 - for(i=0;istatus.job_level && iparamb[job_bonus[s_class.upper][s_class.job][i]-1]++; - } - - if( (skill=pc_checkskill(sd,MC_INCCARRY))>0 ) // skill can be used with an item now, thanks to orn [Valaris] - sd->max_weight += skill*2000; - - if( (skill=pc_checkskill(sd,AC_OWL))>0 ) // ふくろうの目 - sd->paramb[4] += skill; - - if((skill=pc_checkskill(sd,BS_HILTBINDING))>0) { // Hilt binding gives +1 str +4 atk - sd->paramb[0] ++; - sd->base_atk += 4; - } - if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // Dragonology increases +1 int every 2 levels - sd->paramb[3] += (skill+1)*0.5; - } - - // New guild skills - Celest - if (sd->status.guild_id > 0 && !(first&4)) { - struct guild *g; - if ((g = guild_search(sd->status.guild_id)) && strcmp(sd->status.name,g->master)==0) { - if (!sd->state.leadership_flag && guild_checkskill(g, GD_LEADERSHIP)>0) { - skill_unitsetting(&sd->bl,GD_LEADERSHIP,1,sd->bl.x,sd->bl.y,0); - } - if (!sd->state.glorywounds_flag && guild_checkskill(g, GD_GLORYWOUNDS)>0) { - skill_unitsetting(&sd->bl,GD_GLORYWOUNDS,1,sd->bl.x,sd->bl.y,0); - } - if (!sd->state.soulcold_flag && guild_checkskill(g, GD_SOULCOLD)>0) { - skill_unitsetting(&sd->bl,GD_SOULCOLD,1,sd->bl.x,sd->bl.y,0); - } - if (!sd->state.hawkeyes_flag && guild_checkskill(g, GD_HAWKEYES)>0) { - skill_unitsetting(&sd->bl,GD_HAWKEYES,1,sd->bl.x,sd->bl.y,0); - } - } - else if (g) { - if (sd->sc_count && sd->sc_data[SC_BATTLEORDERS].timer != -1) { - sd->paramb[0]+= 5; - sd->paramb[3]+= 5; - sd->paramb[4]+= 5; - } - if (sd->state.leadership_flag) - sd->paramb[0] += 2; - if (sd->state.glorywounds_flag) - sd->paramb[2] += 2; - if (sd->state.soulcold_flag) - sd->paramb[1] += 2; - if (sd->state.hawkeyes_flag) - sd->paramb[4] += 2; - } - } - - // ステ?タス?化による基本パラメ?タ補正 - if(sd->sc_count){ - if(sd->sc_data[SC_CONCENTRATE].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1){ // 集中力向上 - sd->paramb[1]+= (sd->status.agi+sd->paramb[1]+sd->parame[1]-sd->paramcard[1])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100; - sd->paramb[4]+= (sd->status.dex+sd->paramb[4]+sd->parame[4]-sd->paramcard[4])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100; - } - if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){ // 速度?加 - sd->paramb[1]+= 2+sd->sc_data[SC_INCREASEAGI].val1; - sd->speed -= sd->speed *25/100; - } - if(sd->sc_data[SC_DECREASEAGI].timer!=-1) // 速度減少(agiはbattle.cで) - sd->speed = sd->speed *125/100; - if(sd->sc_data[SC_CLOAKING].timer!=-1) { - sd->critical_rate += 100; // critical increases - sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100; - } - if(sd->sc_data[SC_CHASEWALK].timer!=-1) { - sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100; // slow down by chasewalk - if(sd->sc_data[SC_CHASEWALK].val4) - sd->paramb[0] += (1<<(sd->sc_data[SC_CHASEWALK].val1-1)); // increases strength after 10 seconds - } - if(sd->sc_data[SC_SLOWDOWN].timer!=-1) - sd->speed = sd->speed*150/100; - if(sd->sc_data[SC_SPEEDUP0].timer!=-1) - sd->speed -= sd->speed*25/100; - if(sd->sc_data[SC_BLESSING].timer!=-1){ // ブレッシング - sd->paramb[0]+= sd->sc_data[SC_BLESSING].val1; - sd->paramb[3]+= sd->sc_data[SC_BLESSING].val1; - sd->paramb[4]+= sd->sc_data[SC_BLESSING].val1; - } - if(sd->sc_data[SC_GLORIA].timer!=-1) // グロリア - sd->paramb[5]+= 30; - if(sd->sc_data[SC_LOUD].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1) // ラウドボイス - sd->paramb[0]+= 4; - if(sd->sc_data[SC_QUAGMIRE].timer!=-1){ // クァグマイア - //int agib = (sd->status.agi+sd->paramb[1]+sd->parame[1])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100; - //int dexb = (sd->status.dex+sd->paramb[4]+sd->parame[4])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100; - //sd->paramb[1]-= agib > 50 ? 50 : agib; - //sd->paramb[4]-= dexb > 50 ? 50 : dexb; - sd->paramb[1]-= sd->sc_data[SC_QUAGMIRE].val1*5; - sd->paramb[4]-= sd->sc_data[SC_QUAGMIRE].val1*5; - sd->speed = sd->speed*3/2; - } - if(sd->sc_data[SC_TRUESIGHT].timer!=-1){ // トゥル?サイト - sd->paramb[0]+= 5; - sd->paramb[1]+= 5; - sd->paramb[2]+= 5; - sd->paramb[3]+= 5; - sd->paramb[4]+= 5; - sd->paramb[5]+= 5; - } - if(sd->sc_data[SC_MARIONETTE].timer!=-1){ - struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3); - if (psd) { // if partner is found - sd->paramb[0]-= sd->status.str/2; // bonuses not included - sd->paramb[1]-= sd->status.agi/2; - sd->paramb[2]-= sd->status.vit/2; - sd->paramb[3]-= sd->status.int_/2; - sd->paramb[4]-= sd->status.dex/2; - sd->paramb[5]-= sd->status.luk/2; - } - } - else if(sd->sc_data[SC_MARIONETTE2].timer!=-1){ - struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3); - if (psd) { // if partner is found - sd->paramb[0] += sd->status.str+psd->status.str/2 > 99 ? 99-sd->status.str : psd->status.str/2; - sd->paramb[1] += sd->status.agi+psd->status.agi/2 > 99 ? 99-sd->status.agi : psd->status.agi/2; - sd->paramb[2] += sd->status.vit+psd->status.vit/2 > 99 ? 99-sd->status.vit : psd->status.vit/2; - sd->paramb[3] += sd->status.int_+psd->status.int_/2 > 99 ? 99-sd->status.int_ : psd->status.int_/2; - sd->paramb[4] += sd->status.dex+psd->status.dex/2 > 99 ? 99-sd->status.dex : psd->status.dex/2; - sd->paramb[5] += sd->status.luk+psd->status.luk/2 > 99 ? 99-sd->status.luk : psd->status.luk/2; - } - } - if(sd->sc_data[SC_GOSPEL].timer!=-1 && sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){ - if (sd->sc_data[SC_GOSPEL].val3 == 6) { - sd->paramb[0]+= 2; - sd->paramb[1]+= 2; - sd->paramb[2]+= 2; - sd->paramb[3]+= 2; - sd->paramb[4]+= 2; - sd->paramb[5]+= 2; - } - } - } - - //1度も死んでないJob70スパノビに+10 - if(s_class.job == 23 && sd->die_counter == 0 && sd->status.job_level >= 70){ - sd->paramb[0]+= 15; - sd->paramb[1]+= 15; - sd->paramb[2]+= 15; - sd->paramb[3]+= 15; - sd->paramb[4]+= 15; - sd->paramb[5]+= 15; - } - sd->paramc[0]=sd->status.str+sd->paramb[0]+sd->parame[0]; - sd->paramc[1]=sd->status.agi+sd->paramb[1]+sd->parame[1]; - sd->paramc[2]=sd->status.vit+sd->paramb[2]+sd->parame[2]; - sd->paramc[3]=sd->status.int_+sd->paramb[3]+sd->parame[3]; - sd->paramc[4]=sd->status.dex+sd->paramb[4]+sd->parame[4]; - sd->paramc[5]=sd->status.luk+sd->paramb[5]+sd->parame[5]; - for(i=0;i<6;i++) - if(sd->paramc[i] < 0) sd->paramc[i] = 0; - - if(sd->status.weapon == 11 || sd->status.weapon == 13 || sd->status.weapon == 14) { - str = sd->paramc[4]; - dex = sd->paramc[0]; - } - else { - str = sd->paramc[0]; - dex = sd->paramc[4]; - } - dstr = str/10; - sd->base_atk += str + dstr*dstr + dex/5 + sd->paramc[5]/5; - sd->matk1 += sd->paramc[3]+(sd->paramc[3]/5)*(sd->paramc[3]/5); - sd->matk2 += sd->paramc[3]+(sd->paramc[3]/7)*(sd->paramc[3]/7); - if(sd->matk1 < sd->matk2) { - int temp = sd->matk2; - sd->matk2 = sd->matk1; - sd->matk1 = temp; - } - sd->hit += sd->paramc[4] + sd->status.base_level; - sd->flee += sd->paramc[1] + sd->status.base_level; - sd->def2 += sd->paramc[2]; - sd->mdef2 += sd->paramc[3]; - sd->flee2 += sd->paramc[5]+10; - sd->critical += (sd->paramc[5]*3)+10; - - if(sd->base_atk < 1) - sd->base_atk = 1; - if(sd->critical_rate != 100) - sd->critical = (sd->critical*sd->critical_rate)/100; - if(sd->critical < 10) sd->critical = 10; - if(sd->hit_rate != 100) - sd->hit = (sd->hit*sd->hit_rate)/100; - if(sd->hit < 1) sd->hit = 1; - if(sd->flee_rate != 100) - sd->flee = (sd->flee*sd->flee_rate)/100; - if(sd->flee < 1) sd->flee = 1; - if(sd->flee2_rate != 100) - sd->flee2 = (sd->flee2*sd->flee2_rate)/100; - if(sd->flee2 < 10) sd->flee2 = 10; - if(sd->def_rate != 100) - sd->def = (sd->def*sd->def_rate)/100; - if(sd->def < 0) sd->def = 0; - if(sd->def2_rate != 100) - sd->def2 = (sd->def2*sd->def2_rate)/100; - if(sd->def2 < 1) sd->def2 = 1; - if(sd->mdef_rate != 100) - sd->mdef = (sd->mdef*sd->mdef_rate)/100; - if(sd->mdef < 0) sd->mdef = 0; - if(sd->mdef2_rate != 100) - sd->mdef2 = (sd->mdef2*sd->mdef2_rate)/100; - if(sd->mdef2 < 1) sd->mdef2 = 1; - - // 二刀流 ASPD 修正 - if (sd->status.weapon <= 16) - sd->aspd += aspd_base[s_class.job][sd->status.weapon]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->status.weapon]/1000; - else - sd->aspd += ( - (aspd_base[s_class.job][sd->weapontype1]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->weapontype1]/1000) + - (aspd_base[s_class.job][sd->weapontype2]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->weapontype2]/1000) - ) * 140 / 200; - - aspd_rate = sd->aspd_rate; - - //攻?速度?加 - - if((skill=pc_checkskill(sd,AC_VULTURE))>0){ // ワシの目 - sd->hit += skill; - if(sd->status.weapon == 11) - sd->attackrange += skill; - } - - if( (skill=pc_checkskill(sd,BS_WEAPONRESEARCH))>0) // 武器?究の命中率?加 - sd->hit += skill*2; - if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 ) // トンネルドライブ // トンネルドライブ - sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9); - if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0) // カ?トによる速度低下 - sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1); - else if (pc_isriding(sd)) { // ペコペコ?りによる速度?加 - sd->speed -= (0.25 * DEFAULT_WALK_SPEED); - sd->max_weight += 10000; - } - if((skill=pc_checkskill(sd,CR_TRUST))>0) { // フェイス - sd->status.max_hp += skill*200; - sd->subele[6] += skill*5; - } - if((skill=pc_checkskill(sd,BS_SKINTEMPER))>0) { - sd->subele[0] += skill; - sd->subele[3] += skill*5; - } - if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 ) - aspd_rate -= skill*0.5; - - bl=sd->status.base_level; - - sd->status.max_hp += (3500 + bl*hp_coefficient2[s_class.job] + hp_sigma_val[s_class.job][(bl > 0)? bl-1:0])/100 * (100 + sd->paramc[2])/100 + (sd->parame[2] - sd->paramcard[2]); - if (s_class.upper==1) // [MouseJstr] - sd->status.max_hp = sd->status.max_hp * 130/100; - else if (s_class.upper==2) - sd->status.max_hp = sd->status.max_hp * 70/100; - - if(sd->hprate!=100) - sd->status.max_hp = sd->status.max_hp*sd->hprate/100; - - if(sd->sc_count && sd->sc_data[SC_BERSERK].timer!=-1){ // バ?サ?ク - sd->status.max_hp = sd->status.max_hp * 3; - // sd->status.hp = sd->status.hp * 3; - if(sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris - sd->status.max_hp = battle_config.max_hp; - if(sd->status.hp > battle_config.max_hp) // removed negative max hp bug by Valaris - sd->status.hp = battle_config.max_hp; - } - if(s_class.job == 23 && sd->status.base_level >= 99){ - sd->status.max_hp = sd->status.max_hp + 2000; - } - - if(sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris - sd->status.max_hp = battle_config.max_hp; - if(sd->status.max_hp <= 0) sd->status.max_hp = 1; // end - - // 最大SP計算 - sd->status.max_sp += ((sp_coefficient[s_class.job] * bl) + 1000)/100 * (100 + sd->paramc[3])/100 + (sd->parame[3] - sd->paramcard[3]); - if (s_class.upper==1) // [MouseJstr] - sd->status.max_sp = sd->status.max_sp * 130/100; - else if (s_class.upper==2) - sd->status.max_sp = sd->status.max_sp * 70/100; - if(sd->sprate!=100) - sd->status.max_sp = sd->status.max_sp*sd->sprate/100; - - if((skill=pc_checkskill(sd,HP_MEDITATIO))>0) // メディテイティオ - sd->status.max_sp += sd->status.max_sp*skill/100; - if((skill=pc_checkskill(sd,HW_SOULDRAIN))>0) /* ソウルドレイン */ - sd->status.max_sp += sd->status.max_sp*2*skill/100; - - if(sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp) - sd->status.max_sp = battle_config.max_sp; - - //自然回復HP - sd->nhealhp = 1 + (sd->paramc[2]/5) + (sd->status.max_hp/200); - if((skill=pc_checkskill(sd,SM_RECOVERY)) > 0) { /* HP回復力向上 */ - sd->nshealhp = skill*5 + (sd->status.max_hp*skill/500); - if(sd->nshealhp > 0x7fff) sd->nshealhp = 0x7fff; - } - //自然回復SP - sd->nhealsp = 1 + (sd->paramc[3]/6) + (sd->status.max_sp/100); - if(sd->paramc[3] >= 120) - sd->nhealsp += ((sd->paramc[3]-120)>>1) + 4; - if((skill=pc_checkskill(sd,MG_SRECOVERY)) > 0) { /* SP回復力向上 */ - sd->nshealsp = skill*3 + (sd->status.max_sp*skill/500); - if(sd->nshealsp > 0x7fff) sd->nshealsp = 0x7fff; - } - - if((skill = pc_checkskill(sd,MO_SPIRITSRECOVERY)) > 0) { - sd->nsshealhp = skill*4 + (sd->status.max_hp*skill/500); - sd->nsshealsp = skill*2 + (sd->status.max_sp*skill/500); - if(sd->nsshealhp > 0x7fff) sd->nsshealhp = 0x7fff; - if(sd->nsshealsp > 0x7fff) sd->nsshealsp = 0x7fff; - } - if(sd->hprecov_rate != 100) { - sd->nhealhp = sd->nhealhp*sd->hprecov_rate/100; - if(sd->nhealhp < 1) sd->nhealhp = 1; - } - if(sd->sprecov_rate != 100) { - sd->nhealsp = sd->nhealsp*sd->sprecov_rate/100; - if(sd->nhealsp < 1) sd->nhealsp = 1; - } - /* if((skill=pc_checkskill(sd,HP_MEDITATIO)) > 0) { // f?fffBfefCfefBfI,I'SPR,A*,I',E`,。ゥZ((c)。ョR「カn~.ゥォ,E',(c),(c),e' - sd->nhealsp += 3*skill*(sd->status.max_sp)/100; - if(sd->nhealsp > 0x7fff) sd->nhealsp = 0x7fff; - } Increase natural SP regen instead of colossal SP Recovery effect [DracoRPG]*/ - - // 種族耐性(これでいいの? ディバインプロテクションと同じ?理がいるかも) - if( (skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // ドラゴノロジ? - skill = skill*4; - sd->addrace[9]+=skill; - sd->addrace_[9]+=skill; - sd->subrace[9]+=skill; - sd->magic_addrace[9]+=skill; - sd->magic_subrace[9]-=skill; - } - - //Flee上昇 - if( (skill=pc_checkskill(sd,TF_MISS))>0 ){ // 回避率?加 - if(sd->status.class_==6||sd->status.class_==4007 || sd->status.class_==23){ - sd->flee += skill*3; - } - if(sd->status.class_==12||sd->status.class_==17||sd->status.class_==4013||sd->status.class_==4018) - sd->flee += skill*4; - if(sd->status.class_==12||sd->status.class_==4013) - sd->speed -= sd->speed *(skill*1.5)/100; - } - if( (skill=pc_checkskill(sd,MO_DODGE))>0 ) // 見切り - sd->flee += (skill*3)>>1; - - // スキルやステ?タス異常による?りのパラメ?タ補正 - if(sd->sc_count){ - // ATK/DEF?化形 - if(sd->sc_data[SC_ANGELUS].timer!=-1) // エンジェラス - sd->def2 = sd->def2*(110+5*sd->sc_data[SC_ANGELUS].val1)/100; - if(sd->sc_data[SC_IMPOSITIO].timer!=-1) {// インポシティオマヌス - sd->watk += sd->sc_data[SC_IMPOSITIO].val1*5; - index = sd->equip_index[8]; - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) - sd->watk_ += sd->sc_data[SC_IMPOSITIO].val1*5; - } - if(sd->sc_data[SC_PROVOKE].timer!=-1){ // プロボック - sd->def2 = sd->def2*(100-6*sd->sc_data[SC_PROVOKE].val1)/100; - sd->base_atk = sd->base_atk*(100+2*sd->sc_data[SC_PROVOKE].val1)/100; - sd->watk = sd->watk*(100+2*sd->sc_data[SC_PROVOKE].val1)/100; - index = sd->equip_index[8]; - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) - sd->watk_ = sd->watk_*(100+2*sd->sc_data[SC_PROVOKE].val1)/100; - } - if(sd->sc_data[SC_ENDURE].timer!=-1) - sd->mdef2 += sd->sc_data[SC_ENDURE].val1; - if(sd->sc_data[SC_MINDBREAKER].timer!=-1){ // プロボック - sd->mdef2 = sd->mdef2*(100-6*sd->sc_data[SC_MINDBREAKER].val1)/100; - sd->matk1 = sd->matk1*(100+2*sd->sc_data[SC_MINDBREAKER].val1)/100; - sd->matk2 = sd->matk2*(100+2*sd->sc_data[SC_MINDBREAKER].val1)/100; - } - if(sd->sc_data[SC_POISON].timer!=-1) // 毒?態 - sd->def2 = sd->def2*75/100; - if(sd->sc_data[SC_CURSE].timer!=-1){ - sd->base_atk = sd->base_atk*75/100; - sd->watk = sd->watk*75/100; - index = sd->equip_index[8]; - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) - sd->watk_ = sd->watk_*75/100; - } - if(sd->sc_data[SC_DRUMBATTLE].timer!=-1){ // ?太鼓の響き - sd->watk += sd->sc_data[SC_DRUMBATTLE].val2; - sd->def += sd->sc_data[SC_DRUMBATTLE].val3; - index = sd->equip_index[8]; - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) - sd->watk_ += sd->sc_data[SC_DRUMBATTLE].val2; - } - if(sd->sc_data[SC_NIBELUNGEN].timer!=-1) { // ニ?ベルングの指輪 - index = sd->equip_index[9]; - /*if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3) - sd->watk += sd->sc_data[SC_NIBELUNGEN].val3; - index = sd->equip_index[8]; - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3) - sd->watk_ += sd->sc_data[SC_NIBELUNGEN].val3; - index = sd->equip_index[9];*/ - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4) - sd->watk2 += sd->sc_data[SC_NIBELUNGEN].val3; - index = sd->equip_index[8]; - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4) - sd->watk_2 += sd->sc_data[SC_NIBELUNGEN].val3; - } - - if(sd->sc_data[SC_VOLCANO].timer!=-1 && sd->def_ele==3){ // ボルケ?ノ - sd->watk += sd->sc_data[SC_VIOLENTGALE].val3; - } - - if(sd->sc_data[SC_SIGNUMCRUCIS].timer!=-1) - sd->def = sd->def * (100 - sd->sc_data[SC_SIGNUMCRUCIS].val2)/100; - if(sd->sc_data[SC_ETERNALCHAOS].timer!=-1) // エタ?ナルカオス - sd->def=0; - - if(sd->sc_data[SC_CONCENTRATION].timer!=-1){ //コンセントレ?ション - sd->watk = sd->watk * (100 + 5*sd->sc_data[SC_CONCENTRATION].val1)/100; - index = sd->equip_index[8]; - if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) - sd->watk_ = sd->watk * (100 + 5*sd->sc_data[SC_CONCENTRATION].val1)/100; - sd->def = sd->def * (100 - 5*sd->sc_data[SC_CONCENTRATION].val1)/100; - } - - if(sd->sc_data[SC_MAGICPOWER].timer!=-1){ //魔法力?幅 - sd->matk1 = sd->matk1*(100+5*sd->sc_data[SC_MAGICPOWER].val1)/100; - sd->matk2 = sd->matk2*(100+5*sd->sc_data[SC_MAGICPOWER].val1)/100; - } - if(sd->sc_data[SC_ATKPOT].timer!=-1) - sd->watk += sd->sc_data[SC_ATKPOT].val1; - if(sd->sc_data[SC_MATKPOT].timer!=-1){ - sd->matk1 += sd->sc_data[SC_MATKPOT].val1; - sd->matk2 += sd->sc_data[SC_MATKPOT].val1; - } - - // ASPD/移動速度?化系 - if(sd->sc_data[SC_TWOHANDQUICKEN].timer != -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) // 2HQ - aspd_rate -= 30; - if(sd->sc_data[SC_ADRENALINE].timer != -1 && sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 && - sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ - if(sd->sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) - aspd_rate -= 30; - else - aspd_rate -= 25; - } - if(sd->sc_data[SC_SPEARSQUICKEN].timer != -1 && sd->sc_data[SC_ADRENALINE].timer == -1 && - sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) // スピアクィッケン - aspd_rate -= sd->sc_data[SC_SPEARSQUICKEN].val2; - if(sd->sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス - sd->sc_data[SC_TWOHANDQUICKEN].timer==-1 && sd->sc_data[SC_ADRENALINE].timer==-1 && sd->sc_data[SC_SPEARSQUICKEN].timer==-1 && - sd->sc_data[SC_DONTFORGETME].timer == -1) - aspd_rate -= 5+sd->sc_data[SC_ASSNCROS].val1+sd->sc_data[SC_ASSNCROS].val2+sd->sc_data[SC_ASSNCROS].val3; - if(sd->sc_data[SC_DONTFORGETME].timer!=-1){ // 私を忘れないで - aspd_rate += sd->sc_data[SC_DONTFORGETME].val1*3 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3>>16); - sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100; - } - if( sd->sc_data[i=SC_SPEEDPOTION3].timer!=-1 || - sd->sc_data[i=SC_SPEEDPOTION2].timer!=-1 || - sd->sc_data[i=SC_SPEEDPOTION1].timer!=-1 || - sd->sc_data[i=SC_SPEEDPOTION0].timer!=-1) // ? 速ポ?ション - aspd_rate -= sd->sc_data[i].val2; - if(sd->sc_data[SC_WINDWALK].timer!=-1 && sd->sc_data[SC_INCREASEAGI].timer==-1) //ウィンドウォ?ク暫ヘLv*2%減算 - sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100; - if(sd->sc_data[SC_CARTBOOST].timer!=-1) // カ?トブ?スト - sd->speed -= (DEFAULT_WALK_SPEED * 20)/100; - if(sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中はIAと同じぐらい速い? - sd->speed -= sd->speed *25/100; - if(sd->sc_data[SC_WEDDING].timer!=-1) //結婚中は?くのが?い - sd->speed = 2*DEFAULT_WALK_SPEED; - - // HIT/FLEE?化系 - if(sd->sc_data[SC_WHISTLE].timer!=-1){ // 口笛 - sd->flee += sd->flee * (sd->sc_data[SC_WHISTLE].val1 - +sd->sc_data[SC_WHISTLE].val2+(sd->sc_data[SC_WHISTLE].val3>>16))/100; - sd->flee2+= (sd->sc_data[SC_WHISTLE].val1+sd->sc_data[SC_WHISTLE].val2+(sd->sc_data[SC_WHISTLE].val3&0xffff)) * 10; - } - if(sd->sc_data[SC_HUMMING].timer!=-1) // ハミング - sd->hit += (sd->sc_data[SC_HUMMING].val1*2+sd->sc_data[SC_HUMMING].val2 - +sd->sc_data[SC_HUMMING].val3) * sd->hit/100; - if(sd->sc_data[SC_VIOLENTGALE].timer!=-1 && sd->def_ele==4){ // バイオレントゲイル - sd->flee += sd->flee*sd->sc_data[SC_VIOLENTGALE].val3/100; - } - if(sd->sc_data[SC_BLIND].timer!=-1){ // 暗? - sd->hit -= sd->hit*25/100; - sd->flee -= sd->flee*25/100; - } - if(sd->sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォ?ク - sd->flee += sd->flee*(sd->sc_data[SC_WINDWALK].val2)/100; - if(sd->sc_data[SC_SPIDERWEB].timer!=-1) //スパイダ?ウェブ - sd->flee -= sd->flee*50/100; - if(sd->sc_data[SC_TRUESIGHT].timer!=-1) //トゥル?サイト - sd->hit += 3*(sd->sc_data[SC_TRUESIGHT].val1); - if(sd->sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレ?ション - sd->hit += (10*(sd->sc_data[SC_CONCENTRATION].val1)); - - // 耐性 - if(sd->sc_data[SC_SIEGFRIED].timer!=-1){ // 不死身のジ?クフリ?ド - sd->subele[1] += sd->sc_data[SC_SIEGFRIED].val2; // 水 - sd->subele[2] += sd->sc_data[SC_SIEGFRIED].val2; // 水 - sd->subele[3] += sd->sc_data[SC_SIEGFRIED].val2; // 火 - sd->subele[4] += sd->sc_data[SC_SIEGFRIED].val2; // 水 - sd->subele[5] += sd->sc_data[SC_SIEGFRIED].val2; // 水 - sd->subele[6] += sd->sc_data[SC_SIEGFRIED].val2; // 水 - sd->subele[7] += sd->sc_data[SC_SIEGFRIED].val2; // 水 - sd->subele[8] += sd->sc_data[SC_SIEGFRIED].val2; // 水 - sd->subele[9] += sd->sc_data[SC_SIEGFRIED].val2; // 水 - } - if(sd->sc_data[SC_PROVIDENCE].timer!=-1){ // プロヴィデンス - sd->subele[6] += sd->sc_data[SC_PROVIDENCE].val2; // ? 聖?性 - sd->subrace[6] += sd->sc_data[SC_PROVIDENCE].val2; // ? ?魔 - } - - // その他 - if(sd->sc_data[SC_APPLEIDUN].timer!=-1){ // イドゥンの林檎 - sd->status.max_hp += ((5+sd->sc_data[SC_APPLEIDUN].val1*2+((sd->sc_data[SC_APPLEIDUN].val2+1)>>1) - +sd->sc_data[SC_APPLEIDUN].val3/10) * sd->status.max_hp)/100; - if(sd->status.max_hp < 0 || sd->status.max_hp > battle_config.max_hp) - sd->status.max_hp = battle_config.max_hp; - } - if(sd->sc_data[SC_DELUGE].timer!=-1 && sd->def_ele==1){ // デリュ?ジ - sd->status.max_hp += sd->status.max_hp*sd->sc_data[SC_DELUGE].val3/100; - if(sd->status.max_hp < 0 || sd->status.max_hp > battle_config.max_hp) - sd->status.max_hp = battle_config.max_hp; - } - if(sd->sc_data[SC_SERVICE4U].timer!=-1) { // サ?ビスフォ?ユ? - sd->status.max_sp += sd->status.max_sp*(10+sd->sc_data[SC_SERVICE4U].val1+sd->sc_data[SC_SERVICE4U].val2 - +sd->sc_data[SC_SERVICE4U].val3)/100; - if(sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp) - sd->status.max_sp = battle_config.max_sp; - sd->dsprate-=(10+sd->sc_data[SC_SERVICE4U].val1*3+sd->sc_data[SC_SERVICE4U].val2 - +sd->sc_data[SC_SERVICE4U].val3); - if(sd->dsprate<0)sd->dsprate=0; - } - - if(sd->sc_data[SC_FORTUNE].timer!=-1) // 幸運のキス - sd->critical += (10+sd->sc_data[SC_FORTUNE].val1+sd->sc_data[SC_FORTUNE].val2 - +sd->sc_data[SC_FORTUNE].val3)*10; - - if(sd->sc_data[SC_EXPLOSIONSPIRITS].timer!=-1){ // 爆裂波動 - if(s_class.job==23) - sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val1*100; - else - sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val2; - } - - if(sd->sc_data[SC_STEELBODY].timer!=-1){ // 金剛 - sd->def = 90; - sd->mdef = 90; - aspd_rate += 25; - sd->speed = (sd->speed * 125) / 100; - } - if(sd->sc_data[SC_DEFENDER].timer != -1) { - sd->aspd += (550 - sd->sc_data[SC_DEFENDER].val1*50); - // removed as of 12/14's patch [celest] - //sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; - } - if(sd->sc_data[SC_ENCPOISON].timer != -1) - sd->addeff[4] += sd->sc_data[SC_ENCPOISON].val2; - - if( sd->sc_data[SC_DANCING].timer!=-1 ){ // 演奏/ダンス使用中 - sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON))); - //sd->speed*=4; - sd->nhealsp = 0; - sd->nshealsp = 0; - sd->nsshealsp = 0; - } - if(sd->sc_data[SC_CURSE].timer!=-1) - sd->speed += 450; - - if(sd->sc_data[SC_TRUESIGHT].timer!=-1) //トゥル?サイト - sd->critical += sd->critical*(sd->sc_data[SC_TRUESIGHT].val1)/100; - -/* if(sd->sc_data[SC_VOLCANO].timer!=-1) // エンチャントポイズン(?性はbattle.cで) - sd->addeff[2]+=sd->sc_data[SC_VOLCANO].val2;//% of granting - if(sd->sc_data[SC_DELUGE].timer!=-1) // エンチャントポイズン(?性はbattle.cで) - sd->addeff[0]+=sd->sc_data[SC_DELUGE].val2;//% of granting - */ - if(sd->sc_data[SC_BERSERK].timer!=-1) { //All Def/MDef reduced to 0 while in Berserk [DracoRPG] - sd->def = sd->def2 = 0; - sd->mdef = sd->mdef2 = 0; - sd->flee -= sd->flee*50/100; - aspd_rate -= 30; - //sd->base_atk *= 3; - } - if(sd->sc_data[SC_KEEPING].timer!=-1) - sd->def = 100; - if(sd->sc_data[SC_BARRIER].timer!=-1) - sd->mdef = 100; - - if(sd->sc_data[SC_GOSPEL].timer!=-1) { - if (sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){ - switch (sd->sc_data[SC_GOSPEL].val3) - { - case 4: - sd->status.max_hp += sd->status.max_hp * 25 / 100; - if(sd->status.max_hp > battle_config.max_hp) - sd->status.max_hp = battle_config.max_hp; - break; - case 5: - sd->status.max_sp += sd->status.max_sp * 25 / 100; - if(sd->status.max_sp > battle_config.max_sp) - sd->status.max_sp = battle_config.max_sp; - break; - case 11: - sd->def += sd->def * 25 / 100; - sd->def2 += sd->def2 * 25 / 100; - break; - case 12: - sd->base_atk += sd->base_atk * 8 / 100; - break; - case 13: - sd->flee += sd->flee * 5 / 100; - break; - case 14: - sd->hit += sd->hit * 5 / 100; - break; - } - } else if (sd->sc_data[SC_GOSPEL].val4 == BCT_ENEMY){ - switch (sd->sc_data[SC_GOSPEL].val3) - { - case 5: - sd->def = 0; - sd->def2 = 0; - break; - case 6: - sd->base_atk = 0; - sd->watk = 0; - sd->watk2 = 0; - break; - case 7: - sd->flee = 0; - break; - case 8: - sd->speed_rate += 75; - aspd_rate += 75; - break; - } - } - } - } - - if (sd->speed_rate <= 0) - sd->speed_rate = 1; - - if(sd->speed_rate != 100) - sd->speed = sd->speed*sd->speed_rate/100; - if(sd->speed < 1) sd->speed = 1; - if(aspd_rate != 100) - sd->aspd = sd->aspd*aspd_rate/100; - if(pc_isriding(sd)) // 騎兵修練 - sd->aspd = sd->aspd*(100 + 10*(5 - pc_checkskill(sd,KN_CAVALIERMASTERY)))/ 100; - if(sd->aspd < battle_config.max_aspd) sd->aspd = battle_config.max_aspd; - sd->amotion = sd->aspd; - sd->dmotion = 800-sd->paramc[1]*4; - if(sd->dmotion<400) - sd->dmotion = 400; - if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) { - sd->prev_speed = sd->speed; - sd->speed = sd->speed*(175 - skill*5)/100; - } - - if(sd->status.hp>sd->status.max_hp) - sd->status.hp=sd->status.max_hp; - if(sd->status.sp>sd->status.max_sp) - sd->status.sp=sd->status.max_sp; - - if(first&4) - return 0; - if(first&3) { - clif_updatestatus(sd,SP_SPEED); - clif_updatestatus(sd,SP_MAXHP); - clif_updatestatus(sd,SP_MAXSP); - if(first&1) { - clif_updatestatus(sd,SP_HP); - clif_updatestatus(sd,SP_SP); - } - return 0; - } - - if(b_class != sd->view_class) { - clif_changelook(&sd->bl,LOOK_BASE,sd->view_class); -#if PACKETVER < 4 - clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); - clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); -#else - clif_changelook(&sd->bl,LOOK_WEAPON,0); -#endif - } - - if( memcmp(b_skill,sd->status.skill,sizeof(sd->status.skill)) || b_attackrange != sd->attackrange) - clif_skillinfoblock(sd); // スキル送信 - - if(b_speed != sd->speed) - clif_updatestatus(sd,SP_SPEED); - if(b_weight != sd->weight) - clif_updatestatus(sd,SP_WEIGHT); - if(b_max_weight != sd->max_weight) { - clif_updatestatus(sd,SP_MAXWEIGHT); - pc_checkweighticon(sd); - } - for(i=0;i<6;i++) - if(b_paramb[i] + b_parame[i] != sd->paramb[i] + sd->parame[i]) - clif_updatestatus(sd,SP_STR+i); - if(b_hit != sd->hit) - clif_updatestatus(sd,SP_HIT); - if(b_flee != sd->flee) - clif_updatestatus(sd,SP_FLEE1); - if(b_aspd != sd->aspd) - clif_updatestatus(sd,SP_ASPD); - if(b_watk != sd->watk || b_base_atk != sd->base_atk) - clif_updatestatus(sd,SP_ATK1); - if(b_def != sd->def) - clif_updatestatus(sd,SP_DEF1); - if(b_watk2 != sd->watk2) - clif_updatestatus(sd,SP_ATK2); - if(b_def2 != sd->def2) - clif_updatestatus(sd,SP_DEF2); - if(b_flee2 != sd->flee2) - clif_updatestatus(sd,SP_FLEE2); - if(b_critical != sd->critical) - clif_updatestatus(sd,SP_CRITICAL); - if(b_matk1 != sd->matk1) - clif_updatestatus(sd,SP_MATK1); - if(b_matk2 != sd->matk2) - clif_updatestatus(sd,SP_MATK2); - if(b_mdef != sd->mdef) - clif_updatestatus(sd,SP_MDEF1); - if(b_mdef2 != sd->mdef2) - clif_updatestatus(sd,SP_MDEF2); - if(b_attackrange != sd->attackrange) - clif_updatestatus(sd,SP_ATTACKRANGE); - if(b_max_hp != sd->status.max_hp) - clif_updatestatus(sd,SP_MAXHP); - if(b_max_sp != sd->status.max_sp) - clif_updatestatus(sd,SP_MAXSP); - if(b_hp != sd->status.hp) - clif_updatestatus(sd,SP_HP); - if(b_sp != sd->status.sp) - clif_updatestatus(sd,SP_SP); - -/* if(before.cart_num != before.cart_num || before.cart_max_num != before.cart_max_num || - before.cart_weight != before.cart_weight || before.cart_max_weight != before.cart_max_weight ) - clif_updatestatus(sd,SP_CARTINFO);*/ - - //if(sd->status.hpstatus.max_hp>>2 && pc_checkskill(sd,SM_AUTOBERSERK)>0 && - if(sd->status.hpstatus.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 && - (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 ) && !pc_isdead(sd)) - // オ?トバ?サ?ク?動 - skill_status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0); - - return 0; -} - -/*========================================== - * For quick calculating [Celest] - *------------------------------------------ - */ -int pc_calcspeed (struct map_session_data *sd) -{ - int b_speed, skill; - struct pc_base_job s_class; - - nullpo_retr(0, sd); - - s_class = pc_calc_base_job(sd->status.class_); - - b_speed = sd->speed; - sd->speed = DEFAULT_WALK_SPEED ; - - if(sd->sc_count){ - if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){ // 速度?加 - sd->speed -= sd->speed *25/100; - } - if(sd->sc_data[SC_DECREASEAGI].timer!=-1) { - sd->speed = sd->speed *125/100; - } - if(sd->sc_data[SC_CLOAKING].timer!=-1) { - sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100; - } - if(sd->sc_data[SC_CHASEWALK].timer!=-1) { - sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100; - } - if(sd->sc_data[SC_QUAGMIRE].timer!=-1){ - sd->speed = sd->speed*3/2; - } - if(sd->sc_data[SC_WINDWALK].timer!=-1 && sd->sc_data[SC_INCREASEAGI].timer==-1) { - sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100; - } - if(sd->sc_data[SC_CARTBOOST].timer!=-1) { - sd->speed -= (DEFAULT_WALK_SPEED * 20)/100; - } - if(sd->sc_data[SC_BERSERK].timer!=-1) { - sd->speed -= sd->speed *25/100; - } - if(sd->sc_data[SC_WEDDING].timer!=-1) { - sd->speed = 2*DEFAULT_WALK_SPEED; - } - if(sd->sc_data[SC_DONTFORGETME].timer!=-1){ - sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100; - } - if(sd->sc_data[SC_STEELBODY].timer!=-1){ - sd->speed = (sd->speed * 125) / 100; - } - if(sd->sc_data[SC_DEFENDER].timer != -1) { - // removed as of 12/14's patch [celest] - //sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; - } - if( sd->sc_data[SC_DANCING].timer!=-1 ){ - sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON))); - } - if(sd->sc_data[SC_CURSE].timer!=-1) - sd->speed += 450; - if(sd->sc_data[SC_SLOWDOWN].timer!=-1) - sd->speed = sd->speed*150/100; - if(sd->sc_data[SC_SPEEDUP0].timer!=-1) - sd->speed -= sd->speed*25/100; - } - - if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 ) - sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9); - if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0) - sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1); - else if (pc_isriding(sd)) { - sd->speed -= (0.25 * DEFAULT_WALK_SPEED); + status_change_end(&sd->bl,SC_WEIGHT90,-1); } - if((skill=pc_checkskill(sd,TF_MISS))>0) - if(s_class.job==12) - sd->speed -= sd->speed *(skill*1.5)/100; - - if(sd->speed_rate != 100) - sd->speed = sd->speed*sd->speed_rate/100; - if(sd->speed < 1) sd->speed = 1; - - if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) { - sd->prev_speed = sd->speed; - sd->speed = sd->speed*(175 - skill*5)/100; - } - - if(b_speed != sd->speed) - clif_updatestatus(sd,SP_SPEED); - return 0; } @@ -3076,12 +1866,12 @@ int pc_skill(struct map_session_data *sd,int id,int level,int flag) } if(!flag && (sd->status.skill[id].id == id || level == 0)){ // クエスト所得ならここで?件を確認して送信する sd->status.skill[id].lv=level; - pc_calcstatus(sd,0); + status_calc_pc(sd,0); clif_skillinfoblock(sd); } else if(flag==2 && (sd->status.skill[id].id == id || level == 0)){ // クエスト所得ならここで?件を確認して送信する sd->status.skill[id].lv+=level; - pc_calcstatus(sd,0); + status_calc_pc(sd,0); clif_skillinfoblock(sd); } else if(sd->status.skill[id].lv < level){ // ?えられるがlvが小さいなら @@ -3949,19 +2739,19 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt if (sd->sc_count) { if(sd->sc_data[SC_TRICKDEAD].timer != -1) - skill_status_change_end(&sd->bl, SC_TRICKDEAD, -1); + status_change_end(&sd->bl, SC_TRICKDEAD, -1); if(sd->sc_data[SC_BLADESTOP].timer!=-1) - skill_status_change_end(&sd->bl,SC_BLADESTOP,-1); + status_change_end(&sd->bl,SC_BLADESTOP,-1); if(sd->sc_data[SC_DANCING].timer!=-1) // clear dance effect when warping [Valaris] skill_stop_dancing(&sd->bl,0); } if(sd->status.option&2) - skill_status_change_end(&sd->bl, SC_HIDING, -1); + status_change_end(&sd->bl, SC_HIDING, -1); if(sd->status.option&4) - skill_status_change_end(&sd->bl, SC_CLOAKING, -1); + status_change_end(&sd->bl, SC_CLOAKING, -1); if(sd->status.option&16386) - skill_status_change_end(&sd->bl, SC_CHASEWALK, -1); + status_change_end(&sd->bl, SC_CHASEWALK, -1); if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 0) { pet_stopattack(sd->pd); @@ -3999,7 +2789,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt sd->pd = NULL; sd->petDB = NULL; if(battle_config.pet_status_support) - pc_calcstatus(sd,2); + status_calc_pc(sd,2); } else if(sd->pet.intimate > 0) { pet_stopattack(sd->pd); @@ -4056,7 +2846,7 @@ int pc_setpos(struct map_session_data *sd,char *mapname_org,int x,int y,int clrt sd->pd = NULL; sd->petDB = NULL; if(battle_config.pet_status_support) - pc_calcstatus(sd,2); + status_calc_pc(sd,2); pc_makesavestatus(sd); chrif_save(sd); storage_storage_save(sd); @@ -4332,7 +3122,7 @@ static int pc_walk(int tid,unsigned int tick,int id,int data) if ((su = (struct skill_unit *)sd->sc_data[SC_BASILICA].val4)) { struct skill_unit_group *sg; if ((sg = su->group) && sg->src_id == sd->bl.id) { - skill_status_change_end(&sd->bl,SC_BASILICA,-1); + status_change_end(&sd->bl,SC_BASILICA,-1); skill_delunitgroup (sg); } } @@ -4449,7 +3239,7 @@ int pc_stop_walking(struct map_session_data *sd,int type) clif_fixpos(&sd->bl); if(type&0x02 && battle_config.pc_damage_delay) { unsigned int tick = gettick(); - int delay = battle_get_dmotion(&sd->bl); + int delay = status_get_dmotion(&sd->bl); if(sd->canmove_tick < tick) sd->canmove_tick = tick + delay; } @@ -4584,41 +3374,41 @@ int pc_checkallowskill(struct map_session_data *sd) nullpo_retr(0, sd->sc_data); if(!(skill_get_weapontype(KN_TWOHANDQUICKEN)&(1<status.weapon)) && sd->sc_data[SC_TWOHANDQUICKEN].timer!=-1) { // 2HQ - skill_status_change_end(&sd->bl,SC_TWOHANDQUICKEN,-1); // 2HQを解除 + status_change_end(&sd->bl,SC_TWOHANDQUICKEN,-1); // 2HQを解除 return -1; } if(!(skill_get_weapontype(LK_AURABLADE)&(1<status.weapon)) && sd->sc_data[SC_AURABLADE].timer!=-1) { /* オ?ラブレ?ド */ - skill_status_change_end(&sd->bl,SC_AURABLADE,-1); /* オ?ラブレ?ドを解除 */ + status_change_end(&sd->bl,SC_AURABLADE,-1); /* オ?ラブレ?ドを解除 */ return -1; } if(!(skill_get_weapontype(LK_PARRYING)&(1<status.weapon)) && sd->sc_data[SC_PARRYING].timer!=-1) { /* パリイング */ - skill_status_change_end(&sd->bl,SC_PARRYING,-1); /* パリイングを解除 */ + status_change_end(&sd->bl,SC_PARRYING,-1); /* パリイングを解除 */ return -1; } if(!(skill_get_weapontype(LK_CONCENTRATION)&(1<status.weapon)) && sd->sc_data[SC_CONCENTRATION].timer!=-1) { /* コンセントレ?ション */ - skill_status_change_end(&sd->bl,SC_CONCENTRATION,-1); /* コンセントレ?ションを解除 */ + status_change_end(&sd->bl,SC_CONCENTRATION,-1); /* コンセントレ?ションを解除 */ return -1; } if(!(skill_get_weapontype(CR_SPEARQUICKEN)&(1<status.weapon)) && sd->sc_data[SC_SPEARSQUICKEN].timer!=-1){ // スピアクィッケン - skill_status_change_end(&sd->bl,SC_SPEARSQUICKEN,-1); // スピアクイッケンを解除 + status_change_end(&sd->bl,SC_SPEARSQUICKEN,-1); // スピアクイッケンを解除 return -1; } if(!(skill_get_weapontype(BS_ADRENALINE)&(1<status.weapon)) && sd->sc_data[SC_ADRENALINE].timer!=-1){ // アドレナリンラッシュ - skill_status_change_end(&sd->bl,SC_ADRENALINE,-1); // アドレナリンラッシュを解除 + status_change_end(&sd->bl,SC_ADRENALINE,-1); // アドレナリンラッシュを解除 return -1; } if(sd->status.shield <= 0) { if(sd->sc_data[SC_AUTOGUARD].timer!=-1){ // オ?トガ?ド - skill_status_change_end(&sd->bl,SC_AUTOGUARD,-1); + status_change_end(&sd->bl,SC_AUTOGUARD,-1); return -1; } if(sd->sc_data[SC_DEFENDER].timer!=-1){ // ディフェンダ? - skill_status_change_end(&sd->bl,SC_DEFENDER,-1); + status_change_end(&sd->bl,SC_DEFENDER,-1); return -1; } if(sd->sc_data[SC_REFLECTSHIELD].timer!=-1){ //リフレクトシ?ルド - skill_status_change_end(&sd->bl,SC_REFLECTSHIELD,-1); + status_change_end(&sd->bl,SC_REFLECTSHIELD,-1); return -1; } } @@ -4764,11 +3554,11 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data) return 0; } - //if((opt = battle_get_option(bl)) != NULL && *opt&0x46) - if((opt = battle_get_option(bl)) != NULL && *opt&0x42) + //if((opt = status_get_option(bl)) != NULL && *opt&0x46) + if((opt = status_get_option(bl)) != NULL && *opt&0x42) return 0; - if(((sc_data = battle_get_sc_data(bl)) != NULL && sc_data[SC_TRICKDEAD].timer != -1) || - ((sc_data = battle_get_sc_data(bl)) != NULL && sc_data[SC_BASILICA].timer != -1 )) + if(((sc_data = status_get_sc_data(bl)) != NULL && sc_data[SC_TRICKDEAD].timer != -1) || + ((sc_data = status_get_sc_data(bl)) != NULL && sc_data[SC_BASILICA].timer != -1 )) return 0; if(sd->skilltimer != -1 && pc_checkskill(sd,SA_FREECAST) <= 0) @@ -4808,7 +3598,7 @@ int pc_attack_timer(int tid,unsigned int tick,int id,int data) sd->attacktarget_lv = battle_weapon_attack(&sd->bl,bl,tick,0); // &2 = ? - Celest if(!(battle_config.pc_cloak_check_type&2) && sd->sc_data[SC_CLOAKING].timer != -1) - skill_status_change_end(&sd->bl,SC_CLOAKING,-1); + status_change_end(&sd->bl,SC_CLOAKING,-1); if(sd->status.pet_id > 0 && sd->pd && sd->petDB && battle_config.pet_attack_support) pet_target_check(sd,bl,0); map_freeblock_unlock(); @@ -4969,16 +3759,16 @@ int pc_checkbaselevelup(struct map_session_data *sd) clif_updatestatus(sd,SP_STATUSPOINT); clif_updatestatus(sd,SP_BASELEVEL); clif_updatestatus(sd,SP_NEXTBASEEXP); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); pc_heal(sd,sd->status.max_hp,sd->status.max_sp); //スパノビはキリエ、イムポ、マニピ、グロ、サフラLv1がかかる if(s_class.job == 23){ - skill_status_change_start(&sd->bl,SkillStatusChangeTable[PR_KYRIE],1,0,0,0,skill_get_time(PR_KYRIE,1),0 ); - skill_status_change_start(&sd->bl,SkillStatusChangeTable[PR_IMPOSITIO],1,0,0,0,skill_get_time(PR_IMPOSITIO,1),0 ); - skill_status_change_start(&sd->bl,SkillStatusChangeTable[PR_MAGNIFICAT],1,0,0,0,skill_get_time(PR_MAGNIFICAT,1),0 ); - skill_status_change_start(&sd->bl,SkillStatusChangeTable[PR_GLORIA],1,0,0,0,skill_get_time(PR_GLORIA,1),0 ); - skill_status_change_start(&sd->bl,SkillStatusChangeTable[PR_SUFFRAGIUM],1,0,0,0,skill_get_time(PR_SUFFRAGIUM,1),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[PR_KYRIE],1,0,0,0,skill_get_time(PR_KYRIE,1),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[PR_IMPOSITIO],1,0,0,0,skill_get_time(PR_IMPOSITIO,1),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[PR_MAGNIFICAT],1,0,0,0,skill_get_time(PR_MAGNIFICAT,1),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[PR_GLORIA],1,0,0,0,skill_get_time(PR_GLORIA,1),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[PR_SUFFRAGIUM],1,0,0,0,skill_get_time(PR_SUFFRAGIUM,1),0 ); } clif_misceffect(&sd->bl,0); @@ -5005,7 +3795,7 @@ int pc_checkjoblevelup(struct map_session_data *sd) clif_updatestatus(sd,SP_NEXTJOBEXP); sd->status.skill_point ++; clif_updatestatus(sd,SP_SKILLPOINT); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); clif_misceffect(&sd->bl,1); return 1; @@ -5261,7 +4051,7 @@ int pc_statusup(struct map_session_data *sd,int type) } clif_updatestatus(sd,SP_STATUSPOINT); clif_updatestatus(sd,type); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); clif_statusupack(sd,type,1,val); return 0; @@ -5337,7 +4127,7 @@ int pc_statusup2(struct map_session_data *sd,int type,int val) } clif_updatestatus(sd,type-SP_STR+SP_USTR); clif_updatestatus(sd,type); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); clif_statusupack(sd,type,1,val); return 0; @@ -5363,7 +4153,7 @@ int pc_skillup(struct map_session_data *sd,int skill_num) { sd->status.skill[skill_num].lv++; sd->status.skill_point--; - pc_calcstatus(sd,0); + status_calc_pc(sd,0); clif_skillup(sd,skill_num); clif_updatestatus(sd,SP_SKILLPOINT); clif_skillinfoblock(sd); @@ -5421,7 +4211,7 @@ int pc_allskillup(struct map_session_data *sd) } } } - pc_calcstatus(sd,0); + status_calc_pc(sd,0); return 0; } @@ -5506,7 +4296,7 @@ int pc_resetlvl(struct map_session_data* sd,int type) } clif_skillinfoblock(sd); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); return 0; } @@ -5559,7 +4349,7 @@ int pc_resetstate(struct map_session_data* sd) clif_updatestatus(sd,SP_UDEX); clif_updatestatus(sd,SP_ULUK); // End Addition - pc_calcstatus(sd,0); + status_calc_pc(sd,0); return 0; } @@ -5594,7 +4384,7 @@ int pc_resetskill(struct map_session_data* sd) } clif_updatestatus(sd,SP_SKILLPOINT); clif_skillinfoblock(sd); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); return 0; } @@ -5626,7 +4416,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) if (sd->sc_data[SC_ENDURE].timer == -1 && sd->sc_data[SC_BERSERK].timer == -1 && !sd->special_state.infinite_endure) pc_stop_walking(sd,3); else if(sd->sc_data[SC_ENDURE].timer != -1 && (src != NULL && src->type==BL_MOB) && (--sd->sc_data[SC_ENDURE].val2) <= 0) - skill_status_change_end(&sd->bl, SC_ENDURE, -1); + status_change_end(&sd->bl, SC_ENDURE, -1); } else pc_stop_walking(sd,3); @@ -5639,13 +4429,13 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) pet_target_check(sd,src,1); if (sd->sc_data[SC_TRICKDEAD].timer != -1) - skill_status_change_end(&sd->bl, SC_TRICKDEAD, -1); + status_change_end(&sd->bl, SC_TRICKDEAD, -1); if(sd->status.option&2) - skill_status_change_end(&sd->bl, SC_HIDING, -1); + status_change_end(&sd->bl, SC_HIDING, -1); if(sd->status.option&4) - skill_status_change_end(&sd->bl, SC_CLOAKING, -1); + status_change_end(&sd->bl, SC_CLOAKING, -1); if(sd->status.option&16386) - skill_status_change_end(&sd->bl, SC_CHASEWALK, -1); + status_change_end(&sd->bl, SC_CHASEWALK, -1); if(sd->status.hp>0){ // まだ生きているならHP更新 @@ -5655,7 +4445,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) if(sd->status.hpstatus.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 && (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 )) // オ?トバ?サ?ク?動 - skill_status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0); + status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0); sd->canlog_tick = gettick(); @@ -5686,11 +4476,11 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) pc_setdead(sd); skill_unit_out_all(&sd->bl,gettick(),1); if(sd->sc_data[SC_BLADESTOP].timer!=-1)//白刃は事前に解除 - skill_status_change_end(&sd->bl,SC_BLADESTOP,-1); + status_change_end(&sd->bl,SC_BLADESTOP,-1); pc_setglobalreg(sd,"PC_DIE_COUNTER",++sd->die_counter); //死にカウンタ?書き?み - skill_status_change_clear(&sd->bl,0); // ステ?タス異常を解除する + status_change_clear(&sd->bl,0); // ステ?タス異常を解除する clif_updatestatus(sd,SP_HP); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); if (sd->state.event_death) { struct npc_data *npc; @@ -5735,7 +4525,7 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) for(i=0;i<5;i++) if(sd->dev.val1[i]){ - skill_status_change_end(&map_id2sd(sd->dev.val1[i])->bl,SC_DEVOTION,-1); + status_change_end(&map_id2sd(sd->dev.val1[i])->bl,SC_DEVOTION,-1); sd->dev.val1[i] = sd->dev.val2[i]=0; } @@ -5992,7 +4782,7 @@ int pc_setparam(struct map_session_data *sd,int type,int val) clif_updatestatus(sd, SP_NEXTBASEEXP); clif_updatestatus(sd, SP_STATUSPOINT); clif_updatestatus(sd, SP_BASEEXP); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); pc_heal(sd, sd->status.max_hp, sd->status.max_sp); break; case SP_JOBLEVEL: @@ -6012,7 +4802,7 @@ int pc_setparam(struct map_session_data *sd,int type,int val) clif_updatestatus(sd, SP_NEXTJOBEXP); clif_updatestatus(sd, SP_JOBEXP); clif_updatestatus(sd, SP_SKILLPOINT); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); clif_misceffect(&sd->bl, 1); } else { sd->status.job_level = val; @@ -6020,7 +4810,7 @@ int pc_setparam(struct map_session_data *sd,int type,int val) clif_updatestatus(sd, SP_JOBLEVEL); clif_updatestatus(sd, SP_NEXTJOBEXP); clif_updatestatus(sd, SP_JOBEXP); - pc_calcstatus(sd, 0); + status_calc_pc(sd, 0); } clif_updatestatus(sd,type); break; @@ -6351,7 +5141,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) if(battle_config.muting_players && sd->status.manner < 0) clif_changestatus(&sd->bl,SP_MANNER,sd->status.manner); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); pc_checkallowskill(sd); pc_equiplookall(sd); clif_equiplist(sd); @@ -6439,7 +5229,7 @@ int pc_setoption(struct map_session_data *sd,int type) sd->status.option=type; clif_changeoption(&sd->bl); - pc_calcstatus(sd,0); + status_calc_pc(sd,0); return 0; } @@ -6654,7 +5444,7 @@ int pc_setglobalreg(struct map_session_data *sd,char *reg,int val) //PC_DIE_COUNTERがスクリプトなどで?更された暫フ?理 if(strcmp(reg,"PC_DIE_COUNTER") == 0 && sd->die_counter != val){ sd->die_counter = val; - pc_calcstatus(sd,0); + status_calc_pc(sd,0); } else if(strcmp(reg,"PCDieEvent") == 0){ sd->state.event_death = val; } else if(strcmp(reg,"PCKillEvent") == 0){ @@ -6811,29 +5601,6 @@ int pc_setaccountreg2(struct map_session_data *sd,char *reg,int val) return 1; } -/*========================================== - * 精?成功率 - *------------------------------------------ - */ -int pc_percentrefinery(struct map_session_data *sd,struct item *item) -{ - int percent; - - nullpo_retr(0, item); - percent=percentrefinery[itemdb_wlv(item->nameid)][(int)item->refine]; - - percent += pc_checkskill(sd,BS_WEAPONRESEARCH); // 武器?究スキル所持 - - // 確率の有?範?チェック - if( percent > 100 ){ - percent = 100; - } - if( percent < 0 ){ - percent = 0; - } - - return percent; -} /*========================================== * イベントタイマ??理 @@ -7085,20 +5852,20 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos) clif_arrowequip(sd,arrow); sd->status.inventory[arrow].equip=32768; } - pc_calcstatus(sd,0); + status_calc_pc(sd,0); if(sd->special_state.infinite_endure) { if(sd->sc_data[SC_ENDURE].timer == -1) - skill_status_change_start(&sd->bl,SC_ENDURE,10,1,0,0,0,0); + status_change_start(&sd->bl,SC_ENDURE,10,1,0,0,0,0); } else { if(sd->sc_count && sd->sc_data[SC_ENDURE].timer != -1 && sd->sc_data[SC_ENDURE].val2) - skill_status_change_end(&sd->bl,SC_ENDURE,-1); + status_change_end(&sd->bl,SC_ENDURE,-1); } if(sd->sc_count) { if (sd->sc_data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele)) - skill_status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1); + status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1); if(sd->sc_data[SC_DANCING].timer!=-1 && (sd->status.weapon != 13 && sd->status.weapon !=14)) skill_stop_dancing(&sd->bl,0); } @@ -7162,10 +5929,10 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) if(sd->sc_count) { if (sd->sc_data[SC_BROKNWEAPON].timer != -1 && sd->status.inventory[n].equip & 0x0002 && sd->status.inventory[n].attribute == 1) - skill_status_change_end(&sd->bl,SC_BROKNWEAPON,-1); + status_change_end(&sd->bl,SC_BROKNWEAPON,-1); if(sd->sc_data[SC_BROKNARMOR].timer != -1 && sd->status.inventory[n].equip & 0x0010 && sd->status.inventory[n].attribute == 1) - skill_status_change_end(&sd->bl,SC_BROKNARMOR,-1); + status_change_end(&sd->bl,SC_BROKNARMOR,-1); } clif_unequipitemack(sd,n,sd->status.inventory[n].equip,1); @@ -7178,9 +5945,9 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) clif_unequipitemack(sd,n,0,0); } if(flag&1) { - pc_calcstatus(sd,0); + status_calc_pc(sd,0); if(sd->sc_count && sd->sc_data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele)) - skill_status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1); + status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1); } return 0; @@ -7261,7 +6028,7 @@ int pc_checkitem(struct map_session_data *sd) pc_setequipindex(sd); if(calc_flag) - pc_calcstatus(sd,2); + status_calc_pc(sd,2); return 0; } @@ -7980,7 +6747,7 @@ void pc_setstand(struct map_session_data *sd){ nullpo_retv(sd); if(sd->sc_count && sd->sc_data[SC_TENSIONRELAX].timer!=-1) - skill_status_change_end(&sd->bl,SC_TENSIONRELAX,-1); + status_change_end(&sd->bl,SC_TENSIONRELAX,-1); sd->state.dead_sit = 0; } @@ -8042,96 +6809,6 @@ int pc_readdb(void) sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/exp.txt"); ShowStatus(tmp_output); - // JOB補正?値1 - fp=fopen("db/job_db1.txt","r"); - if(fp==NULL){ - printf("can't read db/job_db1.txt\n"); - return 1; - } - i=0; - while(fgets(line, sizeof(line)-1, fp)){ - char *split[50]; - if(line[0]=='/' && line[1]=='/') - continue; - for(j=0,p=line;j<21 && p;j++){ - split[j]=p; - p=strchr(p,','); - if(p) *p++=0; - } - if(j<21) - continue; - max_weight_base[i]=atoi(split[0]); - hp_coefficient[i]=atoi(split[1]); - hp_coefficient2[i]=atoi(split[2]); - sp_coefficient[i]=atoi(split[3]); - for(j=0;j<17;j++) - aspd_base[i][j]=atoi(split[j+4]); - i++; -// -- moonsoul (below two lines added to accommodate high numbered new class ids) - if(i==24) - i=4001; - if(i==MAX_PC_CLASS) - break; - } - fclose(fp); - sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/job_db1.txt"); - ShowStatus(tmp_output); - - // JOBボ?ナス - memset(job_bonus,0,sizeof(job_bonus)); - fp=fopen("db/job_db2.txt","r"); - if(fp==NULL){ - printf("can't read db/job_db2.txt\n"); - return 1; - } - i=0; - while(fgets(line, sizeof(line)-1, fp)){ - if(line[0]=='/' && line[1]=='/') - continue; - for(j=0,p=line;jstate.dead_sit = 1) #define pc_setsit(sd) ((sd)->state.dead_sit = 2) @@ -44,6 +45,7 @@ int pc_checkskill(struct map_session_data *sd,int skill_id); int pc_checkallowskill(struct map_session_data *sd); int pc_checkequip(struct map_session_data *sd,int pos); +int pc_calc_skilltree(struct map_session_data *sd); int pc_calc_skilltree_normalize_job(int c, struct map_session_data *sd); int pc_checkoverhp(struct map_session_data*); @@ -79,8 +81,6 @@ int pc_dropitem(struct map_session_data*,int,int); int pc_checkweighticon(struct map_session_data *sd); -int pc_calcstatus(struct map_session_data*,int); -int pc_calcspeed(struct map_session_data*); // [Celest] int pc_bonus(struct map_session_data*,int,int); int pc_bonus2(struct map_session_data *sd,int,int,int); int pc_bonus3(struct map_session_data *sd,int,int,int,int); @@ -146,7 +146,6 @@ int pc_readaccountreg(struct map_session_data*,char*); int pc_setaccountreg(struct map_session_data*,char*,int); int pc_readaccountreg2(struct map_session_data*,char*); int pc_setaccountreg2(struct map_session_data*,char*,int); -int pc_percentrefinery(struct map_session_data *sd,struct item *item); int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name); int pc_deleventtimer(struct map_session_data *sd,const char *name); diff --git a/src/map/pet.c b/src/map/pet.c index 99f2a4d95..759e2d11b 100644 --- a/src/map/pet.c +++ b/src/map/pet.c @@ -9,6 +9,7 @@ #include "nullpo.h" #include "malloc.h" #include "pc.h" +#include "status.h" #include "map.h" #include "intif.h" #include "clif.h" @@ -202,7 +203,7 @@ static int pet_attack(struct pet_data *pd,unsigned int tick,int data) pd->target_lv = battle_weapon_attack(&pd->bl,&md->bl,tick,0); - pd->attackabletime = tick + battle_get_adelay(&pd->bl); + pd->attackabletime = tick + status_get_adelay(&pd->bl); pd->timer=add_timer(pd->attackabletime,pet_timer,pd->bl.id,0); pd->state.state=MS_ATTACK; @@ -310,7 +311,7 @@ int pet_target_check(struct map_session_data *sd,struct block_list *bl,int type) Assert((pd->msd == 0) || (pd->msd->pd == pd)); - if(bl && pd && bl->type == BL_MOB && sd->pet.intimate > 900 && sd->pet.hungry > 0 && pd->class_ != battle_get_class(bl) + if(bl && pd && bl->type == BL_MOB && sd->pet.intimate > 900 && sd->pet.hungry > 0 && pd->class_ != status_get_class(bl) && pd->state.state != MS_DELAY) { mode=mob_db[pd->class_].mode; race=mob_db[pd->class_].race; @@ -518,9 +519,9 @@ static int pet_hungry(int tid,unsigned int tick,int id,int data) sd->pet.intimate = 0; if(battle_config.pet_status_support && t > 0) { if(sd->bl.prev != NULL) - pc_calcstatus(sd,0); + status_calc_pc(sd,0); else - pc_calcstatus(sd,2); + status_calc_pc(sd,2); } } clif_send_petdata(sd,1,sd->pet.intimate); @@ -672,9 +673,9 @@ int pet_return_egg(struct map_session_data *sd) } if(battle_config.pet_status_support && sd->pet.intimate > 0) { if(sd->bl.prev != NULL) - pc_calcstatus(sd,0); + status_calc_pc(sd,0); else - pc_calcstatus(sd,2); + status_calc_pc(sd,2); } // ルートしたItemを落とさせる pet_lootitem_drop(pd,sd); @@ -821,9 +822,9 @@ int pet_recv_petdata(int account_id,struct s_pet *p,int flag) } if(battle_config.pet_status_support && sd->pet.intimate > 0) { if(sd->bl.prev != NULL) - pc_calcstatus(sd,0); + status_calc_pc(sd,0); else - pc_calcstatus(sd,2); + status_calc_pc(sd,2); } return 0; @@ -995,7 +996,7 @@ int pet_equipitem(struct map_session_data *sd,int index) else { pc_delitem(sd,index,1,0); sd->pet.equip = sd->pd->equip = nameid; - pc_calcstatus(sd,0); + status_calc_pc(sd,0); clif_pet_equip(sd->pd,nameid); } @@ -1016,7 +1017,7 @@ int pet_unequipitem(struct map_session_data *sd) nameid = sd->pet.equip; sd->pet.equip = sd->pd->equip = 0; - pc_calcstatus(sd,0); + status_calc_pc(sd,0); clif_pet_equip(sd->pd,0); memset(&tmp_item,0,sizeof(tmp_item)); tmp_item.nameid = nameid; @@ -1069,9 +1070,9 @@ int pet_food(struct map_session_data *sd) sd->pet.intimate = 0; if(battle_config.pet_status_support && t > 0) { if(sd->bl.prev != NULL) - pc_calcstatus(sd,0); + status_calc_pc(sd,0); else - pc_calcstatus(sd,2); + status_calc_pc(sd,2); } } else if(sd->pet.intimate > 1000) @@ -1096,7 +1097,7 @@ static int pet_randomwalk(struct pet_data *pd,int tick) Assert((pd->msd == 0) || (pd->msd->pd == pd)); - speed = battle_get_speed(&pd->bl); + speed = status_get_speed(&pd->bl); if(DIFF_TICK(pd->next_walktime,tick) < 0){ int i,x,y,c,d=12-pd->move_fail_count; @@ -1201,7 +1202,7 @@ static int pet_ai_sub_hard(struct pet_data *pd,unsigned int tick) pet_unlocktarget(pd); else { i=0; - pd->speed = battle_get_speed(&pd->bl); + pd->speed = status_get_speed(&pd->bl); do { if(i==0) { // 最初はAEGISと同じ方法で検索 dx=md->bl.x - pd->bl.x; @@ -1285,14 +1286,14 @@ static int pet_ai_sub_hard(struct pet_data *pd,unsigned int tick) else { if(dist <= 3 || (pd->timer != -1 && pd->state.state == MS_WALK && distance(pd->to_x,pd->to_y,sd->bl.x,sd->bl.y) < 3) ) return 0; - pd->speed = battle_get_speed(&pd->bl); + pd->speed = status_get_speed(&pd->bl); pet_calc_pos(pd,sd->bl.x,sd->bl.y,sd->dir); if(pet_walktoxy(pd,pd->to_x,pd->to_y)) pet_randomwalk(pd,tick); } } else { - pd->speed = battle_get_speed(&pd->bl); + pd->speed = status_get_speed(&pd->bl); if(pd->state.state == MS_ATTACK) pet_stopattack(pd); pet_randomwalk(pd,tick); @@ -1492,7 +1493,7 @@ int pet_recovery_timer(int tid,unsigned int tick,int id,int data) return 0; if(sd->sc_data[pd->skilltype].timer != -1) - skill_status_change_end(&sd->bl,pd->skilltype,-1); + status_change_end(&sd->bl,pd->skilltype,-1); pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_recovery_timer,sd->bl.id,0); @@ -1543,7 +1544,7 @@ int pet_mag_timer(int tid,unsigned int tick,int id,int data) if(sd->status.hp < sd->status.max_hp * pd->skilltype/100 && sd->status.sp < sd->status.max_sp * pd->skillduration/100) { clif_skill_nodamage(&pd->bl,&sd->bl,PR_MAGNIFICAT,pd->skillval,1); - skill_status_change_start(&sd->bl,SkillStatusChangeTable[PR_MAGNIFICAT],pd->skillval,0,0,0,skill_get_time(PR_MAGNIFICAT,pd->skillval),0 ); + status_change_start(&sd->bl,SkillStatusChangeTable[PR_MAGNIFICAT],pd->skillval,0,0,0,skill_get_time(PR_MAGNIFICAT,pd->skillval),0 ); } pd->skillbonustimer=add_timer(gettick()+pd->skilltimer*1000,pet_mag_timer,sd->bl.id,0); diff --git a/src/map/script.c b/src/map/script.c index 083f3cfd1..0e8a054e7 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24,6 +24,7 @@ #include "chrif.h" #include "itemdb.h" #include "pc.h" +#include "status.h" #include "script.h" #include "storage.h" #include "mob.h" @@ -3028,7 +3029,7 @@ int buildin_getequippercentrefinery(struct script_state *st) sd=script_rid2sd(st); i=pc_checkequip(sd,equip[num-1]); if(i >= 0) - push_val(st->stack,C_INT,pc_percentrefinery(sd,&sd->status.inventory[i])); + push_val(st->stack,C_INT,status_percentrefinery(sd,&sd->status.inventory[i])); else push_val(st->stack,C_INT,0); @@ -4274,7 +4275,7 @@ int buildin_sc_start(struct script_state *st) if (bl != 0) { if(bl->type == BL_PC && ((struct map_session_data *)bl)->state.potionpitcher_flag) bl = map_id2bl(((struct map_session_data *)bl)->skilltarget); - skill_status_change_start(bl,type,val1,0,0,0,tick,0); + status_change_start(bl,type,val1,0,0,0,tick,0); } return 0; } @@ -4298,7 +4299,7 @@ int buildin_sc_start2(struct script_state *st) if(bl->type == BL_PC && ((struct map_session_data *)bl)->state.potionpitcher_flag) bl = map_id2bl(((struct map_session_data *)bl)->skilltarget); if(rand()%10000 < per) - skill_status_change_start(bl,type,val1,0,0,0,tick,0); + status_change_start(bl,type,val1,0,0,0,tick,0); return 0; } @@ -4314,7 +4315,7 @@ int buildin_sc_end(struct script_state *st) bl = map_id2bl(st->rid); if(bl->type == BL_PC && ((struct map_session_data *)bl)->state.potionpitcher_flag) bl = map_id2bl(((struct map_session_data *)bl)->skilltarget); - skill_status_change_end(bl,type,-1); + status_change_end(bl,type,-1); // if(battle_config.etc_log) // printf("sc_end : %d %d\n",st->rid,type); return 0; @@ -4336,10 +4337,10 @@ int buildin_getscrate(struct script_state *st) else bl = map_id2bl(st->rid); - luk = battle_get_luk(bl); - sc_def_mdef2=100 - (3 + battle_get_mdef(bl) + luk/3); - sc_def_vit2=100 - (3 + battle_get_vit(bl) + luk/3); - sc_def_int2=100 - (3 + battle_get_int(bl) + luk/3); + luk = status_get_luk(bl); + sc_def_mdef2=100 - (3 + status_get_mdef(bl) + luk/3); + sc_def_vit2=100 - (3 + status_get_vit(bl) + luk/3); + sc_def_int2=100 - (3 + status_get_int(bl) + luk/3); sc_def_luk2=100 - (3 + luk); if(type==SC_STONE || type==SC_FREEZE) diff --git a/src/map/skill.c b/src/map/skill.c index b42d3d898..8c2ff23be 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -14,6 +14,7 @@ #include "map.h" #include "clif.h" #include "pc.h" +#include "status.h" #include "pet.h" #include "mob.h" #include "battle.h" @@ -877,7 +878,7 @@ int skill_tree_get_max(int id, int b_class){ int skill_check_condition( struct map_session_data *sd,int type); int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag ); int skill_frostjoke_scream(struct block_list *bl,va_list ap); -int skill_status_change_timer_sub(struct block_list *bl, va_list ap ); +int status_change_timer_sub(struct block_list *bl, va_list ap ); int skill_attack_area(struct block_list *bl,va_list ap); int skill_abra_dataset(int skilllv); int skill_clear_element_field(struct block_list *bl); @@ -1064,16 +1065,16 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s } //?象の耐性 - luk = battle_get_luk(bl); - sc_def_mdef=100 - (3 + battle_get_mdef(bl) + luk/3); - sc_def_vit=100 - (3 + battle_get_vit(bl) + luk/3); - sc_def_int=100 - (3 + battle_get_int(bl) + luk/3); + luk = status_get_luk(bl); + sc_def_mdef=100 - (3 + status_get_mdef(bl) + luk/3); + sc_def_vit=100 - (3 + status_get_vit(bl) + luk/3); + sc_def_int=100 - (3 + status_get_int(bl) + luk/3); sc_def_luk=100 - (3 + luk); //自分の耐性 - luk = battle_get_luk(src); - sc_def_mdef2=100 - (3 + battle_get_mdef(src) + luk/3); - sc_def_vit2=100 - (3 + battle_get_vit(src) + luk/3); - sc_def_int2=100 - (3 + battle_get_int(src) + luk/3); + luk = status_get_luk(src); + sc_def_mdef2=100 - (3 + status_get_mdef(src) + luk/3); + sc_def_vit2=100 - (3 + status_get_vit(src) + luk/3); + sc_def_int2=100 - (3 + status_get_int(src) + luk/3); sc_def_luk2=100 - (3 + luk); if(bl->type==BL_PC) dstsd=(struct map_session_data *)bl; @@ -1120,8 +1121,8 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s } // エンチャントデットリ?ポイズン(猛毒?果) if (sd && sd->sc_data[SC_EDP].timer != -1 && rand() % 10000 < sd->sc_data[SC_EDP].val2 * sc_def_vit) { - int mhp = battle_get_max_hp(bl); - int hp = battle_get_hp(bl); + int mhp = status_get_max_hp(bl); + int hp = status_get_hp(bl); int lvl = sd->sc_data[SC_EDP].val1; int diff; // MHPの1/4以下にはならない @@ -1140,21 +1141,21 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s md->hp = mhp>>2; } } - skill_status_change_start(bl,SC_DPOISON,lvl,0,0,0,skill_get_time2(ASC_EDP,lvl),0); + status_change_start(bl,SC_DPOISON,lvl,0,0,0,skill_get_time2(ASC_EDP,lvl),0); } break; case SM_BASH: /* バッシュ(急所攻?) */ if( sd && (skill=pc_checkskill(sd,SM_FATALBLOW))>0 ){ if( rand()%100 < 6*(skilllv-5)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(SM_FATALBLOW,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(SM_FATALBLOW,skilllv),0); } break; case TF_POISON: /* インベナム */ case AS_SPLASHER: /* ベナムスプラッシャ? */ if(rand()%100< (2*skilllv+10)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_POISON,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_POISON,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); else{ if(sd && skillid==TF_POISON) clif_skill_fail(sd,skillid,0,0); @@ -1163,128 +1164,128 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s case AS_SONICBLOW: /* ソニックブロ? */ if( rand()%100 < (2*skilllv+10)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case HT_FREEZINGTRAP: /* フリ?ジングトラップ */ rate=skilllv*3+35; if(rand()%100 < rate*sc_def_mdef/100) - skill_status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case MG_FROSTDIVER: /* フロストダイバ? */ case WZ_FROSTNOVA: /* フロストノヴァ */ - rate=(skilllv*3+35)*sc_def_mdef/100-(battle_get_int(bl)+battle_get_luk(bl))/15; + rate=(skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15; rate=rate<=5?5:rate; if(rand()%100 < rate) - skill_status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); else if(sd && skillid==MG_FROSTDIVER) clif_skill_fail(sd,skillid,0,0); break; case WZ_STORMGUST: /* スト?ムガスト */ { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); if(sc_data) { sc_data[SC_FREEZE].val3++; if(sc_data[SC_FREEZE].val3 >= 3) - skill_status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); } } break; case HT_LANDMINE: /* ランドマイン */ if( rand()%100 < (5*skilllv+30)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case HT_SHOCKWAVE: /* ショックウェ?ブトラップ */ if(map[bl->m].flag.pvp && dstsd){ dstsd->status.sp -= dstsd->status.sp*(5+15*skilllv)/100; - pc_calcstatus(dstsd,0); + status_calc_pc(dstsd,0); } break; case HT_SANDMAN: /* サンドマン */ if( rand()%100 < (5*skilllv+30)*sc_def_int/100 ) - skill_status_change_start(bl,SC_SLEEP,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_SLEEP,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case TF_SPRINKLESAND: /* 砂まき */ if( rand()%100 < 20*sc_def_int/100 ) - skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case TF_THROWSTONE: /* 石投げ */ if( rand()%100 < 7*sc_def_vit/100 ) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case CR_HOLYCROSS: /* ホ?リ?クロス */ if( rand()%100 < 3*skilllv*sc_def_int/100 ) - skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case CR_GRANDCROSS: /* グランドクロス */ case NPC_DARKGRANDCROSS: /*闇グランドクロス*/ { - int race = battle_get_race(bl); - if( (battle_check_undead(race,battle_get_elem_type(bl)) || race == 6) && rand()%100 < 100000*sc_def_int/100) //?制付?だが完全耐性には無? - skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + int race = status_get_race(bl); + if( (battle_check_undead(race,status_get_elem_type(bl)) || race == 6) && rand()%100 < 100000*sc_def_int/100) //?制付?だが完全耐性には無? + status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); } break; case AM_ACIDTERROR: if( rand()%100 < (skilllv*3)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_BLEEDING,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_BLEEDING,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case CR_SHIELDCHARGE: /* シ?ルドチャ?ジ */ if( rand()%100 < (15 + skilllv*5)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case RG_RAID: /* サプライズアタック */ if( rand()%100 < (10+3*skilllv)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); if( rand()%100 < (10+3*skilllv)*sc_def_int/100 ) - skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case BA_FROSTJOKE: if(rand()%100 < (15+5*skilllv)*sc_def_mdef/100) - skill_status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case DC_SCREAM: if( rand()%100 < (25+5*skilllv)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case BD_LULLABY: /* 子守唄 */ if( rand()%100 < 15*sc_def_int/100 ) - skill_status_change_start(bl,SC_SLEEP,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_SLEEP,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; /* MOBの追加?果付きスキル */ case NPC_PETRIFYATTACK: if(rand()%100 < sc_def_mdef) - skill_status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case NPC_POISON: case NPC_SILENCEATTACK: case NPC_STUNATTACK: if(rand()%100 < sc_def_vit && src->type!=BL_PET) - skill_status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); if(src->type==BL_PET) - skill_status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skilllv*1000,0); + status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skilllv*1000,0); break; case NPC_CURSEATTACK: if(rand()%100 < sc_def_luk) - skill_status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case NPC_SLEEPATTACK: case NPC_BLINDATTACK: if(rand()%100 < sc_def_int) - skill_status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,sc[skillid-NPC_POISON],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case NPC_MENTALBREAKER: if(dstsd) { @@ -1298,45 +1299,45 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s // case WZ_METEOR: if(rand()%100 < sc_def_vit) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case WZ_VERMILION: if(rand()%100 < sc_def_int) - skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; // -- moonsoul (stun ability of new champion skill tigerfist) // case CH_TIGERFIST: if( rand()%100 < (10 + skilllv*10)*sc_def_vit/100 ) { - int sec = skill_get_time2 (skillid,skilllv) - battle_get_agi(bl)/10; - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,sec,0); + int sec = skill_get_time2 (skillid,skilllv) - status_get_agi(bl)/10; + status_change_start(bl,SC_STAN,skilllv,0,0,0,sec,0); } break; case LK_SPIRALPIERCE: if( rand()%100 < (15 + skilllv*5)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case ST_REJECTSWORD: /* フリ?ジングトラップ */ if( rand()%100 < (skilllv*15) ) - skill_status_change_start(bl,SC_AUTOCOUNTER,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_AUTOCOUNTER,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case PF_FOGWALL: /* ホ?リ?クロス */ if(src!=bl && rand()%100 < 3*skilllv*sc_def_int/100 ) - skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case LK_HEADCRUSH: /* ヘッドクラッシュ */ {//?件が良く分からないので適?に - int race=battle_get_race(bl); - if( !(battle_check_undead(race,battle_get_elem_type(bl)) || race == 6) && rand()%100 < (2*skilllv+10)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_HEADCRUSH,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + int race=status_get_race(bl); + if( !(battle_check_undead(race,status_get_elem_type(bl)) || race == 6) && rand()%100 < (2*skilllv+10)*sc_def_vit/100 ) + status_change_start(bl,SC_HEADCRUSH,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); } break; case LK_JOINTBEAT: /* ジョイントビ?ト */ //?件が良く分からないので適?に if( rand()%100 < (2*skilllv+10)*sc_def_vit/100 ) - skill_status_change_start(bl,SC_JOINTBEAT,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_JOINTBEAT,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case PF_SPIDERWEB: /* スパイダ?ウェッブ */ { @@ -1346,24 +1347,24 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s if(map[src->m].flag.pvp) //PvPでは拘束時間半減? sec = sec/2; battle_stopwalking(bl,1); - skill_status_change_start(bl,SC_SPIDERWEB,skilllv,0,0,0,sec,0); + status_change_start(bl,SC_SPIDERWEB,skilllv,0,0,0,sec,0); } } break; case ASC_METEORASSAULT: /* メテオアサルト */ if( rand()%100 < (15 + skilllv*5)*sc_def_vit/100 ) //?態異常は詳細が分からないので適?に - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); if( rand()%100 < (10+3*skilllv)*sc_def_int/100 ) - skill_status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_BLIND,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case MO_EXTREMITYFIST: /* 阿修羅覇凰拳 */ //阿修羅を使うと5分間自然回復しないようになる - skill_status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0 ); + status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time2(skillid,skilllv),0 ); break; case HW_NAPALMVULCAN: /* ナパ?ムバルカン */ // skilllv*5%の確率で呪い if (rand()%10000 < 5*skilllv*sc_def_luk) - skill_status_change_start(bl,SC_CURSE,7,0,0,0,skill_get_time2(NPC_CURSEATTACK,7),0); + status_change_start(bl,SC_CURSE,7,0,0,0,skill_get_time2(NPC_CURSEATTACK,7),0); break; } @@ -1386,14 +1387,14 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s if(rand()%10000 < (sd->addeff[i-SC_STONE])*sc_def_card/100 ){ if(battle_config.battle_log) printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",sd->bl.id,i,sd->addeff[i-SC_STONE]); - skill_status_change_start(bl,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + status_change_start(bl,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); } } else { if(rand()%10000 < (sd->addeff[i-SC_STONE]+sd->arrow_addeff[i-SC_STONE])*sc_def_card/100 ){ if(battle_config.battle_log) printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",sd->bl.id,i,sd->addeff[i-SC_STONE]); - skill_status_change_start(bl,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + status_change_start(bl,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); } } //自分に?態異常 @@ -1410,14 +1411,14 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s if(rand()%10000 < (sd->addeff2[i-SC_STONE])*sc_def_card/100 ){ if(battle_config.battle_log) printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",src->id,i,sd->addeff2[i-SC_STONE]); - skill_status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); } } else { if(rand()%10000 < (sd->addeff2[i-SC_STONE]+sd->arrow_addeff2[i-SC_STONE])*sc_def_card/100 ){ if(battle_config.battle_log) printf("PC %d skill_addeff: cardによる異常?動 %d %d\n",src->id,i,sd->addeff2[i-SC_STONE]); - skill_status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); + status_change_start(src,i,7,0,0,0,(i==SC_CONFUSION)? 10000+7000:skill_get_time2(sc2[i-SC_STONE],7),0); } } } @@ -1457,7 +1458,7 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) dy=target->y-src->y; dy=(dy>0)?1:((dy<0)?-1: 0); } if(dx==0 && dy==0){ - int dir=battle_get_dir(target); + int dir=status_get_dir(target); if(dir>=0 && dir<8){ dx=-dirx[dir]; dy=-diry[dir]; @@ -1509,7 +1510,7 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) if(su){ skill_unit_move_unit_group(su->group,target->m,dx,dy); }else{ -// struct status_change *sc_data=battle_get_sc_data(target); +// struct status_change *sc_data=status_get_sc_data(target); if(moveblock) map_delblock(target); target->x=nx; target->y=ny; @@ -1571,7 +1572,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds nullpo_retr(0, dsrc); nullpo_retr(0, bl); - sc_data = battle_get_sc_data(bl); + sc_data = status_get_sc_data(bl); //何もしない判定ここから if(dsrc->m != bl->m) //?象が同じマップにいなければ何もしない @@ -1635,7 +1636,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds //マジックロッド?理ここまで if(src->type==BL_PET) { // [Valaris] - dmg.damage=battle_attr_fix(skilllv, skill_get_pl(skillid), battle_get_element(bl) ); + dmg.damage=battle_attr_fix(skilllv, skill_get_pl(skillid), status_get_element(bl) ); dmg.damage2=0; } @@ -1661,12 +1662,12 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds nullpo_retr(0, sd); //連打掌(MO_CHAINCOMBO)ここから if(skillid == MO_CHAINCOMBO) { - int delay = 1000 - 4 * battle_get_agi(src) - 2 * battle_get_dex(src); //基本ディレイの計算 - if(damage < battle_get_hp(bl)) { //ダメ?ジが?象のHPより小さい場合 + int delay = 1000 - 4 * status_get_agi(src) - 2 * status_get_dex(src); //基本ディレイの計算 + if(damage < status_get_hp(bl)) { //ダメ?ジが?象のHPより小さい場合 if(pc_checkskill(sd, MO_COMBOFINISH) > 0 && sd->spiritball > 0) //猛龍拳(MO_COMBOFINISH)取得&?球保持時は+300ms delay += 300 * battle_config.combo_delay_rate /100; //追加ディレイをconfにより調整 - skill_status_change_start(src,SC_COMBO,MO_CHAINCOMBO,skilllv,0,0,delay,0); //コンボ?態に + status_change_start(src,SC_COMBO,MO_CHAINCOMBO,skilllv,0,0,delay,0); //コンボ?態に } sd->attackabletime = sd->canmove_tick = tick + delay; clif_combo_delay(src,delay); //コンボディレイパケットの送信 @@ -1674,8 +1675,8 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds //連打掌(MO_CHAINCOMBO)ここまで //猛龍拳(MO_COMBOFINISH)ここから else if(skillid == MO_COMBOFINISH) { - int delay = 700 - 4 * battle_get_agi(src) - 2 * battle_get_dex(src); - if(damage < battle_get_hp(bl)) { + int delay = 700 - 4 * status_get_agi(src) - 2 * status_get_dex(src); + if(damage < status_get_hp(bl)) { //阿修羅覇凰拳(MO_EXTREMITYFIST)取得&?球4個保持&爆裂波動(MO_EXPLOSIONSPIRITS)?態時は+300ms //伏虎拳(CH_TIGERFIST)取得時も+300ms if((pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball >= 4 && sd->sc_data[SC_EXPLOSIONSPIRITS].timer != -1) || @@ -1683,7 +1684,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds (pc_checkskill(sd, CH_CHAINCRUSH) > 0 && sd->spiritball > 1)) delay += 300 * battle_config.combo_delay_rate /100; //追加ディレイをconfにより調整 - skill_status_change_start(src,SC_COMBO,MO_COMBOFINISH,skilllv,0,0,delay,0); //コンボ?態に + status_change_start(src,SC_COMBO,MO_COMBOFINISH,skilllv,0,0,delay,0); //コンボ?態に } sd->attackabletime = sd->canmove_tick = tick + delay; clif_combo_delay(src,delay); //コンボディレイパケットの送信 @@ -1691,12 +1692,12 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds //猛龍拳(MO_COMBOFINISH)ここまで //伏虎拳(CH_TIGERFIST)ここから else if(skillid == CH_TIGERFIST) { - int delay = 1000 - 4 * battle_get_agi(src) - 2 * battle_get_dex(src); - if(damage < battle_get_hp(bl)) { + int delay = 1000 - 4 * status_get_agi(src) - 2 * status_get_dex(src); + if(damage < status_get_hp(bl)) { if(pc_checkskill(sd, CH_CHAINCRUSH) > 0) //連柱崩?(CH_CHAINCRUSH)取得時は+300ms delay += 300 * battle_config.combo_delay_rate /100; //追加ディレイをconfにより調整 - skill_status_change_start(src,SC_COMBO,CH_TIGERFIST,skilllv,0,0,delay,0); //コンボ?態に + status_change_start(src,SC_COMBO,CH_TIGERFIST,skilllv,0,0,delay,0); //コンボ?態に } sd->attackabletime = sd->canmove_tick = tick + delay; clif_combo_delay(src,delay); //コンボディレイパケットの送信 @@ -1704,13 +1705,13 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds //伏虎拳(CH_TIGERFIST)ここまで //連柱崩?(CH_CHAINCRUSH)ここから else if(skillid == CH_CHAINCRUSH) { - int delay = 1000 - 4 * battle_get_agi(src) - 2 * battle_get_dex(src); - if(damage < battle_get_hp(bl)) { + int delay = 1000 - 4 * status_get_agi(src) - 2 * status_get_dex(src); + if(damage < status_get_hp(bl)) { //阿修羅覇凰拳(MO_EXTREMITYFIST)取得&?球4個保持&爆裂波動(MO_EXPLOSIONSPIRITS)?態時は+300ms if(pc_checkskill(sd, MO_EXTREMITYFIST) > 0 && sd->spiritball >= 4 && sd->sc_data[SC_EXPLOSIONSPIRITS].timer != -1) delay += 300 * battle_config.combo_delay_rate /100; //追加ディレイをconfにより調整 - skill_status_change_start(src,SC_COMBO,CH_CHAINCRUSH,skilllv,0,0,delay,0); //コンボ?態に + status_change_start(src,SC_COMBO,CH_CHAINCRUSH,skilllv,0,0,delay,0); //コンボ?態に } sd->attackabletime = sd->canmove_tick = tick + delay; clif_combo_delay(src,delay); //コンボディレイパケットの送信 @@ -1790,8 +1791,8 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds /* ?際にダメ?ジ?理を行う */ if(skillid || flag) battle_damage(src,bl,damage,0); - if(skillid == RG_INTIMIDATE && damage > 0 && !(battle_get_mode(bl)&0x20) && !map[src->m].flag.gvg ) { - int s_lv = battle_get_lv(src),t_lv = battle_get_lv(bl); + if(skillid == RG_INTIMIDATE && damage > 0 && !(status_get_mode(bl)&0x20) && !map[src->m].flag.gvg ) { + int s_lv = status_get_lv(src),t_lv = status_get_lv(bl); int rate = 50 + skilllv * 5; rate = rate + (s_lv - t_lv); if(rand()%100 < rate) @@ -1875,7 +1876,7 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds if(attack_type&BF_WEAPON && sc_data && sc_data[SC_AUTOCOUNTER].timer != -1 && sc_data[SC_AUTOCOUNTER].val4 > 0) { if(sc_data[SC_AUTOCOUNTER].val3 == dsrc->id) battle_weapon_attack(bl,dsrc,tick,0x8000|sc_data[SC_AUTOCOUNTER].val1); - skill_status_change_end(bl,SC_AUTOCOUNTER,-1); + status_change_end(bl,SC_AUTOCOUNTER,-1); } map_freeblock_unlock(); @@ -2303,7 +2304,7 @@ int skill_cleartimerskill(struct block_list *src) int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int skillid,int skilllv,unsigned int tick,int flag ) { struct map_session_data *sd = NULL; - struct status_change *sc_data = battle_get_sc_data(src); + struct status_change *sc_data = status_get_sc_data(src); int i; if(skillid > 0 && skilllv <= 0) return 0; @@ -2391,9 +2392,9 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case PA_PRESSURE: /* プレッシャ? */ skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); if (rand()%100 < 50) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(PA_PRESSURE,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(PA_PRESSURE,skilllv),0); else - skill_status_change_start(bl,SC_BLEEDING,skilllv,0,0,0,skill_get_time2(PA_PRESSURE,skilllv),0); + status_change_start(bl,SC_BLEEDING,skilllv,0,0,0,skill_get_time2(PA_PRESSURE,skilllv),0); if (bl->type == BL_PC) { int sp; struct map_session_data *tsd = (struct map_session_data *)bl; @@ -2410,10 +2411,10 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s break; case MO_INVESTIGATE: /* ?勁 */ { - struct status_change *sc_data = battle_get_sc_data(src); + struct status_change *sc_data = status_get_sc_data(src); skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); if(sc_data && sc_data[SC_BLADESTOP].timer != -1) - skill_status_change_end(src,SC_BLADESTOP,-1); + status_change_end(src,SC_BLADESTOP,-1); } break; case SN_FALCONASSAULT: /* ファルコンアサルト */ @@ -2437,12 +2438,12 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s break; case RG_BACKSTAP: /* バックスタブ */ { - int dir = map_calc_dir(src,bl->x,bl->y),t_dir = battle_get_dir(bl); + int dir = map_calc_dir(src,bl->x,bl->y),t_dir = status_get_dir(bl); int dist = distance(src->x,src->y,bl->x,bl->y); if((dist > 0 && !map_check_dir(dir,t_dir)) || bl->type == BL_SKILL) { - struct status_change *sc_data = battle_get_sc_data(src); + struct status_change *sc_data = status_get_sc_data(src); if(sc_data && sc_data[SC_HIDING].timer != -1) - skill_status_change_end(src, SC_HIDING, -1); // ハイディング解除 + status_change_end(src, SC_HIDING, -1); // ハイディング解除 skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); dir = dir < 4 ? dir+4 : dir-4; // change direction [Celest] if (bl->type == BL_PC) @@ -2466,7 +2467,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s break; case MO_FINGEROFFENSIVE: /* 指? */ { - struct status_change *sc_data = battle_get_sc_data(src); + struct status_change *sc_data = status_get_sc_data(src); if(!battle_config.finger_offensive_type) skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); @@ -2479,15 +2480,15 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s } } if(sc_data && sc_data[SC_BLADESTOP].timer != -1) - skill_status_change_end(src,SC_BLADESTOP,-1); + status_change_end(src,SC_BLADESTOP,-1); } break; case MO_CHAINCOMBO: /* 連打掌 */ { - struct status_change *sc_data = battle_get_sc_data(src); + struct status_change *sc_data = status_get_sc_data(src); skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); if(sc_data && sc_data[SC_BLADESTOP].timer != -1) - skill_status_change_end(src,SC_BLADESTOP,-1); + status_change_end(src,SC_BLADESTOP,-1); } break; case MO_COMBOFINISH: /* 猛龍拳 */ @@ -2498,7 +2499,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s break; case MO_EXTREMITYFIST: /* 阿修羅覇鳳拳 */ { - struct status_change *sc_data = battle_get_sc_data(src); + struct status_change *sc_data = status_get_sc_data(src); if(sd) { struct walkpath_data wpd; @@ -2530,13 +2531,13 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s if(sd->canact_tick < sd->canmove_tick) sd->canact_tick = sd->canmove_tick; pc_movepos(sd,sd->to_x,sd->to_y); - skill_status_change_end(&sd->bl,SC_COMBO,-1); + status_change_end(&sd->bl,SC_COMBO,-1); } else skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); - skill_status_change_end(src, SC_EXPLOSIONSPIRITS, -1); + status_change_end(src, SC_EXPLOSIONSPIRITS, -1); if(sc_data && sc_data[SC_BLADESTOP].timer != -1) - skill_status_change_end(src,SC_BLADESTOP,-1); + status_change_end(src,SC_BLADESTOP,-1); } break; /* 武器系範?攻?スキル */ @@ -2559,9 +2560,9 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick, 0x0500|dist ); if (bl->type == BL_MOB && skillid == AS_GRIMTOOTH) { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); if (sc_data && sc_data[SC_SLOWDOWN].timer == -1) - skill_status_change_start(bl,SC_SLOWDOWN,0,0,0,0,1000,0); + status_change_start(bl,SC_SLOWDOWN,0,0,0,0,1000,0); } } }else{ @@ -2591,7 +2592,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s src,skillid,skilllv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); if (skillid == SM_MAGNUM) // fire element for 10 seconds - skill_status_change_start(src,SC_FLAMELAUNCHER,0,0,0,0,10000,0); + status_change_start(src,SC_FLAMELAUNCHER,0,0,0,0,10000,0); } break; @@ -2643,7 +2644,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case ALL_RESURRECTION: /* リザレクション */ case PR_TURNUNDEAD: /* タ?ンアンデッド */ - if(bl->type != BL_PC && battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))) + if(bl->type != BL_PC && battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); else { map_freeblock_unlock(); @@ -2671,10 +2672,10 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case MG_FROSTDIVER: /* フロストダイバー */ { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); int sc_def_mdef, rate, damage; - sc_def_mdef = 100 - (3 + battle_get_mdef(bl) + battle_get_luk(bl)/3); - rate = (skilllv*3+35)*sc_def_mdef/100-(battle_get_int(bl)+battle_get_luk(bl))/15; + sc_def_mdef = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3); + rate = (skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15; rate = rate<=5?5:rate; if (sc_data && sc_data[SC_FREEZE].timer != -1) { skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); @@ -2683,8 +2684,8 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s break; } damage = skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); - if (battle_get_hp(bl) > 0 && damage > 0 && rand()%100 < rate) { - skill_status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + if (status_get_hp(bl) > 0 && damage > 0 && rand()%100 < rate) { + status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); } else if (sd) { clif_skill_fail(sd,skillid,0,0); } @@ -2694,11 +2695,11 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case WZ_WATERBALL: /* ウォ?タ?ボ?ル */ skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); if(skilllv>1) - skill_status_change_start(src,SC_WATERBALL,skilllv,bl->id,0,0,0,0); + status_change_start(src,SC_WATERBALL,skilllv,bl->id,0,0,0,0); break; case PR_BENEDICTIO: /* 聖?降福 */ - if(battle_get_race(bl)==1 || battle_get_race(bl)==6) + if(status_get_race(bl)==1 || status_get_race(bl)==6) skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); break; @@ -2779,7 +2780,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case WZ_SIGHTRASHER: clif_skill_nodamage(src,bl,skillid,skilllv,1); skill_castend_pos2(src,bl->x,bl->y,skillid,skilllv,tick,0); - skill_status_change_end(src,SC_SIGHT,-1); + status_change_end(src,SC_SIGHT,-1); break; /* その他 */ @@ -2838,7 +2839,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s sd->status.sp = 0; clif_updatestatus(sd,SP_SP); } - skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0, (skilllv < 5 ? 10000: 15000),0 ); + status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0, (skilllv < 5 ? 10000: 15000),0 ); } break; @@ -2858,7 +2859,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s struct mob_data *md; if((md=(struct mob_data *)src)){ skill_area_temp[1]=bl->id; - skill_area_temp[2]=battle_get_hp(src); + skill_area_temp[2]=status_get_hp(src); clif_skill_nodamage(src,src,NPC_SELFDESTRUCTION,-1,1); map_foreachinarea(skill_area_sub, bl->m,bl->x-5,bl->y-5,bl->x+5,bl->y+5,0, @@ -2918,7 +2919,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s } if(sc_data) { if (sc_data[SC_MAGICPOWER].timer != -1 && skillid != HW_MAGICPOWER) //マジックパワ?の?果終了 - skill_status_change_end(src,SC_MAGICPOWER,-1); + status_change_end(src,SC_MAGICPOWER,-1); } map_freeblock_unlock(); @@ -2954,11 +2955,11 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int else if(src->type==BL_MOB) md=(struct mob_data *)src; - sc_dex=battle_get_mdef(bl); - sc_luk=battle_get_luk(bl); - sc_def_vit = 100 - (3 + battle_get_vit(bl) + battle_get_luk(bl)/3); - //sc_def_vit = 100 - (3 + battle_get_vit(bl) + battle_get_luk(bl)/3); - sc_def_mdef = 100 - (3 + battle_get_mdef(bl) + battle_get_luk(bl)/3); + sc_dex=status_get_mdef(bl); + sc_luk=status_get_luk(bl); + sc_def_vit = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3); + //sc_def_vit = 100 - (3 + status_get_vit(bl) + status_get_luk(bl)/3); + sc_def_mdef = 100 - (3 + status_get_mdef(bl) + status_get_luk(bl)/3); if(bl->type==BL_PC){ nullpo_retr(1, dstsd=(struct map_session_data *)bl); @@ -2980,7 +2981,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int return 1; if(dstsd && pc_isdead(dstsd) && skillid != ALL_RESURRECTION) return 1; - if(battle_get_class(bl) == 1288) + if(status_get_class(bl) == 1288) return 1; if (skillnotok(skillid, (struct map_session_data *)bl)) // [MouseJstr] return 0; @@ -3067,20 +3068,20 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case AL_DECAGI: /* 速度減少 */ if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - if( rand()%100 < (50+skilllv*3+(battle_get_lv(src)+battle_get_int(src)/5)-sc_def_mdef) ) { + if( rand()%100 < (50+skilllv*3+(status_get_lv(src)+status_get_int(src)/5)-sc_def_mdef) ) { clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0); } break; case AL_CRUCIS: if(flag&1) { - int race = battle_get_race(bl),ele = battle_get_elem_type(bl); + int race = status_get_race(bl),ele = status_get_elem_type(bl); if(battle_check_target(src,bl,BCT_ENEMY) && (race == 6 || battle_check_undead(race,ele))) { - int slv=battle_get_lv(src),tlv=battle_get_lv(bl),rate; + int slv=status_get_lv(src),tlv=status_get_lv(bl),rate; rate = 25 + skilllv*2 + slv - tlv; if(rand()%100 < rate) - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,0,0); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,0,0); } } else { @@ -3095,14 +3096,14 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case PR_LEXDIVINA: /* レックスディビ?ナ */ { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); clif_skill_nodamage(src,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; if(sc_data && sc_data[SC_DIVINA].timer != -1) - skill_status_change_end(bl,SC_DIVINA,-1); + status_change_end(bl,SC_DIVINA,-1); else if( rand()%100 < sc_def_vit ) { - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0); } } break; @@ -3141,7 +3142,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; if(dstsd) pc_heal(dstsd,dstsd->status.max_hp,dstsd->status.max_sp); - if(dstmd) dstmd->hp=battle_get_max_hp(&dstmd->bl); + if(dstmd) dstmd->hp=status_get_max_hp(&dstmd->bl); break; case SA_SUMMONMONSTER: clif_skill_nodamage(src,bl,skillid,skilllv,1); @@ -3180,7 +3181,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; case SA_FORTUNE: clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(sd) pc_getzeny(sd,battle_get_lv(bl)*100); + if(sd) pc_getzeny(sd,status_get_lv(bl)*100); break; case SA_TAMINGMONSTER: clif_skill_nodamage(src,bl,skillid,skilllv,1); @@ -3204,15 +3205,15 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ){ clif_skill_nodamage(src,bl,skillid,skilllv,1); }else{ - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); clif_skill_nodamage(src,bl,skillid,skilllv,1); } break; case CG_MARIONETTE: /* マリオネットコントロ?ル */ if(sd && dstsd){ - struct status_change *sc_data = battle_get_sc_data(src); - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(src); + struct status_change *tsc_data = status_get_sc_data(bl); int sc = SkillStatusChangeTable[skillid]; int sc2 = SC_MARIONETTE2; @@ -3226,13 +3227,13 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } if(sc_data && tsc_data){ if(sc_data[sc].timer == -1 && tsc_data[sc2].timer == -1) { - skill_status_change_start (src,sc,skilllv,0,bl->id,0,skill_get_time(skillid,skilllv),0); - skill_status_change_start (bl,sc2,skilllv,0,src->id,0,skill_get_time(skillid,skilllv),0); + status_change_start (src,sc,skilllv,0,bl->id,0,skill_get_time(skillid,skilllv),0); + status_change_start (bl,sc2,skilllv,0,src->id,0,skill_get_time(skillid,skilllv),0); } else if (sc_data[sc].timer != -1 && tsc_data[sc2].timer != -1 && sc_data[sc].val3 == bl->id && tsc_data[sc2].val3 == src->id) { - skill_status_change_end(src, sc, -1); - skill_status_change_end(bl, sc2, -1); + status_change_end(src, sc, -1); + status_change_end(bl, sc2, -1); } else { clif_skill_fail(sd,skillid,0,0); @@ -3273,7 +3274,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; } else { - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); clif_skill_nodamage(src,bl,skillid,skilllv,1); } break; @@ -3284,13 +3285,13 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; if(bl->type==BL_MOB) break; - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case PR_KYRIE: /* キリエエレイソン */ clif_skill_nodamage(bl,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case KN_AUTOCOUNTER: /* オ?トカウンタ? */ case KN_TWOHANDQUICKEN: /* ツ?ハンドクイッケン */ @@ -3319,24 +3320,24 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case ASC_EDP: // [Celest] case CG_MOONLIT: /* 月明りの泉に落ちる花びら */ clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case SM_ENDURE: /* インデュア */ clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); - skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,10000,0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,10000,0 ); break; case SM_AUTOBERSERK: // Celest { - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *tsc_data = status_get_sc_data(bl); int sc=SkillStatusChangeTable[skillid]; clif_skill_nodamage(src,bl,skillid,skilllv,1); if( tsc_data ){ if( tsc_data[sc].timer==-1 ) - skill_status_change_start(bl,sc,skilllv,0,0,0,0,0); + status_change_start(bl,sc,skilllv,0,0,0,0,0); else - skill_status_change_end(bl, sc, -1); + status_change_end(bl, sc, -1); } } break; @@ -3353,17 +3354,17 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } } clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case LK_TENSIONRELAX: /* テンションリラックス */ clif_skill_nodamage(src,bl,skillid,skilllv,1); pc_setsit(sd); clif_sitting(sd); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case LK_BERSERK: /* バ?サ?ク */ clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); //sd->status.hp = sd->status.max_hp * 3; break; case MC_CHANGECART: @@ -3373,25 +3374,25 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int { int range = 1; clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); - map_foreachinarea( skill_status_change_timer_sub, + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + map_foreachinarea( status_change_timer_sub, src->m, src->x-range, src->y-range, src->x+range,src->y+range,0, src,SkillStatusChangeTable[skillid],tick); } break; case SM_PROVOKE: /* プロボック */ { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); /* MVPmobと不死には?かない */ - if((bl->type==BL_MOB && battle_get_mode(bl)&0x20) || battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))) //不死には?かない + if((bl->type==BL_MOB && status_get_mode(bl)&0x20) || battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) //不死には?かない { map_freeblock_unlock(); return 1; } clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); if(dstmd && dstmd->skilltimer!=-1 && dstmd->state.skillcastcancel) // 詠唱妨害 skill_castcancel(bl,0); @@ -3401,17 +3402,17 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(sc_data){ if(sc_data[SC_FREEZE].timer!=-1) - skill_status_change_end(bl,SC_FREEZE,-1); + status_change_end(bl,SC_FREEZE,-1); if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0) - skill_status_change_end(bl,SC_STONE,-1); + status_change_end(bl,SC_STONE,-1); if(sc_data[SC_SLEEP].timer!=-1) - skill_status_change_end(bl,SC_SLEEP,-1); + status_change_end(bl,SC_SLEEP,-1); } if(dstmd) { int range = skill_get_range(skillid,skilllv); if(range < 0) - range = battle_get_range(src) - (range + 1); + range = status_get_range(src) - (range + 1); dstmd->state.provoke_flag = src->id; mob_target(dstmd,src,range); } @@ -3449,7 +3450,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } clif_skill_nodamage(src,bl,skillid,skilllv,1); clif_devotion(sd,bl->id); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],src->id,1,0,0,1000*(15+15*skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],src->id,1,0,0,1000*(15+15*skilllv),0 ); } else clif_skill_fail(sd,skillid,0,0); break; @@ -3468,7 +3469,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; case MO_BLADESTOP: // 白刃取り clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case MO_ABSORBSPIRITS: // ?奪 i=0; @@ -3536,7 +3537,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_weapon_damage ) break; if( rand()%100 < (20+ 10*skilllv)*sc_def_vit/100 ) { - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); } break; @@ -3552,7 +3553,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int src,skillid,skilllv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); } - skill_status_change_end(src, SC_HIDING, -1); // ハイディング解除 + status_change_end(src, SC_HIDING, -1); // ハイディング解除 break; case KN_BRANDISHSPEAR: /*ブランディッシュスピア*/ @@ -3615,7 +3616,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int clif_skill_nodamage(bl,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0); } else{ /* パ?ティ全?への?理 */ @@ -3631,7 +3632,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(sd == NULL || sd->status.party_id==0 || (flag&1) ){ /* 個別の?理 */ clif_skill_nodamage(bl,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,(src == bl)? 1:0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,(src == bl)? 1:0,0,0,skill_get_time(skillid,skilllv),0); } else{ /* パ?ティ全?への?理 */ @@ -3648,60 +3649,60 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case CR_DEFENDER: /* ディフェンダ? */ case CR_AUTOGUARD: /* オ?トガ?ド */ { - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *tsc_data = status_get_sc_data(bl); int sc=SkillStatusChangeTable[skillid]; clif_skill_nodamage(src,bl,skillid,skilllv,1); if( tsc_data ){ if( tsc_data[sc].timer==-1 ) /* 付加する */ - skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); else /* 解除する */ - skill_status_change_end(bl, sc, -1); + status_change_end(bl, sc, -1); } } break; case TF_HIDING: /* ハイディング */ { - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *tsc_data = status_get_sc_data(bl); int sc=SkillStatusChangeTable[skillid]; clif_skill_nodamage(src,bl,skillid,-1,1); if(tsc_data && tsc_data[sc].timer!=-1 ) /* 解除する */ - skill_status_change_end(bl, sc, -1); + status_change_end(bl, sc, -1); else /* 付加する */ - skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); } break; case AS_CLOAKING: /* クロ?キング */ { - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *tsc_data = status_get_sc_data(bl); int sc=SkillStatusChangeTable[skillid]; clif_skill_nodamage(src,bl,skillid,skilllv,1); if(tsc_data && tsc_data[sc].timer!=-1 ) /* 解除する */ - skill_status_change_end(bl, sc, -1); + status_change_end(bl, sc, -1); else /* 付加する */ - skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); //skill_check_cloaking(bl); } break; case ST_CHASEWALK: /* ハイディング */ { - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *tsc_data = status_get_sc_data(bl); int sc=SkillStatusChangeTable[skillid]; clif_skill_nodamage(src,bl,skillid,-1,1); if(tsc_data && tsc_data[sc].timer!=-1 ) /* 解除する */ - skill_status_change_end(bl, sc, -1); + status_change_end(bl, sc, -1); else /* 付加する */ - skill_status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,sc,skilllv,0,0,0,skill_get_time(skillid,skilllv),0); } break; @@ -3732,20 +3733,20 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case HP_BASILICA: /* バジリカ */ { // cancel Basilica if already in effect - struct status_change *sc_data = battle_get_sc_data(src); + struct status_change *sc_data = status_get_sc_data(src); if(sc_data && sc_data[SC_BASILICA].timer != -1){ struct skill_unit *su; if ((su = (struct skill_unit *)sc_data[SC_BASILICA].val4)) { struct skill_unit_group *sg; if ((sg = su->group) && sg->src_id == sd->bl.id) { - skill_status_change_end(src,SC_BASILICA,-1); + status_change_end(src,SC_BASILICA,-1); skill_delunitgroup (sg); break; } } } else { // otherwise allow casting - skill_status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0); skill_clear_unitgroup(src); clif_skill_nodamage(src,bl,skillid,skilllv,1); skill_unitsetting(src,skillid,skilllv,src->x,src->y,0); @@ -3757,12 +3758,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int skill_clear_unitgroup(src); clif_skill_nodamage(src,bl,skillid,skilllv,1); skill_unitsetting(src,skillid,skilllv,src->x,src->y,0); - skill_status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,BCT_SELF,skill_get_time(skillid,skilllv),0); + status_change_start(src,SkillStatusChangeTable[skillid],skilllv,0,0,BCT_SELF,skill_get_time(skillid,skilllv),0); break; case BD_ADAPTATION: /* アドリブ */ { - struct status_change *sc_data = battle_get_sc_data(src); + struct status_change *sc_data = status_get_sc_data(src); if(sc_data && sc_data[SC_DANCING].timer!=-1){ clif_skill_nodamage(src,bl,skillid,skilllv,1); skill_stop_dancing(src,0); @@ -3790,7 +3791,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(pc_steal_coin(sd,bl)) { int range = skill_get_range(skillid,skilllv); if(range < 0) - range = battle_get_range(src) - (range + 1); + range = status_get_range(src) - (range + 1); clif_skill_nodamage(src,bl,skillid,skilllv,1); mob_target((struct mob_data *)bl,src,range); } @@ -3801,10 +3802,10 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case MG_STONECURSE: /* スト?ンカ?ス */ { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); // Level 6-10 doesn't consume a red gem if it fails [celest] int i, gem_flag = 1; - if (bl->type==BL_MOB && battle_get_mode(bl)&0x20) { + if (bl->type==BL_MOB && status_get_mode(bl)&0x20) { clif_skill_fail(sd,sd->skillid,0,0); break; } @@ -3812,12 +3813,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; if (sc_data && sc_data[SC_STONE].timer != -1) { - skill_status_change_end(bl,SC_STONE,-1); + status_change_end(bl,SC_STONE,-1); if (sd) clif_skill_fail(sd,skillid,0,0); } - else if( rand()%100 < skilllv*4+20 && !battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))) - skill_status_change_start(bl,SC_STONE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + else if( rand()%100 < skilllv*4+20 && !battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) + status_change_start(bl,SC_STONE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); else if(sd) { if (skilllv > 5) gem_flag = 0; clif_skill_fail(sd,skillid,0,0); @@ -3843,18 +3844,18 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int clif_skill_nodamage(src,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - skill_status_change_end(bl, SC_SILENCE , -1 ); - skill_status_change_end(bl, SC_BLIND , -1 ); - skill_status_change_end(bl, SC_CONFUSION, -1 ); - if( battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl)) ){//アンデッドなら暗闇?果 - skill_status_change_start(bl, SC_CONFUSION,1,0,0,0,6000,0); + status_change_end(bl, SC_SILENCE , -1 ); + status_change_end(bl, SC_BLIND , -1 ); + status_change_end(bl, SC_CONFUSION, -1 ); + if( battle_check_undead(status_get_race(bl),status_get_elem_type(bl)) ){//アンデッドなら暗闇?果 + status_change_start(bl, SC_CONFUSION,1,0,0,0,6000,0); } break; case TF_DETOXIFY: /* 解毒 */ clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_end(bl, SC_POISON , -1 ); - skill_status_change_end(bl, SC_DPOISON , -1 ); + status_change_end(bl, SC_POISON , -1 ); + status_change_end(bl, SC_DPOISON , -1 ); break; case PR_STRECOVERY: /* リカバリ? */ @@ -3862,16 +3863,16 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int clif_skill_nodamage(src,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - skill_status_change_end(bl, SC_FREEZE , -1 ); - skill_status_change_end(bl, SC_STONE , -1 ); - skill_status_change_end(bl, SC_SLEEP , -1 ); - skill_status_change_end(bl, SC_STAN , -1 ); - if( battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl)) ){//アンデッドなら暗闇?果 + status_change_end(bl, SC_FREEZE , -1 ); + status_change_end(bl, SC_STONE , -1 ); + status_change_end(bl, SC_SLEEP , -1 ); + status_change_end(bl, SC_STAN , -1 ); + if( battle_check_undead(status_get_race(bl),status_get_elem_type(bl)) ){//アンデッドなら暗闇?果 int blind_time; - //blind_time=30-battle_get_vit(bl)/10-battle_get_int/15; - blind_time=30*(100-(battle_get_int(bl)+battle_get_vit(bl))/2)/100; - if(rand()%100 < (100-(battle_get_int(bl)/2+battle_get_vit(bl)/3+battle_get_luk(bl)/10))) - skill_status_change_start(bl, SC_BLIND,1,0,0,0,blind_time,0); + //blind_time=30-status_get_vit(bl)/10-status_get_int/15; + blind_time=30*(100-(status_get_int(bl)+status_get_vit(bl))/2)/100; + if(rand()%100 < (100-(status_get_int(bl)/2+status_get_vit(bl)/3+status_get_luk(bl)/10))) + status_change_start(bl, SC_BLIND,1,0,0,0,blind_time,0); } if(dstmd){ dstmd->attacked_id=0; @@ -3975,7 +3976,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case RG_STRIPHELM: /* ストリップヘルム */ case ST_FULLSTRIP: // Celest { - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *tsc_data = status_get_sc_data(bl); int scid, equip, strip_fix, strip_num = 0; scid = SkillStatusChangeTable[skillid]; switch (skillid) { @@ -4002,7 +4003,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if (tsc_data && tsc_data[scid].timer != -1) break; - strip_fix = battle_get_dex(src) - battle_get_dex(bl); + strip_fix = status_get_dex(src) - status_get_dex(bl); if(strip_fix < 0) strip_fix=0; strip_per = 5+2*skilllv+strip_fix/5; @@ -4022,7 +4023,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } clif_skill_nodamage(src,bl,skillid,skilllv,1); strip_time = skill_get_time(skillid,skilllv)+strip_fix/2; - skill_status_change_start(bl,scid,skilllv,0,0,0,strip_time,0 ); + status_change_start(bl,scid,skilllv,0,0,0,strip_time,0 ); break; } @@ -4055,7 +4056,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int pc_delitem(sd,i,skill_db[skillid].amount[x],0); sd->state.potionpitcher_flag = 0; if(sd->potion_per_hp > 0 || sd->potion_per_sp > 0) { - hp = battle_get_max_hp(bl) * sd->potion_per_hp / 100; + hp = status_get_max_hp(bl) * sd->potion_per_hp / 100; hp = hp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)/100; if(dstsd) { sp = dstsd->status.max_sp * sd->potion_per_sp / 100; @@ -4065,13 +4066,13 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int else { if(sd->potion_hp > 0) { hp = sd->potion_hp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)/100; - hp = hp * (100 + (battle_get_vit(bl)<<1)) / 100; + hp = hp * (100 + (status_get_vit(bl)<<1)) / 100; if(dstsd) hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10) / 100; } if(sd->potion_sp > 0) { sp = sd->potion_sp * (100 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)/100; - sp = sp * (100 + (battle_get_int(bl)<<1)) / 100; + sp = sp * (100 + (status_get_int(bl)<<1)) / 100; if(dstsd) sp = sp * (100 + pc_checkskill(dstsd,MG_SRECOVERY)*10) / 100; } @@ -4079,7 +4080,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } else { hp = (1 + rand()%400) * (100 + skilllv*10) / 100; - hp = hp * (100 + (battle_get_vit(bl)<<1)) / 100; + hp = hp * (100 + (status_get_vit(bl)<<1)) / 100; if(dstsd) hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10) / 100; } @@ -4101,11 +4102,11 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case AM_CP_HELM: { int scid = SC_STRIPWEAPON + (skillid - AM_CP_WEAPON); - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *tsc_data = status_get_sc_data(bl); clif_skill_nodamage(src,bl,skillid,skilllv,1); if(tsc_data && tsc_data[scid].timer != -1) - skill_status_change_end(bl, SC_STRIPWEAPON, -1 ); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_end(bl, SC_STRIPWEAPON, -1 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); } break; @@ -4121,7 +4122,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int || i==SC_STRIPHELM || i==SC_CP_WEAPON || i==SC_CP_SHIELD || i==SC_CP_ARMOR || i==SC_CP_HELM || i==SC_COMBO) continue; - skill_status_change_end(bl,i,-1); + status_change_end(bl,i,-1); } } break; @@ -4150,7 +4151,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; case SA_SPELLBREAKER: // スペルブレイカ? { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); int sp; if(sc_data && sc_data[SC_MAGICROD].timer != -1) { if(dstsd) { @@ -4215,7 +4216,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case SA_MAGICROD: if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case SA_AUTOSPELL: /* オ?トスペル */ clif_skill_nodamage(src,bl,skillid,skilllv,1); @@ -4246,7 +4247,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int maxlv = 3; } if(spellid > 0) - skill_status_change_start(src,SC_AUTOSPELL,skilllv,spellid,maxlv,0, + status_change_start(src,SC_AUTOSPELL,skilllv,spellid,maxlv,0, skill_get_time(SA_AUTOSPELL,skilllv),0); } break; @@ -4281,7 +4282,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int clif_skill_nodamage(src,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case NPC_KEEPING: @@ -4289,7 +4290,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int { int skill_time = skill_get_time(skillid,skilllv); clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_time,0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_time,0 ); if (src->type == BL_MOB) mob_changestate((struct mob_data *)src,MS_DELAY,skill_time); else if (src->type == BL_PC) @@ -4299,15 +4300,15 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case NPC_DARKBLESSING: { - int sc_def = 100 - battle_get_mdef(bl); + int sc_def = 100 - status_get_mdef(bl); clif_skill_nodamage(src,bl,skillid,skilllv,1); if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; - if(battle_get_elem_type(bl) == 7 || battle_get_race(bl) == 6) + if(status_get_elem_type(bl) == 7 || status_get_race(bl) == 6) break; if(rand()%100 < sc_def*(50+skilllv*5)/100) { if(dstsd) { - int hp = battle_get_hp(bl)-1; + int hp = status_get_hp(bl)-1; pc_heal(dstsd,-hp,0); } else if(dstmd) @@ -4318,7 +4319,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case NPC_SELFDESTRUCTION: /* 自爆 */ case NPC_SELFDESTRUCTION2: /* 自爆2 */ - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,skillid,0,0,skill_get_time(skillid,skilllv),0); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,skillid,0,0,skill_get_time(skillid,skilllv),0); break; case NPC_LICK: clif_skill_nodamage(src,bl,skillid,skilllv,1); @@ -4327,7 +4328,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(dstsd) pc_heal(dstsd,0,-100); if(rand()%100 < (skilllv*5)*sc_def_vit/100) - skill_status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_STAN,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case NPC_SUICIDE: /* 自決 */ @@ -4470,7 +4471,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(su->group->unit_id == 0x91 && su->group->val2){ struct block_list *target=map_id2bl(su->group->val2); if(target && (target->type == BL_PC || target->type == BL_MOB)) - skill_status_change_end(target,SC_ANKLE,-1); + status_change_end(target,SC_ANKLE,-1); } skill_delunit(su); } @@ -4506,25 +4507,25 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; case AS_SPLASHER: /* ベナムスプラッシャ? */ - if((double)battle_get_max_hp(bl)*2/3 < battle_get_hp(bl)) //HPが2/3以上?っていたら失敗 + if((double)status_get_max_hp(bl)*2/3 < status_get_hp(bl)) //HPが2/3以上?っていたら失敗 return 1; clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,skillid,src->id,skill_get_time(skillid,skilllv),1000,0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,skillid,src->id,skill_get_time(skillid,skilllv),1000,0 ); break; case PF_MINDBREAKER: /* プロボック */ { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); /* MVPmobと不死には?かない */ - if((bl->type==BL_MOB && battle_get_mode(bl)&0x20) || battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))) //不死には?かない + if((bl->type==BL_MOB && status_get_mode(bl)&0x20) || battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) //不死には?かない { map_freeblock_unlock(); return 1; } clif_skill_nodamage(src,bl,skillid,skilllv,1); - skill_status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); + status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); if(dstmd && dstmd->skilltimer!=-1 && dstmd->state.skillcastcancel) // 詠唱妨害 skill_castcancel(bl,0); @@ -4534,17 +4535,17 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(sc_data){ if(sc_data[SC_FREEZE].timer!=-1) - skill_status_change_end(bl,SC_FREEZE,-1); + status_change_end(bl,SC_FREEZE,-1); if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0) - skill_status_change_end(bl,SC_STONE,-1); + status_change_end(bl,SC_STONE,-1); if(sc_data[SC_SLEEP].timer!=-1) - skill_status_change_end(bl,SC_SLEEP,-1); + status_change_end(bl,SC_SLEEP,-1); } if(bl->type==BL_MOB) { int range = skill_get_range(skillid,skilllv); if(range < 0) - range = battle_get_range(src) - (range + 1); + range = status_get_range(src) - (range + 1); mob_target((struct mob_data *)bl,src,range); } } @@ -4594,7 +4595,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if (sd && flag&1) { struct block_list tbl; int hp = sd->potion_hp * (100 + pc_checkskill(sd,CR_SLIMPITCHER)*10 + pc_checkskill(sd,AM_POTIONPITCHER)*10 + pc_checkskill(sd,AM_LEARNINGPOTION)*5)/100; - hp = hp * (100 + (battle_get_vit(bl)<<1))/100; + hp = hp * (100 + (status_get_vit(bl)<<1))/100; if (dstsd) { hp = hp * (100 + pc_checkskill(dstsd,SM_RECOVERY)*10)/100; } @@ -4611,13 +4612,13 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case CR_FULLPROTECTION: { int i, skilltime; - struct status_change *tsc_data = battle_get_sc_data(bl); + struct status_change *tsc_data = status_get_sc_data(bl); clif_skill_nodamage(src,bl,skillid,skilllv,1); skilltime = skill_get_time(skillid,skilllv); for (i=0; i<4; i++) { if(tsc_data && tsc_data[SC_STRIPWEAPON + i].timer != -1) - skill_status_change_end(bl, SC_STRIPWEAPON + i, -1 ); - skill_status_change_start(bl,SC_CP_WEAPON + i,skilllv,0,0,0,skilltime,0 ); + status_change_end(bl, SC_STRIPWEAPON + i, -1 ); + status_change_start(bl,SC_CP_WEAPON + i,skilllv,0,0,0,skilltime,0 ); } } break; @@ -4638,9 +4639,9 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case ST_PRESERVE: if (sd){ if (sd->sc_count && sd->sc_data[SC_PRESERVE].timer != -1) - skill_status_change_end(src, SC_PRESERVE, -1 ); + status_change_end(src, SC_PRESERVE, -1 ); else - skill_status_change_start(src,SC_PRESERVE,skilllv,0,0,0,skill_get_time(skillid, skilllv),0 ); + status_change_start(src,SC_PRESERVE,skilllv,0,0,0,skill_get_time(skillid, skilllv),0 ); clif_skill_nodamage(src,src,skillid,skilllv,1); } break; @@ -4657,7 +4658,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } if(flag&1) { if (dstsd && dstsd->status.guild_id == sd->status.guild_id) { - skill_status_change_start(&dstsd->bl,SC_BATTLEORDERS,skilllv,0,0,0,0,0 ); + status_change_start(&dstsd->bl,SC_BATTLEORDERS,skilllv,0,0,0,0,0 ); } } else if (sd && sd->status.guild_id > 0 && (g = guild_search(sd->status.guild_id)) && @@ -4667,7 +4668,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int src->m,src->x-15,src->y-15,src->x+15,src->y+15,0, src,skillid,skilllv,tick, flag|BCT_ALL|1, skill_castend_nodamage_id); - skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 ); + status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 ); } } break; @@ -4682,7 +4683,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int } if(flag&1) { if (dstsd && dstsd->status.guild_id == sd->status.guild_id) { - skill_status_change_start(&dstsd->bl,SC_REGENERATION,skilllv,0,0,0,0,0 ); + status_change_start(&dstsd->bl,SC_REGENERATION,skilllv,0,0,0,0,0 ); } } else if (sd && sd->status.guild_id > 0 && (g = guild_search(sd->status.guild_id)) && @@ -4692,7 +4693,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int src->m,src->x-15,src->y-15,src->x+15,src->y+15,0, src,skillid,skilllv,tick, flag|BCT_ALL|1, skill_castend_nodamage_id); - skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 ); + status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 ); } } break; @@ -4722,7 +4723,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int src->m,src->x-15,src->y-15,src->x+15,src->y+15,0, src,skillid,skilllv,tick, flag|BCT_ALL|1, skill_castend_nodamage_id); - skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 ); + status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 ); } } break; @@ -4751,7 +4752,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int pc_setpos(dstsd, sd->mapname, sd->bl.x+dx[j], sd->bl.y+dy[j], 2); } } - skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 ); + status_change_start(src,SC_BLOCKSKILL,skilllv,0,skillid,0,300000,0 ); } } break; @@ -4804,7 +4805,7 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data ) } if(sd->skillid == PR_LEXAETERNA) { - struct status_change *sc_data = battle_get_sc_data(bl); + struct status_change *sc_data = status_get_sc_data(bl); if(sc_data && (sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0))) { clif_skill_fail(sd,sd->skillid,0,0); sd->canact_tick = tick; @@ -4814,7 +4815,7 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data ) } } else if(sd->skillid == RG_BACKSTAP) { - int dir = map_calc_dir(&sd->bl,bl->x,bl->y),t_dir = battle_get_dir(bl); + int dir = map_calc_dir(&sd->bl,bl->x,bl->y),t_dir = status_get_dir(bl); int dist = distance(sd->bl.x,sd->bl.y,bl->x,bl->y); if(bl->type != BL_SKILL && (dist == 0 || map_check_dir(dir,t_dir))) { clif_skill_fail(sd,sd->skillid,0,0); @@ -4837,7 +4838,7 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data ) int fail_flag = 1; if(inf2 & 0x400 && battle_check_target(&sd->bl,bl, BCT_PARTY) > 0) fail_flag = 0; - if(inf2 & 0x800 && sd->status.guild_id > 0 && sd->status.guild_id == battle_get_guild_id(bl)) + if(inf2 & 0x800 && sd->status.guild_id > 0 && sd->status.guild_id == status_get_guild_id(bl)) fail_flag = 0; if(fail_flag) { clif_skill_fail(sd,sd->skillid,0,0); @@ -4850,7 +4851,7 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data ) range = skill_get_range(sd->skillid,sd->skilllv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); range += battle_config.pc_skill_add_range; if((sd->skillid == MO_EXTREMITYFIST && sd->sc_data[SC_COMBO].timer != -1 && sd->sc_data[SC_COMBO].val1 == MO_COMBOFINISH) || (sd->skillid == CH_TIGERFIST && sd->sc_data[SC_COMBO].timer != -1 && sd->sc_data[SC_COMBO].val1 == MO_COMBOFINISH) || @@ -4893,7 +4894,7 @@ int skill_castend_id( int tid, unsigned int tick, int id,int data ) skill_castend_damage_id(&sd->bl,bl,sd->skillid,sd->skilllv,tick,0); break; case 1:/* 支援系 */ - if( (sd->skillid==AL_HEAL || (sd->skillid==ALL_RESURRECTION && bl->type != BL_PC) || sd->skillid==PR_ASPERSIO) && battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))) + if( (sd->skillid==AL_HEAL || (sd->skillid==ALL_RESURRECTION && bl->type != BL_PC) || sd->skillid==PR_ASPERSIO) && battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) skill_castend_damage_id(&sd->bl,bl,sd->skillid,sd->skilllv,tick,0); else skill_castend_nodamage_id(&sd->bl,bl,sd->skillid,sd->skilllv,tick,0); @@ -4960,7 +4961,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil x+=(src->x-x>0)?-range:range; if(src->y!=y) y+=(src->y-y>0)?-range:range; - map_foreachinarea( skill_status_change_timer_sub, + map_foreachinarea( status_change_timer_sub, src->m, x-range, y-range, x+range,y+range,0, src,SC_SIGHT,tick); } @@ -5060,7 +5061,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil pc_movepos(sd,x,y); }else if( src->type==BL_MOB ) mob_warp((struct mob_data *)src,-1,x,y,0); - skill_status_change_start(src,SC_BLOCKSKILL,skilllv,0,MO_EXTREMITYFIST,0,2000,0 ); + status_change_start(src,SC_BLOCKSKILL,skilllv,0,MO_EXTREMITYFIST,0,2000,0 ); break; case AM_CANNIBALIZE: // バイオプラント if(sd){ @@ -5250,7 +5251,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, nullpo_retr(0, src); - sc_data = battle_get_sc_data(src); // for firewall and fogwall - celest + sc_data = status_get_sc_data(src); // for firewall and fogwall - celest switch(skillid){ /* 設定 */ @@ -5460,8 +5461,8 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, target=BCT_NOENEMY; if(src->type == BL_PC) val1 = (pc_checkskill((struct map_session_data *)src,BA_MUSICALLESSON)+1)>>1; - val2 = ((battle_get_agi(src)/10)&0xffff)<<16; - val2 |= (battle_get_luk(src)/10)&0xffff; + val2 = ((status_get_agi(src)/10)&0xffff)<<16; + val2 |= (status_get_luk(src)/10)&0xffff; break; case DC_HUMMING: /* ハミング */ count=49; @@ -5470,7 +5471,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, target=BCT_NOENEMY; if(src->type == BL_PC) val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1; - val2 = battle_get_dex(src)/10; + val2 = status_get_dex(src)/10; break; case BA_DISSONANCE: /* 不協和音 */ @@ -5488,8 +5489,8 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, target=BCT_ENEMY; if(src->type == BL_PC) val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1; - val2 = ((battle_get_str(src)/20)&0xffff)<<16; - val2 |= (battle_get_agi(src)/10)&0xffff; + val2 = ((status_get_str(src)/20)&0xffff)<<16; + val2 |= (status_get_agi(src)/10)&0xffff; break; case BA_POEMBRAGI: /* ブラギの詩 */ count=49; @@ -5498,8 +5499,8 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, target=BCT_NOENEMY; if(src->type == BL_PC) val1 = pc_checkskill((struct map_session_data *)src,BA_MUSICALLESSON); - val2 = ((battle_get_dex(src)/10)&0xffff)<<16; - val2 |= (battle_get_int(src)/5)&0xffff; + val2 = ((status_get_dex(src)/10)&0xffff)<<16; + val2 |= (status_get_int(src)/5)&0xffff; break; case BA_APPLEIDUN: /* イドゥンの林檎 */ count=49; @@ -5510,7 +5511,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, val1 = ((pc_checkskill((struct map_session_data *)src,BA_MUSICALLESSON))&0xffff)<<16; else val1 = 0; - val1 |= (battle_get_vit(src))&0xffff; + val1 |= (status_get_vit(src))&0xffff; val2 = 0;//回復用タイムカウンタ(6秒?に1?加) break; case DC_SERVICEFORYOU: /* サ?ビスフォ?ユ? */ @@ -5520,7 +5521,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, target=BCT_PARTY; if(src->type == BL_PC) val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1; - val2 = battle_get_int(src)/10; + val2 = status_get_int(src)/10; break; case BA_ASSASSINCROSS: /* 夕陽のアサシンクロス */ count=49; @@ -5529,7 +5530,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, target=BCT_NOENEMY; if(src->type == BL_PC) val1 = (pc_checkskill((struct map_session_data *)src,BA_MUSICALLESSON)+1)>>1; - val2 = battle_get_agi(src)/20; + val2 = status_get_agi(src)/20; break; case DC_FORTUNEKISS: /* 幸運のキス */ count=49; @@ -5538,7 +5539,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, target=BCT_NOENEMY; if(src->type == BL_PC) val1 = (pc_checkskill((struct map_session_data *)src,DC_DANCINGLESSON)+1)>>1; - val2 = battle_get_luk(src)/10; + val2 = status_get_luk(src)/10; break; case AM_DEMONSTRATION: /* デモンストレ?ション */ @@ -5559,7 +5560,7 @@ struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid, range=3; //Fix to prevent the priest from walking while Basilica is up. battle_stopwalking(src,1); - //skill_status_change_start(src,SC_ANKLE,skilllv,0,0,0,limit,0); + //status_change_start(src,SC_ANKLE,skilllv,0,0,0,limit,0); //sd->canmove_tick = gettick() + limit; // added later [celest] break; @@ -5928,10 +5929,10 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int switch(sg->unit_id){ case 0x83: /* サンクチュアリ */ { - int race=battle_get_race(bl); - int damage_flag = (battle_check_undead(race,battle_get_elem_type(bl)) || race == 6)? 1:0; + int race=status_get_race(bl); + int damage_flag = (battle_check_undead(race,status_get_elem_type(bl)) || race == 6)? 1:0; - if( battle_get_hp(bl)>=battle_get_max_hp(bl) && !damage_flag) + if( status_get_hp(bl)>=status_get_max_hp(bl) && !damage_flag) break; if((sg->val1--)<=0){ @@ -5955,8 +5956,8 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0x84: /* マグヌスエクソシズム */ { - int race=battle_get_race(bl); - int damage_flag = (battle_check_undead(race,battle_get_elem_type(bl)) || race == 6)? 1:0; + int race=status_get_race(bl); + int damage_flag = (battle_check_undead(race,status_get_elem_type(bl)) || race == 6)? 1:0; if(!damage_flag) return 0; @@ -5967,14 +5968,14 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0x85: /* ニュ?マ */ { struct skill_unit *unit2; - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type=SC_PNEUMA; if(sc_data) { if (sc_data[type].timer==-1) - skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0); + status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0); else if((unit2=(struct skill_unit *)sc_data[type].val2) && unit2 != src ){ if(DIFF_TICK(sg->tick,unit2->group->tick)>0 ) - skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0); + status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0); ts->tick-=sg->interval; } } @@ -5983,14 +5984,14 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0x7e: /* セイフティウォ?ル */ { struct skill_unit *unit2; - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type=SC_SAFETYWALL; if(sc_data) { if (sc_data[type].timer==-1) - skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0); + status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0); else if((unit2=(struct skill_unit *)sc_data[type].val2) && unit2 != src ){ if(sg->val1 < unit2->group->val1 ) - skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0); + status_change_start(bl,type,sg->skill_lv,(int)src,0,0,0,0); ts->tick-=sg->interval; } } @@ -6060,14 +6061,14 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0x91: /* アンクルスネア */ { - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); if(sg->val2==0 && sc_data && sc_data[SC_ANKLE].timer==-1){ int moveblock = ( bl->x/BLOCK_SIZE != src->bl.x/BLOCK_SIZE || bl->y/BLOCK_SIZE != src->bl.y/BLOCK_SIZE); - int sec = skill_get_time2(sg->skill_id,sg->skill_lv) - battle_get_agi(bl)/10; - if(battle_get_mode(bl)&0x20) + int sec = skill_get_time2(sg->skill_id,sg->skill_lv) - status_get_agi(bl)/10; + if(status_get_mode(bl)&0x20) sec = sec/5; battle_stopwalking(bl,1); - skill_status_change_start(bl,SC_ANKLE,sg->skill_lv,0,0,0,sec,0); + status_change_start(bl,SC_ANKLE,sg->skill_lv,0,0,0,sec,0); if(moveblock) map_delblock(bl); bl->x = src->bl.x; @@ -6109,20 +6110,20 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0x8e: /* クァグマイア */ { - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type=SkillStatusChangeTable[sg->skill_id]; if( bl->type==BL_PC && ((struct map_session_data *)bl)->special_state.no_magic_damage ) break; if(sc_data && sc_data[type].timer==-1) - skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); + status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); } break; case 0x92: /* ベノムダスト */ { - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type=SkillStatusChangeTable[sg->skill_id]; if(sc_data && sc_data[type].timer==-1 ) - skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); + status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); } break; case 0x9a: /* ボルケ?ノ */ @@ -6130,14 +6131,14 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0x9c: /* バイオレントゲイル */ { struct skill_unit *unit2; - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type=SkillStatusChangeTable[sg->skill_id]; if(sc_data) { if (sc_data[type].timer==-1) - skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); + status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); else if((unit2=(struct skill_unit *)sc_data[type].val2) && unit2 != src ){ if( unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) - skill_status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); + status_change_start(bl,type,sg->skill_lv,(int)src,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); ts->tick-=sg->interval; } } @@ -6164,17 +6165,17 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int // case 0xb6: /* フォグウォ?ル */ { struct skill_unit *unit2; - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type=SkillStatusChangeTable[sg->skill_id]; if(sg->src_id == bl->id) break; if(sc_data) { if (sc_data[type].timer==-1) - skill_status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2, + status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2, (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0); else if( (unit2=(struct skill_unit *)sc_data[type].val4) && unit2 != src ){ if( unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) - skill_status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2, + status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2, (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0); ts->tick-=sg->interval; } @@ -6184,17 +6185,17 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0xaa: /* イドゥンの林檎 */ { struct skill_unit *unit2; - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type=SkillStatusChangeTable[sg->skill_id]; if(sg->src_id == bl->id) break; if(sc_data) { if (sc_data[type].timer==-1) - skill_status_change_start(bl,type,sg->skill_lv,(sg->val1)>>16,(sg->val1)&0xffff, + status_change_start(bl,type,sg->skill_lv,(sg->val1)>>16,(sg->val1)&0xffff, (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0); else if((unit2=(struct skill_unit *)sc_data[type].val4) && unit2 != src ){ if( unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) - skill_status_change_start(bl,type,sg->skill_lv,(sg->val1)>>16,(sg->val1)&0xffff, + status_change_start(bl,type,sg->skill_lv,(sg->val1)>>16,(sg->val1)&0xffff, (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0); ts->tick-=sg->interval; } @@ -6204,17 +6205,17 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int case 0xb6: /* フォグウォ?ル */ { struct skill_unit *unit2; - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type=SkillStatusChangeTable[sg->skill_id]; if(sc_data) { if (sc_data[type].timer==-1) { - skill_status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2, + status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2, (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0); skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,tick); } else if( (unit2=(struct skill_unit *)sc_data[type].val4) && unit2 != src ){ if( unit2->group && DIFF_TICK(sg->tick,unit2->group->tick)>0 ) { - skill_status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2, + status_change_start(bl,type,sg->skill_lv,sg->val1,sg->val2, (int)src,skill_get_time2(sg->skill_id,sg->skill_lv),0); skill_additional_effect(ss,bl,sg->skill_id,sg->skill_lv,BF_MISC,tick); } @@ -6273,7 +6274,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int sd->status.guild_id == srcsd->status.guild_id && sd != srcsd) { sd->state.leadership_flag = (int)src; - pc_calcstatus (sd, 0); + status_calc_pc (sd, 0); } } break; @@ -6284,7 +6285,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int sd->status.guild_id == srcsd->status.guild_id && sd != srcsd) { sd->state.glorywounds_flag = (int)src; - pc_calcstatus (sd, 0); + status_calc_pc (sd, 0); } } break; @@ -6295,7 +6296,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int sd->status.guild_id == srcsd->status.guild_id && sd != srcsd) { sd->state.soulcold_flag = (int)src; - pc_calcstatus (sd, 0); + status_calc_pc (sd, 0); } } break; @@ -6306,7 +6307,7 @@ int skill_unit_onplace(struct skill_unit *src,struct block_list *bl,unsigned int sd->status.guild_id == srcsd->status.guild_id && sd != srcsd) { sd->state.hawkeyes_flag = (int)src; - pc_calcstatus (sd, 0); + status_calc_pc (sd, 0); } } break; @@ -6355,14 +6356,14 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t case 0x85: /* ニュ?マ */ case 0x8e: /* クァグマイア */ { - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); int type= (sg->unit_id==0x85)?SC_PNEUMA: ((sg->unit_id==0x7e)?SC_SAFETYWALL: SC_QUAGMIRE); if((type != SC_QUAGMIRE || bl->type != BL_MOB) && sc_data && sc_data[type].timer!=-1 && ((struct skill_unit *)sc_data[type].val2)==src){ - skill_status_change_end(bl,type,-1); + status_change_end(bl,type,-1); } } break; @@ -6370,7 +6371,7 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t { struct block_list *target=map_id2bl(sg->val2); if( target && target==bl ){ - skill_status_change_end(bl,SC_ANKLE,-1); + status_change_end(bl,SC_ANKLE,-1); sg->limit=DIFF_TICK(tick,sg->tick)+1000; } } @@ -6380,19 +6381,19 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t { struct block_list *target=map_id2bl(sg->val2); if( target==bl ) - skill_status_change_end(bl,SC_SPIDERWEB,-1); + status_change_end(bl,SC_SPIDERWEB,-1); sg->limit=DIFF_TICK(tick,sg->tick)+1000; } break; case 0xb6: { struct block_list *target=map_id2bl(sg->val2); - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); if( target==bl ) { - skill_status_change_end(bl,SC_FOGWALL,-1); + status_change_end(bl,SC_FOGWALL,-1); if (sc_data && sc_data[SC_BLIND].timer!=-1) sc_data[SC_BLIND].timer = add_timer( - gettick() + 30000, skill_status_change_timer, bl->id, 0); + gettick() + 30000, status_change_timer, bl->id, 0); } //sg->limit=DIFF_TICK(tick,sg->tick)+1000; } @@ -6401,11 +6402,11 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t case 0x9b: /* デリュ?ジ */ case 0x9c: /* バイオレントゲイル */ { - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); struct skill_unit *su; int type=SkillStatusChangeTable[sg->skill_id]; if( sc_data && sc_data[type].timer!=-1 && (su=((struct skill_unit *)sc_data[type].val2)) && su == src ){ - skill_status_change_end(bl,type,-1); + status_change_end(bl,type,-1); } } break; @@ -6430,11 +6431,11 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t case 0xaf: /* サ?ビスフォ?ユ? */ case 0xb4: { - struct status_change *sc_data=battle_get_sc_data(bl); + struct status_change *sc_data=status_get_sc_data(bl); struct skill_unit *su; int type=SkillStatusChangeTable[sg->skill_id]; if( sc_data && sc_data[type].timer!=-1 && (su=((struct skill_unit *)sc_data[type].val4)) && su == src ){ - skill_status_change_end(bl,type,-1); + status_change_end(bl,type,-1); } } break; @@ -6442,7 +6443,7 @@ int skill_unit_onout(struct skill_unit *src,struct block_list *bl,unsigned int t { struct block_list *target=map_id2bl(sg->val2); if( target && target==bl ) - skill_status_change_end(bl,SC_SPIDERWEB,-1); + status_change_end(bl,SC_SPIDERWEB,-1); sg->limit=DIFF_TICK(tick,sg->tick)+1000; } break; @@ -6769,7 +6770,7 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data ) if(sd->skilllv <= 0) return 0; range = skill_get_range(sd->skillid,sd->skilllv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); range += battle_config.pc_skill_add_range; if(battle_config.skill_out_range_consume) { // changed to allow casting when target walks out of range [Valaris] if(range < distance(sd->bl.x,sd->bl.y,sd->skillx,sd->skilly)) { @@ -6905,7 +6906,7 @@ static int skill_check_condition_use_sub(struct block_list *bl,va_list ap) if(sd != ssd && (s_class.job == 4 || s_class.job == 8 || s_class.job == 15) && (sd->bl.x == ssd->bl.x - 1 || sd->bl.x == ssd->bl.x + 1) && sd->status.sp >= 10){ sd->status.sp -= 10; - pc_calcstatus(sd,0); + status_calc_pc(sd,0); (*c)++; } break; @@ -6930,7 +6931,7 @@ static int skill_check_condition_use_sub(struct block_list *bl,va_list ap) ){ ssd->sc_data[SC_DANCING].val4=bl->id; clif_skill_nodamage(bl,src,skillid,skilllv,1); - skill_status_change_start(bl,SC_DANCING,skillid,ssd->sc_data[SC_DANCING].val2,0,src->id,skill_get_time(skillid,skilllv)+1000,0); + status_change_start(bl,SC_DANCING,skillid,ssd->sc_data[SC_DANCING].val2,0,src->id,skill_get_time(skillid,skilllv)+1000,0); sd->skillid_dance=sd->skillid=skillid; sd->skilllv_dance=sd->skilllv=skilllv; (*c)++; @@ -7400,7 +7401,7 @@ int skill_castfix( struct block_list *bl, int time ) if(lv <= 0) return 0; - sc_data = battle_get_sc_data(bl); + sc_data = status_get_sc_data(bl); if (skill > MAX_SKILL_DB || skill < 0) return 0; @@ -7408,14 +7409,14 @@ int skill_castfix( struct block_list *bl, int time ) /* サフラギウム */ if(sc_data && sc_data[SC_SUFFRAGIUM].timer!=-1 ) time=time*(100-sc_data[SC_SUFFRAGIUM].val1*15)/100; - skill_status_change_end( bl, SC_SUFFRAGIUM, -1); + status_change_end( bl, SC_SUFFRAGIUM, -1); if(time==0) return 0; if (sd) { if(!skill_get_castnodex(skill, lv) > 0) { castrate=((struct map_session_data *)bl)->castrate; - time=time*castrate*(battle_config.castrate_dex_scale - battle_get_dex(bl))/(battle_config.castrate_dex_scale * 100); + time=time*castrate*(battle_config.castrate_dex_scale - status_get_dex(bl))/(battle_config.castrate_dex_scale * 100); time=time*battle_config.cast_rate/100; } } @@ -7448,7 +7449,7 @@ int skill_delayfix( struct block_list *bl, int time ) if(lv <= 0) return 0; - sc_data = battle_get_sc_data(bl); + sc_data = status_get_sc_data(bl); if(sd) { delayrate=((struct map_session_data *)bl)->delayrate; @@ -7456,15 +7457,15 @@ int skill_delayfix( struct block_list *bl, int time ) // instant cast attack skills depend on aspd as delay [celest] if (time == 0) { if (skill_db[skill].skill_type == BF_WEAPON) - time = battle_get_adelay (bl)/2; + time = status_get_adelay (bl)/2; else time = 300; // default delay, according to official servers } else if (time < 0) - time = abs(time) + battle_get_adelay (bl)/2; // if set to <0, the aspd delay will be added + time = abs(time) + status_get_adelay (bl)/2; // if set to <0, the aspd delay will be added if(battle_config.delay_dependon_dex && /* dexの影響を計算する */ !skill_get_delaynodex(skill, lv)) // if skill casttime is allowed to be reduced by dex - time = time * (battle_config.castrate_dex_scale - battle_get_dex(bl)) / (battle_config.castrate_dex_scale); + time = time * (battle_config.castrate_dex_scale - status_get_dex(bl)) / (battle_config.castrate_dex_scale); time = time * delayrate * battle_config.delay_rate / 10000; @@ -7552,7 +7553,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, struct skill_unit_group *sg; // if caster is the owner of basilica if ((sg = su->group) && sg->src_id == sd->bl.id) { - // skill_status_change_end(&sd->bl,SC_BASILICA,-1); + // status_change_end(&sd->bl,SC_BASILICA,-1); // skill_delunitgroup (sg); if (skill_num != HP_BASILICA) return 0; } // otherwise... @@ -7669,7 +7670,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, /* 射程と障害物チェック */ range = skill_get_range(skill_num,skill_lv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); // be lenient if the skill was cast before we have moved to the correct position [Celest] if (sd->walktimer != -1) range += battle_config.skill_range_leniency; @@ -7706,11 +7707,11 @@ int skill_use_id( struct map_session_data *sd, int target_id, switch(skill_num){ /* 何か特殊な?理が必要 */ // case AL_HEAL: /* ヒ?ル */ -// if(battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))) +// if(battle_check_undead(status_get_race(bl),status_get_elem_type(bl))) // forcecast=1; /* ヒ?ルアタックなら詠唱エフェクト有り */ // break; case ALL_RESURRECTION: /* リザレクション */ - if(bl->type != BL_PC && battle_check_undead(battle_get_race(bl),battle_get_elem_type(bl))){ /* 敵がアンデッドなら */ + if(bl->type != BL_PC && battle_check_undead(status_get_race(bl),status_get_elem_type(bl))){ /* 敵がアンデッドなら */ forcecast=1; /* タ?ンアンデットと同じ詠唱時間 */ casttime=skill_castfix(&sd->bl, skill_get_cast(PR_TURNUNDEAD,skill_lv) ); } @@ -7759,7 +7760,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, //rangeをもう1回?査 range = skill_get_range(skill_num,skill_lv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); if(!battle_check_range(&sd->bl,&p_sd->bl,range)) return 0; } @@ -7767,7 +7768,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, // removed on 12/14's patch [celest] //case AS_SPLASHER: /* ベナムスプラッシャ? */ /* { - struct status_change *t_sc_data = battle_get_sc_data(bl); + struct status_change *t_sc_data = status_get_sc_data(bl); if(t_sc_data && t_sc_data[SC_POISON].timer==-1){ clif_skill_fail(sd,skill_num,0,10); return 0; @@ -7792,7 +7793,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, if(sc_data && sc_data[SC_MEMORIZE].timer != -1 && casttime > 0){ casttime = casttime/2; if((--sc_data[SC_MEMORIZE].val2)<=0) - skill_status_change_end(&sd->bl, SC_MEMORIZE, -1); + status_change_end(&sd->bl, SC_MEMORIZE, -1); } if(battle_config.pc_skill_log) @@ -7824,7 +7825,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, sd->canact_tick = tick + casttime + delay; sd->canmove_tick = tick; if(!(battle_config.pc_cloak_check_type&2) && sc_data && sc_data[SC_CLOAKING].timer != -1 && sd->skillid != AS_CLOAKING) - skill_status_change_end(&sd->bl,SC_CLOAKING,-1); + status_change_end(&sd->bl,SC_CLOAKING,-1); if(casttime > 0) { sd->skilltimer = add_timer( tick+casttime, skill_castend_id, sd->bl.id, 0 ); if((skill = pc_checkskill(sd,SA_FREECAST)) > 0) { @@ -7893,7 +7894,7 @@ int skill_use_pos( struct map_session_data *sd, struct skill_unit_group *sg; // if caster is the owner of basilica if ((sg = su->group) && sg->src_id == sd->bl.id) { - // skill_status_change_end(&sd->bl,SC_BASILICA,-1); + // status_change_end(&sd->bl,SC_BASILICA,-1); // skill_delunitgroup (sg); if (skill_num != HP_BASILICA) return 0; } // otherwise... @@ -7926,7 +7927,7 @@ int skill_use_pos( struct map_session_data *sd, bl.y = skill_y; range = skill_get_range(skill_num,skill_lv); if(range < 0) - range = battle_get_range(&sd->bl) - (range + 1); + range = status_get_range(&sd->bl) - (range + 1); // be lenient if the skill was cast before we have moved to the correct position [Celest] if (sd->walktimer != -1) range += battle_config.skill_range_leniency; @@ -7948,7 +7949,7 @@ int skill_use_pos( struct map_session_data *sd, if(sc_data && sc_data[SC_MEMORIZE].timer != -1 && casttime > 0){ casttime = casttime/3; if((--sc_data[SC_MEMORIZE].val2)<=0) - skill_status_change_end(&sd->bl, SC_MEMORIZE, -1); + status_change_end(&sd->bl, SC_MEMORIZE, -1); } if( casttime>0 ) /* 詠唱が必要 */ @@ -7964,7 +7965,7 @@ int skill_use_pos( struct map_session_data *sd, sd->canact_tick = tick + casttime + delay; sd->canmove_tick = tick; if(!(battle_config.pc_cloak_check_type&2) && sc_data && sc_data[SC_CLOAKING].timer != -1) - skill_status_change_end(&sd->bl,SC_CLOAKING,-1); + status_change_end(&sd->bl,SC_CLOAKING,-1); if(casttime > 0) { sd->skilltimer = add_timer( tick+casttime, skill_castend_pos, sd->bl.id, 0 ); if((skill = pc_checkskill(sd,SA_FREECAST)) > 0) { @@ -7981,7 +7982,7 @@ int skill_use_pos( struct map_session_data *sd, } //マジックパワ?の?果終了 if(sc_data && sc_data[SC_MAGICPOWER].timer != -1 && skill_num != HW_MAGICPOWER) - skill_status_change_end(&sd->bl,SC_MAGICPOWER,-1); + status_change_end(&sd->bl,SC_MAGICPOWER,-1); return 0; } @@ -8246,7 +8247,7 @@ void skill_devotion_end(struct map_session_data *md,struct map_session_data *sd, md->dev.val1[target]=md->dev.val2[target]=0; if(sd && sd->sc_data){ - // skill_status_change_end(sd->bl,SC_DEVOTION,-1); + // status_change_end(sd->bl,SC_DEVOTION,-1); sd->sc_data[SC_DEVOTION].val1=0; sd->sc_data[SC_DEVOTION].val2=0; clif_status_change(&sd->bl,SC_DEVOTION,0); @@ -8288,7 +8289,7 @@ int skill_autospell(struct map_session_data *sd,int skillid) if(maxlv > (lv=pc_checkskill(sd,skillid))) maxlv = lv; - skill_status_change_start(&sd->bl,SC_AUTOSPELL,skilllv,skillid,maxlv,0, // val1:スキルID val2:使用最大Lv + status_change_start(&sd->bl,SC_AUTOSPELL,skilllv,skillid,maxlv,0, // val1:スキルID val2:使用最大Lv skill_get_time(SA_AUTOSPELL,skilllv),0);// にしてみたけどbscriptが書き易い???? return 0; } @@ -8664,1977 +8665,30 @@ int skill_trap_splash(struct block_list *bl, va_list ap ) return 0; } -/*---------------------------------------------------------------------------- - * ステ?タス異常 - *---------------------------------------------------------------------------- - */ - -/*========================================== - * ステ?タス異常タイマ?範??理 - *------------------------------------------ - */ -int skill_status_change_timer_sub(struct block_list *bl, va_list ap ) -{ - struct block_list *src; - int type; - unsigned int tick; - - nullpo_retr(0, bl); - nullpo_retr(0, ap); - nullpo_retr(0, src=va_arg(ap,struct block_list*)); - type=va_arg(ap,int); - tick=va_arg(ap,unsigned int); - - if(bl->type!=BL_PC && bl->type!=BL_MOB) - return 0; - - switch( type ){ - case SC_SIGHT: /* サイト */ - case SC_CONCENTRATE: - if( (*battle_get_option(bl))&6 ){ - skill_status_change_end( bl, SC_HIDING, -1); - skill_status_change_end( bl, SC_CLOAKING, -1); - } - break; - case SC_RUWACH: /* ルアフ */ - if( (*battle_get_option(bl))&6 ){ - if(battle_check_target( src,bl, BCT_ENEMY ) > 0) { - struct status_change *sc_data = battle_get_sc_data(bl); // check whether the target is hiding/cloaking [celest] - if (sc_data && (sc_data[SC_HIDING].timer != -1 || // if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother - sc_data[SC_CLOAKING].timer != -1)) { - skill_status_change_end( bl, SC_HIDING, -1); - skill_status_change_end( bl, SC_CLOAKING, -1); - skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,sc_data[type].val1,tick,0); - } - } - } - break; - } - return 0; -} /*========================================== * ステ?タス異常終了 *------------------------------------------ */ -int skill_status_change_end(struct block_list* bl, int type, int tid) -{ - struct status_change* sc_data; - int opt_flag=0, calc_flag = 0; - short *sc_count, *option, *opt1, *opt2, *opt3; - - nullpo_retr(0, bl); - if(bl->type!=BL_PC && bl->type!=BL_MOB) { - if(battle_config.error_log) - printf("skill_status_change_end: neither MOB nor PC !\n"); - return 0; - } - nullpo_retr(0, sc_data = battle_get_sc_data(bl)); - nullpo_retr(0, sc_count = battle_get_sc_count(bl)); - nullpo_retr(0, option = battle_get_option(bl)); - nullpo_retr(0, opt1 = battle_get_opt1(bl)); - nullpo_retr(0, opt2 = battle_get_opt2(bl)); - nullpo_retr(0, opt3 = battle_get_opt3(bl)); - - if ((*sc_count) > 0 && sc_data[type].timer != -1 && (sc_data[type].timer == tid || tid == -1)) { - - if (tid == -1) // タイマから呼ばれていないならタイマ削除をする - delete_timer(sc_data[type].timer,skill_status_change_timer); - - /* 該?の異常を正常に?す */ - sc_data[type].timer=-1; - (*sc_count)--; - - switch(type){ /* 異常の種類ごとの?理 */ - case SC_PROVOKE: /* プロボック */ - case SC_ENDURE: // celest - case SC_CONCENTRATE: /* 集中力向上 */ - case SC_BLESSING: /* ブレッシング */ - case SC_ANGELUS: /* アンゼルス */ - case SC_INCREASEAGI: /* 速度上昇 */ - case SC_DECREASEAGI: /* 速度減少 */ - case SC_SIGNUMCRUCIS: /* シグナムクルシス */ - case SC_HIDING: - case SC_TWOHANDQUICKEN: /* 2HQ */ - case SC_ADRENALINE: /* アドレナリンラッシュ */ - case SC_ENCPOISON: /* エンチャントポイズン */ - case SC_IMPOSITIO: /* インポシティオマヌス */ - case SC_GLORIA: /* グロリア */ - case SC_LOUD: /* ラウドボイス */ - case SC_QUAGMIRE: /* クァグマイア */ - case SC_PROVIDENCE: /* プロヴィデンス */ - case SC_SPEARSQUICKEN: /* スピアクイッケン */ - case SC_VOLCANO: - case SC_DELUGE: - case SC_VIOLENTGALE: - case SC_ETERNALCHAOS: /* エタ?ナルカオス */ - case SC_DRUMBATTLE: /* ?太鼓の響き */ - case SC_NIBELUNGEN: /* ニ?ベルングの指輪 */ - case SC_SIEGFRIED: /* 不死身のジ?クフリ?ド */ - case SC_WHISTLE: /* 口笛 */ - case SC_ASSNCROS: /* 夕陽のアサシンクロス */ - case SC_HUMMING: /* ハミング */ - case SC_DONTFORGETME: /* 私を忘れないで */ - case SC_FORTUNE: /* 幸運のキス */ - case SC_SERVICE4U: /* サ?ビスフォ?ユ? */ - case SC_EXPLOSIONSPIRITS: // 爆裂波動 - case SC_STEELBODY: // 金剛 - case SC_DEFENDER: - case SC_SPEEDPOTION0: /* ?速ポ?ション */ - case SC_SPEEDPOTION1: - case SC_SPEEDPOTION2: - case SC_SPEEDPOTION3: - case SC_APPLEIDUN: /* イドゥンの林檎 */ - case SC_RIDING: - case SC_BLADESTOP_WAIT: - case SC_AURABLADE: /* オ?ラブレ?ド */ - case SC_PARRYING: /* パリイング */ - case SC_CONCENTRATION: /* コンセントレ?ション */ - case SC_TENSIONRELAX: /* テンションリラックス */ - case SC_ASSUMPTIO: /* アシャンプティオ */ - case SC_WINDWALK: /* ウインドウォ?ク */ - case SC_TRUESIGHT: /* トゥル?サイト */ - case SC_SPIDERWEB: /* スパイダ?ウェッブ */ - case SC_MAGICPOWER: /* 魔法力?幅 */ - case SC_CHASEWALK: - case SC_ATKPOT: /* attack potion [Valaris] */ - case SC_MATKPOT: /* magic attack potion [Valaris] */ - case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) - case SC_MELTDOWN: /* メルトダウン */ - // Celest - case SC_EDP: - case SC_SLOWDOWN: - case SC_SPEEDUP0: -/* case SC_LEADERSHIP: - case SC_GLORYWOUNDS: - case SC_SOULCOLD: - case SC_HAWKEYES:*/ - case SC_BATTLEORDERS: - case SC_REGENERATION: - calc_flag = 1; - break; - case SC_AUTOBERSERK: - if (sc_data[SC_PROVOKE].timer != -1) - skill_status_change_end(bl,SC_PROVOKE,-1); - break; - case SC_BERSERK: /* バ?サ?ク */ - calc_flag = 1; - clif_status_change(bl,SC_INCREASEAGI,0); /* アイコン消去 */ - break; - case SC_DEVOTION: /* ディボ?ション */ - { - struct map_session_data *md = map_id2sd(sc_data[type].val1); - sc_data[type].val1=sc_data[type].val2=0; - skill_devotion(md,bl->id); - calc_flag = 1; - } - break; - case SC_BLADESTOP: - { - struct status_change *t_sc_data = battle_get_sc_data((struct block_list *)sc_data[type].val4); - //片方が切れたので相手の白刃?態が切れてないのなら解除 - if(t_sc_data && t_sc_data[SC_BLADESTOP].timer!=-1) - skill_status_change_end((struct block_list *)sc_data[type].val4,SC_BLADESTOP,-1); - - if(sc_data[type].val2==2) - clif_bladestop((struct block_list *)sc_data[type].val3,(struct block_list *)sc_data[type].val4,0); - } - break; - case SC_DANCING: - { - struct map_session_data *dsd; - struct status_change *d_sc_data; - if(sc_data[type].val4 && (dsd=map_id2sd(sc_data[type].val4))){ - d_sc_data = dsd->sc_data; - //合奏で相手がいる場合相手のval4を0にする - if(d_sc_data && d_sc_data[type].timer!=-1) - d_sc_data[type].val4=0; - } - } - calc_flag = 1; - break; - case SC_GRAFFITI: - { - struct skill_unit_group *sg=(struct skill_unit_group *)sc_data[type].val4; //val4がグラフィティのgroup_id - if(sg) - skill_delunitgroup(sg); - } - break; - case SC_NOCHAT: //チャット禁止?態 - { - struct map_session_data *sd=NULL; - if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){ - if (sd->status.manner >= 0) // weeee ^^ [celest] - sd->status.manner = 0; - clif_updatestatus(sd,SP_MANNER); - } - } - break; - case SC_SPLASHER: /* ベナムスプラッシャ? */ - { - struct block_list *src=map_id2bl(sc_data[type].val3); - if(src && tid!=-1){ - //自分にダメ?ジ&周?3*3にダメ?ジ - skill_castend_damage_id(src, bl,sc_data[type].val2,sc_data[type].val1,gettick(),0 ); - } - } - break; - case SC_SELFDESTRUCTION: /* 自爆 */ - { - //自分のダメ?ジは0にして - struct mob_data *md=NULL; - if(bl->type == BL_MOB && (md=(struct mob_data*)bl)) - skill_castend_damage_id(bl, bl,sc_data[type].val2,sc_data[type].val1,gettick(),0 ); - } - break; - /* option1 */ - case SC_FREEZE: - sc_data[type].val3 = 0; - break; - - /* option2 */ - case SC_POISON: /* 毒 */ - case SC_BLIND: /* 暗? */ - case SC_CURSE: - calc_flag = 1; - break; - - // celest - case SC_CONFUSION: - { - struct map_session_data *sd=NULL; - if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){ - sd->next_walktime = -1; - } - } - break; - - case SC_MARIONETTE: /* マリオネットコントロ?ル */ - case SC_MARIONETTE2: /// Marionette target - { - // check for partner and end their marionette status as well - int type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE; - struct block_list *pbl = map_id2bl(sc_data[type].val3); - if (pbl) { - struct status_change* sc_data; - if (*battle_get_sc_count(pbl) > 0 && - (sc_data = battle_get_sc_data(pbl)) && - sc_data[type2].timer != -1) - skill_status_change_end(pbl, type2, -1); - } - calc_flag = 1; - } - break; - } - - if(bl->type==BL_PC && - (typetype == BL_PC && // by [Yor] - !map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) { // [celest] - *opt2 |= STATE_BLIND; - opt_flag = 1; - } - - if(opt_flag) /* optionの?更を?える */ - clif_changeoption(bl); - - if (bl->type == BL_PC && calc_flag) - pc_calcstatus((struct map_session_data *)bl,0); /* ステ?タス再計算 */ - } - - return 0; -} -/*========================================== - * ステ?タス異常終了タイマ? - *------------------------------------------ - */ -int skill_status_change_timer(int tid, unsigned int tick, int id, int data) +int skill_encchant_eremental_end(struct block_list *bl,int type) { - int type=data; - struct block_list *bl; - struct map_session_data *sd=NULL; struct status_change *sc_data; - //short *sc_count; //使ってない? - - nullpo_retr(0, bl=map_id2bl(id)); - nullpo_retr(0, sc_data=battle_get_sc_data(bl)); - - if(bl->type==BL_PC) - nullpo_retr(0, sd=(struct map_session_data *)bl); - - //sc_count=battle_get_sc_count(bl); //使ってない? - - if(sc_data[type].timer != tid) { - if(battle_config.error_log) - printf("skill_status_change_timer %d != %d\n",tid,sc_data[type].timer); - return 0; - } - - switch(type){ /* 特殊な?理になる場合 */ - case SC_MAXIMIZEPOWER: /* マキシマイズパワ? */ - case SC_CLOAKING: - if(sd){ - if( sd->status.sp > 0 ){ /* SP切れるまで持? */ - sd->status.sp--; - clif_updatestatus(sd,SP_SP); - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - sc_data[type].val2+tick, skill_status_change_timer, bl->id, data); - return 0; - } - } - break; - - case SC_CHASEWALK: - if(sd){ - int sp = 10+sc_data[SC_CHASEWALK].val1*2; - if (map[sd->bl.m].flag.gvg) sp *= 5; - if( sd->status.sp > sp){ - sd->status.sp -= sp; // update sp cost [Celest] - clif_updatestatus(sd,SP_SP); - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - sc_data[type].val2+tick, skill_status_change_timer, bl->id, data); - sc_data[SC_CHASEWALK].val4++; - if (sc_data[SC_CHASEWALK].val4 > 3) - sc_data[SC_CHASEWALK].val4 = 0; - pc_calcstatus (sd, 0); - return 0; - } - } - break; - - case SC_HIDING: /* ハイディング */ - if(sd){ /* SPがあって、時間制限の間は持? */ - if( sd->status.sp > 0 && (--sc_data[type].val2)>0 ){ - if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){ - sd->status.sp--; - clif_updatestatus(sd,SP_SP); - } - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - 1000+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - break; - - case SC_SIGHT: /* サイト */ - case SC_RUWACH: /* ルアフ */ - { - int range = 5; - if ( type == SC_SIGHT ) range = 7; - map_foreachinarea( skill_status_change_timer_sub, - bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,0, - bl,type,tick); - - if( (--sc_data[type].val2)>0 ){ - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - 250+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - break; - - case SC_SIGNUMCRUCIS: /* シグナムクルシス */ - { - int race = battle_get_race(bl); - if(race == 6 || battle_check_undead(race,battle_get_elem_type(bl))) { - sc_data[type].timer=add_timer(1000*600+tick,skill_status_change_timer, bl->id, data ); - return 0; - } - } - break; - - case SC_PROVOKE: /* プロボック/オ?トバ?サ?ク */ - if(sc_data[type].val2!=0){ /* オ?トバ?サ?ク(1秒ごとにHPチェック) */ - if(sd && sd->status.hp>sd->status.max_hp>>2) /* 停止 */ - break; - sc_data[type].timer=add_timer( 1000+tick,skill_status_change_timer, bl->id, data ); - return 0; - } - break; - - case SC_WATERBALL: /* ウォ?タ?ボ?ル */ - { - struct block_list *target=map_id2bl(sc_data[type].val2); - nullpo_retb(target); - nullpo_retb(target->prev); - skill_attack(BF_MAGIC,bl,bl,target,WZ_WATERBALL,sc_data[type].val1,tick,0); - if((--sc_data[type].val3)>0) { - sc_data[type].timer=add_timer( 150+tick,skill_status_change_timer, bl->id, data ); - return 0; - } - } - break; - - case SC_ENDURE: /* インデュア */ - case SC_AUTOBERSERK: // Celest - if(sd && sd->special_state.infinite_endure) { -#ifdef TWILIGHT - sc_data[type].timer=add_timer( 1000*600+tick,skill_status_change_timer, bl->id, data ); -#else - sc_data[type].timer=add_timer( 1000*60+tick,skill_status_change_timer, bl->id, data ); -#endif - //sc_data[type].val2=1; - return 0; - } - break; - - case SC_DISSONANCE: /* 不協和音 */ - if( (--sc_data[type].val2)>0){ - struct skill_unit *unit= - (struct skill_unit *)sc_data[type].val4; - struct block_list *src; - /*if(!unit || !unit->group) - break; - src=map_id2bl(unit->group->src_id); - if(!src) - break;*/ - nullpo_retb(unit); - nullpo_retb(unit->group); - nullpo_retr(0, src=map_id2bl(unit->group->src_id)); - skill_attack(BF_MISC,src,&unit->bl,bl,unit->group->skill_id,sc_data[type].val1,tick,0); - sc_data[type].timer=add_timer(skill_get_time2(unit->group->skill_id,unit->group->skill_lv)+tick, - skill_status_change_timer, bl->id, data ); - return 0; - } - break; - - case SC_LULLABY: /* 子守唄 */ - if( (--sc_data[type].val2)>0){ - struct skill_unit *unit= - (struct skill_unit *)sc_data[type].val4; - nullpo_retb(unit); - nullpo_retb(unit->group); - if(unit->group->src_id == bl->id) - break; - skill_additional_effect(bl,bl,unit->group->skill_id,sc_data[type].val1,BF_LONG|BF_SKILL|BF_MISC,tick); - if (unit->group != 0) - sc_data[type].timer=add_timer(skill_get_time(unit->group->skill_id,unit->group->skill_lv)/10+tick, - skill_status_change_timer, bl->id, data ); - return 0; - } - break; - - case SC_STONE: - if(sc_data[type].val2 != 0) { - short *opt1 = battle_get_opt1(bl); - sc_data[type].val2 = 0; - sc_data[type].val4 = 0; - battle_stopwalking(bl,1); - if(opt1) { - *opt1 = 1; - clif_changeoption(bl); - } - sc_data[type].timer=add_timer(1000+tick,skill_status_change_timer, bl->id, data ); - return 0; - } - else if( (--sc_data[type].val3) > 0) { - int hp = battle_get_max_hp(bl); - if((++sc_data[type].val4)%5 == 0 && battle_get_hp(bl) > hp>>2) { - hp = hp/100; - if(hp < 1) hp = 1; - if(sd) - pc_heal(sd,-hp,0); - else if(bl->type == BL_MOB){ - struct mob_data *md; - if((md=((struct mob_data *)bl)) == NULL) - break; - md->hp -= hp; - } - } - sc_data[type].timer=add_timer(1000+tick,skill_status_change_timer, bl->id, data ); - return 0; - } - break; - case SC_POISON: - if(sc_data[SC_SLOWPOISON].timer == -1) { - if( (--sc_data[type].val3) > 0) { - int hp = battle_get_max_hp(bl); - if(battle_get_hp(bl) > hp>>2) { - if(bl->type == BL_PC) { - hp = 3 + hp*3/200; - pc_heal((struct map_session_data *)bl,-hp,0); - } - else if(bl->type == BL_MOB) { - struct mob_data *md; - nullpo_retr(0, md=(struct mob_data *)bl); - /*if((md=((struct mob_data *)bl)) == NULL) - break;*/ - hp = 3 + hp/200; - md->hp -= hp; - } - } - sc_data[type].timer=add_timer(1000+tick,skill_status_change_timer, bl->id, data ); - } - } - else - sc_data[type].timer=add_timer(1000+tick,skill_status_change_timer, bl->id, data ); - break; - case SC_DPOISON: - if (sc_data[SC_SLOWPOISON].timer == -1 && (--sc_data[type].val3) > 0) { - int hp = battle_get_max_hp(bl); - if (battle_get_hp(bl) > hp>>2) { - if(sd) { - hp = 3 + hp/50; - pc_heal(sd, -hp, 0); - } else if (bl->type == BL_MOB) { - struct mob_data *md; - nullpo_retr(0, md=(struct mob_data *)bl); - /*if ((md=((struct mob_data *)bl)) == NULL) - break;*/ - hp = 3 + hp/100; - md->hp -= hp; - } - } - } - if (sc_data[type].val3 > 0) - sc_data[type].timer=add_timer(1000+tick,skill_status_change_timer, bl->id, data ); - break; - - case SC_TENSIONRELAX: /* テンションリラックス */ - if(sd){ /* SPがあって、HPが?タンでなければ?? */ - if( sd->status.sp > 12 && sd->status.max_hp > sd->status.hp ){ -/* if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){ - sd->status.sp -= 12; - clif_updatestatus(sd,SP_SP); - } */ - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - 10000+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - if(sd->status.max_hp <= sd->status.hp) - skill_status_change_end(&sd->bl,SC_TENSIONRELAX,-1); - } - break; - case SC_HEADCRUSH: // temporary damage [celest] -// case SC_BLEEDING: - if((--sc_data[type].val3) > 0) { - int hp = battle_get_max_hp(bl); - if(sd) { - hp = 3 + hp*3/200; - pc_heal(sd,-hp,0); - } - else if(bl->type == BL_MOB) { - struct mob_data *md; - nullpo_retr(0, md=(struct mob_data *)bl); - /*if((md=((struct mob_data *)bl)) == NULL) - break;*/ - hp = 3 + hp/200; - md->hp -= hp; - } - sc_data[type].timer=add_timer(1000+tick,skill_status_change_timer, bl->id, data ); - } - break; - - /* 時間切れ無し?? */ - case SC_AETERNA: - case SC_TRICKDEAD: - case SC_RIDING: - case SC_FALCON: - case SC_WEIGHT50: - case SC_WEIGHT90: - case SC_MAGICPOWER: /* 魔法力?幅 */ - case SC_REJECTSWORD: /* リジェクトソ?ド */ - case SC_MEMORIZE: /* メモライズ */ - case SC_BROKNWEAPON: - case SC_BROKNARMOR: - case SC_SACRIFICE: -// if(sc_data[type].timer==tid) - sc_data[type].timer=add_timer( 1000*600+tick,skill_status_change_timer, bl->id, data ); - return 0; - - case SC_DANCING: //ダンススキルの時間SP消費 - { - int s=0; - if(sd){ - if(sd->status.sp > 0 && (--sc_data[type].val3)>0){ - switch(sc_data[type].val1){ - case BD_RICHMANKIM: /* ニヨルドの宴 3秒にSP1 */ - case BD_DRUMBATTLEFIELD: /* ?太鼓の響き 3秒にSP1 */ - case BD_RINGNIBELUNGEN: /* ニ?ベルングの指輪 3秒にSP1 */ - case BD_SIEGFRIED: /* 不死身のジ?クフリ?ド 3秒にSP1 */ - case BA_DISSONANCE: /* 不協和音 3秒でSP1 */ - case BA_ASSASSINCROSS: /* 夕陽のアサシンクロス 3秒でSP1 */ - case DC_UGLYDANCE: /* 自分勝手なダンス 3秒でSP1 */ - s=3; - break; - case BD_LULLABY: /* 子守歌 4秒にSP1 */ - case BD_ETERNALCHAOS: /* 永遠の混沌 4秒にSP1 */ - case BD_ROKISWEIL: /* ロキの叫び 4秒にSP1 */ - case DC_FORTUNEKISS: /* 幸運のキス 4秒でSP1 */ - s=4; - break; - case BD_INTOABYSS: /* 深淵の中に 5秒にSP1 */ - case BA_WHISTLE: /* 口笛 5秒でSP1 */ - case DC_HUMMING: /* ハミング 5秒でSP1 */ - case BA_POEMBRAGI: /* ブラギの詩 5秒でSP1 */ - case DC_SERVICEFORYOU: /* サ?ビスフォ?ユ? 5秒でSP1 */ - s=5; - break; - case BA_APPLEIDUN: /* イドゥンの林檎 6秒でSP1 */ - s=6; - break; - case DC_DONTFORGETME: /* 私を忘れないで… 10秒でSP1 */ - case CG_MOONLIT: /* 月明りの泉に落ちる花びら 10秒でSP1? */ - s=10; - break; - } - if(s && ((sc_data[type].val3 % s) == 0)){ - sd->status.sp--; - clif_updatestatus(sd,SP_SP); - } - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - 1000+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - } - break; - case SC_BERSERK: /* バ?サ?ク */ - if(sd){ /* HPが100以上なら?? */ - if( (sd->status.hp - sd->status.max_hp*5/100) > 100 ){ // 5% every 10 seconds [DracoRPG] - sd->status.hp -= sd->status.max_hp*5/100; // changed to max hp [celest] - clif_updatestatus(sd,SP_HP); - sc_data[type].timer = add_timer( /* タイマ?再設定 */ - 10000+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - break; - case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) - if(sd){ - time_t timer; - if(time(&timer) < ((sc_data[type].val2) + 3600)){ //1時間たっていないので?? - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - 10000+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - break; - case SC_NOCHAT: //チャット禁止?態 - if(sd && battle_config.muting_players){ - time_t timer; - if((++sd->status.manner) && time(&timer) < ((sc_data[type].val2) + 60*(0-sd->status.manner))){ //開始からstatus.manner分?ってないので?? - clif_updatestatus(sd,SP_MANNER); - sc_data[type].timer=add_timer( /* タイマ?再設定(60秒) */ - 60000+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - break; - case SC_SELFDESTRUCTION: /* 自爆 */ - if(--sc_data[type].val3>0){ - struct mob_data *md; - if(bl->type==BL_MOB && (md=(struct mob_data *)bl) && md->speed > 250){ - md->speed -= 250; - md->next_walktime=tick; - } - sc_data[type].timer=add_timer( /* タイマ?再設定 */ - 1000+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - break; - - case SC_SPLASHER: - if (sc_data[type].val4 % 1000 == 0) { - char timer[2]; - sprintf (timer, "%d", sc_data[type].val4/1000); - clif_message(bl, timer); - } - if((sc_data[type].val4 -= 500) > 0) { - sc_data[type].timer = add_timer( - 500 + tick, skill_status_change_timer, - bl->id, data); - return 0; - } - break; - case SC_MARIONETTE: /* マリオネットコントロ?ル */ - case SC_MARIONETTE2: - { - struct block_list *pbl = map_id2bl(sc_data[type].val3); - if (pbl && battle_check_range(bl, pbl, 7) && - (sc_data[type].val2 -= 1000)>0) { - sc_data[type].timer = add_timer( - 1000 + tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - break; - -/* case SC_LEADERSHIP: - case SC_GLORYWOUNDS: - case SC_SOULCOLD: - case SC_HAWKEYES: - if (sd) { - sc_data[type].timer = add_timer( - 1000+tick, skill_status_change_timer, - bl->id, data); - } - break;*/ - - // Celest - case SC_CONFUSION: - { - int i = 3000; - //struct mob_data *md; - if (sd) { - pc_randomwalk (sd, gettick()); - sd->next_walktime = tick + (i=1000 + rand()%1000); - } /*else if (bl->type==BL_MOB && (md=(struct mob_data *)bl) && md->mode&1 && mob_can_move(md)) { - md->state.state=MS_WALK; - if( DIFF_TICK(md->next_walktime,tick) > + 7000 && - (md->walkpath.path_len==0 || md->walkpath.path_pos>=md->walkpath.path_len) ) - md->next_walktime = tick + 3000*rand()%2000; - mob_randomwalk(md,tick); - }*/ - if ((sc_data[type].val2 -= 1000) > 0) { - sc_data[type].timer = add_timer( - i + tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - break; - - case SC_GOSPEL: - { - int calc_flag = 0; - if (sc_data[type].val3 > 0) { - sc_data[type].val3 = 0; - calc_flag = 1; - } - if(sd && sc_data[type].val4 == BCT_SELF){ - int hp, sp; - hp = (sc_data[type].val1 > 5) ? 45 : 30; - sp = (sc_data[type].val1 > 5) ? 35 : 20; - if(sd->status.hp - hp > 0 && - sd->status.sp - sp > 0){ - sd->status.hp -= hp; - sd->status.sp -= sp; - clif_updatestatus(sd,SP_HP); - clif_updatestatus(sd,SP_SP); - if ((sc_data[type].val2 -= 10000) > 0) { - sc_data[type].timer = add_timer( - 10000+tick, skill_status_change_timer, - bl->id, data); - return 0; - } - } - } else if (sd && sc_data[type].val4 == BCT_PARTY) { - int i; - switch ((i = rand() % 12)) { - case 1: // heal between 100-1000 - { - struct block_list tbl; - int heal = rand() % 900 + 100; - tbl.id = 0; - tbl.m = bl->m; - tbl.x = bl->x; - tbl.y = bl->y; - clif_skill_nodamage(&tbl,bl,AL_HEAL,heal,1); - battle_heal(NULL,bl,heal,0,0); - } - break; - case 2: // end negative status - { - int j; - for (j=0; j<4; j++) - if(sc_data[i + SC_POISON].timer!=-1) { - skill_status_change_end(bl,j,-1); - break; - } - } - break; - case 3: // +25% resistance to negative status - case 4: // +25% max hp - case 5: // +25% max sp - case 6: // +2 to all stats - case 11: // +25% armor and vit def - case 12: // +8% atk - case 13: // +5% flee - case 14: // +5% hit - sc_data[type].val3 = i; - if (i == 6 || - (i >= 11 && i <= 14)) - calc_flag = 1; - break; - case 7: // level 5 bless - { - struct block_list tbl; - tbl.id = 0; - tbl.m = bl->m; - tbl.x = bl->x; - tbl.y = bl->y; - clif_skill_nodamage(&tbl,bl,AL_BLESSING,5,1); - skill_status_change_start(bl,SkillStatusChangeTable[AL_BLESSING],5,0,0,0,10000,0 ); - } - break; - case 8: // level 5 increase agility - { - struct block_list tbl; - tbl.id = 0; - tbl.m = bl->m; - tbl.x = bl->x; - tbl.y = bl->y; - clif_skill_nodamage(&tbl,bl,AL_INCAGI,5,1); - skill_status_change_start(bl,SkillStatusChangeTable[AL_INCAGI],5,0,0,0,10000,0 ); - } - break; - case 9: // holy element to weapon - { - struct block_list tbl; - tbl.id = 0; - tbl.m = bl->m; - tbl.x = bl->x; - tbl.y = bl->y; - clif_skill_nodamage(&tbl,bl,PR_ASPERSIO,1,1); - skill_status_change_start(bl,SkillStatusChangeTable[PR_ASPERSIO],1,0,0,0,10000,0 ); - } - break; - case 10: // holy element to armour - { - struct block_list tbl; - tbl.id = 0; - tbl.m = bl->m; - tbl.x = bl->x; - tbl.y = bl->y; - clif_skill_nodamage(&tbl,bl,PR_BENEDICTIO,1,1); - skill_status_change_start(bl,SkillStatusChangeTable[PR_BENEDICTIO],1,0,0,0,10000,0 ); - } - break; - default: - break; - } - } else if (sc_data[type].val4 == BCT_ENEMY) { - int i; - switch ((i = rand() % 8)) { - case 1: // damage between 300-800 - case 2: // damage between 150-550 (ignore def) - battle_damage(NULL, bl, rand() % 500,0); // temporary damage - break; - case 3: // random status effect - { - int effect[3] = { - SC_CURSE, - SC_BLIND, - SC_POISON }; - skill_status_change_start(bl,effect[rand()%3],1,0,0,0,10000,0 ); - } - break; - case 4: // level 10 provoke - { - struct block_list tbl; - tbl.id = 0; - tbl.m = bl->m; - tbl.x = bl->x; - tbl.y = bl->y; - clif_skill_nodamage(&tbl,bl,SM_PROVOKE,1,1); - skill_status_change_start(bl,SkillStatusChangeTable[SM_PROVOKE],10,0,0,0,10000,0 ); - } - break; - case 5: // 0 def - case 6: // 0 atk - case 7: // 0 flee - case 8: // -75% move speed and aspd - sc_data[type].val3 = i; - calc_flag = 1; - break; - default: - break; - } - } - if (sd && calc_flag) - pc_calcstatus (sd, 0); - } - break; - } - - return skill_status_change_end( bl,type,tid ); -} - -/*========================================== - * ステ?タス異常終了 - *------------------------------------------ - */ -int skill_encchant_eremental_end(struct block_list *bl,int type) -{ - struct status_change *sc_data; - - nullpo_retr(0, bl); - nullpo_retr(0, sc_data=battle_get_sc_data(bl)); + nullpo_retr(0, bl); + nullpo_retr(0, sc_data=status_get_sc_data(bl)); if( type!=SC_ENCPOISON && sc_data[SC_ENCPOISON].timer!=-1 ) /* エンチャントポイズン解除 */ - skill_status_change_end(bl,SC_ENCPOISON,-1); + status_change_end(bl,SC_ENCPOISON,-1); if( type!=SC_ASPERSIO && sc_data[SC_ASPERSIO].timer!=-1 ) /* アスペルシオ解除 */ - skill_status_change_end(bl,SC_ASPERSIO,-1); + status_change_end(bl,SC_ASPERSIO,-1); if( type!=SC_FLAMELAUNCHER && sc_data[SC_FLAMELAUNCHER].timer!=-1 ) /* フレイムランチャ解除 */ - skill_status_change_end(bl,SC_FLAMELAUNCHER,-1); + status_change_end(bl,SC_FLAMELAUNCHER,-1); if( type!=SC_FROSTWEAPON && sc_data[SC_FROSTWEAPON].timer!=-1 ) /* フロストウェポン解除 */ - skill_status_change_end(bl,SC_FROSTWEAPON,-1); + status_change_end(bl,SC_FROSTWEAPON,-1); if( type!=SC_LIGHTNINGLOADER && sc_data[SC_LIGHTNINGLOADER].timer!=-1 ) /* ライトニングロ?ダ?解除 */ - skill_status_change_end(bl,SC_LIGHTNINGLOADER,-1); + status_change_end(bl,SC_LIGHTNINGLOADER,-1); if( type!=SC_SEISMICWEAPON && sc_data[SC_SEISMICWEAPON].timer!=-1 ) /* サイスミックウェポン解除 */ - skill_status_change_end(bl,SC_SEISMICWEAPON,-1); - - return 0; -} -/*========================================== - * ステ?タス異常開始 - *------------------------------------------ - */ -int skill_status_change_start(struct block_list *bl, int type, int val1, int val2, int val3, int val4, int tick, int flag) -{ - struct map_session_data *sd = NULL; - struct status_change* sc_data; - short *sc_count, *option, *opt1, *opt2, *opt3; - int opt_flag = 0, calc_flag = 0,updateflag = 0, save_flag = 0, race, mode, elem, undead_flag; - int scdef=0; - - nullpo_retr(0, bl); - if(bl->type == BL_SKILL) - return 0; - nullpo_retr(0, sc_data=battle_get_sc_data(bl)); - nullpo_retr(0, sc_count=battle_get_sc_count(bl)); - nullpo_retr(0, option=battle_get_option(bl)); - nullpo_retr(0, opt1=battle_get_opt1(bl)); - nullpo_retr(0, opt2=battle_get_opt2(bl)); - nullpo_retr(0, opt3=battle_get_opt3(bl)); - - - race=battle_get_race(bl); - mode=battle_get_mode(bl); - elem=battle_get_elem_type(bl); - undead_flag=battle_check_undead(race,elem); - - if(type == SC_AETERNA && (sc_data[SC_STONE].timer != -1 || sc_data[SC_FREEZE].timer != -1) ) - return 0; - - switch(type){ - case SC_STONE: - case SC_FREEZE: - scdef=3+battle_get_mdef(bl)+battle_get_luk(bl)/3; - break; - case SC_STAN: - case SC_SILENCE: - case SC_POISON: - case SC_DPOISON: - scdef=3+battle_get_vit(bl)+battle_get_luk(bl)/3; - break; - case SC_SLEEP: - case SC_BLIND: - scdef=3+battle_get_int(bl)+battle_get_luk(bl)/3; - break; - case SC_CURSE: - scdef=3+battle_get_luk(bl); - break; - -// case SC_CONFUSION: - default: - scdef=0; - } - if(scdef>=100) - return 0; - if(bl->type==BL_PC){ - sd=(struct map_session_data *)bl; - if( sd && type == SC_ADRENALINE && !(skill_get_weapontype(BS_ADRENALINE)&(1<status.weapon))) - return 0; - - if(SC_STONE<=type && type<=SC_BLIND){ /* カ?ドによる耐性 */ - if( sd && sd->reseff[type-SC_STONE] > 0 && rand()%10000reseff[type-SC_STONE]){ - if(battle_config.battle_log) - printf("PC %d skill_sc_start: cardによる異常耐性?動\n",sd->bl.id); - return 0; - } - } - } - else if(bl->type == BL_MOB) { - } - else { - if(battle_config.error_log) - printf("skill_status_change_start: neither MOB nor PC !\n"); - return 0; - } - - if(type==SC_FREEZE && undead_flag && !(flag&1)) - return 0; - - if((type == SC_ADRENALINE || type == SC_WEAPONPERFECTION || type == SC_OVERTHRUST) && - sc_data[type].timer != -1 && sc_data[type].val2 && !val2) - return 0; - - if(mode & 0x20 && (type==SC_STONE || type==SC_FREEZE || - type==SC_STAN || type==SC_SLEEP || type==SC_SILENCE || type==SC_QUAGMIRE || type == SC_DECREASEAGI || type == SC_SIGNUMCRUCIS || type == SC_PROVOKE || - (type == SC_BLESSING && (undead_flag || race == 6))) && !(flag&1)){ - /* ボスには?かない(ただしカ?ドによる?果は適用される) */ - return 0; - } - if(type==SC_FREEZE || type==SC_STAN || type==SC_SLEEP) - battle_stopwalking(bl,1); - - if(sc_data[type].timer != -1){ /* すでに同じ異常になっている場合タイマ解除 */ - if(sc_data[type].val1 > val1 && type != SC_COMBO && type != SC_DANCING && type != SC_DEVOTION && - type != SC_SPEEDPOTION0 && type != SC_SPEEDPOTION1 && type != SC_SPEEDPOTION2 && type != SC_SPEEDPOTION3 - && type != SC_ATKPOT && type != SC_MATKPOT) // added atk and matk potions [Valaris] - return 0; - if ((type >=SC_STAN && type <= SC_BLIND) || type == SC_DPOISON) - return 0;/* ?ぎ足しができない?態異常である時は?態異常を行わない */ - if(type == SC_GRAFFITI){ //異常中にもう一度?態異常になった時に解除してから再度かかる - skill_status_change_end(bl,type,-1); - } else { - (*sc_count)--; - delete_timer(sc_data[type].timer, skill_status_change_timer); - sc_data[type].timer = -1; - } - } - - switch(type){ /* 異常の種類ごとの?理 */ - case SC_PROVOKE: /* プロボック */ - calc_flag = 1; - if(tick <= 0) tick = 1000; /* (オ?トバ?サ?ク) */ - break; - case SC_ENDURE: /* インデュア */ - if(tick <= 0) tick = 1000 * 60; - calc_flag = 1; // for updating mdef - val2 = 7; // [Celest] - break; - case SC_AUTOBERSERK: - { - tick = 60*1000; - if (bl->type == BL_PC && sd->status.hpstatus.max_hp>>2 && - (sc_data[SC_PROVOKE].timer==-1 || sc_data[SC_PROVOKE].val2==0)) - skill_status_change_start(bl,SC_PROVOKE,10,1,0,0,0,0); - } - break; - case SC_CONCENTRATE: /* 集中力向上 */ - calc_flag = 1; - break; - case SC_BLESSING: /* ブレッシング */ - { - if(bl->type == BL_PC || (!undead_flag && race != 6)) { - if(sc_data[SC_CURSE].timer!=-1 ) - skill_status_change_end(bl,SC_CURSE,-1); - if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2 == 0) - skill_status_change_end(bl,SC_STONE,-1); - } - calc_flag = 1; - } - break; - case SC_ANGELUS: /* アンゼルス */ - calc_flag = 1; - break; - case SC_INCREASEAGI: /* 速度上昇 */ - calc_flag = 1; - if(sc_data[SC_DECREASEAGI].timer!=-1 ) - skill_status_change_end(bl,SC_DECREASEAGI,-1); - // the effect will still remain [celest] -// if(sc_data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */ -// skill_status_change_end(bl,SC_WINDWALK,-1); - break; - case SC_DECREASEAGI: /* 速度減少 */ - if (bl->type == BL_PC) // Celest - tick>>=1; - calc_flag = 1; - if(sc_data[SC_INCREASEAGI].timer!=-1 ) - skill_status_change_end(bl,SC_INCREASEAGI,-1); - if(sc_data[SC_ADRENALINE].timer!=-1 ) - skill_status_change_end(bl,SC_ADRENALINE,-1); - if(sc_data[SC_SPEARSQUICKEN].timer!=-1 ) - skill_status_change_end(bl,SC_SPEARSQUICKEN,-1); - if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 ) - skill_status_change_end(bl,SC_TWOHANDQUICKEN,-1); - break; - case SC_SIGNUMCRUCIS: /* シグナムクルシス */ - calc_flag = 1; -// val2 = 14 + val1; - val2 = 10 + val1*2; - tick = 600*1000; - clif_emotion(bl,4); - break; - case SC_SLOWPOISON: - if (sc_data[SC_POISON].timer == -1 && sc_data[SC_DPOISON].timer == -1) - return 0; - break; - case SC_TWOHANDQUICKEN: /* 2HQ */ - if(sc_data[SC_DECREASEAGI].timer!=-1) - return 0; - *opt3 |= 1; - calc_flag = 1; - break; - case SC_ADRENALINE: /* アドレナリンラッシュ */ - if(sc_data[SC_DECREASEAGI].timer!=-1) - return 0; - calc_flag = 1; - break; - case SC_WEAPONPERFECTION: /* ウェポンパ?フェクション */ - // Lasting time penalties have been removed on sakray as of 12/14 [celest] - //if(battle_config.party_skill_penalty && !val2) tick /= 5; - break; - case SC_OVERTHRUST: /* オ?バ?スラスト */ - *opt3 |= 2; - // Lasting time penalties have been removed on sakray as of 12/14 [celest] - //if(battle_config.party_skill_penalty && !val2) tick /= 10; - break; - case SC_MAXIMIZEPOWER: /* マキシマイズパワ?(SPが1減る時間,val2にも) */ - if(bl->type == BL_PC) - val2 = tick; - else - tick = 5000*val1; - break; - case SC_ENCPOISON: /* エンチャントポイズン */ - calc_flag = 1; - val2=(((val1 - 1) / 2) + 3)*100; /* 毒付?確率 */ - skill_encchant_eremental_end(bl,SC_ENCPOISON); - break; - case SC_EDP: // [Celest] - val2 = val1 + 2; /* 猛毒付?確率(%) */ - calc_flag = 1; - break; - case SC_POISONREACT: /* ポイズンリアクト */ - val2=val1/2 + val1%2; // [Celest] - break; - case SC_IMPOSITIO: /* インポシティオマヌス */ - calc_flag = 1; - break; - case SC_ASPERSIO: /* アスペルシオ */ - skill_encchant_eremental_end(bl,SC_ASPERSIO); - break; - case SC_SUFFRAGIUM: /* サフラギム */ - case SC_BENEDICTIO: /* 聖? */ - case SC_MAGNIFICAT: /* マグニフィカ?ト */ - case SC_AETERNA: /* エ?テルナ */ - break; - case SC_ENERGYCOAT: /* エナジ?コ?ト */ - *opt3 |= 4; - break; - case SC_MAGICROD: - val2 = val1*20; - break; - case SC_KYRIE: /* キリエエレイソン */ - val2 = battle_get_max_hp(bl) * (val1 * 2 + 10) / 100;/* 耐久度 */ - val3 = (val1 / 2 + 5); /* 回? */ -// -- moonsoul (added to undo assumptio status if target has it) - if(sc_data[SC_ASSUMPTIO].timer!=-1 ) - skill_status_change_end(bl,SC_ASSUMPTIO,-1); - break; - case SC_MINDBREAKER: - calc_flag = 1; - if(tick <= 0) tick = 1000; /* (オ?トバ?サ?ク) */ - case SC_GLORIA: /* グロリア */ - calc_flag = 1; - break; - case SC_LOUD: /* ラウドボイス */ - calc_flag = 1; - break; - case SC_TRICKDEAD: /* 死んだふり */ - if (bl->type == BL_PC) { - pc_stopattack((struct map_session_data *)sd); - } - break; - case SC_QUAGMIRE: /* クァグマイア */ - calc_flag = 1; - if(sc_data[SC_CONCENTRATE].timer!=-1 ) /* 集中力向上解除 */ - skill_status_change_end(bl,SC_CONCENTRATE,-1); - if(sc_data[SC_INCREASEAGI].timer!=-1 ) /* 速度上昇解除 */ - skill_status_change_end(bl,SC_INCREASEAGI,-1); - if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 ) - skill_status_change_end(bl,SC_TWOHANDQUICKEN,-1); - if(sc_data[SC_SPEARSQUICKEN].timer!=-1 ) - skill_status_change_end(bl,SC_SPEARSQUICKEN,-1); - if(sc_data[SC_ADRENALINE].timer!=-1 ) - skill_status_change_end(bl,SC_ADRENALINE,-1); - if(sc_data[SC_LOUD].timer!=-1 ) - skill_status_change_end(bl,SC_LOUD,-1); - if(sc_data[SC_TRUESIGHT].timer!=-1 ) /* トゥル?サイト */ - skill_status_change_end(bl,SC_TRUESIGHT,-1); - if(sc_data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */ - skill_status_change_end(bl,SC_WINDWALK,-1); - if(sc_data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */ - skill_status_change_end(bl,SC_CARTBOOST,-1); - break; - case SC_MAGICPOWER: - calc_flag = 1; - val2 = 1; - break; - case SC_SACRIFICE: - val2 = 5; - break; - case SC_FLAMELAUNCHER: /* フレ?ムランチャ? */ - skill_encchant_eremental_end(bl,SC_FLAMELAUNCHER); - break; - case SC_FROSTWEAPON: /* フロストウェポン */ - skill_encchant_eremental_end(bl,SC_FROSTWEAPON); - break; - case SC_LIGHTNINGLOADER: /* ライトニングロ?ダ? */ - skill_encchant_eremental_end(bl,SC_LIGHTNINGLOADER); - break; - case SC_SEISMICWEAPON: /* サイズミックウェポン */ - skill_encchant_eremental_end(bl,SC_SEISMICWEAPON); - break; - case SC_DEVOTION: /* ディボ?ション */ - calc_flag = 1; - break; - case SC_PROVIDENCE: /* プロヴィデンス */ - calc_flag = 1; - val2=val1*5; - break; - case SC_REFLECTSHIELD: - val2=10+val1*3; - break; - case SC_STRIPWEAPON: - if (val2==0) val2=90; - break; - case SC_STRIPSHIELD: - if (val2==0) val2=85; - break; - case SC_STRIPARMOR: - case SC_STRIPHELM: - case SC_CP_WEAPON: - case SC_CP_SHIELD: - case SC_CP_ARMOR: - case SC_CP_HELM: - break; - - case SC_AUTOSPELL: /* オ?トスペル */ - val4 = 5 + val1*2; - break; - - case SC_VOLCANO: - calc_flag = 1; - val3 = val1*10; - val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) ); - break; - case SC_DELUGE: - calc_flag = 1; - val3 = val1>=5?15: (val1==4?14: (val1==3?12: ( val1==2?9:5 ) ) ); - val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) ); - break; - case SC_VIOLENTGALE: - calc_flag = 1; - val3 = val1*3; - val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) ); - break; - - case SC_SPEARSQUICKEN: /* スピアクイッケン */ - calc_flag = 1; - val2 = 20+val1; - *opt3 |= 1; - break; - case SC_COMBO: - break; - case SC_BLADESTOP_WAIT: /* 白刃取り(待ち) */ - break; - case SC_BLADESTOP: /* 白刃取り */ - if(val2==2) clif_bladestop((struct block_list *)val3,(struct block_list *)val4,1); - *opt3 |= 32; - break; - - case SC_LULLABY: /* 子守唄 */ - val2 = 11; - break; - case SC_RICHMANKIM: - break; - case SC_ETERNALCHAOS: /* エタ?ナルカオス */ - calc_flag = 1; - break; - case SC_DRUMBATTLE: /* ?太鼓の響き */ - calc_flag = 1; - val2 = (val1+1)*25; - val3 = (val1+1)*2; - break; - case SC_NIBELUNGEN: /* ニ?ベルングの指輪 */ - calc_flag = 1; - //val2 = (val1+2)*50; - val3 = (val1+2)*25; - break; - case SC_ROKISWEIL: /* ロキの叫び */ - break; - case SC_INTOABYSS: /* 深淵の中に */ - break; - case SC_SIEGFRIED: /* 不死身のジ?クフリ?ド */ - calc_flag = 1; - val2 = 55 + val1*5; - val3 = val1*10; - break; - case SC_DISSONANCE: /* 不協和音 */ - val2 = 10; - break; - case SC_WHISTLE: /* 口笛 */ - calc_flag = 1; - break; - case SC_ASSNCROS: /* 夕陽のアサシンクロス */ - calc_flag = 1; - break; - case SC_POEMBRAGI: /* ブラギの詩 */ - break; - case SC_APPLEIDUN: /* イドゥンの林檎 */ - calc_flag = 1; - break; - case SC_UGLYDANCE: /* 自分勝手なダンス */ - val2 = 10; - break; - case SC_HUMMING: /* ハミング */ - calc_flag = 1; - break; - case SC_DONTFORGETME: /* 私を忘れないで */ - calc_flag = 1; - if(sc_data[SC_INCREASEAGI].timer!=-1 ) /* 速度上昇解除 */ - skill_status_change_end(bl,SC_INCREASEAGI,-1); - if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 ) - skill_status_change_end(bl,SC_TWOHANDQUICKEN,-1); - if(sc_data[SC_SPEARSQUICKEN].timer!=-1 ) - skill_status_change_end(bl,SC_SPEARSQUICKEN,-1); - if(sc_data[SC_ADRENALINE].timer!=-1 ) - skill_status_change_end(bl,SC_ADRENALINE,-1); - if(sc_data[SC_ASSNCROS].timer!=-1 ) - skill_status_change_end(bl,SC_ASSNCROS,-1); - if(sc_data[SC_TRUESIGHT].timer!=-1 ) /* トゥル?サイト */ - skill_status_change_end(bl,SC_TRUESIGHT,-1); - if(sc_data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */ - skill_status_change_end(bl,SC_WINDWALK,-1); - if(sc_data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */ - skill_status_change_end(bl,SC_CARTBOOST,-1); - break; - case SC_FORTUNE: /* 幸運のキス */ - calc_flag = 1; - break; - case SC_SERVICE4U: /* サ?ビスフォ?ユ? */ - calc_flag = 1; - break; - case SC_MOONLIT: - val2 = bl->id; - break; - case SC_DANCING: /* ダンス/演奏中 */ - calc_flag = 1; - val3= tick / 1000; - tick = 1000; - break; - - case SC_EXPLOSIONSPIRITS: // 爆裂波動 - calc_flag = 1; - val2 = 75 + 25*val1; - *opt3 |= 8; - break; - case SC_STEELBODY: // 金剛 - calc_flag = 1; - *opt3 |= 16; - break; - case SC_EXTREMITYFIST: /* 阿修羅覇凰拳 */ - break; - case SC_AUTOCOUNTER: - val3 = val4 = 0; - break; - - case SC_SPEEDPOTION0: /* ?速ポ?ション */ - case SC_SPEEDPOTION1: - case SC_SPEEDPOTION2: - case SC_SPEEDPOTION3: - calc_flag = 1; - tick = 1000 * tick; - val2 = 5*(2+type-SC_SPEEDPOTION0); - break; - - /* atk & matk potions [Valaris] */ - case SC_ATKPOT: - case SC_MATKPOT: - calc_flag = 1; - tick = 1000 * tick; - break; - case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) - { - time_t timer; - - calc_flag = 1; - tick = 10000; - if(!val2) - val2 = time(&timer); - } - break; - case SC_NOCHAT: //チャット禁止?態 - { - time_t timer; - - if(!battle_config.muting_players) - break; - - tick = 60000; - if(!val2) - val2 = time(&timer); - updateflag = SP_MANNER; - save_flag = 1; // celest - } - break; - case SC_SELFDESTRUCTION: //自爆 - clif_skillcasting(bl,bl->id, bl->id,0,0,331,skill_get_time(val2,val1)); - val3 = tick / 1000; - tick = 1000; - break; - - /* option1 */ - case SC_STONE: /* 石化 */ - if(!(flag&2)) { - int sc_def = battle_get_mdef(bl)*200; - tick = tick - sc_def; - } - val3 = tick/1000; - if(val3 < 1) val3 = 1; - tick = 5000; - val2 = 1; - break; - case SC_SLEEP: /* 睡眠 */ - if(!(flag&2)) { -// int sc_def = 100 - (battle_get_int(bl) + battle_get_luk(bl)/3); -// tick = tick * sc_def / 100; -// if(tick < 1000) tick = 1000; - tick = 30000;//睡眠はステ?タス耐性に?わらず30秒 - } - break; - case SC_FREEZE: /* 凍結 */ - if(!(flag&2)) { - int sc_def = 100 - battle_get_mdef(bl); - tick = tick * sc_def / 100; - } - break; - case SC_STAN: /* スタン(val2にミリ秒セット) */ - if(!(flag&2)) { - int sc_def = 100 - (battle_get_vit(bl) + battle_get_luk(bl)/3); - tick = tick * sc_def / 100; - } - break; - - /* option2 */ - case SC_DPOISON: /* 猛毒 */ - { - int mhp = battle_get_max_hp(bl); - int hp = battle_get_hp(bl); - // MHP?1/4???????? - if (hp > mhp>>2) { - if(bl->type == BL_PC) { - int diff = mhp*10/100; - if (hp - diff < mhp>>2) - hp = hp - (mhp>>2); - pc_heal((struct map_session_data *)bl, -hp, 0); - } else if(bl->type == BL_MOB) { - struct mob_data *md = (struct mob_data *)bl; - hp -= mhp*15/100; - if (hp > mhp>>2) - md->hp = hp; - else - md->hp = mhp>>2; - } - } - } // fall through - case SC_POISON: /* 毒 */ - calc_flag = 1; - if(!(flag&2)) { - int sc_def = 100 - (battle_get_vit(bl) + battle_get_luk(bl)/5); - tick = tick * sc_def / 100; - } - val3 = tick/1000; - if(val3 < 1) val3 = 1; - tick = 1000; - break; - case SC_SILENCE: /* 沈?(レックスデビ?ナ) */ - if(!(flag&2)) { - int sc_def = 100 - battle_get_vit(bl); - tick = tick * sc_def / 100; - } - break; - case SC_CONFUSION: - val2 = tick; - tick = 100; - clif_emotion(bl,1); - if (sd) { - pc_stop_walking (sd, 0); - } - break; - case SC_BLIND: /* 暗? */ - calc_flag = 1; - if(!(flag&2)) { - int sc_def = battle_get_lv(bl)/10 + battle_get_int(bl)/15; - tick = 30000 - sc_def; - } - break; - case SC_CURSE: - calc_flag = 1; - if(!(flag&2)) { - int sc_def = 100 - battle_get_vit(bl); - tick = tick * sc_def / 100; - } - break; - - /* option */ - case SC_HIDING: /* ハイディング */ - calc_flag = 1; - if(bl->type == BL_PC) { - val2 = tick / 1000; /* 持?時間 */ - tick = 1000; - } - break; - case SC_CHASEWALK: - case SC_CLOAKING: /* クロ?キング */ - if(bl->type == BL_PC) { - calc_flag = 1; // [Celest] - val2 = tick; - val3 = type==SC_CLOAKING ? 130-val1*3 : 135-val1*5; - } - else - tick = 5000*val1; - break; - case SC_SIGHT: /* サイト/ルアフ */ - case SC_RUWACH: - val2 = tick/250; - tick = 10; - break; - - /* セ?フティウォ?ル、ニュ?マ */ - case SC_SAFETYWALL: case SC_PNEUMA: - tick=((struct skill_unit *)val2)->group->limit; - break; - - /* アンクル */ - case SC_ANKLE: - break; - - /* ウォ?タ?ボ?ル */ - case SC_WATERBALL: - tick=150; - if(val1>5) //レベルが5以上の場合は25?に制限(1?目はすでに打ってるので-1) - val3=5*5-1; - else - val3= (val1|1)*(val1|1)-1; - break; - - /* スキルじゃない/時間に?係しない */ - case SC_RIDING: - calc_flag = 1; - tick = 600*1000; - break; - case SC_FALCON: - case SC_WEIGHT50: - case SC_WEIGHT90: - case SC_BROKNWEAPON: - case SC_BROKNARMOR: - tick=600*1000; - break; - - case SC_AUTOGUARD: - { - int i,t; - for(i=val2=0;i>1); - val2 += (t < 0)? 1:t; - } - } - break; - - case SC_DEFENDER: - calc_flag = 1; - val2 = 5 + val1*15; - break; - - case SC_KEEPING: - case SC_BARRIER: - calc_flag = 1; - - case SC_HALLUCINATION: - break; - - case SC_CONCENTRATION: /* コンセントレ?ション */ - *opt3 |= 1; - calc_flag = 1; - break; - - case SC_TENSIONRELAX: /* テンションリラックス */ - calc_flag = 1; - if(bl->type == BL_PC) { - tick = 10000; - } - break; - - case SC_AURABLADE: /* オ?ラブレ?ド */ - case SC_PARRYING: /* パリイング */ -// case SC_ASSUMPTIO: /* */ - case SC_HEADCRUSH: /* ヘッドクラッシュ */ - case SC_JOINTBEAT: /* ジョイントビ?ト */ -// case SC_MARIONETTE: /* マリオネットコントロ?ル */ - - //とりあえず手?き - break; - -// -- moonsoul (for new upper class related skill status effects) -/* - case SC_AURABLADE: - val2 = val1*10; - break; - case SC_PARRYING: - val2=val1*3; - break; - case SC_CONCENTRATION: - calc_flag=1; - val2=val1*10; - val3=val1*5; - break; - case SC_TENSIONRELAX: -// val2 = 10; -// val3 = 15; - break; - case SC_BERSERK: - calc_flag=1; - break; - case SC_ASSUMPTIO: - if(sc_data[SC_KYRIE].timer!=-1 ) - skill_status_change_end(bl,SC_KYRIE,-1); - break;*/ - - case SC_WINDWALK: /* ウインドウォ?ク */ - calc_flag = 1; - val2 = (val1 / 2); //Flee上昇率 - break; - - case SC_BERSERK: /* バ?サ?ク */ - if(sd){ - sd->status.hp = sd->status.max_hp * 3; - sd->status.sp = 0; - clif_updatestatus(sd,SP_HP); - clif_updatestatus(sd,SP_SP); - clif_status_change(bl,SC_INCREASEAGI,1); /* アイコン表示 */ - sd->canregen_tick = gettick() + 300000; - } - *opt3 |= 128; - tick = 10000; - calc_flag = 1; - break; - - case SC_ASSUMPTIO: /* アスムプティオ */ - if(sc_data[SC_KYRIE].timer!=-1 ) - skill_status_change_end(bl,SC_KYRIE,-1); - break; - *opt3 |= 2048; - break; - - case SC_BASILICA: // [celest] - break; - - case SC_GOSPEL: - if (val4 == BCT_SELF) { // self effect - int i; - if (sd) { - sd->canact_tick += tick; - sd->canmove_tick += tick; - } - val2 = tick; - tick = 1000; - for (i=0; i<=26; i++) { - if(sc_data[i].timer!=-1) - skill_status_change_end(bl,i,-1); - } - for (i=58; i<=62; i++) { - if(sc_data[i].timer!=-1) - skill_status_change_end(bl,i,-1); - } - for (i=132; i<=136; i++) { - if(sc_data[i].timer!=-1) - skill_status_change_end(bl,i,-1); - } - } - break; - - case SC_MARIONETTE: /* マリオネットコントロ?ル */ - case SC_MARIONETTE2: - val2 = tick; - if (!val3) - return 0; - tick = 1000; - calc_flag = 1; - *opt3 |= 1024; - break; - - case SC_MELTDOWN: /* メルトダウン */ - case SC_CARTBOOST: /* カ?トブ?スト */ - case SC_TRUESIGHT: /* トゥル?サイト */ - case SC_SPIDERWEB: /* スパイダ?ウェッブ */ - calc_flag = 1; - break; - - case SC_REJECTSWORD: /* リジェクトソ?ド */ - val2 = 3; //3回攻?を跳ね返す - break; - - case SC_MEMORIZE: /* メモライズ */ - val2 = 3; //3回詠唱を1/3にする - break; - - case SC_GRAFFITI: /* グラフィティ */ - { - struct skill_unit_group *sg = skill_unitsetting(bl,RG_GRAFFITI,val1,val2,val3,0); - if(sg) - val4 = (int)sg; - } - break; - - case SC_SPLASHER: /* ベナムスプラッシャ? */ - break; - - case SC_FOGWALL: - val2 = 75; - // calc_flag = 1; // not sure of effects yet [celest] - break; - - case SC_PRESERVE: - break; - - case SC_BLOCKSKILL: - if (!tick) tick = 60000; - if (!val3) val3 = -1; - break; - - case SC_SLOWDOWN: - case SC_SPEEDUP0: - calc_flag = 1; - break; - - case SC_REGENERATION: - val1 = 2; - case SC_BATTLEORDERS: - tick = 60000; // 1 minute - calc_flag = 1; - break; - - default: - if(battle_config.error_log) - printf("UnknownStatusChange [%d]\n", type); - return 0; - } - - if(bl->type==BL_PC && - (typeid, type); - - if(bl->type==BL_PC && calc_flag) - pc_calcstatus(sd,0); /* ステ?タス再計算 */ - - if(bl->type==BL_PC && save_flag) - chrif_save(sd); // save the player status - - if(bl->type==BL_PC && updateflag) - clif_updatestatus(sd,updateflag); /* ステ?タスをクライアントに送る */ - - return 0; -} -/*========================================== - * ステ?タス異常全解除 - *------------------------------------------ - */ -int skill_status_change_clear(struct block_list *bl, int type) -{ - struct status_change* sc_data; - short *sc_count, *option, *opt1, *opt2, *opt3; - int i; - - nullpo_retr(0, bl); - nullpo_retr(0, sc_data = battle_get_sc_data(bl)); - nullpo_retr(0, sc_count = battle_get_sc_count(bl)); - nullpo_retr(0, option = battle_get_option(bl)); - nullpo_retr(0, opt1 = battle_get_opt1(bl)); - nullpo_retr(0, opt2 = battle_get_opt2(bl)); - nullpo_retr(0, opt3 = battle_get_opt3(bl)); - - if (*sc_count == 0) - return 0; - for(i = 0; i < MAX_STATUSCHANGE; i++){ - if(sc_data[i].timer != -1){ /* 異常があるならタイマ?を削除する */ - skill_status_change_end(bl, i, -1); - } - } - *sc_count = 0; - *opt1 = 0; - *opt2 = 0; - *opt3 = 0; - *option &= OPTION_MASK; - - if (night_flag == 1 && type == BL_PC && !map[bl->m].flag.indoors && // by [Yor] - !map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) // [celest] - *opt2 |= STATE_BLIND; - - if(!type || type&2) - clif_changeoption(bl); + status_change_end(bl,SC_SEISMICWEAPON,-1); return 0; } @@ -10663,18 +8717,18 @@ int skill_check_cloaking(struct block_list *bl) } if(end){ if ((bl->type == BL_PC && pc_checkskill(sd,AS_CLOAKING)<3) || bl->type == BL_MOB) { - skill_status_change_end(bl, SC_CLOAKING, -1); - *battle_get_option(bl)&=~4; /* 念のための?理 */ + status_change_end(bl, SC_CLOAKING, -1); + *status_get_option(bl)&=~4; /* 念のための?理 */ } else if (bl->type == BL_PC && sd->sc_data[SC_CLOAKING].val3 != 130) { sd->sc_data[SC_CLOAKING].val3 = 130; - pc_calcspeed (sd); + status_calc_speed (sd); } } else { if (bl->type == BL_PC && sd->sc_data[SC_CLOAKING].val3 != 103) { sd->sc_data[SC_CLOAKING].val3 = 103; - pc_calcspeed (sd); + status_calc_speed (sd); } } return end; @@ -10760,8 +8814,8 @@ void skill_stop_dancing(struct block_list *src, int flag) short* sc_count; nullpo_retv(src); - nullpo_retv(sc_data = battle_get_sc_data(src)); - nullpo_retv(sc_count = battle_get_sc_count(src)); + nullpo_retv(sc_data = status_get_sc_data(src)); + nullpo_retv(sc_count = status_get_sc_count(src)); if((*sc_count)>0 && sc_data[SC_DANCING].timer != -1) { group=(struct skill_unit_group *)sc_data[SC_DANCING].val2; //ダンスのスキルユニットIDはval2に入ってる @@ -10780,15 +8834,15 @@ void skill_stop_dancing(struct block_list *src, int flag) if(flag&2) //ハエ飛びなど return; //合奏もダンス?態も終了させない&スキルユニットは置いてけぼり } - skill_status_change_end(src,SC_DANCING,-1);//自分のステ?タスを終了させる + status_change_end(src,SC_DANCING,-1);//自分のステ?タスを終了させる //そしてグル?プは消さない&消さないのでステ?タス計算もいらない? return; }else{ if(dsd && src->id == group->src_id){ //グル?プを持ってるPCが止める - skill_status_change_end((struct block_list *)dsd,SC_DANCING,-1);//相手のステ?タスを終了させる + status_change_end((struct block_list *)dsd,SC_DANCING,-1);//相手のステ?タスを終了させる } if(dsd && dsd->bl.id == group->src_id){ //相方がグル?プを持っているPCが止める(自分はグル?プを持っていない) - skill_status_change_end(src,SC_DANCING,-1);//自分のステ?タスを終了させる + status_change_end(src,SC_DANCING,-1);//自分のステ?タスを終了させる } } } @@ -10799,7 +8853,7 @@ void skill_stop_dancing(struct block_list *src, int flag) } skill_delunitgroup(group); if(src->type==BL_PC) - pc_calcstatus((struct map_session_data *)src,0); + status_calc_pc((struct map_session_data *)src,0); } } @@ -10917,8 +8971,8 @@ struct skill_unit_group *skill_initunitgroup(struct block_list *src, } group->src_id=src->id; - group->party_id=battle_get_party_id(src); - group->guild_id=battle_get_guild_id(src); + group->party_id=status_get_party_id(src); + group->guild_id=status_get_guild_id(src); group->group_id=skill_unit_group_newid++; if(skill_unit_group_newid<=0) skill_unit_group_newid=10; @@ -10941,7 +8995,7 @@ struct skill_unit_group *skill_initunitgroup(struct block_list *src, sd->skillid_dance=skillid; sd->skilllv_dance=skilllv; } - skill_status_change_start(src,SC_DANCING,skillid,(int)group,0,0,skill_get_time(skillid,skilllv)+1000,0); + status_change_start(src,SC_DANCING,skillid,(int)group,0,0,skill_get_time(skillid,skilllv)+1000,0); switch(skillid){ //合奏スキルは相方をダンス?態にする case BD_LULLABY: /* 子守歌 */ case BD_RICHMANKIM: /* ニヨルドの宴 */ @@ -10983,7 +9037,7 @@ int skill_delunitgroup(struct skill_unit_group *group) src=map_id2bl(group->src_id); if( skill_is_danceskill(group->skill_id) ){ //ダンススキルはダンス?態を解除する if(src) - skill_status_change_end(src,SC_DANCING,-1); + status_change_end(src,SC_DANCING,-1); } group->alive_count=0; @@ -12382,7 +10436,6 @@ int do_init_skill(void) add_timer_func_list(skill_castend_id,"skill_castend_id"); add_timer_func_list(skill_castend_pos,"skill_castend_pos"); add_timer_func_list(skill_timerskill,"skill_timerskill"); - add_timer_func_list(skill_status_change_timer,"skill_status_change_timer"); add_timer_interval(gettick()+SKILLUNITTIMER_INVERVAL,skill_unit_timer,0,0,SKILLUNITTIMER_INVERVAL); return 0; diff --git a/src/map/skill.h b/src/map/skill.h index 44ea5ca22..9187b0d67 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -145,7 +145,7 @@ void skill_devotion2(struct block_list *bl,int crusader); int skill_devotion3(struct block_list *bl,int target); void skill_devotion_end(struct map_session_data *md,struct map_session_data *sd,int target); -#define skill_calc_heal(bl,skill_lv) (( battle_get_lv(bl)+battle_get_int(bl) )/8 *(4+ skill_lv*8)) +#define skill_calc_heal(bl,skill_lv) (( status_get_lv(bl)+status_get_int(bl) )/8 *(4+ skill_lv*8)) // その他 int skill_check_cloaking(struct block_list *bl); @@ -153,11 +153,7 @@ int skill_type_cloaking(struct block_list *bl); int skill_is_danceskill(int id); // ステ?タス異常 -int skill_status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag); -int skill_status_change_timer(int tid, unsigned int tick, int id, int data); int skill_encchant_eremental_end(struct block_list *bl, int type); -int skill_status_change_end( struct block_list* bl , int type,int tid ); -int skill_status_change_clear(struct block_list *bl,int type); int skillnotok(int skillid, struct map_session_data *sd); // アイテム作成 diff --git a/src/map/status.c b/src/map/status.c new file mode 100644 index 000000000..f3c022fe0 --- /dev/null +++ b/src/map/status.c @@ -0,0 +1,4699 @@ + +// ステータス計算、状態異常処理 +#include +#include +#include +#include +#include + +#include "pc.h" +#include "map.h" +#include "pet.h" +#include "mob.h" +#include "clif.h" +#include "guild.h" +#include "skill.h" +#include "itemdb.h" +#include "battle.h" +#include "chrif.h" +#include "status.h" + +#include "timer.h" +#include "nullpo.h" +#include "script.h" +#include "showmsg.h" + +static int max_weight_base[MAX_PC_CLASS]; +static int hp_coefficient[MAX_PC_CLASS]; +static int hp_coefficient2[MAX_PC_CLASS]; +static int hp_sigma_val[MAX_PC_CLASS][MAX_LEVEL]; +static int sp_coefficient[MAX_PC_CLASS]; +static int aspd_base[MAX_PC_CLASS][20]; +static int refinebonus[5][3]; // 精錬ボーナステーブル(refine_db.txt) +int percentrefinery[5][10]; // 精錬成功率(refine_db.txt) +static int atkmods[3][20]; // 武器ATKサイズ修正(size_fix.txt) +static char job_bonus[3][MAX_PC_CLASS][MAX_LEVEL]; + +/*========================================== + * 精錬ボーナス + *------------------------------------------ + */ +int status_getrefinebonus(int lv,int type) +{ + if (lv >= 0 && lv < 5 && type >= 0 && type < 3) + return refinebonus[lv][type]; + return 0; +} + +/*========================================== + * 精錬成功率 + *------------------------------------------ + */ +int status_percentrefinery(struct map_session_data *sd,struct item *item) +{ + int percent; + + nullpo_retr(0, item); + percent=percentrefinery[itemdb_wlv(item->nameid)][(int)item->refine]; + + percent += pc_checkskill(sd,BS_WEAPONRESEARCH); // 武器研究スキル所持 + + // 確率の有効範囲チェック + if( percent > 100 ){ + percent = 100; + } + if( percent < 0 ){ + percent = 0; + } + + return percent; +} + +/*========================================== + * パラメータ計算 + * first==0の時、計算対象のパラメータが呼び出し前から + * 変 化した場合自動でsendするが、 + * 能動的に変化させたパラメータは自前でsendするように + *------------------------------------------ + */ + +int status_calc_pc(struct map_session_data* sd,int first) +{ + int b_speed,b_max_hp,b_max_sp,b_hp,b_sp,b_weight,b_max_weight,b_paramb[6],b_parame[6],b_hit,b_flee; + int b_aspd,b_watk,b_def,b_watk2,b_def2,b_flee2,b_critical,b_attackrange,b_matk1,b_matk2,b_mdef,b_mdef2,b_class; + int b_base_atk; + struct skill b_skill[MAX_SKILL]; + int i,bl,index; + int skill,aspd_rate,wele,wele_,def_ele,refinedef=0; + int pele=0,pdef_ele=0; + int str,dstr,dex; + struct pc_base_job s_class; + + nullpo_retr(0, sd); + + //?生や養子の場合の元の職業を算出する + s_class = pc_calc_base_job(sd->status.class_); + + b_speed = sd->speed; + b_max_hp = sd->status.max_hp; + b_max_sp = sd->status.max_sp; + b_hp = sd->status.hp; + b_sp = sd->status.sp; + b_weight = sd->weight; + b_max_weight = sd->max_weight; + memcpy(b_paramb,&sd->paramb,sizeof(b_paramb)); + memcpy(b_parame,&sd->paramc,sizeof(b_parame)); + memcpy(b_skill,&sd->status.skill,sizeof(b_skill)); + b_hit = sd->hit; + b_flee = sd->flee; + b_aspd = sd->aspd; + b_watk = sd->watk; + b_def = sd->def; + b_watk2 = sd->watk2; + b_def2 = sd->def2; + b_flee2 = sd->flee2; + b_critical = sd->critical; + b_attackrange = sd->attackrange; + b_matk1 = sd->matk1; + b_matk2 = sd->matk2; + b_mdef = sd->mdef; + b_mdef2 = sd->mdef2; + b_class = sd->view_class; + sd->view_class = sd->status.class_; + b_base_atk = sd->base_atk; + + pc_calc_skilltree(sd); // スキルツリ?の計算 + + sd->max_weight = max_weight_base[s_class.job]+sd->status.str*300; + + if(first&1) { + sd->weight=0; + for(i=0;istatus.inventory[i].nameid==0 || sd->inventory_data[i] == NULL) + continue; + sd->weight += sd->inventory_data[i]->weight*sd->status.inventory[i].amount; + } + sd->cart_max_weight=battle_config.max_cart_weight; + sd->cart_weight=0; + sd->cart_max_num=MAX_CART; + sd->cart_num=0; + for(i=0;istatus.cart[i].nameid==0) + continue; + sd->cart_weight+=itemdb_weight(sd->status.cart[i].nameid)*sd->status.cart[i].amount; + sd->cart_num++; + } + } + + memset(sd->paramb,0,sizeof(sd->paramb)); + memset(sd->parame,0,sizeof(sd->parame)); + sd->hit = 0; + sd->flee = 0; + sd->flee2 = 0; + sd->critical = 0; + sd->aspd = 0; + sd->watk = 0; + sd->def = 0; + sd->mdef = 0; + sd->watk2 = 0; + sd->def2 = 0; + sd->mdef2 = 0; + sd->status.max_hp = 0; + sd->status.max_sp = 0; + sd->attackrange = 0; + sd->attackrange_ = 0; + sd->atk_ele = 0; + sd->def_ele = 0; + sd->star =0; + sd->overrefine =0; + sd->matk1 =0; + sd->matk2 =0; + sd->speed = DEFAULT_WALK_SPEED ; + sd->hprate=battle_config.hp_rate; + sd->sprate=battle_config.sp_rate; + sd->castrate=100; + sd->delayrate=100; + sd->dsprate=100; + sd->base_atk=0; + sd->arrow_atk=0; + sd->arrow_ele=0; + sd->arrow_hit=0; + sd->arrow_range=0; + sd->nhealhp=sd->nhealsp=sd->nshealhp=sd->nshealsp=sd->nsshealhp=sd->nsshealsp=0; + memset(sd->addele,0,sizeof(sd->addele)); + memset(sd->addrace,0,sizeof(sd->addrace)); + memset(sd->addsize,0,sizeof(sd->addsize)); + memset(sd->addele_,0,sizeof(sd->addele_)); + memset(sd->addrace_,0,sizeof(sd->addrace_)); + memset(sd->addsize_,0,sizeof(sd->addsize_)); + memset(sd->subele,0,sizeof(sd->subele)); + memset(sd->subrace,0,sizeof(sd->subrace)); + memset(sd->addeff,0,sizeof(sd->addeff)); + memset(sd->addeff2,0,sizeof(sd->addeff2)); + memset(sd->reseff,0,sizeof(sd->reseff)); + memset(&sd->special_state,0,sizeof(sd->special_state)); + memset(sd->weapon_coma_ele,0,sizeof(sd->weapon_coma_ele)); + memset(sd->weapon_coma_race,0,sizeof(sd->weapon_coma_race)); + memset(sd->weapon_atk,0,sizeof(sd->weapon_atk)); + memset(sd->weapon_atk_rate,0,sizeof(sd->weapon_atk_rate)); + + sd->watk_ = 0; //二刀流用(?) + sd->watk_2 = 0; + sd->atk_ele_ = 0; + sd->star_ = 0; + sd->overrefine_ = 0; + + sd->aspd_rate = 100; + sd->speed_rate = 100; + sd->hprecov_rate = 100; + sd->sprecov_rate = 100; + sd->critical_def = 0; + sd->double_rate = 0; + sd->near_attack_def_rate = sd->long_attack_def_rate = 0; + sd->atk_rate = sd->matk_rate = 100; + sd->ignore_def_ele = sd->ignore_def_race = 0; + sd->ignore_def_ele_ = sd->ignore_def_race_ = 0; + sd->ignore_mdef_ele = sd->ignore_mdef_race = 0; + sd->arrow_cri = 0; + sd->magic_def_rate = sd->misc_def_rate = 0; + memset(sd->arrow_addele,0,sizeof(sd->arrow_addele)); + memset(sd->arrow_addrace,0,sizeof(sd->arrow_addrace)); + memset(sd->arrow_addsize,0,sizeof(sd->arrow_addsize)); + memset(sd->arrow_addeff,0,sizeof(sd->arrow_addeff)); + memset(sd->arrow_addeff2,0,sizeof(sd->arrow_addeff2)); + memset(sd->magic_addele,0,sizeof(sd->magic_addele)); + memset(sd->magic_addrace,0,sizeof(sd->magic_addrace)); + memset(sd->magic_subrace,0,sizeof(sd->magic_subrace)); + sd->perfect_hit = 0; + sd->critical_rate = sd->hit_rate = sd->flee_rate = sd->flee2_rate = 100; + sd->def_rate = sd->def2_rate = sd->mdef_rate = sd->mdef2_rate = 100; + sd->def_ratio_atk_ele = sd->def_ratio_atk_ele_ = 0; + sd->def_ratio_atk_race = sd->def_ratio_atk_race_ = 0; + sd->get_zeny_num = 0; + sd->add_damage_class_count = sd->add_damage_class_count_ = sd->add_magic_damage_class_count = 0; + sd->add_def_class_count = sd->add_mdef_class_count = 0; + sd->monster_drop_item_count = 0; + memset(sd->add_damage_classrate,0,sizeof(sd->add_damage_classrate)); + memset(sd->add_damage_classrate_,0,sizeof(sd->add_damage_classrate_)); + memset(sd->add_magic_damage_classrate,0,sizeof(sd->add_magic_damage_classrate)); + memset(sd->add_def_classrate,0,sizeof(sd->add_def_classrate)); + memset(sd->add_mdef_classrate,0,sizeof(sd->add_mdef_classrate)); + memset(sd->monster_drop_race,0,sizeof(sd->monster_drop_race)); + memset(sd->monster_drop_itemrate,0,sizeof(sd->monster_drop_itemrate)); + sd->speed_add_rate = sd->aspd_add_rate = 100; + sd->double_add_rate = sd->perfect_hit_add = sd->get_zeny_add_num = 0; + sd->splash_range = sd->splash_add_range = 0; + sd->autospell_id = sd->autospell_lv = sd->autospell_rate = 0; + sd->hp_drain_rate = sd->hp_drain_per = sd->sp_drain_rate = sd->sp_drain_per = 0; + sd->hp_drain_rate_ = sd->hp_drain_per_ = sd->sp_drain_rate_ = sd->sp_drain_per_ = 0; + sd->short_weapon_damage_return = sd->long_weapon_damage_return = 0; + sd->magic_damage_return = 0; //AppleGirl Was Here + sd->random_attack_increase_add = sd->random_attack_increase_per = 0; + sd->hp_drain_value = sd->hp_drain_value_ = sd->sp_drain_value = sd->sp_drain_value_ = 0; + sd->unbreakable_equip = 0; + + + if(!sd->disguiseflag && sd->disguise) { + sd->disguise=0; + clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); + clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); + clif_changelook(&sd->bl,LOOK_HEAD_BOTTOM,sd->status.head_bottom); + clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); + clif_changelook(&sd->bl,LOOK_HEAD_MID,sd->status.head_mid); + clif_clearchar(&sd->bl, 9); + pc_setpos(sd, sd->mapname, sd->bl.x, sd->bl.y, 3); + } + + for(i=0;i<10;i++) { + index = sd->equip_index[i]; + if(index < 0) + continue; + if(i == 9 && sd->equip_index[8] == index) + continue; + if(i == 5 && sd->equip_index[4] == index) + continue; + if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index)) + continue; + + if(sd->inventory_data[index]) { + if(sd->inventory_data[index]->type == 4) { + if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) { + int j; + for(j=0;jinventory_data[index]->slot;j++){ // カ?ド + int c=sd->status.inventory[index].card[j]; + if(c>0){ + if(i == 8 && sd->status.inventory[index].equip == 0x20) + sd->state.lr_flag = 1; + run_script(itemdb_equipscript(c),0,sd->bl.id,0); + sd->state.lr_flag = 0; + } + } + } + } + else if(sd->inventory_data[index]->type==5){ // 防具 + if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) { + int j; + for(j=0;jinventory_data[index]->slot;j++){ // カ?ド + int c=sd->status.inventory[index].card[j]; + if(c>0) + run_script(itemdb_equipscript(c),0,sd->bl.id,0); + } + } + } + } + } + wele = sd->atk_ele; + wele_ = sd->atk_ele_; + def_ele = sd->def_ele; + if(sd->status.pet_id > 0) { + struct pet_data *pd=sd->pd; + if((pd && battle_config.pet_status_support==1) && (battle_config.pet_equip_required==0 || (battle_config.pet_equip_required && pd->equip > 0))) { + if(sd->status.pet_id > 0 && sd->petDB && sd->pet.intimate > 0) + run_script(sd->petDB->script,0,sd->bl.id,0); + pele = sd->atk_ele; + pdef_ele = sd->def_ele; + sd->atk_ele = sd->def_ele = 0; + } + } + memcpy(sd->paramcard,sd->parame,sizeof(sd->paramcard)); + + // ?備品によるステ?タス?化はここで?行 + for(i=0;i<10;i++) { + index = sd->equip_index[i]; + if(index < 0) + continue; + if(i == 9 && sd->equip_index[8] == index) + continue; + if(i == 5 && sd->equip_index[4] == index) + continue; + if(i == 6 && (sd->equip_index[5] == index || sd->equip_index[4] == index)) + continue; + if(sd->inventory_data[index]) { + sd->def += sd->inventory_data[index]->def; + if(sd->inventory_data[index]->type == 4) { + int r,wlv = sd->inventory_data[index]->wlv; + if(i == 8 && sd->status.inventory[index].equip == 0x20) { + //二刀流用デ?タ入力 + sd->watk_ += sd->inventory_data[index]->atk; + sd->watk_2 = (r=sd->status.inventory[index].refine)* // 精?攻?力 + refinebonus[wlv][0]; + if( (r-=refinebonus[wlv][2])>0 ) // 過?精?ボ?ナス + sd->overrefine_ = r*refinebonus[wlv][1]; + + if(sd->status.inventory[index].card[0]==0x00ff){ // 製造武器 + sd->star_ = (sd->status.inventory[index].card[1]>>8); // 星のかけら + wele_= (sd->status.inventory[index].card[1]&0x0f); // ? 性 + } + sd->attackrange_ += sd->inventory_data[index]->range; + sd->state.lr_flag = 1; + run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); + sd->state.lr_flag = 0; + } + else { //二刀流武器以外 + sd->watk += sd->inventory_data[index]->atk; + sd->watk2 += (r=sd->status.inventory[index].refine)* // 精?攻?力 + refinebonus[wlv][0]; + if( (r-=refinebonus[wlv][2])>0 ) // 過?精?ボ?ナス + sd->overrefine += r*refinebonus[wlv][1]; + + if(sd->status.inventory[index].card[0]==0x00ff){ // 製造武器 + sd->star += (sd->status.inventory[index].card[1]>>8); // 星のかけら + wele = (sd->status.inventory[index].card[1]&0x0f); // ? 性 + } + sd->attackrange += sd->inventory_data[index]->range; + run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); + } + } + else if(sd->inventory_data[index]->type == 5) { + sd->watk += sd->inventory_data[index]->atk; + refinedef += sd->status.inventory[index].refine*refinebonus[0][0]; + run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); + } + } + } + + if(sd->equip_index[10] >= 0){ // 矢 + index = sd->equip_index[10]; + if(sd->inventory_data[index]){ //まだ?性が入っていない + sd->state.lr_flag = 2; + run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0); + sd->state.lr_flag = 0; + sd->arrow_atk += sd->inventory_data[index]->atk; + } + } + sd->def += (refinedef+50)/100; + + if(sd->attackrange < 1) sd->attackrange = 1; + if(sd->attackrange_ < 1) sd->attackrange_ = 1; + if(sd->attackrange < sd->attackrange_) + sd->attackrange = sd->attackrange_; + if(sd->status.weapon == 11) + sd->attackrange += sd->arrow_range; + if(wele > 0) + sd->atk_ele = wele; + if(wele_ > 0) + sd->atk_ele_ = wele_; + if(def_ele > 0) + sd->def_ele = def_ele; + if(battle_config.pet_status_support) { + if(pele > 0 && !sd->atk_ele) + sd->atk_ele = pele; + if(pdef_ele > 0 && !sd->def_ele) + sd->def_ele = pdef_ele; + } + sd->double_rate += sd->double_add_rate; + sd->perfect_hit += sd->perfect_hit_add; + sd->get_zeny_num += sd->get_zeny_add_num; + sd->splash_range += sd->splash_add_range; + if(sd->speed_add_rate != 100) + sd->speed_rate += sd->speed_add_rate - 100; + if(sd->aspd_add_rate != 100) + sd->aspd_rate += sd->aspd_add_rate - 100; + + // 武器ATKサイズ補正 (右手) + sd->atkmods[0] = atkmods[0][sd->weapontype1]; + sd->atkmods[1] = atkmods[1][sd->weapontype1]; + sd->atkmods[2] = atkmods[2][sd->weapontype1]; + //武器ATKサイズ補正 (左手) + sd->atkmods_[0] = atkmods[0][sd->weapontype2]; + sd->atkmods_[1] = atkmods[1][sd->weapontype2]; + sd->atkmods_[2] = atkmods[2][sd->weapontype2]; + + // jobボ?ナス分 + for(i=0;istatus.job_level && iparamb[job_bonus[s_class.upper][s_class.job][i]-1]++; + } + + if( (skill=pc_checkskill(sd,MC_INCCARRY))>0 ) // skill can be used with an item now, thanks to orn [Valaris] + sd->max_weight += skill*2000; + + if( (skill=pc_checkskill(sd,AC_OWL))>0 ) // ふくろうの目 + sd->paramb[4] += skill; + + if((skill=pc_checkskill(sd,BS_HILTBINDING))>0) { // Hilt binding gives +1 str +4 atk + sd->paramb[0] ++; + sd->base_atk += 4; + } + if((skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // Dragonology increases +1 int every 2 levels + sd->paramb[3] += (skill+1)*0.5; + } + + // New guild skills - Celest + if (sd->status.guild_id > 0 && !(first&4)) { + struct guild *g; + if ((g = guild_search(sd->status.guild_id)) && strcmp(sd->status.name,g->master)==0) { + if (!sd->state.leadership_flag && guild_checkskill(g, GD_LEADERSHIP)>0) { + skill_unitsetting(&sd->bl,GD_LEADERSHIP,1,sd->bl.x,sd->bl.y,0); + } + if (!sd->state.glorywounds_flag && guild_checkskill(g, GD_GLORYWOUNDS)>0) { + skill_unitsetting(&sd->bl,GD_GLORYWOUNDS,1,sd->bl.x,sd->bl.y,0); + } + if (!sd->state.soulcold_flag && guild_checkskill(g, GD_SOULCOLD)>0) { + skill_unitsetting(&sd->bl,GD_SOULCOLD,1,sd->bl.x,sd->bl.y,0); + } + if (!sd->state.hawkeyes_flag && guild_checkskill(g, GD_HAWKEYES)>0) { + skill_unitsetting(&sd->bl,GD_HAWKEYES,1,sd->bl.x,sd->bl.y,0); + } + } + else if (g) { + if (sd->sc_count && sd->sc_data[SC_BATTLEORDERS].timer != -1) { + sd->paramb[0]+= 5; + sd->paramb[3]+= 5; + sd->paramb[4]+= 5; + } + if (sd->state.leadership_flag) + sd->paramb[0] += 2; + if (sd->state.glorywounds_flag) + sd->paramb[2] += 2; + if (sd->state.soulcold_flag) + sd->paramb[1] += 2; + if (sd->state.hawkeyes_flag) + sd->paramb[4] += 2; + } + } + + // ステ?タス?化による基本パラメ?タ補正 + if(sd->sc_count){ + if(sd->sc_data[SC_CONCENTRATE].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1){ // 集中力向上 + sd->paramb[1]+= (sd->status.agi+sd->paramb[1]+sd->parame[1]-sd->paramcard[1])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100; + sd->paramb[4]+= (sd->status.dex+sd->paramb[4]+sd->parame[4]-sd->paramcard[4])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100; + } + if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){ // 速度?加 + sd->paramb[1]+= 2+sd->sc_data[SC_INCREASEAGI].val1; + sd->speed -= sd->speed *25/100; + } + if(sd->sc_data[SC_DECREASEAGI].timer!=-1) // 速度減少(agiはbattle.cで) + sd->speed = sd->speed *125/100; + if(sd->sc_data[SC_CLOAKING].timer!=-1) { + sd->critical_rate += 100; // critical increases + sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100; + } + if(sd->sc_data[SC_CHASEWALK].timer!=-1) { + sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100; // slow down by chasewalk + if(sd->sc_data[SC_CHASEWALK].val4) + sd->paramb[0] += (1<<(sd->sc_data[SC_CHASEWALK].val1-1)); // increases strength after 10 seconds + } + if(sd->sc_data[SC_SLOWDOWN].timer!=-1) + sd->speed = sd->speed*150/100; + if(sd->sc_data[SC_SPEEDUP0].timer!=-1) + sd->speed -= sd->speed*25/100; + if(sd->sc_data[SC_BLESSING].timer!=-1){ // ブレッシング + sd->paramb[0]+= sd->sc_data[SC_BLESSING].val1; + sd->paramb[3]+= sd->sc_data[SC_BLESSING].val1; + sd->paramb[4]+= sd->sc_data[SC_BLESSING].val1; + } + if(sd->sc_data[SC_GLORIA].timer!=-1) // グロリア + sd->paramb[5]+= 30; + if(sd->sc_data[SC_LOUD].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1) // ラウドボイス + sd->paramb[0]+= 4; + if(sd->sc_data[SC_QUAGMIRE].timer!=-1){ // クァグマイア + //int agib = (sd->status.agi+sd->paramb[1]+sd->parame[1])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100; + //int dexb = (sd->status.dex+sd->paramb[4]+sd->parame[4])*(sd->sc_data[SC_QUAGMIRE].val1*10)/100; + //sd->paramb[1]-= agib > 50 ? 50 : agib; + //sd->paramb[4]-= dexb > 50 ? 50 : dexb; + sd->paramb[1]-= sd->sc_data[SC_QUAGMIRE].val1*5; + sd->paramb[4]-= sd->sc_data[SC_QUAGMIRE].val1*5; + sd->speed = sd->speed*3/2; + } + if(sd->sc_data[SC_TRUESIGHT].timer!=-1){ // トゥル?サイト + sd->paramb[0]+= 5; + sd->paramb[1]+= 5; + sd->paramb[2]+= 5; + sd->paramb[3]+= 5; + sd->paramb[4]+= 5; + sd->paramb[5]+= 5; + } + if(sd->sc_data[SC_MARIONETTE].timer!=-1){ + struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3); + if (psd) { // if partner is found + sd->paramb[0]-= sd->status.str/2; // bonuses not included + sd->paramb[1]-= sd->status.agi/2; + sd->paramb[2]-= sd->status.vit/2; + sd->paramb[3]-= sd->status.int_/2; + sd->paramb[4]-= sd->status.dex/2; + sd->paramb[5]-= sd->status.luk/2; + } + } + else if(sd->sc_data[SC_MARIONETTE2].timer!=-1){ + struct map_session_data *psd = map_id2sd(sd->sc_data[SC_MARIONETTE2].val3); + if (psd) { // if partner is found + sd->paramb[0] += sd->status.str+psd->status.str/2 > 99 ? 99-sd->status.str : psd->status.str/2; + sd->paramb[1] += sd->status.agi+psd->status.agi/2 > 99 ? 99-sd->status.agi : psd->status.agi/2; + sd->paramb[2] += sd->status.vit+psd->status.vit/2 > 99 ? 99-sd->status.vit : psd->status.vit/2; + sd->paramb[3] += sd->status.int_+psd->status.int_/2 > 99 ? 99-sd->status.int_ : psd->status.int_/2; + sd->paramb[4] += sd->status.dex+psd->status.dex/2 > 99 ? 99-sd->status.dex : psd->status.dex/2; + sd->paramb[5] += sd->status.luk+psd->status.luk/2 > 99 ? 99-sd->status.luk : psd->status.luk/2; + } + } + if(sd->sc_data[SC_GOSPEL].timer!=-1 && sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){ + if (sd->sc_data[SC_GOSPEL].val3 == 6) { + sd->paramb[0]+= 2; + sd->paramb[1]+= 2; + sd->paramb[2]+= 2; + sd->paramb[3]+= 2; + sd->paramb[4]+= 2; + sd->paramb[5]+= 2; + } + } + } + + //1度も死んでないJob70スパノビに+10 + if(s_class.job == 23 && sd->die_counter == 0 && sd->status.job_level >= 70){ + sd->paramb[0]+= 15; + sd->paramb[1]+= 15; + sd->paramb[2]+= 15; + sd->paramb[3]+= 15; + sd->paramb[4]+= 15; + sd->paramb[5]+= 15; + } + sd->paramc[0]=sd->status.str+sd->paramb[0]+sd->parame[0]; + sd->paramc[1]=sd->status.agi+sd->paramb[1]+sd->parame[1]; + sd->paramc[2]=sd->status.vit+sd->paramb[2]+sd->parame[2]; + sd->paramc[3]=sd->status.int_+sd->paramb[3]+sd->parame[3]; + sd->paramc[4]=sd->status.dex+sd->paramb[4]+sd->parame[4]; + sd->paramc[5]=sd->status.luk+sd->paramb[5]+sd->parame[5]; + for(i=0;i<6;i++) + if(sd->paramc[i] < 0) sd->paramc[i] = 0; + + if(sd->status.weapon == 11 || sd->status.weapon == 13 || sd->status.weapon == 14) { + str = sd->paramc[4]; + dex = sd->paramc[0]; + } + else { + str = sd->paramc[0]; + dex = sd->paramc[4]; + } + dstr = str/10; + sd->base_atk += str + dstr*dstr + dex/5 + sd->paramc[5]/5; + sd->matk1 += sd->paramc[3]+(sd->paramc[3]/5)*(sd->paramc[3]/5); + sd->matk2 += sd->paramc[3]+(sd->paramc[3]/7)*(sd->paramc[3]/7); + if(sd->matk1 < sd->matk2) { + int temp = sd->matk2; + sd->matk2 = sd->matk1; + sd->matk1 = temp; + } + sd->hit += sd->paramc[4] + sd->status.base_level; + sd->flee += sd->paramc[1] + sd->status.base_level; + sd->def2 += sd->paramc[2]; + sd->mdef2 += sd->paramc[3]; + sd->flee2 += sd->paramc[5]+10; + sd->critical += (sd->paramc[5]*3)+10; + + if(sd->base_atk < 1) + sd->base_atk = 1; + if(sd->critical_rate != 100) + sd->critical = (sd->critical*sd->critical_rate)/100; + if(sd->critical < 10) sd->critical = 10; + if(sd->hit_rate != 100) + sd->hit = (sd->hit*sd->hit_rate)/100; + if(sd->hit < 1) sd->hit = 1; + if(sd->flee_rate != 100) + sd->flee = (sd->flee*sd->flee_rate)/100; + if(sd->flee < 1) sd->flee = 1; + if(sd->flee2_rate != 100) + sd->flee2 = (sd->flee2*sd->flee2_rate)/100; + if(sd->flee2 < 10) sd->flee2 = 10; + if(sd->def_rate != 100) + sd->def = (sd->def*sd->def_rate)/100; + if(sd->def < 0) sd->def = 0; + if(sd->def2_rate != 100) + sd->def2 = (sd->def2*sd->def2_rate)/100; + if(sd->def2 < 1) sd->def2 = 1; + if(sd->mdef_rate != 100) + sd->mdef = (sd->mdef*sd->mdef_rate)/100; + if(sd->mdef < 0) sd->mdef = 0; + if(sd->mdef2_rate != 100) + sd->mdef2 = (sd->mdef2*sd->mdef2_rate)/100; + if(sd->mdef2 < 1) sd->mdef2 = 1; + + // 二刀流 ASPD 修正 + if (sd->status.weapon <= 16) + sd->aspd += aspd_base[s_class.job][sd->status.weapon]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->status.weapon]/1000; + else + sd->aspd += ( + (aspd_base[s_class.job][sd->weapontype1]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->weapontype1]/1000) + + (aspd_base[s_class.job][sd->weapontype2]-(sd->paramc[1]*4+sd->paramc[4])*aspd_base[s_class.job][sd->weapontype2]/1000) + ) * 140 / 200; + + aspd_rate = sd->aspd_rate; + + //攻?速度?加 + + if((skill=pc_checkskill(sd,AC_VULTURE))>0){ // ワシの目 + sd->hit += skill; + if(sd->status.weapon == 11) + sd->attackrange += skill; + } + + if( (skill=pc_checkskill(sd,BS_WEAPONRESEARCH))>0) // 武器?究の命中率?加 + sd->hit += skill*2; + if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 ) // トンネルドライブ // トンネルドライブ + sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9); + if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0) // カ?トによる速度低下 + sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1); + else if (pc_isriding(sd)) { // ペコペコ?りによる速度?加 + sd->speed -= (0.25 * DEFAULT_WALK_SPEED); + sd->max_weight += 10000; + } + if((skill=pc_checkskill(sd,CR_TRUST))>0) { // フェイス + sd->status.max_hp += skill*200; + sd->subele[6] += skill*5; + } + if((skill=pc_checkskill(sd,BS_SKINTEMPER))>0) { + sd->subele[0] += skill; + sd->subele[3] += skill*5; + } + if((skill=pc_checkskill(sd,SA_ADVANCEDBOOK))>0 ) + aspd_rate -= skill*0.5; + + bl=sd->status.base_level; + + sd->status.max_hp += (3500 + bl*hp_coefficient2[s_class.job] + hp_sigma_val[s_class.job][(bl > 0)? bl-1:0])/100 * (100 + sd->paramc[2])/100 + (sd->parame[2] - sd->paramcard[2]); + if (s_class.upper==1) // [MouseJstr] + sd->status.max_hp = sd->status.max_hp * 130/100; + else if (s_class.upper==2) + sd->status.max_hp = sd->status.max_hp * 70/100; + + if(sd->hprate!=100) + sd->status.max_hp = sd->status.max_hp*sd->hprate/100; + + if(sd->sc_count && sd->sc_data[SC_BERSERK].timer!=-1){ // バ?サ?ク + sd->status.max_hp = sd->status.max_hp * 3; + // sd->status.hp = sd->status.hp * 3; + if(sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris + sd->status.max_hp = battle_config.max_hp; + if(sd->status.hp > battle_config.max_hp) // removed negative max hp bug by Valaris + sd->status.hp = battle_config.max_hp; + } + if(s_class.job == 23 && sd->status.base_level >= 99){ + sd->status.max_hp = sd->status.max_hp + 2000; + } + + if(sd->status.max_hp > battle_config.max_hp) // removed negative max hp bug by Valaris + sd->status.max_hp = battle_config.max_hp; + if(sd->status.max_hp <= 0) sd->status.max_hp = 1; // end + + // 最大SP計算 + sd->status.max_sp += ((sp_coefficient[s_class.job] * bl) + 1000)/100 * (100 + sd->paramc[3])/100 + (sd->parame[3] - sd->paramcard[3]); + if (s_class.upper==1) // [MouseJstr] + sd->status.max_sp = sd->status.max_sp * 130/100; + else if (s_class.upper==2) + sd->status.max_sp = sd->status.max_sp * 70/100; + if(sd->sprate!=100) + sd->status.max_sp = sd->status.max_sp*sd->sprate/100; + + if((skill=pc_checkskill(sd,HP_MEDITATIO))>0) // メディテイティオ + sd->status.max_sp += sd->status.max_sp*skill/100; + if((skill=pc_checkskill(sd,HW_SOULDRAIN))>0) /* ソウルドレイン */ + sd->status.max_sp += sd->status.max_sp*2*skill/100; + + if(sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp) + sd->status.max_sp = battle_config.max_sp; + + //自然回復HP + sd->nhealhp = 1 + (sd->paramc[2]/5) + (sd->status.max_hp/200); + if((skill=pc_checkskill(sd,SM_RECOVERY)) > 0) { /* HP回復力向上 */ + sd->nshealhp = skill*5 + (sd->status.max_hp*skill/500); + if(sd->nshealhp > 0x7fff) sd->nshealhp = 0x7fff; + } + //自然回復SP + sd->nhealsp = 1 + (sd->paramc[3]/6) + (sd->status.max_sp/100); + if(sd->paramc[3] >= 120) + sd->nhealsp += ((sd->paramc[3]-120)>>1) + 4; + if((skill=pc_checkskill(sd,MG_SRECOVERY)) > 0) { /* SP回復力向上 */ + sd->nshealsp = skill*3 + (sd->status.max_sp*skill/500); + if(sd->nshealsp > 0x7fff) sd->nshealsp = 0x7fff; + } + + if((skill = pc_checkskill(sd,MO_SPIRITSRECOVERY)) > 0) { + sd->nsshealhp = skill*4 + (sd->status.max_hp*skill/500); + sd->nsshealsp = skill*2 + (sd->status.max_sp*skill/500); + if(sd->nsshealhp > 0x7fff) sd->nsshealhp = 0x7fff; + if(sd->nsshealsp > 0x7fff) sd->nsshealsp = 0x7fff; + } + if(sd->hprecov_rate != 100) { + sd->nhealhp = sd->nhealhp*sd->hprecov_rate/100; + if(sd->nhealhp < 1) sd->nhealhp = 1; + } + if(sd->sprecov_rate != 100) { + sd->nhealsp = sd->nhealsp*sd->sprecov_rate/100; + if(sd->nhealsp < 1) sd->nhealsp = 1; + } + /* if((skill=pc_checkskill(sd,HP_MEDITATIO)) > 0) { // f?fffBfefCfefBfI,I'SPR,A*,I',E`,。ゥZ((c)。ョR「カn~.ゥォ,E',(c),(c),e' + sd->nhealsp += 3*skill*(sd->status.max_sp)/100; + if(sd->nhealsp > 0x7fff) sd->nhealsp = 0x7fff; + } Increase natural SP regen instead of colossal SP Recovery effect [DracoRPG]*/ + + // 種族耐性(これでいいの? ディバインプロテクションと同じ?理がいるかも) + if( (skill=pc_checkskill(sd,SA_DRAGONOLOGY))>0 ){ // ドラゴノロジ? + skill = skill*4; + sd->addrace[9]+=skill; + sd->addrace_[9]+=skill; + sd->subrace[9]+=skill; + sd->magic_addrace[9]+=skill; + sd->magic_subrace[9]-=skill; + } + + //Flee上昇 + if( (skill=pc_checkskill(sd,TF_MISS))>0 ){ // 回避率?加 + if(sd->status.class_==6||sd->status.class_==4007 || sd->status.class_==23){ + sd->flee += skill*3; + } + if(sd->status.class_==12||sd->status.class_==17||sd->status.class_==4013||sd->status.class_==4018) + sd->flee += skill*4; + if(sd->status.class_==12||sd->status.class_==4013) + sd->speed -= sd->speed *(skill*1.5)/100; + } + if( (skill=pc_checkskill(sd,MO_DODGE))>0 ) // 見切り + sd->flee += (skill*3)>>1; + + // スキルやステ?タス異常による?りのパラメ?タ補正 + if(sd->sc_count){ + // ATK/DEF?化形 + if(sd->sc_data[SC_ANGELUS].timer!=-1) // エンジェラス + sd->def2 = sd->def2*(110+5*sd->sc_data[SC_ANGELUS].val1)/100; + if(sd->sc_data[SC_IMPOSITIO].timer!=-1) {// インポシティオマヌス + sd->watk += sd->sc_data[SC_IMPOSITIO].val1*5; + index = sd->equip_index[8]; + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) + sd->watk_ += sd->sc_data[SC_IMPOSITIO].val1*5; + } + if(sd->sc_data[SC_PROVOKE].timer!=-1){ // プロボック + sd->def2 = sd->def2*(100-6*sd->sc_data[SC_PROVOKE].val1)/100; + sd->base_atk = sd->base_atk*(100+2*sd->sc_data[SC_PROVOKE].val1)/100; + sd->watk = sd->watk*(100+2*sd->sc_data[SC_PROVOKE].val1)/100; + index = sd->equip_index[8]; + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) + sd->watk_ = sd->watk_*(100+2*sd->sc_data[SC_PROVOKE].val1)/100; + } + if(sd->sc_data[SC_ENDURE].timer!=-1) + sd->mdef2 += sd->sc_data[SC_ENDURE].val1; + if(sd->sc_data[SC_MINDBREAKER].timer!=-1){ // プロボック + sd->mdef2 = sd->mdef2*(100-6*sd->sc_data[SC_MINDBREAKER].val1)/100; + sd->matk1 = sd->matk1*(100+2*sd->sc_data[SC_MINDBREAKER].val1)/100; + sd->matk2 = sd->matk2*(100+2*sd->sc_data[SC_MINDBREAKER].val1)/100; + } + if(sd->sc_data[SC_POISON].timer!=-1) // 毒?態 + sd->def2 = sd->def2*75/100; + if(sd->sc_data[SC_CURSE].timer!=-1){ + sd->base_atk = sd->base_atk*75/100; + sd->watk = sd->watk*75/100; + index = sd->equip_index[8]; + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) + sd->watk_ = sd->watk_*75/100; + } + if(sd->sc_data[SC_DRUMBATTLE].timer!=-1){ // ?太鼓の響き + sd->watk += sd->sc_data[SC_DRUMBATTLE].val2; + sd->def += sd->sc_data[SC_DRUMBATTLE].val3; + index = sd->equip_index[8]; + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) + sd->watk_ += sd->sc_data[SC_DRUMBATTLE].val2; + } + if(sd->sc_data[SC_NIBELUNGEN].timer!=-1) { // ニ?ベルングの指輪 + index = sd->equip_index[9]; + /*if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3) + sd->watk += sd->sc_data[SC_NIBELUNGEN].val3; + index = sd->equip_index[8]; + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 3) + sd->watk_ += sd->sc_data[SC_NIBELUNGEN].val3; + index = sd->equip_index[9];*/ + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4) + sd->watk2 += sd->sc_data[SC_NIBELUNGEN].val3; + index = sd->equip_index[8]; + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->wlv == 4) + sd->watk_2 += sd->sc_data[SC_NIBELUNGEN].val3; + } + + if(sd->sc_data[SC_VOLCANO].timer!=-1 && sd->def_ele==3){ // ボルケ?ノ + sd->watk += sd->sc_data[SC_VIOLENTGALE].val3; + } + + if(sd->sc_data[SC_SIGNUMCRUCIS].timer!=-1) + sd->def = sd->def * (100 - sd->sc_data[SC_SIGNUMCRUCIS].val2)/100; + if(sd->sc_data[SC_ETERNALCHAOS].timer!=-1) // エタ?ナルカオス + sd->def=0; + + if(sd->sc_data[SC_CONCENTRATION].timer!=-1){ //コンセントレ?ション + sd->watk = sd->watk * (100 + 5*sd->sc_data[SC_CONCENTRATION].val1)/100; + index = sd->equip_index[8]; + if(index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == 4) + sd->watk_ = sd->watk * (100 + 5*sd->sc_data[SC_CONCENTRATION].val1)/100; + sd->def = sd->def * (100 - 5*sd->sc_data[SC_CONCENTRATION].val1)/100; + } + + if(sd->sc_data[SC_MAGICPOWER].timer!=-1){ //魔法力?幅 + sd->matk1 = sd->matk1*(100+5*sd->sc_data[SC_MAGICPOWER].val1)/100; + sd->matk2 = sd->matk2*(100+5*sd->sc_data[SC_MAGICPOWER].val1)/100; + } + if(sd->sc_data[SC_ATKPOT].timer!=-1) + sd->watk += sd->sc_data[SC_ATKPOT].val1; + if(sd->sc_data[SC_MATKPOT].timer!=-1){ + sd->matk1 += sd->sc_data[SC_MATKPOT].val1; + sd->matk2 += sd->sc_data[SC_MATKPOT].val1; + } + + // ASPD/移動速度?化系 + if(sd->sc_data[SC_TWOHANDQUICKEN].timer != -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) // 2HQ + aspd_rate -= 30; + if(sd->sc_data[SC_ADRENALINE].timer != -1 && sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 && + sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ + if(sd->sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) + aspd_rate -= 30; + else + aspd_rate -= 25; + } + if(sd->sc_data[SC_SPEARSQUICKEN].timer != -1 && sd->sc_data[SC_ADRENALINE].timer == -1 && + sd->sc_data[SC_TWOHANDQUICKEN].timer == -1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1) // スピアクィッケン + aspd_rate -= sd->sc_data[SC_SPEARSQUICKEN].val2; + if(sd->sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス + sd->sc_data[SC_TWOHANDQUICKEN].timer==-1 && sd->sc_data[SC_ADRENALINE].timer==-1 && sd->sc_data[SC_SPEARSQUICKEN].timer==-1 && + sd->sc_data[SC_DONTFORGETME].timer == -1) + aspd_rate -= 5+sd->sc_data[SC_ASSNCROS].val1+sd->sc_data[SC_ASSNCROS].val2+sd->sc_data[SC_ASSNCROS].val3; + if(sd->sc_data[SC_DONTFORGETME].timer!=-1){ // 私を忘れないで + aspd_rate += sd->sc_data[SC_DONTFORGETME].val1*3 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3>>16); + sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100; + } + if( sd->sc_data[i=SC_SPEEDPOTION3].timer!=-1 || + sd->sc_data[i=SC_SPEEDPOTION2].timer!=-1 || + sd->sc_data[i=SC_SPEEDPOTION1].timer!=-1 || + sd->sc_data[i=SC_SPEEDPOTION0].timer!=-1) // ? 速ポ?ション + aspd_rate -= sd->sc_data[i].val2; + if(sd->sc_data[SC_WINDWALK].timer!=-1 && sd->sc_data[SC_INCREASEAGI].timer==-1) //ウィンドウォ?ク暫ヘLv*2%減算 + sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100; + if(sd->sc_data[SC_CARTBOOST].timer!=-1) // カ?トブ?スト + sd->speed -= (DEFAULT_WALK_SPEED * 20)/100; + if(sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中はIAと同じぐらい速い? + sd->speed -= sd->speed *25/100; + if(sd->sc_data[SC_WEDDING].timer!=-1) //結婚中は?くのが?い + sd->speed = 2*DEFAULT_WALK_SPEED; + + // HIT/FLEE?化系 + if(sd->sc_data[SC_WHISTLE].timer!=-1){ // 口笛 + sd->flee += sd->flee * (sd->sc_data[SC_WHISTLE].val1 + +sd->sc_data[SC_WHISTLE].val2+(sd->sc_data[SC_WHISTLE].val3>>16))/100; + sd->flee2+= (sd->sc_data[SC_WHISTLE].val1+sd->sc_data[SC_WHISTLE].val2+(sd->sc_data[SC_WHISTLE].val3&0xffff)) * 10; + } + if(sd->sc_data[SC_HUMMING].timer!=-1) // ハミング + sd->hit += (sd->sc_data[SC_HUMMING].val1*2+sd->sc_data[SC_HUMMING].val2 + +sd->sc_data[SC_HUMMING].val3) * sd->hit/100; + if(sd->sc_data[SC_VIOLENTGALE].timer!=-1 && sd->def_ele==4){ // バイオレントゲイル + sd->flee += sd->flee*sd->sc_data[SC_VIOLENTGALE].val3/100; + } + if(sd->sc_data[SC_BLIND].timer!=-1){ // 暗? + sd->hit -= sd->hit*25/100; + sd->flee -= sd->flee*25/100; + } + if(sd->sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォ?ク + sd->flee += sd->flee*(sd->sc_data[SC_WINDWALK].val2)/100; + if(sd->sc_data[SC_SPIDERWEB].timer!=-1) //スパイダ?ウェブ + sd->flee -= sd->flee*50/100; + if(sd->sc_data[SC_TRUESIGHT].timer!=-1) //トゥル?サイト + sd->hit += 3*(sd->sc_data[SC_TRUESIGHT].val1); + if(sd->sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレ?ション + sd->hit += (10*(sd->sc_data[SC_CONCENTRATION].val1)); + + // 耐性 + if(sd->sc_data[SC_SIEGFRIED].timer!=-1){ // 不死身のジ?クフリ?ド + sd->subele[1] += sd->sc_data[SC_SIEGFRIED].val2; // 水 + sd->subele[2] += sd->sc_data[SC_SIEGFRIED].val2; // 水 + sd->subele[3] += sd->sc_data[SC_SIEGFRIED].val2; // 火 + sd->subele[4] += sd->sc_data[SC_SIEGFRIED].val2; // 水 + sd->subele[5] += sd->sc_data[SC_SIEGFRIED].val2; // 水 + sd->subele[6] += sd->sc_data[SC_SIEGFRIED].val2; // 水 + sd->subele[7] += sd->sc_data[SC_SIEGFRIED].val2; // 水 + sd->subele[8] += sd->sc_data[SC_SIEGFRIED].val2; // 水 + sd->subele[9] += sd->sc_data[SC_SIEGFRIED].val2; // 水 + } + if(sd->sc_data[SC_PROVIDENCE].timer!=-1){ // プロヴィデンス + sd->subele[6] += sd->sc_data[SC_PROVIDENCE].val2; // ? 聖?性 + sd->subrace[6] += sd->sc_data[SC_PROVIDENCE].val2; // ? ?魔 + } + + // その他 + if(sd->sc_data[SC_APPLEIDUN].timer!=-1){ // イドゥンの林檎 + sd->status.max_hp += ((5+sd->sc_data[SC_APPLEIDUN].val1*2+((sd->sc_data[SC_APPLEIDUN].val2+1)>>1) + +sd->sc_data[SC_APPLEIDUN].val3/10) * sd->status.max_hp)/100; + if(sd->status.max_hp < 0 || sd->status.max_hp > battle_config.max_hp) + sd->status.max_hp = battle_config.max_hp; + } + if(sd->sc_data[SC_DELUGE].timer!=-1 && sd->def_ele==1){ // デリュ?ジ + sd->status.max_hp += sd->status.max_hp*sd->sc_data[SC_DELUGE].val3/100; + if(sd->status.max_hp < 0 || sd->status.max_hp > battle_config.max_hp) + sd->status.max_hp = battle_config.max_hp; + } + if(sd->sc_data[SC_SERVICE4U].timer!=-1) { // サ?ビスフォ?ユ? + sd->status.max_sp += sd->status.max_sp*(10+sd->sc_data[SC_SERVICE4U].val1+sd->sc_data[SC_SERVICE4U].val2 + +sd->sc_data[SC_SERVICE4U].val3)/100; + if(sd->status.max_sp < 0 || sd->status.max_sp > battle_config.max_sp) + sd->status.max_sp = battle_config.max_sp; + sd->dsprate-=(10+sd->sc_data[SC_SERVICE4U].val1*3+sd->sc_data[SC_SERVICE4U].val2 + +sd->sc_data[SC_SERVICE4U].val3); + if(sd->dsprate<0)sd->dsprate=0; + } + + if(sd->sc_data[SC_FORTUNE].timer!=-1) // 幸運のキス + sd->critical += (10+sd->sc_data[SC_FORTUNE].val1+sd->sc_data[SC_FORTUNE].val2 + +sd->sc_data[SC_FORTUNE].val3)*10; + + if(sd->sc_data[SC_EXPLOSIONSPIRITS].timer!=-1){ // 爆裂波動 + if(s_class.job==23) + sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val1*100; + else + sd->critical += sd->sc_data[SC_EXPLOSIONSPIRITS].val2; + } + + if(sd->sc_data[SC_STEELBODY].timer!=-1){ // 金剛 + sd->def = 90; + sd->mdef = 90; + aspd_rate += 25; + sd->speed = (sd->speed * 125) / 100; + } + if(sd->sc_data[SC_DEFENDER].timer != -1) { + sd->aspd += (550 - sd->sc_data[SC_DEFENDER].val1*50); + // removed as of 12/14's patch [celest] + //sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; + } + if(sd->sc_data[SC_ENCPOISON].timer != -1) + sd->addeff[4] += sd->sc_data[SC_ENCPOISON].val2; + + if( sd->sc_data[SC_DANCING].timer!=-1 ){ // 演奏/ダンス使用中 + sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON))); + //sd->speed*=4; + sd->nhealsp = 0; + sd->nshealsp = 0; + sd->nsshealsp = 0; + } + if(sd->sc_data[SC_CURSE].timer!=-1) + sd->speed += 450; + + if(sd->sc_data[SC_TRUESIGHT].timer!=-1) //トゥル?サイト + sd->critical += sd->critical*(sd->sc_data[SC_TRUESIGHT].val1)/100; + +/* if(sd->sc_data[SC_VOLCANO].timer!=-1) // エンチャントポイズン(?性はbattle.cで) + sd->addeff[2]+=sd->sc_data[SC_VOLCANO].val2;//% of granting + if(sd->sc_data[SC_DELUGE].timer!=-1) // エンチャントポイズン(?性はbattle.cで) + sd->addeff[0]+=sd->sc_data[SC_DELUGE].val2;//% of granting + */ + if(sd->sc_data[SC_BERSERK].timer!=-1) { //All Def/MDef reduced to 0 while in Berserk [DracoRPG] + sd->def = sd->def2 = 0; + sd->mdef = sd->mdef2 = 0; + sd->flee -= sd->flee*50/100; + aspd_rate -= 30; + //sd->base_atk *= 3; + } + if(sd->sc_data[SC_KEEPING].timer!=-1) + sd->def = 100; + if(sd->sc_data[SC_BARRIER].timer!=-1) + sd->mdef = 100; + + if(sd->sc_data[SC_GOSPEL].timer!=-1) { + if (sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){ + switch (sd->sc_data[SC_GOSPEL].val3) + { + case 4: + sd->status.max_hp += sd->status.max_hp * 25 / 100; + if(sd->status.max_hp > battle_config.max_hp) + sd->status.max_hp = battle_config.max_hp; + break; + case 5: + sd->status.max_sp += sd->status.max_sp * 25 / 100; + if(sd->status.max_sp > battle_config.max_sp) + sd->status.max_sp = battle_config.max_sp; + break; + case 11: + sd->def += sd->def * 25 / 100; + sd->def2 += sd->def2 * 25 / 100; + break; + case 12: + sd->base_atk += sd->base_atk * 8 / 100; + break; + case 13: + sd->flee += sd->flee * 5 / 100; + break; + case 14: + sd->hit += sd->hit * 5 / 100; + break; + } + } else if (sd->sc_data[SC_GOSPEL].val4 == BCT_ENEMY){ + switch (sd->sc_data[SC_GOSPEL].val3) + { + case 5: + sd->def = 0; + sd->def2 = 0; + break; + case 6: + sd->base_atk = 0; + sd->watk = 0; + sd->watk2 = 0; + break; + case 7: + sd->flee = 0; + break; + case 8: + sd->speed_rate += 75; + aspd_rate += 75; + break; + } + } + } + } + + if (sd->speed_rate <= 0) + sd->speed_rate = 1; + + if(sd->speed_rate != 100) + sd->speed = sd->speed*sd->speed_rate/100; + if(sd->speed < 1) sd->speed = 1; + if(aspd_rate != 100) + sd->aspd = sd->aspd*aspd_rate/100; + if(pc_isriding(sd)) // 騎兵修練 + sd->aspd = sd->aspd*(100 + 10*(5 - pc_checkskill(sd,KN_CAVALIERMASTERY)))/ 100; + if(sd->aspd < battle_config.max_aspd) sd->aspd = battle_config.max_aspd; + sd->amotion = sd->aspd; + sd->dmotion = 800-sd->paramc[1]*4; + if(sd->dmotion<400) + sd->dmotion = 400; + if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) { + sd->prev_speed = sd->speed; + sd->speed = sd->speed*(175 - skill*5)/100; + } + + if(sd->status.hp>sd->status.max_hp) + sd->status.hp=sd->status.max_hp; + if(sd->status.sp>sd->status.max_sp) + sd->status.sp=sd->status.max_sp; + + if(first&4) + return 0; + if(first&3) { + clif_updatestatus(sd,SP_SPEED); + clif_updatestatus(sd,SP_MAXHP); + clif_updatestatus(sd,SP_MAXSP); + if(first&1) { + clif_updatestatus(sd,SP_HP); + clif_updatestatus(sd,SP_SP); + } + return 0; + } + + if(b_class != sd->view_class) { + clif_changelook(&sd->bl,LOOK_BASE,sd->view_class); +#if PACKETVER < 4 + clif_changelook(&sd->bl,LOOK_WEAPON,sd->status.weapon); + clif_changelook(&sd->bl,LOOK_SHIELD,sd->status.shield); +#else + clif_changelook(&sd->bl,LOOK_WEAPON,0); +#endif + } + + if( memcmp(b_skill,sd->status.skill,sizeof(sd->status.skill)) || b_attackrange != sd->attackrange) + clif_skillinfoblock(sd); // スキル送信 + + if(b_speed != sd->speed) + clif_updatestatus(sd,SP_SPEED); + if(b_weight != sd->weight) + clif_updatestatus(sd,SP_WEIGHT); + if(b_max_weight != sd->max_weight) { + clif_updatestatus(sd,SP_MAXWEIGHT); + pc_checkweighticon(sd); + } + for(i=0;i<6;i++) + if(b_paramb[i] + b_parame[i] != sd->paramb[i] + sd->parame[i]) + clif_updatestatus(sd,SP_STR+i); + if(b_hit != sd->hit) + clif_updatestatus(sd,SP_HIT); + if(b_flee != sd->flee) + clif_updatestatus(sd,SP_FLEE1); + if(b_aspd != sd->aspd) + clif_updatestatus(sd,SP_ASPD); + if(b_watk != sd->watk || b_base_atk != sd->base_atk) + clif_updatestatus(sd,SP_ATK1); + if(b_def != sd->def) + clif_updatestatus(sd,SP_DEF1); + if(b_watk2 != sd->watk2) + clif_updatestatus(sd,SP_ATK2); + if(b_def2 != sd->def2) + clif_updatestatus(sd,SP_DEF2); + if(b_flee2 != sd->flee2) + clif_updatestatus(sd,SP_FLEE2); + if(b_critical != sd->critical) + clif_updatestatus(sd,SP_CRITICAL); + if(b_matk1 != sd->matk1) + clif_updatestatus(sd,SP_MATK1); + if(b_matk2 != sd->matk2) + clif_updatestatus(sd,SP_MATK2); + if(b_mdef != sd->mdef) + clif_updatestatus(sd,SP_MDEF1); + if(b_mdef2 != sd->mdef2) + clif_updatestatus(sd,SP_MDEF2); + if(b_attackrange != sd->attackrange) + clif_updatestatus(sd,SP_ATTACKRANGE); + if(b_max_hp != sd->status.max_hp) + clif_updatestatus(sd,SP_MAXHP); + if(b_max_sp != sd->status.max_sp) + clif_updatestatus(sd,SP_MAXSP); + if(b_hp != sd->status.hp) + clif_updatestatus(sd,SP_HP); + if(b_sp != sd->status.sp) + clif_updatestatus(sd,SP_SP); + +/* if(before.cart_num != before.cart_num || before.cart_max_num != before.cart_max_num || + before.cart_weight != before.cart_weight || before.cart_max_weight != before.cart_max_weight ) + clif_updatestatus(sd,SP_CARTINFO);*/ + + //if(sd->status.hpstatus.max_hp>>2 && pc_checkskill(sd,SM_AUTOBERSERK)>0 && + if(sd->status.hpstatus.max_hp>>2 && sd->sc_data[SC_AUTOBERSERK].timer != -1 && + (sd->sc_data[SC_PROVOKE].timer==-1 || sd->sc_data[SC_PROVOKE].val2==0 ) && !pc_isdead(sd)) + // オ?トバ?サ?ク?動 + status_change_start(&sd->bl,SC_PROVOKE,10,1,0,0,0,0); + + return 0; +} + +/*========================================== + * For quick calculating [Celest] + *------------------------------------------ + */ +int status_calc_speed (struct map_session_data *sd) +{ + int b_speed, skill; + struct pc_base_job s_class; + + nullpo_retr(0, sd); + + s_class = pc_calc_base_job(sd->status.class_); + + b_speed = sd->speed; + sd->speed = DEFAULT_WALK_SPEED ; + + if(sd->sc_count){ + if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){ // 速度?加 + sd->speed -= sd->speed *25/100; + } + if(sd->sc_data[SC_DECREASEAGI].timer!=-1) { + sd->speed = sd->speed *125/100; + } + if(sd->sc_data[SC_CLOAKING].timer!=-1) { + sd->speed = sd->speed * (sd->sc_data[SC_CLOAKING].val3-sd->sc_data[SC_CLOAKING].val1*3) /100; + } + if(sd->sc_data[SC_CHASEWALK].timer!=-1) { + sd->speed = sd->speed * sd->sc_data[SC_CHASEWALK].val3 /100; + } + if(sd->sc_data[SC_QUAGMIRE].timer!=-1){ + sd->speed = sd->speed*3/2; + } + if(sd->sc_data[SC_WINDWALK].timer!=-1 && sd->sc_data[SC_INCREASEAGI].timer==-1) { + sd->speed -= sd->speed *(sd->sc_data[SC_WINDWALK].val1*2)/100; + } + if(sd->sc_data[SC_CARTBOOST].timer!=-1) { + sd->speed -= (DEFAULT_WALK_SPEED * 20)/100; + } + if(sd->sc_data[SC_BERSERK].timer!=-1) { + sd->speed -= sd->speed *25/100; + } + if(sd->sc_data[SC_WEDDING].timer!=-1) { + sd->speed = 2*DEFAULT_WALK_SPEED; + } + if(sd->sc_data[SC_DONTFORGETME].timer!=-1){ + sd->speed= sd->speed*(100+sd->sc_data[SC_DONTFORGETME].val1*2 + sd->sc_data[SC_DONTFORGETME].val2 + (sd->sc_data[SC_DONTFORGETME].val3&0xffff))/100; + } + if(sd->sc_data[SC_STEELBODY].timer!=-1){ + sd->speed = (sd->speed * 125) / 100; + } + if(sd->sc_data[SC_DEFENDER].timer != -1) { + // removed as of 12/14's patch [celest] + //sd->speed = (sd->speed * (155 - sd->sc_data[SC_DEFENDER].val1*5)) / 100; + } + if( sd->sc_data[SC_DANCING].timer!=-1 ){ + sd->speed = (double)sd->speed * (6.- 0.4 * pc_checkskill(sd, ((s_class.job == 19) ? BA_MUSICALLESSON : DC_DANCINGLESSON))); + } + if(sd->sc_data[SC_CURSE].timer!=-1) + sd->speed += 450; + if(sd->sc_data[SC_SLOWDOWN].timer!=-1) + sd->speed = sd->speed*150/100; + if(sd->sc_data[SC_SPEEDUP0].timer!=-1) + sd->speed -= sd->speed*25/100; + } + + if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 ) + sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9); + if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0) + sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1); + else if (pc_isriding(sd)) { + sd->speed -= (0.25 * DEFAULT_WALK_SPEED); + } + if((skill=pc_checkskill(sd,TF_MISS))>0) + if(s_class.job==12) + sd->speed -= sd->speed *(skill*1.5)/100; + + if(sd->speed_rate != 100) + sd->speed = sd->speed*sd->speed_rate/100; + if(sd->speed < 1) sd->speed = 1; + + if(sd->skilltimer != -1 && (skill = pc_checkskill(sd,SA_FREECAST)) > 0) { + sd->prev_speed = sd->speed; + sd->speed = sd->speed*(175 - skill*5)/100; + } + + if(b_speed != sd->speed) + clif_updatestatus(sd,SP_SPEED); + + return 0; +} + +/*========================================== + * 対象のClassを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_class(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return ((struct mob_data *)bl)->class_; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->status.class_; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return ((struct pet_data *)bl)->class_; + else + return 0; +} +/*========================================== + * 対象の方向を返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_dir(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return ((struct mob_data *)bl)->dir; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->dir; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return ((struct pet_data *)bl)->dir; + else + return 0; +} +/*========================================== + * 対象のレベルを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_lv(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return ((struct mob_data *)bl)->level; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->status.base_level; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return ((struct pet_data *)bl)->msd->pet.level; + else + return 0; +} + +/*========================================== + * 対象の射程を返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_range(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return mob_db[((struct mob_data *)bl)->class_].range; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->attackrange; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return mob_db[((struct pet_data *)bl)->class_].range; + else + return 0; +} +/*========================================== + * 対象のHPを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_hp(struct block_list *bl) +{ + nullpo_retr(1, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return ((struct mob_data *)bl)->hp; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->status.hp; + else + return 1; +} +/*========================================== + * 対象のMHPを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_max_hp(struct block_list *bl) +{ + nullpo_retr(1, bl); + if(bl->type==BL_PC && ((struct map_session_data *)bl)) + return ((struct map_session_data *)bl)->status.max_hp; + else { + struct status_change *sc_data=status_get_sc_data(bl); + int max_hp=1; + if(bl->type==BL_MOB && ((struct mob_data*)bl)) { + max_hp = mob_db[((struct mob_data*)bl)->class_].max_hp; + if(battle_config.mobs_level_up) // mobs leveling up increase [Valaris] + max_hp+=(((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv)*status_get_vit(bl); + if(mob_db[((struct mob_data*)bl)->class_].mexp > 0) { + if(battle_config.mvp_hp_rate != 100) + max_hp = (max_hp * battle_config.mvp_hp_rate)/100; + } + else { + if(battle_config.monster_hp_rate != 100) + max_hp = (max_hp * battle_config.monster_hp_rate)/100; + } + } + else if(bl->type==BL_PET && ((struct pet_data*)bl)) { + max_hp = mob_db[((struct pet_data*)bl)->class_].max_hp; + if(mob_db[((struct pet_data*)bl)->class_].mexp > 0) { + if(battle_config.mvp_hp_rate != 100) + max_hp = (max_hp * battle_config.mvp_hp_rate)/100; + } + else { + if(battle_config.monster_hp_rate != 100) + max_hp = (max_hp * battle_config.monster_hp_rate)/100; + } + } + if(sc_data) { + if(sc_data[SC_APPLEIDUN].timer!=-1) + max_hp += ((5+sc_data[SC_APPLEIDUN].val1*2+((sc_data[SC_APPLEIDUN].val2+1)>>1) + +sc_data[SC_APPLEIDUN].val3/10) * max_hp)/100; + if(sc_data[SC_GOSPEL].timer!=-1 && + sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 4) + max_hp += max_hp * 25 / 100; + } + if(max_hp < 1) max_hp = 1; + return max_hp; + } + return 1; +} +/*========================================== + * 対象のStrを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_str(struct block_list *bl) +{ + int str=0; + struct status_change *sc_data; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_MOB && ((struct mob_data *)bl)) { + str = mob_db[((struct mob_data *)bl)->class_].str; + if(battle_config.mobs_level_up) // mobs leveling up increase [Valaris] + str+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; + } + else if(bl->type==BL_PC && ((struct map_session_data *)bl)) + return ((struct map_session_data *)bl)->paramc[0]; + else if(bl->type==BL_PET && ((struct pet_data *)bl)) + str = mob_db[((struct pet_data *)bl)->class_].str; + + if(sc_data) { + if(sc_data[SC_LOUD].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && bl->type != BL_PC) + str += 4; + if( sc_data[SC_BLESSING].timer != -1 && bl->type != BL_PC){ // ブレッシング + int race=status_get_race(bl); + if(battle_check_undead(race,status_get_elem_type(bl)) || race==6 ) str >>= 1; // 悪 魔/不死 + else str += sc_data[SC_BLESSING].val1; // その他 + } + if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト + str += 5; + } + if(str < 0) str = 0; + return str; +} +/*========================================== + * 対象のAgiを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ + +int status_get_agi(struct block_list *bl) +{ + int agi=0; + struct status_change *sc_data; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) { + agi=mob_db[((struct mob_data *)bl)->class_].agi; + if(battle_config.mobs_level_up) // increase of mobs leveling up [Valaris] + agi+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; + } + else if(bl->type==BL_PC && (struct map_session_data *)bl) + agi=((struct map_session_data *)bl)->paramc[1]; + else if(bl->type==BL_PET && (struct pet_data *)bl) + agi=mob_db[((struct pet_data *)bl)->class_].agi; + + if(sc_data) { + if( sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1 && + bl->type != BL_PC) // 速度増加(PCはpc.cで) + agi += 2+sc_data[SC_INCREASEAGI].val1; + + if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && bl->type != BL_PC) + agi += agi*(2+sc_data[SC_CONCENTRATE].val1)/100; + + if(sc_data[SC_DECREASEAGI].timer!=-1) // 速度減少 + agi -= 2+sc_data[SC_DECREASEAGI].val1; + + if(sc_data[SC_QUAGMIRE].timer!=-1 ) { // クァグマイア + //agi >>= 1; + //int agib = agi*(sc_data[SC_QUAGMIRE].val1*10)/100; + //agi -= agib > 50 ? 50 : agib; + agi -= (bl->type == BL_PC) ? sc_data[SC_QUAGMIRE].val1*5 : sc_data[SC_QUAGMIRE].val1*10; + } + if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト + agi += 5; + } + if(agi < 0) agi = 0; + return agi; +} +/*========================================== + * 対象のVitを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_vit(struct block_list *bl) +{ + int vit=0; + struct status_change *sc_data; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) { + vit=mob_db[((struct mob_data *)bl)->class_].vit; + if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] + vit+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; + } + else if(bl->type==BL_PC && (struct map_session_data *)bl) + vit=((struct map_session_data *)bl)->paramc[2]; + else if(bl->type==BL_PET && (struct pet_data *)bl) + vit=mob_db[((struct pet_data *)bl)->class_].vit; + if(sc_data) { + if(sc_data[SC_STRIPARMOR].timer != -1 && bl->type!=BL_PC) + vit = vit*60/100; + if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト + vit += 5; + } + + if(vit < 0) vit = 0; + return vit; +} +/*========================================== + * 対象のIntを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_int(struct block_list *bl) +{ + int int_=0; + struct status_change *sc_data; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_MOB && (struct mob_data *)bl){ + int_=mob_db[((struct mob_data *)bl)->class_].int_; + if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] + int_+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; + } + else if(bl->type==BL_PC && (struct map_session_data *)bl) + int_=((struct map_session_data *)bl)->paramc[3]; + else if(bl->type==BL_PET && (struct pet_data *)bl) + int_=mob_db[((struct pet_data *)bl)->class_].int_; + + if(sc_data) { + if( sc_data[SC_BLESSING].timer != -1 && bl->type != BL_PC){ // ブレッシング + int race=status_get_race(bl); + if(battle_check_undead(race,status_get_elem_type(bl)) || race==6 ) int_ >>= 1; // 悪 魔/不死 + else int_ += sc_data[SC_BLESSING].val1; // その他 + } + if( sc_data[SC_STRIPHELM].timer != -1 && bl->type != BL_PC) + int_ = int_*60/100; + if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト + int_ += 5; + } + if(int_ < 0) int_ = 0; + return int_; +} +/*========================================== + * 対象のDexを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_dex(struct block_list *bl) +{ + int dex=0; + struct status_change *sc_data; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) { + dex=mob_db[((struct mob_data *)bl)->class_].dex; + if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] + dex+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; + } + else if(bl->type==BL_PC && (struct map_session_data *)bl) + dex=((struct map_session_data *)bl)->paramc[4]; + else if(bl->type==BL_PET && (struct pet_data *)bl) + dex=mob_db[((struct pet_data *)bl)->class_].dex; + + if(sc_data) { + if(sc_data[SC_CONCENTRATE].timer!=-1 && sc_data[SC_QUAGMIRE].timer == -1 && bl->type != BL_PC) + dex += dex*(2+sc_data[SC_CONCENTRATE].val1)/100; + + if( sc_data[SC_BLESSING].timer != -1 && bl->type != BL_PC){ // ブレッシング + int race=status_get_race(bl); + if(battle_check_undead(race,status_get_elem_type(bl)) || race==6 ) dex >>= 1; // 悪 魔/不死 + else dex += sc_data[SC_BLESSING].val1; // その他 + } + + if(sc_data[SC_QUAGMIRE].timer!=-1 ) { // クァグマイア + // dex >>= 1; + //int dexb = dex*(sc_data[SC_QUAGMIRE].val1*10)/100; + //dex -= dexb > 50 ? 50 : dexb; + dex -= (bl->type == BL_PC) ? sc_data[SC_QUAGMIRE].val1*5 : sc_data[SC_QUAGMIRE].val1*10; + } + if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト + dex += 5; + } + if(dex < 0) dex = 0; + return dex; +} +/*========================================== + * 対象のLukを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_luk(struct block_list *bl) +{ + int luk=0; + struct status_change *sc_data; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) { + luk=mob_db[((struct mob_data *)bl)->class_].luk; + if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] + luk+=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; + } + else if(bl->type==BL_PC && (struct map_session_data *)bl) + luk=((struct map_session_data *)bl)->paramc[5]; + else if(bl->type==BL_PET && (struct pet_data *)bl) + luk=mob_db[((struct pet_data *)bl)->class_].luk; + + if(sc_data) { + if(sc_data[SC_GLORIA].timer!=-1 && bl->type != BL_PC) // グロリア(PCはpc.cで) + luk += 30; + if(sc_data[SC_CURSE].timer!=-1 ) // 呪い + luk=0; + if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) // トゥルーサイト + luk += 5; + } + if(luk < 0) luk = 0; + return luk; +} + +/*========================================== + * 対象のFleeを返す(汎用) + * 戻りは整数で1以上 + *------------------------------------------ + */ +int status_get_flee(struct block_list *bl) +{ + int flee=1; + struct status_change *sc_data; + + nullpo_retr(1, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + flee=((struct map_session_data *)bl)->flee; + else + flee=status_get_agi(bl) + status_get_lv(bl); + + if(bl->type != BL_PC && sc_data){ + if(sc_data[SC_WHISTLE].timer!=-1) + flee += flee*(sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2 + +(sc_data[SC_WHISTLE].val3>>16))/100; + if(sc_data[SC_BLIND].timer!=-1) + flee -= flee*25/100; + if(sc_data[SC_WINDWALK].timer!=-1) // ウィンドウォーク + flee += flee*(sc_data[SC_WINDWALK].val2)/100; + if(sc_data[SC_SPIDERWEB].timer!=-1) //スパイダーウェブ + flee -= flee*50/100; + if(sc_data[SC_GOSPEL].timer!=-1) { + if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 13) + flee += flee*5/100; + else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 7) + flee = 0; + } + } + if(flee < 1) flee = 1; + return flee; +} +/*========================================== + * 対象のHitを返す(汎用) + * 戻りは整数で1以上 + *------------------------------------------ + */ +int status_get_hit(struct block_list *bl) +{ + int hit=1; + struct status_change *sc_data; + + nullpo_retr(1, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + hit=((struct map_session_data *)bl)->hit; + else + hit=status_get_dex(bl) + status_get_lv(bl); + + if(bl->type != BL_PC && sc_data) { + if(sc_data[SC_HUMMING].timer!=-1) // + hit += hit*(sc_data[SC_HUMMING].val1*2+sc_data[SC_HUMMING].val2 + +sc_data[SC_HUMMING].val3)/100; + if(sc_data[SC_BLIND].timer!=-1) // 呪い + hit -= hit*25/100; + if(sc_data[SC_TRUESIGHT].timer!=-1) // トゥルーサイト + hit += 3*(sc_data[SC_TRUESIGHT].val1); + if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション + hit += (hit*(10*(sc_data[SC_CONCENTRATION].val1)))/100; + if(sc_data[SC_GOSPEL].timer!=-1 && + sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 14) + hit += hit*5/100; + } + if(hit < 1) hit = 1; + return hit; +} +/*========================================== + * 対象の完全回避を返す(汎用) + * 戻りは整数で1以上 + *------------------------------------------ + */ +int status_get_flee2(struct block_list *bl) +{ + int flee2=1; + struct status_change *sc_data; + + nullpo_retr(1, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC && (struct map_session_data *)bl){ + flee2 = status_get_luk(bl) + 10; + flee2 += ((struct map_session_data *)bl)->flee2 - (((struct map_session_data *)bl)->paramc[5] + 10); + } + else + flee2=status_get_luk(bl)+1; + + if(sc_data) { + if(sc_data[SC_WHISTLE].timer!=-1 && bl->type != BL_PC) + flee2 += (sc_data[SC_WHISTLE].val1+sc_data[SC_WHISTLE].val2 + +(sc_data[SC_WHISTLE].val3&0xffff))*10; + } + if(flee2 < 1) flee2 = 1; + return flee2; +} +/*========================================== + * 対象のクリティカルを返す(汎用) + * 戻りは整数で1以上 + *------------------------------------------ + */ +int status_get_critical(struct block_list *bl) +{ + int critical=1; + struct status_change *sc_data; + + nullpo_retr(1, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC && (struct map_session_data *)bl){ + critical = status_get_luk(bl)*3 + 10; + critical += ((struct map_session_data *)bl)->critical - ((((struct map_session_data *)bl)->paramc[5]*3) + 10); + } + else + critical=status_get_luk(bl)*3 + 1; + + if(sc_data) { + if(sc_data[SC_FORTUNE].timer!=-1 && bl->type != BL_PC) + critical += (10+sc_data[SC_FORTUNE].val1+sc_data[SC_FORTUNE].val2 + +sc_data[SC_FORTUNE].val3)*10; + if(sc_data[SC_EXPLOSIONSPIRITS].timer!=-1 && bl->type != BL_PC) + critical += sc_data[SC_EXPLOSIONSPIRITS].val2; + if(sc_data[SC_TRUESIGHT].timer!=-1 && bl->type != BL_PC) //トゥルーサイト + critical += critical*sc_data[SC_TRUESIGHT].val1/100; + } + if(critical < 1) critical = 1; + return critical; +} +/*========================================== + * base_atkの取得 + * 戻りは整数で1以上 + *------------------------------------------ + */ +int status_get_baseatk(struct block_list *bl) +{ + struct status_change *sc_data; + int batk=1; + + nullpo_retr(1, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) { + batk = ((struct map_session_data *)bl)->base_atk; //設定されているbase_atk + if (((struct map_session_data *)bl)->status.weapon < 16) + batk += ((struct map_session_data *)bl)->weapon_atk[((struct map_session_data *)bl)->status.weapon]; + } else { //それ以外なら + int str,dstr; + str = status_get_str(bl); //STR + dstr = str/10; + batk = dstr*dstr + str; //base_atkを計算する + } + if(sc_data) { //状態異常あり + if(sc_data[SC_PROVOKE].timer!=-1 && bl->type != BL_PC) //PCでプロボック(SM_PROVOKE)状態 + batk = batk*(100+2*sc_data[SC_PROVOKE].val1)/100; //base_atk増加 + if(sc_data[SC_CURSE].timer!=-1 ) //呪われていたら + batk -= batk*25/100; //base_atkが25%減少 + if(sc_data[SC_CONCENTRATION].timer!=-1 && bl->type != BL_PC) //コンセントレーション + batk += batk*(5*sc_data[SC_CONCENTRATION].val1)/100; + } + if(batk < 1) batk = 1; //base_atkは最低でも1 + return batk; +} +/*========================================== + * 対象のAtkを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_atk(struct block_list *bl) +{ + struct status_change *sc_data; + int atk=0; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + atk = ((struct map_session_data*)bl)->watk; + else if(bl->type==BL_MOB && (struct mob_data *)bl) + atk = mob_db[((struct mob_data*)bl)->class_].atk1; + else if(bl->type==BL_PET && (struct pet_data *)bl) + atk = mob_db[((struct pet_data*)bl)->class_].atk1; + + if(bl->type != BL_PC && sc_data) { + if(sc_data[SC_PROVOKE].timer!=-1) + atk = atk*(100+2*sc_data[SC_PROVOKE].val1)/100; + if(sc_data[SC_CURSE].timer!=-1) + atk -= atk*25/100; + if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション + atk += atk*(5*sc_data[SC_CONCENTRATION].val1)/100; + + if(sc_data[SC_GOSPEL].timer!=-1) { + if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 12) + atk += atk*8/100; + else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 6) + atk = 0; + } + } + if(atk < 0) atk = 0; + return atk; +} +/*========================================== + * 対象の左手Atkを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_atk_(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl){ + int atk=((struct map_session_data*)bl)->watk_; + return atk; + } + else + return 0; +} +/*========================================== + * 対象のAtk2を返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_atk2(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data*)bl)->watk2; + else { + struct status_change *sc_data=status_get_sc_data(bl); + int atk2=0; + if(bl->type==BL_MOB && (struct mob_data *)bl) + atk2 = mob_db[((struct mob_data*)bl)->class_].atk2; + else if(bl->type==BL_PET && (struct pet_data *)bl) + atk2 = mob_db[((struct pet_data*)bl)->class_].atk2; + if(sc_data) { + if( sc_data[SC_IMPOSITIO].timer!=-1) + atk2 += sc_data[SC_IMPOSITIO].val1*5; + if( sc_data[SC_PROVOKE].timer!=-1 ) + atk2 = atk2*(100+2*sc_data[SC_PROVOKE].val1)/100; + if( sc_data[SC_CURSE].timer!=-1 ) + atk2 -= atk2*25/100; + if(sc_data[SC_DRUMBATTLE].timer!=-1) + atk2 += sc_data[SC_DRUMBATTLE].val2; + if(sc_data[SC_NIBELUNGEN].timer!=-1 && (status_get_element(bl)/10) >= 8 ) + atk2 += sc_data[SC_NIBELUNGEN].val3; + if(sc_data[SC_STRIPWEAPON].timer!=-1) + atk2 = atk2*sc_data[SC_STRIPWEAPON].val2/100; + if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション + atk2 += atk2*(5*sc_data[SC_CONCENTRATION].val1)/100; + } + if(atk2 < 0) atk2 = 0; + return atk2; + } + return 0; +} +/*========================================== + * 対象の左手Atk2を返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_atk_2(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data*)bl)->watk_2; + else + return 0; +} +/*========================================== + * 対象のMAtk1を返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_matk1(struct block_list *bl) +{ + struct status_change *sc_data; + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_MOB){ + int matk,int_=status_get_int(bl); + matk = int_+(int_/5)*(int_/5); + + if(sc_data) + if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) + matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; + return matk; + } + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->matk1; + else if(bl->type==BL_PET){ + int matk,int_=status_get_int(bl); + matk = int_+(int_/5)*(int_/5); + + if(sc_data) + if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) + matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; + return matk; + } + else + return 0; +} +/*========================================== + * 対象のMAtk2を返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_matk2(struct block_list *bl) +{ + struct status_change *sc_data=status_get_sc_data(bl); + nullpo_retr(0, bl); + if(bl->type==BL_MOB){ + int matk,int_=status_get_int(bl); + matk = int_+(int_/7)*(int_/7); + + if(sc_data) + if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) + matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; + return matk; + } + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->matk2; + else if(bl->type==BL_PET){ + int matk,int_=status_get_int(bl); + matk = int_+(int_/7)*(int_/7); + if(sc_data) + if(sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) + matk = matk*(100+2*sc_data[SC_MINDBREAKER].val1)/100; + return matk; + } + else + return 0; +} +/*========================================== + * 対象のDefを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_def(struct block_list *bl) +{ + struct status_change *sc_data; + int def=0,skilltimer=-1,skillid=0; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC && (struct map_session_data *)bl){ + def = ((struct map_session_data *)bl)->def; + skilltimer = ((struct map_session_data *)bl)->skilltimer; + skillid = ((struct map_session_data *)bl)->skillid; + } + else if(bl->type==BL_MOB && (struct mob_data *)bl) { + def = mob_db[((struct mob_data *)bl)->class_].def; + skilltimer = ((struct mob_data *)bl)->skilltimer; + skillid = ((struct mob_data *)bl)->skillid; + } + else if(bl->type==BL_PET && (struct pet_data *)bl) + def = mob_db[((struct pet_data *)bl)->class_].def; + + if(def < 1000000) { + if(sc_data) { + //凍結、石化時は右シフト + if(sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0)) + def >>= 1; + + if (bl->type != BL_PC) { + //キーピング時はDEF100 + if( sc_data[SC_KEEPING].timer!=-1) + def = 100; + //プロボック時は減算 + if( sc_data[SC_PROVOKE].timer!=-1) + def = (def*(100 - 6*sc_data[SC_PROVOKE].val1)+50)/100; + //戦太鼓の響き時は加算 + if( sc_data[SC_DRUMBATTLE].timer!=-1) + def += sc_data[SC_DRUMBATTLE].val3; + //毒にかかっている時は減算 + if(sc_data[SC_POISON].timer!=-1) + def = def*75/100; + //ストリップシールド時は減算 + if(sc_data[SC_STRIPSHIELD].timer!=-1) + def = def*sc_data[SC_STRIPSHIELD].val2/100; + //シグナムクルシス時は減算 + if(sc_data[SC_SIGNUMCRUCIS].timer!=-1) + def = def * (100 - sc_data[SC_SIGNUMCRUCIS].val2)/100; + //永遠の混沌時はDEF0になる + if(sc_data[SC_ETERNALCHAOS].timer!=-1) + def = 0; + //コンセントレーション時は減算 + if( sc_data[SC_CONCENTRATION].timer!=-1) + def = (def*(100 - 5*sc_data[SC_CONCENTRATION].val1))/100; + + if(sc_data[SC_GOSPEL].timer!=-1) { + if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 11) + def += def*25/100; + else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 5) + def = 0; + } + } + } + //詠唱中は詠唱時減算率に基づいて減算 + if(skilltimer != -1) { + int def_rate = skill_get_castdef(skillid); + if(def_rate != 0) + def = (def * (100 - def_rate))/100; + } + } + if(def < 0) def = 0; + return def; +} +/*========================================== + * 対象のMDefを返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_mdef(struct block_list *bl) +{ + struct status_change *sc_data; + int mdef=0; + + nullpo_retr(0, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + mdef = ((struct map_session_data *)bl)->mdef; + else if(bl->type==BL_MOB && (struct mob_data *)bl) + mdef = mob_db[((struct mob_data *)bl)->class_].mdef; + else if(bl->type==BL_PET && (struct pet_data *)bl) + mdef = mob_db[((struct pet_data *)bl)->class_].mdef; + + if(mdef < 1000000) { + if(sc_data) { + //バリアー状態時はMDEF100 + if(sc_data[SC_BARRIER].timer != -1) + mdef = 100; + //凍結、石化時は1.25倍 + if(sc_data[SC_FREEZE].timer != -1 || (sc_data[SC_STONE].timer != -1 && sc_data[SC_STONE].val2 == 0)) + mdef = mdef*125/100; + if( sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) + mdef -= (mdef*6*sc_data[SC_MINDBREAKER].val1)/100; + } + } + if(mdef < 0) mdef = 0; + return mdef; +} +/*========================================== + * 対象のDef2を返す(汎用) + * 戻りは整数で1以上 + *------------------------------------------ + */ +int status_get_def2(struct block_list *bl) +{ + struct status_change *sc_data; + int def2=1; + + nullpo_retr(1, bl); + sc_data=status_get_sc_data(bl); + if(bl->type==BL_PC) + def2 = ((struct map_session_data *)bl)->def2; + else if(bl->type==BL_MOB) + def2 = mob_db[((struct mob_data *)bl)->class_].vit; + else if(bl->type==BL_PET) + def2 = mob_db[((struct pet_data *)bl)->class_].vit; + + if(bl->type != BL_PC && sc_data) { + if( sc_data[SC_ANGELUS].timer!=-1) + def2 = def2*(110+5*sc_data[SC_ANGELUS].val1)/100; + if( sc_data[SC_PROVOKE].timer!=-1) + def2 = (def2*(100 - 6*sc_data[SC_PROVOKE].val1)+50)/100; + if(sc_data[SC_POISON].timer!=-1) + def2 = def2*75/100; + //コンセントレーション時は減算 + if( sc_data[SC_CONCENTRATION].timer!=-1) + def2 = def2*(100 - 5*sc_data[SC_CONCENTRATION].val1)/100; + + if(sc_data[SC_GOSPEL].timer!=-1) { + if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && + sc_data[SC_GOSPEL].val3 == 11) + def2 += def2*25/100; + else if (sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 5) + def2 = 0; + } + } + if(def2 < 1) def2 = 1; + return def2; +} +/*========================================== + * 対象のMDef2を返す(汎用) + * 戻りは整数で0以上 + *------------------------------------------ + */ +int status_get_mdef2(struct block_list *bl) +{ + int mdef2=0; + struct status_change *sc_data=status_get_sc_data(bl); + + nullpo_retr(0, bl); + if(bl->type==BL_MOB) + mdef2 = mob_db[((struct mob_data *)bl)->class_].int_ + (mob_db[((struct mob_data *)bl)->class_].vit>>1); + else if(bl->type==BL_PC) + mdef2 = ((struct map_session_data *)bl)->mdef2 + (((struct map_session_data *)bl)->paramc[2]>>1); + else if(bl->type==BL_PET) + mdef2 = mob_db[((struct pet_data *)bl)->class_].int_ + (mob_db[((struct pet_data *)bl)->class_].vit>>1); + if(sc_data) { + if( sc_data[SC_MINDBREAKER].timer!=-1 && bl->type != BL_PC) + mdef2 -= (mdef2*6*sc_data[SC_MINDBREAKER].val1)/100; + } + if(mdef2 < 0) mdef2 = 0; + return mdef2; +} +/*========================================== + * 対象のSpeed(移動速度)を返す(汎用) + * 戻りは整数で1以上 + * Speedは小さいほうが移動速度が速い + *------------------------------------------ + */ +int status_get_speed(struct block_list *bl) +{ + nullpo_retr(1000, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->speed; + else { + struct status_change *sc_data=status_get_sc_data(bl); + int speed = 1000; + if(bl->type==BL_MOB && (struct mob_data *)bl) { + speed = ((struct mob_data *)bl)->speed; + if(battle_config.mobs_level_up) // increase from mobs leveling up [Valaris] + speed-=((struct mob_data *)bl)->level - mob_db[((struct mob_data *)bl)->class_].lv; + } + else if(bl->type==BL_PET && (struct pet_data *)bl) + speed = ((struct pet_data *)bl)->msd->petDB->speed; + + if(sc_data) { + //速度増加時は25%減算 + if(sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_DONTFORGETME].timer == -1) + speed -= speed*25/100; + //速度減少時は25%加算 + if(sc_data[SC_DECREASEAGI].timer!=-1) + speed = speed*125/100; + //クァグマイア時は50%加算 + if(sc_data[SC_QUAGMIRE].timer!=-1) + speed = speed*3/2; + //私を忘れないで…時は加算 + if(sc_data[SC_DONTFORGETME].timer!=-1) + speed = speed*(100+sc_data[SC_DONTFORGETME].val1*2 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3&0xffff))/100; + //金剛時は25%加算 + if(sc_data[SC_STEELBODY].timer!=-1) + speed = speed*125/100; + //ディフェンダー時は加算 + // removed as of 12/14's patch [celest] + /*if(sc_data[SC_DEFENDER].timer!=-1) + speed = (speed * (155 - sc_data[SC_DEFENDER].val1*5)) / 100;*/ + //踊り状態は4倍遅い + if(sc_data[SC_DANCING].timer!=-1 ) + speed *= 6; + //呪い時は450加算 + if(sc_data[SC_CURSE].timer!=-1) + speed = speed + 450; + //ウィンドウォーク時はLv*2%減算 + if(sc_data[SC_WINDWALK].timer!=-1 && sc_data[SC_INCREASEAGI].timer==-1) + speed -= (speed*(sc_data[SC_WINDWALK].val1*2))/100; + if(sc_data[SC_SLOWDOWN].timer!=-1) + speed = speed*150/100; + if(sc_data[SC_SPEEDUP0].timer!=-1) + speed -= speed*25/100; + if(sc_data[SC_GOSPEL].timer!=-1 && + sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 8) + speed = speed*125/100; + } + if(speed < 1) speed = 1; + return speed; + } + + return 1000; +} +/*========================================== + * 対象のaDelay(攻撃時ディレイ)を返す(汎用) + * aDelayは小さいほうが攻撃速度が速い + *------------------------------------------ + */ +int status_get_adelay(struct block_list *bl) +{ + nullpo_retr(4000, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + return (((struct map_session_data *)bl)->aspd<<1); + else { + struct status_change *sc_data=status_get_sc_data(bl); + int adelay=4000,aspd_rate = 100,i; + if(bl->type==BL_MOB && (struct mob_data *)bl) + adelay = mob_db[((struct mob_data *)bl)->class_].adelay; + else if(bl->type==BL_PET && (struct pet_data *)bl) + adelay = mob_db[((struct pet_data *)bl)->class_].adelay; + + if(sc_data) { + //ツーハンドクイッケン使用時でクァグマイアでも私を忘れないで…でもない時は3割減算 + if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // 2HQ + aspd_rate -= 30; + //アドレナリンラッシュ使用時でツーハンドクイッケンでもクァグマイアでも私を忘れないで…でもない時は + if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 && + sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ + //使用者とパーティメンバーで格差が出る設定でなければ3割減算 + if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) + aspd_rate -= 30; + //そうでなければ2.5割減算 + else + aspd_rate -= 25; + } + //スピアクィッケン時は減算 + if(sc_data[SC_SPEARSQUICKEN].timer != -1 && sc_data[SC_ADRENALINE].timer == -1 && + sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // スピアクィッケン + aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2; + //夕日のアサシンクロス時は減算 + if(sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス + sc_data[SC_TWOHANDQUICKEN].timer==-1 && sc_data[SC_ADRENALINE].timer==-1 && sc_data[SC_SPEARSQUICKEN].timer==-1 && + sc_data[SC_DONTFORGETME].timer == -1) + aspd_rate -= 5+sc_data[SC_ASSNCROS].val1+sc_data[SC_ASSNCROS].val2+sc_data[SC_ASSNCROS].val3; + //私を忘れないで…時は加算 + if(sc_data[SC_DONTFORGETME].timer!=-1) // 私を忘れないで + aspd_rate += sc_data[SC_DONTFORGETME].val1*3 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3>>16); + //金剛時25%加算 + if(sc_data[SC_STEELBODY].timer!=-1) // 金剛 + aspd_rate += 25; + //増速ポーション使用時は減算 + if( sc_data[i=SC_SPEEDPOTION3].timer!=-1 || sc_data[i=SC_SPEEDPOTION2].timer!=-1 || sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sc_data[i=SC_SPEEDPOTION0].timer!=-1) + aspd_rate -= sc_data[i].val2; + //ディフェンダー時は加算 + if(sc_data[SC_DEFENDER].timer != -1) + adelay += (1100 - sc_data[SC_DEFENDER].val1*100); + if(sc_data[SC_GOSPEL].timer!=-1 && + sc_data[SC_GOSPEL].val4 == BCT_ENEMY && + sc_data[SC_GOSPEL].val3 == 8) + aspd_rate = aspd_rate*125/100; + } + if(aspd_rate != 100) + adelay = adelay*aspd_rate/100; + if(adelay < battle_config.monster_max_aspd<<1) adelay = battle_config.monster_max_aspd<<1; + return adelay; + } + return 4000; +} +int status_get_amotion(struct block_list *bl) +{ + nullpo_retr(2000, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->amotion; + else { + struct status_change *sc_data=status_get_sc_data(bl); + int amotion=2000,aspd_rate = 100,i; + if(bl->type==BL_MOB && (struct mob_data *)bl) + amotion = mob_db[((struct mob_data *)bl)->class_].amotion; + else if(bl->type==BL_PET && (struct pet_data *)bl) + amotion = mob_db[((struct pet_data *)bl)->class_].amotion; + + if(sc_data) { + if(sc_data[SC_TWOHANDQUICKEN].timer != -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // 2HQ + aspd_rate -= 30; + if(sc_data[SC_ADRENALINE].timer != -1 && sc_data[SC_TWOHANDQUICKEN].timer == -1 && + sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) { // アドレナリンラッシュ + if(sc_data[SC_ADRENALINE].val2 || !battle_config.party_skill_penalty) + aspd_rate -= 30; + else + aspd_rate -= 25; + } + if(sc_data[SC_SPEARSQUICKEN].timer != -1 && sc_data[SC_ADRENALINE].timer == -1 && + sc_data[SC_TWOHANDQUICKEN].timer == -1 && sc_data[SC_QUAGMIRE].timer == -1 && sc_data[SC_DONTFORGETME].timer == -1) // スピアクィッケン + aspd_rate -= sc_data[SC_SPEARSQUICKEN].val2; + if(sc_data[SC_ASSNCROS].timer!=-1 && // 夕陽のアサシンクロス + sc_data[SC_TWOHANDQUICKEN].timer==-1 && sc_data[SC_ADRENALINE].timer==-1 && sc_data[SC_SPEARSQUICKEN].timer==-1 && + sc_data[SC_DONTFORGETME].timer == -1) + aspd_rate -= 5+sc_data[SC_ASSNCROS].val1+sc_data[SC_ASSNCROS].val2+sc_data[SC_ASSNCROS].val3; + if(sc_data[SC_DONTFORGETME].timer!=-1) // 私を忘れないで + aspd_rate += sc_data[SC_DONTFORGETME].val1*3 + sc_data[SC_DONTFORGETME].val2 + (sc_data[SC_DONTFORGETME].val3>>16); + if(sc_data[SC_STEELBODY].timer!=-1) // 金剛 + aspd_rate += 25; + if( sc_data[i=SC_SPEEDPOTION3].timer!=-1 || sc_data[i=SC_SPEEDPOTION2].timer!=-1 || sc_data[i=SC_SPEEDPOTION1].timer!=-1 || sc_data[i=SC_SPEEDPOTION0].timer!=-1) + aspd_rate -= sc_data[i].val2; + if(sc_data[SC_DEFENDER].timer != -1) + amotion += (550 - sc_data[SC_DEFENDER].val1*50); + } + if(aspd_rate != 100) + amotion = amotion*aspd_rate/100; + if(amotion < battle_config.monster_max_aspd) amotion = battle_config.monster_max_aspd; + return amotion; + } + return 2000; +} +int status_get_dmotion(struct block_list *bl) +{ + int ret; + struct status_change *sc_data; + + nullpo_retr(0, bl); + sc_data = status_get_sc_data(bl); + if(bl->type==BL_MOB && (struct mob_data *)bl){ + ret=mob_db[((struct mob_data *)bl)->class_].dmotion; + if(battle_config.monster_damage_delay_rate != 100) + ret = ret*battle_config.monster_damage_delay_rate/400; + } + else if(bl->type==BL_PC && (struct map_session_data *)bl){ + ret=((struct map_session_data *)bl)->dmotion; + if(battle_config.pc_damage_delay_rate != 100) + ret = ret*battle_config.pc_damage_delay_rate/400; + } + else if(bl->type==BL_PET && (struct pet_data *)bl) + ret=mob_db[((struct pet_data *)bl)->class_].dmotion; + else + return 2000; + + if((sc_data && (sc_data[SC_ENDURE].timer!=-1 || sc_data[SC_BERSERK].timer!=-1)) || + (bl->type == BL_PC && ((struct map_session_data *)bl)->special_state.infinite_endure)) + ret=0; + + return ret; +} +int status_get_element(struct block_list *bl) +{ + int ret = 20; + struct status_change *sc_data; + + nullpo_retr(ret, bl); + sc_data = status_get_sc_data(bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) // 10の位=Lv*2、1の位=属性 + ret=((struct mob_data *)bl)->def_ele; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + ret=20+((struct map_session_data *)bl)->def_ele; // 防御属性Lv1 + else if(bl->type==BL_PET && (struct pet_data *)bl) + ret = mob_db[((struct pet_data *)bl)->class_].element; + + if(sc_data) { + if( sc_data[SC_BENEDICTIO].timer!=-1 ) // 聖体降福 + ret=26; + if( sc_data[SC_FREEZE].timer!=-1 ) // 凍結 + ret=21; + if( sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0) + ret=22; + } + + return ret; +} + +int status_get_attack_element(struct block_list *bl) +{ + int ret = 0; + struct status_change *sc_data=status_get_sc_data(bl); + + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + ret=0; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + ret=((struct map_session_data *)bl)->atk_ele; + else if(bl->type==BL_PET && (struct pet_data *)bl) + ret=0; + + if(sc_data) { + if( sc_data[SC_FROSTWEAPON].timer!=-1) // フロストウェポン + ret=1; + if( sc_data[SC_SEISMICWEAPON].timer!=-1) // サイズミックウェポン + ret=2; + if( sc_data[SC_FLAMELAUNCHER].timer!=-1) // フレームランチャー + ret=3; + if( sc_data[SC_LIGHTNINGLOADER].timer!=-1) // ライトニングローダー + ret=4; + if( sc_data[SC_ENCPOISON].timer!=-1) // エンチャントポイズン + ret=5; + if( sc_data[SC_ASPERSIO].timer!=-1) // アスペルシオ + ret=6; + } + + return ret; +} +int status_get_attack_element2(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) { + int ret = ((struct map_session_data *)bl)->atk_ele_; + struct status_change *sc_data = ((struct map_session_data *)bl)->sc_data; + + if(sc_data) { + if( sc_data[SC_FROSTWEAPON].timer!=-1) // フロストウェポン + ret=1; + if( sc_data[SC_SEISMICWEAPON].timer!=-1) // サイズミックウェポン + ret=2; + if( sc_data[SC_FLAMELAUNCHER].timer!=-1) // フレームランチャー + ret=3; + if( sc_data[SC_LIGHTNINGLOADER].timer!=-1) // ライトニングローダー + ret=4; + if( sc_data[SC_ENCPOISON].timer!=-1) // エンチャントポイズン + ret=5; + if( sc_data[SC_ASPERSIO].timer!=-1) // アスペルシオ + ret=6; + } + return ret; + } + return 0; +} +int status_get_party_id(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->status.party_id; + else if(bl->type==BL_MOB && (struct mob_data *)bl){ + struct mob_data *md=(struct mob_data *)bl; + if( md->master_id>0 ) + return -md->master_id; + return -md->bl.id; + } + else if(bl->type==BL_SKILL && (struct skill_unit *)bl) + return ((struct skill_unit *)bl)->group->party_id; + else + return 0; +} +int status_get_guild_id(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data *)bl)->status.guild_id; + else if(bl->type==BL_MOB && (struct mob_data *)bl) + return ((struct mob_data *)bl)->class_; + else if(bl->type==BL_SKILL && (struct skill_unit *)bl) + return ((struct skill_unit *)bl)->group->guild_id; + else + return 0; +} +int status_get_race(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return mob_db[((struct mob_data *)bl)->class_].race; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return 7; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return mob_db[((struct pet_data *)bl)->class_].race; + else + return 0; +} +int status_get_size(struct block_list *bl) +{ + nullpo_retr(1, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return mob_db[((struct mob_data *)bl)->class_].size; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return 1; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return mob_db[((struct pet_data *)bl)->class_].size; + else + return 1; +} +int status_get_mode(struct block_list *bl) +{ + nullpo_retr(0x01, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return mob_db[((struct mob_data *)bl)->class_].mode; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return mob_db[((struct pet_data *)bl)->class_].mode; + else + return 0x01; // とりあえず動くということで1 +} + +int status_get_mexp(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return mob_db[((struct mob_data *)bl)->class_].mexp; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return mob_db[((struct pet_data *)bl)->class_].mexp; + else + return 0; +} + +// StatusChange系の所得 +struct status_change *status_get_sc_data(struct block_list *bl) +{ + nullpo_retr(NULL, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return ((struct mob_data*)bl)->sc_data; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return ((struct map_session_data*)bl)->sc_data; + return NULL; +} +short *status_get_sc_count(struct block_list *bl) +{ + nullpo_retr(NULL, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return &((struct mob_data*)bl)->sc_count; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return &((struct map_session_data*)bl)->sc_count; + return NULL; +} +short *status_get_opt1(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return &((struct mob_data*)bl)->opt1; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return &((struct map_session_data*)bl)->opt1; + else if(bl->type==BL_NPC && (struct npc_data *)bl) + return &((struct npc_data*)bl)->opt1; + return 0; +} +short *status_get_opt2(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return &((struct mob_data*)bl)->opt2; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return &((struct map_session_data*)bl)->opt2; + else if(bl->type==BL_NPC && (struct npc_data *)bl) + return &((struct npc_data*)bl)->opt2; + return 0; +} +short *status_get_opt3(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return &((struct mob_data*)bl)->opt3; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return &((struct map_session_data*)bl)->opt3; + else if(bl->type==BL_NPC && (struct npc_data *)bl) + return &((struct npc_data*)bl)->opt3; + return 0; +} +short *status_get_option(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type==BL_MOB && (struct mob_data *)bl) + return &((struct mob_data*)bl)->option; + else if(bl->type==BL_PC && (struct map_session_data *)bl) + return &((struct map_session_data*)bl)->status.option; + else if(bl->type==BL_NPC && (struct npc_data *)bl) + return &((struct npc_data*)bl)->option; + return 0; +} + +/*========================================== + * ステータス異常開始 + *------------------------------------------ + */ +int status_change_start(struct block_list *bl,int type,int val1,int val2,int val3,int val4,int tick,int flag) +{ + struct map_session_data *sd = NULL; + struct status_change* sc_data; + short *sc_count, *option, *opt1, *opt2, *opt3; + int opt_flag = 0, calc_flag = 0,updateflag = 0, save_flag = 0, race, mode, elem, undead_flag; + int scdef=0; + + nullpo_retr(0, bl); + if(bl->type == BL_SKILL) + return 0; + nullpo_retr(0, sc_data=status_get_sc_data(bl)); + nullpo_retr(0, sc_count=status_get_sc_count(bl)); + nullpo_retr(0, option=status_get_option(bl)); + nullpo_retr(0, opt1=status_get_opt1(bl)); + nullpo_retr(0, opt2=status_get_opt2(bl)); + nullpo_retr(0, opt3=status_get_opt3(bl)); + + + race=status_get_race(bl); + mode=status_get_mode(bl); + elem=status_get_elem_type(bl); + undead_flag=battle_check_undead(race,elem); + + if(type == SC_AETERNA && (sc_data[SC_STONE].timer != -1 || sc_data[SC_FREEZE].timer != -1) ) + return 0; + + switch(type){ + case SC_STONE: + case SC_FREEZE: + scdef=3+status_get_mdef(bl)+status_get_luk(bl)/3; + break; + case SC_STAN: + case SC_SILENCE: + case SC_POISON: + case SC_DPOISON: + scdef=3+status_get_vit(bl)+status_get_luk(bl)/3; + break; + case SC_SLEEP: + case SC_BLIND: + scdef=3+status_get_int(bl)+status_get_luk(bl)/3; + break; + case SC_CURSE: + scdef=3+status_get_luk(bl); + break; + +// case SC_CONFUSION: + default: + scdef=0; + } + if(scdef>=100) + return 0; + if(bl->type==BL_PC){ + sd=(struct map_session_data *)bl; + if( sd && type == SC_ADRENALINE && !(skill_get_weapontype(BS_ADRENALINE)&(1<status.weapon))) + return 0; + + if(SC_STONE<=type && type<=SC_BLIND){ /* カ?ドによる耐性 */ + if( sd && sd->reseff[type-SC_STONE] > 0 && rand()%10000reseff[type-SC_STONE]){ + if(battle_config.battle_log) + printf("PC %d skill_sc_start: cardによる異常耐性?動\n",sd->bl.id); + return 0; + } + } + } + else if(bl->type == BL_MOB) { + } + else { + if(battle_config.error_log) + printf("status_change_start: neither MOB nor PC !\n"); + return 0; + } + + if(type==SC_FREEZE && undead_flag && !(flag&1)) + return 0; + + if((type == SC_ADRENALINE || type == SC_WEAPONPERFECTION || type == SC_OVERTHRUST) && + sc_data[type].timer != -1 && sc_data[type].val2 && !val2) + return 0; + + if(mode & 0x20 && (type==SC_STONE || type==SC_FREEZE || + type==SC_STAN || type==SC_SLEEP || type==SC_SILENCE || type==SC_QUAGMIRE || type == SC_DECREASEAGI || type == SC_SIGNUMCRUCIS || type == SC_PROVOKE || + (type == SC_BLESSING && (undead_flag || race == 6))) && !(flag&1)){ + /* ボスには?かない(ただしカ?ドによる?果は適用される) */ + return 0; + } + if(type==SC_FREEZE || type==SC_STAN || type==SC_SLEEP) + battle_stopwalking(bl,1); + + if(sc_data[type].timer != -1){ /* すでに同じ異常になっている場合タイマ解除 */ + if(sc_data[type].val1 > val1 && type != SC_COMBO && type != SC_DANCING && type != SC_DEVOTION && + type != SC_SPEEDPOTION0 && type != SC_SPEEDPOTION1 && type != SC_SPEEDPOTION2 && type != SC_SPEEDPOTION3 + && type != SC_ATKPOT && type != SC_MATKPOT) // added atk and matk potions [Valaris] + return 0; + if ((type >=SC_STAN && type <= SC_BLIND) || type == SC_DPOISON) + return 0;/* ?ぎ足しができない?態異常である時は?態異常を行わない */ + if(type == SC_GRAFFITI){ //異常中にもう一度?態異常になった時に解除してから再度かかる + status_change_end(bl,type,-1); + } else { + (*sc_count)--; + delete_timer(sc_data[type].timer, status_change_timer); + sc_data[type].timer = -1; + } + } + + switch(type){ /* 異常の種類ごとの?理 */ + case SC_PROVOKE: /* プロボック */ + calc_flag = 1; + if(tick <= 0) tick = 1000; /* (オ?トバ?サ?ク) */ + break; + case SC_ENDURE: /* インデュア */ + if(tick <= 0) tick = 1000 * 60; + calc_flag = 1; // for updating mdef + val2 = 7; // [Celest] + break; + case SC_AUTOBERSERK: + { + tick = 60*1000; + if (bl->type == BL_PC && sd->status.hpstatus.max_hp>>2 && + (sc_data[SC_PROVOKE].timer==-1 || sc_data[SC_PROVOKE].val2==0)) + status_change_start(bl,SC_PROVOKE,10,1,0,0,0,0); + } + break; + case SC_CONCENTRATE: /* 集中力向上 */ + calc_flag = 1; + break; + case SC_BLESSING: /* ブレッシング */ + { + if(bl->type == BL_PC || (!undead_flag && race != 6)) { + if(sc_data[SC_CURSE].timer!=-1 ) + status_change_end(bl,SC_CURSE,-1); + if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2 == 0) + status_change_end(bl,SC_STONE,-1); + } + calc_flag = 1; + } + break; + case SC_ANGELUS: /* アンゼルス */ + calc_flag = 1; + break; + case SC_INCREASEAGI: /* 速度上昇 */ + calc_flag = 1; + if(sc_data[SC_DECREASEAGI].timer!=-1 ) + status_change_end(bl,SC_DECREASEAGI,-1); + // the effect will still remain [celest] +// if(sc_data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */ +// status_change_end(bl,SC_WINDWALK,-1); + break; + case SC_DECREASEAGI: /* 速度減少 */ + if (bl->type == BL_PC) // Celest + tick>>=1; + calc_flag = 1; + if(sc_data[SC_INCREASEAGI].timer!=-1 ) + status_change_end(bl,SC_INCREASEAGI,-1); + if(sc_data[SC_ADRENALINE].timer!=-1 ) + status_change_end(bl,SC_ADRENALINE,-1); + if(sc_data[SC_SPEARSQUICKEN].timer!=-1 ) + status_change_end(bl,SC_SPEARSQUICKEN,-1); + if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 ) + status_change_end(bl,SC_TWOHANDQUICKEN,-1); + break; + case SC_SIGNUMCRUCIS: /* シグナムクルシス */ + calc_flag = 1; +// val2 = 14 + val1; + val2 = 10 + val1*2; + tick = 600*1000; + clif_emotion(bl,4); + break; + case SC_SLOWPOISON: + if (sc_data[SC_POISON].timer == -1 && sc_data[SC_DPOISON].timer == -1) + return 0; + break; + case SC_TWOHANDQUICKEN: /* 2HQ */ + if(sc_data[SC_DECREASEAGI].timer!=-1) + return 0; + *opt3 |= 1; + calc_flag = 1; + break; + case SC_ADRENALINE: /* アドレナリンラッシュ */ + if(sc_data[SC_DECREASEAGI].timer!=-1) + return 0; + calc_flag = 1; + break; + case SC_WEAPONPERFECTION: /* ウェポンパ?フェクション */ + // Lasting time penalties have been removed on sakray as of 12/14 [celest] + //if(battle_config.party_skill_penalty && !val2) tick /= 5; + break; + case SC_OVERTHRUST: /* オ?バ?スラスト */ + *opt3 |= 2; + // Lasting time penalties have been removed on sakray as of 12/14 [celest] + //if(battle_config.party_skill_penalty && !val2) tick /= 10; + break; + case SC_MAXIMIZEPOWER: /* マキシマイズパワ?(SPが1減る時間,val2にも) */ + if(bl->type == BL_PC) + val2 = tick; + else + tick = 5000*val1; + break; + case SC_ENCPOISON: /* エンチャントポイズン */ + calc_flag = 1; + val2=(((val1 - 1) / 2) + 3)*100; /* 毒付?確率 */ + skill_encchant_eremental_end(bl,SC_ENCPOISON); + break; + case SC_EDP: // [Celest] + val2 = val1 + 2; /* 猛毒付?確率(%) */ + calc_flag = 1; + break; + case SC_POISONREACT: /* ポイズンリアクト */ + val2=val1/2 + val1%2; // [Celest] + break; + case SC_IMPOSITIO: /* インポシティオマヌス */ + calc_flag = 1; + break; + case SC_ASPERSIO: /* アスペルシオ */ + skill_encchant_eremental_end(bl,SC_ASPERSIO); + break; + case SC_SUFFRAGIUM: /* サフラギム */ + case SC_BENEDICTIO: /* 聖? */ + case SC_MAGNIFICAT: /* マグニフィカ?ト */ + case SC_AETERNA: /* エ?テルナ */ + break; + case SC_ENERGYCOAT: /* エナジ?コ?ト */ + *opt3 |= 4; + break; + case SC_MAGICROD: + val2 = val1*20; + break; + case SC_KYRIE: /* キリエエレイソン */ + val2 = status_get_max_hp(bl) * (val1 * 2 + 10) / 100;/* 耐久度 */ + val3 = (val1 / 2 + 5); /* 回? */ +// -- moonsoul (added to undo assumptio status if target has it) + if(sc_data[SC_ASSUMPTIO].timer!=-1 ) + status_change_end(bl,SC_ASSUMPTIO,-1); + break; + case SC_MINDBREAKER: + calc_flag = 1; + if(tick <= 0) tick = 1000; /* (オ?トバ?サ?ク) */ + case SC_GLORIA: /* グロリア */ + calc_flag = 1; + break; + case SC_LOUD: /* ラウドボイス */ + calc_flag = 1; + break; + case SC_TRICKDEAD: /* 死んだふり */ + if (bl->type == BL_PC) { + pc_stopattack((struct map_session_data *)sd); + } + break; + case SC_QUAGMIRE: /* クァグマイア */ + calc_flag = 1; + if(sc_data[SC_CONCENTRATE].timer!=-1 ) /* 集中力向上解除 */ + status_change_end(bl,SC_CONCENTRATE,-1); + if(sc_data[SC_INCREASEAGI].timer!=-1 ) /* 速度上昇解除 */ + status_change_end(bl,SC_INCREASEAGI,-1); + if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 ) + status_change_end(bl,SC_TWOHANDQUICKEN,-1); + if(sc_data[SC_SPEARSQUICKEN].timer!=-1 ) + status_change_end(bl,SC_SPEARSQUICKEN,-1); + if(sc_data[SC_ADRENALINE].timer!=-1 ) + status_change_end(bl,SC_ADRENALINE,-1); + if(sc_data[SC_LOUD].timer!=-1 ) + status_change_end(bl,SC_LOUD,-1); + if(sc_data[SC_TRUESIGHT].timer!=-1 ) /* トゥル?サイト */ + status_change_end(bl,SC_TRUESIGHT,-1); + if(sc_data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */ + status_change_end(bl,SC_WINDWALK,-1); + if(sc_data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */ + status_change_end(bl,SC_CARTBOOST,-1); + break; + case SC_MAGICPOWER: + calc_flag = 1; + val2 = 1; + break; + case SC_SACRIFICE: + val2 = 5; + break; + case SC_FLAMELAUNCHER: /* フレ?ムランチャ? */ + skill_encchant_eremental_end(bl,SC_FLAMELAUNCHER); + break; + case SC_FROSTWEAPON: /* フロストウェポン */ + skill_encchant_eremental_end(bl,SC_FROSTWEAPON); + break; + case SC_LIGHTNINGLOADER: /* ライトニングロ?ダ? */ + skill_encchant_eremental_end(bl,SC_LIGHTNINGLOADER); + break; + case SC_SEISMICWEAPON: /* サイズミックウェポン */ + skill_encchant_eremental_end(bl,SC_SEISMICWEAPON); + break; + case SC_DEVOTION: /* ディボ?ション */ + calc_flag = 1; + break; + case SC_PROVIDENCE: /* プロヴィデンス */ + calc_flag = 1; + val2=val1*5; + break; + case SC_REFLECTSHIELD: + val2=10+val1*3; + break; + case SC_STRIPWEAPON: + if (val2==0) val2=90; + break; + case SC_STRIPSHIELD: + if (val2==0) val2=85; + break; + case SC_STRIPARMOR: + case SC_STRIPHELM: + case SC_CP_WEAPON: + case SC_CP_SHIELD: + case SC_CP_ARMOR: + case SC_CP_HELM: + break; + + case SC_AUTOSPELL: /* オ?トスペル */ + val4 = 5 + val1*2; + break; + + case SC_VOLCANO: + calc_flag = 1; + val3 = val1*10; + val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) ); + break; + case SC_DELUGE: + calc_flag = 1; + val3 = val1>=5?15: (val1==4?14: (val1==3?12: ( val1==2?9:5 ) ) ); + val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) ); + break; + case SC_VIOLENTGALE: + calc_flag = 1; + val3 = val1*3; + val4 = val1>=5?20: (val1==4?19: (val1==3?17: ( val1==2?14:10 ) ) ); + break; + + case SC_SPEARSQUICKEN: /* スピアクイッケン */ + calc_flag = 1; + val2 = 20+val1; + *opt3 |= 1; + break; + case SC_COMBO: + break; + case SC_BLADESTOP_WAIT: /* 白刃取り(待ち) */ + break; + case SC_BLADESTOP: /* 白刃取り */ + if(val2==2) clif_bladestop((struct block_list *)val3,(struct block_list *)val4,1); + *opt3 |= 32; + break; + + case SC_LULLABY: /* 子守唄 */ + val2 = 11; + break; + case SC_RICHMANKIM: + break; + case SC_ETERNALCHAOS: /* エタ?ナルカオス */ + calc_flag = 1; + break; + case SC_DRUMBATTLE: /* ?太鼓の響き */ + calc_flag = 1; + val2 = (val1+1)*25; + val3 = (val1+1)*2; + break; + case SC_NIBELUNGEN: /* ニ?ベルングの指輪 */ + calc_flag = 1; + //val2 = (val1+2)*50; + val3 = (val1+2)*25; + break; + case SC_ROKISWEIL: /* ロキの叫び */ + break; + case SC_INTOABYSS: /* 深淵の中に */ + break; + case SC_SIEGFRIED: /* 不死身のジ?クフリ?ド */ + calc_flag = 1; + val2 = 55 + val1*5; + val3 = val1*10; + break; + case SC_DISSONANCE: /* 不協和音 */ + val2 = 10; + break; + case SC_WHISTLE: /* 口笛 */ + calc_flag = 1; + break; + case SC_ASSNCROS: /* 夕陽のアサシンクロス */ + calc_flag = 1; + break; + case SC_POEMBRAGI: /* ブラギの詩 */ + break; + case SC_APPLEIDUN: /* イドゥンの林檎 */ + calc_flag = 1; + break; + case SC_UGLYDANCE: /* 自分勝手なダンス */ + val2 = 10; + break; + case SC_HUMMING: /* ハミング */ + calc_flag = 1; + break; + case SC_DONTFORGETME: /* 私を忘れないで */ + calc_flag = 1; + if(sc_data[SC_INCREASEAGI].timer!=-1 ) /* 速度上昇解除 */ + status_change_end(bl,SC_INCREASEAGI,-1); + if(sc_data[SC_TWOHANDQUICKEN].timer!=-1 ) + status_change_end(bl,SC_TWOHANDQUICKEN,-1); + if(sc_data[SC_SPEARSQUICKEN].timer!=-1 ) + status_change_end(bl,SC_SPEARSQUICKEN,-1); + if(sc_data[SC_ADRENALINE].timer!=-1 ) + status_change_end(bl,SC_ADRENALINE,-1); + if(sc_data[SC_ASSNCROS].timer!=-1 ) + status_change_end(bl,SC_ASSNCROS,-1); + if(sc_data[SC_TRUESIGHT].timer!=-1 ) /* トゥル?サイト */ + status_change_end(bl,SC_TRUESIGHT,-1); + if(sc_data[SC_WINDWALK].timer!=-1 ) /* ウインドウォ?ク */ + status_change_end(bl,SC_WINDWALK,-1); + if(sc_data[SC_CARTBOOST].timer!=-1 ) /* カ?トブ?スト */ + status_change_end(bl,SC_CARTBOOST,-1); + break; + case SC_FORTUNE: /* 幸運のキス */ + calc_flag = 1; + break; + case SC_SERVICE4U: /* サ?ビスフォ?ユ? */ + calc_flag = 1; + break; + case SC_MOONLIT: + val2 = bl->id; + break; + case SC_DANCING: /* ダンス/演奏中 */ + calc_flag = 1; + val3= tick / 1000; + tick = 1000; + break; + + case SC_EXPLOSIONSPIRITS: // 爆裂波動 + calc_flag = 1; + val2 = 75 + 25*val1; + *opt3 |= 8; + break; + case SC_STEELBODY: // 金剛 + calc_flag = 1; + *opt3 |= 16; + break; + case SC_EXTREMITYFIST: /* 阿修羅覇凰拳 */ + break; + case SC_AUTOCOUNTER: + val3 = val4 = 0; + break; + + case SC_SPEEDPOTION0: /* ?速ポ?ション */ + case SC_SPEEDPOTION1: + case SC_SPEEDPOTION2: + case SC_SPEEDPOTION3: + calc_flag = 1; + tick = 1000 * tick; + val2 = 5*(2+type-SC_SPEEDPOTION0); + break; + + /* atk & matk potions [Valaris] */ + case SC_ATKPOT: + case SC_MATKPOT: + calc_flag = 1; + tick = 1000 * tick; + break; + case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) + { + time_t timer; + + calc_flag = 1; + tick = 10000; + if(!val2) + val2 = time(&timer); + } + break; + case SC_NOCHAT: //チャット禁止?態 + { + time_t timer; + + if(!battle_config.muting_players) + break; + + tick = 60000; + if(!val2) + val2 = time(&timer); + updateflag = SP_MANNER; + save_flag = 1; // celest + } + break; + case SC_SELFDESTRUCTION: //自爆 + clif_skillcasting(bl,bl->id, bl->id,0,0,331,skill_get_time(val2,val1)); + val3 = tick / 1000; + tick = 1000; + break; + + /* option1 */ + case SC_STONE: /* 石化 */ + if(!(flag&2)) { + int sc_def = status_get_mdef(bl)*200; + tick = tick - sc_def; + } + val3 = tick/1000; + if(val3 < 1) val3 = 1; + tick = 5000; + val2 = 1; + break; + case SC_SLEEP: /* 睡眠 */ + if(!(flag&2)) { +// int sc_def = 100 - (status_get_int(bl) + status_get_luk(bl)/3); +// tick = tick * sc_def / 100; +// if(tick < 1000) tick = 1000; + tick = 30000;//睡眠はステ?タス耐性に?わらず30秒 + } + break; + case SC_FREEZE: /* 凍結 */ + if(!(flag&2)) { + int sc_def = 100 - status_get_mdef(bl); + tick = tick * sc_def / 100; + } + break; + case SC_STAN: /* スタン(val2にミリ秒セット) */ + if(!(flag&2)) { + int sc_def = 100 - (status_get_vit(bl) + status_get_luk(bl)/3); + tick = tick * sc_def / 100; + } + break; + + /* option2 */ + case SC_DPOISON: /* 猛毒 */ + { + int mhp = status_get_max_hp(bl); + int hp = status_get_hp(bl); + // MHP?1/4???????? + if (hp > mhp>>2) { + if(bl->type == BL_PC) { + int diff = mhp*10/100; + if (hp - diff < mhp>>2) + hp = hp - (mhp>>2); + pc_heal((struct map_session_data *)bl, -hp, 0); + } else if(bl->type == BL_MOB) { + struct mob_data *md = (struct mob_data *)bl; + hp -= mhp*15/100; + if (hp > mhp>>2) + md->hp = hp; + else + md->hp = mhp>>2; + } + } + } // fall through + case SC_POISON: /* 毒 */ + calc_flag = 1; + if(!(flag&2)) { + int sc_def = 100 - (status_get_vit(bl) + status_get_luk(bl)/5); + tick = tick * sc_def / 100; + } + val3 = tick/1000; + if(val3 < 1) val3 = 1; + tick = 1000; + break; + case SC_SILENCE: /* 沈?(レックスデビ?ナ) */ + if(!(flag&2)) { + int sc_def = 100 - status_get_vit(bl); + tick = tick * sc_def / 100; + } + break; + case SC_CONFUSION: + val2 = tick; + tick = 100; + clif_emotion(bl,1); + if (sd) { + pc_stop_walking (sd, 0); + } + break; + case SC_BLIND: /* 暗? */ + calc_flag = 1; + if(!(flag&2)) { + int sc_def = status_get_lv(bl)/10 + status_get_int(bl)/15; + tick = 30000 - sc_def; + } + break; + case SC_CURSE: + calc_flag = 1; + if(!(flag&2)) { + int sc_def = 100 - status_get_vit(bl); + tick = tick * sc_def / 100; + } + break; + + /* option */ + case SC_HIDING: /* ハイディング */ + calc_flag = 1; + if(bl->type == BL_PC) { + val2 = tick / 1000; /* 持?時間 */ + tick = 1000; + } + break; + case SC_CHASEWALK: + case SC_CLOAKING: /* クロ?キング */ + if(bl->type == BL_PC) { + calc_flag = 1; // [Celest] + val2 = tick; + val3 = type==SC_CLOAKING ? 130-val1*3 : 135-val1*5; + } + else + tick = 5000*val1; + break; + case SC_SIGHT: /* サイト/ルアフ */ + case SC_RUWACH: + val2 = tick/250; + tick = 10; + break; + + /* セ?フティウォ?ル、ニュ?マ */ + case SC_SAFETYWALL: case SC_PNEUMA: + tick=((struct skill_unit *)val2)->group->limit; + break; + + /* アンクル */ + case SC_ANKLE: + break; + + /* ウォ?タ?ボ?ル */ + case SC_WATERBALL: + tick=150; + if(val1>5) //レベルが5以上の場合は25?に制限(1?目はすでに打ってるので-1) + val3=5*5-1; + else + val3= (val1|1)*(val1|1)-1; + break; + + /* スキルじゃない/時間に?係しない */ + case SC_RIDING: + calc_flag = 1; + tick = 600*1000; + break; + case SC_FALCON: + case SC_WEIGHT50: + case SC_WEIGHT90: + case SC_BROKNWEAPON: + case SC_BROKNARMOR: + tick=600*1000; + break; + + case SC_AUTOGUARD: + { + int i,t; + for(i=val2=0;i>1); + val2 += (t < 0)? 1:t; + } + } + break; + + case SC_DEFENDER: + calc_flag = 1; + val2 = 5 + val1*15; + break; + + case SC_KEEPING: + case SC_BARRIER: + calc_flag = 1; + + case SC_HALLUCINATION: + break; + + case SC_CONCENTRATION: /* コンセントレ?ション */ + *opt3 |= 1; + calc_flag = 1; + break; + + case SC_TENSIONRELAX: /* テンションリラックス */ + calc_flag = 1; + if(bl->type == BL_PC) { + tick = 10000; + } + break; + + case SC_AURABLADE: /* オ?ラブレ?ド */ + case SC_PARRYING: /* パリイング */ +// case SC_ASSUMPTIO: /* */ + case SC_HEADCRUSH: /* ヘッドクラッシュ */ + case SC_JOINTBEAT: /* ジョイントビ?ト */ +// case SC_MARIONETTE: /* マリオネットコントロ?ル */ + + //とりあえず手?き + break; + +// -- moonsoul (for new upper class related skill status effects) +/* + case SC_AURABLADE: + val2 = val1*10; + break; + case SC_PARRYING: + val2=val1*3; + break; + case SC_CONCENTRATION: + calc_flag=1; + val2=val1*10; + val3=val1*5; + break; + case SC_TENSIONRELAX: +// val2 = 10; +// val3 = 15; + break; + case SC_BERSERK: + calc_flag=1; + break; + case SC_ASSUMPTIO: + if(sc_data[SC_KYRIE].timer!=-1 ) + status_change_end(bl,SC_KYRIE,-1); + break;*/ + + case SC_WINDWALK: /* ウインドウォ?ク */ + calc_flag = 1; + val2 = (val1 / 2); //Flee上昇率 + break; + + case SC_BERSERK: /* バ?サ?ク */ + if(sd){ + sd->status.hp = sd->status.max_hp * 3; + sd->status.sp = 0; + clif_updatestatus(sd,SP_HP); + clif_updatestatus(sd,SP_SP); + clif_status_change(bl,SC_INCREASEAGI,1); /* アイコン表示 */ + sd->canregen_tick = gettick() + 300000; + } + *opt3 |= 128; + tick = 10000; + calc_flag = 1; + break; + + case SC_ASSUMPTIO: /* アスムプティオ */ + if(sc_data[SC_KYRIE].timer!=-1 ) + status_change_end(bl,SC_KYRIE,-1); + break; + *opt3 |= 2048; + break; + + case SC_BASILICA: // [celest] + break; + + case SC_GOSPEL: + if (val4 == BCT_SELF) { // self effect + int i; + if (sd) { + sd->canact_tick += tick; + sd->canmove_tick += tick; + } + val2 = tick; + tick = 1000; + for (i=0; i<=26; i++) { + if(sc_data[i].timer!=-1) + status_change_end(bl,i,-1); + } + for (i=58; i<=62; i++) { + if(sc_data[i].timer!=-1) + status_change_end(bl,i,-1); + } + for (i=132; i<=136; i++) { + if(sc_data[i].timer!=-1) + status_change_end(bl,i,-1); + } + } + break; + + case SC_MARIONETTE: /* マリオネットコントロ?ル */ + case SC_MARIONETTE2: + val2 = tick; + if (!val3) + return 0; + tick = 1000; + calc_flag = 1; + *opt3 |= 1024; + break; + + case SC_MELTDOWN: /* メルトダウン */ + case SC_CARTBOOST: /* カ?トブ?スト */ + case SC_TRUESIGHT: /* トゥル?サイト */ + case SC_SPIDERWEB: /* スパイダ?ウェッブ */ + calc_flag = 1; + break; + + case SC_REJECTSWORD: /* リジェクトソ?ド */ + val2 = 3; //3回攻?を跳ね返す + break; + + case SC_MEMORIZE: /* メモライズ */ + val2 = 3; //3回詠唱を1/3にする + break; + + case SC_GRAFFITI: /* グラフィティ */ + { + struct skill_unit_group *sg = skill_unitsetting(bl,RG_GRAFFITI,val1,val2,val3,0); + if(sg) + val4 = (int)sg; + } + break; + + case SC_SPLASHER: /* ベナムスプラッシャ? */ + break; + + case SC_FOGWALL: + val2 = 75; + // calc_flag = 1; // not sure of effects yet [celest] + break; + + case SC_PRESERVE: + break; + + case SC_BLOCKSKILL: + if (!tick) tick = 60000; + if (!val3) val3 = -1; + break; + + case SC_SLOWDOWN: + case SC_SPEEDUP0: + calc_flag = 1; + break; + + case SC_REGENERATION: + val1 = 2; + case SC_BATTLEORDERS: + tick = 60000; // 1 minute + calc_flag = 1; + break; + + default: + if(battle_config.error_log) + printf("UnknownStatusChange [%d]\n", type); + return 0; + } + + if(bl->type==BL_PC && + (typeid, type); + + if(bl->type==BL_PC && calc_flag) + status_calc_pc(sd,0); /* ステ?タス再計算 */ + + if(bl->type==BL_PC && save_flag) + chrif_save(sd); // save the player status + + if(bl->type==BL_PC && updateflag) + clif_updatestatus(sd,updateflag); /* ステ?タスをクライアントに送る */ + + return 0; +} +/*========================================== + * ステータス異常全解除 + *------------------------------------------ + */ +int status_change_clear(struct block_list *bl,int type) +{ + struct status_change* sc_data; + short *sc_count, *option, *opt1, *opt2, *opt3; + int i; + + nullpo_retr(0, bl); + nullpo_retr(0, sc_data = status_get_sc_data(bl)); + nullpo_retr(0, sc_count = status_get_sc_count(bl)); + nullpo_retr(0, option = status_get_option(bl)); + nullpo_retr(0, opt1 = status_get_opt1(bl)); + nullpo_retr(0, opt2 = status_get_opt2(bl)); + nullpo_retr(0, opt3 = status_get_opt3(bl)); + + if (*sc_count == 0) + return 0; + for(i = 0; i < MAX_STATUSCHANGE; i++){ + if(sc_data[i].timer != -1){ /* 異常があるならタイマ?を削除する */ + status_change_end(bl, i, -1); + } + } + *sc_count = 0; + *opt1 = 0; + *opt2 = 0; + *opt3 = 0; + *option &= OPTION_MASK; + + if (night_flag == 1 && type == BL_PC && !map[bl->m].flag.indoors && // by [Yor] + !map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) // [celest] + *opt2 |= STATE_BLIND; + + if(!type || type&2) + clif_changeoption(bl); + + return 0; +} + +/*========================================== + * ステータス異常終了 + *------------------------------------------ + */ +int status_change_end( struct block_list* bl , int type,int tid ) +{ + struct status_change* sc_data; + int opt_flag=0, calc_flag = 0; + short *sc_count, *option, *opt1, *opt2, *opt3; + + nullpo_retr(0, bl); + if(bl->type!=BL_PC && bl->type!=BL_MOB) { + if(battle_config.error_log) + printf("status_change_end: neither MOB nor PC !\n"); + return 0; + } + nullpo_retr(0, sc_data = status_get_sc_data(bl)); + nullpo_retr(0, sc_count = status_get_sc_count(bl)); + nullpo_retr(0, option = status_get_option(bl)); + nullpo_retr(0, opt1 = status_get_opt1(bl)); + nullpo_retr(0, opt2 = status_get_opt2(bl)); + nullpo_retr(0, opt3 = status_get_opt3(bl)); + + if ((*sc_count) > 0 && sc_data[type].timer != -1 && (sc_data[type].timer == tid || tid == -1)) { + + if (tid == -1) // タイマから呼ばれていないならタイマ削除をする + delete_timer(sc_data[type].timer,status_change_timer); + + /* 該?の異常を正常に?す */ + sc_data[type].timer=-1; + (*sc_count)--; + + switch(type){ /* 異常の種類ごとの?理 */ + case SC_PROVOKE: /* プロボック */ + case SC_ENDURE: // celest + case SC_CONCENTRATE: /* 集中力向上 */ + case SC_BLESSING: /* ブレッシング */ + case SC_ANGELUS: /* アンゼルス */ + case SC_INCREASEAGI: /* 速度上昇 */ + case SC_DECREASEAGI: /* 速度減少 */ + case SC_SIGNUMCRUCIS: /* シグナムクルシス */ + case SC_HIDING: + case SC_TWOHANDQUICKEN: /* 2HQ */ + case SC_ADRENALINE: /* アドレナリンラッシュ */ + case SC_ENCPOISON: /* エンチャントポイズン */ + case SC_IMPOSITIO: /* インポシティオマヌス */ + case SC_GLORIA: /* グロリア */ + case SC_LOUD: /* ラウドボイス */ + case SC_QUAGMIRE: /* クァグマイア */ + case SC_PROVIDENCE: /* プロヴィデンス */ + case SC_SPEARSQUICKEN: /* スピアクイッケン */ + case SC_VOLCANO: + case SC_DELUGE: + case SC_VIOLENTGALE: + case SC_ETERNALCHAOS: /* エタ?ナルカオス */ + case SC_DRUMBATTLE: /* ?太鼓の響き */ + case SC_NIBELUNGEN: /* ニ?ベルングの指輪 */ + case SC_SIEGFRIED: /* 不死身のジ?クフリ?ド */ + case SC_WHISTLE: /* 口笛 */ + case SC_ASSNCROS: /* 夕陽のアサシンクロス */ + case SC_HUMMING: /* ハミング */ + case SC_DONTFORGETME: /* 私を忘れないで */ + case SC_FORTUNE: /* 幸運のキス */ + case SC_SERVICE4U: /* サ?ビスフォ?ユ? */ + case SC_EXPLOSIONSPIRITS: // 爆裂波動 + case SC_STEELBODY: // 金剛 + case SC_DEFENDER: + case SC_SPEEDPOTION0: /* ?速ポ?ション */ + case SC_SPEEDPOTION1: + case SC_SPEEDPOTION2: + case SC_SPEEDPOTION3: + case SC_APPLEIDUN: /* イドゥンの林檎 */ + case SC_RIDING: + case SC_BLADESTOP_WAIT: + case SC_AURABLADE: /* オ?ラブレ?ド */ + case SC_PARRYING: /* パリイング */ + case SC_CONCENTRATION: /* コンセントレ?ション */ + case SC_TENSIONRELAX: /* テンションリラックス */ + case SC_ASSUMPTIO: /* アシャンプティオ */ + case SC_WINDWALK: /* ウインドウォ?ク */ + case SC_TRUESIGHT: /* トゥル?サイト */ + case SC_SPIDERWEB: /* スパイダ?ウェッブ */ + case SC_MAGICPOWER: /* 魔法力?幅 */ + case SC_CHASEWALK: + case SC_ATKPOT: /* attack potion [Valaris] */ + case SC_MATKPOT: /* magic attack potion [Valaris] */ + case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) + case SC_MELTDOWN: /* メルトダウン */ + // Celest + case SC_EDP: + case SC_SLOWDOWN: + case SC_SPEEDUP0: +/* case SC_LEADERSHIP: + case SC_GLORYWOUNDS: + case SC_SOULCOLD: + case SC_HAWKEYES:*/ + case SC_BATTLEORDERS: + case SC_REGENERATION: + calc_flag = 1; + break; + case SC_AUTOBERSERK: + if (sc_data[SC_PROVOKE].timer != -1) + status_change_end(bl,SC_PROVOKE,-1); + break; + case SC_BERSERK: /* バ?サ?ク */ + calc_flag = 1; + clif_status_change(bl,SC_INCREASEAGI,0); /* アイコン消去 */ + break; + case SC_DEVOTION: /* ディボ?ション */ + { + struct map_session_data *md = map_id2sd(sc_data[type].val1); + sc_data[type].val1=sc_data[type].val2=0; + skill_devotion(md,bl->id); + calc_flag = 1; + } + break; + case SC_BLADESTOP: + { + struct status_change *t_sc_data = status_get_sc_data((struct block_list *)sc_data[type].val4); + //片方が切れたので相手の白刃?態が切れてないのなら解除 + if(t_sc_data && t_sc_data[SC_BLADESTOP].timer!=-1) + status_change_end((struct block_list *)sc_data[type].val4,SC_BLADESTOP,-1); + + if(sc_data[type].val2==2) + clif_bladestop((struct block_list *)sc_data[type].val3,(struct block_list *)sc_data[type].val4,0); + } + break; + case SC_DANCING: + { + struct map_session_data *dsd; + struct status_change *d_sc_data; + if(sc_data[type].val4 && (dsd=map_id2sd(sc_data[type].val4))){ + d_sc_data = dsd->sc_data; + //合奏で相手がいる場合相手のval4を0にする + if(d_sc_data && d_sc_data[type].timer!=-1) + d_sc_data[type].val4=0; + } + } + calc_flag = 1; + break; + case SC_GRAFFITI: + { + struct skill_unit_group *sg=(struct skill_unit_group *)sc_data[type].val4; //val4がグラフィティのgroup_id + if(sg) + skill_delunitgroup(sg); + } + break; + case SC_NOCHAT: //チャット禁止?態 + { + struct map_session_data *sd=NULL; + if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){ + if (sd->status.manner >= 0) // weeee ^^ [celest] + sd->status.manner = 0; + clif_updatestatus(sd,SP_MANNER); + } + } + break; + case SC_SPLASHER: /* ベナムスプラッシャ? */ + { + struct block_list *src=map_id2bl(sc_data[type].val3); + if(src && tid!=-1){ + //自分にダメ?ジ&周?3*3にダメ?ジ + skill_castend_damage_id(src, bl,sc_data[type].val2,sc_data[type].val1,gettick(),0 ); + } + } + break; + case SC_SELFDESTRUCTION: /* 自爆 */ + { + //自分のダメ?ジは0にして + struct mob_data *md=NULL; + if(bl->type == BL_MOB && (md=(struct mob_data*)bl)) + skill_castend_damage_id(bl, bl,sc_data[type].val2,sc_data[type].val1,gettick(),0 ); + } + break; + /* option1 */ + case SC_FREEZE: + sc_data[type].val3 = 0; + break; + + /* option2 */ + case SC_POISON: /* 毒 */ + case SC_BLIND: /* 暗? */ + case SC_CURSE: + calc_flag = 1; + break; + + // celest + case SC_CONFUSION: + { + struct map_session_data *sd=NULL; + if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){ + sd->next_walktime = -1; + } + } + break; + + case SC_MARIONETTE: /* マリオネットコントロ?ル */ + case SC_MARIONETTE2: /// Marionette target + { + // check for partner and end their marionette status as well + int type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE; + struct block_list *pbl = map_id2bl(sc_data[type].val3); + if (pbl) { + struct status_change* sc_data; + if (*status_get_sc_count(pbl) > 0 && + (sc_data = status_get_sc_data(pbl)) && + sc_data[type2].timer != -1) + status_change_end(pbl, type2, -1); + } + calc_flag = 1; + } + break; + } + + if(bl->type==BL_PC && + (typetype == BL_PC && // by [Yor] + !map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) { // [celest] + *opt2 |= STATE_BLIND; + opt_flag = 1; + } + + if(opt_flag) /* optionの?更を?える */ + clif_changeoption(bl); + + if (bl->type == BL_PC && calc_flag) + status_calc_pc((struct map_session_data *)bl,0); /* ステ?タス再計算 */ + } + + return 0; +} + + +/*========================================== + * ステータス異常終了タイマー + *------------------------------------------ + */ +int status_change_timer(int tid, unsigned int tick, int id, int data) +{ + int type=data; + struct block_list *bl; + struct map_session_data *sd=NULL; + struct status_change *sc_data; + //short *sc_count; //使ってない? + + nullpo_retr(0, bl=map_id2bl(id)); + nullpo_retr(0, sc_data=status_get_sc_data(bl)); + + if(bl->type==BL_PC) + nullpo_retr(0, sd=(struct map_session_data *)bl); + + //sc_count=status_get_sc_count(bl); //使ってない? + + if(sc_data[type].timer != tid) { + if(battle_config.error_log) + printf("status_change_timer %d != %d\n",tid,sc_data[type].timer); + return 0; + } + + switch(type){ /* 特殊な?理になる場合 */ + case SC_MAXIMIZEPOWER: /* マキシマイズパワ? */ + case SC_CLOAKING: + if(sd){ + if( sd->status.sp > 0 ){ /* SP切れるまで持? */ + sd->status.sp--; + clif_updatestatus(sd,SP_SP); + sc_data[type].timer=add_timer( /* タイマ?再設定 */ + sc_data[type].val2+tick, status_change_timer, bl->id, data); + return 0; + } + } + break; + + case SC_CHASEWALK: + if(sd){ + int sp = 10+sc_data[SC_CHASEWALK].val1*2; + if (map[sd->bl.m].flag.gvg) sp *= 5; + if( sd->status.sp > sp){ + sd->status.sp -= sp; // update sp cost [Celest] + clif_updatestatus(sd,SP_SP); + sc_data[type].timer=add_timer( /* タイマ?再設定 */ + sc_data[type].val2+tick, status_change_timer, bl->id, data); + sc_data[SC_CHASEWALK].val4++; + if (sc_data[SC_CHASEWALK].val4 > 3) + sc_data[SC_CHASEWALK].val4 = 0; + status_calc_pc (sd, 0); + return 0; + } + } + break; + + case SC_HIDING: /* ハイディング */ + if(sd){ /* SPがあって、時間制限の間は持? */ + if( sd->status.sp > 0 && (--sc_data[type].val2)>0 ){ + if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){ + sd->status.sp--; + clif_updatestatus(sd,SP_SP); + } + sc_data[type].timer=add_timer( /* タイマ?再設定 */ + 1000+tick, status_change_timer, + bl->id, data); + return 0; + } + } + break; + + case SC_SIGHT: /* サイト */ + case SC_RUWACH: /* ルアフ */ + { + int range = 5; + if ( type == SC_SIGHT ) range = 7; + map_foreachinarea( status_change_timer_sub, + bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,0, + bl,type,tick); + + if( (--sc_data[type].val2)>0 ){ + sc_data[type].timer=add_timer( /* タイマ?再設定 */ + 250+tick, status_change_timer, + bl->id, data); + return 0; + } + } + break; + + case SC_SIGNUMCRUCIS: /* シグナムクルシス */ + { + int race = status_get_race(bl); + if(race == 6 || battle_check_undead(race,status_get_elem_type(bl))) { + sc_data[type].timer=add_timer(1000*600+tick,status_change_timer, bl->id, data ); + return 0; + } + } + break; + + case SC_PROVOKE: /* プロボック/オ?トバ?サ?ク */ + if(sc_data[type].val2!=0){ /* オ?トバ?サ?ク(1秒ごとにHPチェック) */ + if(sd && sd->status.hp>sd->status.max_hp>>2) /* 停止 */ + break; + sc_data[type].timer=add_timer( 1000+tick,status_change_timer, bl->id, data ); + return 0; + } + break; + + case SC_WATERBALL: /* ウォ?タ?ボ?ル */ + { + struct block_list *target=map_id2bl(sc_data[type].val2); + nullpo_retb(target); + nullpo_retb(target->prev); + skill_attack(BF_MAGIC,bl,bl,target,WZ_WATERBALL,sc_data[type].val1,tick,0); + if((--sc_data[type].val3)>0) { + sc_data[type].timer=add_timer( 150+tick,status_change_timer, bl->id, data ); + return 0; + } + } + break; + + case SC_ENDURE: /* インデュア */ + case SC_AUTOBERSERK: // Celest + if(sd && sd->special_state.infinite_endure) { +#ifdef TWILIGHT + sc_data[type].timer=add_timer( 1000*600+tick,status_change_timer, bl->id, data ); +#else + sc_data[type].timer=add_timer( 1000*60+tick,status_change_timer, bl->id, data ); +#endif + //sc_data[type].val2=1; + return 0; + } + break; + + case SC_DISSONANCE: /* 不協和音 */ + if( (--sc_data[type].val2)>0){ + struct skill_unit *unit= + (struct skill_unit *)sc_data[type].val4; + struct block_list *src; + /*if(!unit || !unit->group) + break; + src=map_id2bl(unit->group->src_id); + if(!src) + break;*/ + nullpo_retb(unit); + nullpo_retb(unit->group); + nullpo_retr(0, src=map_id2bl(unit->group->src_id)); + skill_attack(BF_MISC,src,&unit->bl,bl,unit->group->skill_id,sc_data[type].val1,tick,0); + sc_data[type].timer=add_timer(skill_get_time2(unit->group->skill_id,unit->group->skill_lv)+tick, + status_change_timer, bl->id, data ); + return 0; + } + break; + + case SC_LULLABY: /* 子守唄 */ + if( (--sc_data[type].val2)>0){ + struct skill_unit *unit= + (struct skill_unit *)sc_data[type].val4; + nullpo_retb(unit); + nullpo_retb(unit->group); + if(unit->group->src_id == bl->id) + break; + skill_additional_effect(bl,bl,unit->group->skill_id,sc_data[type].val1,BF_LONG|BF_SKILL|BF_MISC,tick); + if (unit->group != 0) + sc_data[type].timer=add_timer(skill_get_time(unit->group->skill_id,unit->group->skill_lv)/10+tick, + status_change_timer, bl->id, data ); + return 0; + } + break; + + case SC_STONE: + if(sc_data[type].val2 != 0) { + short *opt1 = status_get_opt1(bl); + sc_data[type].val2 = 0; + sc_data[type].val4 = 0; + battle_stopwalking(bl,1); + if(opt1) { + *opt1 = 1; + clif_changeoption(bl); + } + sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data ); + return 0; + } + else if( (--sc_data[type].val3) > 0) { + int hp = status_get_max_hp(bl); + if((++sc_data[type].val4)%5 == 0 && status_get_hp(bl) > hp>>2) { + hp = hp/100; + if(hp < 1) hp = 1; + if(sd) + pc_heal(sd,-hp,0); + else if(bl->type == BL_MOB){ + struct mob_data *md; + if((md=((struct mob_data *)bl)) == NULL) + break; + md->hp -= hp; + } + } + sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data ); + return 0; + } + break; + case SC_POISON: + if(sc_data[SC_SLOWPOISON].timer == -1) { + if( (--sc_data[type].val3) > 0) { + int hp = status_get_max_hp(bl); + if(status_get_hp(bl) > hp>>2) { + if(bl->type == BL_PC) { + hp = 3 + hp*3/200; + pc_heal((struct map_session_data *)bl,-hp,0); + } + else if(bl->type == BL_MOB) { + struct mob_data *md; + nullpo_retr(0, md=(struct mob_data *)bl); + /*if((md=((struct mob_data *)bl)) == NULL) + break;*/ + hp = 3 + hp/200; + md->hp -= hp; + } + } + sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data ); + } + } + else + sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data ); + break; + case SC_DPOISON: + if (sc_data[SC_SLOWPOISON].timer == -1 && (--sc_data[type].val3) > 0) { + int hp = status_get_max_hp(bl); + if (status_get_hp(bl) > hp>>2) { + if(sd) { + hp = 3 + hp/50; + pc_heal(sd, -hp, 0); + } else if (bl->type == BL_MOB) { + struct mob_data *md; + nullpo_retr(0, md=(struct mob_data *)bl); + /*if ((md=((struct mob_data *)bl)) == NULL) + break;*/ + hp = 3 + hp/100; + md->hp -= hp; + } + } + } + if (sc_data[type].val3 > 0) + sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data ); + break; + + case SC_TENSIONRELAX: /* テンションリラックス */ + if(sd){ /* SPがあって、HPが?タンでなければ?? */ + if( sd->status.sp > 12 && sd->status.max_hp > sd->status.hp ){ +/* if(sc_data[type].val2 % (sc_data[type].val1+3) ==0 ){ + sd->status.sp -= 12; + clif_updatestatus(sd,SP_SP); + } */ + sc_data[type].timer=add_timer( /* タイマ?再設定 */ + 10000+tick, status_change_timer, + bl->id, data); + return 0; + } + if(sd->status.max_hp <= sd->status.hp) + status_change_end(&sd->bl,SC_TENSIONRELAX,-1); + } + break; + case SC_HEADCRUSH: // temporary damage [celest] +// case SC_BLEEDING: + if((--sc_data[type].val3) > 0) { + int hp = status_get_max_hp(bl); + if(sd) { + hp = 3 + hp*3/200; + pc_heal(sd,-hp,0); + } + else if(bl->type == BL_MOB) { + struct mob_data *md; + nullpo_retr(0, md=(struct mob_data *)bl); + /*if((md=((struct mob_data *)bl)) == NULL) + break;*/ + hp = 3 + hp/200; + md->hp -= hp; + } + sc_data[type].timer=add_timer(1000+tick,status_change_timer, bl->id, data ); + } + break; + + /* 時間切れ無し?? */ + case SC_AETERNA: + case SC_TRICKDEAD: + case SC_RIDING: + case SC_FALCON: + case SC_WEIGHT50: + case SC_WEIGHT90: + case SC_MAGICPOWER: /* 魔法力?幅 */ + case SC_REJECTSWORD: /* リジェクトソ?ド */ + case SC_MEMORIZE: /* メモライズ */ + case SC_BROKNWEAPON: + case SC_BROKNARMOR: + case SC_SACRIFICE: +// if(sc_data[type].timer==tid) + sc_data[type].timer=add_timer( 1000*600+tick,status_change_timer, bl->id, data ); + return 0; + + case SC_DANCING: //ダンススキルの時間SP消費 + { + int s=0; + if(sd){ + if(sd->status.sp > 0 && (--sc_data[type].val3)>0){ + switch(sc_data[type].val1){ + case BD_RICHMANKIM: /* ニヨルドの宴 3秒にSP1 */ + case BD_DRUMBATTLEFIELD: /* ?太鼓の響き 3秒にSP1 */ + case BD_RINGNIBELUNGEN: /* ニ?ベルングの指輪 3秒にSP1 */ + case BD_SIEGFRIED: /* 不死身のジ?クフリ?ド 3秒にSP1 */ + case BA_DISSONANCE: /* 不協和音 3秒でSP1 */ + case BA_ASSASSINCROSS: /* 夕陽のアサシンクロス 3秒でSP1 */ + case DC_UGLYDANCE: /* 自分勝手なダンス 3秒でSP1 */ + s=3; + break; + case BD_LULLABY: /* 子守歌 4秒にSP1 */ + case BD_ETERNALCHAOS: /* 永遠の混沌 4秒にSP1 */ + case BD_ROKISWEIL: /* ロキの叫び 4秒にSP1 */ + case DC_FORTUNEKISS: /* 幸運のキス 4秒でSP1 */ + s=4; + break; + case BD_INTOABYSS: /* 深淵の中に 5秒にSP1 */ + case BA_WHISTLE: /* 口笛 5秒でSP1 */ + case DC_HUMMING: /* ハミング 5秒でSP1 */ + case BA_POEMBRAGI: /* ブラギの詩 5秒でSP1 */ + case DC_SERVICEFORYOU: /* サ?ビスフォ?ユ? 5秒でSP1 */ + s=5; + break; + case BA_APPLEIDUN: /* イドゥンの林檎 6秒でSP1 */ + s=6; + break; + case DC_DONTFORGETME: /* 私を忘れないで… 10秒でSP1 */ + case CG_MOONLIT: /* 月明りの泉に落ちる花びら 10秒でSP1? */ + s=10; + break; + } + if(s && ((sc_data[type].val3 % s) == 0)){ + sd->status.sp--; + clif_updatestatus(sd,SP_SP); + } + sc_data[type].timer=add_timer( /* タイマ?再設定 */ + 1000+tick, status_change_timer, + bl->id, data); + return 0; + } + } + } + break; + case SC_BERSERK: /* バ?サ?ク */ + if(sd){ /* HPが100以上なら?? */ + if( (sd->status.hp - sd->status.max_hp*5/100) > 100 ){ // 5% every 10 seconds [DracoRPG] + sd->status.hp -= sd->status.max_hp*5/100; // changed to max hp [celest] + clif_updatestatus(sd,SP_HP); + sc_data[type].timer = add_timer( /* タイマ?再設定 */ + 10000+tick, status_change_timer, + bl->id, data); + return 0; + } + } + break; + case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) + if(sd){ + time_t timer; + if(time(&timer) < ((sc_data[type].val2) + 3600)){ //1時間たっていないので?? + sc_data[type].timer=add_timer( /* タイマ?再設定 */ + 10000+tick, status_change_timer, + bl->id, data); + return 0; + } + } + break; + case SC_NOCHAT: //チャット禁止?態 + if(sd && battle_config.muting_players){ + time_t timer; + if((++sd->status.manner) && time(&timer) < ((sc_data[type].val2) + 60*(0-sd->status.manner))){ //開始からstatus.manner分?ってないので?? + clif_updatestatus(sd,SP_MANNER); + sc_data[type].timer=add_timer( /* タイマ?再設定(60秒) */ + 60000+tick, status_change_timer, + bl->id, data); + return 0; + } + } + break; + case SC_SELFDESTRUCTION: /* 自爆 */ + if(--sc_data[type].val3>0){ + struct mob_data *md; + if(bl->type==BL_MOB && (md=(struct mob_data *)bl) && md->speed > 250){ + md->speed -= 250; + md->next_walktime=tick; + } + sc_data[type].timer=add_timer( /* タイマ?再設定 */ + 1000+tick, status_change_timer, + bl->id, data); + return 0; + } + break; + + case SC_SPLASHER: + if (sc_data[type].val4 % 1000 == 0) { + char timer[2]; + sprintf (timer, "%d", sc_data[type].val4/1000); + clif_message(bl, timer); + } + if((sc_data[type].val4 -= 500) > 0) { + sc_data[type].timer = add_timer( + 500 + tick, status_change_timer, + bl->id, data); + return 0; + } + break; + + case SC_MARIONETTE: /* マリオネットコントロ?ル */ + case SC_MARIONETTE2: + { + struct block_list *pbl = map_id2bl(sc_data[type].val3); + if (pbl && battle_check_range(bl, pbl, 7) && + (sc_data[type].val2 -= 1000)>0) { + sc_data[type].timer = add_timer( + 1000 + tick, status_change_timer, + bl->id, data); + return 0; + } + } + break; + +/* case SC_LEADERSHIP: + case SC_GLORYWOUNDS: + case SC_SOULCOLD: + case SC_HAWKEYES: + if (sd) { + sc_data[type].timer = add_timer( + 1000+tick, status_change_timer, + bl->id, data); + } + break;*/ + + // Celest + case SC_CONFUSION: + { + int i = 3000; + //struct mob_data *md; + if (sd) { + pc_randomwalk (sd, gettick()); + sd->next_walktime = tick + (i=1000 + rand()%1000); + } /*else if (bl->type==BL_MOB && (md=(struct mob_data *)bl) && md->mode&1 && mob_can_move(md)) { + md->state.state=MS_WALK; + if( DIFF_TICK(md->next_walktime,tick) > + 7000 && + (md->walkpath.path_len==0 || md->walkpath.path_pos>=md->walkpath.path_len) ) + md->next_walktime = tick + 3000*rand()%2000; + mob_randomwalk(md,tick); + }*/ + if ((sc_data[type].val2 -= 1000) > 0) { + sc_data[type].timer = add_timer( + i + tick, status_change_timer, + bl->id, data); + return 0; + } + } + break; + + case SC_GOSPEL: + { + int calc_flag = 0; + if (sc_data[type].val3 > 0) { + sc_data[type].val3 = 0; + calc_flag = 1; + } + if(sd && sc_data[type].val4 == BCT_SELF){ + int hp, sp; + hp = (sc_data[type].val1 > 5) ? 45 : 30; + sp = (sc_data[type].val1 > 5) ? 35 : 20; + if(sd->status.hp - hp > 0 && + sd->status.sp - sp > 0){ + sd->status.hp -= hp; + sd->status.sp -= sp; + clif_updatestatus(sd,SP_HP); + clif_updatestatus(sd,SP_SP); + if ((sc_data[type].val2 -= 10000) > 0) { + sc_data[type].timer = add_timer( + 10000+tick, status_change_timer, + bl->id, data); + return 0; + } + } + } else if (sd && sc_data[type].val4 == BCT_PARTY) { + int i; + switch ((i = rand() % 12)) { + case 1: // heal between 100-1000 + { + struct block_list tbl; + int heal = rand() % 900 + 100; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,AL_HEAL,heal,1); + battle_heal(NULL,bl,heal,0,0); + } + break; + case 2: // end negative status + { + int j; + for (j=0; j<4; j++) + if(sc_data[i + SC_POISON].timer!=-1) { + status_change_end(bl,j,-1); + break; + } + } + break; + case 3: // +25% resistance to negative status + case 4: // +25% max hp + case 5: // +25% max sp + case 6: // +2 to all stats + case 11: // +25% armor and vit def + case 12: // +8% atk + case 13: // +5% flee + case 14: // +5% hit + sc_data[type].val3 = i; + if (i == 6 || + (i >= 11 && i <= 14)) + calc_flag = 1; + break; + case 7: // level 5 bless + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,AL_BLESSING,5,1); + status_change_start(bl,SkillStatusChangeTable[AL_BLESSING],5,0,0,0,10000,0 ); + } + break; + case 8: // level 5 increase agility + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,AL_INCAGI,5,1); + status_change_start(bl,SkillStatusChangeTable[AL_INCAGI],5,0,0,0,10000,0 ); + } + break; + case 9: // holy element to weapon + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,PR_ASPERSIO,1,1); + status_change_start(bl,SkillStatusChangeTable[PR_ASPERSIO],1,0,0,0,10000,0 ); + } + break; + case 10: // holy element to armour + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,PR_BENEDICTIO,1,1); + status_change_start(bl,SkillStatusChangeTable[PR_BENEDICTIO],1,0,0,0,10000,0 ); + } + break; + default: + break; + } + } else if (sc_data[type].val4 == BCT_ENEMY) { + int i; + switch ((i = rand() % 8)) { + case 1: // damage between 300-800 + case 2: // damage between 150-550 (ignore def) + battle_damage(NULL, bl, rand() % 500,0); // temporary damage + break; + case 3: // random status effect + { + int effect[3] = { + SC_CURSE, + SC_BLIND, + SC_POISON }; + status_change_start(bl,effect[rand()%3],1,0,0,0,10000,0 ); + } + break; + case 4: // level 10 provoke + { + struct block_list tbl; + tbl.id = 0; + tbl.m = bl->m; + tbl.x = bl->x; + tbl.y = bl->y; + clif_skill_nodamage(&tbl,bl,SM_PROVOKE,1,1); + status_change_start(bl,SkillStatusChangeTable[SM_PROVOKE],10,0,0,0,10000,0 ); + } + break; + case 5: // 0 def + case 6: // 0 atk + case 7: // 0 flee + case 8: // -75% move speed and aspd + sc_data[type].val3 = i; + calc_flag = 1; + break; + default: + break; + } + } + if (sd && calc_flag) + status_calc_pc (sd, 0); + } + break; + } + + return status_change_end( bl,type,tid ); +} + +/*========================================== + * ステータス異常タイマー範囲処理 + *------------------------------------------ + */ +int status_change_timer_sub(struct block_list *bl, va_list ap ) +{ + struct block_list *src; + int type; + unsigned int tick; + + nullpo_retr(0, bl); + nullpo_retr(0, ap); + nullpo_retr(0, src=va_arg(ap,struct block_list*)); + type=va_arg(ap,int); + tick=va_arg(ap,unsigned int); + + if(bl->type!=BL_PC && bl->type!=BL_MOB) + return 0; + + switch( type ){ + case SC_SIGHT: /* サイト */ + case SC_CONCENTRATE: + if( (*status_get_option(bl))&6 ){ + status_change_end( bl, SC_HIDING, -1); + status_change_end( bl, SC_CLOAKING, -1); + } + break; + case SC_RUWACH: /* ルアフ */ + if( (*status_get_option(bl))&6 ){ + if(battle_check_target( src,bl, BCT_ENEMY ) > 0) { + struct status_change *sc_data = status_get_sc_data(bl); // check whether the target is hiding/cloaking [celest] + if (sc_data && (sc_data[SC_HIDING].timer != -1 || // if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother + sc_data[SC_CLOAKING].timer != -1)) { + status_change_end( bl, SC_HIDING, -1); + status_change_end( bl, SC_CLOAKING, -1); + skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,sc_data[type].val1,tick,0); + } + } + } + break; + } + return 0; +} + + +static int status_calc_sigma(void) +{ + int i,j,k; + + for(i=0;i Date: Thu, 3 Feb 2005 04:32:15 +0000 Subject: * Fixed a mistake that was causing Ruwach to only work in PvP and PvM * Updated code for Joint Beat git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1023 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 4 +++ conf-tmpl/battle_athena.conf | 2 +- db/skill_require_db.txt | 2 +- src/map/battle.c | 27 ++++++++++++++----- src/map/skill.c | 2 +- src/map/status.c | 63 +++++++++++++++++++++++++++++++++++++------- 6 files changed, 82 insertions(+), 18 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog.txt b/Changelog.txt index 2839c5d43..fdd0c4ce0 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Date Added +02/03 + * Fixed a mistake that was causing Ruwach to only work in PvP and PvM [celest] + * Added DracoRPG's code for Joint Beat effects, thanks! [celest] + 02/02 * Added checks to prevent some crashes in skill.c [Full credit to shinomori] [SVN 1022: Ajarn] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 10df2b7ee..a36792ec4 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -551,7 +551,7 @@ gvg_magic_attack_damage_rate: 50 // Misc damage adjustments for WoE battles (Guild Vs Guild) (Note 2) gvg_misc_attack_damage_rate: 60 -// When the empelium is broken with WoE mode on, How Long Before The Declaration Of Castle Owner +// When the emperium is broken with WoE mode on, How Long Before The Declaration Of Castle Owner // and Removal of Monsters/Players from Castle. (in milliseconds) gvg_eliminate_time: 7000 diff --git a/db/skill_require_db.txt b/db/skill_require_db.txt index eab178231..50578ac49 100644 --- a/db/skill_require_db.txt +++ b/db/skill_require_db.txt @@ -281,7 +281,7 @@ 396,0,0,1,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //CG_MARIONETTE#マリオネットコントロ?ル# 397,0,0,18:21:23:25:28,0,0,0,4:05,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_SPIRALPIERCE#スパイラルピア?ス# 398,0,0,23,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_HEADCRUSH#ヘッドクラッシュ# -399,0,0,22:24:26:28:30:32:34:36:38:40,0,0,0,4:05,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_JOINTBEAT#ジョイントビ?ト# +399,0,0,12:12:14:14:16:16:18:18:20:20,0,0,0,4:05,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LK_JOINTBEAT#ジョイントビ?ト# 400,0,0,10:25:40:55:70,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //HW_NAPALMVULCAN#ナパ?ムバルカン# 401,0,0,20,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //CH_SOULCOLLECT#狂?功# 402,0,0,4:5:6:7:8:9:10:11:12:13,0,0,0,99,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //PF_MINDBREAKER#マインドブレ?カ?# diff --git a/src/map/battle.c b/src/map/battle.c index 128ede1a8..b9908f835 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -689,8 +689,13 @@ static struct Damage battle_calc_pet_weapon_attack( if(cri < 1) cri = 1; } - if(t_sc_data != NULL && t_sc_data[SC_SLEEP].timer!=-1 ) - cri <<=1; + if(t_sc_data) { + if (t_sc_data[SC_SLEEP].timer!=-1) + cri <<=1; + if(t_sc_data[SC_JOINTBEAT].timer != -1 && + t_sc_data[SC_JOINTBEAT].val2 == 6) // Always take crits with Neck broken by Joint Beat [DracoRPG] + cri = 1000; + } if(skill_num == 0 && battle_config.enemy_critical && (rand() % 1000) < cri) { @@ -1155,8 +1160,13 @@ static struct Damage battle_calc_mob_weapon_attack( if(cri < 1) cri = 1; } - if(t_sc_data != NULL && t_sc_data[SC_SLEEP].timer!=-1 ) // 睡眠中はクリティカルが倍に - cri <<=1; + if(t_sc_data) { + if (t_sc_data[SC_SLEEP].timer!=-1 ) // 睡眠中はクリティカルが倍に + cri <<=1; + if(t_sc_data[SC_JOINTBEAT].timer != -1 && + t_sc_data[SC_JOINTBEAT].val2 == 6) // Always take crits with Neck broken by Joint Beat [DracoRPG] + cri = 1000; + } if(ac_flag) cri = 1000; @@ -1767,8 +1777,13 @@ static struct Damage battle_calc_pc_weapon_attack( // カタールの場合、クリティカルを倍に cri <<=1; cri -= status_get_luk(target) * 3; - if(t_sc_data != NULL && t_sc_data[SC_SLEEP].timer!=-1 ) // 睡眠中はクリティカルが倍に - cri <<=1; + if(t_sc_data) { + if (t_sc_data[SC_SLEEP].timer!=-1 ) // 睡眠中はクリティカルが倍に + cri <<=1; + if(t_sc_data[SC_JOINTBEAT].timer != -1 && + t_sc_data[SC_JOINTBEAT].val2 == 6) // Always take crits with Neck broken by Joint Beat [DracoRPG] + cri = 1000; + } if(ac_flag) cri = 1000; if(skill_num == KN_AUTOCOUNTER) { diff --git a/src/map/skill.c b/src/map/skill.c index 674412332..f06cafba4 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1238,7 +1238,7 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s break; case LK_JOINTBEAT: /* ジョイントビ?ト */ //?件が良く分からないので適?に - if( rand()%100 < (2*skilllv+10)*sc_def_vit/100 ) + if( rand()%100 < (5*skilllv+5)*sc_def_vit/100 ) status_change_start(bl,SC_JOINTBEAT,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); break; case PF_SPIDERWEB: /* スパイダ?ウェッブ */ diff --git a/src/map/status.c b/src/map/status.c index 35b2baaff..13542e5a6 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1007,6 +1007,28 @@ int status_calc_pc(struct map_session_data* sd,int first) if(sd->sc_data[SC_BARRIER].timer!=-1) sd->mdef = 100; + if(sd->sc_data[SC_JOINTBEAT].timer!=-1) { // Random break [DracoRPG] + switch(sd->sc_data[SC_JOINTBEAT].val2) { + case 1: //Ankle break + sd->speed_rate += 50; + break; + case 2: //Wrist break + sd->aspd_rate += 25; + break; + case 3: //Knee break + sd->speed_rate += 30; + sd->aspd_rate += 10; + break; + case 4: //Shoulder break + sd->def2 -= sd->def2*50/100; + break; + case 5: //Waist break + sd->def2 -= sd->def2*50/100; + sd->base_atk -= sd->base_atk*25/100; + break; + } + } + if(sd->sc_data[SC_GOSPEL].timer!=-1) { if (sd->sc_data[SC_GOSPEL].val4 == BCT_PARTY){ switch (sd->sc_data[SC_GOSPEL].val3) @@ -2023,6 +2045,12 @@ int status_get_def(struct block_list *bl) sc_data[SC_GOSPEL].val3 == 5) def = 0; } + if(sc_data[SC_JOINTBEAT].timer!=-1) { + if (sc_data[SC_JOINTBEAT].val2 == 4) + def -= def*50/100; + else if (sc_data[SC_JOINTBEAT].val2 == 5) + def -= def*25/100; + } } } //詠唱中は詠唱時減算率に基づいて減算 @@ -2194,6 +2222,12 @@ int status_get_speed(struct block_list *bl) sc_data[SC_GOSPEL].val4 == BCT_ENEMY && sc_data[SC_GOSPEL].val3 == 8) speed = speed*125/100; + if(sc_data[SC_JOINTBEAT].timer!=-1) { + if (sc_data[SC_JOINTBEAT].val2 == 1) + speed = speed*150/100; + else if (sc_data[SC_JOINTBEAT].val2 == 3) + speed = speed*130/100; + } } if(speed < 1) speed = 1; return speed; @@ -2258,6 +2292,12 @@ int status_get_adelay(struct block_list *bl) sc_data[SC_GOSPEL].val4 == BCT_ENEMY && sc_data[SC_GOSPEL].val3 == 8) aspd_rate = aspd_rate*125/100; + if(sc_data[SC_JOINTBEAT].timer!=-1) { + if (sc_data[SC_JOINTBEAT].val2 == 2) + aspd_rate = aspd_rate*125/100; + else if (sc_data[SC_JOINTBEAT].val2 == 3) + aspd_rate = aspd_rate*110/100; + } } if(aspd_rate != 100) adelay = adelay*aspd_rate/100; @@ -3295,7 +3335,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val case SC_PARRYING: /* パリイング */ // case SC_ASSUMPTIO: /* */ case SC_HEADCRUSH: /* ヘッドクラッシュ */ - case SC_JOINTBEAT: /* ジョイントビ?ト */ +// case SC_JOINTBEAT: /* ジョイントビ?ト */ // case SC_MARIONETTE: /* マリオネットコントロ?ル */ //とりあえず手?き @@ -3330,6 +3370,12 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val calc_flag = 1; val2 = (val1 / 2); //Flee上昇率 break; + + case SC_JOINTBEAT: // Random break [DracoRPG] + calc_flag = 1; + val2 = rand()%6 + 1; + if (val2 == 6) status_change_start(bl,SC_BLEEDING,val1,0,0,0,skill_get_time2(type,val1),0); + break; case SC_BERSERK: /* バ?サ?ク */ if(sd){ @@ -4549,15 +4595,14 @@ int status_change_timer_sub(struct block_list *bl, va_list ap ) break; case SC_RUWACH: /* ルアフ */ if( (*status_get_option(bl))&6 ){ - if(battle_check_target( src,bl, BCT_ENEMY ) > 0) { - struct status_change *sc_data = status_get_sc_data(bl); // check whether the target is hiding/cloaking [celest] - if (sc_data && (sc_data[SC_HIDING].timer != -1 || // if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother - sc_data[SC_CLOAKING].timer != -1)) { - status_change_end( bl, SC_HIDING, -1); - status_change_end( bl, SC_CLOAKING, -1); - skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,sc_data[type].val1,tick,0); - } + struct status_change *sc_data = status_get_sc_data(bl); // check whether the target is hiding/cloaking [celest] + if (sc_data && (sc_data[SC_HIDING].timer != -1 || // if the target is using a special hiding, i.e not using normal hiding/cloaking, don't bother + sc_data[SC_CLOAKING].timer != -1)) { + status_change_end( bl, SC_HIDING, -1); + status_change_end( bl, SC_CLOAKING, -1); } + if(battle_check_target( src,bl, BCT_ENEMY ) > 0) + skill_attack(BF_MAGIC,src,src,bl,AL_RUWACH,sc_data[type].val1,tick,0); } break; } -- cgit v1.2.3-70-g09d2 From b91405aa5454bab5eeacd29d28a773812ef55b29 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> Date: Fri, 4 Feb 2005 23:22:34 +0000 Subject: some item/mob db fixes git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1032 54d463be-8e91-2dee-dedb-b68131a5f0ec --- conf-tmpl/battle_athena.conf | 6 ++++++ db/Changelog.txt | 6 ++++++ db/item_db.txt | 42 +++++++++++++++++++++--------------------- db/mob_db.txt | 2 +- npc/cities/valkyrie.txt | 13 ++++++++++--- src/map/mob.c | 5 +++-- 6 files changed, 47 insertions(+), 27 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index a36792ec4..2b5114f95 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -837,5 +837,11 @@ bone_drop: 0 // The rate of monsters dropping ores by the skill Ore Discovery (Default is 100) finding_ore_rate: 100 +//Method of calculating earned experience when defeating a monster: +//0 - jAthena's +//1 - eAthena's, using damage given / max_hp as damage ratio +//2 - eAthena's, using damage given / total damage as damage ratio +exp_calc_type: 1 + import: conf/import/battle_conf.txt diff --git a/db/Changelog.txt b/db/Changelog.txt index e6f60e31a..3edb35f42 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -5,6 +5,12 @@ Ayathoya items == Added but no effect ( all are "ect" itens) Skill databases == celest working on them i believe. +02/05 + * item_db.txt Added prices to all Magic Scrolls and to Horse Crest, + added +100-1000 Zeny effect to Gold Coin (it's used in st.Patric event) + not sure in Zeny amount, tough. [Lupus] + * mob_db.txt Kind of Beetle -> Beetle King. [Lupus] + 01/26 * Updated Counter dagger's attack, thanks to Poki#3 * Added ayo_fild02 to nomemo mapflag list diff --git a/db/item_db.txt b/db/item_db.txt index d7440724e..02956b3a8 100644 --- a/db/item_db.txt +++ b/db/item_db.txt @@ -134,7 +134,7 @@ 661,Sky_Apron,Soft Apron,2,20,0,50,,,,,10477567,2,,,,,{ pet 1275; },{} // Newer Items -662,Horse_Crest,Crest of the Horse,2,2,0,30,0,0,0,0,10477567,2,0,0,0,0,{ skilleffect 29,5; sc_start SC_SpeedUp0,240000,0; },{} +662,Horse_Crest,Crest of the Horse,2,2,3000,30,0,0,0,0,10477567,2,0,0,0,0,{ skilleffect 29,5; sc_start SC_SpeedUp0,240000,0; },{} 664,Gift_Box_,Gift Box,2,20,0,200,,,,,10477567,2,,,,,{ getitem -4,1; },{}, 665,Gift_Box__,Gift Box,2,20,0,200,,,,,10477567,2,,,,,{ getitem -4,1; },{}, 666,Gift_Box___,Gift Box,2,20,0,200,,,,,10477567,2,,,,,{ getitem -4,1; },{}, @@ -142,7 +142,7 @@ 668,Angpow,Angpow,0,1,0,2,,,,,10477567,2,,,,,{ set Zeny,Zeny+rand(100,10000); },{} 669,Rice_Cake_Soup,Rice Cake Soup,2,20,0,100,,,,,,,,,,,{},{} 670,Gold_Coin_Pouch,Gold Coin Pouch,2,20,0,400,,,,,,,,,,,{},{} -671,Gold_Coin,Gold Coin,2,20,0,40,,,,,,,,,,,{},{} +671,Gold_Coin,Gold Coin,2,20,0,40,,,,,10477567,2,,,,,{ set Zeny,Zeny+rand(100,1000); },{} 672,Copper_Coin_Pouch,Copper Coin Pouch,2,20,0,400,,,,,,,,,,,{},{} 673,Copper_Coin,Copper Coin,2,20,0,40,,,,,,,,,,,{},{} 674,Mysterious_Ore_Coin,Mysterious Ore Coin,2,20,0,40,,,,,0,3,,,,,{},{} @@ -159,21 +159,21 @@ 685,Ramadan,Ramadan,2,20,10,300,,,,,0,3,,,,,{},{} // Scrolls -686,Earth_Spike_3,Earth Spike Level 3,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 90,3,"Earth Spike Level 3"; },{} -687,Earth_Spike_5,Earth Spike Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 90,5,"Earth Spike Level 5"; },{} -688,Cold_Bolt_3,Cold Bolt Level 3,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 14,3,"Cold Bolt Level 3"; },{} -689,Cold_Bolt_5,Cold Bolt Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 14,5,"Cold Bolt Level 5"; },{} -690,Fire_Bolt_3,Fire Bolt Level 3,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 19,3,"Fire Bolt Level 3"; },{} -691,Fire_Bolt_5,Fire Bolt Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 19,5,"Fire bolt Level 5"; },{} -692,Lightning_Bolt_3,Lightning Bolt Level 3,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 20,3,"Lightning Bolt Level 3"; },{} -693,Lightning_Bolt_5,Lightning Bolt Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 20,5,"Lightning Bolt Level 5"; },{} -694,Soul_Strike_3,Soul Strike Level 3,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 13,3,"Soul Strike Level 3"; },{} -695,Soul_Strike_5,Soul Strike Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 13,5,"Soul Strike Level 5"; },{} -696,Fire_Ball_1,Fire Ball Level 1,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 17,1,"Fire Ball Level 1"; },{} -697,Fire_Ball_5,Fire Ball Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 17,5,"Fire Ball Level 5"; },{} -698,Fire_Wall_1,Fire Wall Level 1,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 18,1,"Fire Wall Level 1"; },{} -699,Fire_Wall_5,Fire Wall Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 18,5,"Fire Wall Level 5"; },{} -700,Frost_Diver_1,Frost Diver Level 1,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 15,1,"Frost Diver Level 1"; },{} +686,Earth_Spike_3,Earth Spike Level 3,2,650,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 90,3,"Earth Spike Level 3"; },{} +687,Earth_Spike_5,Earth Spike Level 5,2,1300,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 90,5,"Earth Spike Level 5"; },{} +688,Cold_Bolt_3,Cold Bolt Level 3,2,500,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 14,3,"Cold Bolt Level 3"; },{} +689,Cold_Bolt_5,Cold Bolt Level 5,2,1000,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 14,5,"Cold Bolt Level 5"; },{} +690,Fire_Bolt_3,Fire Bolt Level 3,2,500,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 19,3,"Fire Bolt Level 3"; },{} +691,Fire_Bolt_5,Fire Bolt Level 5,2,1000,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 19,5,"Fire bolt Level 5"; },{} +692,Lightning_Bolt_3,Lightning Bolt Level 3,2,500,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 20,3,"Lightning Bolt Level 3"; },{} +693,Lightning_Bolt_5,Lightning Bolt Level 5,2,1000,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 20,5,"Lightning Bolt Level 5"; },{} +694,Soul_Strike_3,Soul Strike Level 3,2,500,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 13,3,"Soul Strike Level 3"; },{} +695,Soul_Strike_5,Soul Strike Level 5,2,1000,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 13,5,"Soul Strike Level 5"; },{} +696,Fire_Ball_1,Fire Ball Level 1,2,500,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 17,1,"Fire Ball Level 1"; },{} +697,Fire_Ball_5,Fire Ball Level 5,2,1000,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 17,5,"Fire Ball Level 5"; },{} +698,Fire_Wall_1,Fire Wall Level 1,2,350,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 18,1,"Fire Wall Level 1"; },{} +699,Fire_Wall_5,Fire Wall Level 5,2,700,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 18,5,"Fire Wall Level 5"; },{} +700,Frost_Diver_1,Frost Diver Level 1,2,350,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 15,1,"Frost Diver Level 1"; },{} 701,Ora_Ora,Ora Ora,3,55000,0,200,,,,,,,,,,,{},{} 702,Animal_Gore,Animal Gore,3,2,0,100,,,,,,,,,,,{},{} @@ -1719,10 +1719,10 @@ 11020,Louyang_History_Book,Louyang History Book,3,20,0,0,,,,,,,,,,,{},{} // More Scrolls -12000,Frost_Diver_5,Frost Diver Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 15,5,"Frost Diver Level 5"; },{} -12001,Heal_3,Heal Level 3,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 28,3,"Heal Level 3"; },{} -12002,Heal_5,Heal Level 5,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 28,5,"Heal Level 5"; },{} -12003,Teleport_1,Teleport Level 1,2,0,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 26,1,"Teleport Level 1"; },{} +12000,Frost_Diver_5,Frost Diver Level 5,2,700,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 15,5,"Frost Diver Level 5"; },{} +12001,Heal_3,Heal Level 3,2,1000,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 28,3,"Heal Level 3"; },{} +12002,Heal_5,Heal Level 5,2,2000,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 28,5,"Heal Level 5"; },{} +12003,Teleport_1,Teleport Level 1,2,100,0,10,0,0,0,0,10477567,2,0,0,0,0,{ itemskill 26,1,"Teleport Level 1"; },{} // Arrow Quivers 12004,Arrow_Quiver,Arrow Quiver,2,500,,250,,,,,10477567,2,,,,,{ getitem 1750,500; },{} diff --git a/db/mob_db.txt b/db/mob_db.txt index d3c72e5af..b50dcb25e 100644 --- a/db/mob_db.txt +++ b/db/mob_db.txt @@ -489,7 +489,7 @@ 1491,G_DOKEBI,Dokebi,33,2697,0,0,0,1,197,249,0,10,1,50,40,35,69,40,10,12,0,6,27,145,250,1156,456,384,512,0,512,0,512,0,512,0,512,0,512,0,512,0,512,0,0,0,0,0,0,0,0,0 1492,INCANTATION_SAMURAI,Incantation Samurai,71,218652,0,53600,5000,1,1219,2169,10,51,1,85,78,85,150,60,10,12,2,7,67,181,200,1152,1152,480,512,0,1165,1,999,5000,984,3500,985,1000,607,5000,512,0,504,5000,5000,1000,607,500,608,1000,985,2000,607,6000 1493,DRYAD,Dryad,50,8791,0,2763,1493,3,499,589,15,33,1,75,55,1,78,45,10,12,1,3,64,149,200,1152,1152,384,7188,3000,7198,1100,7197,6000,1951,200,2269,2,1964,1,7100,3200,512,0,0,0,0,0,0,0,0,0 -1494,KIND_OF_BEETLE,Kind of Beetle,34,1874,0,679,442,1,191,243,45,12,1,34,10,1,50,1,10,12,0,4,22,149,200,1152,1152,384,7190,9000,7202,6000,928,600,955,600,2102,15,512,0,512,0,512,0,0,0,0,0,0,0,0,0 +1494,BEETLE_KING,Beetle King,34,1874,0,679,442,1,191,243,45,12,1,34,10,1,50,1,10,12,0,4,22,149,200,1152,1152,384,7190,9000,7202,6000,928,600,955,600,2102,15,512,0,512,0,512,0,0,0,0,0,0,0,0,0 1495,STONE_SHOOTER,Stone Shooter,42,4104,0,1238,752,9,309,350,12,45,1,40,20,79,92,20,10,12,1,3,63,133,150,1872,1248,428,7203,8000,7188,6000,7201,3000,7049,1500,1019,1000,756,197,0,0,0,0,0,0,0,0,0,0,0,0 1497,WOODEN_GOLEM,Wooden Golem,51,9200,0,1926,1353,1,570,657,32,36,1,41,69,5,85,41,10,12,2,3,42,149,200,1152,1584,400,7188,6500,7189,5000,757,120,604,100,2270,3,921,1000,7201,900,0,0,0,0,0,0,0,0,0,0 1498,WOOTAN_SHOOTER,Wootan Shooter,39,3977,0,886,453,9,224,271,10,28,1,35,29,15,120,42,10,12,1,7,42,133,200,1152,1152,384,7049,1000,513,1000,7195,4500,7200,3500,512,100,512,0,512,0,512,0,0,0,0,0,0,0,0,0 diff --git a/npc/cities/valkyrie.txt b/npc/cities/valkyrie.txt index 6c0c4a67c..94f41920b 100644 --- a/npc/cities/valkyrie.txt +++ b/npc/cities/valkyrie.txt @@ -1,7 +1,7 @@ // Valkyrie Replacement after kRO. // The Jobquest from kRO on how to advance to a Reborn class. // Made by: Nana -// 1.01 bugfixex by Lupus +// 1.0.2 bugfixex by Lupus // -== Warp's needed! ==- @@ -44,15 +44,15 @@ L_Start: mes "[Book of Ymir]"; mes "And only after then, the decended ones will aprove you to the highest obedience.. Into the warmth of Valkyrie, you will be welcomed by the gods themself."; next; - mes "[Book og Ymir]"; + mes "[Book of Ymir]"; mes "*As you close the book a strange ray of light sourounds you and you suddently feel light. Everything around you fades away and all you can see left is white before you pass out.*"; warp "valkyrie",48,9; - set valkyrie_Q,0; close; } // -== The Librarian that watches the "Book of Ymir" ==- yuno_in02.gat,91,176,5 script Librarian 754,{ + if (valkyrie_Q>0) goto L_DONE; if(readparam(19) >= 7) goto L_Pay; mes "[Librarian]"; mes "Have a look around, but dont touch the book. Only a few chosen one can read its wise words."; @@ -87,6 +87,13 @@ accurate_z: mes "You didnt bring me the accurate number of zeny i wanted. Bring me back only 1,285,000 zeny!"; mes "Not more, nor less."; close; + +L_DONE: + mes "[Librarian]"; + mes "Why? You have already paid me."; + mes "Now go and look for the Book of Ymir."; + close; + } // -== The Heart of Ymir ==- diff --git a/src/map/mob.c b/src/map/mob.c index b381a4407..b8eac5d67 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -237,12 +237,13 @@ int mob_once_spawn_area(struct map_session_data *sd,char *mapname, x=rand()%(x1-x0+1)+x0; y=rand()%(y1-y0+1)+y0; } while (map_getcell(m,x,y,CELL_CHKNOPASS) && (++j)=max){ - if(lx>=0){ // 検索に失敗したので以前に沸いた場所を使う + if(lx>=0){ // Since reference went wrong, the place which boiled before is used. x=lx; y=ly; }else - return 0; // 最初に沸く場所の検索を失敗したのでやめる + return 0; // Since reference of the place which boils first went wrong, it stops. } if(x==0||y==0) printf("xory=0, x=%d,y=%d,x0=%d,y0=%d\n",x,y,x0,y0); id=mob_once_spawn(sd,mapname,x,y,mobname,class_,1,event); -- cgit v1.2.3-70-g09d2 From aa52f1d90449e970bd5972db00ef29f77eaa39d7 Mon Sep 17 00:00:00 2001 From: celest Date: Fri, 18 Feb 2005 07:07:25 +0000 Subject: * Added bAddRace2 * Added mob_race2_db.txt * Updated description for backup_txt in char_athena.conf a bit * Added some suggestions by Poki#3 * Use the event names from script_athena.conf to check whenever a player event trigger is being read/set * Removed an unused save/bank.txt git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1131 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 11 +++++++++ conf-tmpl/battle_athena.conf | 4 ++-- conf-tmpl/char_athena.conf | 2 +- conf-tmpl/map_athena.conf | 4 ++-- db/Changelog.txt | 2 ++ db/const.txt | 1 + db/item_db.txt | 2 +- db/mob_race2_db.txt | 6 +++++ doc/item_bonus.txt | 2 ++ save-tmpl/bank.txt | 0 src/map/battle.c | 20 +++++++++++------ src/map/map.h | 3 ++- src/map/mob.c | 53 +++++++++++++++++++++++++++++++++++++++++++- src/map/mob.h | 2 ++ src/map/pc.c | 20 ++++++++++++----- src/map/status.c | 12 ++++++++++ src/map/status.h | 1 + 17 files changed, 124 insertions(+), 21 deletions(-) create mode 100644 db/mob_race2_db.txt delete mode 100644 save-tmpl/bank.txt (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 8d5ab72cb..5a3de0f2c 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,7 +1,18 @@ Date Added 02/18 + * Added bAddRace2 -- check item_bonus.txt [celest] + * Added mob_race2_db.txt -- contains 'main races' of certain monsters [celest] + * Updated description for backup_txt in char_athena.conf a bit [celest] + * Set read_map_from_cache to 2 (enable compression), and map_cache_file back to + saving in /db instead of /save, as suggested by Poki#3 [celest] + * Updated description for auto_counter_type, and set plaer_auto_counter_type + to 0 by default, as suggested by Poki#3 [celest] + * Use the event names from script_athena.conf to check whenever a player event + trigger is being read/set [celest] + * Removed an unused save/bank.txt [celest] * Added some new cards effects. (check DB\changelog.txt) [Lupus] + 02/17 * Now all mobs have 10 drops slots. the last one is used for Cards Drops [Lupus] Don't forget to update your SQL files (Drop Log: logs.sql and db_tables.sql diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 2b5114f95..34e047990 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -466,12 +466,12 @@ save_clothcolor: yes // 2 = both undead_detect_type: 2 -// Operational mode of automatic counter. +// Counter Attack Skill Type // 0 = 100% critical // 1 = disregard DEF and HIT+20, CRI*2 // 2 = Same as 0, but can counter skills (?) // Players -player_auto_counter_type: 1 +player_auto_counter_type: 0 // Monsters monster_auto_counter_type: 0 diff --git a/conf-tmpl/char_athena.conf b/conf-tmpl/char_athena.conf index 97021d816..6b73b3447 100644 --- a/conf-tmpl/char_athena.conf +++ b/conf-tmpl/char_athena.conf @@ -84,7 +84,7 @@ char_txt: save/athena.txt // default is 'no', because backup file take time for nothing. Actually, there is no problem on characters file creation and save. backup_txt_flag: no -// Character server flatfile database (backup) +// Character server flatfile database (backup, TXT only) backup_txt: save/athena_backup.txt // Friends list flatfile database diff --git a/conf-tmpl/map_athena.conf b/conf-tmpl/map_athena.conf index ad01675d0..405af5d80 100644 --- a/conf-tmpl/map_athena.conf +++ b/conf-tmpl/map_athena.conf @@ -57,10 +57,10 @@ map_port: 5121 // It is possible to reduce the map cache to 1MB for 400+ maps with compression // enabled. If all maps are already loaded in the cache, Athena can boot without // reading the grf files. -read_map_from_cache: 1 +read_map_from_cache: 2 // //Where is the bitmap file stored? -map_cache_file: save/mapinfo.txt +map_cache_file: db/mapinfo.txt // Console Commands // Allow for console commands to be used on/off diff --git a/db/Changelog.txt b/db/Changelog.txt index c757a0adf..73f7b4380 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -6,6 +6,8 @@ Skill databases == celest working on them i believe. 02/18 + * Changed Goblin Leader Card to using bAddRace2 -- each player can only save + 10 AddDamageClass, so this would save some space for other cards ^^ [celest] * Started adding new cards effects. Also big thanks to Landarma [Lupus] 02/17 diff --git a/db/const.txt b/db/const.txt index a2f199c0b..5e3976c86 100644 --- a/db/const.txt +++ b/db/const.txt @@ -245,6 +245,7 @@ bAddDamageByClass 2020 bSPGainValue 2021 bIgnoreDefMob 2022 bHPLossRate 2023 +bAddRace2 2024 Eff_Stone 0 diff --git a/db/item_db.txt b/db/item_db.txt index d439a11d9..3a8556870 100644 --- a/db/item_db.txt +++ b/db/item_db.txt @@ -1185,7 +1185,7 @@ 4152,Galapago_Card,Galapago Card,6,20,0,10,,,,,,,,,,,{},{} 4153,Crab_Card,Crab Card,6,20,0,10,,,,,,,2,,,,{},{ bonus bAtk,5; bonus2 bAddDamageClass,1266,30; bonus2 bAddEle,4,30; if(isequipped(4247,4273)) bonus3 bAddMonsterDropItem,544,5,3000; } 4154,Dumpling_Child_Card,Dumpling Child Card,6,20,0,10,,,,,,,,,,,{},{} -4155,Goblin_Leader_Card,Goblin Leader Card,6,20,0,10,,,,,,,2,,,,{},{ bonus2 bAddDamageClass,1122,30; bonus2 bAddDamageClass,1123,30; bonus2 bAddDamageClass,1124,30; bonus2 bAddDamageClass,1125,30; bonus2 bAddDamageClass,1126,30; bAddDamageClass,1245,30; bAddDamageClass,1258,30; bAddDamageClass,1280,30; bAddDamageClass,1299,30; bAddDamageClass,1308,30; } +4155,Goblin_Leader_Card,Goblin Leader Card,6,20,0,10,,,,,,,2,,,,{},{ bonus2 bAddRace2,1,30; } 4156,Goblin_Steamrider_Card,Goblin Steamrider Card,6,20,0,10,,,,,,,2,,,,{},{} 4157,Goblin_Archer_Card,Goblin Archer Card,6,20,0,10,,,,,,,2,,,,{},{} 4158,Sky_Deleter_Card,Sky Deleter Card,6,20,0,10,,,,,,,16,,,,{},{} diff --git a/db/mob_race2_db.txt b/db/mob_race2_db.txt new file mode 100644 index 000000000..ebe563d52 --- /dev/null +++ b/db/mob_race2_db.txt @@ -0,0 +1,6 @@ +// RACE,Mob ID1,Mob ID2,Mob ID3,...,Mob ID9 +1,1122,1123,1124,1125,1126,1245,1258,1280,1308 // Goblins +2,1133,1134,1135,1136,1137,1226,1282,1455 // Kobolds +3,1023,1152,1153,1177,1189,1213,1273 // Orcs +4,1040,1278,1366,1497 // Golems +5,1285,1286,1287 // Guardians \ No newline at end of file diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt index fedf6b37e..038383d1e 100644 --- a/doc/item_bonus.txt +++ b/doc/item_bonus.txt @@ -157,6 +157,8 @@ bonus2 bAddEffWhenHit,n,x; n% chance to cause x state to the enemy when bonus2 bSkillAtk,n,x; Increase damage of skill n by x% bonus2 bAddDamageByClass,n,x; When being hit by monster of class n increase damage taken by x% +bonus2 bAddRace2,n,x; Increase damage by x% vs. enemies of race n + (Check db/mob_race2_db.txt) bonus3 bHPLossRate,n,x,y; Lose n amount of hp every x amount of time y:0=Don't show damage 1=Show damage diff --git a/save-tmpl/bank.txt b/save-tmpl/bank.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/map/battle.c b/src/map/battle.c index 634b04a70..6b46a357e 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1617,6 +1617,7 @@ static struct Damage battle_calc_pc_weapon_attack( int damage,damage2,damage3=0,damage4=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv); int flag,skill,dmg_lv = 0; int t_mode=0,t_race=0,t_size=1,s_race=7,s_ele=0; + int t_race2=0; struct status_change *sc_data,*t_sc_data; short *sc_count; short *option, *opt1, *opt2; @@ -1644,6 +1645,7 @@ static struct Damage battle_calc_pc_weapon_attack( option=status_get_option(src); //鷹とかペコとかカートとか opt1=status_get_opt1(src); //石化、凍結、スタン、睡眠、暗闇 opt2=status_get_opt2(src); //毒、呪い、沈黙、暗闇? + t_race2=status_get_race2(target); if(skill_num != CR_GRANDCROSS) //グランドクロスでないなら sd->state.attack_type = BF_WEAPON; //攻撃タイプは武器攻撃 @@ -2517,17 +2519,20 @@ static struct Damage battle_calc_pc_weapon_attack( cardfix=cardfix*(100+sd->addrace[t_race])/100; // 種族によるダメージ修正 cardfix=cardfix*(100+sd->addele[t_ele])/100; // 属性によるダメージ修正 cardfix=cardfix*(100+sd->addsize[t_size])/100; // サイズによるダメージ修正 + cardfix=cardfix*(100+sd->addrace2[t_race2])/100; } else { cardfix=cardfix*(100+sd->addrace[t_race]+sd->addrace_[t_race])/100; // 種族によるダメージ修正(左手による追加あり) cardfix=cardfix*(100+sd->addele[t_ele]+sd->addele_[t_ele])/100; // 属性によるダメージ修正(左手による追加あり) cardfix=cardfix*(100+sd->addsize[t_size]+sd->addsize_[t_size])/100; // サイズによるダメージ修正(左手による追加あり) + cardfix=cardfix*(100+sd->addrace2[t_race2]+sd->addrace2_[t_race2])/100; } } else { //弓矢 cardfix=cardfix*(100+sd->addrace[t_race]+sd->arrow_addrace[t_race])/100; // 種族によるダメージ修正(弓矢による追加あり) cardfix=cardfix*(100+sd->addele[t_ele]+sd->arrow_addele[t_ele])/100; // 属性によるダメージ修正(弓矢による追加あり) cardfix=cardfix*(100+sd->addsize[t_size]+sd->arrow_addsize[t_size])/100; // サイズによるダメージ修正(弓矢による追加あり) + cardfix=cardfix*(100+sd->addrace2[t_race2])/100; } if(t_mode & 0x20) { //ボス if(!sd->state.arrow_atk) { //弓矢攻撃以外なら @@ -2567,6 +2572,7 @@ static struct Damage battle_calc_pc_weapon_attack( cardfix=cardfix*(100+sd->addrace_[t_race])/100; // 種族によるダメージ修正左手 cardfix=cardfix*(100+sd->addele_[t_ele])/100; // 属 性によるダメージ修正左手 cardfix=cardfix*(100+sd->addsize_[t_size])/100; // サイズによるダメージ修正左手 + cardfix=cardfix*(100+sd->addrace2_[t_race2])/100; if(t_mode & 0x20) //ボス cardfix=cardfix*(100+sd->addrace_[10])/100; //ボスモンスターに追加ダメージ左手 else @@ -2580,8 +2586,8 @@ static struct Damage battle_calc_pc_weapon_attack( } } if(!no_cardfix) - damage2=damage2*cardfix/100; + //カード補正による左手ダメージ増加 //カードによるダメージ増加処理(左手)ここまで @@ -2629,14 +2635,14 @@ static struct Damage battle_calc_pc_weapon_attack( } if(t_sc_data[SC_ASSUMPTIO].timer != -1){ //アスムプティオ if(!map[target->m].flag.pvp){ - damage=damage/3; - damage2=damage2/3; - }else{ - damage=damage/2; - damage2=damage2/2; + damage=damage/3; + damage2=damage2/3; + }else{ + damage=damage/2; + damage2=damage2/2; + } } } - } //対象にステータス異常がある場合のダメージ減算処理ここまで if(damage < 0) damage = 0; diff --git a/src/map/map.h b/src/map/map.h index d4cd5084e..b8fe82539 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -289,6 +289,7 @@ struct map_session_data { short ignore_def_mob, ignore_def_mob_; int hp_loss_tick, hp_loss_rate; short hp_loss_value, hp_loss_type; + int addrace2[6],addrace2_[6]; short spiritball, spiritball_old; int spirit_timer[MAX_SKILL_LEVEL]; @@ -630,7 +631,7 @@ enum { SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017 SP_SKILL_ATK, SP_UNSTRIPABLE, SP_ADD_DAMAGE_BY_CLASS, // 2018-2020 - SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE // 2021-2023 + SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2 // 2021-2023 }; enum { diff --git a/src/map/mob.c b/src/map/mob.c index 7d87b1b98..14a9b564b 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -35,7 +35,6 @@ #define MAX_MOB_DB 2000 /* Change this to increase the table size in your mob_db to accomodate numbers more than 2000 for mobs if you want to (and know what you're doing). Be sure to note that 4001 to 4047 are for advanced classes. */ - struct mob_db mob_db[2001]; #define CLASSCHANGE_BOSS_NUM 21 @@ -4318,6 +4317,57 @@ static int mob_readskilldb(void) } return 0; } +/*========================================== + * db/mob_race_db.txt reading + *------------------------------------------ + */ +static int mob_readdb_race(void) +{ + FILE *fp; + char line[1024]; + int race,j,k; + char *str[20],*p,*np; + + if( (fp=fopen("db/mob_race2_db.txt","r"))==NULL ){ + printf("can't read db/mob_race2_db.txt\n"); + return -1; + } + + while(fgets(line,1020,fp)){ + if(line[0]=='/' && line[1]=='/') + continue; + memset(str,0,sizeof(str)); + + for(j=0,p=line;j<12;j++){ + if((np=strchr(p,','))!=NULL){ + str[j]=p; + *np=0; + p=np+1; + } else + str[j]=p; + } + if(str[0]==NULL) + continue; + + race=atoi(str[0]); + if (race < 0 || race >= MAX_MOB_RACE_DB) + continue; + + for (j=1; j<20; j++) { + if (!str[j]) + break; + k=atoi(str[j]); + if (k < 1000 || k > MAX_MOB_DB) + continue; + mob_db[k].race2 = race; + //mob_race_db[race][j] = k; + } + } + fclose(fp); + sprintf(tmp_output,"Done reading '"CL_WHITE"%s"CL_RESET"'.\n","db/mob_race2_db.txt"); + ShowStatus(tmp_output); + return 0; +} void mob_reload(void) { @@ -4495,6 +4545,7 @@ int do_init_mob(void) mob_readdb_mobavail(); mob_read_randommonster(); mob_readskilldb(); + mob_readdb_race(); add_timer_func_list(mob_timer,"mob_timer"); add_timer_func_list(mob_delayspawn,"mob_delayspawn"); diff --git a/src/map/mob.h b/src/map/mob.h index 103335365..83a07d301 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -3,6 +3,7 @@ #define _MOB_H_ #define MAX_RANDOMMONSTER 3 +#define MAX_MOB_RACE_DB 6 struct mob_skill { short state; @@ -26,6 +27,7 @@ struct mob_db { int str,agi,vit,int_,dex,luk; int range,range2,range3; int size,race,element,mode; + short race2; // celest int speed,adelay,amotion,dmotion; int mexp,mexpper; struct { int nameid,p; } dropitem[10]; //8 -> 10 Lupus diff --git a/src/map/pc.c b/src/map/pc.c index 2bb6ddf5d..cd2d9bb64 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -809,9 +809,9 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars // Automated script events if (script_config.event_requires_trigger) { - sd->state.event_death = pc_readglobalreg(sd,"PCDieEvent"); - sd->state.event_kill = pc_readglobalreg(sd,"PCKillEvent"); - sd->state.event_disconnect = pc_readglobalreg(sd,"PCLogoffEvent"); + sd->state.event_death = pc_readglobalreg(sd, script_config.die_event_name); + sd->state.event_kill = pc_readglobalreg(sd, script_config.kill_event_name); + sd->state.event_disconnect = pc_readglobalreg(sd, script_config.logout_event_name); // if script triggers are not required } else { sd->state.event_death = 1; @@ -1839,6 +1839,14 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->hp_loss_rate = val; } break; + case SP_ADDRACE2: + if (type2 > 0 && type2 < MAX_MOB_RACE_DB) + break; + if(sd->state.lr_flag != 2) + sd->addrace2[type2] += val; + else + sd->addrace2_[type2] += val; + break; default: if(battle_config.error_log) @@ -5560,11 +5568,11 @@ int pc_setglobalreg(struct map_session_data *sd,char *reg,int val) if(strcmp(reg,"PC_DIE_COUNTER") == 0 && sd->die_counter != val){ sd->die_counter = val; status_calc_pc(sd,0); - } else if(strcmp(reg,"PCDieEvent") == 0){ + } else if(strcmp(reg,script_config.die_event_name) == 0){ sd->state.event_death = val; - } else if(strcmp(reg,"PCKillEvent") == 0){ + } else if(strcmp(reg,script_config.kill_event_name) == 0){ sd->state.event_kill = val; - } else if(strcmp(reg,"PCLogoutEvent") == 0){ + } else if(strcmp(reg,script_config.logout_event_name) == 0){ sd->state.event_disconnect = val; } diff --git a/src/map/status.c b/src/map/status.c index 6c2300dca..74a7bd320 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -510,6 +510,8 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->sp_gain_value = 0; sd->ignore_def_mob = sd->ignore_def_mob_ = 0; sd->hp_loss_rate = sd->hp_loss_value = sd->hp_loss_type = 0; + memset(sd->addrace2,0,sizeof(sd->addrace2)); + memset(sd->addrace2_,0,sizeof(sd->addrace2_)); if(!sd->disguiseflag && sd->disguise) { sd->disguise=0; @@ -2812,6 +2814,16 @@ int status_get_mexp(struct block_list *bl) else return 0; } +int status_get_race2(struct block_list *bl) +{ + nullpo_retr(0, bl); + if(bl->type == BL_MOB && (struct mob_data *)bl) + return mob_db[((struct mob_data *)bl)->class_].race2; + else if(bl->type==BL_PET && (struct pet_data *)bl) + return mob_db[((struct pet_data *)bl)->class_].race2; + else + return 0; +} // StatusChange系の所得 struct status_change *status_get_sc_data(struct block_list *bl) diff --git a/src/map/status.h b/src/map/status.h index dbb4ec21c..9bda514b7 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -240,6 +240,7 @@ int status_get_race(struct block_list *bl); int status_get_size(struct block_list *bl); int status_get_mode(struct block_list *bl); int status_get_mexp(struct block_list *bl); +int status_get_race2(struct block_list *bl); struct status_change *status_get_sc_data(struct block_list *bl); short *status_get_sc_count(struct block_list *bl); -- cgit v1.2.3-70-g09d2 From 48f8a39dbac7dd47104933a5c7cab30412987ecc Mon Sep 17 00:00:00 2001 From: celest Date: Sat, 19 Feb 2005 08:04:33 +0000 Subject: * Added bSubSize, bHPGainValue, and bDamageWhenUnequip * Updated bSPDrainValue/Rate * Set baby class players' size to 0(small) * Fixed item_db2.txt reading printing wrong number of entries read * Fixed @allskill not giving the newer stalker, whitesmith and creator skills git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1139 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 8 ++++++++ conf-tmpl/battle_athena.conf | 3 ++- db/const.txt | 3 +++ doc/item_bonus.txt | 16 ++++++++++++++- src/map/battle.c | 18 ++++++++++++---- src/map/itemdb.c | 1 + src/map/map.h | 8 ++++++-- src/map/mob.c | 9 +++++++- src/map/pc.c | 49 ++++++++++++++++++++++++++++++++++++++++++-- src/map/skill.c | 5 ++++- src/map/skill.h | 3 ++- src/map/status.c | 14 ++++++++++--- 12 files changed, 121 insertions(+), 16 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 3b227cee5..08755e4a8 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,5 +1,13 @@ Date Added +02/19 + * Added bSubSize, bHPGainValue, and bDamageWhenUnequip [celest] + * Updated bSPDrainValue/Rate to accept a 'type' [celest] + * Set baby class players' size to 0(small) [celest] + * Fixed item_db2.txt reading printing wrong number of entries read [celest] + * Fixed @allskill not giving the newer stalker, whitesmith and creator skills + [celest] + 02/18 * Fixed a bug with statpoint.txt reading and giving too much stat points, thanks to Benz / eAthenaC [celest] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 34e047990..a6615b9e2 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -258,7 +258,8 @@ gm_skill_unconditional: no // Can a normal player by-pass the skill tree? (Note 1) player_skillfree: no -// When doing a skill reset, whether the skill's restriction is to be ignored or not. (Note 1) +// When set to yes, forces skill points gained from 1st class to be put into 1st class +// sklls, and forces novice skill points to be put into the basic skill. (Note 1) player_skillup_limit: no // Forging success rate. (Note 2) diff --git a/db/const.txt b/db/const.txt index 5e3976c86..b902d4350 100644 --- a/db/const.txt +++ b/db/const.txt @@ -246,6 +246,9 @@ bSPGainValue 2021 bIgnoreDefMob 2022 bHPLossRate 2023 bAddRace2 2024 +bHPGainValue 2025 +bSubSize 2026 +bDamageWhenUnequip 2027 Eff_Stone 0 diff --git a/doc/item_bonus.txt b/doc/item_bonus.txt index 3403bc3c5..96a2ebe5f 100644 --- a/doc/item_bonus.txt +++ b/doc/item_bonus.txt @@ -1,4 +1,4 @@ -//eAthena Items Scripting Manual +サソ//eAthena Items Scripting Manual skill n,x; skill n of level x @@ -150,9 +150,12 @@ bonus bNoRegen,n; Stops regeneration for n. bonus bUnstripable,n; Armor cannot be taken off via Strip skills bonus bSPGainValue,n; When killing a monster by physical attack gain n amount of sp +bonus bHPGainValue,n; When killing a monster by physical attack + gain n amount of hp bonus bIgnoreDefMob,n; Ignore monster's DEF when attacking. n:0=All normal monsters, except Bosses 1=All monsters +bonus bDamageWhenUnequip,n; Lose n HP when the item is unequipped bonus2 bCriticalAddRace,n,x; Increase critical + n vs. enemies of type x bonus2 bHPLossRate,n,x; Lose n amount of hp every x amount of time @@ -163,11 +166,22 @@ bonus2 bAddDamageByClass,n,x; When being hit by monster of class n increase damage taken by x% bonus2 bAddRace2,n,x; Increase damage by x% vs. enemies of race n (Check db/mob_race2_db.txt) +bonus2 bSubSize,n,x; Damage x% reduction from n size + n:0=Small 1=Medium 2=Large bonus3 bHPLossRate,n,x,y; Lose n amount of hp every x amount of time y:0=Don't show damage 1=Show damage bonus3 bAutoSpellWhenHit,x,y,n; n% chance to cast skill x of level y when being hit by physical close range damage +bonus3 bSPDrainRate,n,x,y; When attacking there is a n% chance to either + gain SP equivalent to x% of damage dealt, OR + drain the amount of sp from the enemy. + y:0=gain sp 1:drain enemy sp +bonus3 bSPDrainValue,n,x,y; When attacking there is a n% chance to either + gain x SP, OR drain the amount of sp from the + enemy. y:0=gain sp 1:drain enemy sp + (Note: setting x to -1 or below will reduce + YOUR sp) bonus4 bAutoSpellWhenHit,x,y,n,i; n% chance to cast skill x of level y when being hit by physical close range damage diff --git a/src/map/battle.c b/src/map/battle.c index 6b46a357e..707362f7f 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1058,7 +1058,7 @@ static struct Damage battle_calc_mob_weapon_attack( struct Damage wd; int damage,damage2=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv); int flag,skill,ac_flag = 0,dmg_lv = 0; - int t_mode=0,t_race=0,t_size=1,s_race=0,s_ele=0; + int t_mode=0,t_race=0,t_size=1,s_race=0,s_ele=0,s_size=0; struct status_change *sc_data,*t_sc_data; short *sc_count; short *option, *opt1, *opt2; @@ -1074,6 +1074,7 @@ static struct Damage battle_calc_mob_weapon_attack( s_race = status_get_race(src); s_ele = status_get_attack_element(src); + s_size = status_get_size(src); sc_data = status_get_sc_data(src); sc_count = status_get_sc_count(src); option = status_get_option(src); @@ -1498,6 +1499,7 @@ static struct Damage battle_calc_mob_weapon_attack( int cardfix=100,i; cardfix=cardfix*(100-tsd->subele[s_ele])/100; // 属 性によるダメージ耐性 cardfix=cardfix*(100-tsd->subrace[s_race])/100; // 種族によるダメージ耐性 + cardfix=cardfix*(100-tsd->subsize[s_size])/100; if(mob_db[md->class_].mode & 0x20) cardfix=cardfix*(100-tsd->subrace[10])/100; else @@ -1616,7 +1618,7 @@ static struct Damage battle_calc_pc_weapon_attack( struct Damage wd; int damage,damage2,damage3=0,damage4=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv); int flag,skill,dmg_lv = 0; - int t_mode=0,t_race=0,t_size=1,s_race=7,s_ele=0; + int t_mode=0,t_race=0,t_size=1,s_race=7,s_ele=0,s_size=1; int t_race2=0; struct status_change *sc_data,*t_sc_data; short *sc_count; @@ -1640,6 +1642,7 @@ static struct Damage battle_calc_pc_weapon_attack( s_race=status_get_race(src); //種族 s_ele=status_get_attack_element(src); //属性 s_ele_=status_get_attack_element2(src); //左手属性 + s_size=status_get_size(src); sc_data=status_get_sc_data(src); //ステータス異常 sc_count=status_get_sc_count(src); //ステータス異常の数 option=status_get_option(src); //鷹とかペコとかカートとか @@ -2602,6 +2605,7 @@ static struct Damage battle_calc_pc_weapon_attack( cardfix=100; cardfix=cardfix*(100-tsd->subrace[s_race])/100; // 種族によるダメージ耐性 cardfix=cardfix*(100-tsd->subele[s_ele])/100; // 属性によるダメージ耐性 + cardfix=cardfix*(100-tsd->subsize[s_size])/100; if(status_get_mode(src) & 0x20) cardfix=cardfix*(100-tsd->subrace[10])/100; //ボスからの攻撃はダメージ減少 else @@ -2904,7 +2908,7 @@ struct Damage battle_calc_magic_attack( int aflag; int normalmagic_flag=1; int matk_flag = 1; - int ele=0,race=7,t_ele=0,t_race=7,t_mode = 0,cardfix,t_class,i; + int ele=0,race=7,size=1,t_ele=0,t_race=7,t_mode = 0,cardfix,t_class,i; struct map_session_data *sd=NULL,*tsd=NULL; struct mob_data *tmd = NULL; @@ -2925,6 +2929,7 @@ struct Damage battle_calc_magic_attack( matk2=status_get_matk2(bl); ele = skill_get_pl(skill_num); race = status_get_race(bl); + size = status_get_size(bl); t_ele = status_get_elem_type(target); t_race = status_get_race(target); t_mode = status_get_mode(target); @@ -3131,6 +3136,7 @@ struct Damage battle_calc_magic_attack( cardfix=100; cardfix=cardfix*(100-tsd->subele[ele])/100; // 属 性によるダメージ耐性 cardfix=cardfix*(100-tsd->subrace[race])/100; // 種族によるダメージ耐性 + cardfix=cardfix*(100-tsd->subsize[size])/100; cardfix=cardfix*(100-tsd->magic_subrace[race])/100; if(status_get_mode(bl) & 0x20) cardfix=cardfix*(100-tsd->magic_subrace[10])/100; @@ -3207,7 +3213,7 @@ struct Damage battle_calc_misc_attack( int int_=status_get_int(bl); // int luk=status_get_luk(bl); int dex=status_get_dex(bl); - int skill,ele,race,cardfix; + int skill,ele,race,size,cardfix; struct map_session_data *sd=NULL,*tsd=NULL; int damage=0,div_=1,blewcount=skill_get_blewcount(skill_num,skill_lv); struct Damage md; @@ -3311,6 +3317,7 @@ struct Damage battle_calc_misc_attack( ele = skill_get_pl(skill_num); race = status_get_race(bl); + size = status_get_size(bl); if(damagefix){ if(damage<1 && skill_num != NPC_DARKBREATH) @@ -3320,6 +3327,7 @@ struct Damage battle_calc_misc_attack( cardfix=100; cardfix=cardfix*(100-tsd->subele[ele])/100; // 属性によるダメージ耐性 cardfix=cardfix*(100-tsd->subrace[race])/100; // 種族によるダメージ耐性 + cardfix=cardfix*(100-tsd->subsize[size])/100; cardfix=cardfix*(100-tsd->misc_def_rate)/100; damage=damage*cardfix/100; } @@ -3605,6 +3613,8 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, } if (hp || sp) pc_heal(sd, hp, sp); + if (sd->sp_drain_type && target->type == BL_PC) + battle_heal(NULL,target,0,-sp,0); } } if (target->type == BL_PC) { diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 5e19b1aca..41e2e2a75 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -381,6 +381,7 @@ static int itemdb_readdb(void) fclose(fp); sprintf(tmp_output,"Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n",ln,filename[i]); ShowStatus(tmp_output); + ln=0; // reset to 0 } return 0; } diff --git a/src/map/map.h b/src/map/map.h index b8fe82539..99bceb884 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -285,11 +285,14 @@ struct map_session_data { unsigned short unstripable_equip; short add_damage_classid2[10],add_damage_class_count2; int add_damage_classrate2[10]; - short sp_gain_value; + short sp_gain_value, hp_gain_value; + short sp_drain_type; short ignore_def_mob, ignore_def_mob_; int hp_loss_tick, hp_loss_rate; short hp_loss_value, hp_loss_type; int addrace2[6],addrace2_[6]; + int subsize[3]; + short unequip_damage; short spiritball, spiritball_old; int spirit_timer[MAX_SKILL_LEVEL]; @@ -631,7 +634,8 @@ enum { SP_CRIT_ATK_RATE, SP_CRITICAL_ADDRACE, SP_NO_REGEN, SP_ADDEFF_WHENHIT, SP_AUTOSPELL_WHENHIT, // 2013-2017 SP_SKILL_ATK, SP_UNSTRIPABLE, SP_ADD_DAMAGE_BY_CLASS, // 2018-2020 - SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2 // 2021-2023 + SP_SP_GAIN_VALUE, SP_IGNORE_DEF_MOB, SP_HP_LOSS_RATE, SP_ADDRACE2, SP_HP_GAIN_VALUE, // 2021-2025 + SP_SUBSIZE, SP_DAMAGE_WHEN_UNEQUIP // 2026 }; enum { diff --git a/src/map/mob.c b/src/map/mob.c index 14a9b564b..6b2e4e37a 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2384,18 +2384,25 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(sd) { - int sp = 0; + int sp = 0, hp = 0; if (sd->state.attack_type == BF_MAGIC && (i=pc_checkskill(sd,HW_SOULDRAIN))>0){ /* ソウルドレイン */ clif_skill_nodamage(src,&md->bl,HW_SOULDRAIN,i,1); sp += (status_get_lv(&md->bl))*(65+15*i)/100; } sp += sd->sp_gain_value; + hp += sd->hp_gain_value; if (sp > 0) { if(sd->status.sp + sp > sd->status.max_sp) sp = sd->status.max_sp - sd->status.sp; sd->status.sp += sp; clif_heal(sd->fd,SP_SP,sp); } + if (hp > 0) { + if(sd->status.hp + hp > sd->status.max_hp) + hp = sd->status.max_hp - sd->status.hp; + sd->status.hp += hp; + clif_heal(sd->fd,SP_HP,hp); + } } // map外に消えた人は計算から除くので diff --git a/src/map/pc.c b/src/map/pc.c index eac66bb97..4b2131f57 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -980,6 +980,8 @@ int pc_calc_skilltree(struct map_session_data *sd) if(battle_config.enable_upper_class){ //confで無?でなければ?み?む for(i=355;i<411;i++) sd->status.skill[i].id=i; + for(i=475;i<480;i++) + sd->status.skill[i].id=i; } }else{ do { @@ -1585,6 +1587,14 @@ int pc_bonus(struct map_session_data *sd,int type,int val) else if(sd->state.lr_flag == 1) sd->ignore_def_mob_ |= 1<state.lr_flag) + sd->hp_gain_value += val; + break; + case SP_DAMAGE_WHEN_UNEQUIP: + if(!sd->state.lr_flag) + sd->unequip_damage += val; + break; default: if(battle_config.error_log) printf("pc_bonus: unknown type %d %d !\n",type,val); @@ -1764,8 +1774,9 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) } else if(sd->state.lr_flag == 1) { sd->sp_drain_rate_ += type2; - sd->sp_drain_per_ += val; + sd->sp_drain_per_ += val; } + sd->sp_drain_type = 0; break; case SP_SP_DRAIN_VALUE: if(!sd->state.lr_flag) { @@ -1776,7 +1787,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->sp_drain_rate_ += type2; sd->sp_drain_value_ += val; } - + sd->sp_drain_type = 0; break; case SP_WEAPON_COMA_ELE: if(sd->state.lr_flag != 2) @@ -1847,6 +1858,10 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) else sd->addrace2_[type2] += val; break; + case SP_SUBSIZE: + if(sd->state.lr_flag != 2) + sd->subsize[type2]+=val; + break; default: if(battle_config.error_log) @@ -1900,6 +1915,27 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) sd->hp_loss_type = val; } break; + case SP_SP_DRAIN_RATE: + if(!sd->state.lr_flag) { + sd->sp_drain_rate += type2; + sd->sp_drain_per += type3; + } + else if(sd->state.lr_flag == 1) { + sd->sp_drain_rate_ += type2; + sd->sp_drain_per_ += type3; + } + sd->sp_drain_type = val; + break; + case SP_SP_DRAIN_VALUE: + if(!sd->state.lr_flag) { + sd->sp_drain_rate += type2; + sd->sp_drain_value += type3; + } + else if(sd->state.lr_flag == 1) { + sd->sp_drain_rate_ += type2; + sd->sp_drain_value_ += type3; + } + sd->sp_drain_type = val; default: if(battle_config.error_log) printf("pc_bonus3: unknown type %d %d %d %d!\n",type,type2,type3,val); @@ -4306,6 +4342,8 @@ int pc_allskillup(struct map_session_data *sd) if(battle_config.enable_upper_class){ //confで無?でなければ?み?む for(i=355;i<411;i++) sd->status.skill[i].id=i; + for(i=475;i<480;i++) + sd->status.skill[i].id=i; } } else { @@ -6067,6 +6105,13 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) } else { clif_unequipitemack(sd,n,0,0); } + if (sd->unequip_damage > 0) { + short dmg = sd->unequip_damage; + if (dmg > sd->status.hp) + dmg = sd->status.hp; + pc_heal(sd,-dmg,0); + } + if(flag&1) { status_calc_pc(sd,0); if(sd->sc_count && sd->sc_data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele)) diff --git a/src/map/skill.c b/src/map/skill.c index 4bdf4ae2a..03704839f 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1588,7 +1588,10 @@ int skill_attack( int attack_type, struct block_list* src, struct block_list *ds if(sd->sp_drain_rate_ > 0 && sp < 1) sp = 1; else if(sd->sp_drain_rate_ < 0 && sp > -1) sp = -1; } - if(hp || sp) pc_heal(sd,hp,sp); + if(hp || sp) + pc_heal(sd,hp,sp); + if (sd->sp_drain_type && bl->type == BL_PC) + battle_heal(NULL,bl,0,-sp,0); } if((skillid || flag) && rdamage > 0) diff --git a/src/map/skill.h b/src/map/skill.h index c06ab270f..dc789aa4a 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -611,7 +611,8 @@ enum { WE_BABY, WE_CALLPARENT, WE_CALLBABY, - TK_RUN, + + TK_RUN = 411, TK_READYSTORM, TK_STORMKICK, TK_READYDOWN, diff --git a/src/map/status.c b/src/map/status.c index 74a7bd320..05c6c8baa 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -512,6 +512,9 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->hp_loss_rate = sd->hp_loss_value = sd->hp_loss_type = 0; memset(sd->addrace2,0,sizeof(sd->addrace2)); memset(sd->addrace2_,0,sizeof(sd->addrace2_)); + sd->hp_gain_value = sd->sp_drain_type = 0; + memset(sd->subsize,0,sizeof(sd->subsize)); + sd->unequip_damage = 0; if(!sd->disguiseflag && sd->disguise) { sd->disguise=0; @@ -2786,11 +2789,16 @@ int status_get_size(struct block_list *bl) nullpo_retr(1, bl); if(bl->type==BL_MOB && (struct mob_data *)bl) return mob_db[((struct mob_data *)bl)->class_].size; - else if(bl->type==BL_PC && (struct map_session_data *)bl) - return 1; else if(bl->type==BL_PET && (struct pet_data *)bl) return mob_db[((struct pet_data *)bl)->class_].size; - else + else if(bl->type==BL_PC) { + struct map_session_data *sd = (struct map_session_data *)bl; + //if (pc_isriding(sd)) // fact or rumour? + // return 2; + if (pc_calc_upper(sd->status.class_) == 2) + return 0; + return 1; + } else return 1; } int status_get_mode(struct block_list *bl) -- cgit v1.2.3-70-g09d2 From ad81f62be42d1f1e6ef14266d442603a68714c94 Mon Sep 17 00:00:00 2001 From: Lupus Date: Wed, 23 Feb 2005 22:49:21 +0000 Subject: mob db exp reading fix mobs item drops rate fix mob spawn once shows normal log git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1170 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 6 ++ conf-tmpl/battle_athena.conf | 35 ++--------- src/map/battle.c | 28 +-------- src/map/battle.h | 3 - src/map/mob.c | 141 +++++++++++++++++++------------------------ src/map/pc.c | 8 +-- 6 files changed, 75 insertions(+), 146 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index f6c0c52b6..8ca6cf7da 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,5 +1,11 @@ Date Added +02/24 + * Fixed Steal Item Rate. It has been multiplied twice on common_item_drop value for any kinds of items. [Lupus] + e.g. If you set droprate of comman items to 500%, then even rare items could be stolen more easily. Thanks to Freya + * Items Droprate fix. Now it adjusts correctly, w/o overflows. Thanks to Freya [Lupus] + * mob DBbs EXP reading fix. w/o overflows. Thanks to Freya [Lupus] + 02/23 * Added bAddItemHealRate [celest] * Fixed a crash if adding an offline player to a party, thanks to Alex14 diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index a6615b9e2..f2c76990d 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -149,37 +149,6 @@ item_drop_card_max: 10000 item_drop_mvp_min: 1 item_drop_mvp_max: 10000 -//For fine tuning drop rates for all items -//details = 0: Don't change anything (Default) -// 1: Change drop ratios depending on current rates -// 2: Change drop ratios depending on current rates, but not exceeding minimum -// and maximum values -// Example: details=3 rate_1=1000 min=20 If an item's drops is between 1/10000 - -// 9/10000 it will become at least 1x1000%=10, which is still below 20, -// so it'll be increase to 20/10000 -// -item_rate_details: 0 -// -//Drop rates 1-9 -item_rate_1: 100 -item_rate_1_min: 1 -item_rate_1_max: 9 -// -//Drop rates 10-99 -item_rate_10: 100 -item_rate_10_min: 10 -item_rate_10_max: 99 -// -//Drop rates 100-999 -item_rate_100: 100 -item_rate_100_min: 100 -item_rate_100_max: 999 -// -//Drop rates 1000 and above -item_rate_1000: 100 -item_rate_1000_min: 1000 -item_rate_1000_max: 10000 - // Can the monster's drop rate become 0? (Note 1) drop_rate0item: yes @@ -532,6 +501,10 @@ monster_skill_nofootset: yes // When a player is cloaking, Whether the wall is checked or not. (Note 1) // Note: When set to no players can always cloak away from walls and move around // freely even if the skill level is below 3. +// no or 0 = doesn't check for walls (you can cloacking without walls) +// 1 = it checks for walls +// 2 = it doesn't checks for walls + your cloaking lasts forever +// 3 = it checks for walls, but your cloaking lasts forever player_cloak_check_type: yes // When a monster is cloaking, Whether the wall is checked or not. (Note 1) diff --git a/src/map/battle.c b/src/map/battle.c index 605fd30e0..f58151f3d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4122,19 +4122,6 @@ static const struct { { "gm_can_drop_lv", &battle_config.gm_can_drop_lv }, { "disp_hpmeter", &battle_config.disp_hpmeter }, { "bone_drop", &battle_config.bone_drop }, - { "item_rate_details", &battle_config.item_rate_details }, - { "item_rate_1", &battle_config.item_rate_1 }, - { "item_rate_10", &battle_config.item_rate_10 }, - { "item_rate_100", &battle_config.item_rate_100 }, - { "item_rate_1000", &battle_config.item_rate_1000 }, - { "item_rate_1_min", &battle_config.item_rate_1_min }, - { "item_rate_1_max", &battle_config.item_rate_1_max }, - { "item_rate_10_min", &battle_config.item_rate_10_min }, - { "item_rate_10_max", &battle_config.item_rate_10_max }, - { "item_rate_100_min", &battle_config.item_rate_100_min }, - { "item_rate_100_max", &battle_config.item_rate_100_max }, - { "item_rate_1000_min", &battle_config.item_rate_1000_min }, - { "item_rate_1000_max", &battle_config.item_rate_1000_max }, { "item_rate_common", &battle_config.item_rate_common }, // Added by RoVeRT { "item_rate_equip", &battle_config.item_rate_equip }, { "item_rate_card", &battle_config.item_rate_card }, // End Addition @@ -4382,19 +4369,6 @@ void battle_set_defaults() { battle_config.gm_can_drop_lv = 0; battle_config.disp_hpmeter = 0; battle_config.bone_drop = 0; - battle_config.item_rate_details = 0; - battle_config.item_rate_1 = 100; - battle_config.item_rate_10 = 100; - battle_config.item_rate_100 = 100; - battle_config.item_rate_1000 = 100; - battle_config.item_rate_1_min = 1; - battle_config.item_rate_1_max = 9; - battle_config.item_rate_10_min = 10; - battle_config.item_rate_10_max = 99; - battle_config.item_rate_100_min = 100; - battle_config.item_rate_100_max = 999; - battle_config.item_rate_1000_min = 1000; - battle_config.item_rate_1000_max = 10000; battle_config.item_rate_common = 100; battle_config.item_rate_equip = 100; battle_config.item_rate_card = 100; @@ -4605,7 +4579,7 @@ int battle_config_read(const char *cfgName) fp = fopen(cfgName,"r"); if (fp == NULL) { - printf("file not found: %s\n", cfgName); + printf("File not found: %s\n", cfgName); return 1; } while(fgets(line,1020,fp)){ diff --git a/src/map/battle.h b/src/map/battle.h index 4a75dfe1e..95d809b3a 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -280,9 +280,6 @@ extern struct Battle_Config { int gm_can_drop_lv; int disp_hpmeter; int bone_drop; - int item_rate_details,item_rate_1,item_rate_10,item_rate_100,item_rate_1000; //ドロップレート詳細 - int item_rate_1_min,item_rate_10_min,item_rate_100_min,item_rate_1000_min; //ドロップレート詳細min - int item_rate_1_max,item_rate_10_max,item_rate_100_max,item_rate_1000_max; //ドロップレート詳細max int night_at_start; // added by [Yor] int day_duration; // added by [Yor] diff --git a/src/map/mob.c b/src/map/mob.c index 9b2f91da1..130852c97 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -152,11 +152,12 @@ int mob_once_spawn(struct map_session_data *sd,char *mapname, // if(battle_config.etc_log) // printf("mobclass=%d try=%d\n",class_,i); } + if(sd){ if(x<=0) x=sd->bl.x; if(y<=0) y=sd->bl.y; }else if(x<=0 || y<=0){ - printf("mob_once_spawn: ??\n"); + printf("mob_once_spawn: %i at %s x:%i y:%i\n ??\n",class_,map[m].name,x,y); //got idea from Freya [Lupus] } for(count=0;count battle_config.item_drop_mvp_max) + else if(drop_rate > battle_config.item_drop_mvp_max) //fixed drop_rate = battle_config.item_drop_mvp_max; if(drop_rate <= rand()%10000) continue; @@ -3891,23 +3892,29 @@ static int mob_readdb(void) mob_db[class_].max_hp=atoi(str[4]); mob_db[class_].max_sp=atoi(str[5]); - mob_db[class_].base_exp=atoi(str[6]); - if(mob_db[class_].base_exp < 0) + mob_db[class_].base_exp = atoi(str[6]); + if (mob_db[class_].base_exp <= 0) mob_db[class_].base_exp = 0; - else if(mob_db[class_].base_exp > 0 && (mob_db[class_].base_exp*battle_config.base_exp_rate/100 > 1000000000 || - mob_db[class_].base_exp*battle_config.base_exp_rate/100 < 0)) - mob_db[class_].base_exp=1000000000; - else - mob_db[class_].base_exp*= battle_config.base_exp_rate/100; + else if (mob_db[class_].base_exp * battle_config.base_exp_rate / 100 > 1000000000 || + mob_db[class_].base_exp * battle_config.base_exp_rate / 100 < 0) + mob_db[class_].base_exp = 1000000000; + else { + mob_db[class_].base_exp = mob_db[class_].base_exp * battle_config.base_exp_rate / 100; + if (mob_db[class_].base_exp < 1) + mob_db[class_].base_exp = 1; + } - mob_db[class_].job_exp=atoi(str[7]); - if(mob_db[class_].job_exp < 0) + mob_db[class_].job_exp = atoi(str[7]); + if (mob_db[class_].job_exp <= 0) mob_db[class_].job_exp = 0; - else if(mob_db[class_].job_exp > 0 && (mob_db[class_].job_exp*battle_config.job_exp_rate/100 > 1000000000 || - mob_db[class_].job_exp*battle_config.job_exp_rate/100 < 0)) - mob_db[class_].job_exp=1000000000; - else - mob_db[class_].job_exp*=battle_config.job_exp_rate/100; + else if (mob_db[class_].job_exp * battle_config.job_exp_rate / 100 > 1000000000 || + mob_db[class_].job_exp * battle_config.job_exp_rate / 100 < 0) + mob_db[class_].job_exp = 1000000000; + else { + mob_db[class_].job_exp = mob_db[class_].job_exp * battle_config.job_exp_rate / 100; + if (mob_db[class_].job_exp < 1) + mob_db[class_].job_exp = 1; + } mob_db[class_].range=atoi(str[8]); mob_db[class_].atk1=atoi(str[9]); @@ -3935,73 +3942,32 @@ static int mob_readdb(void) int rate = 0,type,ratemin,ratemax; mob_db[class_].dropitem[i].nameid=atoi(str[29+i*2]); type = itemdb_type(mob_db[class_].dropitem[i].nameid); - if (type == 0) { // Added [Valaris] - rate = battle_config.item_rate_heal; + if (type == 0) { + rate = battle_config.item_rate_heal * atoi(str[30+i*2]) / 100; //fix by Yor ratemin = battle_config.item_drop_heal_min; ratemax = battle_config.item_drop_heal_max; } else if (type == 2) { - rate = battle_config.item_rate_use; + rate = battle_config.item_rate_use * atoi(str[30+i*2]) / 100; //fix by Yor ratemin = battle_config.item_drop_use_min; ratemax = battle_config.item_drop_use_max; // End } else if (type == 4 || type == 5 || type == 8) { // Changed to include Pet Equip - rate = battle_config.item_rate_equip; + rate = battle_config.item_rate_equip * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_equip_min; ratemax = battle_config.item_drop_equip_max; } else if (type == 6) { - rate = battle_config.item_rate_card; + rate = battle_config.item_rate_card * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_card_min; ratemax = battle_config.item_drop_card_max; } else { - rate = battle_config.item_rate_common; + rate = battle_config.item_rate_common * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_common_min; ratemax = battle_config.item_drop_common_max; } - if (battle_config.item_rate_details == 1) { //ドロップレート詳細項目が1の時 レート=x/100倍 - if (rate < 10) - rate = rate * battle_config.item_rate_1/100; - else if (rate >= 10 && rate < 100) - rate = rate * battle_config.item_rate_10/100; - else if (rate >= 100 && rate < 1000) - rate = rate * battle_config.item_rate_100/100; - else rate = rate * battle_config.item_rate_1000/100; - } - else if (battle_config.item_rate_details == 2) { //ドロップレート詳細項目が2の時 レート=x/100倍 min max 指定 - if (rate >= 1 && rate < 10) { - if (rate * battle_config.item_rate_1/100 < battle_config.item_rate_1_min) - rate = battle_config.item_rate_1_min; - else if (rate * battle_config.item_rate_1/100 > battle_config.item_rate_1_max) - rate = battle_config.item_rate_1_max; - else rate = rate * battle_config.item_rate_1/100; - } - else if (rate >= 10 && rate < 100) { - if (rate * battle_config.item_rate_10/100 < battle_config.item_rate_10_min) - rate = battle_config.item_rate_10_min; - else if (rate * battle_config.item_rate_10/100 > battle_config.item_rate_10_max) - rate = battle_config.item_rate_10_max; - else rate = rate * battle_config.item_rate_10/100; - } - else if (rate >= 100 && rate < 1000) { - if (rate * battle_config.item_rate_100/100 < battle_config.item_rate_100_min) - rate = battle_config.item_rate_100_min; - else if (rate * battle_config.item_rate_100/100 > battle_config.item_rate_100_max) - rate = battle_config.item_rate_100_max; - else rate = rate * battle_config.item_rate_100/100; - } - else if (rate >= 1000) { - if (rate * battle_config.item_rate_1000/100 < battle_config.item_rate_1000_min) - rate = battle_config.item_rate_1000_min; - else if (rate * battle_config.item_rate_1000/100 > battle_config.item_rate_1000_max) - rate = battle_config.item_rate_1000_max; - else rate = rate * battle_config.item_rate_1000/100; - } - } - rate = rate * atoi(str[30+i*2])/100; - rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate; - mob_db[class_].dropitem[i].p = rate; + mob_db[class_].dropitem[i].p = (rate < ratemin) ? ratemin : (rate > ratemax) ? ratemax: rate; } // MVP EXP Bonus, Chance: MEXP,ExpPer mob_db[class_].mexp=atoi(str[49])*battle_config.mvp_exp_rate/100; @@ -4421,14 +4387,30 @@ static int mob_read_sqldb(void) mob_db[class_].lv=atoi(str[3]); mob_db[class_].max_hp=atoi(str[4]); mob_db[class_].max_sp=atoi(str[5]); - mob_db[class_].base_exp=atoi(str[6])* - battle_config.base_exp_rate/100; - if(mob_db[class_].base_exp <= 0) - mob_db[class_].base_exp = 1; - mob_db[class_].job_exp=atoi(str[7])* - battle_config.job_exp_rate/100; - if(mob_db[class_].job_exp <= 0) - mob_db[class_].job_exp = 1; + + mob_db[class_].base_exp = atoi(str[6]); + if (mob_db[class_].base_exp <= 0) + mob_db[class_].base_exp = 0; + else if (mob_db[class_].base_exp * battle_config.base_exp_rate / 100 > 1000000000 || + mob_db[class_].base_exp * battle_config.base_exp_rate / 100 < 0) + mob_db[class_].base_exp = 1000000000; + else { + mob_db[class_].base_exp = mob_db[class_].base_exp * battle_config.base_exp_rate / 100; + if (mob_db[class_].base_exp < 1) + mob_db[class_].base_exp = 1; + } + mob_db[class_].job_exp = atoi(str[7]); + if (mob_db[class_].job_exp <= 0) + mob_db[class_].job_exp = 0; + else if (mob_db[class_].job_exp * battle_config.job_exp_rate / 100 > 1000000000 || + mob_db[class_].job_exp * battle_config.job_exp_rate / 100 < 0) + mob_db[class_].job_exp = 1000000000; + else { + mob_db[class_].job_exp = mob_db[class_].job_exp * battle_config.job_exp_rate / 100; + if (mob_db[class_].job_exp < 1) + mob_db[class_].job_exp = 1; + } + mob_db[class_].range=atoi(str[8]); mob_db[class_].atk1=atoi(str[9]); mob_db[class_].atk2=atoi(str[10]); @@ -4456,33 +4438,32 @@ static int mob_read_sqldb(void) mob_db[class_].dropitem[i].nameid=atoi(str[29+i*2]); type = itemdb_type(mob_db[class_].dropitem[i].nameid); if (type == 0) { // Added by Valaris - rate = battle_config.item_rate_heal; + rate = battle_config.item_rate_heal * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_heal_min; ratemax = battle_config.item_drop_heal_max; } else if (type == 2) { - rate = battle_config.item_rate_use; + rate = battle_config.item_rate_use * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_use_min; ratemax = battle_config.item_drop_use_max; // End } else if (type == 4 || type == 5 || type == 8) { // Changed to include Pet Equip - rate = battle_config.item_rate_equip; + rate = battle_config.item_rate_equip * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_equip_min; ratemax = battle_config.item_drop_equip_max; } else if (type == 6) { - rate = battle_config.item_rate_card; + rate = battle_config.item_rate_card * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_card_min; ratemax = battle_config.item_drop_card_max; } else { - rate = battle_config.item_rate_common; + rate = battle_config.item_rate_common * atoi(str[30+i*2]) / 100; ratemin = battle_config.item_drop_common_min; ratemax = battle_config.item_drop_common_max; } - rate = (rate / 100) * atoi(str[30+i*2]); - rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate; - mob_db[class_].dropitem[i].p = rate; + + mob_db[class_].dropitem[i].p = (rate < ratemin) ? ratemin : (rate > ratemax) ? ratemax: rate; } // MVP EXP Bonus, Chance: MEXP,ExpPer mob_db[class_].mexp=atoi(str[49])*battle_config.mvp_exp_rate/100; diff --git a/src/map/pc.c b/src/map/pc.c index 20f5d8854..3110726d2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2768,7 +2768,7 @@ int pc_show_steal(struct block_list *bl,va_list ap) int pc_steal_item(struct map_session_data *sd,struct block_list *bl) { if(sd != NULL && bl != NULL && bl->type == BL_MOB) { - int i,skill,rate,itemid,flag, count; + int i,skill,itemid,flag, count; struct mob_data *md; md=(struct mob_data *)bl; if(!md->state.steal_flag && mob_db[md->class_].mexp <= 0 && !(mob_db[md->class_].mode&0x20) && @@ -2789,10 +2789,8 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl) if(itemid > 0 && itemdb_type(itemid) != 6) { - rate = (mob_db[md->class_].dropitem[i].p / battle_config.item_rate_common * 100 * skill)/100; - rate += sd->add_steal_rate; - - if(rand()%10000 < rate) + //fixed rate. From Freya [Lupus] + if (rand() % 10000 < ((mob_db[md->class_].dropitem[i].p * skill) / 100 + sd->add_steal_rate)) { struct item tmp_item; memset(&tmp_item,0,sizeof(tmp_item)); -- cgit v1.2.3-70-g09d2 From 24ec5cc01a034fe378bc0e8dfb7426a2dbbf8563 Mon Sep 17 00:00:00 2001 From: celest Date: Mon, 7 Mar 2005 11:35:13 +0000 Subject: * Updated core and map-server to jA 1115~1137 * Fixed a typo in Volcano git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1206 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 18 ++ Readme-jap | 428 +++++++++++++++++++++++++++++++++++++++++++ conf-tmpl/battle_athena.conf | 11 +- conf-tmpl/script_athena.conf | 21 ++- db/skill_db.txt | 22 +-- src/common/core.c | 31 ++++ src/common/db.c | 106 +++++++++-- src/common/db.h | 12 +- src/map/atcommand.c | 43 +++++ src/map/atcommand.h | 1 + src/map/battle.c | 68 ++----- src/map/battle.h | 2 + src/map/chrif.c | 2 +- src/map/guild.c | 34 +++- src/map/guild.h | 1 + src/map/map.c | 162 +++++++++------- src/map/map.h | 8 +- src/map/mob.c | 17 +- src/map/npc.c | 6 + src/map/path.c | 23 ++- src/map/pc.c | 43 +++-- src/map/script.c | 8 +- src/map/skill.c | 201 ++++++++++---------- src/map/status.c | 94 ++++++---- 24 files changed, 1028 insertions(+), 334 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 1e5ffce25..a6c499e82 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,6 +1,24 @@ Date Added 03/07 + * Updated core and map-server to jA 1115~1137 [celest] + - Added monster_delay_damage to battle conf + - Increased some default settings in script conf + - Updated Brandish Spear, Soul Change, Soul Burn + - Updated Body Relocation (shorter distance) + - Added monster skill NPC_EXPLOSIONSPIRITS + - Corrected Mindbreaker level to 5 + - Updated Meteor Assault to instant-cast + - Removed some unused code for Breaker + - Temporarily set Emperium to be immune to Breaker + - Added command @users - shows the percentage of users in all maps + - Don't save status if the player is set for disconnection + - Added free block lock-checking system + - Added saving the processes' ID into [xx-server.pid] + - Fixed a memory leak with duplicate script labels + + For more detailed logs check 'Readme-jap' + + * Fixed a typo in Volcano, thanks to Ilpalazzo-sama [celest] * Fixed Apple of Idun reading the wrong skill level and giving too much HP [celest] diff --git a/Readme-jap b/Readme-jap index 9956e4bd0..3bc55cedd 100644 --- a/Readme-jap +++ b/Readme-jap @@ -1,3 +1,431 @@ +-------------------- +//1136 by by eigen + +・1135で消えていたbattle_athena.confの項目とデフォルト値を復活 +・conf_ref.txtにnext_exp_limitの説明を追加 + + (conf) + battle_athena.conf - 消えた項目とデフォルト値を復活 + (doc) + conf_ref.txt - next_exp_limitの説明を追加 + +-------------------- +//1135 by by Toshi^2 +・パッチ1125で修正された、経験値の上限設定を従来方式の制限無しも選べるように変更 + + (db) + battle_athena.conf - next_exp_limitを追加。 + (src/map) + battle.c - battle_config_read() 修正 + battle.h - struct Battle_Config{}に int next_exp_limit; を追加。 + pc.c - pc_gainexp() 修正 + +-------------------- +//1134 by End_of_exam + +・1132で#undef closeを忘れていたバグを修正(socket.c) +・1133のアイテムdupe対策が不完全だったのを修正(map.c) +・athena-start stop , kill の順番をmap -> char -> login に変更 +    (athena-start thanks to eigenさん) + + (/) + athena-start - athena-start stop , kill の順番修正 + + (src/common) + socket.c - #undef close 追加 + + (src/map) + map.c - map_quit() 修正 + +-------------------- +//1133 by End_of_exam + +・mapflag nosave が指定されたマップで死んでリスタートする時に、セーブポイントが + 別マップサーバーにあると、(nul,0,0)に飛ばされていたバグを修正(pc.c) +・マップサーバーを分配している時に、細工をした特殊なツールを使うことによって、 + アイテムがdupeできたバグを修正。(pc.c) +・buildin_menu, buildin_select() がバッファオーバーフローを起こしていた + バグを修正(script.c) + + (src/map) + pc.c - pc_makesavestatus(), pc_setpos(), pc_autosave_sub() 修正 + script.c - buildin_menu(), buildin_select() 修正 + +-------------------- +//1132 by End_of_exam +・@users コマンド(サーバー内の人数マップを表示)を追加(atcommand.c / h) +・guild_check_alliance() を呼び出すときのチェックを追加(mob.c battle.c) +・マップサーバー分配時にギルドのメンバーが抜けた時、そのギルドメンバーが + 一人もログインしていないマップサーバーが落ちていたのを修正(guild.c) +・1130で見切りの回避率上昇が消えていたのを戻す(status.c) +・pid 対応版のstart, athena-start を統合(start , athena_start) +・田代砲対策、Shinomoriさんの do_sendrecv() 高速化を組み込む + (socket.c socket.conf Makefile) +・socket の高速化 +  1. FIFOFLUSH が実行される頻度を下げる(socket.c char.c) +  2. 不正なfdを0 に変更(socket.c socket.h chrif.c char.c) + + (/) + start - pid ファイルに対応するように修正 + sthena-start - pid ファイルに対応するように修正 + Makefile - "-D_XOPEN_SOURCE -D_BSD_SOURCE" 追加 + + (conf/) + help.txt - @users 追加、@mes の修正 + socket.conf - アクセス制限の設定ファイル + + (src/common/) + socket.c - アクセス制限の追加、色々高速化 + socket.h - FIFO命令の高速化 + + (src/char/) + char.c - parse_tologin(), parse_char() 更新 + + (src/map/) + atcommand.c - @users 追加 + atcommand.h - @users 追加 + battle.c - battle_calc_damage() 修正 + chrif.c - 不正なfdを0 に変更したのに伴う修正 + guild.c - guild_member_leaved() 修正 + mob.c - mob_gvmobcheck() 修正 + status.c - status_calc_pc() 修正 + +-------------------- +//1131 by eigen +・ギルド拡張の人数増分を+2/Lvから+4/Lvに変更 +・メテオストームにスタンがかかるよう修正 +・ロードオブヴァーミリオンに暗闇がかかるよう修正 +・ヒルトバインディングを取っていればSTR+1 ATK+4が付くよう変更 +・ヒルトバインディングを取っていればAR・OT・WPがの効果時間が10%長くなるよう変更 +・AR・OTのパーティーメンバー効果時間減少を撤廃 +・フロストダイバーで凍結する際、凍結時間がMDEFに影響されるよう変更 +・skill_db.txt、skill_require_db.txt、skill_cast_db.txtをOWNや各職Wikiなどを参考に修正 + + (src/map) + skill.c + status.c + (db) + skill_db.txt + skill_cast_db.txt + skill_require_db.txt + +-------------------- +//1130 by eigen +・所持限界量増加の+100/Lvを+200/Lvに修正 +・シーフの上位職に於いて回避率増加のFlee上昇率+3/Lvを+4/Lvに修正 +・アサシン系が回避率増加を取得している場合、移動速度が+0.5%/Lvになるよう修正 +・プレッシャーのSP攻撃を実装 +・プリザーブ、フルストリップ、武器精錬、スリムピッチャー、フルケミカルチャージ +をdbに追加 + + (src/map) + skill.c - skill_additional_effect() 修正 + status.c - status_calc_pc() 修正 + (db) + skill_db.txt + skill_cast_db.txt + skill_require_db.txt + skill_tree.txt + +-------------------- +//1129 by En_of_exam + +・NPC イベントが重複した場合のメモリ解放手順が違っていたバグを修正 +  (npc.c thanks to TOSHI^2さん) + + (src/map) + npc.c - npc_parse_script() 修正 + +-------------------- +//1128 by 悩める人 +・アイテムを消費せずに使用するかのオプション追加 +・カード、装備品、エル・オリのドロップ率を別に設定出来るようにオプション追加 +・battle_athena.confの初期設定で矢・聖水等を作成時に名前を付けないように変更 + (本鯖ではまだ来てないと思ったので初期設定を変えました) + (src/map) + battle.c + mob.c + pc.c + battle.h + (conf) + battle_athena.conf + +-------------------- +//1127 by End_of_exam + +・getarraysize() が正しい値を返さないバグを修正(script.c) + このバグの影響で、deletearray() 命令の動作が正常なものと異なっていました。 + +・buildin_deletearray() の最適化(script.c) +・シグナル処理中に再度シグナルが呼ばれる可能性に対処する(core.c) +・委託販売を追加してみる(npc_test_seller.txt) + + (src/map) + script.c - getarraysize() , buildin_deletearray() 修正 + + (src/common) + core.c - sig_proc() 修正 + + (script/sample) + npc_test_seller.txt - 委託販売NPC + +-------------------- +//1126 by eigen +・メモライズの効果回数と詠唱短縮比率をそれぞれ5回、1/2に修正 + + (src/map) + skill.c - 1/3になっているのを1/2に修正 + status.c - 3回になっているのを5回に修正 + +-------------------- +//1125 by lizorett +・ブランディッシュスピアのノックバックを3セルにし、ミス時にはノックバックしない +よう変更 +・スピアスタブを対象から自分に向かって4マスの範囲攻撃に変更(本鯖仕様) +・鷹/投石をニュマで防げるよう変更 +・ボウリングバッシュが対象にミスした場合にはノックバックしないよう変更 +・ソウルブレイカーのダメージ計算、ニュマでミスになるよう変更 +・獲得経験値の上限(現レベルの必要経験値-1)を設定 +・バジリカ展開時に展開者はノックバックしないよう変更 +・メテオアサルトを即時発動、使用者中心、詠唱500ms固定、エフェクト有に変更 +・ストリップウェポン時のmobの攻撃力低下を10%に変更 +・掛けられているものより低レベルのブレスにより呪い/石化が解除できるよう変更 +・ソウルバーン/マインドブレーカー/ソウルチェンジ実装 +・シャープシューティングを射線にいる敵にもダメージを与えるよう変更、クリティカル +確率+20%で防御無視ダメージに変更 +・投石など一部のスキルが草などに1ダメージにならない問題を修正 + + (db) + skill_db.txt- BDS/メテオアサルト変更、スキル追加 + skill_cast_db.txt + - スキル追加 + skill_require_db.txt + - スキル追加 + (src/map) + battle.c - ソウルブレイカーのダメージ計算を変更 + - シャープシューティングのクリティカル確率修正 + - 鷹/投石をニュマで防げるよう変更 + skill.h - SC_MINDBREAKER追加 + skill.c - BDS/BBのノックバックを修正 + - スピアスタブを範囲攻撃に変更 + - メテオアサルト修正 + - ソウルバーン/マインドブレーカー/ソウルチェンジ実装 + path.c - シャープシューティングの射線計算を追加 + pc.c - 獲得経験値の上限(前のレベルの経験値-1)を設定 + status.c - マインドブレーカーのmatk上昇/mdef減少の実装 + map.h - シャープシューティングの射線計算用構造体を追加 + +-------------------- +//1124 by もっさり +敵が使う爆裂波動実装 +効果 +atk1,atk2 1000*skilllv加算 +hit 20*skilllv加算 + + (src/map) + skill.c + skill.h NPC_EXPLOSIONSPIRITS関係を追加 + status.c     + (db) + skill_db.txt + skill_cast_db.txt + + + +-------------------- +//1123 by Nameless +・Athenaサービス化キットを追加しました。(NT/2000/XP/2003/LH) + 詳しい方法はdoc内のinstasv.txtを参照してください + + (bin/tool) + instasv.bat - サービス登録用バッチ + delasv.bat - サービス抹消用バッチ + (doc/) + instasv.txt - 説明書(テキスト版) + +-------------------- +//1122 by End_of_exam + +・1120のstrdb のキーを保存し忘れていたバグ修正(db.c) +・念のため1121、1120のreadme をマージして、両方に含まれていたファイルを添付する + + (src/char) + char.c - 1121のものを添付 + + (src/common) + mmo.h - 1121のものを添付 + db.h - 1120のものを添付 + db.c - strdb のキーを保存するようにする + + (src/map) + battle.c - 1121のものを添付 + guild.c - 1121のものを添付 + guild.h - 1121のものを添付 + mob.c - 1121のものを添付 + skill.c - 1121のものを添付 + skill.h - 1121のものを添付 + +-------------------- +//1121 by _ + +・ロードナイト/パラディンのログイン時のエラー対策 +・Gvでの同盟の扱いを修正 + エンペリウム攻撃不可、ガーディアンから攻撃されないように修正 +・新追加スキル用の定数追加修正 + + (src/char) + char.c + 修正 mmo_char_send006b() + (src/common) + mmo.h + 修正 MAX_SKILL=500 + 追加 新ギルドスキル(コメントアウトしてます) + (src/map) + battle.c + 修正 battle_calc_damage() + guild.c + guild.h + 追加 guild_check_alliance() + mob.c + 修正 mob_gvmobcheck() + skill.c + 修正 SkillStatusChangeTable[] (420-490) + skill.h + 修正 MAX_SKILL_DB=500 + 追加 475以降の新スキルID + +-------------------- +//1120 by End_of_exam + +・db_foreach()の呼び出し先でdb_erase()が呼び出されているされている場合、 + 複数回同じキーで関数を呼び出す可能性があるバグを修正(db.h db.c) + + cygwin上で2重freeをした場合、プログラムが暴走する可能性があります。 + char鯖との接続が切れたmap 鯖が暴走するバグは、これに起因しています。 + + (src/common) + db.c - db_eraseを一時的にロックする機能追加 + db.h - db_eraseを一時的にロックする機能追加 + +-------------------- +//1119 by ICO + +・NPCスキル(ブレイクウェポン、ブレイクアーマー、ブレイクヘルム、ブレイクシールド)の実装 +・battle_athena.confにmonster_damage_delayを追加。 + noを指定するとFW等のノックバックスキルの挙動が多少本鯖に近づくかも…? + + (db) + skill_db.txt + skill_cast_db.txt + (conf/) + battle_athena.conf + monster_damage_delay 追加 + (map/) + battle.c + battle.h + mob.c + monster_damage_delay関連を追加 + skill.c + skill.h + skill_additional_effect,skill_castend_damage_id 修正 + +-------------------- +//1118 by BDPQ銀 [ 2005/02/10 ] +■データベースが変更されています。導入時には御注意ください■ +・スキルの固定詠唱時間を skill_cast_db.txt に移動。 + 詠唱時間の計算は、 (通常詠唱 + 固定詠唱)*メモライズ補正 となります。 + skill_cast_dbの書式は + [ID],[cast_list(通常詠唱)],[fixed_cast_list(固定詠唱)],[delay_list(ディレイ)],[upkeep_time(維持時間)],[upkeep_time2(維持時間2)] です。 +・アブラカタブラをディレイにASPDによるディレイを付加しないよう修正(即発動スキル用) +・新2次職のskill_cast_dbに関する項目の修正 + + (src/map) + skill.c - skill_use_id() 修正 (詠唱時間計算部 ・ メモライズ/魔法力増幅 固定詠唱時間部削除) + (アブラカタブラの修正) + skill_use_pos() 修正 (詠唱時間計算部) + skill_readdb() 修正 (cast_db 読込部) + skill.h - skill_db 修正 (fixedcastの追加) + skill_get_fixedcast() 追加 (dbから固定詠唱時間の取得) + + (db) + skill_cast_db.txt- fixed_cast_list 追加 (固定詠唱時間) + 魔法力増幅-700、メモライズ-5000に設定 + + 361(アスムプティオ) 修正 ( R.O.M 776を参考に詠唱/ディレイを修正 ) + 365(マジッククラッシャー)修正 ( R.O.M 776を参考に詠唱/ディレイを追加 ) + 373(ライフ置き換え) 修正 ( R.O.M 776を参考にディレイを修正 ) + 375(ソウルバーン) 追加 ( R.O.M 776を参考にディレイを追加 ) ( スキル効果は実装していません ) + 381(ファルコンアサルト) 修正 ( R.O.M 776を参考にディレイを修正 ) + 383(ウィンドウォーク) 修正 ( R.O.M 776を参考に詠唱/ディレイ/効果時間を修正 ) + 384(メルトダウン) 修正 ( R.O.M 776を参考に詠唱/ディレイを修正 ) + 387(カートブースト) 修正 ( R.O.M 776を参考に効果時間を修正 ) + 398(ヘッドクラッシュ) 修正 ( R.O.M 776を参考にディレイ持続時間を修正 ) + 406(メテオアサルト) 修正 ( R.O.M 776を参考に詠唱/ディレイを追加 ) + + (doc) + db_ref.txt - 1. db/skill_cast_db.txt 修正 (fixed_cast_listの項目を追加) + +-------------------- +//1117 by End_of_exam + +・ベナムスプラッシャーを毒状態の敵に使用したが、失敗した時(敵モンスターの + HPが2/3 以上だった時)に深刻なメモリリークが起きていたバグを修正(skill.c) +・あなたに逢いたいが失敗した時に深刻なメモリリークが起きていたバグを修正(skill.c) + + 上2つは、共にmap_freeblock_unlock() が抜けている為に発生していました。 + ドロップアイテム、スキルユニット、取り巻きなどで確保されたメモリが、 + 以降全く開放されなくなるというかなり深刻なメモリリークのバグです。 + map_freeblock_lock() を呼ぶルーチンを修正する場合、ルーチンを抜けるときに、 + map_freeblock_unlock() が呼ばれるように気を付けてください(return に注意!)。 + +・map_freeblock_unlock() を忘れても良いように、定期的にblock_free_lockを + クリアするように修正(map.c) +・Debian好き さんのMPVモンスターのHP計算がオーバーフローするバグ修正の取り込み(status.c) + + (src/map) + skill.c - skill_castend_nodamage_id() 修正 + map.c - map_freeblock_timer() 追加、 do_init() 修正 + status.c - status_get_max_hp() 修正 + +-------------------- +//1116 by End_of_exam + +・copyarray で同じ配列を指定した時、コピー先の要素番号がコピー元の要素番号より + 大きい時の動作が不定になっていたバグを修正(script.c npc_test_array.txt) +・関数宣言せずに関数定義したユーザー定義関数を呼び出そうとすると、エラーが出る + バグを修正(script.c) +・スクリプトのオーバーフロー判定基準を緩和させる(script.c) +・ギルドの告知に\nが使えるバグを修正(int_guild.c) +・イベントdbのメモリリーク修正が不完全だったのを修正(npc.c) +・db_foreachのチェック方法を変更(db.c) +・起動時に*.pid (プロセスIDのファイル)を作成するようにする(core.c) +・経験値所得が全体発言になっているバグを修正(clif.c) +・叫ぶを全体発言に変更(clif.c) +・testerさん作成のVC++ Toolkit2003 用のバッチファイルを同伴(vc07_make.bat) + + (/) + vc07_make.bat - testerさん作成のバッチファイルを同伴 + + (src/common) + db.c - db_foreach() 修正 + core.c - main() 修正 , pid_create() , pid_delete() 追加 + + (src/char) + int_guild.c - mapif_parse_GuildPosition() 修正 + + (src/map) + clif.c - clif_disp_onlyself() , clif_onlymessage() 修正 + npc.c - npc_parse_script() 修正 + script.c - buildin_copyarray() , parse_syntax() 修正 + + (script/sample) + npc_test_array.txt - チェック項目の追加 + +-------------------- +//1115 by いど + +・サーバースナップショット + -------------------- //1114-fix1 by 稀枝 diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index f2c76990d..ef0802342 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -240,6 +240,9 @@ potion_produce_rate: 100 // Allow monsters to be aggresive and attack first? (Note 1) monster_active_enable: yes +// If a monster is attacked, will they have a delay in being able to move? (Note 1) +monster_damage_delay: yes + // Monster damage delay rate (Note 1) monster_damage_delay_rate: 100 @@ -552,16 +555,16 @@ party_skill_penalty: yes monster_class_change_full_recover: no // Do produced items have the maker's name on them? (Note 1) -produce_item_name_input: yes +produce_item_name_input: no // Do produced potions have the maker's name on them? (Note 1) -produce_potion_name_input: yes +produce_potion_name_input: no // Do crafted arrows have the maker's name on them? (Note 1) -making_arrow_name_input: yes +making_arrow_name_input: no // Does created holy water have the maker's name on it? (Note 1) -holywater_name_input: yes +holywater_name_input: no // Stop logout for 10 seconds after a hit? (Note 1) prevent_logout: yes diff --git a/conf-tmpl/script_athena.conf b/conf-tmpl/script_athena.conf index bc8f1c907..3e420744b 100644 --- a/conf-tmpl/script_athena.conf +++ b/conf-tmpl/script_athena.conf @@ -1,3 +1,20 @@ +// ______ __ __ +// /\ _ \/\ \__/\ \ +// __\ \ \L\ \ \ ,_\ \ \___ __ ___ __ +// /'__`\ \ __ \ \ \/\ \ _ `\ /'__`\/' _ `\ /'__`\ +///\ __/\ \ \/\ \ \ \_\ \ \ \ \/\ __//\ \/\ \/\ \L\.\_ +//\ \____\\ \_\ \_\ \__\\ \_\ \_\ \____\ \_\ \_\ \__/.\_\ +// \/____/ \/_/\/_/\/__/ \/_/\/_/\/____/\/_/\/_/\/__/\/_/ +// _ _ _ _ _ _ _ _ _ _ _ _ _ +// / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ +//( e | n | g | l | i | s | h ) ( A | t | h | e | n | a ) +// \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ +// +//-------------------------------------------------------- +// eAthena Script Configuration File +//-------------------------------------------------------- + + // When choosing those which it refines setting the letter which is indicated. (Those for word use other than Japanese?) refine_posword: Head,Body,Left hand,Right hand,Robe,Shoes,Accessory 1,Accessory 2,Head 2,Head 3,Not Equipped @@ -9,9 +26,9 @@ warn_func_mismatch_paramnum: yes warn_cmd_mismatch_paramnum: yes -check_cmdcount: 8192 +check_cmdcount: 65536 -check_gotocount: 512 +check_gotocount: 2048 //---- Custom script functions ---- diff --git a/db/skill_db.txt b/db/skill_db.txt index c66c43a33..ac6acb17f 100644 --- a/db/skill_db.txt +++ b/db/skill_db.txt @@ -56,7 +56,7 @@ 54,8,6,16,6,1,4,1,yes,0,0,0,magic,0 //ALL_RESURRECTION#リザレクション# 55,0,0,0,0,0,10,0,no,0,0,0,weapon,0 //KN_SPEARMASTERY#槍修練# 56,-1,8,1,0,0,10,3,no,0,0,0,weapon,0 //KN_PIERCE#ピア?ス# -57,1,6,1,0,1,10,1,no,33,0,0,weapon,1 //KN_BRANDISHSPEAR#ブランディッシュスピア# +57,1,6,1,0,1,10,1,no,33,0,0,weapon,3 //KN_BRANDISHSPEAR#ブランディッシュスピア# 58,4,6,1,0,2,10,1,no,0,0,0,weapon,6 //KN_SPEARSTAB#スピアス?ブ# 59,-3:-5:-7:-9:-11,6,1,0,0,5,1,no,0,0,0,weapon,0 //KN_SPEARBOOMERANG#スピアブ?メラン# 60,0,6,4,0,1,10,1,no,0,0,0,weapon,0 //KN_TWOHANDQUICKEN#ツ?ハンドクイッケン# @@ -313,7 +313,7 @@ 261,0,6,4,0,1,5,1,no,0,0,0,weapon,0 //MO_CALLSPIRITS#気功# 262,6,6,16,0,1,1,1,no,0,0,0,weapon,0 //MO_ABSORBSPIRITS#気奪# 263,0,8,0,0,0,10,3,no,0,0,0,weapon,0 //MO_TRIPLEATTACK#三段掌# -264,50,6,2,0,1,1,1,no,0,0,0,none,0 //MO_BODYRELOCATION#残影# +264,14,6,2,0,1,1,1,no,0,0,0,none,0 //MO_BODYRELOCATION#残影# 265,0,0,0,0,0,10,0,no,0,0,0,weapon,0 //MO_DODGE#見切り# 266,8,6,1,0,0,5,1,no,0,0,0,weapon,0 //MO_INVESTIGATE#発勁# 267,10,8,1,0,0,5,1:2:3:4:5,no,0,0,0,weapon,0 //MO_FINGEROFFENSIVE#指弾# @@ -392,10 +392,10 @@ 340,8,8,1,7,0,10,1:1:2:2:3:3:4:4:5:5,yes,0,2,0,magic,0 //NPC_DARKSOULSTRIKE#闇ソウルストライク# 341,8,8,1,7,0,10,3:4:5:6:7:8:9:10:11:12,yes,0,2,0,magic,2:3:3:4:4:5:5:6:6:7 //NPC_DARKJUPITEL#闇ユピテル# -343,1,6,1,0,1,10,1,yes,0,2,0,weapon,0 //NPC_BREAKWEAPON -344,1,6,1,0,1,10,1,yes,0,2,0,weapon,0 //NPC_BREAKARMOR -345,1,6,1,0,1,10,1,yes,0,2,0,weapon,0 //NPC_BREAKHELM -346,1,6,1,0,1,10,1,yes,0,2,0,weapon,0 //NPC_BREAKSHIELD +343,8,6,1,0,0,5,1,no,0,2,0,weapon,0 //NPC_BREAKWEAPON#ブレイクウェポン# +344,8,6,1,0,0,5,1,no,0,2,0,weapon,0 //NPC_BREAKARMOR#ブレイクアーマー# +345,8,6,1,0,0,5,1,no,0,2,0,weapon,0 //NPC_BREAKHELM#ブレイクヘルム# +346,8,6,1,0,0,5,1,no,0,2,0,weapon,0 //NPC_BREAKSIELD#ブレイクシールド# 347,-1,6,1,9,0,10,1,no,0,2,0,weapon,0 //NPC_UNDEADATTACK //342束縛 @@ -405,7 +405,7 @@ //346盾壊し //347不死属性攻撃 //348攻撃系エフェクト(後退?) -//349赤爆裂 +349,0,6,4,0,1,5,0,no,0,0,0,weapon,0 //NPC_EXPLOSIONSPIRITS#NPC爆裂波動# //350速度増加エフェクト //351攻撃系スキルエフェクト //352攻撃系スキルエフェクト @@ -431,8 +431,8 @@ 371,-2,8,4,0,0,5,1,no,0,0,0,weapon,0 //CH_TIGERFIST#伏虎拳# 372,-2,8,4,0,0,10,1:1:2:2:3:3:4:4:5:5,no,0,0,0,weapon,0 //CH_CHAINCRUSH#連柱崩撃# 373,0,6,4,0,1,5,1,no,0,0,0,magic,0 //PF_HPCONVERSION#ライフ置き換え# -374,4,6,16,0,1,1,1,yes,0,0,0,magic,0 //PF_SOULCHANGE#?ウル?ェンジ# -375,4,6,1,0,0,5,1,yes,0,0,0,magic,0 //PF_SOULBURN#?ウルバ?ン# +374,8,6,16,0,1,1,1,yes,0,0,0,none,0 //PF_SOULCHANGE#?ウル?ェンジ# +375,8,6,1,0,0,5,1,yes,0,0,0,magic,0 //PF_SOULBURN#?ウルバ?ン# 376,0,0,0,0,1,5,1,no,0,0,0,weapon,0 //ASC_KATAR#アドバンスドカ??ル研究# 377,0,0,4,0,1,10,1,no,0,0,0,misc,0 //ASC_HALLUCINATION#ハルシネ?ションウォ?ク# 378,0,6,4,5,1,5,1,no,0,1024,0,weapon,0 //ASC_EDP#エン?ャントデッドリ??イズン# @@ -459,11 +459,11 @@ 399,4,6,1,0,0,10,1,no,0,0,0,weapon,0 //LK_JOINTBEAT#ジョイントビ?ト# 400,8,8,1,8,0,5,1:2:3:4:5,yes,0,0,0,magic,0 //HW_NAPALMVULCAN#ナパ??バルカン# 401,0,6,4,0,1,1,1,yes,0,0,0,weapon,0 //CH_SOULCOLLECT#狂気功# -402,8,6,1,0,1,10,1,no,0,0,0,none,0 //PF_MINDBREAKER#?インドブレ?カ?# +402,8,6,1,0,1,5,1,no,0,0,0,none,0 //PF_MINDBREAKER#?インドブレ?カ?# 403,0,0,4,0,1,1,1,yes,0,0,0,magic,0 //PF_MEMORIZE#メモライズ# 404,3,6,2,2,1,5,1,yes,0,256,1,magic,0 //PF_FOGWALL#フォグウォ?ル# 405,3,6,2,0,1,1,1,no,0,128,2,misc,0 //PF_SPIDERWEB#スパイ??ウェッブ# -406,-1,6,1,0,2,10,1,no,33,0,0,weapon,0 //ASC_METEORASSAULT#メテオアサルト# +406,0,6,4,0,1,10,1,no,33,0,0,weapon,0 //ASC_METEORASSAULT#メテオアサルト# 407,0,6,4,0,1,1,0,no,0,0,0,none,0 //ASC_CDP#デッドリ??イズン製造# 408,0,0,4,0,1,1,1,yes,0,0,0,magic,0 //WE_BABY## 409,0,0,4,0,1,1,1,yes,0,0,0,magic,0 //WE_CALLPARENT## diff --git a/src/common/core.c b/src/common/core.c index 016ade08d..a30445650 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -76,6 +76,11 @@ sigfunc *compat_signal(int signo, sigfunc *func) static void sig_proc(int sn) { int i; + static int is_called = 0; + + if(is_called++) + return; + switch(sn){ case SIGINT: case SIGTERM: @@ -196,11 +201,37 @@ static void display_title(void) */ int runflag = 1; +char pid_file[256]; + +void pid_delete(void) { + unlink(pid_file); +} + +void pid_create(const char* file) { + FILE *fp; + int len = strlen(file); + strcpy(pid_file,file); + if(len > 4 && pid_file[len - 4] == '.') { + pid_file[len - 4] = 0; + } + strcat(pid_file,".pid"); + fp = fopen(pid_file,"w"); + if(fp) { +#ifdef _WIN32 + fprintf(fp,"%d",GetCurrentProcessId()); +#else + fprintf(fp,"%d",getpid()); +#endif + fclose(fp); + atexit(pid_delete); + } +} int main(int argc,char **argv) { int next; + pid_create(argv[0]); Net_Init(); do_socket(); diff --git a/src/common/db.c b/src/common/db.c index 9f2c75a68..5eb73c785 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -354,6 +354,29 @@ static void db_rebalance_erase(struct dbn *z,struct dbn **root) } } +void db_free_lock(struct dbt *table) { + table->free_lock++; +} + +void db_free_unlock(struct dbt *table) { + if(--table->free_lock == 0) { + int i; + for(i = 0; i < table->free_count ; i++) { + db_rebalance_erase(table->free_list[i].z,table->free_list[i].root); + if(table->cmp == strdb_cmp) { + free(table->free_list[i].z->key); + } +#ifdef MALLOC_DBN + free_dbn(table->free_list[i].z); +#else + free(table->free_list[i].z); +#endif + table->item_count--; + } + table->free_count = 0; + } +} + struct dbn* db_insert(struct dbt *table,void* key,void* data) { struct dbn *p,*priv; @@ -363,10 +386,33 @@ struct dbn* db_insert(struct dbt *table,void* key,void* data) for(c=0,priv=NULL ,p = table->ht[hash];p;){ c=table->cmp(table,key,p->key); if(c==0){ // replace - if (table->release) - table->release(p, 3); + if (table->release) + table->release(p, 3); + if(p->deleted) { + // 削除されたデータなので、free_list 上の削除予定を消す + int i; + for(i = 0; i < table->free_count ; i++) { + if(table->free_list[i].z == p) { + memmove( + &table->free_list[i], + &table->free_list[i+1], + sizeof(struct db_free)*(table->free_count - i - 1) + ); + break; + } + } + if(i == table->free_count || table->free_count <= 0) { + printf("db_insert: cannnot find deleted db node.\n"); + } else { + table->free_count--; + if(table->cmp == strdb_cmp) { + free(p->key); + } + } + } p->data=data; p->key=key; + p->deleted = 0; return p; } priv=p; @@ -391,6 +437,7 @@ struct dbn* db_insert(struct dbt *table,void* key,void* data) p->key = key; p->data = data; p->color = RED; + p->deleted = 0; if(c==0){ // hash entry is empty table->ht[hash] = p; p->color = BLACK; @@ -429,25 +476,47 @@ void* db_erase(struct dbt *table,void* key) if(!p) return NULL; data=p->data; - db_rebalance_erase(p,&table->ht[hash]); -#ifdef MALLOC_DBN - free_dbn(p); -#else - aFree(p); -#endif - table->item_count--; + if(table->free_lock) { + if(table->free_count == table->free_max) { + table->free_max += 32; + table->free_list = (struct db_free*)realloc(table->free_list,sizeof(struct db_free) * table->free_max); + } + table->free_list[table->free_count].z = p; + table->free_list[table->free_count].root = &table->ht[hash]; + table->free_count++; + p->deleted = 1; + p->data = NULL; + if(table->cmp == strdb_cmp) { + if(table->maxlen) { + char *key = (char*)malloc(table->maxlen); + memcpy(key,p->key,table->maxlen); + p->key = key; + } else { + p->key = strdup((const char*)p->key); + } + } + } else { + db_rebalance_erase(p,&table->ht[hash]); + #ifdef MALLOC_DBN + free_dbn(p); + #else + aFree(p); + #endif + table->item_count--; + } return data; } void db_foreach(struct dbt *table,int (*func)(void*,void*,va_list),...) { int i,sp; - int count = 0; + int count = table->item_count; // red-black treeなので64個stackがあれば2^32個ノードまで大丈夫 struct dbn *p,*pn,*stack[64]; va_list ap; va_start(ap,func); + db_free_lock(table); for(i=0;iht[i])==NULL) continue; @@ -457,8 +526,9 @@ void db_foreach(struct dbt *table,int (*func)(void*,void*,va_list),...) //if (!p->data) { // printf("Warning: no data for key %d in db_foreach (db.c) !\n",(int)p->key); //} else { - func(p->key, p->data, ap); - count++; + if(!p->deleted) + func(p->key, p->data, ap); + count--; //} if((pn=p->left)!=NULL){ if(p->right){ @@ -476,10 +546,11 @@ void db_foreach(struct dbt *table,int (*func)(void*,void*,va_list),...) } } } - if(count != table->item_count) { + db_free_unlock(table); + if(count) { printf( - "db_foreach : data lost %d of %d item(s) allocated from %s line %d\n", - table->item_count - count,count,table->alloc_file,table->alloc_line + "db_foreach : data lost %d item(s) allocated from %s line %d\n", + count,table->alloc_file,table->alloc_line ); } va_end(ap); @@ -492,12 +563,13 @@ void db_final(struct dbt *table,int (*func)(void*,void*,va_list),...) va_list ap; va_start(ap,func); + db_free_lock(table); for(i=0;iht[i])==NULL) continue; sp=0; while(1){ - if(func) + if(func && !p->deleted) func(p->key,p->data,ap); if((pn=p->left)!=NULL){ if(p->right){ @@ -520,6 +592,8 @@ void db_final(struct dbt *table,int (*func)(void*,void*,va_list),...) p=pn; } } + db_free_unlock(table); + free(table->free_list); aFree(table); va_end(ap); } diff --git a/src/common/db.h b/src/common/db.h index c31f5bfaa..11ed4f3e1 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -13,6 +13,7 @@ struct dbn { int color; void *key; void *data; + int deleted; // 削除済みフラグ(db_foreach) }; struct dbt { @@ -24,7 +25,16 @@ struct dbt { struct dbn *ht[HASH_SIZE]; int item_count; // vf? const char* alloc_file; // DB?t@C - int alloc_line; // DB?s + int alloc_line; // DB?s + // db_foreach 内部でdb_erase される対策として、 + // db_foreach が終わるまでロックすることにする + struct db_free { + struct dbn *z; + struct dbn **root; + } *free_list; + int free_count; + int free_max; + int free_lock; }; #define strdb_search(t,k) db_search((t),(void*)(k)) diff --git a/src/map/atcommand.c b/src/map/atcommand.c index ded7d593d..9fea47dee 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -213,6 +213,7 @@ ACMD_FUNC(mobsearch); ACMD_FUNC(cleanmap); ACMD_FUNC(npctalk); ACMD_FUNC(pettalk); +ACMD_FUNC(users); ACMD_FUNC(autoloot); // by Upa-Kun #ifndef TXT_ONLY @@ -489,6 +490,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_CleanMap, "@cleanmap", 0, atcommand_cleanmap }, { AtCommand_NpcTalk, "@npctalk", 0, atcommand_npctalk }, { AtCommand_PetTalk, "@pettalk", 0, atcommand_pettalk }, + { AtCommand_Users, "@users", 0, atcommand_users }, { AtCommand_ResetState, "/reset", 40, NULL }, #ifndef TXT_ONLY // sql-only commands @@ -7838,6 +7840,47 @@ atcommand_pettalk( return 0; } +/*========================================== + * @users + * サーバー内の人数マップを表示させる + * 手抜きのため汚くなっているのは仕様です。 + *------------------------------------------ + */ + +static struct dbt *users_db; +static int users_all; + +static int atcommand_users_sub1(struct map_session_data* sd,va_list va) { + int users = (int)strdb_search(users_db,sd->mapname) + 1; + users_all++; + strdb_insert(users_db,sd->mapname,(void *)users); + return 0; +} + +static int atcommand_users_sub2(void* key,void* val,va_list va) { + char buf[256]; + struct map_session_data* sd = va_arg(va,struct map_session_data*); + sprintf(buf,"%s : %d (%d%%)",(char *)key,(int)val,(int)val * 100 / users_all); + clif_displaymessage(sd->fd,buf); + return 0; +} + +int +atcommand_users( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char buf[256]; + users_all = 0; + users_db = strdb_init(24); + clif_foreachclient(atcommand_users_sub1); + strdb_foreach(users_db,atcommand_users_sub2,sd); + sprintf(buf,"all : %d",users_all); + clif_displaymessage(fd,buf); + strdb_final(users_db,NULL); + return 0; +} + /*========================================== * *------------------------------------------ diff --git a/src/map/atcommand.h b/src/map/atcommand.h index ea6849476..bdc4f429d 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -198,6 +198,7 @@ enum AtCommandType { AtCommand_CleanMap, AtCommand_NpcTalk, AtCommand_PetTalk, + AtCommand_Users, // SQL-only commands start #ifndef TXT_ONLY diff --git a/src/map/battle.c b/src/map/battle.c index cc82c6ddc..bffbd0684 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -400,7 +400,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i if(class_ == 1288 || class_ == 1287 || class_ == 1286 || class_ == 1285) { // if(class_ == 1288) { - if(class_ == 1288 && flag&BF_SKILL) + if(class_ == 1288 && (flag&BF_SKILL || skill_num == ASC_BREAKER)) damage=0; if(src->type == BL_PC) { struct guild *g=guild_search(((struct map_session_data *)src)->status.guild_id); @@ -417,6 +417,8 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,int damage,i damage=0;//正規ギルド承認がないとダメージ無し else if (battle_config.guild_max_castles != 0 && guild_checkcastles(g)>=battle_config.guild_max_castles) damage = 0; // [MouseJstr] + else if (g && gc && guild_check_alliance(gc->guild_id, g->guild_id, 0) == 1) + return 0; } else damage = 0; } @@ -775,7 +777,6 @@ static struct Damage battle_calc_pet_weapon_attack( if(skill_lv>9 && wflag==2) damage2+=damage/4; if(skill_lv>9 && wflag==3) damage2+=damage/2; damage +=damage2; - blewcount=0; break; case KN_BOWLINGBASH: // ボウリングバッシュ damage = damage*(100+ 50*skill_lv)/100; @@ -1271,7 +1272,6 @@ static struct Damage battle_calc_mob_weapon_attack( if(skill_lv>9 && wflag==2) damage2+=damage/4; if(skill_lv>9 && wflag==3) damage2+=damage/2; damage +=damage2; - blewcount=0; break; case KN_BOWLINGBASH: // ボウリングバッシュ damage = damage*(100+ 50*skill_lv)/100; @@ -1615,7 +1615,6 @@ static struct Damage battle_calc_pc_weapon_attack( int no_cardfix=0; int def1 = status_get_def(target); int def2 = status_get_def2(target); -// int mdef1, mdef2; int t_vit = status_get_vit(target); struct Damage wd; int damage,damage2,damage3=0,damage4=0,type,div_,blewcount=skill_get_blewcount(skill_num,skill_lv); @@ -2024,6 +2023,7 @@ static struct Damage battle_calc_pc_weapon_attack( case KN_SPEARSTAB: // スピアスタブ damage = damage*(100+ 15*skill_lv)/100; damage2 = damage2*(100+ 15*skill_lv)/100; + blewcount=0; break; case KN_SPEARBOOMERANG: // スピアブーメラン damage = damage*(100+ 50*skill_lv)/100; @@ -2047,7 +2047,6 @@ static struct Damage battle_calc_pc_weapon_attack( if(skill_lv>9 && wflag==2) damage4+=damage2/4; if(skill_lv>9 && wflag==3) damage4+=damage2/2; damage2 +=damage4; - blewcount=0; break; case KN_BOWLINGBASH: // ボウリングバッシュ damage = damage*(100+ 50*skill_lv)/100; @@ -2287,49 +2286,12 @@ static struct Damage battle_calc_pc_weapon_attack( break; case ASC_BREAKER: // -- moonsoul (special damage for ASC_BREAKER skill) if(sd){ -/* int mdef1=status_get_mdef(target); - int mdef2=status_get_mdef2(target); - int imdef_flag=0; - - damage = ((damage * 5) + (skill_lv * status_get_int(src) * 5) + rand()%500 + 500) /2; - damage2 = ((damage2 * 5) + (skill_lv * status_get_int(src) * 5) + rand()%500 + 500) /2; - damage3 = damage; - // physical damage can miss - hitrate = 1000000;*/ - // calculate physical part of damage damage = damage * skill_lv; damage2 = damage2 * skill_lv; - // element modifier added right after this - // calculate magic part of damage damage3 = skill_lv * status_get_int(src) * 5; - // ignores magic defense now [Celest] - /*if(sd->ignore_mdef_ele & (1<ignore_mdef_race & (1<ignore_mdef_race & (1<<10)) - imdef_flag = 1; - } - else { - if(sd->ignore_mdef_race & (1<<11)) - imdef_flag = 1; - } - if(!imdef_flag){ - if(battle_config.magic_defense_type) { - damage3 = damage3 - (mdef1 * battle_config.magic_defense_type) - mdef2; - } - else{ - damage3 = (damage3*(100-mdef1))/100 - mdef2; - } - } - - if(damage3<1) - damage3=1; - - damage3=battle_attr_fix(damage2,s_ele_, status_get_element(target) );*/ - flag=(flag&~BF_RANGEMASK)|BF_LONG; } break; @@ -3221,7 +3183,7 @@ struct Damage battle_calc_misc_attack( struct Damage md; int damagefix=1; - int aflag=BF_MISC|BF_LONG|BF_SKILL; + int aflag=BF_MISC|BF_SHORT|BF_SKILL; //return前の処理があるので情報出力部のみ変更 if( bl == NULL || target == NULL ){ @@ -3263,13 +3225,13 @@ struct Damage battle_calc_misc_attack( damage=(dex/10+int_/2+skill*3+40)*2; if(flag > 1) damage /= flag; - if(status_get_mode(target) & 0x40) - damage = 1; + aflag |= (flag&~BF_RANGEMASK)|BF_LONG; break; case TF_THROWSTONE: // 石投げ damage=50; damagefix=0; + aflag |= (flag&~BF_RANGEMASK)|BF_LONG; break; case BA_DISSONANCE: // 不協和音 @@ -3312,8 +3274,7 @@ struct Damage battle_calc_misc_attack( #endif if(flag > 1) damage /= flag; - if(status_get_mode(target) & 0x40) - damage = 1; + aflag |= (flag&~BF_RANGEMASK)|BF_LONG; break; } @@ -3348,6 +3309,9 @@ struct Damage battle_calc_misc_attack( damage = div_; } + if(status_get_mode(target)&0x40 && damage>0) + damage = 1; + damage=battle_calc_damage(bl,target,damage,div_,skill_num,skill_lv,aflag); // 最終修正 md.damage=damage; @@ -3476,7 +3440,7 @@ int battle_weapon_attack( struct block_list *src,struct block_list *target, } } if(rdamage > 0) - clif_damage(src,src,tick, wd.amotion,0,rdamage,1,4,0); + clif_damage(src,src,tick,wd.amotion,wd.dmotion,rdamage,1,4,0); } if (wd.div_ == 255 && sd) { //三段掌 @@ -3925,7 +3889,7 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range) // return 1; // 障害物判定 - return path_search_long(src->m,src->x,src->y,bl->x,bl->y); + return path_search_long(NULL,src->m,src->x,src->y,bl->x,bl->y); } /*========================================== @@ -4122,6 +4086,9 @@ static const struct { { "gm_can_drop_lv", &battle_config.gm_can_drop_lv }, { "disp_hpmeter", &battle_config.disp_hpmeter }, { "bone_drop", &battle_config.bone_drop }, + { "monster_damage_delay", &battle_config.monster_damage_delay }, + +// eAthena additions { "item_rate_common", &battle_config.item_rate_common }, // Added by RoVeRT { "item_rate_equip", &battle_config.item_rate_equip }, { "item_rate_card", &battle_config.item_rate_card }, // End Addition @@ -4369,6 +4336,9 @@ void battle_set_defaults() { battle_config.gm_can_drop_lv = 0; battle_config.disp_hpmeter = 0; battle_config.bone_drop = 0; + battle_config.monster_damage_delay = 1; + +// eAthena additions battle_config.item_rate_common = 100; battle_config.item_rate_equip = 100; battle_config.item_rate_card = 100; diff --git a/src/map/battle.h b/src/map/battle.h index 150e08f41..63681360a 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -280,7 +280,9 @@ extern struct Battle_Config { int gm_can_drop_lv; int disp_hpmeter; int bone_drop; + int monster_damage_delay; +// eAthena additions int night_at_start; // added by [Yor] int day_duration; // added by [Yor] int night_duration; // added by [Yor] diff --git a/src/map/chrif.c b/src/map/chrif.c index 8bd70a737..a3a3e63f5 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1006,7 +1006,7 @@ int chrif_disconnect_sub(struct map_session_data* sd,va_list va) { int chrif_disconnect(int fd) { if(fd == char_fd) { - char_fd = -1; + char_fd = 0; sprintf(tmp_output,"Map Server disconnected from Char Server.\n\n"); ShowWarning(tmp_output); clif_foreachclient(chrif_disconnect_sub); diff --git a/src/map/guild.c b/src/map/guild.c index ea9c3795f..06838c4b8 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -678,11 +678,10 @@ int guild_member_leaved(int guild_id,int account_id,int char_id,int flag, { struct map_session_data *sd=map_id2sd(account_id); struct guild *g=guild_search(guild_id); - int i; if(g!=NULL){ int i; - for(i=0;imax_member;i++) + for(i=0;imax_member;i++) { if( g->member[i].account_id==account_id && g->member[i].char_id==char_id ){ struct map_session_data *sd2=sd; @@ -698,6 +697,12 @@ int guild_member_leaved(int guild_id,int account_id,int char_id,int flag, g->member[i].account_id=0; g->member[i].sd=NULL; } + // メンバーリストを全員に再通知 + for(i=0;imax_member;i++){ + if( g->member[i].sd!=NULL ) + clif_guild_memberlist(g->member[i].sd); + } + } } if(sd!=NULL) { if (sd->status.guild_id==guild_id){ @@ -706,13 +711,7 @@ int guild_member_leaved(int guild_id,int account_id,int char_id,int flag, sd->guild_sended=0; } } - - // メンバーリストを全員に再通知 - for(i=0;imax_member;i++){ - if( g->member[i].sd!=NULL ) - clif_guild_memberlist(g->member[i].sd); - } - + return 0; } // ギルドメンバのオンライン状態/Lv更新送信 @@ -1037,6 +1036,23 @@ int guild_get_alliance_count(struct guild *g,int flag) } return c; } +// 同盟関係かどうかチェック +// 同盟なら1、それ以外は0 +int guild_check_alliance(int guild_id1, int guild_id2, int flag) +{ + struct guild *g; + int i; + + g = guild_search(guild_id1); + if (g == NULL) + return 0; + + for (i=0; ialliance[i].guild_id == guild_id2) && (g->alliance[i].opposition == flag)) + return 1; + + return 0; +} // ギルド同盟要求 int guild_reqalliance(struct map_session_data *sd,int account_id) { diff --git a/src/map/guild.h b/src/map/guild.h index 8f5243a8c..1dee350a1 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -54,6 +54,7 @@ int guild_allianceack(int guild_id1,int guild_id2,int account_id1,int account_id int flag,const char *name1,const char *name2); int guild_delalliance(struct map_session_data *sd,int guild_id,int flag); int guild_opposition(struct map_session_data *sd,int char_id); +int guild_check_alliance(int guild_id1, int guild_id2, int flag); int guild_send_memberinfoshort(struct map_session_data *sd,int online); int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int online,int lv,int class_); diff --git a/src/map/map.c b/src/map/map.c index d402ac06c..bcf6c83ad 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -239,10 +239,27 @@ int map_freeblock_unlock(void) { }else if(block_free_lock<0){ if(battle_config.error_log) printf("map_freeblock_unlock: lock count < 0 !\n"); + block_free_lock = 0; // 次回以降のロックに支障が出てくるのでリセット } return block_free_lock; } +// map_freeblock_lock() を呼んで map_freeblock_unlock() を呼ばない +// 関数があったので、定期的にblock_free_lockをリセットするようにする。 +// この関数は、do_timer() のトップレベルから呼ばれるので、 +// block_free_lock を直接いじっても支障無いはず。 + +int map_freeblock_timer(int tid,unsigned int tick,int id,int data) { + if(block_free_lock > 0) { + printf("map_freeblock_timer: block_free_lock(%d) is invalid.\n",block_free_lock); + block_free_lock = 1; + map_freeblock_unlock(); + } + // else { + // printf("map_freeblock_timer: check ok\n"); + // } + return 0; +} // // block化?理 @@ -1428,96 +1445,98 @@ void map_addnickdb(struct map_session_data *sd) { int map_quit(struct map_session_data *sd) { nullpo_retr(0, sd); - if (sd->state.event_disconnect) { - struct npc_data *npc; - if ((npc = npc_name2id(script_config.logout_event_name))) { - run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCLogoutNPC - sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.logout_event_name); - ShowStatus(tmp_output); + if(!sd->state.waitingdisconnect) { + if (sd->state.event_disconnect) { + struct npc_data *npc; + if ((npc = npc_name2id(script_config.logout_event_name))) { + run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCLogoutNPC + sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.logout_event_name); + ShowStatus(tmp_output); + } } - } - if(sd->chatID) // チャットから出る - chat_leavechat(sd); + if(sd->chatID) // チャットから出る + chat_leavechat(sd); - if(sd->trade_partner) // 取引を中?する - trade_tradecancel(sd); + if(sd->trade_partner) // 取引を中?する + trade_tradecancel(sd); - if(sd->party_invite>0) // パ?ティ?誘を拒否する - party_reply_invite(sd,sd->party_invite_account,0); + if(sd->party_invite>0) // パ?ティ?誘を拒否する + party_reply_invite(sd,sd->party_invite_account,0); - if(sd->guild_invite>0) // ギルド?誘を拒否する - guild_reply_invite(sd,sd->guild_invite,0); - if(sd->guild_alliance>0) // ギルド同盟?誘を拒否する - guild_reply_reqalliance(sd,sd->guild_alliance_account,0); + if(sd->guild_invite>0) // ギルド?誘を拒否する + guild_reply_invite(sd,sd->guild_invite,0); + if(sd->guild_alliance>0) // ギルド同盟?誘を拒否する + guild_reply_reqalliance(sd,sd->guild_alliance_account,0); - party_send_logout(sd); // パ?ティのログアウトメッセ?ジ送信 + party_send_logout(sd); // パ?ティのログアウトメッセ?ジ送信 - guild_send_memberinfoshort(sd,0); // ギルドのログアウトメッセ?ジ送信 + guild_send_memberinfoshort(sd,0); // ギルドのログアウトメッセ?ジ送信 - pc_cleareventtimer(sd); // イベントタイマを破棄する + pc_cleareventtimer(sd); // イベントタイマを破棄する - if(sd->state.storage_flag) - storage_guild_storage_quit(sd,0); - else - storage_storage_quit(sd); // 倉庫を開いてるなら保存する - - // check if we've been authenticated [celest] - if (sd->state.auth) - skill_castcancel(&sd->bl,0); // 詠唱を中?する - - skill_stop_dancing(&sd->bl,1);// ダンス/演奏中? - - if(sd->sc_data && sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中の終了はHPを100に - sd->status.hp = 100; + if(sd->state.storage_flag) + storage_guild_storage_quit(sd,0); + else + storage_storage_quit(sd); // 倉庫を開いてるなら保存する - status_change_clear(&sd->bl,1); // ステ?タス異常を解除する - skill_clear_unitgroup(&sd->bl); // スキルユニットグル?プの削除 - skill_cleartimerskill(&sd->bl); + // check if we've been authenticated [celest] + if (sd->state.auth) + skill_castcancel(&sd->bl,0); // 詠唱を中?する - // check if we've been authenticated [celest] - if (sd->state.auth) { - pc_stop_walking(sd,0); - pc_stopattack(sd); - pc_delinvincibletimer(sd); - } - pc_delspiritball(sd,sd->spiritball,1); - skill_gangsterparadise(sd,0); + skill_stop_dancing(&sd->bl,1);// ダンス/演奏中? - if (sd->state.auth) - status_calc_pc(sd,4); -// skill_clear_unitgroup(&sd->bl); // [Sara-chan] + if(sd->sc_data && sd->sc_data[SC_BERSERK].timer!=-1) //バ?サ?ク中の終了はHPを100に + sd->status.hp = 100; - clif_clearchar_area(&sd->bl,2); + status_change_clear(&sd->bl,1); // ステ?タス異常を解除する + skill_clear_unitgroup(&sd->bl); // スキルユニットグル?プの削除 + skill_cleartimerskill(&sd->bl); - if(sd->status.pet_id && sd->pd) { - pet_lootitem_drop(sd->pd,sd); - pet_remove_map(sd); - if(sd->pet.intimate <= 0) { - intif_delete_petdata(sd->status.pet_id); - sd->status.pet_id = 0; - sd->pd = NULL; - sd->petDB = NULL; + // check if we've been authenticated [celest] + if (sd->state.auth) { + pc_stop_walking(sd,0); + pc_stopattack(sd); + pc_delinvincibletimer(sd); + } + pc_delspiritball(sd,sd->spiritball,1); + skill_gangsterparadise(sd,0); + skill_unit_move(&sd->bl,gettick(),0); + + if (sd->state.auth) + status_calc_pc(sd,4); + // skill_clear_unitgroup(&sd->bl); // [Sara-chan] + + clif_clearchar_area(&sd->bl,2); + + if(sd->status.pet_id && sd->pd) { + pet_lootitem_drop(sd->pd,sd); + pet_remove_map(sd); + if(sd->pet.intimate <= 0) { + intif_delete_petdata(sd->status.pet_id); + sd->status.pet_id = 0; + sd->pd = NULL; + sd->petDB = NULL; + } + else + intif_save_petdata(sd->status.account_id,&sd->pet); } - else - intif_save_petdata(sd->status.account_id,&sd->pet); - } - if(pc_isdead(sd)) - pc_setrestartvalue(sd,2); + if(pc_isdead(sd)) + pc_setrestartvalue(sd,2); - pc_makesavestatus(sd); - chrif_save(sd); - storage_storage_dirty(sd); - storage_storage_save(sd); + pc_makesavestatus(sd); + chrif_save(sd); + storage_storage_dirty(sd); + storage_storage_save(sd); + map_delblock(&sd->bl); + } if( sd->npc_stackbuf && sd->npc_stackbuf != NULL) { aFree( sd->npc_stackbuf ); sd->npc_stackbuf = NULL; } - map_delblock(&sd->bl); - #ifndef TXT_ONLY chrif_char_offline(sd); #endif @@ -3348,11 +3367,16 @@ int do_init(int argc, char *argv[]) { map_readallmap(); + add_timer_func_list(map_freeblock_timer,"map_freeblock_timer"); add_timer_func_list(map_clearflooritem_timer, "map_clearflooritem_timer"); + add_timer_interval(gettick()+1000,map_freeblock_timer,0,0,60*1000); //Added by Mugendai for GUI support if (flush_on) add_timer_interval(gettick()+10, flush_timer,0,0,flush_time); + //Added for Mugendais I'm Alive mod + if (imalive_on) + add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000); #ifndef TXT_ONLY // online status timer, checks every hour [Valaris] add_timer_func_list(online_timer, "online_timer"); @@ -3395,10 +3419,6 @@ int do_init(int argc, char *argv[]) { if (battle_config.pk_mode == 1) ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n"); - //Added for Mugendais I'm Alive mod - if (imalive_on) - add_timer_interval(gettick()+10, imalive_timer,0,0,imalive_time*1000); - sprintf(tmp_output,"Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map_port); ShowStatus(tmp_output); diff --git a/src/map/map.h b/src/map/map.h index c1d0670e7..aa73b7a8b 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -53,6 +53,12 @@ struct walkpath_data { unsigned char path_len,path_pos,path_half; unsigned char path[MAX_WALKPATH]; }; +struct shootpath_data { + int rx,ry,len; + int x[MAX_WALKPATH]; + int y[MAX_WALKPATH]; +}; + struct script_reg { int index; int data; @@ -774,7 +780,7 @@ int map_calc_dir( struct block_list *src,int x,int y); // path.cより int path_search(struct walkpath_data*,int,int,int,int,int,int); -int path_search_long(int m,int x0,int y0,int x1,int y1); +int path_search_long(struct shootpath_data *,int,int,int,int,int); int path_blownpos(int m,int x0,int y0,int dx,int dy,int count); int map_who(int fd); diff --git a/src/map/mob.c b/src/map/mob.c index 327d78b02..b313328c2 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1103,7 +1103,7 @@ int mob_stop_walking(struct mob_data *md,int type) if(type&0x02) { int delay=status_get_dmotion(&md->bl); unsigned int tick = gettick(); - if(md->canmove_tick < tick) + if(battle_config.monster_damage_delay && md->canmove_tick < tick) md->canmove_tick = tick + delay; } @@ -2225,7 +2225,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) return 0; } - if(md->sc_data[SC_ENDURE].timer == -1) + if(battle_config.monster_damage_delay && md->sc_data[SC_ENDURE].timer == -1) mob_stop_walking(md,3); if(damage > max_hp>>2) skill_stop_dancing(&md->bl,0); @@ -3777,11 +3777,14 @@ int mob_gvmobcheck(struct map_session_data *sd, struct block_list *bl) return 0;//ギルド未加入ならダメージ無し else if(gc != NULL && !map[sd->bl.m].flag.gvg) return 0;//砦内でGvじゃないときはダメージなし - else if(g && gc != NULL && g->guild_id == gc->guild_id) - return 0;//自占領ギルドのエンペならダメージ無し - else if(g && guild_checkskill(g,GD_APPROVAL) <= 0 && md->class_ == 1288) - return 0;//正規ギルド承認がないとダメージ無し - + else if(g) { + if (gc != NULL && g->guild_id == gc->guild_id) + return 0;//自占領ギルドのエンペならダメージ無し + else if(guild_checkskill(g,GD_APPROVAL) <= 0 && md->class_ == 1288) + return 0;//正規ギルド承認がないとダメージ無し + else if (gc && guild_check_alliance(gc->guild_id, g->guild_id, 0) == 1) + return 0; // 同盟ならダメージ無し + } } return 1; diff --git a/src/map/npc.c b/src/map/npc.c index c6d77c18c..89837da77 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1882,9 +1882,15 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line printf("npc_parse_script: label name error !\n"); exit(1); }else{ + struct event_data *ev2; ev->nd=nd; ev->pos=pos; sprintf(buf,"%s::%s",nd->exname,lname); + ev2 = strdb_search(ev_db,buf); + if(ev2 != NULL) { + printf("npc_parse_script : duplicate event %s\n",buf); + free(ev2); + } strdb_insert(ev_db,buf,ev); } } diff --git a/src/map/path.c b/src/map/path.c index 92ea4941e..c2b852469 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -246,7 +246,7 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) *------------------------------------------ */ #define swap(x,y) { int t; t = x; x = y; y = t; } -int path_search_long(int m,int x0,int y0,int x1,int y1) +int path_search_long(struct shootpath_data *spd,int m,int x0,int y0,int x1,int y1) { int dx, dy; int wx = 0, wy = 0; @@ -265,13 +265,25 @@ int path_search_long(int m,int x0,int y0,int x1,int y1) } dy = (y1 - y0); + if (spd) { + spd->rx = spd->ry = 0; + spd->len = 1; + spd->x[0] = x0; + spd->y[0] = y0; + } + if (map_getcellp(md,x1,y1,CELL_CHKWALL)) return 0; - if (dx > abs(dy)) + if (dx > abs(dy)) { weight = dx; - else + if (spd) + spd->ry=1; + } else { weight = abs(y1 - y0); + if (spd) + spd->rx=1; + } while (x0 != x1 || y0 != y1) { if (map_getcellp(md,x0,y0,CELL_CHKWALL)) @@ -289,6 +301,11 @@ int path_search_long(int m,int x0,int y0,int x1,int y1) wy += weight; y0 --; } + if (spd && spd->lenx[spd->len] = x0; + spd->y[spd->len] = y0; + spd->len++; + } } return 1; diff --git a/src/map/pc.c b/src/map/pc.c index 2b04699d2..282aa79c4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -371,22 +371,24 @@ int pc_makesavestatus(struct map_session_data *sd) sd->status.clothes_color=0; // 死亡?態だったのでhpを1、位置をセ?ブ場所に?更 - if(pc_isdead(sd)){ - pc_setrestartvalue(sd,0); - memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point)); - } else { - memcpy(sd->status.last_point.map,sd->mapname,24); - sd->status.last_point.x = sd->bl.x; - sd->status.last_point.y = sd->bl.y; - } - - // セ?ブ禁止マップだったので指定位置に移動 - if(map[sd->bl.m].flag.nosave){ - struct map_data *m=&map[sd->bl.m]; - if(strcmp(m->save.map,"SavePoint")==0) + if(!sd->state.waitingdisconnect) { + if(pc_isdead(sd)){ + pc_setrestartvalue(sd,0); memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point)); - else - memcpy(&sd->status.last_point,&m->save,sizeof(sd->status.last_point)); + } else { + memcpy(sd->status.last_point.map,sd->mapname,24); + sd->status.last_point.x = sd->bl.x; + sd->status.last_point.y = sd->bl.y; + } + + // セ?ブ禁止マップだったので指定位置に移動 + if(map[sd->bl.m].flag.nosave){ + struct map_data *m=&map[sd->bl.m]; + if(strcmp(m->save.map,"SavePoint")==0) + memcpy(&sd->status.last_point,&sd->status.save_point,sizeof(sd->status.last_point)); + else + memcpy(&sd->status.last_point,&m->save,sizeof(sd->status.last_point)); + } } //マナ?ポイントがプラスだった場合0に @@ -585,10 +587,8 @@ int pc_isequip(struct map_session_data *sd,int n) //装備破壊 int pc_break_equip(struct map_session_data *sd, unsigned short where) { - struct item_data* item; int i; int sc; - char output[255]; nullpo_retr(-1, sd); if(sd->unbreakable_equip & where) @@ -616,13 +616,12 @@ int pc_break_equip(struct map_session_data *sd, unsigned short where) for (i=0;istatus.inventory[i].equip & where && - !sd->status.inventory[i].attribute == 1) { - item=sd->inventory_data[i]; + sd->status.inventory[i].attribute != 1) { sd->status.inventory[i].attribute = 1; pc_unequipitem(sd,i,3); - sprintf(output, "%s has broken.",item->jname); + sprintf(tmp_output, "%s has broken.",sd->inventory_data[i]->jname); clif_emotion(&sd->bl,23); - clif_displaymessage(sd->fd, output); + clif_displaymessage(sd->fd, tmp_output); clif_equiplist(sd); break; } @@ -6823,7 +6822,7 @@ static int pc_autosave_sub(struct map_session_data *sd,va_list ap) Assert((sd->status.pet_id == 0 || sd->pd == 0) || sd->pd->msd == sd); - if(save_flag==0 && sd->fd>last_save_fd){ + if(save_flag==0 && sd->fd>last_save_fd && !sd->state.waitingdisconnect){ struct guild_castle *gc=NULL; int i; // if(battle_config.save_log) diff --git a/src/map/script.c b/src/map/script.c index d0fc773b2..201635b8f 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1725,7 +1725,7 @@ int buildin_menu(struct script_state *st) conv_str(st,& (st->stack->stack_data[i])); len+=strlen(st->stack->stack_data[i].u.str)+1; } - buf=(char *)aCallocA(len,sizeof(char)); + buf=(char *)aCallocA(len+1,sizeof(char)); buf[0]=0; for(i=st->start+2,len=0;iend;i+=2){ strcat(buf,st->stack->stack_data[i].u.str); @@ -6326,7 +6326,7 @@ int buildin_select(struct script_state *st) conv_str(st,& (st->stack->stack_data[i])); len+=strlen(st->stack->stack_data[i].u.str)+1; } - buf=(char *)aCalloc(len,sizeof(char)); + buf=(char *)aCalloc(len+1,sizeof(char)); buf[0]=0; for(i=st->start+2,len=0;iend;i++){ strcat(buf,st->stack->stack_data[i].u.str); @@ -7652,8 +7652,8 @@ int script_config_read(char *cfgName) script_config.warn_cmd_no_comma=1; script_config.warn_func_mismatch_paramnum=1; script_config.warn_cmd_mismatch_paramnum=1; - script_config.check_cmdcount=8192; - script_config.check_gotocount=512; + script_config.check_cmdcount=65535; + script_config.check_gotocount=2048; script_config.die_event_name = (char *)aCallocA(24,sizeof(char)); script_config.kill_event_name = (char *)aCallocA(24,sizeof(char)); diff --git a/src/map/skill.c b/src/map/skill.c index c693ec2c1..a8e158c71 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1113,7 +1113,7 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) { int dx=0,dy=0,nx,ny; int x=target->x,y=target->y; - int ret,prev_state=MS_IDLE; + int dir,ret,prev_state=MS_IDLE; int moveblock; struct map_session_data *sd=NULL; struct mob_data *md=NULL; @@ -1133,16 +1133,15 @@ int skill_blown( struct block_list *src, struct block_list *target,int count) su=(struct skill_unit *)target; }else return 0; - if(!(count&0x10000)){ /* 指定なしなら位置関係から方向を求める */ - dx=target->x-src->x; dx=(dx>0)?1:((dx<0)?-1: 0); - dy=target->y-src->y; dy=(dy>0)?1:((dy<0)?-1: 0); - } - if(dx==0 && dy==0){ - int dir=status_get_dir(target); - if(dir>=0 && dir<8){ - dx=-dirx[dir]; - dy=-diry[dir]; - } + if (count&0xf00000) + dir = (count>>20)&0xf; + else if (count&0x10000 || (target->x==src->x && target->y==src->y)) + dir = status_get_dir(target); + else + dir = map_calc_dir(target,src->x,src->y); + if (dir>=0 && dir<8){ + dx = -dirx[dir]; + dy = -diry[dir]; } ret=path_blownpos(target->m,x,y,dx,dy,count&0xffff); @@ -2093,10 +2092,11 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case AS_SONICBLOW: /* ソニックブロ? */ case KN_PIERCE: /* ピア?ス */ case KN_SPEARBOOMERANG: /* スピアブ?メラン */ + case KN_BRANDISHSPEAR: /* ブランディッシュスピア */ case TF_POISON: /* インベナム */ case TF_SPRINKLESAND: /* 砂まき */ case AC_CHARGEARROW: /* チャ?ジアロ? */ - case KN_SPEARSTAB: /* スピアスタブ */ +// case KN_SPEARSTAB: /* スピアスタブ */ case RG_RAID: /* サプライズアタック */ case RG_INTIMIDATE: /* インティミデイト */ case BA_MUSICALSTRIKE: /* ミュ?ジカルストライク */ @@ -2135,6 +2135,10 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case NPC_DARKNESSATTACK: case NPC_TELEKINESISATTACK: case NPC_UNDEADATTACK: + case NPC_BREAKARMOR: + case NPC_BREAKWEAPON: + case NPC_BREAKHELM: + case NPC_BREAKSHIELD: case LK_AURABLADE: /* オ?ラブレ?ド */ case LK_SPIRALPIERCE: /* スパイラルピア?ス */ case LK_HEADCRUSH: /* ヘッドクラッシュ */ @@ -2145,6 +2149,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case CG_ARROWVULCAN: /* アロ?バルカン */ case ASC_BREAKER: /* ソウルブレ?カ? */ case HW_MAGICCRASHER: /* マジッククラッシャ? */ + case ASC_METEORASSAULT: /* メテオアサルト */ case ITM_TOMAHAWK: skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); break; @@ -2188,22 +2193,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case SN_FALCONASSAULT: /* ファルコンアサルト */ skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag); break; - case KN_BRANDISHSPEAR: /* ブランディッシュスピア */ - { - struct mob_data *md = (struct mob_data *)bl; - nullpo_retr(1, md); - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); - if(md->hp > 0){ - skill_blown(src,bl,skill_get_blewcount(skillid,skilllv)); - if(bl->type == BL_MOB) - clif_fixmobpos((struct mob_data *)bl); - else if(bl->type == BL_PET) - clif_fixpetpos((struct pet_data *)bl); - else - clif_fixpos(bl); - } - } - break; + case RG_BACKSTAP: /* バックスタブ */ { int dir = map_calc_dir(src,bl->x,bl->y),t_dir = status_get_dir(bl); @@ -2310,21 +2300,14 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s break; /* 武器系範?攻?スキル */ case AC_SHOWER: /* アロ?シャワ? */ -// case SM_MAGNUM: /* マグナムブレイク */ case AS_GRIMTOOTH: /* グリムトゥ?ス */ case MC_CARTREVOLUTION: /* カ?トレヴォリュ?ション */ case NPC_SPLASHATTACK: /* スプラッシュアタック */ - case ASC_METEORASSAULT: /* メテオアサルト */ case AS_SPLASHER: /* [Valaris] */ if(flag&1){ /* 個別にダメ?ジを?える */ if(bl->id!=skill_area_temp[1]){ int dist=0; - //if(skillid==SM_MAGNUM){ /* マグナムブレイクなら中心からの距離を計算 */ - // int dx=abs( bl->x - skill_area_temp[2] ); - // int dy=abs( bl->y - skill_area_temp[3] ); - // dist=((dx>dy)?dx:dy); - //} skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick, 0x0500|dist ); if (bl->type == BL_MOB && skillid == AS_GRIMTOOTH) { @@ -2333,22 +2316,20 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s status_change_start(bl,SC_SLOWDOWN,0,0,0,0,1000,0); } } - }else{ - int ar=1; - int x=bl->x,y=bl->y; - /*if( skillid==SM_MAGNUM){ - x=src->x; - y=src->y; - }else*/ - if(skillid==AC_SHOWER || skillid==ASC_METEORASSAULT) /* アロ?シャワ?、メテオアサルト範?5*5 */ - ar=2; - else if(skillid==AS_SPLASHER) /* ベナムスプラッシャ?範?3*3 */ - ar=1; - else if(skillid==NPC_SPLASHATTACK) /* スプラッシュアタックは範?7*7 */ - ar=3; - - if (skillid == ASC_METEORASSAULT) - clif_skill_nodamage(src,bl,skillid,skilllv,1); + } else { + int ar; + int x = bl->x, y = bl->y; + switch (skillid) { + case AC_SHOWER: + ar=2; + break; + case NPC_SPLASHATTACK: + ar=3; + break; + default: + ar=1; + break; + } skill_area_temp[1]=bl->id; skill_area_temp[2]=x; @@ -2382,11 +2363,10 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s if(bl->id!=skill_area_temp[1]) skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0x0500); } else { -/* int damage; - map_freeblock_lock(); - damage = skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0); - if(damage > 0) {*/ int i,c; /* 他人から聞いた動きなので間違ってる可能性大&?率が?いっす>< */ + /* まずターゲットに攻撃を加える */ + if (!skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0)) + break; c = skill_get_blewcount(skillid,skilllv); if(map[bl->m].flag.gvg) c = 0; for(i=0;i1) break; } skill_area_temp[1]=bl->id; - skill_area_temp[2]=bl->x; - skill_area_temp[3]=bl->y; - skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0); - /* その後タ?ゲット以外の範??の敵全?に?理を行う */ map_foreachinarea(skill_area_sub, bl->m,bl->x-1,bl->y-1,bl->x+1,bl->y+1,0, src,skillid,skilllv,tick, flag|BCT_ENEMY|1, skill_castend_damage_id); -/* battle_damage(src,bl,damage,1); - if(rdamage > 0) - battle_damage(bl,src,rdamage,0); + } + break; + + case KN_SPEARSTAB: /* スピアスタブ */ + if(flag&1){ + /* 個別にダメージを与える */ + if (bl->id==skill_area_temp[1]) + break; + if (skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0x0500)) + skill_blown(src,bl,skill_area_temp[2]); + } else { + int x=bl->x,y=bl->y,i,dir; + /* まずターゲットに攻撃を加える */ + dir = map_calc_dir(bl,src->x,src->y); + skill_area_temp[1] = bl->id; + skill_area_temp[2] = skill_get_blewcount(skillid,skilllv)|dir<<20; + if (skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,0)) + skill_blown(src,bl,skill_area_temp[2]); + for (i=0;i<4;i++) { + map_foreachinarea(skill_area_sub,bl->m,x,y,x,y,0, + src,skillid,skilllv,tick,flag|BCT_ENEMY|1, + skill_castend_damage_id); + x += dirx[dir]; + y += diry[dir]; } - map_freeblock_unlock();*/ } break; @@ -2441,12 +2437,10 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case WZ_EARTHSPIKE: /* アーススパイク */ case AL_HEAL: /* ヒール */ case AL_HOLYLIGHT: /* ホーリーライト */ -// case MG_FROSTDIVER: /* フロストダイバー */ case WZ_JUPITEL: /* ユピテルサンダー */ case NPC_DARKJUPITEL: /*闇ユピテル*/ case NPC_MAGICALATTACK: /* MOB:魔法打?攻? */ case PR_ASPERSIO: /* アスペルシオ */ -// case HW_NAPALMVULCAN: /* ナパームバルカン */ skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); break; @@ -2465,7 +2459,8 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s } damage = skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,flag); if (status_get_hp(bl) > 0 && damage > 0 && rand()%100 < rate) { - status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv),0); + status_change_start(bl,SC_FREEZE,skilllv,0,0,0, + skill_get_time2(skillid,skilllv)*(1-sc_def_mdef/100),0); } else if (sd) { clif_skill_fail(sd,skillid,0,0); } @@ -2631,11 +2626,11 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s clif_skill_nodamage(src,bl,skillid,skilllv,1); if (skilllv == 5) skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick,0 ); - if (bl->type == BL_PC) { + if (bl->type == BL_PC && (map[src->m].flag.pvp || map[src->m].flag.gvg)) { struct map_session_data *tsd = (struct map_session_data *)bl; if (tsd) { tsd->status.sp = 0; - clif_updatestatus((struct map_session_data *)bl,SP_SP); + clif_updatestatus(tsd,SP_SP); } } } else { @@ -3162,6 +3157,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int clif_skill_nodamage(src,bl,skillid,skilllv,1); status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; + case LK_TENSIONRELAX: /* テンションリラックス */ clif_skill_nodamage(src,bl,skillid,skilllv,1); pc_setsit(sd); @@ -3173,9 +3169,11 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); //sd->status.hp = sd->status.max_hp * 3; break; + case MC_CHANGECART: clif_skill_nodamage(src,bl,skillid,skilllv,1); break; + case AC_CONCENTRATION: /* 集中力向上 */ { int range = 1; @@ -3186,6 +3184,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int src,SkillStatusChangeTable[skillid],tick); } break; + case SM_PROVOKE: /* プロボック */ { struct status_change *sc_data = status_get_sc_data(bl); @@ -3347,19 +3346,21 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case RG_RAID: /* サプライズアタック */ clif_skill_nodamage(src,bl,skillid,skilllv,1); - { - int x=bl->x,y=bl->y; - skill_area_temp[1]=bl->id; - skill_area_temp[2]=x; - skill_area_temp[3]=y; - map_foreachinarea(skill_area_sub, - bl->m,x-1,y-1,x+1,y+1,0, - src,skillid,skilllv,tick, flag|BCT_ENEMY|1, - skill_castend_damage_id); - } + map_foreachinarea(skill_area_sub, + bl->m,bl->x-1,bl->y-1,bl->x+1,bl->y+1,0, + src,skillid,skilllv,tick, flag|BCT_ENEMY|1, + skill_castend_damage_id); status_change_end(src, SC_HIDING, -1); // ハイディング解除 break; + case ASC_METEORASSAULT: /* メテオアサルト */ + clif_skill_nodamage(src,bl,skillid,skilllv,1); + map_foreachinarea(skill_area_sub, + bl->m,bl->x-2,bl->y-2,bl->x+2,bl->y+2,0, + src,skillid,skilllv,tick, flag|BCT_ENEMY|1, + skill_castend_damage_id); + break; + case KN_BRANDISHSPEAR: /*ブランディッシュスピア*/ { int c,n=4,ar; @@ -3769,35 +3770,36 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int case ST_FULLSTRIP: // Celest { struct status_change *tsc_data = status_get_sc_data(bl); - int scid, equip, strip_fix, strip_num = 0; + int scid, cp_scid = 0, equip, strip_fix, strip_num = 0; scid = SkillStatusChangeTable[skillid]; switch (skillid) { case RG_STRIPWEAPON: equip = EQP_WEAPON; + cp_scid = SC_CP_WEAPON; break; case RG_STRIPSHIELD: equip = EQP_SHIELD; + cp_scid = SC_CP_SHIELD; break; case RG_STRIPARMOR: equip = EQP_ARMOR; + cp_scid = SC_CP_ARMOR; break; case RG_STRIPHELM: equip = EQP_HELM; + cp_scid = SC_CP_HELM; break; case ST_FULLSTRIP: equip = EQP_WEAPON | EQP_SHIELD | EQP_ARMOR | EQP_HELM; strip_num = 3; break; default: + map_freeblock_unlock(); return 1; } - if (tsc_data) { - if (tsc_data[scid].timer != -1) - break; - if (tsc_data[skillid - RG_STRIPWEAPON + SC_CP_WEAPON].timer != -1) + if (tsc_data && (tsc_data[scid].timer != -1 || tsc_data[cp_scid].timer != -1)) break; - } if (dstsd && dstsd->unstripable_equip & equip) break; @@ -3810,7 +3812,7 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if (dstsd) { for (i=0;istatus.inventory[i].equip && dstsd->status.inventory[i].equip & equip){ + if (dstsd->status.inventory[i].equip && (dstsd->status.inventory[i].equip & equip)){ pc_unequipitem(dstsd,i,3); if ((--strip_num) <= 0) break; @@ -4159,28 +4161,31 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int // Equipment breaking monster skills [Celest] case NPC_BREAKWEAPON: clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(bl->type == BL_PC && rand()%100 < skilllv && battle_config.equipment_breaking) - pc_breakweapon((struct map_session_data *)bl); + if(bl->type == BL_PC && battle_config.equipment_breaking) + pc_breakweapon(dstsd); break; case NPC_BREAKARMOR: clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(bl->type == BL_PC && rand()%100 < skilllv && battle_config.equipment_breaking) - pc_breakarmor((struct map_session_data *)bl); + if(bl->type == BL_PC && battle_config.equipment_breaking) + pc_breakarmor(dstsd); break; case NPC_BREAKHELM: clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(bl->type == BL_PC && rand()%100 < skilllv && battle_config.equipment_breaking) - // since we don't have any code for helm breaking yet... - pc_breakweapon((struct map_session_data *)bl); + if(bl->type == BL_PC && battle_config.equipment_breaking) + pc_breakhelm(dstsd); break; case NPC_BREAKSHIELD: clif_skill_nodamage(src,bl,skillid,skilllv,1); - if(bl->type == BL_PC && rand()%100 < skilllv && battle_config.equipment_breaking) - // since we don't have any code for helm breaking yet... - pc_breakweapon((struct map_session_data *)bl); + if(bl->type == BL_PC && battle_config.equipment_breaking) + pc_breakshield(dstsd); + break; + + case NPC_EXPLOSIONSPIRITS: //NPC爆裂波動 + clif_skill_nodamage(src,bl,skillid,skilllv,1); + status_change_start(bl,SC_EXPLOSIONSPIRITS,skilllv,0,0,0,skill_get_time(skillid,skilllv),0 ); break; case WE_MALE: /* 君だけは護るよ */ @@ -4204,10 +4209,12 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int if(sd && dstsd){ if((dstsd = pc_get_partner(sd)) == NULL){ clif_skill_fail(sd,skillid,0,0); + map_freeblock_unlock(); return 0; } if(map[sd->bl.m].flag.nomemo || map[sd->bl.m].flag.nowarpto || map[dstsd->bl.m].flag.nowarp){ clif_skill_teleportmessage(sd,1); + map_freeblock_unlock(); return 0; } skill_unitsetting(src,skillid,skilllv,sd->bl.x,sd->bl.y,0); @@ -4307,8 +4314,10 @@ int skill_castend_nodamage_id( struct block_list *src, struct block_list *bl,int break; case AS_SPLASHER: /* ベナムスプラッシャ? */ - if((double)status_get_max_hp(bl)*2/3 < status_get_hp(bl)) //HPが2/3以上?っていたら失敗 + if((double)status_get_max_hp(bl)*2/3 < status_get_hp(bl)) { //HPが2/3以上?っていたら失敗 + map_freeblock_unlock(); return 1; + } clif_skill_nodamage(src,bl,skillid,skilllv,1); status_change_start(bl,SkillStatusChangeTable[skillid],skilllv,skillid,src->id,skill_get_time(skillid,skilllv),1000,0 ); break; diff --git a/src/map/status.c b/src/map/status.c index 50fa778e1..f13694145 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -720,7 +720,7 @@ int status_calc_pc(struct map_session_data* sd,int first) sd->paramb[1]+= (sd->status.agi+sd->paramb[1]+sd->parame[1]-sd->paramcard[1])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100; sd->paramb[4]+= (sd->status.dex+sd->paramb[4]+sd->parame[4]-sd->paramcard[4])*(2+sd->sc_data[SC_CONCENTRATE].val1)/100; } - if(sd->sc_data[SC_INCREASEAGI].timer!=-1 && sd->sc_data[SC_QUAGMIRE].timer == -1 && sd->sc_data[SC_DONTFORGETME].timer == -1){ // 速度?加 + if(sd->sc_data[SC_INCREASEAGI].timer!=-1){ // 速度?加 sd->paramb[1]+= 2+sd->sc_data[SC_INCREASEAGI].val1; sd->speed -= sd->speed *25/100; } @@ -1021,13 +1021,12 @@ int status_calc_pc(struct map_session_data* sd,int first) //Flee上昇 if( (skill=pc_checkskill(sd,TF_MISS))>0 ){ // 回避率?加 - if(sd->status.class_==6||sd->status.class_==4007 || sd->status.class_==23){ + if(sd->status.class_==6||sd->status.class_==4007 || sd->status.class_==23) sd->flee += skill*3; - } - if(sd->status.class_==12||sd->status.class_==17||sd->status.class_==4013||sd->status.class_==4018) + else if(sd->status.class_==12||sd->status.class_==17||sd->status.class_==4013||sd->status.class_==4018) sd->flee += skill*4; if(sd->status.class_==12||sd->status.class_==4013) - sd->speed -= sd->speed *(skill*1.5)/100; + sd->speed -= (short)(skill*1.5/100 * DEFAULT_WALK_SPEED); } if( (skill=pc_checkskill(sd,MO_DODGE))>0 ) // 見切り sd->flee += (skill*3)>>1; @@ -1090,7 +1089,7 @@ int status_calc_pc(struct map_session_data* sd,int first) } if(sd->sc_data[SC_VOLCANO].timer!=-1 && sd->def_ele==3){ // ボルケ?ノ - sd->watk += sd->sc_data[SC_VIOLENTGALE].val3; + sd->watk += sd->sc_data[SC_VOLCANO].val3; } if(sd->sc_data[SC_SIGNUMCRUCIS].timer!=-1) @@ -1663,12 +1662,16 @@ int status_get_max_hp(struct block_list *bl) max_hp += (md->level - mob_db[md->class_].lv) * status_get_vit(bl); if(mob_db[md->class_].mexp > 0) { - if(battle_config.mvp_hp_rate != 100) - max_hp = (max_hp * battle_config.mvp_hp_rate)/100; + if(battle_config.mvp_hp_rate != 100) { + double hp = (double)max_hp * battle_config.mvp_hp_rate / 100.0; + max_hp = (hp > 0x7FFFFFFF ? 0x7FFFFFFF : (int)hp); + } } else { - if(battle_config.monster_hp_rate != 100) - max_hp = (max_hp * battle_config.monster_hp_rate)/100; + if(battle_config.mvp_hp_rate != 100) { + double hp = (double)max_hp * battle_config.mvp_hp_rate / 100.0; + max_hp = (hp > 0x7FFFFFFF ? 0x7FFFFFFF : (int)hp); + } } } else if(bl->type == BL_PET) { @@ -2007,6 +2010,8 @@ int status_get_hit(struct block_list *bl) sc_data[SC_GOSPEL].val4 == BCT_PARTY && sc_data[SC_GOSPEL].val3 == 14) hit += hit*5/100; + if(sc_data[SC_EXPLOSIONSPIRITS].timer!=-1) + hit += 20*sc_data[SC_EXPLOSIONSPIRITS].val1; } } if(hit < 1) hit = 1; @@ -2130,6 +2135,10 @@ int status_get_atk(struct block_list *bl) atk -= atk*25/100; if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション atk += atk*(5*sc_data[SC_CONCENTRATION].val1)/100; + if(sc_data[SC_EXPLOSIONSPIRITS].timer!=-1) + atk += (1000*sc_data[SC_EXPLOSIONSPIRITS].val1); + if(sc_data[SC_STRIPWEAPON].timer!=-1) + atk -= atk*10/100; if(sc_data[SC_GOSPEL].timer!=-1) { if (sc_data[SC_GOSPEL].val4 == BCT_PARTY && @@ -2191,6 +2200,8 @@ int status_get_atk2(struct block_list *bl) atk2 = atk2*sc_data[SC_STRIPWEAPON].val2/100; if(sc_data[SC_CONCENTRATION].timer!=-1) //コンセントレーション atk2 += atk2*(5*sc_data[SC_CONCENTRATION].val1)/100; + if(sc_data[SC_EXPLOSIONSPIRITS].timer!=-1) + atk2 += (1000*sc_data[SC_EXPLOSIONSPIRITS].val1); } if(atk2 < 0) atk2 = 0; return atk2; @@ -2471,8 +2482,11 @@ int status_get_speed(struct block_list *bl) if(sc_data) { //速度増加時は25%減算 - if(sc_data[SC_INCREASEAGI].timer!=-1 && sc_data[SC_DONTFORGETME].timer == -1) + if(sc_data[SC_INCREASEAGI].timer!=-1) speed -= speed*25/100; + //ウィンドウォーク時はLv*2%減算 + else if(sc_data[SC_WINDWALK].timer!=-1) + speed -= (speed*(sc_data[SC_WINDWALK].val1*2))/100; //速度減少時は25%加算 if(sc_data[SC_DECREASEAGI].timer!=-1) speed = speed*125/100; @@ -2495,9 +2509,6 @@ int status_get_speed(struct block_list *bl) //呪い時は450加算 if(sc_data[SC_CURSE].timer!=-1) speed = speed + 450; - //ウィンドウォーク時はLv*2%減算 - if(sc_data[SC_WINDWALK].timer!=-1 && sc_data[SC_INCREASEAGI].timer==-1) - speed -= (speed*(sc_data[SC_WINDWALK].val1*2))/100; if(sc_data[SC_SLOWDOWN].timer!=-1) speed = speed*150/100; if(sc_data[SC_SPEEDUP0].timer!=-1) @@ -3050,6 +3061,13 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val if(type==SC_FREEZE && undead_flag && !(flag&1)) return 0; + if (type==SC_BLESSING && (bl->type==BL_PC || (!undead_flag && race!=6))) { + if (sc_data[SC_CURSE].timer!=-1) + status_change_end(bl,SC_CURSE,-1); + if (sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2==0) + status_change_end(bl,SC_STONE,-1); + } + if((type == SC_ADRENALINE || type == SC_WEAPONPERFECTION || type == SC_OVERTHRUST) && sc_data[type].timer != -1 && sc_data[type].val2 && !val2) return 0; @@ -3066,15 +3084,25 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val if(sc_data[type].timer != -1){ /* すでに同じ異常になっている場合タイマ解除 */ if(sc_data[type].val1 > val1 && type != SC_COMBO && type != SC_DANCING && type != SC_DEVOTION && type != SC_SPEEDPOTION0 && type != SC_SPEEDPOTION1 && type != SC_SPEEDPOTION2 && type != SC_SPEEDPOTION3 - && type != SC_ATKPOT && type != SC_MATKPOT) // added atk and matk potions [Valaris] + && type != SC_ATKPOT && type != SC_MATKPOT) // added atk and matk potions [Valaris] return 0; + if ((type >=SC_STAN && type <= SC_BLIND) || type == SC_DPOISON) return 0;/* ?ぎ足しができない?態異常である時は?態異常を行わない */ + (*sc_count)--; delete_timer(sc_data[type].timer, status_change_timer); sc_data[type].timer = -1; } + // クアグマイア/私を忘れないで中は無効なスキル + if ((sc_data[SC_QUAGMIRE].timer!=-1 || sc_data[SC_DONTFORGETME].timer!=-1) && + (type==SC_CONCENTRATE || type==SC_INCREASEAGI || + type==SC_TWOHANDQUICKEN || type==SC_SPEARSQUICKEN || + type==SC_ADRENALINE || type==SC_LOUD || type==SC_TRUESIGHT || + type==SC_WINDWALK || type==SC_CARTBOOST || type==SC_ASSNCROS)) + return 0; + switch(type){ /* 異常の種類ごとの?理 */ case SC_PROVOKE: /* プロボック */ calc_flag = 1; @@ -3093,23 +3121,13 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val status_change_start(bl,SC_PROVOKE,10,1,0,0,0,0); } break; + case SC_CONCENTRATE: /* 集中力向上 */ - calc_flag = 1; - break; case SC_BLESSING: /* ブレッシング */ - { - if(bl->type == BL_PC || (!undead_flag && race != 6)) { - if(sc_data[SC_CURSE].timer!=-1 ) - status_change_end(bl,SC_CURSE,-1); - if(sc_data[SC_STONE].timer!=-1 && sc_data[SC_STONE].val2 == 0) - status_change_end(bl,SC_STONE,-1); - } - calc_flag = 1; - } - break; case SC_ANGELUS: /* アンゼルス */ calc_flag = 1; break; + case SC_INCREASEAGI: /* 速度上昇 */ calc_flag = 1; if(sc_data[SC_DECREASEAGI].timer!=-1 ) @@ -3151,16 +3169,21 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val case SC_ADRENALINE: /* アドレナリンラッシュ */ if(sc_data[SC_DECREASEAGI].timer!=-1) return 0; + if(bl->type == BL_PC) + if(pc_checkskill(sd,BS_HILTBINDING)>0) + tick *= 1.1; calc_flag = 1; break; case SC_WEAPONPERFECTION: /* ウェポンパ?フェクション */ - // Lasting time penalties have been removed on sakray as of 12/14 [celest] - //if(battle_config.party_skill_penalty && !val2) tick /= 5; + if(bl->type == BL_PC) + if(pc_checkskill(sd,BS_HILTBINDING)>0) + tick *= 1.1; break; case SC_OVERTHRUST: /* オ?バ?スラスト */ + if(bl->type == BL_PC) + if(pc_checkskill(sd,BS_HILTBINDING)>0) + tick *= 1.1; *opt3 |= 2; - // Lasting time penalties have been removed on sakray as of 12/14 [celest] - //if(battle_config.party_skill_penalty && !val2) tick /= 10; break; case SC_MAXIMIZEPOWER: /* マキシマイズパワ?(SPが1減る時間,val2にも) */ if(bl->type == BL_PC) @@ -3624,10 +3647,9 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val break; case SC_TENSIONRELAX: /* テンションリラックス */ - calc_flag = 1; if(bl->type == BL_PC) { tick = 10000; - } + } else return 0; break; case SC_AURABLADE: /* オ?ラブレ?ド */ @@ -3746,7 +3768,7 @@ int status_change_start(struct block_list *bl,int type,int val1,int val2,int val break; case SC_MEMORIZE: /* メモライズ */ - val2 = 3; //3回詠唱を1/3にする + val2 = 5; //回詠唱を1/3にする break; case SC_SPLASHER: /* ベナムスプラッシャ? */ @@ -4001,10 +4023,7 @@ int status_change_end( struct block_list* bl , int type,int tid ) case SC_APPLEIDUN: /* イドゥンの林檎 */ case SC_RIDING: case SC_BLADESTOP_WAIT: - case SC_AURABLADE: /* オ?ラブレ?ド */ - case SC_PARRYING: /* パリイング */ case SC_CONCENTRATION: /* コンセントレ?ション */ - case SC_TENSIONRELAX: /* テンションリラックス */ case SC_ASSUMPTIO: /* アシャンプティオ */ case SC_WINDWALK: /* ウインドウォ?ク */ case SC_TRUESIGHT: /* トゥル?サイト */ @@ -4015,6 +4034,7 @@ int status_change_end( struct block_list* bl , int type,int tid ) case SC_MATKPOT: /* magic attack potion [Valaris] */ case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) case SC_MELTDOWN: /* メルトダウン */ + case SC_MINDBREAKER: /* マインドブレーカー */ // Celest case SC_EDP: case SC_SLOWDOWN: -- cgit v1.2.3-70-g09d2 From b5735b90f5ec847a89acd80509e8ba2ce23a3905 Mon Sep 17 00:00:00 2001 From: celest Date: Tue, 22 Mar 2005 16:31:56 +0000 Subject: Check changelog ^^ git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1267 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 21 +++++++- conf-tmpl/battle_athena.conf | 9 ++-- conf-tmpl/msg_athena.conf | 8 ++++ db/Changelog.txt | 1 + db/item_db.txt | 30 ++++++------ npc/Changelog.txt | 2 + npc/quests/juice_maker.txt | 2 +- src/common/core.c | 13 +++-- src/map/atcommand.c | 111 ++++++++++++++++--------------------------- src/map/battle.c | 13 +---- src/map/battle.h | 4 -- src/map/itemdb.c | 8 +--- src/map/map.c | 2 +- src/map/map.h | 2 + src/map/mob.c | 17 ++++--- src/map/npc.c | 19 ++++---- src/map/pc.c | 26 ++++------ src/map/script.c | 6 +-- src/map/skill.c | 76 +++++++++++++---------------- src/map/status.c | 3 +- src/map/storage.c | 15 ++++-- src/map/trade.c | 8 ++-- 22 files changed, 185 insertions(+), 211 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index f9eb4276c..74b25e370 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -2,6 +2,25 @@ Date Added 03/22 * Fixed Alchemist's CANNIBALIZE, now it summons correct # of plants. With their real HP [Lupus] + * Updated @reloadmobdb, @reloadskilldb, @reloaditemdb [celest] + * Some tidying up in @reloadscript (more work needed) [celest] + * Moved some gm command messages to msg_athena.conf [celest] + * Removed skill_range_leniency [celest] + * Removed enable_upper_class [celest] + * Removed riding_weight [celest] + * Added signal handler for SIGPIPE [celest] + * Updated Frost Joke to affect everyone else in PvP/GvG, thanks to veider + * Corrected Detect Trap range to be based on level, thanks to veider + * Updated Tunnel Drive's movement speed, thanks to veider + * Removed cdp_rate, suggested by leinsirk10 + * Fixed a typo in Acid Terror, thanks to leinsirk10 + * Fixed some typos/memory leak in script cleaning up, thanks to leinsirk10 + * Added gm_can_drop_lv limitations for trading and opening storage, thanks to + Dino9021 + * Changed shop_exp's calculation to use 0.01% increments, suggested by tcdiem + * Refixed "--en/ja--" usage in 'monster' script not working properly, thanks + to sbilly + 03/21 * Moved /tool and /webserver to under /src and added 'make tools' and 'make web-server' [celest] @@ -86,8 +105,6 @@ Date Added - Should be made as an option of battle_athena.conf 03/11 - * Fixed "--en/ja--" usage in 'monster' script not working properly, thanks - to sbilly [celest] * Speedup player autosaving -- don't save guild castle data at the same time, thanks to Alex14 [celest] * Optimised guild castle saving when autosaving player data, thanks to Yor / diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index ef0802342..06f6a90ab 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -339,8 +339,9 @@ heal_exp: 0 // Experience calculations for the experience value * level difference of the person revived / 100 * resurrection_exp/10000 which the revived player has can be got. resurrection_exp: 0 -// The rate of job exp. when using discount and overcharge on an NPC (100 is normal, 200 is double.) -// The way it is calculated is (money recieved * skill lv) * shop_exp / 100. +// The rate of job exp. when using discount and overcharge on an NPC +// (in 0.01% increments - 100 is 1%, 10000 is normal, 20000 is double.) +// The way it is calculated is (money recieved * skill lv) * shop_exp / 10000. shop_exp: 0 // The delay rate of monk's combo (Note 2) @@ -791,10 +792,6 @@ mobs_level_up: no // Use kRO new steal formula? skill_steal_type: yes -// Sometimes when using skills while walking it'll fail because of range being too -// far, should we allow this to happen? (Setting this at 1 would be enough) -skill_range_leniency: 1 - // Set this to 1 if your clients have langtype problems and can't display motd properly motd_type: 0 diff --git a/conf-tmpl/msg_athena.conf b/conf-tmpl/msg_athena.conf index 7c9119dd6..afb482043 100644 --- a/conf-tmpl/msg_athena.conf +++ b/conf-tmpl/msg_athena.conf @@ -257,6 +257,14 @@ 243: Map skills are off 244: Map skills are on 245: Server Uptime: %ld days, %ld hours, %ld minutes, %ld seconds. +246: Your GM level don't authorise you to do this action. +247: You are not authorised to warp to this map. +248: You are not authorised to warp from your current map. +249: You are not authorised to warp to your save map. +250: You have already opened your storage. Close it first. +251: You have already opened your guild storage. Close it first. +252: You are not in a guild. +253: You are not authorised to memo this map. // Messages of others (not for GM commands) // ---------------------------------------- diff --git a/db/Changelog.txt b/db/Changelog.txt index 30a69ddd9..b995b3394 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -6,6 +6,7 @@ Skill databases == celest working on them i believe. 03/22 + * Corrected some typos in the items DB, thanks to Zoc [celest] * Added new items. Thanks to Landarma [Lupus] * skill CANNIBALIZE: fixed its upkeep time [Lupus] * Added Rafflesia into Dead Branch monsters list, removen all MVPs from there [Lupus] diff --git a/db/item_db.txt b/db/item_db.txt index aa0ab034e..40a5823ee 100644 --- a/db/item_db.txt +++ b/db/item_db.txt @@ -71,10 +71,10 @@ 568,Lemon,Lemon,0,20,0,20,,,,,0,3,,,,,{},{} 569,Novice's_Red_Potion,Novices Red Potion,0,50,0,70,,,,,10477567,2,,,,,{ itemheal rand(45,64),0; },{} // st.Valentine's Day Items -570,Fortune_Candy,Fortune Candy,0,10,0,30,,,,,10477567,2,,,,{ itemheal rand(45,64),0; },{} -571,Fortune_Candy_Cane,Fortune Candy Cane,0,20,0,40,,,,,10477567,2,,,,{ itemheal rand(105,144),0; },{} -572,Fortune_Cookie,Fortune Cookie,0,15,0,30,,,,,10477567,2,,,,{ itemheal rand(45,64),0; },{} -573,Chocolate_Drink,Chocolate Drink,0,20,0,150,,,,,10477567,2,,,,{ itemheal rand(105,144),0; },{} +570,Fortune_Candy,Fortune Candy,0,10,0,30,,,,,10477567,2,,,,,{ itemheal rand(45,64),0; },{} +571,Fortune_Candy_Cane,Fortune Candy Cane,0,20,0,40,,,,,10477567,2,,,,,{ itemheal rand(105,144),0; },{} +572,Fortune_Cookie,Fortune Cookie,0,15,0,30,,,,,10477567,2,,,,,{ itemheal rand(45,64),0; },{} +573,Chocolate_Drink,Chocolate Drink,0,20,0,150,,,,,10477567,2,,,,,{ itemheal rand(105,144),0; },{} 574,Egg,Egg,0,0,,30,,,,,10477567,2,,,,,{ itemheal rand(16,21),0; },{} // Usable Items @@ -1781,17 +1781,17 @@ 7303,Rice_Bag,Rice Straw Bag,3,20,0,800,,,,,,,,,,,{},{} // 2005 -7304,Witchs_Spellbook,Witch's Spellbook,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7305,Unknown_item,Authority of 9 worlds,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7306,Piece_of_Soul,Piece of Soul,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7307,Whisper_of_Soul,Whisper of Soul,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7308,Witchs_Potion,Witch's Potion,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7309,Crows_Wing,Crow's Wing,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7310,Peco_Coupon,Pecopeco Free Coupon,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7311,Airship_Coupon,Airship Free Coupon,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7312,Jubile,Jubilaeum,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7313,Witch\'s_Voucher,Witch's Voucher,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} -7314,The_Sign,The Sign,3,20,0,10,0,0,0,0,0,0,0,0,0,0,0,{},{} +7304,Witchs_Spellbook,Witch's Spellbook,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7305,Unknown_item,Authority of 9 worlds,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7306,Piece_of_Soul,Piece of Soul,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7307,Whisper_of_Soul,Whisper of Soul,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7308,Witchs_Potion,Witch's Potion,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7309,Crows_Wing,Crow's Wing,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7310,Peco_Coupon,Pecopeco Free Coupon,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7311,Airship_Coupon,Airship Free Coupon,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7312,Jubile,Jubilaeum,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7313,Witch\'s_Voucher,Witch's Voucher,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} +7314,The_Sign,The Sign,3,20,0,10,0,0,0,0,0,0,0,0,0,0,{},{} 7315,Black_Quartz_Piece,Piece of Black Quartz,3,,,10,0,0,0,0,0,0,0,0,0,0,0,{},{} 7316,Insect_Long_leg,Insect's Long Leg,3,,,10,0,0,0,0,0,0,0,0,0,0,0,{},{} diff --git a/npc/Changelog.txt b/npc/Changelog.txt index b1739129b..7a1a644e0 100644 --- a/npc/Changelog.txt +++ b/npc/Changelog.txt @@ -35,6 +35,8 @@ Other Ppl Date Added ====== +03/22 + * Moved position for Marx Hansen to payon_in03, thanks to Dino9021 [celest] 03/18 * Reduced label name length in heal_payment.txt [celest] * Added Sara-chan's Einbroch/Einbech city warps [celest] diff --git a/npc/quests/juice_maker.txt b/npc/quests/juice_maker.txt index a41d6ad0f..c94d9234d 100644 --- a/npc/quests/juice_maker.txt +++ b/npc/quests/juice_maker.txt @@ -181,7 +181,7 @@ L_Juice: } // Juicer Marx Hansen --------------------------------------------------------- -payon_in01.gat,5,48,7 script Juicer Marx Hansen 86,{ +payon_in03.gat,188,146,5 script Juicer Marx Hansen 86,{ mes "[Juicer Marx Hansen]"; if(MARIANNE == 1) goto L_Juice; mes "Welcome to my shop. What brings you here?"; diff --git a/src/common/core.c b/src/common/core.c index 02ba004ae..96d2c872b 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -76,7 +76,11 @@ sigfunc *compat_signal(int signo, sigfunc *func) * CORE : Signal Sub Function *-------------------------------------- */ - +// for handling certain signals ourselves, like SIGPIPE +static void sig_ignore(int sn) { + printf ("Broken pipe found... closing socket\n"); // set to eof in socket.c + return; // does nothing here +} static void sig_proc(int sn) { int i; @@ -137,8 +141,7 @@ void sig_dump(int sn) fprintf(fp, "Exception: %s \n", strsignal(sn)); fflush (fp); - - #ifdef CYGWIN + #ifdef CYGWIN cygwin_stackdump (); #else fprintf(fp, "Stack trace:\n"); @@ -153,7 +156,7 @@ void sig_dump(int sn) printf ("Done.\n"); fflush(stdout); - fclose(fp); + fclose(fp); } // Pass the signal to the system's default handler compat_signal(sn, SIG_DFL); @@ -289,7 +292,7 @@ int main(int argc,char **argv) Net_Init(); do_socket(); - compat_signal(SIGPIPE,SIG_IGN); + compat_signal(SIGPIPE, sig_ignore); compat_signal(SIGTERM,sig_proc); compat_signal(SIGINT,sig_proc); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 2964c8ce4..6f037c216 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -829,15 +829,11 @@ AtCommandType atcommand(struct map_session_data* sd, const int level, const char *------------------------------------------ */ static int atkillmonster_sub(struct block_list *bl, va_list ap) { - int flag = va_arg(ap, int); - - nullpo_retr(0, bl); - - if (flag) - mob_damage(NULL, (struct mob_data *)bl, ((struct mob_data *)bl)->hp, 2); - else - mob_delete((struct mob_data *)bl); + struct mob_data *md; + nullpo_retr(0, md=(struct mob_data *)bl); + mob_damage(NULL, md, md->hp, 2); + return 0; } /*========================================== @@ -893,34 +889,6 @@ static int atcommand_cleanmap_sub(struct block_list *bl,va_list ap) return 0; } -static int atkillnpc_sub(struct block_list *bl, va_list ap) -{ - int flag = va_arg(ap,int); - - nullpo_retr(0, bl); - - npc_delete((struct npc_data *)bl); - - flag = 0; - - return 0; -} - -void rehash( const int fd, struct map_session_data* sd ) -{ - int map_id = 0; - - int LOADED_MAPS = map_num; - - for (map_id = 0; map_id < LOADED_MAPS;map_id++) { - - if (map_id > LOADED_MAPS) - break; - - map_foreachinarea(atkillmonster_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, BL_MOB, 0); - map_foreachinarea(atkillnpc_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, BL_NPC, 0); - } -} /*========================================== * Read Message Data @@ -1078,11 +1046,11 @@ int atcommand_rura( if (x > 0 && x < 400 && y > 0 && y < 400) { m = map_mapname2mapid(map_name); if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to this map."); + clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } if (pc_setpos(sd, map_name, x, y, 3) == 0) @@ -1161,11 +1129,11 @@ int atcommand_jumpto( if ((pl_sd = map_nick2sd(character)) != NULL) { if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to the map of this player."); + clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(sd, pl_sd->mapname, pl_sd->bl.x, pl_sd->bl.y, 3); @@ -1201,12 +1169,8 @@ int atcommand_jump( if (y <= 0) y = rand() % 399 + 1; if (x > 0 && x < 400 && y > 0 && y < 400) { - if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to your actual map."); - return -1; - } - if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + if (sd->bl.m >= 0 && (map[sd->bl.m].flag.nowarp || map[sd->bl.m].flag.nowarpto) && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { + clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(sd, sd->mapname, x, y, 3); @@ -1815,11 +1779,11 @@ int atcommand_load( m = map_mapname2mapid(sd->status.save_point.map); if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to your save map."); + clif_displaymessage(fd, msg_table[249]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } @@ -1878,12 +1842,12 @@ int atcommand_storage( nullpo_retr(-1, sd); if (sd->state.storage_flag == 1) { - clif_displaymessage(fd, "You have opened your guild storage. Close it before."); + clif_displaymessage(fd, msg_table[250]); return -1; } if ((stor = account2storage2(sd->status.account_id)) != NULL && stor->storage_status == 1) { - clif_displaymessage(fd, "You have already opened your storage."); + clif_displaymessage(fd, msg_table[250]); return -1; } @@ -1906,16 +1870,16 @@ int atcommand_guildstorage( if (sd->status.guild_id > 0) { if (sd->state.storage_flag == 1) { - clif_displaymessage(fd, "You have already opened your guild storage."); + clif_displaymessage(fd, msg_table[251]); return -1; } if ((stor = account2storage2(sd->status.account_id)) != NULL && stor->storage_status == 1) { - clif_displaymessage(fd, "Your storage is opened. Close it before."); + clif_displaymessage(fd, msg_table[251]); return -1; } storage_guild_storageopen(sd); } else { - clif_displaymessage(fd, "You are not in a guild."); + clif_displaymessage(fd, msg_table[252]); return -1; } @@ -3066,11 +3030,11 @@ int atcommand_go( if (sd->status.memo_point[-town-1].map[0]) { m = map_mapname2mapid(sd->status.memo_point[-town-1].map); if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to this memo map."); + clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } if (pc_setpos(sd, sd->status.memo_point[-town-1].map, sd->status.memo_point[-town-1].x, sd->status.memo_point[-town-1].y, 3) == 0) { @@ -3087,11 +3051,11 @@ int atcommand_go( } else if (town >= 0 && town < (int)(sizeof(data) / sizeof(data[0]))) { m = map_mapname2mapid((char *)data[town].map); if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to this destination map."); + clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } if (pc_setpos(sd, (char *)data[town].map, data[town].x, data[town].y, 3) == 0) { @@ -3675,7 +3639,7 @@ int atcommand_memo( else { if (position >= MIN_PORTAL_MEMO && position <= MAX_PORTAL_MEMO) { if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to memo this map."); + clif_displaymessage(fd, msg_table[253]); return -1; } if (sd->status.memo_point[position].map[0]) { @@ -5697,15 +5661,24 @@ int atcommand_reloadskilldb( * *------------------------------------------ */ +void rehash(void) +{ + int map_id; + + for (map_id = 0; map_id < map_num; map_id++) { + map_foreachinarea(cleanup_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, BL_MOB); + map_foreachinarea(cleanup_sub, map_id, 0, 0, map[map_id].xs, map[map_id].ys, BL_NPC); + } +} int atcommand_reloadscript( const int fd, struct map_session_data* sd, const char* command, const char* message) { nullpo_retr(-1, sd); - atcommand_broadcast( fd, sd, "@broadcast", "eAthena SQL Server is Rehashing..." ); + atcommand_broadcast( fd, sd, "@broadcast", "eAthena Server is Rehashing..." ); atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" ); - rehash( fd, sd ); + rehash(); atcommand_broadcast( fd, sd, "@broadcast", "Reloading NPCs..." ); do_init_npc(); @@ -8376,11 +8349,11 @@ int atcommand_jumptoid( { if ((pl_sd = session[session_id]->session_data) != NULL) { if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to the map of this player."); + clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(sd, pl_sd->mapname, pl_sd->bl.x, pl_sd->bl.y, 3); @@ -8431,11 +8404,11 @@ int atcommand_jumptoid2( { if ((pl_sd = session[session_id]->session_data) != NULL) { if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to the map of this player."); + clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(sd, pl_sd->mapname, pl_sd->bl.x, pl_sd->bl.y, 3); @@ -8486,11 +8459,11 @@ int atcommand_recallid( if ((pl_sd = session[session_id]->session_data) != NULL) { if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can recall only lower or same level if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to the map of this player."); + clif_displaymessage(fd, msg_table[247]); return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(pl_sd, sd->mapname, sd->bl.x, sd->bl.y, 2); @@ -8545,11 +8518,11 @@ int atcommand_recallid2( if ((pl_sd = session[session_id]->session_data) != NULL) { if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can recall only lower or same level if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you to the map of this player."); - return -1; + clif_displaymessage(fd, msg_table[247]); + return -1; } if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp you from your actual map."); + clif_displaymessage(fd, msg_table[248]); return -1; } pc_setpos(pl_sd, sd->mapname, sd->bl.x, sd->bl.y, 2); diff --git a/src/map/battle.c b/src/map/battle.c index 81b2c3189..3c3442c60 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -1441,7 +1441,7 @@ static struct Damage battle_calc_mob_weapon_attack( if( skill_num!=NPC_CRITICALSLASH ){ // 対 象の防御力によるダメージの減少 // ディバインプロテクション(ここでいいのかな?) - if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && skill_num != KN_AUTOCOUNTER && def1 < 1000000) { //DEF, VIT無視 + if ( skill_num != MO_INVESTIGATE && skill_num != MO_EXTREMITYFIST && skill_num != KN_AUTOCOUNTER && skill_num != AM_ACIDTERROR && def1 < 1000000) { //DEF, VIT無視 int t_def; target_count = 1 + battle_counttargeted(target,src,battle_config.vit_penalty_count_lv); if(battle_config.vit_penalty_type > 0) { @@ -3958,7 +3958,6 @@ static const struct { { "player_skillup_limit", &battle_config.skillup_limit }, { "weapon_produce_rate", &battle_config.wp_rate }, { "potion_produce_rate", &battle_config.pp_rate }, - { "deadly_potion_produce_rate", &battle_config.cdp_rate }, { "monster_active_enable", &battle_config.monster_active_enable }, { "monster_damage_delay_rate", &battle_config.monster_damage_delay_rate}, { "monster_loot_type", &battle_config.monster_loot_type }, @@ -4058,7 +4057,6 @@ static const struct { { "dead_branch_active", &battle_config.dead_branch_active }, { "vending_max_value", &battle_config.vending_max_value }, { "show_steal_in_same_party", &battle_config.show_steal_in_same_party }, - { "enable_upper_class", &battle_config.enable_upper_class }, { "pet_attack_attr_none", &battle_config.pet_attack_attr_none }, { "mob_attack_attr_none", &battle_config.mob_attack_attr_none }, { "mob_ghostring_fix", &battle_config.mob_ghostring_fix }, @@ -4075,7 +4073,6 @@ static const struct { { "skill_removetrap_type", &battle_config.skill_removetrap_type }, { "disp_experience", &battle_config.disp_experience }, { "castle_defense_rate", &battle_config.castle_defense_rate }, - { "riding_weight", &battle_config.riding_weight }, { "hp_rate", &battle_config.hp_rate }, { "sp_rate", &battle_config.sp_rate }, { "gm_can_drop_lv", &battle_config.gm_can_drop_lv }, @@ -4131,7 +4128,6 @@ static const struct { { "skill_steal_type", &battle_config.skill_steal_type}, // [celest] { "skill_steal_rate", &battle_config.skill_steal_rate}, // [celest] { "night_darkness_level", &battle_config.night_darkness_level}, // [celest] - { "skill_range_leniency", &battle_config.skill_range_leniency}, // [celest] { "motd_type", &battle_config.motd_type}, // [celest] { "allow_atcommand_when_mute", &battle_config.allow_atcommand_when_mute}, // [celest] { "finding_ore_rate", &battle_config.finding_ore_rate}, // [celest] @@ -4208,7 +4204,6 @@ void battle_set_defaults() { battle_config.skillup_limit = 0; battle_config.wp_rate=100; battle_config.pp_rate=100; - battle_config.cdp_rate=100; battle_config.monster_active_enable=1; battle_config.monster_damage_delay_rate=100; battle_config.monster_loot_type=0; @@ -4308,7 +4303,6 @@ void battle_set_defaults() { battle_config.dead_branch_active = 0; battle_config.vending_max_value = 10000000; battle_config.show_steal_in_same_party = 0; - battle_config.enable_upper_class = 0; battle_config.pet_attack_attr_none = 0; battle_config.pc_attack_attr_none = 0; battle_config.mob_attack_attr_none = 1; @@ -4325,7 +4319,6 @@ void battle_set_defaults() { battle_config.skill_removetrap_type = 0; battle_config.disp_experience = 0; battle_config.castle_defense_rate = 100; - battle_config.riding_weight = 0; battle_config.hp_rate = 100; battle_config.sp_rate = 100; battle_config.gm_can_drop_lv = 0; @@ -4380,7 +4373,6 @@ void battle_set_defaults() { battle_config.skill_steal_type = 1; battle_config.skill_steal_rate = 100; battle_config.night_darkness_level = 9; - battle_config.skill_range_leniency = 1; battle_config.motd_type = 0; battle_config.allow_atcommand_when_mute = 0; battle_config.finding_ore_rate = 100; @@ -4511,9 +4503,6 @@ void battle_validate_conf() { if (battle_config.night_darkness_level > 10) // Celest battle_config.night_darkness_level = 10; - if (battle_config.skill_range_leniency < 0) // Celest - battle_config.skill_range_leniency = 0; - if (battle_config.motd_type < 0) battle_config.motd_type = 0; else if (battle_config.motd_type > 1) diff --git a/src/map/battle.h b/src/map/battle.h index 63681360a..a4758ab80 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -131,7 +131,6 @@ extern struct Battle_Config { int skillup_limit; int wp_rate; int pp_rate; - int cdp_rate; int monster_active_enable; int monster_damage_delay_rate; int monster_loot_type; @@ -232,7 +231,6 @@ extern struct Battle_Config { // int pet_lootitem; // removed [Valaris] // int pet_weight; // removed [Valaris] int show_steal_in_same_party; - int enable_upper_class; int pet_attack_attr_none; int mob_attack_attr_none; int mob_ghostring_fix; @@ -273,7 +271,6 @@ extern struct Battle_Config { int skill_removetrap_type; int disp_experience; int castle_defense_rate; - int riding_weight; int backstab_bow_penalty; int hp_rate; int sp_rate; @@ -309,7 +306,6 @@ extern struct Battle_Config { int skill_steal_type; // [celest] int skill_steal_rate; // [celest] int night_darkness_level; // [celest] - int skill_range_leniency; // [celest] int motd_type; // [celest] int allow_atcommand_when_mute; // [celest] int finding_ore_rate; // orn diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 82149946d..c37274cb9 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -929,13 +929,7 @@ static int itemdb_final(void *key,void *data,va_list ap) void itemdb_reload(void) { - /* - - - itemdb_read(); - - */ - + numdb_final(item_db,itemdb_final); do_init_itemdb(); } diff --git a/src/map/map.c b/src/map/map.c index 1ee3840c7..60d41b84e 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3120,7 +3120,7 @@ int map_db_final(void *k,void *d,va_list ap) } int nick_db_final(void *k,void *d,va_list ap){ return 0; } int charid_db_final(void *k,void *d,va_list ap){ return 0; } -static int cleanup_sub(struct block_list *bl, va_list ap) { +int cleanup_sub(struct block_list *bl, va_list ap) { nullpo_retr(0, bl); switch(bl->type) { diff --git a/src/map/map.h b/src/map/map.h index 8039615f7..aeb47136c 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -791,6 +791,8 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count); int map_who(int fd); +int cleanup_sub(struct block_list *bl, va_list ap); + void map_helpscreen(); // [Valaris] int map_delmap(char *mapname); diff --git a/src/map/mob.c b/src/map/mob.c index 3cfb4e6d5..7a39af029 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4352,14 +4352,17 @@ static int mob_readdb_race(void) void mob_reload(void) { - /* - - - mob_read(); - - */ +#ifndef TXT_ONLY + if(db_use_sqldbs) + mob_read_sqldb(); + else +#endif /* TXT_ONLY */ + mob_readdb(); - do_init_mob(); + mob_readdb_mobavail(); + mob_read_randommonster(); + mob_readskilldb(); + mob_readdb_race(); } #ifndef TXT_ONLY diff --git a/src/map/npc.c b/src/map/npc.c index 018ceae01..eb3f33ac5 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1106,7 +1106,7 @@ int npc_buylist(struct map_session_data *sd,int n,unsigned short *item_list) if (sd->status.skill[MC_DISCOUNT].flag != 0) skill = sd->status.skill[MC_DISCOUNT].flag - 2; if (skill > 0) { - z = z * (double)skill * (double)battle_config.shop_exp/100.; + z = z * (double)skill * (double)battle_config.shop_exp/10000.; if (z < 1) z = 1; pc_gainexp(sd,0,(int)z); @@ -1166,7 +1166,7 @@ int npc_selllist(struct map_session_data *sd,int n,unsigned short *item_list) if (sd->status.skill[MC_OVERCHARGE].flag != 0) skill = sd->status.skill[MC_OVERCHARGE].flag - 2; if (skill > 0) { - z = z * (double)skill * (double)battle_config.shop_exp/100.; + z = z * (double)skill * (double)battle_config.shop_exp/10000.; if (z < 1) z = 1; pc_gainexp(sd,0,(int)z); @@ -2094,16 +2094,13 @@ int npc_parse_mob(char *w1,char *w2,char *w3,char *w4) md->bl.x=x; md->bl.y=y; - if(sscanf(w3,"%[^,],%d",mobname,&level) > 1) { - if(strcmp(mobname,"--en--")==0) - memcpy(md->name,mob_db[class_].name,24); - else if(strcmp(mobname,"--ja--")==0) - memcpy(md->name,mob_db[class_].jname,24); + if(sscanf(w3,"%[^,],%d",mobname,&level) > 1) md->level=level; - } - - else - memcpy(md->name,w3,24); + if(strcmp(mobname,"--en--")==0) + memcpy(md->name,mob_db[class_].name,24); + else if(strcmp(mobname,"--ja--")==0) + memcpy(md->name,mob_db[class_].jname,24); + else memcpy(md->name,mobname,24); md->n = i; md->base_class = md->class_ = class_; diff --git a/src/map/pc.c b/src/map/pc.c index 9e607f560..07e712dbe 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -978,13 +978,11 @@ int pc_calc_skilltree(struct map_session_data *sd) if(i==331) continue; sd->status.skill[i].id=i; } - if(battle_config.enable_upper_class){ //confで無?でなければ?み?む - for(i=355;i<411;i++) - sd->status.skill[i].id=i; - for(i=475;i<480;i++) - sd->status.skill[i].id=i; - } - }else{ + for(i=355;i<411;i++) + sd->status.skill[i].id=i; + for(i=475;i<480;i++) + sd->status.skill[i].id=i; + } else { do { flag=0; for(i=0;(id=skill_tree[s][c][i].id)>0;i++){ @@ -3611,10 +3609,6 @@ struct pc_base_job pc_calc_base_job(int b_class) bj.upper = 2; } - if(battle_config.enable_upper_class==0){ //confで無?になっていたらupper=0 - bj.upper = 0; - } - if(bj.job == 0){ bj.type = 0; }else if(bj.job < 7){ @@ -4355,12 +4349,10 @@ int pc_allskillup(struct map_session_data *sd) if(i==331) continue; sd->status.skill[i].lv=skill_get_max(i); } - if(battle_config.enable_upper_class){ //confで無?でなければ?み?む - for(i=355;i<411;i++) - sd->status.skill[i].lv=skill_get_max(i); - for(i=475;i<480;i++) - sd->status.skill[i].lv=skill_get_max(i); - } + for(i=355;i<411;i++) + sd->status.skill[i].lv=skill_get_max(i); + for(i=475;i<480;i++) + sd->status.skill[i].lv=skill_get_max(i); } else { for(i=0;(id=skill_tree[s][c][i].id)>0;i++){ diff --git a/src/map/script.c b/src/map/script.c index fd2068cbd..a732f7bc4 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -7833,11 +7833,11 @@ int do_final_script() if (script_config.die_event_name) aFree(script_config.die_event_name); if (script_config.kill_event_name) - aFree(script_config.die_event_name); + aFree(script_config.kill_event_name); if (script_config.login_event_name) - aFree(script_config.die_event_name); + aFree(script_config.login_event_name); if (script_config.logout_event_name) - aFree(script_config.die_event_name); + aFree(script_config.logout_event_name); return 0; } diff --git a/src/map/skill.c b/src/map/skill.c index b233f9c78..be8288beb 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -4812,7 +4812,7 @@ int skill_castend_pos2( struct block_list *src, int x,int y,int skillid,int skil case HT_DETECTING: /* ディテクティング */ { - const int range=7; + int range=skilllv*2+1; if(src->x!=x) x+=(src->x-x>0)?-range:range; if(src->y!=y) @@ -6915,14 +6915,13 @@ int skill_use_id( struct map_session_data *sd, int target_id, range = status_get_range(&sd->bl) - (range + 1); // be lenient if the skill was cast before we have moved to the correct position [Celest] if (sd->walktimer != -1) - range += battle_config.skill_range_leniency; + range++; else check_range_flag = 1; if(!battle_check_range(&sd->bl,bl,range)) { - if (check_range_flag && battle_check_range(&sd->bl,bl,range + battle_config.skill_range_leniency)) { - int dir, mask[8][2] = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}}; - dir = map_calc_dir(&sd->bl,bl->x,bl->y); - pc_walktoxy (sd, sd->bl.x + mask[dir][0] * battle_config.skill_range_leniency, - sd->bl.y + mask[dir][1] * battle_config.skill_range_leniency); + if (check_range_flag && battle_check_range(&sd->bl,bl,range + 1)) { + int mask[8][2] = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}}; + int dir = map_calc_dir(&sd->bl,bl->x,bl->y); + pc_walktoxy (sd, sd->bl.x + mask[dir][0], sd->bl.y + mask[dir][1]); } else return 0; } @@ -7177,14 +7176,13 @@ int skill_use_pos( struct map_session_data *sd, range = status_get_range(&sd->bl) - (range + 1); // be lenient if the skill was cast before we have moved to the correct position [Celest] if (sd->walktimer != -1) - range += battle_config.skill_range_leniency; + range ++; else check_range_flag = 1; if(!battle_check_range(&sd->bl,&bl,range)) { - if (check_range_flag && battle_check_range(&sd->bl,&bl,range + battle_config.skill_range_leniency)) { - int dir, mask[8][2] = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}}; - dir = map_calc_dir(&sd->bl,bl.x,bl.y); - pc_walktoxy (sd, sd->bl.x + mask[dir][0] * battle_config.skill_range_leniency, - sd->bl.y + mask[dir][1] * battle_config.skill_range_leniency); + if (check_range_flag && battle_check_range(&sd->bl,&bl,range + 1)) { + int mask[8][2] = {{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1},{1,0},{1,1}}; + int dir = map_calc_dir(&sd->bl,bl.x,bl.y); + pc_walktoxy (sd, sd->bl.x + mask[dir][0], sd->bl.y + mask[dir][1]); } else return 0; } @@ -7656,12 +7654,16 @@ int skill_frostjoke_scream(struct block_list *bl,va_list ap) if(src == bl)//自分には?かない return 0; - if(battle_check_target(src,bl,BCT_ENEMY) > 0) + if (map[src->m].flag.gvg || map[src->m].flag.pvp) skill_additional_effect(src,bl,skillnum,skilllv,BF_MISC,tick); - else if(battle_check_target(src,bl,BCT_PARTY) > 0) { - if(rand()%100 < 10)//PTメンバにも低確率でかかる(とりあえず10%) + // we freeze everybody except of ourselfes on pvp/gvg [veider] + else { + if(battle_check_target(src,bl,BCT_ENEMY) > 0) + skill_additional_effect(src,bl,skillnum,skilllv,BF_MISC,tick); + else if(battle_check_target(src,bl,BCT_PARTY) > 0 && rand()%100 < 10) skill_additional_effect(src,bl,skillnum,skilllv,BF_MISC,tick); } + // so on non-pvp/gvg we are just freezing as freezed before return 0; } @@ -8373,8 +8375,9 @@ int skill_unit_timer_sub( struct block_list *bl, va_list ap ) if(!unit->alive) return 0; + group=unit->group; - nullpo_retr(0, group=unit->group); + nullpo_retr(0, group); range = unit->range; /* onplace_timerイベント呼び出し */ @@ -8772,41 +8775,33 @@ int skill_produce_mix( struct map_session_data *sd, make_per += 500 + pc_checkskill(sd,AM_CP_WEAPON)*100 + pc_checkskill(sd,AM_CP_SHIELD)*100 + pc_checkskill(sd,AM_CP_ARMOR)*100 + pc_checkskill(sd,AM_CP_HELM)*100; else - make_per = 1000 + sd->status.base_level*30 + sd->paramc[3]*20 + sd->paramc[4]*15 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300; + make_per = 1000 + sd->status.base_level*30 + sd->paramc[3]*20 + sd->paramc[4]*15 + pc_checkskill(sd,AM_LEARNINGPOTION)*100 + pc_checkskill(sd,AM_PHARMACY)*300; } else if (skill_produce_db[idx].req_skill == ASC_CDP) { - make_per = 2000 + 40*sd->paramc[4] + 20*sd->paramc[5]; - //make_per = 20 + (20*sd->paramc[4])/50 + (20*sd->paramc[5])/100; + make_per = 2000 + 40*sd->paramc[4] + 20*sd->paramc[5]; } else { if(nameid == 998) make_per = 1500 + sd->status.job_level*35 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,skill_produce_db[idx].req_skill)*600; else make_per = 1000 + sd->status.job_level*35 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,skill_produce_db[idx].req_skill)*500; } - } - else { // Corrected rates [DracoRPG] + if(battle_config.pp_rate != 100) + make_per = make_per * battle_config.pp_rate / 100; + } else { // Corrected rates [DracoRPG] int add_per=0; if(pc_search_inventory(sd,989) >= 0) add_per = 400; else if(pc_search_inventory(sd,988) >= 0) add_per = 300; else if(pc_search_inventory(sd,987) >= 0) add_per = 200; else if(pc_search_inventory(sd,986) >= 0) add_per = 100; - wlv = itemdb_wlv(nameid); - make_per = 1500 + sd->status.job_level*35 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,skill_produce_db[idx].req_skill)*1000 + pc_checkskill(sd,BS_WEAPONRESEARCH)*100 + - ((wlv >= 3)? pc_checkskill(sd,BS_ORIDEOCON)*100 : 0) + add_per - (ele? 2500:0) - sc*((4-wlv)*500) - wlv*1000; + wlv = itemdb_wlv(nameid); + make_per = 1500 + sd->status.job_level*35 + sd->paramc[4]*10 + sd->paramc[5]*10 + pc_checkskill(sd,skill_produce_db[idx].req_skill)*1000 + pc_checkskill(sd,BS_WEAPONRESEARCH)*100 + + ((wlv >= 3)? pc_checkskill(sd,BS_ORIDEOCON)*100 : 0) + add_per - (ele? 2500:0) - sc*((4-wlv)*500) - wlv*1000; + if(battle_config.wp_rate != 100) /* 確率補正 */ + make_per = make_per * battle_config.wp_rate / 100; } // -----------------------------------------------------// if(make_per < 1) make_per = 1; - if(skill_produce_db[idx].req_skill==AM_PHARMACY || - skill_produce_db[idx].req_skill==ASC_CDP) { - if( battle_config.pp_rate!=100 ) - make_per=make_per*battle_config.pp_rate/100; - } - else { - if( battle_config.wp_rate!=100 ) /* 確率補正 */ - make_per=make_per*battle_config.wp_rate/100; - } - // if(battle_config.etc_log) // printf("make rate = %d\n",make_per); @@ -9556,14 +9551,9 @@ static int skill_read_skillspamount(void) void skill_reload(void) { - /* - - - - - */ - - do_init_skill(); + skill_readdb(); + if (battle_config.skill_sp_override_grffile) + skill_read_skillspamount(); } /*========================================== diff --git a/src/map/status.c b/src/map/status.c index e05d33909..a848f8a4a 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -921,7 +921,8 @@ int status_calc_pc(struct map_session_data* sd,int first) if( (skill=pc_checkskill(sd,BS_WEAPONRESEARCH))>0) // 武器?究の命中率?加 sd->hit += skill*2; if(sd->status.option&2 && (skill = pc_checkskill(sd,RG_TUNNELDRIVE))>0 ) // トンネルドライブ // トンネルドライブ - sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9); + sd->speed += (100-16)*skill*DEFAULT_WALK_SPEED/100; + //sd->speed += (1.2*DEFAULT_WALK_SPEED - skill*9); if (pc_iscarton(sd) && (skill=pc_checkskill(sd,MC_PUSHCART))>0) // カ?トによる速度低下 sd->speed += (10-skill) * (DEFAULT_WALK_SPEED * 0.1); else if (pc_isriding(sd)) { // ペコペコ?りによる速度?加 diff --git a/src/map/storage.c b/src/map/storage.c index b78510a92..5e3797740 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -3,15 +3,18 @@ #include #include -#include "db.h" +#include "../common/db.h" +#include "../common/nullpo.h" +#include "../common/malloc.h" + #include "itemdb.h" #include "clif.h" #include "intif.h" #include "pc.h" #include "storage.h" #include "guild.h" -#include "nullpo.h" -#include "malloc.h" +#include "battle.h" +#include "atcommand.h" #ifdef MEMWATCH #include "memwatch.h" @@ -124,6 +127,10 @@ int storage_storageopen(struct map_session_data *sd) nullpo_retr(0, sd); + if(pc_isGM(sd) && pc_isGM(sd) < battle_config.gm_can_drop_lv) { + clif_displaymessage(sd->fd, msg_txt(246)); + return 1; + } if((stor = numdb_search(storage_db,sd->status.account_id)) != NULL) { if (stor->storage_status == 0) { stor->storage_status = 1; @@ -132,7 +139,7 @@ int storage_storageopen(struct map_session_data *sd) clif_storageequiplist(sd,stor); clif_updatestorageamount(sd,stor); return 0; - } + } } else intif_request_storage(sd->status.account_id); diff --git a/src/map/trade.c b/src/map/trade.c index 62dd65831..7709376fb 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -4,6 +4,7 @@ #include #include +#include "../common/nullpo.h" #include "clif.h" #include "itemdb.h" #include "map.h" @@ -16,8 +17,6 @@ #include "intif.h" #include "atcommand.h" -#include "nullpo.h" - /*========================================== * 取引要請を相手に送る *------------------------------------------ @@ -34,7 +33,10 @@ void trade_traderequest(struct map_session_data *sd, int target_id) { return; } } - if ((target_sd->trade_partner != 0) || (sd->trade_partner != 0)) { + if(pc_isGM(sd) && pc_isGM(sd) < battle_config.gm_can_drop_lv) { + clif_displaymessage(sd->fd, msg_txt(246)); + trade_tradecancel(sd); // GM is not allowed to trade + } else if ((target_sd->trade_partner != 0) || (sd->trade_partner != 0)) { trade_tradecancel(sd); // person is in another trade } else { if (sd->bl.m != target_sd->bl.m || -- cgit v1.2.3-70-g09d2 From 300facbcd059becdc8addac8a2f392452fea5fa0 Mon Sep 17 00:00:00 2001 From: celest Date: Wed, 23 Mar 2005 17:20:41 +0000 Subject: * Added' require_glory_guild' * Fixed some --addrace variables' sizes git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1277 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 3 +++ conf-tmpl/battle_athena.conf | 4 ++++ src/map/battle.c | 2 ++ src/map/battle.h | 1 + src/map/guild.c | 13 +++++++------ src/map/map.h | 10 +++++----- 6 files changed, 22 insertions(+), 11 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 047c96b99..1a5aab776 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,6 +1,9 @@ Date Added 03/23 + * Fixed some --addrace variables' sizes [celest] + * Added' require_glory_guild' - sets whether changing guild emblems require + the Glory of Guild skill [celest] * Fixed alot of memory leaks [celest] * Added stray memory cleaning routine to db.c [celest] * Fixed some compile errors, sorry xP [celest] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 06f6a90ab..9a473704d 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -817,5 +817,9 @@ finding_ore_rate: 100 //2 - eAthena's, using damage given / total damage as damage ratio exp_calc_type: 1 +// Does changing emblems require the guild skill "Glory of Guild"? (Note 1) +// Note: This new guild skill only appears for 2004-10-25aSakexe or newer +require_glory_guild: yes + import: conf/import/battle_conf.txt diff --git a/src/map/battle.c b/src/map/battle.c index 3c3442c60..54e1ba484 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4133,6 +4133,7 @@ static const struct { { "finding_ore_rate", &battle_config.finding_ore_rate}, // [celest] { "exp_calc_type", &battle_config.exp_calc_type}, // [celest] { "min_skill_delay_limit", &battle_config.min_skill_delay_limit}, // [celest] + { "require_glory_guild", &battle_config.require_glory_guild}, // [celest] //SQL-only options start #ifndef TXT_ONLY @@ -4380,6 +4381,7 @@ void battle_set_defaults() { battle_config.area_size = 14; battle_config.exp_calc_type = 1; battle_config.min_skill_delay_limit = 100; + battle_config.require_glory_guild = 1; //SQL-only options start #ifndef TXT_ONLY diff --git a/src/map/battle.h b/src/map/battle.h index a4758ab80..3bb9068bf 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -311,6 +311,7 @@ extern struct Battle_Config { int finding_ore_rate; // orn int exp_calc_type; int min_skill_delay_limit; + int require_glory_guild; #ifndef TXT_ONLY /* SQL-only options */ int mail_system; // [Valaris] diff --git a/src/map/guild.c b/src/map/guild.c index 06838c4b8..431ef5dec 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -892,15 +892,16 @@ int guild_notice_changed(int guild_id,const char *mes1,const char *mes2) // ギルドエンブレム変更 int guild_change_emblem(struct map_session_data *sd,int len,const char *data) { - struct guild *g = NULL; - + struct guild *g; nullpo_retr(0, sd); - if ((g = guild_search(sd->status.guild_id)) && guild_checkskill(g, GD_GLORYGUILD)>0) - return intif_guild_emblem(sd->status.guild_id,len,data); + if (battle_config.require_glory_guild && + !((g = guild_search(sd->status.guild_id)) && guild_checkskill(g, GD_GLORYGUILD)>0)) { + clif_skill_fail(sd,GD_GLORYGUILD,0,0); + return 0; + } - clif_skill_fail(sd,GD_GLORYGUILD,0,0); - return 0; + return intif_guild_emblem(sd->status.guild_id,len,data); } // ギルドエンブレム変更通知 int guild_emblem_changed(int len,int guild_id,int emblem_id,const char *data) diff --git a/src/map/map.h b/src/map/map.h index aeb47136c..453d0fbc6 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -295,16 +295,16 @@ struct map_session_data { short ignore_def_mob, ignore_def_mob_; int hp_loss_tick, hp_loss_rate; short hp_loss_value, hp_loss_type; - int addrace2[6],addrace2_[6]; + int addrace2[12],addrace2_[12]; int subsize[3]; short unequip_losehp[11]; short unequip_losesp[11]; int itemid; - int itemhealrate[6]; + int itemhealrate[7]; //--- 03/15's new card effects - int expaddrace[6]; - int subrace2[6]; - short sp_gain_race[6]; + int expaddrace[12]; + int subrace2[12]; + short sp_gain_race[12]; short spiritball, spiritball_old; int spirit_timer[MAX_SKILL_LEVEL]; -- cgit v1.2.3-70-g09d2 From 85fdcfa5c7831dc87a2b6810b3e2ebd5e3ec49c7 Mon Sep 17 00:00:00 2001 From: celest Date: Thu, 24 Mar 2005 15:31:28 +0000 Subject: * Added 'map_charid2id' * Changed monster damage logging to save char ID's * Implemented 'event_script_type' * Set Emsolute Develop as a learnable skill * Updated 'require_glory_guild' * Allow monsters to cast skills near themselves even when monster_nofootset is set to 'yes' * Print number of online users in online.txt/.html even if there's only 1 user git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1282 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 17 ++++++++++ conf-tmpl/battle_athena.conf | 16 +++++----- npc/Changelog.txt | 4 +++ npc/guild/gldfunc_manager.txt | 7 ++++- npc/jobs/custom/jobchange.txt | 2 +- npc/sample/PCLoginEvent.txt | 22 ++++++++++++- src/char/char.c | 3 +- src/map/battle.c | 2 +- src/map/clif.c | 12 +++++--- src/map/map.c | 26 +++++++++++++--- src/map/map.h | 1 + src/map/mob.c | 27 ++++++++++------ src/map/npc.c | 72 ++++++++----------------------------------- src/map/npc.h | 1 + src/map/pc.c | 35 +++++++++++++++------ src/map/skill.c | 19 ++++++++---- src/map/skill.h | 2 +- 17 files changed, 164 insertions(+), 104 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index dcb72a6cf..7f699be37 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -1,5 +1,22 @@ Date Added +03/24 + * Added 'map_charid2id' [celest] + * Changed monster damage logging to save char ID's for the most time -- also + fixes an exp bug, thanks to Super Novice / Ezhik [celest] + * Implemented 'event_script_type' -- no changes at '0', at '1' script events + will work according to Qamera's original mod + For more info please refer to his thread: + http://www.eathena.deltaanime.net/board/index.php?showtopic=13305&hl= + * Set Emsolute Develop as a learnable skill [celest] + * Updated 'require_glory_guild' [celest] + - the skill is only acquirable if this is set to 'yes', otherwise it will not + appear in the guild skill tree. Default is changed to 'no'. + * Allow monsters to cast skills near themselves even when monster_nofootset + is set to 'yes' -- they're only not allowed to cast near players [celest] + * Print number of online users in online.txt/.html even if there's only 1 user + online [celest] + 03/23 * Adjusted my trade fix [1280: MouseJstr] * Fixed possible memory corruption in storage if number of guilds diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 9a473704d..5663bc4e6 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -494,12 +494,12 @@ player_skill_reiteration: no //Whether or not, ground skills of the monsters' will pile up. (Note 1) monster_skill_reiteration: no -// Whether or not players can cast ground based skills of a certain type such as traps -// straight onto other players/monsters. (Note 1) +// Whether players are not allowed to cast ground based skills of a certain type such +// as traps straight onto or nearby other players/monsters. (Note 1) player_skill_nofootset: yes -// Whether or not monsters can cast ground based skills of a certain type such as traps -// straight onto players. (Note 1) +// Whether monsters are not allowed to cast ground based skills of a certain type such +// as traps straight onto or nearby other players. (Note 1) monster_skill_nofootset: yes // When a player is cloaking, Whether the wall is checked or not. (Note 1) @@ -817,9 +817,11 @@ finding_ore_rate: 100 //2 - eAthena's, using damage given / total damage as damage ratio exp_calc_type: 1 -// Does changing emblems require the guild skill "Glory of Guild"? (Note 1) -// Note: This new guild skill only appears for 2004-10-25aSakexe or newer -require_glory_guild: yes +// Can the 'Glory of Guild' skill be learnt in the Guild window, +// and does changing emblems require it? (Note 1) +// P.S: This new guild skill only appears for 2004-10-25aSakexe or newer +// P.S 2: This skill is not implemented on official servers, so its only optional +require_glory_guild: no import: conf/import/battle_conf.txt diff --git a/npc/Changelog.txt b/npc/Changelog.txt index a20f1de19..09b33f62a 100644 --- a/npc/Changelog.txt +++ b/npc/Changelog.txt @@ -35,6 +35,10 @@ Other Ppl Date Added ====== +03/24 + * Added support for Emsolute Develop in the guild manager script [celest] + * Fixed the custom jobchanger allowing Super Novices to change to high novice, + thanks to CavaCava 03/23 * WOE 1.3 Now you can't install Guardians during WOE [Lupus] * Set only Storage/Cancel to Kafra in Niflheim. [Lupus] diff --git a/npc/guild/gldfunc_manager.txt b/npc/guild/gldfunc_manager.txt index ec40e5a1e..577cd37e4 100644 --- a/npc/guild/gldfunc_manager.txt +++ b/npc/guild/gldfunc_manager.txt @@ -4,7 +4,7 @@ //= jAthena - kalen (1.0) //= 1.1 by Akaru, ho|yAnge|X, and Valaris //===== Current Version: ===================================== -//= 1.3 +//= 1.31 //===== Compatible With: ===================================== //= eAthena 0.1+; RO Episode 4+ //===== Description: ========================================= @@ -19,6 +19,7 @@ //= arg(3): y1 coordinate for warp to treasure room //= arg(4): guild script suffix for kafra, gaurdian scripts etc. //===== Additional Comments: ================================= +//= v1.31: Added support for Emsolute Develop [celest] //= v1.2: All Guild manager scripts use this function. Optimized //= Comerce and Defense investment. [kobra_k88] //= v1.2a Function now returns to script that called it. @@ -116,6 +117,8 @@ L_Start: set Zeny,Zeny-@eco_invest; SetCastleData getarg(1)+".gat",4,@TriggerE+1; SetCastleData getarg(1)+".gat",2,@Economy+1; + // if we learnt Emsolute Develop there's a chance to get +1 investment again + if (getgdskilllv(@GID,10014) > 0) && rand(100)>50) set @Economy, @Economy + 1; mes "[ "+getarg(0)+" ]"; mes "You have invested successfully."; return 0; @@ -172,6 +175,8 @@ L_Start: SetCastleData getarg(1)+".gat",3,@Defence+1; // set new hp values for guardians set @Defence, @Defence + 1; + // if we learnt Emsolute Develop there's a chance to get +1 investment again + if (getgdskilllv(@GID,10014) > 0) && rand(100)>50) set @Defence, @Defence + 1; set @AGuardian, 28634 + (@Defence*2000); set @KGuardian, 30214 + (@Defence*2000); set @SGuardian, 15670 + (@Defence*2000); diff --git a/npc/jobs/custom/jobchange.txt b/npc/jobs/custom/jobchange.txt index e69c42595..11c313772 100644 --- a/npc/jobs/custom/jobchange.txt +++ b/npc/jobs/custom/jobchange.txt @@ -22,7 +22,7 @@ mes "Sup? I'm the insanely cool and uber cute jobchanger thingy for eAthena! Fir next; menu "First Class",LFirstClass,"Second Class (2-1)",LSecondClass,"Alternate Second Class (2-2)",LSecondClass2,"Novice High",LNovice2,"Advance First Class",Llevelcheck,"Advance Second Class",Llevelcheck,"Super Novice",LSuperNovice; LNovice2: - if ((readparam(11) >= 99) && (readparam(55) >= 50) || (readparam(19) > 20)) goto Lchange; + if ((readparam(11) >= 99) && (readparam(55) >= 50) || ((readparam(19) > 20) && (readparam(19) != 23)) goto Lchange; mes "[ ^0065DFJobra^000000 ]"; mes "Ummmm, excuse me... o.O..."; mes "Hey! You don't MEET the class requirements..."; diff --git a/npc/sample/PCLoginEvent.txt b/npc/sample/PCLoginEvent.txt index d668c0960..707398277 100644 --- a/npc/sample/PCLoginEvent.txt +++ b/npc/sample/PCLoginEvent.txt @@ -26,8 +26,28 @@ // 7) Modify this script to your liking and give your players a surprise // 8) Remember: IT RUNS LIKE A NORMAL NPC. BUT THE ONLY WAY TO 'CLICK' IT IS BY // LOGGING ON +// 9) There are 2 ways to use this - check the examples below! - +// +// The 1st type -- with 'event_script_type' set to 0 +// prontera.gat,0,0,0 script PCLoginEvent -1,{ end; +} + +// +// The 2nd type -- with 'event_script_type' set to 1 +// +prontera.gat,155,175,0 script An NPC 46,{ + close; +PCLoginEvent: + // this part will run + close; +} + +prontera.gat,156,176,0 script Another NPC 46,{ + close; +PCLoginEvent: + // this part runs AS WELL + close; } \ No newline at end of file diff --git a/src/char/char.c b/src/char/char.c index 78f4bd3ae..0b8c3c9d9 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1345,8 +1345,9 @@ void create_online_files(void) { if (players == 0) { fprintf(fp2, "

No user is online.

\n"); fprintf(fp, "No user is online.\n"); - // no display if only 1 player } else if (players == 1) { + fprintf(fp2, "

%d user is online.

\n", players); + fprintf(fp, "%d user is online.\n", players); } else { fprintf(fp2, "

%d users are online.

\n", players); fprintf(fp, "%d users are online.\n", players); diff --git a/src/map/battle.c b/src/map/battle.c index 15f192ec4..1a44dc9a7 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4415,7 +4415,7 @@ void battle_set_defaults() { battle_config.area_size = 14; battle_config.exp_calc_type = 1; battle_config.min_skill_delay_limit = 100; - battle_config.require_glory_guild = 1; + battle_config.require_glory_guild = 0; //SQL-only options start #ifndef TXT_ONLY diff --git a/src/map/clif.c b/src/map/clif.c index 2e1a7e1e7..74d26dbac 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6704,14 +6704,18 @@ int clif_guild_skillinfo(struct map_session_data *sd) case GD_KAFRACONTACT: case GD_GUARDIANRESEARCH: case GD_GUARDUP: + case GD_DEVELOPMENT: up = guild_checkskill(g,GD_APPROVAL) > 0; break; case GD_LEADERSHIP: //Glory skill requirements -- Pretty sure correct [Sara] - up = guild_checkskill(g,GD_GLORYGUILD) > 0; + up = (battle_config.require_glory_guild) ? + guild_checkskill(g,GD_GLORYGUILD) > 0 : 1; + // what skill does it need now that glory guild was removed? [celest] break; case GD_GLORYWOUNDS: - up = guild_checkskill(g,GD_GLORYGUILD) > 0; + up = (battle_config.require_glory_guild) ? + guild_checkskill(g,GD_GLORYGUILD) > 0 : 1; break; case GD_SOULCOLD: up = guild_checkskill(g,GD_GLORYWOUNDS) > 0; @@ -6734,8 +6738,8 @@ int clif_guild_skillinfo(struct map_session_data *sd) up = guild_checkskill(g,GD_GUARDIANRESEARCH) > 0 && guild_checkskill(g,GD_REGENERATION) > 0; break; - case GD_DEVELOPMENT: - up = 0; + case GD_GLORYGUILD: + up = (battle_config.require_glory_guild) ? 1 : 0; break; default: up = 1; diff --git a/src/map/map.c b/src/map/map.c index 9dcf541c1..205c21cd2 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1446,10 +1446,16 @@ int map_quit(struct map_session_data *sd) { if(!sd->state.waitingdisconnect) { if (sd->state.event_disconnect) { - struct npc_data *npc; - if ((npc = npc_name2id(script_config.logout_event_name))) { - run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCLogoutNPC - sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.logout_event_name); + if (script_config.event_script_type == 0) { + struct npc_data *npc; + if ((npc = npc_name2id(script_config.logout_event_name))) { + run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCLogoutNPC + sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.logout_event_name); + ShowStatus(tmp_output); + } + } else { + sprintf (tmp_output, "%d '"CL_WHITE"%s"CL_RESET"' events executed.\n", + npc_event_doall_id(script_config.logout_event_name, sd->bl.id), script_config.logout_event_name); ShowStatus(tmp_output); } } @@ -1601,6 +1607,18 @@ char * map_charid2nick(int id) { return p->nick; } +struct map_session_data * map_charid2sd(int id) { + int i; + struct map_session_data *sd; + + if (id <= 0) return 0; + + for(i = 0; i < fd_max; i++) + if (session[i] && (sd = (struct map_session_data*)session[i]->session_data) && sd->status.char_id == id) + return sd; + + return NULL; +} /*========================================== * Search session data from a nick name diff --git a/src/map/map.h b/src/map/map.h index 453d0fbc6..2af4b9b4d 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -765,6 +765,7 @@ void map_addchariddb(int charid,char *name); void map_delchariddb(int charid); int map_reqchariddb(struct map_session_data * sd,int charid); char * map_charid2nick(int); +struct map_session_data * map_charid2sd(int); struct map_session_data * map_id2sd(int); struct block_list * map_id2bl(int); diff --git a/src/map/mob.c b/src/map/mob.c index cae0eddf3..002a37fb7 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2248,7 +2248,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(!(type&2)) { if(sd!=NULL){ for(i=0,minpos=0,mindmg=0x7fffffff;idmglog[i].id==sd->bl.id) + //if(md->dmglog[i].id==sd->bl.id) + if(md->dmglog[i].id==sd->status.char_id) break; if(md->dmglog[i].id==0){ minpos=i; @@ -2262,7 +2263,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(idmglog[i].dmg+=damage; else { - md->dmglog[minpos].id=sd->bl.id; + //md->dmglog[minpos].id=sd->bl.id; + md->dmglog[minpos].id=sd->status.char_id; md->dmglog[minpos].dmg=damage; } @@ -2273,7 +2275,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) struct pet_data *pd = (struct pet_data *)src; nullpo_retr(0, pd); for(i=0,minpos=0,mindmg=0x7fffffff;idmglog[i].id==pd->msd->bl.id) + //if(md->dmglog[i].id==pd->msd->bl.id) + if(md->dmglog[i].id==pd->msd->status.char_id) break; if(md->dmglog[i].id==0){ minpos=i; @@ -2287,7 +2290,8 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(idmglog[i].dmg+=(damage*battle_config.pet_attack_exp_rate)/100; else { - md->dmglog[minpos].id=pd->msd->bl.id; + //md->dmglog[minpos].id=pd->msd->bl.id; + md->dmglog[minpos].id=pd->msd->status.char_id; md->dmglog[minpos].dmg=(damage*battle_config.pet_attack_exp_rate)/100; } } @@ -2454,7 +2458,12 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) for(i=0,count=0,mvp_damage=0;idmglog[i].id==0) continue; - tmpsd[i] = map_id2sd(md->dmglog[i].id); + // Will this slow things down too much? + tmpsd[i] = map_charid2sd(md->dmglog[i].id); + // try finding again + if(tmpsd[i] == NULL) + tmpsd[i] = map_id2sd(md->dmglog[i].id); + // if we still can't find the player if(tmpsd[i] == NULL) continue; count++; @@ -3289,13 +3298,13 @@ int mobskill_castend_pos( int tid, unsigned int tick, int id,int data ) } if (!battle_config.monster_skill_reiteration && - skill_get_unit_flag(md->skillid)&UF_NOREITERATION && - skill_check_unit_range(md->bl.m,md->skillx,md->skilly,md->skillid,md->skilllv)) + skill_get_unit_flag (md->skillid) & UF_NOREITERATION && + skill_check_unit_range (md->bl.m, md->skillx, md->skilly, md->skillid, md->skilllv)) return 0; if(battle_config.monster_skill_nofootset && - skill_get_unit_flag(md->skillid)&UF_NOFOOTSET && - skill_check_unit_range2(md->bl.m,md->skillx,md->skilly,md->skillid,md->skilllv)) + skill_get_unit_flag (md->skillid) & UF_NOFOOTSET && + skill_check_unit_range2(&md->bl, md->bl.m, md->skillx, md->skilly, md->skillid, md->skilllv)) return 0; diff --git a/src/map/npc.c b/src/map/npc.c index 0e158bc77..1c5a0c585 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -311,62 +311,6 @@ int npc_event_export(void *key,void *data,va_list ap) return 0; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - /*========================================== * 全てのNPCのOn*イベント実行 *------------------------------------------ @@ -376,16 +320,17 @@ int npc_event_doall_sub(void *key,void *data,va_list ap) char *p=(char *)key; struct event_data *ev; int *c; + int rid; const char *name; nullpo_retr(0, ev=(struct event_data *)data); nullpo_retr(0, ap); nullpo_retr(0, c=va_arg(ap,int *)); - name=va_arg(ap,const char *); + rid=va_arg(ap, int); if( (p=strchr(p,':')) && p && strcmpi(name,p)==0 ){ - run_script(ev->nd->u.scr.script,ev->pos,0,ev->nd->bl.id); + run_script(ev->nd->u.scr.script,ev->pos,rid,ev->nd->bl.id); (*c)++; } @@ -397,7 +342,16 @@ int npc_event_doall(const char *name) char buf[64]="::"; strncpy(buf+2,name,62); - strdb_foreach(ev_db,npc_event_doall_sub,&c,buf); + strdb_foreach(ev_db,npc_event_doall_sub,&c,buf,0); + return c; +} +int npc_event_doall_id(const char *name, int rid) +{ + int c=0; + char buf[64]="::"; + + strncpy(buf+2,name,62); + strdb_foreach(ev_db,npc_event_doall_sub,&c,buf,rid); return c; } diff --git a/src/map/npc.h b/src/map/npc.h index 5a680f22a..054e9559b 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -46,6 +46,7 @@ int npc_do_ontimer(int,struct map_session_data *,int); int npc_event_doall(const char *name); int npc_event_do(const char *name); +int npc_event_doall_id(const char *name, int id); int npc_timerevent_start(struct npc_data *nd, int rid); int npc_timerevent_stop(struct npc_data *nd); diff --git a/src/map/pc.c b/src/map/pc.c index 8c0857d4b..768098afb 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -840,7 +840,7 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars sprintf(tmp_output,"Character '"CL_WHITE"%s"CL_RESET"' logged in. (Account ID: '"CL_WHITE"%d"CL_RESET"').\n", sd->status.name, sd->status.account_id); ShowInfo(tmp_output); - { + if (script_config.event_script_type == 0) { struct npc_data *npc; //printf("pc: OnPCLogin event done. (%d events)\n", npc_event_doall("OnPCLogin") ); if ((npc = npc_name2id(script_config.login_event_name))) { @@ -848,7 +848,12 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.login_event_name); ShowStatus(tmp_output); } + } else { + sprintf (tmp_output, "%d '"CL_WHITE"%s"CL_RESET"' events executed.\n", + npc_event_doall_id(script_config.login_event_name, sd->bl.id), script_config.login_event_name); + ShowStatus(tmp_output); } + // Send friends list clif_friends_list_send(sd); @@ -4645,10 +4650,16 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) if (sd->state.event_death) pc_setglobalreg(sd,"killerrid",(ssd->status.account_id)); if (ssd->state.event_kill) { - struct npc_data *npc; - if ((npc = npc_name2id(script_config.kill_event_name))) { - run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCKillNPC - sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.kill_event_name); + if (script_config.event_script_type == 0) { + struct npc_data *npc; + if ((npc = npc_name2id(script_config.kill_event_name))) { + run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCKillNPC + sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.kill_event_name); + ShowStatus(tmp_output); + } + } else { + sprintf (tmp_output, "%d '"CL_WHITE"%s"CL_RESET"' events executed.\n", + npc_event_doall_id(script_config.kill_event_name, sd->bl.id), script_config.kill_event_name); ShowStatus(tmp_output); } } @@ -4656,10 +4667,16 @@ int pc_damage(struct block_list *src,struct map_session_data *sd,int damage) } if (sd->state.event_death) { - struct npc_data *npc; - if ((npc = npc_name2id(script_config.die_event_name))) { - run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCDeathNPC - sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.die_event_name); + if (script_config.event_script_type == 0) { + struct npc_data *npc; + if ((npc = npc_name2id(script_config.die_event_name))) { + run_script(npc->u.scr.script,0,sd->bl.id,npc->bl.id); // PCDeathNPC + sprintf (tmp_output, "Event '"CL_WHITE"%s"CL_RESET"' executed.\n", script_config.die_event_name); + ShowStatus(tmp_output); + } + } else { + sprintf (tmp_output, "%d '"CL_WHITE"%s"CL_RESET"' events executed.\n", + npc_event_doall_id(script_config.die_event_name, sd->bl.id), script_config.die_event_name); ShowStatus(tmp_output); } } diff --git a/src/map/skill.c b/src/map/skill.c index d5bd61a4c..688f84c99 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1693,9 +1693,9 @@ static int skill_check_unit_range2_sub( struct block_list *bl,va_list ap ) return 0; } -int skill_check_unit_range2(int m,int x,int y,int skillid, int skilllv) +int skill_check_unit_range2(struct block_list *bl, int m,int x,int y,int skillid, int skilllv) { - int c = 0, range; + int c = 0, range, type; switch (skillid) { // to be expanded later case WZ_ICEWALL: @@ -1714,8 +1714,15 @@ int skill_check_unit_range2(int m,int x,int y,int skillid, int skilllv) break; } - map_foreachinarea(skill_check_unit_range2_sub,m, - x-range,y-range,x+range,y+range,0,&c,skillid); + // if the caster is a monster/NPC, only check for players + // otherwise just check everything + if (bl->type == BL_PC) + type = 0; + else type = BL_PC; + + map_foreachinarea(skill_check_unit_range2_sub, m, + x - range, y - range, x + range, y + range, + type, &c, skillid); return c; } @@ -6000,7 +6007,7 @@ int skill_castend_pos( int tid, unsigned int tick, int id,int data ) break;*/ if (battle_config.pc_skill_nofootset && skill_get_unit_flag(sd->skillid)&UF_NOFOOTSET && - skill_check_unit_range2(sd->bl.m,sd->skillx,sd->skilly,sd->skillid,sd->skilllv)) { + skill_check_unit_range2(&sd->bl,sd->bl.m,sd->skillx,sd->skilly,sd->skillid,sd->skilllv)) { clif_skill_fail(sd,sd->skillid,0,0); sd->canact_tick = tick; sd->canmove_tick = tick; @@ -7022,7 +7029,7 @@ int skill_use_id( struct map_session_data *sd, int target_id, clif_skill_fail(sd,sd->skillid,0,0); return 0; } - if (skill_check_unit_range2(sd->bl.m,sd->bl.x,sd->bl.y,sd->skillid,sd->skilllv)) { + if (skill_check_unit_range2(&sd->bl,sd->bl.m,sd->bl.x,sd->bl.y,sd->skillid,sd->skilllv)) { clif_skill_fail(sd,sd->skillid,0,0); return 0; } diff --git a/src/map/skill.h b/src/map/skill.h index a14aa95fd..4c0d0a8f7 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -143,7 +143,7 @@ int skill_unit_ondamaged(struct skill_unit *src,struct block_list *bl, int skill_castfix( struct block_list *bl, int time ); int skill_delayfix( struct block_list *bl, int time ); int skill_check_unit_range(int m,int x,int y,int skillid, int skilllv); -int skill_check_unit_range2(int m,int x,int y,int skillid, int skilllv); +int skill_check_unit_range2(struct block_list *bl,int m,int x,int y,int skillid, int skilllv); // -- moonsoul (added skill_check_unit_cell) int skill_check_unit_cell(int skillid,int m,int x,int y,int unit_id); int skill_unit_out_all( struct block_list *bl,unsigned int tick,int range); -- cgit v1.2.3-70-g09d2 From 56f8c49f065831c21156dd88bd5397b6ba355813 Mon Sep 17 00:00:00 2001 From: celest Date: Wed, 30 Mar 2005 17:10:03 +0000 Subject: * Added base code for loading Ser's UPNP plugin * Added 'idle_no_share' to battle_athena.conf * Added item_findingore.txt git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1343 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 3 +++ conf-tmpl/battle_athena.conf | 3 +++ db/item_findingore.txt | 24 ++++++++++++++++++++ src/common/socket.c | 48 ++++++++++++++++++++++++++++++++++++++- src/map/battle.c | 2 ++ src/map/battle.h | 1 + src/map/itemdb.c | 16 +++++++------ src/map/mob.c | 5 ++-- src/map/party.c | 26 ++++++++++----------- src/map/skill.c | 54 ++++++++++++++++++++------------------------ 10 files changed, 129 insertions(+), 53 deletions(-) create mode 100644 db/item_findingore.txt (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 316f0d8c3..28da82c4b 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -2,6 +2,8 @@ Date Added 03/30 + * Added base code for loading Ser's UPNP plugin [celest] + * Added 'idle_no_share' to battle_athena.conf [celest] * updated map server to jA1137~1159 - Added @reloadatcommand, @reloadbattleconf, @reloadstatusdb, @reloadpcdb @@ -16,6 +18,7 @@ Date Added - Updated Hammerfall, Meteor Shower and Lord of Vermillion -- when MvP's cast them they should have much more range - Some other skill tweaks + - Added item_findingore.txt * Some tidying up in mob.c and skill.c [celest] 03/29 diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index 5663bc4e6..a92f27c4e 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -823,5 +823,8 @@ exp_calc_type: 1 // P.S 2: This skill is not implemented on official servers, so its only optional require_glory_guild: no +// Is exp sharing disabled for idle members in the party? +idle_no_share: no + import: conf/import/battle_conf.txt diff --git a/db/item_findingore.txt b/db/item_findingore.txt new file mode 100644 index 000000000..d14d14f29 --- /dev/null +++ b/db/item_findingore.txt @@ -0,0 +1,24 @@ +// 鉱石発見スキルでドロップされる鉱石 +// item ID, Jname (dummy), 確率を 1 万倍 (100% なら 1000000) +// 0 はデフォルト項目 +0,Iron Ore,1002 +714,Emperium,30000 +756,Rough Oridecon,200000 +757,Rough Elunium,200000 +969,Gold,20000 +984,Oridecon,100000 +985,Elunium,100000 +990,Red Blood,300000 +991,Crystal Blue,300000 +992,Wind of Verdure,300000 +993,Green Live,300000 +994,Flame Heart,150000 +995,Mystic Frozen,150000 +996,Rough Wind,150000 +997,Great Nature,150000 +998,Iron,800000 +999,Steel,500000 +1002,Iron Ore,1000000 +1003,Coal,600000 +1010,Phracon,950000 +1011,Emveretarcon,550000 \ No newline at end of file diff --git a/src/common/socket.c b/src/common/socket.c index 70432eddf..5dd2e38f9 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -38,6 +38,20 @@ typedef int socklen_t; #include "memwatch.h" #endif +#ifdef UPNP + #if defined(CYGWIN) + #include + #elif _WIN32 + // windows.h already included + #else + #error This doesnt work with non-Windows yet + #endif + + void *upnp_dll; + void (*upnp_init)(); + void (*upnp_final)(); +#endif + fd_set readfds; int fd_max; time_t tick_; @@ -920,6 +934,27 @@ int Net_Init(void) return(0); } +#ifdef UPNP +// not implemented yet ^^; +void do_init_upnp(void) +{ + upnp_dll = dlopen("upnp.dll", RTLD_NOW); + if (!upnp_dll) { + printf ("Cannot open upnp.dll: %s\n", dlerror()); + return; + } + upnp_init = (void *)dlsym(upnp_dll, "do_init"); + upnp_final = (void *)dlsym(upnp_dll, "do_final"); + if (!upnp_init || !upnp_final) { + printf ("Cannot load symbol: %s\n", dlerror()); + dlclose (upnp_dll); + return; + } + upnp_init(); + return; +} +#endif + void do_final_socket(void) { int i; @@ -945,7 +980,14 @@ void do_final_socket(void) // session[0] のダミーデータを削除 aFree(session[0]->rdata); aFree(session[0]->wdata); - aFree(session[0]); + aFree(session[0]); + +#ifdef UPNP + if (upnp_final) + upnp_final(); + if (upnp_dll) + dlclose(upnp_dll); +#endif } void do_socket(void) @@ -966,4 +1008,8 @@ void do_socket(void) // とりあえず5分ごとに不要なデータを削除する add_timer_interval(gettick()+1000,connect_check_clear,0,0,300*1000); + +#ifdef UPNP + do_init_upnp(); +#endif } diff --git a/src/map/battle.c b/src/map/battle.c index aa30ef0a9..421f85ec3 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4202,6 +4202,7 @@ static const struct { { "exp_calc_type", &battle_config.exp_calc_type}, // [celest] { "min_skill_delay_limit", &battle_config.min_skill_delay_limit}, // [celest] { "require_glory_guild", &battle_config.require_glory_guild}, // [celest] + { "idle_no_share", &battle_config.idle_no_share}, // [celest], for a feature by [MouseJstr] //SQL-only options start #ifndef TXT_ONLY @@ -4450,6 +4451,7 @@ void battle_set_defaults() { battle_config.exp_calc_type = 1; battle_config.min_skill_delay_limit = 100; battle_config.require_glory_guild = 0; + battle_config.idle_no_share = 0; //SQL-only options start #ifndef TXT_ONLY diff --git a/src/map/battle.h b/src/map/battle.h index 3bb9068bf..393cc58b4 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -312,6 +312,7 @@ extern struct Battle_Config { int exp_calc_type; int min_skill_delay_limit; int require_glory_guild; + int idle_no_share; #ifndef TXT_ONLY /* SQL-only options */ int mail_system; // [Valaris] diff --git a/src/map/itemdb.c b/src/map/itemdb.c index d575e8a77..91ec58c81 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -26,9 +26,9 @@ static struct dbt* item_db; -static struct random_item_data blue_box[MAX_RANDITEM],violet_box[MAX_RANDITEM],card_album[MAX_RANDITEM],gift_box[MAX_RANDITEM],scroll[MAX_RANDITEM]; -static int blue_box_count=0,violet_box_count=0,card_album_count=0,gift_box_count=0,scroll_count=0; -static int blue_box_default=0,violet_box_default=0,card_album_default=0,gift_box_default=0,scroll_default=0; +static struct random_item_data blue_box[MAX_RANDITEM], violet_box[MAX_RANDITEM], card_album[MAX_RANDITEM], gift_box[MAX_RANDITEM], scroll[MAX_RANDITEM], finding_ore[MAX_RANDITEM]; +static int blue_box_count=0, violet_box_count=0, card_album_count=0, gift_box_count=0, scroll_count=0, finding_ore_count = 0; +static int blue_box_default=0, violet_box_default=0, card_album_default=0, gift_box_default=0, scroll_default=0, finding_ore_default = 0; // Function declarations @@ -102,7 +102,7 @@ int itemdb_searchrandomid(int flags) struct { int nameid,count; struct random_item_data *list; - } data[6]; + } data[7]; // for BCC32 compile error data[0].nameid = 0; data[0].count = 0; data[0].list = NULL; @@ -111,8 +111,9 @@ int itemdb_searchrandomid(int flags) data[3].nameid = card_album_default; data[3].count = card_album_count; data[3].list = card_album; data[4].nameid = gift_box_default; data[4].count = gift_box_count; data[4].list = gift_box; data[5].nameid = scroll_default; data[5].count = scroll_count; data[5].list = scroll; + data[6].nameid = finding_ore_default; data[6].count = finding_ore_count; data[6].list = finding_ore; - if(flags>=1 && flags<=5){ + if(flags>=1 && flags<=6){ nameid=data[flags].nameid; count=data[flags].count; list=data[flags].list; @@ -410,8 +411,9 @@ static int itemdb_read_randomitem() {"db/item_bluebox.txt", blue_box, &blue_box_count, &blue_box_default }, {"db/item_violetbox.txt", violet_box, &violet_box_count, &violet_box_default }, {"db/item_cardalbum.txt", card_album, &card_album_count, &card_album_default }, - {"db/item_giftbox.txt", gift_box, &gift_box_count, &gift_box_default }, - {"db/item_scroll.txt", scroll, &scroll_count, &scroll_default }, + {"db/item_giftbox.txt", gift_box, &gift_box_count, &gift_box_default }, + {"db/item_scroll.txt", scroll, &scroll_count, &scroll_default }, + {"db/item_findingore.txt", finding_ore,&finding_ore_count, &finding_ore_default }, }; for(i=0;i0 && battle_config.finding_ore_rate/100 >= rand()%1000) { + if (sd == mvp_sd && pc_checkskill(sd,BS_FINDINGORE)>0 && battle_config.finding_ore_rate/100 >= rand()%1000) { struct delay_item_drop *ditem; - int itemid[17] = { 714, 756, 757, 969, 984, 985, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1002 }; ditem=(struct delay_item_drop *)aCalloc(1,sizeof(struct delay_item_drop)); - ditem->nameid = itemid[rand()%17]; //should return from 0 to 16 + ditem->nameid = itemdb_searchrandomid(6); if (drop_ore<0) i=8; //we have only 10 slots in LOG, there's a check to not overflow (9th item usually a card, so we use 8th slot) log_item[i] = ditem->nameid; //it's for logging only drop_items++; //we cound if there were any drops diff --git a/src/map/party.c b/src/map/party.c index 17f0cf5eb..7eb3f02dc 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -586,23 +586,23 @@ int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny) nullpo_retr(0, p); - for(i=c=0;imember[i].sd)!=NULL && p->member[i].online && sd->bl.m==map && session[sd->fd] != NULL) + for (i=c=0; i < MAX_PARTY; i++) + if ((sd = p->member[i].sd) != NULL && p->member[i].online && sd->bl.m == map /*&& session[sd->fd] != NULL*/) // should be done in socket.c c++; - - if(c==0) + + if(c == 0) return 0; - for(i=0;imember[i].sd)!=NULL && p->member[i].online && sd->bl.m==map && session[sd->fd] != NULL) { - if (/* pc_issit(sd) || */ sd->chatID || (sd->idletime < (tick_ - 120))) + for (i = 0; i < MAX_PARTY; i++) + if ((sd = p->member[i].sd) != NULL && p->member[i].online && sd->bl.m == map /*&& session[sd->fd] != NULL*/) { + if (battle_config.idle_no_share && (/* pc_issit(sd) || */ sd->chatID || (sd->idletime < (tick_ - 120)))) continue; -#ifdef TWILIGHT + #ifdef TWILIGHT pc_gainexp(sd,base_exp,job_exp); -#else - pc_gainexp(sd,base_exp/c+1,job_exp/c+1); -#endif - if(battle_config.zeny_from_mobs) // zeny from mobs [Valaris] - pc_getzeny(sd,zeny/c+1); + #else + pc_gainexp(sd,(base_exp/c)+1,(job_exp/c)+1); + #endif + if (battle_config.zeny_from_mobs) // zeny from mobs [Valaris] + pc_getzeny(sd,(zeny/c)+1); } return 0; } diff --git a/src/map/skill.c b/src/map/skill.c index 40626fa57..b6010f151 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -608,8 +608,8 @@ int skillnotok(int skillid, struct map_session_data *sd) return 1; } - if (pc_isGM(sd) >= 20) - return 0; // gm's can do anything damn thing they want + if (pc_isGM(sd) >= 20) + return 0; // gm's can do anything damn thing they want // Check skill restrictions [Celest] if(!map[sd->bl.m].flag.pvp && !map[sd->bl.m].flag.gvg && skill_get_nocast (skillid) & 1) @@ -630,7 +630,7 @@ int skillnotok(int skillid, struct map_session_data *sd) case MC_IDENTIFY: return 0; // always allowed default: - return(map[sd->bl.m].flag.noskill); + return (map[sd->bl.m].flag.noskill); } } @@ -639,9 +639,9 @@ static int distance(int x0,int y0,int x1,int y1) { int dx,dy; - dx=abs(x0-x1); - dy=abs(y0-y1); - return dx>dy ? dx : dy; + dx = abs(x0 - x1); + dy = abs(y0 - y1); + return dx > dy ? dx : dy; } /* スキルユニットの配置情報を返す */ @@ -649,26 +649,25 @@ struct skill_unit_layout skill_unit_layout[MAX_SKILL_UNIT_LAYOUT]; int firewall_unit_pos; int icewall_unit_pos; -struct skill_unit_layout *skill_get_unit_layout(int skillid,int skilllv,struct block_list *src,int x,int y) -{ - +struct skill_unit_layout *skill_get_unit_layout (int skillid, int skilllv, struct block_list *src, int x, int y) +{ int pos = skill_get_unit_layout_type(skillid,skilllv); int dir; - if (pos!=-1) + if (pos != -1) return &skill_unit_layout[pos]; - if (src->x==x && src->y==y) + if (src->x == x && src->y == y) dir = 2; else dir = map_calc_dir(src,x,y); - if (skillid==MG_FIREWALL) - return &skill_unit_layout[firewall_unit_pos+dir]; - else if (skillid==WZ_ICEWALL) - return &skill_unit_layout[icewall_unit_pos+dir]; + if (skillid == MG_FIREWALL) + return &skill_unit_layout [firewall_unit_pos + dir]; + else if (skillid == WZ_ICEWALL) + return &skill_unit_layout [icewall_unit_pos + dir]; - printf("unknown unit layout for skill %d, %d\n",skillid,skilllv); + printf("Unknown unit layout for skill %d, %d\n",skillid,skilllv); return &skill_unit_layout[0]; } @@ -691,7 +690,7 @@ struct skill_unit_layout *skill_get_unit_layout(int skillid,int skilllv,struct b * スキル追加?果 *------------------------------------------ */ -int skill_additional_effect( struct block_list* src, struct block_list *bl,int skillid,int skilllv,int attack_type,unsigned int tick) +int skill_additional_effect (struct block_list* src, struct block_list *bl, int skillid, int skilllv, int attack_type, unsigned int tick) { /* MOB追加?果スキル用 */ const int sc[]={ @@ -825,8 +824,9 @@ int skill_additional_effect( struct block_list* src, struct block_list *bl,int s case WZ_FROSTNOVA: /* フロストノヴァ */ { struct status_change *sc_data = status_get_sc_data(bl); - rate=(skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15; - rate=rate<=5?5:rate; + rate = (skilllv*3+35)*sc_def_mdef/100-(status_get_int(bl)+status_get_luk(bl))/15; + if (rate <= 5) + rate = 5; if(sc_data && sc_data[SC_FREEZE].timer == -1 && rand()%100 < rate) status_change_start(bl,SC_FREEZE,skilllv,0,0,0,skill_get_time2(skillid,skilllv)*(1-sc_def_mdef/100),0); else if (sd && skillid == MG_FROSTDIVER) @@ -2384,9 +2384,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case SM_MAGNUM: /* マグナムブレイク [celest] */ if(flag&1 && bl->id != skill_area_temp[1]){ - int dx = abs( bl->x - skill_area_temp[2] ); - int dy = abs( bl->y - skill_area_temp[3] ); - int dist = ((dx>dy)?dx:dy); + int dist = distance (bl->x, bl->y, skill_area_temp[2], skill_area_temp[3]); skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick, 0x0500|dist); } else { @@ -2514,18 +2512,16 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s case MG_NAPALMBEAT: /* ナパ?ムビ?ト */ case MG_FIREBALL: /* ファイヤ?ボ?ル */ case WZ_SIGHTRASHER: /* サイトラッシャー */ - if(flag&1){ + if (flag & 1) { /* 個別にダメ?ジを?える */ - if(bl->id!=skill_area_temp[1]){ - if(skillid==MG_FIREBALL){ /* ファイヤ?ボ?ルなら中心からの距離を計算 */ - int dx=abs( bl->x - skill_area_temp[2] ); - int dy=abs( bl->y - skill_area_temp[3] ); - skill_area_temp[0]=((dx>dy)?dx:dy); + if (bl->id != skill_area_temp[1]){ + if(skillid == MG_FIREBALL){ /* ファイヤ?ボ?ルなら中心からの距離を計算 */ + skill_area_temp[0] = distance(bl->x, bl->y, skill_area_temp[2], skill_area_temp[3]); } skill_attack(BF_MAGIC,src,src,bl,skillid,skilllv,tick, skill_area_temp[0]| 0x0500); } - }else{ + } else { int ar; skill_area_temp[0]=0; skill_area_temp[1]=bl->id; -- cgit v1.2.3-70-g09d2 From 2728f0a06a9aa3cf1530ac2756bde985221541ed Mon Sep 17 00:00:00 2001 From: celest Date: Thu, 31 Mar 2005 15:34:54 +0000 Subject: * Set 'undead_detect_type' to 0 by default * Fixed Enchant Poison / Deadly Poison having too high poisoning chance git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1355 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-SVN.txt | 2 ++ conf-tmpl/battle_athena.conf | 2 +- db/Changelog.txt | 3 +++ db/skill_cast_db.txt | 6 +++--- npc/Changelog.txt | 2 ++ npc/mobs/fields/umbala.txt | 2 +- src/map/skill.c | 6 +++--- 7 files changed, 15 insertions(+), 8 deletions(-) (limited to 'conf-tmpl/battle_athena.conf') diff --git a/Changelog-SVN.txt b/Changelog-SVN.txt index 61ac5b655..8d0d39096 100644 --- a/Changelog-SVN.txt +++ b/Changelog-SVN.txt @@ -2,6 +2,8 @@ Date Added 03/31 + * Set 'undead_detect_type' to 0 by default, thanks to Dino9021 + * Fixed Enchant Poison / Deadly Poison having too high poisoning chance * Reverted the pc_remove_map() change temporarily * Added back up old files in 'save' before saving new data -- also fixes 'Access denied' errors when saving in TXT diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index a92f27c4e..789346b59 100644 --- a/conf-tmpl/battle_athena.conf +++ b/conf-tmpl/battle_athena.conf @@ -438,7 +438,7 @@ save_clothcolor: yes // 0 = element undead // 1 = race undead // 2 = both -undead_detect_type: 2 +undead_detect_type: 0 // Counter Attack Skill Type // 0 = 100% critical diff --git a/db/Changelog.txt b/db/Changelog.txt index 9bdf056da..3220f7c14 100644 --- a/db/Changelog.txt +++ b/db/Changelog.txt @@ -8,6 +8,9 @@ Einboroch items == 5% Skill databases == celest working on them i believe. +03/31 + * Updated freeze time for Frost Diver and Frost Nova + * Updated cast time for Preserve, thanks to Neko2 03/29 * Some optimizatons, added missing skill to Electric Guitar [Lupus] * Added new items (thanx to Landarma) [Lupus] diff --git a/db/skill_cast_db.txt b/db/skill_cast_db.txt index d1b62cf0c..63d4c3ef7 100644 --- a/db/skill_cast_db.txt +++ b/db/skill_cast_db.txt @@ -10,7 +10,7 @@ 12,4000:3500:3500:2500:2000:1500:1000:1000:1000:1000,0,5000:10000:15000:20000:25000:30000:35000:40000:45000:50000,0 //MG_SAFETYWALL#セイフティウォール# 13,500,1200:1400:1600:1800:2000:2200:2400:2600:2800:2700,0,0 //MG_SOULSTRIKE#ソウルストライク# 14,700:1400:2100:2800:3500:4200:4900:5600:6300:7000,1000:1200:1400:1600:1800:2000:2200:2400:2600:2800,0,0 //MG_COLDBOLT#コールドボルト# -15,800,1500,0,6000:7000:8000:9000:10000:11000:12000:13000:14000:15000 //MG_FROSTDIVER#フロストダイバー# +15,800,1500,0,3000:6000:9000:12000:15000:18000:21000:24000:27000:30000 //MG_FROSTDIVER#フロストダイバー# 16,0,0,0,10000:11000:12000:13000:14000:15000:16000:17000:18000:19000 //MG_STONECURSE#ストーンカース# 17,1600,1600,0,0 //MG_FIREBALL#ファイアーボール# 18,2000:1850:1700:1550:1400:1250:1100:950:800:650,0,5000:6000:7000:8000:9000:10000:11000:12000:13000:14000,0 //MG_FIREWALL#ファイアーウォール# @@ -69,7 +69,7 @@ 85,15000:14500:14000:13500:13000:12500:12000:11500:11000:10500,5000,4100,5500:6000:6500:7000:7500:8000:8500:9000:9500:10000 //WZ_VERMILION#ロードオブヴァーミリオン# 86,1000:2000:3000:4000:5000,0,0,0 //WZ_WATERBALL#ウォーターボール# 87,0,0,5000:10000:15000:20000:25000:30000:35000:40000:45000:50000,0 //WZ_ICEWALL#アイスウォール# -88,5000:4700:4400:4100:3800:3500:3200:2900:2700:2500,1000,0,3000:3500:4000:4500:5000:5500:6000:6500:7000:7500 //WZ_FROSTNOVA#フロストノヴァ# +88,5000:4700:4400:4100:3800:3500:3200:2900:2700:2500,1000,0,1500:3000:4500:6000:7500:9000:10500:12000:13500:15000 //WZ_FROSTNOVA#フロストノヴァ# 89,6000:7000:8000:9000:10000:11000:12000:13000:14000:15000,5000,4600,10000:11000:12000:13000:14000:15000:16000:17000:18000:19000 //WZ_STORMGUST#ストームガスト# 90,1000:2000:3000:4000:5000,700,0,0 //WZ_EARTHSPIKE#アーススパイク# 91,1000:2000:3000:4000:5000,700,500,0 //WZ_HEAVENDRIVE#ヘヴンズドライブ# @@ -268,7 +268,7 @@ 406,0,0,0,3000 //ASC_METEORASSAULT#メテオアサルト# 407,0,5000,0,0 //ASC_CDP -475,0,0,300000,0 //ST_PRESERVE## +475,1000,0,600000,0 //ST_PRESERVE## 476,1000,1000,75000:90000:105000:120000:135000,0 //ST_FULLSTRIP## 479,2000,0,120000:240000:360000:480000:600000,0 //CR_FULLPROTECTION## diff --git a/npc/Changelog.txt b/npc/Changelog.txt index 7b1f98c8f..ef10efd92 100644 --- a/npc/Changelog.txt +++ b/npc/Changelog.txt @@ -37,6 +37,8 @@ Other Ppl Date Added ====== +03/31 + * Corrected a G_GRYPHON spawn in umbala field to GRYPHON, thanks to CrasherZero 03/29 * Corrected Amatsu warp points, thanks to Dino9021 03/28 diff --git a/npc/mobs/fields/umbala.txt b/npc/mobs/fields/umbala.txt index c15fec09a..f09b31ead 100644 --- a/npc/mobs/fields/umbala.txt +++ b/npc/mobs/fields/umbala.txt @@ -28,7 +28,7 @@ um_fild03.gat,0,0,0,0 monster Pest 1256,10,0,0,0 um_fild03.gat,0,0,0,0 monster Parasite 1500,55,0,0,0 um_fild03.gat,0,0,0,0 monster Alligator 1271,30,0,0,0 um_fild03.gat,0,0,0,0 monster Dragon Tail 1321,25,0,0,0 -um_fild03.gat,0,0,0,0 monster Gryphon 1447,1,3600000,3600000,0 +um_fild03.gat,0,0,0,0 monster Gryphon 1259,1,3600000,3600000,0 //(um_fild04.gat)* um_fild04.gat,0,0,0,0 monster Stainer 1174,30,0,0,0 diff --git a/src/map/skill.c b/src/map/skill.c index 0ea0c81fa..d84a18d7a 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -772,13 +772,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int } // enchant poison has a chance of poisoning enemy if (sd->sc_data[SC_ENCPOISON].timer != -1 && sc_data && sc_data[SC_POISON].timer == -1 && - rand() % 100 < sd->sc_data[SC_ENCPOISON].val1 * sc_def_vit) { + rand() % 100 < sd->sc_data[SC_ENCPOISON].val1 * sc_def_vit / 100) { status_change_start(bl,SC_POISON,sd->sc_data[SC_ENCPOISON].val1, 0,0,0,skill_get_time2(AS_ENCHANTPOISON,sd->sc_data[SC_ENCPOISON].val1),0); } // エンチャントデットリ?ポイズン(猛毒?果) if (sd->sc_data[SC_EDP].timer != -1 && sc_data && sc_data[SC_DPOISON].timer == -1 && - rand() % 100 < sd->sc_data[SC_EDP].val2 * sc_def_vit) + rand() % 100 < sd->sc_data[SC_EDP].val2 * sc_def_vit / 100) status_change_start(bl,SC_DPOISON,sd->sc_data[SC_EDP].val1, 0,0,0,skill_get_time2(ASC_EDP,sd->sc_data[SC_EDP].val1),0); } @@ -6791,7 +6791,7 @@ int skill_delayfix( struct block_list *bl, int time ) sc_data = status_get_sc_data(bl); if(sd) { - delayrate=((struct map_session_data *)bl)->delayrate; + delayrate = sd->delayrate; // instant cast attack skills depend on aspd as delay [celest] if (time == 0) { -- cgit v1.2.3-70-g09d2