diff options
-rw-r--r-- | db/re/skill_cast_db.txt | 4 | ||||
-rw-r--r-- | db/re/skill_unit_db.txt | 13 | ||||
-rw-r--r-- | src/map/atcommand.c | 514 | ||||
-rw-r--r-- | src/map/battle.c | 334 | ||||
-rw-r--r-- | src/map/clif.c | 449 | ||||
-rw-r--r-- | src/map/map.c | 189 | ||||
-rw-r--r-- | src/map/map.h | 34 | ||||
-rw-r--r-- | src/map/mob.c | 322 | ||||
-rw-r--r-- | src/map/mob.h | 10 | ||||
-rw-r--r-- | src/map/pc.c | 344 | ||||
-rw-r--r-- | src/map/pc.h | 1 | ||||
-rw-r--r-- | src/map/skill.c | 592 | ||||
-rw-r--r-- | src/map/skill.h | 1 | ||||
-rw-r--r-- | src/map/status.c | 555 |
14 files changed, 1717 insertions, 1645 deletions
diff --git a/db/re/skill_cast_db.txt b/db/re/skill_cast_db.txt index 4366817c7..1b69feab3 100644 --- a/db/re/skill_cast_db.txt +++ b/db/re/skill_cast_db.txt @@ -1368,8 +1368,8 @@ 2301,2000,2000,0,5000:10000:15000,4000:8000:12000,0,-1 //-- SC_MAELSTROM 2302,2000,2000,0,7000:14000:21000,0,0,-1 -//-- SC_BLOODYLUST -2303,2000,2000,0,10000:20000:30000,30000,0,-1 +//-- SC_BLOODYLUST //dur2=intr +2303,2000,2000,0,10000:20000:30000,0,0,-1 //-- SC_FEINTBOMB 2304,1000,0,0,1000,0,5000,-1 //========================================== diff --git a/db/re/skill_unit_db.txt b/db/re/skill_unit_db.txt index 511a60f4d..3b7d9c26c 100644 --- a/db/re/skill_unit_db.txt +++ b/db/re/skill_unit_db.txt @@ -15,6 +15,7 @@ // 0x200(UF_ENSEMBLE) Ensemble skill // 0x400(UF_SONG) Song skill // 0x800(UF_DUALMODE) Spell has effects both at an interval and when you step in/out +// 0x2000(UF_RANGEDSINGLEUNIT) Layout hack, use layout range propriety but only display center. // Example: 0x006 = 0x002+0x004 -> Cannot be stacked nor cast near targets // // Notes: @@ -121,9 +122,9 @@ 2299,0xcc, , 0, 1,1000,all, 0x006 //SC_MANHOLE 2300,0xcd, , 0, 1,1000,all, 0x006 //SC_DIMENSIONDOOR -2301,0xce, , 0, 2, -1,enemy, 0x00E //SC_CHAOSPANIC +2301,0xce, , 2, 0, -1,enemy, 0x200E //SC_CHAOSPANIC 2302,0xcf, , 0, 2, -1,enemy, 0x002 //SC_MAELSTROM -2303,0xd0, , 0, 2, -1,enemy, 0x018 //SC_BLOODYLUST +2303,0xd0, , 3, 0, -1,all, 0x2018 //SC_BLOODYLUST 2304,0xd1, , 0, 2, -1,enemy, 0x000 //SC_FEINTBOMB 2319,0xec, , 0, 3,5000,all, 0x000 //LG_BANDING @@ -140,10 +141,10 @@ 2450,0xe0, , 3, 0, 500,enemy, 0x010 //SO_CLOUD_KILL 2452,0xe4, , 0, 3,3000,all, 0x010 //SO_WARMER 2453,0xeb, , 0, 1:1:2:2:3,1000,enemy,0x010 //SO_VACUUM_EXTREME -2465,0xf1, , 0, 2,1000,all, 0x010 //SO_FIRE_INSIGNIA -2466,0xf2, , 0, 2,1000,all, 0x010 //SO_WATER_INSIGNIA -2467,0xf3, , 0, 2,1000,all, 0x010 //SO_WIND_INSIGNIA -2468,0xf4, , 0, 2,1000,all, 0x010 //SO_EARTH_INSIGNIA +2465,0xf1, , 0, 1,1000,all, 0x010 //SO_FIRE_INSIGNIA +2466,0xf2, , 0, 1,1000,all, 0x010 //SO_WATER_INSIGNIA +2467,0xf3, , 0, 1,1000,all, 0x010 //SO_WIND_INSIGNIA +2468,0xf4, , 0, 1,1000,all, 0x010 //SO_EARTH_INSIGNIA 2479,0xe5, , 0, 1,1000,enemy, 0x000 //GN_THORNS_TRAP 2482,0xe6,0x7f, -1, 1, -1,all, 0x000 //GN_WALLOFTHORN diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 0d92ef156..75afd4a46 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -61,7 +61,7 @@ typedef struct AliasInfo AliasInfo; int atcmd_binding_count = 0; struct AtCommandInfo { - char command[ATCOMMAND_LENGTH]; + char command[ATCOMMAND_LENGTH]; AtCommandFunc func; char* at_groups;/* quick @commands "can-use" lookup */ char* char_groups;/* quick @charcommands "can-use" lookup */ @@ -91,12 +91,12 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n // @commands (script-based) struct atcmd_binding_data* get_atcommandbind_byname(const char* name) { int i = 0; - + if( *name == atcommand_symbol || *name == charcommand_symbol ) name++; // for backwards compatibility - + ARR_FIND( 0, atcmd_binding_count, i, strcmp(atcmd_binding[i]->command, name) == 0 ); - + return ( i < atcmd_binding_count ) ? atcmd_binding[i] : NULL; } @@ -193,7 +193,7 @@ static const char* atcommand_help_string(const char* command) {// failed to find the help property in the configuration file return NULL; } - + if( !config_setting_lookup_string( info, command, &str ) ) {// failed to find the matching help string return NULL; @@ -454,7 +454,7 @@ ACMD_FUNC(mapmove) if (!message || !*message || (sscanf(message, "%15s %hd %hd", map_name, &x, &y) < 3 && sscanf(message, "%15[^,],%hd,%hd", map_name, &x, &y) < 1)) { - + clif_displaymessage(fd, msg_txt(909)); // Please enter a map (usage: @warp/@rura/@mapmove <mapname> <x> <y>). return -1; } @@ -462,7 +462,7 @@ ACMD_FUNC(mapmove) mapindex = mapindex_name2id(map_name); if (mapindex) m = map_mapindex2mapid(mapindex); - + if (!mapindex) { // m < 0 means on different server! [Kevin] clif_displaymessage(fd, msg_txt(1)); // Map not found. return -1; @@ -540,13 +540,13 @@ ACMD_FUNC(jumpto) clif_displaymessage(fd, msg_txt(3)); // Character not found. return -1; } - + if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif_displaymessage(fd, msg_txt(247)); // You are not authorized to warp to this map. return -1; } - + if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif_displaymessage(fd, msg_txt(248)); // You are not authorized to warp from your current map. @@ -768,10 +768,10 @@ ACMD_FUNC(whogm) pl_sd->status.base_level, job_name(pl_sd->status.class_), pl_sd->status.job_level); clif_displaymessage(fd, atcmd_output); - + p = party_search(pl_sd->status.party_id); g = guild_search(pl_sd->status.guild_id); - + sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s' p?p->party.name:msg_txt(917), g?g->name:msg_txt(917)); // None. @@ -804,7 +804,7 @@ ACMD_FUNC(save) intif_save_petdata(sd->status.account_id, &sd->pd->pet); chrif_save(sd,0); - + clif_displaymessage(fd, msg_txt(6)); // Your save point has been changed. return 0; @@ -864,7 +864,7 @@ ACMD_FUNC(speed) ACMD_FUNC(storage) { nullpo_retr(-1, sd); - + if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag) return -1; @@ -873,9 +873,9 @@ ACMD_FUNC(storage) clif_displaymessage(fd, msg_txt(250)); return -1; } - + clif_displaymessage(fd, msg_txt(919)); // Storage opened. - + return 0; } @@ -939,7 +939,7 @@ ACMD_FUNC(option) sd->sc.opt1 = param1; sd->sc.opt2 = param2; pc_setoption(sd, param3); - + clif_displaymessage(fd, msg_txt(9)); // Options changed. return 0; @@ -1226,7 +1226,7 @@ ACMD_FUNC(kami) clif_displaymessage(fd, msg_txt(981)); // Please enter color and message (usage: @kamic <color> <message>). return -1; } - + if(color > 0xFFFFFF) { clif_displaymessage(fd, msg_txt(982)); // Invalid color. return -1; @@ -1511,7 +1511,7 @@ ACMD_FUNC(joblevelup) { int level=0; nullpo_retr(-1, sd); - + level = atoi(message); if (!message || !*message || !level) { @@ -1588,7 +1588,7 @@ ACMD_FUNC(help) atcommand_get_suggestions(sd, command_name, true); return -1; } - + if (!config_setting_lookup_string(help, command_name, &text)) { sprintf(atcmd_output, msg_txt(988), atcommand_symbol, command_name); // There is no help for %c%s. clif_displaymessage(fd, atcmd_output); @@ -1723,7 +1723,7 @@ ACMD_FUNC(gvgoff) clif_displaymessage(fd, msg_txt(162)); // GvG is already Off. return -1; } - + map[sd->bl.m].flag.gvg = 0; clif_map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING); map_foreachinmap(atcommand_stopattack,sd->bl.m, BL_CHAR, 0); @@ -1743,7 +1743,7 @@ ACMD_FUNC(gvgon) clif_displaymessage(fd, msg_txt(163)); // GvG is already On. return -1; } - + map[sd->bl.m].flag.gvg = 1; clif_map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE); clif_displaymessage(fd, msg_txt(34)); // GvG: On. @@ -1873,7 +1873,7 @@ ACMD_FUNC(go) int town; char map_name[MAP_NAME_LENGTH]; int m; - + const struct { char map[MAP_NAME_LENGTH]; int x, y; @@ -1919,20 +1919,20 @@ ACMD_FUNC(go) { MAP_MALAYA, 242, 211 }, // 34=Malaya Port { MAP_ECLAGE, 110, 39 }, // 35=Eclage }; - + nullpo_retr(-1, sd); - + if( map[sd->bl.m].flag.nogo && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE) ) { clif_displaymessage(sd->fd,msg_txt(995)); // You cannot use @go on this map. return 0; } - + memset(map_name, '\0', sizeof(map_name)); memset(atcmd_output, '\0', sizeof(atcmd_output)); - + // get the number town = atoi(message); - + if (!message || !*message || sscanf(message, "%11s", map_name) < 1 || town < 0 || town >= ARRAYLENGTH(data)) {// no value matched so send the list of locations const char* text; @@ -1946,7 +1946,7 @@ ACMD_FUNC(go) {// send the text to the client clif_displaymessage( fd, text ); } - + return -1; } @@ -2060,7 +2060,7 @@ ACMD_FUNC(go) clif_displaymessage(fd, msg_txt(38)); // Invalid location number or name. return -1; } - + return 0; } @@ -2165,13 +2165,13 @@ static int atkillmonster_sub(struct block_list *bl, va_list ap) { struct mob_data *md; int flag; - + nullpo_ret(md=(struct mob_data *)bl); flag = va_arg(ap, int); if (md->guardian_data) return 0; //Do not touch WoE mobs! - + if (flag) status_zap(bl,md->status.hp, 0); else @@ -2323,9 +2323,9 @@ ACMD_FUNC(produce) clif_displaymessage(fd, msg_txt(170)); //This item is not an equipment. return -1; } - + item_id = item_data->nameid; - + if (itemdb_isequip2(item_data)) { if (attribute < MIN_ATTRIBUTE || attribute > MAX_ATTRIBUTE) attribute = ATTRIBUTE_NORMAL; @@ -2378,7 +2378,7 @@ ACMD_FUNC(memo) } return 0; } - + if( position < 0 || position >= MAX_MEMOPOINTS ) { sprintf(atcmd_output, msg_txt(1008), 0, MAX_MEMOPOINTS-1); // Please enter a valid position (usage: @memo <memo_position:%d-%d>). @@ -2422,7 +2422,7 @@ ACMD_FUNC(displaystatus) { int i, type, flag, tick, val1 = 0, val2 = 0, val3 = 0; nullpo_retr(-1, sd); - + if (!message || !*message || (i = sscanf(message, "%d %d %d %d %d %d", &type, &flag, &tick, &val1, &val2, &val3)) < 1) { clif_displaymessage(fd, msg_txt(1009)); // Please enter a status type/flag (usage: @displaystatus <status type> <flag> <tick> {<val1> {<val2> {<val3>}}}). return -1; @@ -2576,7 +2576,7 @@ ACMD_FUNC(param) short* status[6]; //we don't use direct initialization because it isn't part of the c standard. nullpo_retr(-1, sd); - + memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) { @@ -2637,7 +2637,7 @@ ACMD_FUNC(stat_all) short* status[6]; //we don't use direct initialization because it isn't part of the c standard. nullpo_retr(-1, sd); - + status[0] = &sd->status.str; status[1] = &sd->status.agi; status[2] = &sd->status.vit; @@ -2664,7 +2664,7 @@ ACMD_FUNC(stat_all) new_value = 1; else new_value = *status[index] +value; - + if (new_value != (int)*status[index]) { *status[index] = new_value; clif_updatestatus(sd, SP_STR + index); @@ -2803,13 +2803,13 @@ ACMD_FUNC(petfriendly) clif_displaymessage(fd, msg_txt(184)); // Sorry, but you have no pet. return -1; } - + if (friendly < 0 || friendly > 1000) { clif_displaymessage(fd, msg_txt(37)); // An invalid number was specified. return -1; } - + if (friendly == pd->pet.intimate) { clif_displaymessage(fd, msg_txt(183)); // Pet intimacy is already at maximum. return -1; @@ -2905,7 +2905,7 @@ ACMD_FUNC(recall) { clif_displaymessage(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player. return -1; } - + if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) { clif_displaymessage(fd, msg_txt(1019)); // You are not authorized to warp someone to this map. return -1; @@ -3173,9 +3173,9 @@ ACMD_FUNC(doommap) * *------------------------------------------*/ static void atcommand_raise_sub(struct map_session_data* sd) { - + status_revive(&sd->bl, 100, 100); - + clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); clif_displaymessage(sd->fd, msg_txt(63)); // Mercy has been shown. } @@ -3187,7 +3187,7 @@ ACMD_FUNC(raise) { struct map_session_data* pl_sd; struct s_mapiterator* iter; - + nullpo_retr(-1, sd); iter = mapit_getallusers(); @@ -3248,9 +3248,9 @@ ACMD_FUNC(kick) clif_displaymessage(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player. return -1; } - + clif_GM_kick(sd, pl_sd); - + return 0; } @@ -3350,7 +3350,7 @@ ACMD_FUNC(lostskill) // attempt to find the text corresponding to this command text = atcommand_help_string( command ); - + // send the error message as always clif_displaymessage(fd, msg_txt(1027)); // Please enter a quest skill number. @@ -3390,9 +3390,9 @@ ACMD_FUNC(spiritball) int max_spiritballs; int number; nullpo_retr(-1, sd); - + max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF); - + if( !message || !*message || (number = atoi(message)) < 0 || number > max_spiritballs ) { char msg[CHAT_SIZE_MAX]; @@ -3791,16 +3791,16 @@ ACMD_FUNC(reloadatcommand) { clif_displaymessage(fd, msg_txt(1036)); // Error reading groups.conf, reload failed. return -1; } - + config_destroy(&run_test); - + if (conf_read_file(&run_test, ATCOMMAND_CONF_FILENAME)) { clif_displaymessage(fd, msg_txt(1037)); // Error reading atcommand_athena.conf, reload failed. return -1; } config_destroy(&run_test); - + atcommand_doload(); pc_groups_reload(); clif_displaymessage(fd, msg_txt(254)); @@ -3946,7 +3946,7 @@ ACMD_FUNC(mapinfo) return -1; } m_index = mapindex_name2id(mapname); //This one shouldn't fail since the previous seek did not. - + clif_displaymessage(fd, msg_txt(1039)); // ------ Map Info ------ // count chats (for initial message) @@ -3967,49 +3967,49 @@ ACMD_FUNC(mapinfo) clif_displaymessage(fd, msg_txt(1043)); // Autotrade Enabled else clif_displaymessage(fd, msg_txt(1044)); // Autotrade Disabled - + if (map[m_id].flag.battleground) clif_displaymessage(fd, msg_txt(1045)); // Battlegrounds ON - - strcpy(atcmd_output,msg_txt(1046)); // PvP Flags: + + strcpy(atcmd_output,msg_txt(1046)); // PvP Flags: if (map[m_id].flag.pvp) - strcat(atcmd_output, msg_txt(1047)); // Pvp ON | + strcat(atcmd_output, msg_txt(1047)); // Pvp ON | if (map[m_id].flag.pvp_noguild) - strcat(atcmd_output, msg_txt(1048)); // NoGuild | + strcat(atcmd_output, msg_txt(1048)); // NoGuild | if (map[m_id].flag.pvp_noparty) - strcat(atcmd_output, msg_txt(1049)); // NoParty | + strcat(atcmd_output, msg_txt(1049)); // NoParty | if (map[m_id].flag.pvp_nightmaredrop) - strcat(atcmd_output, msg_txt(1050)); // NightmareDrop | + strcat(atcmd_output, msg_txt(1050)); // NightmareDrop | if (map[m_id].flag.pvp_nocalcrank) - strcat(atcmd_output, msg_txt(1051)); // NoCalcRank | + strcat(atcmd_output, msg_txt(1051)); // NoCalcRank | clif_displaymessage(fd, atcmd_output); - strcpy(atcmd_output,msg_txt(1052)); // GvG Flags: + strcpy(atcmd_output,msg_txt(1052)); // GvG Flags: if (map[m_id].flag.gvg) - strcat(atcmd_output, msg_txt(1053)); // GvG ON | + strcat(atcmd_output, msg_txt(1053)); // GvG ON | if (map[m_id].flag.gvg_dungeon) - strcat(atcmd_output, msg_txt(1054)); // GvG Dungeon | + strcat(atcmd_output, msg_txt(1054)); // GvG Dungeon | if (map[m_id].flag.gvg_castle) - strcat(atcmd_output, msg_txt(1055)); // GvG Castle | + strcat(atcmd_output, msg_txt(1055)); // GvG Castle | if (map[m_id].flag.gvg_noparty) - strcat(atcmd_output, msg_txt(1056)); // NoParty | + strcat(atcmd_output, msg_txt(1056)); // NoParty | clif_displaymessage(fd, atcmd_output); - strcpy(atcmd_output,msg_txt(1057)); // Teleport Flags: + strcpy(atcmd_output,msg_txt(1057)); // Teleport Flags: if (map[m_id].flag.noteleport) - strcat(atcmd_output, msg_txt(1058)); // NoTeleport | + strcat(atcmd_output, msg_txt(1058)); // NoTeleport | if (map[m_id].flag.monster_noteleport) - strcat(atcmd_output, msg_txt(1059)); // Monster NoTeleport | + strcat(atcmd_output, msg_txt(1059)); // Monster NoTeleport | if (map[m_id].flag.nowarp) - strcat(atcmd_output, msg_txt(1060)); // NoWarp | + strcat(atcmd_output, msg_txt(1060)); // NoWarp | if (map[m_id].flag.nowarpto) - strcat(atcmd_output, msg_txt(1061)); // NoWarpTo | + strcat(atcmd_output, msg_txt(1061)); // NoWarpTo | if (map[m_id].flag.noreturn) - strcat(atcmd_output, msg_txt(1062)); // NoReturn | + strcat(atcmd_output, msg_txt(1062)); // NoReturn | if (map[m_id].flag.nogo) - strcat(atcmd_output, msg_txt(1063)); // NoGo | + strcat(atcmd_output, msg_txt(1063)); // NoGo | if (map[m_id].flag.nomemo) - strcat(atcmd_output, msg_txt(1064)); // NoMemo | + strcat(atcmd_output, msg_txt(1064)); // NoMemo | clif_displaymessage(fd, atcmd_output); sprintf(atcmd_output, msg_txt(1065), // No Exp Penalty: %s | No Zeny Penalty: %s @@ -4030,64 +4030,64 @@ ACMD_FUNC(mapinfo) } } - strcpy(atcmd_output,msg_txt(1071)); // Weather Flags: + strcpy(atcmd_output,msg_txt(1071)); // Weather Flags: if (map[m_id].flag.snow) - strcat(atcmd_output, msg_txt(1072)); // Snow | + strcat(atcmd_output, msg_txt(1072)); // Snow | if (map[m_id].flag.fog) - strcat(atcmd_output, msg_txt(1073)); // Fog | + strcat(atcmd_output, msg_txt(1073)); // Fog | if (map[m_id].flag.sakura) - strcat(atcmd_output, msg_txt(1074)); // Sakura | + strcat(atcmd_output, msg_txt(1074)); // Sakura | if (map[m_id].flag.clouds) - strcat(atcmd_output, msg_txt(1075)); // Clouds | + strcat(atcmd_output, msg_txt(1075)); // Clouds | if (map[m_id].flag.clouds2) - strcat(atcmd_output, msg_txt(1076)); // Clouds2 | + strcat(atcmd_output, msg_txt(1076)); // Clouds2 | if (map[m_id].flag.fireworks) - strcat(atcmd_output, msg_txt(1077)); // Fireworks | + strcat(atcmd_output, msg_txt(1077)); // Fireworks | if (map[m_id].flag.leaves) - strcat(atcmd_output, msg_txt(1078)); // Leaves | + strcat(atcmd_output, msg_txt(1078)); // Leaves | /** * No longer available, keeping here just in case it's back someday. [Ind] **/ //if (map[m_id].flag.rain) - // strcat(atcmd_output, msg_txt(1079)); // Rain | + // strcat(atcmd_output, msg_txt(1079)); // Rain | if (map[m_id].flag.nightenabled) - strcat(atcmd_output, msg_txt(1080)); // Displays Night | + strcat(atcmd_output, msg_txt(1080)); // Displays Night | clif_displaymessage(fd, atcmd_output); - strcpy(atcmd_output,msg_txt(1081)); // Other Flags: + strcpy(atcmd_output,msg_txt(1081)); // Other Flags: if (map[m_id].flag.nobranch) - strcat(atcmd_output, msg_txt(1082)); // NoBranch | + strcat(atcmd_output, msg_txt(1082)); // NoBranch | if (map[m_id].flag.notrade) - strcat(atcmd_output, msg_txt(1083)); // NoTrade | + strcat(atcmd_output, msg_txt(1083)); // NoTrade | if (map[m_id].flag.novending) - strcat(atcmd_output, msg_txt(1084)); // NoVending | + strcat(atcmd_output, msg_txt(1084)); // NoVending | if (map[m_id].flag.nodrop) - strcat(atcmd_output, msg_txt(1085)); // NoDrop | + strcat(atcmd_output, msg_txt(1085)); // NoDrop | if (map[m_id].flag.noskill) - strcat(atcmd_output, msg_txt(1086)); // NoSkill | + strcat(atcmd_output, msg_txt(1086)); // NoSkill | if (map[m_id].flag.noicewall) - strcat(atcmd_output, msg_txt(1087)); // NoIcewall | + strcat(atcmd_output, msg_txt(1087)); // NoIcewall | if (map[m_id].flag.allowks) - strcat(atcmd_output, msg_txt(1088)); // AllowKS | + strcat(atcmd_output, msg_txt(1088)); // AllowKS | if (map[m_id].flag.reset) - strcat(atcmd_output, msg_txt(1089)); // Reset | + strcat(atcmd_output, msg_txt(1089)); // Reset | clif_displaymessage(fd, atcmd_output); - strcpy(atcmd_output,msg_txt(1090)); // Other Flags: + strcpy(atcmd_output,msg_txt(1090)); // Other Flags: if (map[m_id].nocommand) - strcat(atcmd_output, msg_txt(1091)); // NoCommand | + strcat(atcmd_output, msg_txt(1091)); // NoCommand | if (map[m_id].flag.nobaseexp) - strcat(atcmd_output, msg_txt(1092)); // NoBaseEXP | + strcat(atcmd_output, msg_txt(1092)); // NoBaseEXP | if (map[m_id].flag.nojobexp) - strcat(atcmd_output, msg_txt(1093)); // NoJobEXP | + strcat(atcmd_output, msg_txt(1093)); // NoJobEXP | if (map[m_id].flag.nomobloot) - strcat(atcmd_output, msg_txt(1094)); // NoMobLoot | + strcat(atcmd_output, msg_txt(1094)); // NoMobLoot | if (map[m_id].flag.nomvploot) - strcat(atcmd_output, msg_txt(1095)); // NoMVPLoot | + strcat(atcmd_output, msg_txt(1095)); // NoMVPLoot | if (map[m_id].flag.partylock) - strcat(atcmd_output, msg_txt(1096)); // PartyLock | + strcat(atcmd_output, msg_txt(1096)); // PartyLock | if (map[m_id].flag.guildlock) - strcat(atcmd_output, msg_txt(1097)); // GuildLock | + strcat(atcmd_output, msg_txt(1097)); // GuildLock | clif_displaymessage(fd, atcmd_output); switch (list) { @@ -4803,7 +4803,7 @@ ACMD_FUNC(jailfor) } //Added by Coltaro - if(pl_sd->sc.data[SC_JAILED] && + if(pl_sd->sc.data[SC_JAILED] && pl_sd->sc.data[SC_JAILED]->val1 != INT_MAX) { //Update the player's jail time jailtime += pl_sd->sc.data[SC_JAILED]->val1; @@ -4847,7 +4847,7 @@ ACMD_FUNC(jailtime) int year, month, day, hour, minute; nullpo_retr(-1, sd); - + if (!sd->sc.data[SC_JAILED]) { clif_displaymessage(fd, msg_txt(1139)); // You are not in jail. return -1; @@ -5043,9 +5043,9 @@ ACMD_FUNC(undisguiseguild) struct guild *g; int i; nullpo_retr(-1, sd); - + memset(guild_name, '\0', sizeof(guild_name)); - + if(!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) { clif_displaymessage(fd, msg_txt(1147)); // Please enter guild name/ID (usage: @undisguiseguild <guild name/ID>). return -1; @@ -5055,7 +5055,7 @@ ACMD_FUNC(undisguiseguild) clif_displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return -1; } - + for(i = 0; i < g->max_member; i++) if( (pl_sd = g->member[i].sd) && pl_sd->disguise ) pc_disguise(pl_sd, 0); @@ -5074,15 +5074,15 @@ ACMD_FUNC(exp) double nextb, nextj; nullpo_retr(-1, sd); memset(output, '\0', sizeof(output)); - + nextb = pc_nextbaseexp(sd); if (nextb) nextb = sd->status.base_exp*100.0/nextb; - + nextj = pc_nextjobexp(sd); if (nextj) nextj = sd->status.job_exp*100.0/nextj; - + sprintf(output, msg_txt(1148), sd->status.base_level, nextb, sd->status.job_level, nextj); // Base Level: %d (%.3f%%) | Job Level: %d (%.3f%%) clif_displaymessage(fd, output); return 0; @@ -5271,7 +5271,7 @@ ACMD_FUNC(npcmove) clif_displaymessage(fd, msg_txt(1154)); // NPC is not on this map. return -1; //Not on a map. } - + x = cap_value(x, 0, map[m].xs-1); y = cap_value(y, 0, map[m].ys-1); map_foreachinrange(clif_outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl); @@ -5334,7 +5334,7 @@ ACMD_FUNC(follow) clif_displaymessage(fd, msg_txt(1159)); // Follow mode OFF. return 0; } - + if ( (pl_sd = map_nick2sd((char *)message)) == NULL ) { clif_displaymessage(fd, msg_txt(3)); // Character not found. @@ -5348,7 +5348,7 @@ ACMD_FUNC(follow) pc_follow(sd, pl_sd->bl.id); clif_displaymessage(fd, msg_txt(1160)); // Follow mode ON. } - + return 0; } @@ -5464,7 +5464,7 @@ ACMD_FUNC(useskill) bl = &sd->hd->bl; else bl = &sd->bl; - + if (skill_get_inf(skillnum)&INF_GROUND_SKILL) unit_skilluse_pos(bl, pl_sd->bl.x, pl_sd->bl.y, skillnum, skilllv); else @@ -5583,9 +5583,9 @@ ACMD_FUNC(marry) { struct map_session_data *pl_sd = NULL; char player_name[NAME_LENGTH] = ""; - + nullpo_retr(-1, sd); - + if (!message || !*message || sscanf(message, "%23s", player_name) != 1) { clif_displaymessage(fd, msg_txt(1172)); // Usage: @marry <char name> return -1; @@ -5621,7 +5621,7 @@ ACMD_FUNC(divorce) clif_displaymessage(fd, atcmd_output); return -1; } - + sprintf(atcmd_output, msg_txt(1176), sd->status.name); // '%s' and his/her partner are now divorced. clif_displaymessage(fd, atcmd_output); return 0; @@ -5634,7 +5634,7 @@ ACMD_FUNC(changelook) { int i, j = 0, k = 0; int pos[7] = { LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HEAD_BOTTOM,LOOK_WEAPON,LOOK_SHIELD,LOOK_SHOES,LOOK_ROBE }; - + if((i = sscanf(message, "%d %d", &j, &k)) < 1) { clif_displaymessage(fd, msg_txt(1177)); // Usage: @changelook {<position>} <view id> clif_displaymessage(fd, msg_txt(1178)); // Position: 1-Top 2-Middle 3-Bottom 4-Weapon 5-Shield 6-Shoes 7-Robe @@ -5660,7 +5660,7 @@ ACMD_FUNC(changelook) ACMD_FUNC(autotrade) { nullpo_retr(-1, sd); - + if( map[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) { clif_displaymessage(fd, msg_txt(1179)); // Autotrade is not allowed on this map. return -1; @@ -5670,12 +5670,12 @@ ACMD_FUNC(autotrade) clif_displaymessage(fd, msg_txt(1180)); // You cannot autotrade when dead. return -1; } - + if( !sd->state.vending && !sd->state.buyingstore ) { //check if player is vending or buying clif_displaymessage(fd, msg_txt(549)); // "You should have a shop open to use @autotrade." return -1; } - + sd->state.autotrade = 1; if( battle_config.at_timeout ) { @@ -5683,7 +5683,7 @@ ACMD_FUNC(autotrade) status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0); } clif_authfail_fd(fd, 15); - + return 0; } @@ -5711,7 +5711,7 @@ ACMD_FUNC(changegm) clif_displaymessage(fd, msg_txt(1183)); // Usage: @changegm <guild_member_name> return -1; } - + if((pl_sd=map_nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) { clif_displaymessage(fd, msg_txt(1184)); // Target character must be online and be a guild member. return -1; @@ -5728,7 +5728,7 @@ ACMD_FUNC(changegm) ACMD_FUNC(changeleader) { nullpo_retr(-1, sd); - + if( !message[0] ) { clif_displaymessage(fd, msg_txt(1185)); // Usage: @changeleader <party_member_name> @@ -5772,7 +5772,7 @@ ACMD_FUNC(partyoption) clif_displaymessage(fd, msg_txt(1186)); // Usage: @partyoption <pickup share: yes/no> <item distribution: yes/no> return -1; } - + option = (config_switch(w1)?1:0)|(config_switch(w2)?2:0); //Change item share type. @@ -6083,7 +6083,7 @@ ACMD_FUNC(clearweather) map[sd->bl.m].flag.leaves=0; clif_weather(sd->bl.m); clif_displaymessage(fd, msg_txt(291)); - + return 0; } @@ -6197,7 +6197,7 @@ ACMD_FUNC(npctalk) unsigned long color=0; if (sd->sc.count && //no "chatting" while muted. - (sd->sc.data[SC_BERSERK] || + (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))) return -1; @@ -6218,10 +6218,10 @@ ACMD_FUNC(npctalk) clif_displaymessage(fd, msg_txt(111)); // This NPC doesn't exist return -1; } - + strtok(name, "#"); // discard extra name identifier if present snprintf(temp, sizeof(temp), "%s : %s", name, mes); - + if(ifcolor) clif_messagecolor(&nd->bl,color,temp); else clif_message(&nd->bl, temp); @@ -6248,7 +6248,7 @@ ACMD_FUNC(pettalk) } if (sd->sc.count && //no "chatting" while muted. - (sd->sc.data[SC_BERSERK] || + (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))) return -1; @@ -6280,7 +6280,7 @@ ACMD_FUNC(pettalk) return 0; } sd->emotionlasttime = time(NULL); - + clif_emotion(&pd->bl, i); return 0; } @@ -6373,7 +6373,7 @@ ACMD_FUNC(summon) duration =1; else if (duration > 60) duration =60; - + if ((mob_id = atoi(name)) == 0) mob_id = mobdb_searchname(name); if(mob_id == 0 || mobdb_checkid(mob_id) == 0) @@ -6386,7 +6386,7 @@ ACMD_FUNC(summon) if(!md) return -1; - + md->master_id=sd->bl.id; md->special_state.ai=1; md->deletetimer=add_timer(tick+(duration*60000),mob_timer_delete,md->bl.id,0); @@ -6395,7 +6395,7 @@ ACMD_FUNC(summon) sc_start4(&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000); clif_skill_poseffect(&sd->bl,AM_CALLHOMUN,1,md->bl.x,md->bl.y,tick); clif_displaymessage(fd, msg_txt(39)); // All monster summoned! - + return 0; } @@ -6418,7 +6418,7 @@ ACMD_FUNC(adjgroup) clif_displaymessage(fd, msg_txt(1227)); // Specified group does not exist. return -1; } - + sd->group_id = new_group; pc_group_pc_load(sd);/* update cache */ clif_displaymessage(fd, msg_txt(1228)); // Group changed successfully. @@ -6502,7 +6502,7 @@ ACMD_FUNC(unmute) pl_sd->status.manner = 0; status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER); clif_displaymessage(sd->fd,msg_txt(1236)); // Player unmuted. - + return 0; } @@ -6737,7 +6737,7 @@ ACMD_FUNC(mobinfo) mob->status.def, mob->status.mdef,mob->status.str, mob->status.agi, mob->status.vit, mob->status.int_, mob->status.dex, mob->status.luk); clif_displaymessage(fd, atcmd_output); - + sprintf(atcmd_output, msg_txt(1244), // ATK:%d~%d Range:%d~%d~%d Size:%s Race: %s Element: %s (Lv:%d) mob->status.rhw.atk, mob->status.rhw.atk2, mob->status.rhw.range, mob->range2 , mob->range3, msize[mob->status.size], @@ -7006,7 +7006,7 @@ ACMD_FUNC(homtalk) } if (sd->sc.count && //no "chatting" while muted. - (sd->sc.data[SC_BERSERK] || + (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))) return -1; @@ -7080,7 +7080,7 @@ ACMD_FUNC(homstats) } hd = sd->hd; - + hom = &hd->homunculus; db = hd->homunculusDB; lv = hom->level; @@ -7089,7 +7089,7 @@ ACMD_FUNC(homstats) msg_txt(1266), lv, db->name); // Homunculus growth stats (Lv %d %s): clif_displaymessage(fd, atcmd_output); lv--; //Since the first increase is at level 2. - + evo = (hom->class_ == db->evo_class); min = db->base.HP +lv*db->gmin.HP +(evo?db->emin.HP:0); max = db->base.HP +lv*db->gmax.HP +(evo?db->emax.HP:0);; @@ -7179,12 +7179,12 @@ ACMD_FUNC(iteminfo) item_data = item_array[i]; sprintf(atcmd_output, msg_txt(1277), // Item: '%s'/'%s'[%d] (%d) Type: %s | Extra Effect: %s item_data->name,item_data->jname,item_data->slot,item_data->nameid, - itemdb_typename(item_data->type), + itemdb_typename(item_data->type), (item_data->script==NULL)? msg_txt(1278) : msg_txt(1279) // None / With script ); clif_displaymessage(fd, atcmd_output); - sprintf(atcmd_output, msg_txt(1280), item_data->value_buy, item_data->value_sell, item_data->weight/10. ); // NPC Buy:%dz, Sell:%dz | Weight: %.1f + sprintf(atcmd_output, msg_txt(1280), item_data->value_buy, item_data->value_sell, item_data->weight/10. ); // NPC Buy:%dz, Sell:%dz | Weight: %.1f clif_displaymessage(fd, atcmd_output); if (item_data->maxchance == -1) @@ -7235,7 +7235,7 @@ ACMD_FUNC(whodrops) } else { sprintf(atcmd_output, msg_txt(1287), MAX_SEARCH); // - Common mobs with highest drop chance (only max %d are listed): clif_displaymessage(fd, atcmd_output); - + for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++) { sprintf(atcmd_output, "- %s (%02.02f%%)", mob_db(item_data->mob[j].id)->jname, item_data->mob[j].chance/100.); @@ -7325,7 +7325,7 @@ ACMD_FUNC(adopt) clif_displaymessage(fd, output); return -1; } - + if((pl_sd3=map_nick2sd((char *) player3)) == NULL) { sprintf(output, msg_txt(1293), player3); // Cannot find player %s online. clif_displaymessage(fd, output); @@ -7335,7 +7335,7 @@ ACMD_FUNC(adopt) if( !pc_adoption(pl_sd1, pl_sd2, pl_sd3) ) { return -1; } - + clif_displaymessage(fd, msg_txt(1294)); // They are family... wish them luck. return 0; } @@ -7347,7 +7347,7 @@ ACMD_FUNC(version) if ((revision = get_svn_revision()) != 0) { sprintf(atcmd_output,msg_txt(1295),revision); // rAthena Version SVN r%s clif_displaymessage(fd,atcmd_output); - } else + } else clif_displaymessage(fd,msg_txt(1296)); // Cannot determine SVN revision. return 0; @@ -7358,7 +7358,7 @@ ACMD_FUNC(version) *------------------------------------------*/ static int atcommand_mutearea_sub(struct block_list *bl,va_list ap) { - + int time, id; struct map_session_data *pl_sd = (struct map_session_data *)bl; if (pl_sd == NULL) @@ -7386,11 +7386,11 @@ ACMD_FUNC(mutearea) clif_displaymessage(fd, msg_txt(1297)); // Please enter a time in minutes (usage: @mutearea/@stfu <time in minutes>). return -1; } - + time = atoi(message); - map_foreachinarea(atcommand_mutearea_sub,sd->bl.m, - sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, + map_foreachinarea(atcommand_mutearea_sub,sd->bl.m, + sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd->bl.id, time); return 0; @@ -7400,10 +7400,10 @@ ACMD_FUNC(mutearea) ACMD_FUNC(rates) { char buf[CHAT_SIZE_MAX]; - + nullpo_ret(sd); memset(buf, '\0', sizeof(buf)); - + snprintf(buf, CHAT_SIZE_MAX, msg_txt(1298), // Experience rates: Base %.2fx / Job %.2fx battle_config.base_exp_rate/100., battle_config.job_exp_rate/100.); clif_displaymessage(fd, buf); @@ -7416,7 +7416,7 @@ ACMD_FUNC(rates) snprintf(buf, CHAT_SIZE_MAX, msg_txt(1301), // Other Drop Rates: MvP %.2fx / Card-Based %.2fx / Treasure %.2fx battle_config.item_rate_mvp/100., battle_config.item_rate_adddrop/100., battle_config.item_rate_treasure/100.); clif_displaymessage(fd, buf); - + return 0; } @@ -7433,7 +7433,7 @@ ACMD_FUNC(me) memset(atcmd_output, '\0', sizeof(atcmd_output)); if (sd->sc.count && //no "chatting" while muted. - (sd->sc.data[SC_BERSERK] || + (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT))) return -1; @@ -7441,12 +7441,12 @@ ACMD_FUNC(me) clif_displaymessage(fd, msg_txt(1302)); // Please enter a message (usage: @me <message>). return -1; } - + sprintf(atcmd_output, msg_txt(270), sd->status.name, tempmes); // *%s %s* clif_disp_overhead(sd, atcmd_output); - + return 0; - + } /*========================================== @@ -7459,7 +7459,7 @@ ACMD_FUNC(size) nullpo_retr(-1, sd); size = cap_value(atoi(message),SZ_SMALL,SZ_BIG); - + if(sd->state.size) { sd->state.size = SZ_SMALL; pc_setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT); @@ -7512,9 +7512,9 @@ ACMD_FUNC(sizeguild) struct map_session_data *pl_sd; struct guild *g; nullpo_retr(-1, sd); - + memset(guild, '\0', sizeof(guild)); - + if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild) < 2 ) { clif_displaymessage(fd, msg_txt(1304)); // Please enter guild name/ID (usage: @sizeguild <size> <guild name/ID>). return -1; @@ -7524,9 +7524,9 @@ ACMD_FUNC(sizeguild) clif_displaymessage(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online. return -1; } - + size = cap_value(size,SZ_SMALL,SZ_BIG); - + for( i = 0; i < g->max_member; i++ ) { if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) { if( pl_sd->state.size ) { @@ -7591,7 +7591,7 @@ ACMD_FUNC(fakename) clif_displaymessage(sd->fd, msg_txt(1309)); // Fake name must be at least two characters. return -1; } - + safestrncpy(sd->fakename, message, sizeof(sd->fakename)); clif_charnameack(0, &sd->bl); clif_displaymessage(sd->fd, msg_txt(1310)); // Fake name enabled. @@ -7615,7 +7615,7 @@ ACMD_FUNC(mapflag) { int flag=9,i; nullpo_retr(-1, sd); memset(flag_name, '\0', sizeof(flag_name)); - + if (!message || !*message || (sscanf(message, "%99s %d", flag_name, &flag) < 1)) { clif_displaymessage(sd->fd,msg_txt(1311)); // Enabled Mapflags in this map: clif_displaymessage(sd->fd,"----------------------------------"); @@ -7637,7 +7637,7 @@ ACMD_FUNC(mapflag) { return 1; } for (i = 0; flag_name[i]; i++) flag_name[i] = tolower(flag_name[i]); //lowercase - + setflag(autotrade); setflag(allowks); setflag(nomemo); setflag(noteleport); setflag(noreturn); setflag(monster_noteleport);setflag(nosave); setflag(nobranch); setflag(noexppenalty); setflag(pvp); setflag(pvp_noparty); setflag(pvp_noguild); @@ -7705,7 +7705,7 @@ ACMD_FUNC(showdelay) clif_displaymessage(fd, msg_txt(1320)); // Skill delay failures will not be shown. return 0; } - + sd->state.showdelay = 1; clif_displaymessage(fd, msg_txt(1321)); // Skill delay failures are now shown. return 0; @@ -7730,21 +7730,21 @@ ACMD_FUNC(invite) clif_displaymessage(fd, msg_txt(350)); return 0; } - + if(duel_list[did].max_players_limit > 0 && duel_list[did].members_count >= duel_list[did].max_players_limit) { - + // "Duel: Limit of players is reached." clif_displaymessage(fd, msg_txt(351)); return 0; } - + if(target_sd == NULL) { // "Duel: Player not found." clif_displaymessage(fd, msg_txt(352)); return 0; } - + if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) { // "Duel: Player already in duel." clif_displaymessage(fd, msg_txt(353)); @@ -7757,7 +7757,7 @@ ACMD_FUNC(invite) clif_displaymessage(fd, atcmd_output); return 0; } - + duel_invite(did, sd, target_sd); // "Duel: Invitation has been sent." clif_displaymessage(fd, msg_txt(354)); @@ -7939,7 +7939,7 @@ ACMD_FUNC(clone) return 0; } - if (strcmpi(command+1, "clone") == 0) + if (strcmpi(command+1, "clone") == 0) flag = 1; else if (strcmpi(command+1, "slaveclone") == 0) { flag = 2; @@ -8010,10 +8010,10 @@ ACMD_FUNC(main) // send the message using inter-server system intif_main_message( sd, message ); } - + } else { - - if(sd->state.mainchat) + + if(sd->state.mainchat) clif_displaymessage(fd, msg_txt(384)); // Main chat currently enabled. Usage: @main <on|off>, @main <message>. else clif_displaymessage(fd, msg_txt(385)); // Main chat currently disabled. Usage: @main <on|off>, @main <message>. @@ -8034,7 +8034,7 @@ ACMD_FUNC(noask) clif_displaymessage(fd, msg_txt(390)); // Autorejecting is activated. sd->state.noask = 1; } - + return 0; } @@ -8132,7 +8132,7 @@ ACMD_FUNC(allowks) ACMD_FUNC(resetstat) { nullpo_retr(-1, sd); - + pc_resetstate(sd); sprintf(atcmd_output, msg_txt(207), sd->status.name); clif_displaymessage(fd, atcmd_output); @@ -8142,7 +8142,7 @@ ACMD_FUNC(resetstat) ACMD_FUNC(resetskill) { nullpo_retr(-1,sd); - + pc_resetskill(sd,1); sprintf(atcmd_output, msg_txt(206), sd->status.name); clif_displaymessage(fd, atcmd_output); @@ -8217,35 +8217,35 @@ ACMD_FUNC(itemlist) if( it->equip ) { char equipstr[CHAT_SIZE_MAX]; - strcpy(equipstr, msg_txt(1333)); // | equipped: + strcpy(equipstr, msg_txt(1333)); // | equipped: if( it->equip & EQP_GARMENT ) - strcat(equipstr, msg_txt(1334)); // garment, + strcat(equipstr, msg_txt(1334)); // garment, if( it->equip & EQP_ACC_L ) - strcat(equipstr, msg_txt(1335)); // left accessory, + strcat(equipstr, msg_txt(1335)); // left accessory, if( it->equip & EQP_ARMOR ) - strcat(equipstr, msg_txt(1336)); // body/armor, + strcat(equipstr, msg_txt(1336)); // body/armor, if( (it->equip & EQP_ARMS) == EQP_HAND_R ) - strcat(equipstr, msg_txt(1337)); // right hand, + strcat(equipstr, msg_txt(1337)); // right hand, if( (it->equip & EQP_ARMS) == EQP_HAND_L ) - strcat(equipstr, msg_txt(1338)); // left hand, + strcat(equipstr, msg_txt(1338)); // left hand, if( (it->equip & EQP_ARMS) == EQP_ARMS ) - strcat(equipstr, msg_txt(1339)); // both hands, + strcat(equipstr, msg_txt(1339)); // both hands, if( it->equip & EQP_SHOES ) - strcat(equipstr, msg_txt(1340)); // feet, + strcat(equipstr, msg_txt(1340)); // feet, if( it->equip & EQP_ACC_R ) - strcat(equipstr, msg_txt(1341)); // right accessory, + strcat(equipstr, msg_txt(1341)); // right accessory, if( (it->equip & EQP_HELM) == EQP_HEAD_LOW ) - strcat(equipstr, msg_txt(1342)); // lower head, + strcat(equipstr, msg_txt(1342)); // lower head, if( (it->equip & EQP_HELM) == EQP_HEAD_TOP ) - strcat(equipstr, msg_txt(1343)); // top head, + strcat(equipstr, msg_txt(1343)); // top head, if( (it->equip & EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_TOP) ) - strcat(equipstr, msg_txt(1344)); // lower/top head, + strcat(equipstr, msg_txt(1344)); // lower/top head, if( (it->equip & EQP_HELM) == EQP_HEAD_MID ) - strcat(equipstr, msg_txt(1345)); // mid head, + strcat(equipstr, msg_txt(1345)); // mid head, if( (it->equip & EQP_HELM) == (EQP_HEAD_LOW|EQP_HEAD_MID) ) - strcat(equipstr, msg_txt(1346)); // lower/mid head, + strcat(equipstr, msg_txt(1346)); // lower/mid head, if( (it->equip & EQP_HELM) == EQP_HELM ) - strcat(equipstr, msg_txt(1347)); // lower/mid/top head, + strcat(equipstr, msg_txt(1347)); // lower/mid/top head, // remove final ', ' equipstr[strlen(equipstr) - 2] = '\0'; StringBuf_AppendStr(&buf, equipstr); @@ -8285,7 +8285,7 @@ ACMD_FUNC(itemlist) counter2++; if( counter2 == 1 ) - StringBuf_AppendStr(&buf, msg_txt(1352)); // -> (card(s): + StringBuf_AppendStr(&buf, msg_txt(1352)); // -> (card(s): if( counter2 != 1 ) StringBuf_AppendStr(&buf, ", "); @@ -8369,7 +8369,7 @@ ACMD_FUNC(stats) sprintf(output, msg_txt(53), sd->status.name); // '%s' stats: clif_displaymessage(fd, output); - + for (i = 0; output_table[i].format != NULL; i++) { sprintf(output, output_table[i].format, output_table[i].value); clif_displaymessage(fd, output); @@ -8509,7 +8509,7 @@ static void atcommand_commands_sub(struct map_session_data* sd, const int fd, At default: continue; } - + slen = strlen(cmd->command); @@ -8569,18 +8569,18 @@ ACMD_FUNC(mount2) { ACMD_FUNC(accinfo) { char query[NAME_LENGTH]; - + if (!message || !*message || strlen(message) > NAME_LENGTH ) { clif_displaymessage(fd, msg_txt(1365)); // Usage: @accinfo/@accountinfo <account_id/char name> clif_displaymessage(fd, msg_txt(1366)); // You may search partial name by making use of '%' in the search, ex. "@accinfo %Mario%" lists all characters whose name contains "Mario". return -1; } - + //remove const type safestrncpy(query, message, NAME_LENGTH); - + intif_request_accinfo( sd->fd, sd->bl.id, sd->group_id, query ); - + return 0; } @@ -8590,15 +8590,15 @@ ACMD_FUNC(set) { struct script_data* data; int toset = 0; bool is_str = false; - + if( !message || !*message || (toset = sscanf(message, "%32s %128[^\n]s", reg, val)) < 1 ) { clif_displaymessage(fd, msg_txt(1367)); // Usage: @set <variable name> <value> clif_displaymessage(fd, msg_txt(1368)); // Usage: ex. "@set PoringCharVar 50" clif_displaymessage(fd, msg_txt(1369)); // Usage: ex. "@set PoringCharVarSTR$ Super Duper String" - clif_displaymessage(fd, msg_txt(1370)); // Usage: ex. "@set PoringCharVarSTR$" outputs its value, Super Duper String. + clif_displaymessage(fd, msg_txt(1370)); // Usage: ex. "@set PoringCharVarSTR$" outputs its value, Super Duper String. return -1; } - + /* disabled variable types (they require a proper script state to function, so allowing them would crash the server) */ if( reg[0] == '.' ) { clif_displaymessage(fd, msg_txt(1371)); // NPC variables may not be used with @set. @@ -8609,7 +8609,7 @@ ACMD_FUNC(set) { } is_str = ( reg[strlen(reg) - 1] == '$' ) ? true : false; - + if( toset >= 2 ) {/* we only set the var if there is an val, otherwise we only output the value */ if( is_str ) set_var(sd, reg, (void*) val); @@ -8617,12 +8617,12 @@ ACMD_FUNC(set) { set_var(sd, reg, (void*)__64BPRTSIZE((int)(atoi(val)))); } - + CREATE(data, struct script_data,1); - - + + if( is_str ) {// string variable - + switch( reg[0] ) { case '@': data->u.str = pc_readregstr(sd, add_str(reg)); @@ -8640,7 +8640,7 @@ ACMD_FUNC(set) { data->u.str = pc_readglobalreg_str(sd, reg); break; } - + if( data->u.str == NULL || data->u.str[0] == '\0' ) {// empty string data->type = C_CONSTSTR; data->u.str = ""; @@ -8648,9 +8648,9 @@ ACMD_FUNC(set) { data->type = C_STR; data->u.str = aStrdup(data->u.str); } - + } else {// integer variable - + data->type = C_INT; switch( reg[0] ) { case '@': @@ -8669,10 +8669,10 @@ ACMD_FUNC(set) { data->u.num = pc_readglobalreg(sd, reg); break; } - + } - - + + switch( data->type ) { case C_INT: sprintf(atcmd_output,msg_txt(1373),reg,data->u.num); // %s value is now :%d @@ -8687,11 +8687,11 @@ ACMD_FUNC(set) { sprintf(atcmd_output,msg_txt(1376),reg,data->type); // %s data type is not supported :%u break; } - + clif_displaymessage(fd, atcmd_output); - + aFree(data); - + return 0; } ACMD_FUNC(reloadquestdb) { @@ -8703,7 +8703,7 @@ ACMD_FUNC(addperm) { int perm_size = ARRAYLENGTH(pc_g_permission_name); bool add = (strcmpi(command+1, "addperm") == 0) ? true : false; int i; - + if( !message || !*message ) { sprintf(atcmd_output, msg_txt(1378),command); // Usage: %s <permission_name> clif_displaymessage(fd, atcmd_output); @@ -8714,7 +8714,7 @@ ACMD_FUNC(addperm) { } return -1; } - + ARR_FIND(0, perm_size, i, strcmpi(pc_g_permission_name[i].name, message) == 0); if( i == perm_size ) { @@ -8727,7 +8727,7 @@ ACMD_FUNC(addperm) { } return -1; } - + if( add && (sd->permissions&pc_g_permission_name[i].permission) ) { sprintf(atcmd_output, msg_txt(1381),sd->status.name,pc_g_permission_name[i].name); // User '%s' already possesses the '%s' permission. clif_displaymessage(fd, atcmd_output); @@ -8743,10 +8743,10 @@ ACMD_FUNC(addperm) { clif_displaymessage(fd, atcmd_output); } } - - return -1; + + return -1; } - + if( add ) sd->permissions |= pc_g_permission_name[i].permission; else @@ -8755,16 +8755,16 @@ ACMD_FUNC(addperm) { sprintf(atcmd_output, msg_txt(1384),sd->status.name); // User '%s' permissions updated successfully. The changes are temporary. clif_displaymessage(fd, atcmd_output); - + return 0; } ACMD_FUNC(unloadnpcfile) { - + if( !message || !*message ) { clif_displaymessage(fd, msg_txt(1385)); // Usage: @unloadnpcfile <file name> return -1; } - + if( npc_unloadfile(message) ) clif_displaymessage(fd, msg_txt(1386)); // File unloaded. Be aware that mapflags and monsters spawned directly are not removed. else { @@ -8781,7 +8781,7 @@ ACMD_FUNC(cart) { int val = atoi(message); bool need_skill = pc_checkskill(sd, MC_PUSHCART) ? false : true; - + if( !message || !*message || val < 0 || val > MAX_CARTS ) { sprintf(atcmd_output, msg_txt(1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>). clif_displaymessage(fd, atcmd_output); @@ -8792,24 +8792,24 @@ ACMD_FUNC(cart) { clif_displaymessage(fd, msg_txt(1391)); // You do not possess a cart to be removed return -1; } - + if( need_skill ) { MC_CART_MDFY(1); } - + if( pc_setcart(sd, val) ) { if( need_skill ) { MC_CART_MDFY(0); } return -1;/* @cart failed */ } - + if( need_skill ) { MC_CART_MDFY(0); } - + clif_displaymessage(fd, msg_txt(1392)); // Cart Added - + return 0; #undef MC_CART_MDFY } @@ -9127,7 +9127,7 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n atcommand_iter = db_iterator(atcommand_db); alias_iter = db_iterator(atcommand_alias_db); - + // Build the matches for (command_info = dbi_first(atcommand_iter); dbi_exists(atcommand_iter); command_info = dbi_next(atcommand_iter)) { match = strstr(command_info->command, name); @@ -9141,7 +9141,7 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n ++full_count; } } - + for (alias_info = dbi_first(alias_iter); dbi_exists(alias_iter); alias_info = dbi_next(alias_iter)) { match = strstr(alias_info->alias, name); can_use = pc_can_use_command(sd, alias_info->command->command, type); @@ -9168,7 +9168,7 @@ static void atcommand_get_suggestions(struct map_session_data* sd, const char *n // Build the suggestion string strcpy(buffer, msg_txt(205)); strcat(buffer,"\n"); - + for(i=0; i < prefix_count; ++i) { strcat(buffer,suggestions[i]); strcat(buffer," "); @@ -9188,31 +9188,31 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message char charname2[NAME_LENGTH], params2[100]; char command[100]; char output[CHAT_SIZE_MAX]; - + //Reconstructed message char atcmd_msg[CHAT_SIZE_MAX]; - + TBL_PC * ssd = NULL; //sd for target AtCommandInfo * info; nullpo_retr(false, sd); - + //Shouldn't happen if ( !message || !*message ) return false; - + //Block NOCHAT but do not display it as a normal message if ( sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCOMMAND ) return true; - + // skip 10/11-langtype's codepage indicator, if detected if ( message[0] == '|' && strlen(message) >= 4 && (message[3] == atcommand_symbol || message[3] == charcommand_symbol) ) message += 3; - + //Should display as a normal message if ( *message != atcommand_symbol && *message != charcommand_symbol ) return false; - + // type value 0 = server invoked: bypass restrictions // 1 = player invoked if ( type == 1) { @@ -9230,7 +9230,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message //Checks to see if #command has a name or a name + parameters. x = sscanf(message, "%99s \"%23[^\"]\" %99[^\n]", command, charname, params); y = sscanf(message, "%99s %23s %99[^\n]", command, charname2, params2); - + //z always has the value of the scan that was successful z = ( x > 1 ) ? x : y; @@ -9251,7 +9251,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message sprintf(atcmd_msg, "%s", command); break; } - + if( !pc_get_group_level(sd) ) { if( x >= 1 || y >= 1 ) { /* we have command */ info = get_atcommandinfo_byname(atcommand_checkalias(command + 1)); @@ -9260,7 +9260,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message } else return false;/* display as normal message */ } - + sprintf(output, msg_txt(1388), charcommand_symbol); // Charcommand failed (usage: %c<command> <char name> <parameters>). clif_displaymessage(fd, output); return true; @@ -9268,15 +9268,15 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message } else if (*message == atcommand_symbol) { //atcmd_msg is constructed above differently for charcommands - //it's copied from message if not a charcommand so it can + //it's copied from message if not a charcommand so it can //pass through the rest of the code compatible with both symbols sprintf(atcmd_msg, "%s", message); } - - //Clearing these to be used once more. + + //Clearing these to be used once more. memset(command, '\0', sizeof(command)); memset(params, '\0', sizeof(params)); - + //check to see if any params exist within this command if( sscanf(atcmd_msg, "%99s %99[^\n]", command, params) < 2 ) params[0] = '\0'; @@ -9319,7 +9319,7 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message } else return false; } - + // type == 1 : player invoked if (type == 1) { if ((*command == atcommand_symbol && info->at_groups[sd->group_pos] == 0) || @@ -9375,7 +9375,7 @@ static void atcommand_config_read(const char* config_filename) *symbol != '/' && // symbol of client commands *symbol != '%' && // symbol of party chat *symbol != '$' && // symbol of guild chat - *symbol != charcommand_symbol) + *symbol != charcommand_symbol) atcommand_symbol = *symbol; } @@ -9453,7 +9453,7 @@ void atcommand_db_load_groups(int* group_ids) { DBIterator *iter = db_iterator(atcommand_db); AtCommandInfo* cmd; int i; - + for (cmd = dbi_first(iter); dbi_exists(iter); cmd = dbi_next(iter)) { cmd->at_groups = aMalloc( pc_group_max * sizeof(char) ); cmd->char_groups = aMalloc( pc_group_max * sizeof(char) ); @@ -9468,29 +9468,29 @@ void atcommand_db_load_groups(int* group_ids) { cmd->char_groups[i] = 0; } } - + dbi_destroy(iter); - + return; } void atcommand_db_clear(void) { - + if (atcommand_db != NULL) { DBIterator *iter = db_iterator(atcommand_db); AtCommandInfo* cmd; - + for (cmd = dbi_first(iter); dbi_exists(iter); cmd = dbi_next(iter)) { aFree(cmd->at_groups); aFree(cmd->char_groups); } - + dbi_destroy(iter); db_destroy(atcommand_db); } if (atcommand_alias_db != NULL) db_destroy(atcommand_alias_db); - + config_destroy(&atcommand_config); } diff --git a/src/map/battle.c b/src/map/battle.c index 5e9fb1bc1..b9c865099 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -47,9 +47,9 @@ int battle_getcurrentskill(struct block_list *bl) { //Returns the current/last s struct skill_unit * su = (struct skill_unit*)bl; return su->group?su->group->skill_id:0; } - + ud = unit_bl2ud(bl); - + return ud?ud->skillid:0; } @@ -68,10 +68,10 @@ static int battle_gettargeted_sub(struct block_list *bl, va_list ap) { if (bl->id == target_id) return 0; - + if (*c >= 24) return 0; - + if ( !(ud = unit_bl2ud(bl)) ) return 0; @@ -79,7 +79,7 @@ static int battle_gettargeted_sub(struct block_list *bl, va_list ap) { bl_list[(*c)++] = bl; return 1; } - + return 0; } @@ -100,7 +100,7 @@ struct block_list* battle_gettargeted(struct block_list *target) { //Returns the id of the current targetted character of the passed bl. [Skotlex] int battle_gettarget(struct block_list* bl) { - + switch (bl->type) { case BL_PC: return ((struct map_session_data*)bl)->ud.target; case BL_MOB: return ((struct mob_data*)bl)->target_id; @@ -109,7 +109,7 @@ int battle_gettarget(struct block_list* bl) { case BL_MER: return ((struct mercenary_data*)bl)->ud.target; case BL_ELEM: return ((struct elemental_data*)bl)->ud.target; } - + return 0; } @@ -124,18 +124,18 @@ static int battle_getenemy_sub(struct block_list *bl, va_list ap) { if (bl->id == target->id) return 0; - + if (*c >= 24) return 0; - + if (status_isdead(bl)) return 0; - + if (battle_check_target(target, bl, BCT_ENEMY) > 0) { bl_list[(*c)++] = bl; return 1; } - + return 0; } @@ -143,16 +143,16 @@ static int battle_getenemy_sub(struct block_list *bl, va_list ap) { struct block_list* battle_getenemy(struct block_list *target, int type, int range) { struct block_list *bl_list[24]; int c = 0; - + memset(bl_list, 0, sizeof(bl_list)); map_foreachinrange(battle_getenemy_sub, target, range, type, bl_list, &c, target); - + if ( c == 0 ) return NULL; - + if( c > 24 ) c = 24; - + return bl_list[rnd()%c]; } static int battle_getenemyarea_sub(struct block_list *bl, va_list ap) { @@ -166,18 +166,18 @@ static int battle_getenemyarea_sub(struct block_list *bl, va_list ap) { if( bl->id == src->id || bl->id == ignore_id ) return 0; // Ignores Caster and a possible pre-target - + if( *c >= 23 ) return 0; - + if( status_isdead(bl) ) return 0; - + if( battle_check_target(src, bl, BCT_ENEMY) > 0 ) {// Is Enemy!... bl_list[(*c)++] = bl; return 1; } - + return 0; } @@ -185,15 +185,15 @@ static int battle_getenemyarea_sub(struct block_list *bl, va_list ap) { struct block_list* battle_getenemyarea(struct block_list *src, int x, int y, int range, int type, int ignore_id) { struct block_list *bl_list[24]; int c = 0; - + memset(bl_list, 0, sizeof(bl_list)); map_foreachinarea(battle_getenemyarea_sub, src->m, x - range, y - range, x + range, y + range, type, bl_list, &c, src, ignore_id); - + if( c == 0 ) return NULL; if( c >= 24 ) c = 23; - + return bl_list[rnd()%c]; } @@ -212,18 +212,18 @@ struct delay_damage { int battle_delay_damage_sub(int tid, unsigned int tick, int id, intptr_t data) { struct delay_damage *dat = (struct delay_damage *)data; - + if ( dat ) { struct block_list* src; struct block_list* target = map_id2bl(dat->target_id); - + if( !target || status_isdead(target) ) {/* nothing we can do */ ers_free(delay_damage_ers, dat); return 0; } - + src = map_id2bl(dat->src_id); - + if( src && target->m == src->m && (target->type != BL_PC || ((TBL_PC*)target)->invincible_timer == INVALID_TIMER) && check_distance_bl(src, target, dat->distance) ) //Check to see if you haven't teleported. [Skotlex] @@ -284,12 +284,12 @@ int battle_delay_damage (unsigned int tick, int amotion, struct block_list *src, amotion = 1000; //Aegis places a damage-delay cap of 1 sec to non player attacks. [Skotlex] add_timer(tick+amotion, battle_delay_damage_sub, 0, (intptr_t)dat); - + return 0; } int battle_attr_ratio(int atk_elem,int def_type, int def_lv) { - + if (atk_elem < 0 || atk_elem >= ELE_MAX) return 100; @@ -300,7 +300,7 @@ int battle_attr_ratio(int atk_elem,int def_type, int def_lv) } /*========================================== - * Does attribute fix modifiers. + * Does attribute fix modifiers. * Added passing of the chars so that the status changes can affect it. [Skotlex] * Note: Passing src/target == NULL is perfectly valid, it skips SC_ checks. *------------------------------------------*/ @@ -308,10 +308,10 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag { struct status_change *sc=NULL, *tsc=NULL; int ratio; - + if (src) sc = status_get_sc(src); if (target) tsc = status_get_sc(target); - + if (atk_elem < 0 || atk_elem >= ELE_MAX) atk_elem = rnd()%ELE_MAX; @@ -336,11 +336,11 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag struct skill_unit_group *sg; struct block_list *src; int x,y; - + if( !su || !su->alive || (sg = su->group) == NULL || !sg || sg->val3 == -1 || (src = map_id2bl(sg->src_id)) == NULL || status_isdead(src) ) return 0; - + if( sg->unit_id != UNT_FIREWALL ) { x = sg->val3 >> 16; y = sg->val3 & 0xffff; @@ -373,7 +373,7 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag break; case ELE_POISON: if( tsc->data[SC_VENOMIMPRESS]) ratio += tsc->data[SC_VENOMIMPRESS]->val2; - break; + break; case ELE_WIND: if( tsc->data[SC_CRYSTALIZE] && target->type != BL_MOB) damage += damage/2; if( tsc->data[SC_WATER_INSIGNIA]) damage += damage/2; @@ -381,10 +381,10 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag case ELE_WATER: if( tsc->data[SC_FIRE_INSIGNIA]) damage += damage/2; break; - case ELE_EARTH: + case ELE_EARTH: if( tsc->data[SC_WIND_INSIGNIA]) damage += damage/2; break; - } + } } //end tsc check if( src && src->type == BL_PC ){ struct map_session_data *sd = BL_CAST(BL_PC, src); @@ -398,11 +398,11 @@ int battle_attr_fix(struct block_list *src, struct block_list *target, int damag if( target && target->type == BL_PC ) { struct map_session_data *tsd = BL_CAST(BL_PC, target); int t; - + ARR_FIND(1, 6, t, tsd->talisman[t] > 0); - + if( t < 5 && atk_elem == t ) - damage -= damage * tsd->talisman[t] * 3 / 100; // -3% custom value + damage -= damage * tsd->talisman[t] * 3 / 100; // -3% custom value } return damage*ratio/100; } @@ -464,7 +464,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag (skill_num && skill_get_ele(skill_num, skill_lv) == ELE_GHOST) || (!skill_num && (status_get_status_data(src))->rhw.ele == ELE_GHOST) ){ - if( skill_num == WL_SOULEXPANSION ) + if( skill_num == WL_SOULEXPANSION ) damage <<= 1; // If used against a player in White Imprison, the skill deals double damage. status_change_end(bl,SC_WHITEIMPRISON,INVALID_TIMER); // Those skills do damage and removes effect }else{ @@ -556,7 +556,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag clif_skill_nodamage(bl, bl, LK_PARRYING, sce->val1,1); return 0; } - + if(sc->data[SC_DODGE] && ( !sc->opt1 || sc->opt1 == OPT1_BURNING ) && (flag&BF_LONG || sc->data[SC_SPURT]) && rnd()%100 < 20) { @@ -595,7 +595,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if (((sce=sc->data[SC_UTSUSEMI]) || sc->data[SC_BUNSINJYUTSU]) && flag&BF_WEAPON && !(skill_get_nk(skill_num)&NK_NO_CARDFIX_ATK)) { - + skill_additional_effect (src, bl, skill_num, skill_lv, flag, ATK_BLOCK, gettick() ); if( !status_isdead(src) ) skill_counter_additional_effect( src, bl, skill_num, skill_lv, flag, gettick() ); @@ -608,7 +608,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag status_change_end(bl, SC_UTSUSEMI, INVALID_TIMER); if ((sce=sc->data[SC_BUNSINJYUTSU]) && --(sce->val2) <= 0) status_change_end(bl, SC_BUNSINJYUTSU, INVALID_TIMER); - + return 0; } @@ -646,7 +646,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag case W_2HAXE: damage = damage * 150 / 100; break; - case W_MUSICAL: + case W_MUSICAL: case W_WHIP: if(!sd->state.arrow_atk) break; @@ -762,7 +762,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( sc->data[SC_MEIKYOUSISUI] && rand()%100 < 40 ) // custom value damage = 0; - + if (!damage) return 0; @@ -787,7 +787,7 @@ int battle_calc_damage(struct block_list *src,struct block_list *bl,struct Damag if( sd && (sce = sc->data[SC_FORCEOFVANGUARD]) && flag&BF_WEAPON && rnd()%100 < sce->val2 ) pc_addspiritball(sd,skill_get_time(LG_FORCEOFVANGUARD,sce->val1),sce->val3); - + if( sc->data[SC__DEADLYINFECT] && damage > 0 && rnd()%100 < 65 + 5 * sc->data[SC__DEADLYINFECT]->val1 ) status_change_spread(bl, src); // Deadly infect attacked side @@ -915,7 +915,7 @@ int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int dam if( bl->type == BL_MOB ) { struct mob_data* md = BL_CAST(BL_MOB, bl); - if( map[bl->m].flag.battleground && (md->class_ == 1914 || md->class_ == 1915) && flag&BF_SKILL ) + if( map[bl->m].flag.battleground && (md->class_ == MOBID_BLUE_CRYST || md->class_ == MOBID_PINK_CRYST) && flag&BF_SKILL ) return 0; // Crystal cannot receive skill damage on battlegrounds } @@ -943,7 +943,7 @@ int battle_calc_bg_damage(struct block_list *src, struct block_list *bl, int dam if( flag&BF_LONG ) damage = damage * battle_config.bg_long_damage_rate/100; } - + if( !damage ) damage = 1; } @@ -979,7 +979,7 @@ int battle_calc_gvg_damage(struct block_list *src,struct block_list *bl,int dama if (class_ == MOBID_EMPERIUM && (!g || guild_checkskill(g,GD_APPROVAL) <= 0 )) return 0; - + if (g && battle_config.guild_max_castles && guild_checkcastles(g)>=battle_config.guild_max_castles) return 0; // [MouseJstr] } @@ -1162,7 +1162,7 @@ static int battle_calc_base_damage(struct status_data *status, struct weapon_atk if (!sd) { //Mobs/Pets if(flag&4) - { + { atkmin = status->matk_min; atkmax = status->matk_max; } else { @@ -1178,13 +1178,13 @@ static int battle_calc_base_damage(struct status_data *status, struct weapon_atk if (!(flag&1) || (flag&2)) { //Normal attacks atkmin = status->dex; - + if (sd->equip_index[type] >= 0 && sd->inventory_data[sd->equip_index[type]]) atkmin = atkmin*(80 + sd->inventory_data[sd->equip_index[type]]->wlv*20)/100; if (atkmin > atkmax) atkmin = atkmax; - + if(flag&2 && !(flag&16)) { //Bows atkmin = atkmin*atkmax/100; @@ -1193,16 +1193,16 @@ static int battle_calc_base_damage(struct status_data *status, struct weapon_atk } } } - + if (sc && sc->data[SC_MAXIMIZEPOWER]) atkmin = atkmax; - + //Weapon Damage calculation if (!(flag&1)) damage = (atkmax>atkmin? rnd()%(atkmax-atkmin):0)+atkmin; - else + else damage = atkmax; - + if (sd) { //rodatazone says the range is 0~arrow_atk-1 for non crit @@ -1215,13 +1215,13 @@ static int battle_calc_base_damage(struct status_data *status, struct weapon_atk sd->left_weapon.atkmods[t_size]: sd->right_weapon.atkmods[t_size])/100; } - + //Finally, add baseatk if(flag&4) damage += status->matk_min; else damage += status->batk; - + //rodatazone says that Overrefine bonuses are part of baseatk //Here we also apply the weapon_atk_rate bonus so it is correctly applied on left/right hands. if(sd) { @@ -1248,7 +1248,7 @@ void battle_consume_ammo(TBL_PC*sd, int skill, int lv) int qty=1; if (!battle_config.arrow_decrement) return; - + if (skill) { qty = skill_get_ammo_qty(skill, lv); if (!qty) qty = 1; @@ -1337,7 +1337,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo //Initial flag flag.rh=1; flag.weapon=1; - flag.infdef=(tstatus->mode&MD_PLANT && skill_num != RA_CLUSTERBOMB + flag.infdef=(tstatus->mode&MD_PLANT && skill_num != RA_CLUSTERBOMB #ifdef RENEWAL && skill_num != HT_FREEZINGTRAP #endif @@ -1382,7 +1382,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo (!sd && ((skill_num && skill_get_ammotype(skill_num)) || sstatus->rhw.range>3)) ) flag.arrow = 1; - + if(skill_num){ wd.flag |= battle_range_type(src, target, skill_num, skill_lv); switch(skill_num) @@ -1417,7 +1417,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo case GS_CHAINACTION: wd.type = 0x08; break; - + case GS_GROUNDDRIFT: case KN_SPEARSTAB: case KN_BOWLINGBASH: @@ -1442,7 +1442,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } } else //Range for normal attacks. wd.flag |= flag.arrow?BF_LONG:BF_SHORT; - + if ( (!skill_num || skill_num == PA_SACRIFICE) && tstatus->flee2 && rnd()%1000 < tstatus->flee2 ) { //Check for Lucky Dodge wd.type=0x0b; @@ -1493,7 +1493,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( sd && !skill_num ) { //Check for double attack. if( ( ( skill_lv = pc_checkskill(sd,TF_DOUBLE) ) > 0 && sd->weapontype1 == W_DAGGER ) - || ( sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST ) //Will fail bare-handed + || ( sd->bonus.double_rate > 0 && sd->weapontype1 != W_FIST ) //Will fail bare-handed || ( sc && sc->data[SC_KAGEMUSYA] && sd->weapontype1 != W_FIST )) // Need confirmation { //Success chance is not added, the higher one is used [Skotlex] if( rnd()%100 < ( 5*skill_lv > sd->bonus.double_rate ? 5*skill_lv : sc && sc->data[SC_KAGEMUSYA]?sc->data[SC_KAGEMUSYA]->val1*3:sd->bonus.double_rate ) ) @@ -1542,7 +1542,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo //The official equation is *2, but that only applies when sd's do critical. //Therefore, we use the old value 3 on cases when an sd gets attacked by a mob cri -= tstatus->luk*(!sd&&tsd?3:2); - + if( tsc && tsc->data[SC_SLEEP] ) { cri <<= 1; } @@ -1667,7 +1667,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo case GN_CARTCANNON: if( sd && pc_checkskill(sd, GN_REMODELING_CART) ) hitrate += pc_checkskill(sd, GN_REMODELING_CART) * 4; - break; + break; case GC_VENOMPRESSURE: hitrate += 10 + 4 * skill_lv; break; @@ -1677,13 +1677,13 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo // Weaponry Research hidden bonus if ((skill = pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0) hitrate += hitrate * ( 2 * skill ) / 100; - - if( (sd->status.weapon == W_1HSWORD || sd->status.weapon == W_DAGGER) && + + if( (sd->status.weapon == W_1HSWORD || sd->status.weapon == W_DAGGER) && (skill = pc_checkskill(sd, GN_TRAINING_SWORD))>0 ) hitrate += 3 * skill; } - - hitrate = cap_value(hitrate, battle_config.min_hitrate, battle_config.max_hitrate); + + hitrate = cap_value(hitrate, battle_config.min_hitrate, battle_config.max_hitrate); if(rnd()%100 >= hitrate) wd.dmg_lv = ATK_FLEE; @@ -1818,7 +1818,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo skillratio += sc->data[SC_OVERTHRUST]->val3; if(sc->data[SC_MAXOVERTHRUST]) skillratio += sc->data[SC_MAXOVERTHRUST]->val2; - if(sc->data[SC_BERSERK]) + if(sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) skillratio += 100; if(sc->data[SC_ZENKAI] && sstatus->rhw.ele == sc->data[SC_ZENKAI]->val2 ) skillratio += sc->data[SC_ZENKAI]->val1 * 2; @@ -1837,7 +1837,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo break; case SM_MAGNUM: case MS_MAGNUM: - skillratio += 20*skill_lv; + skillratio += 20*skill_lv; break; case MC_MAMMONITE: skillratio += 50*skill_lv; @@ -2030,7 +2030,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if (sd && index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON) - weight = sd->inventory_data[index]->weight/20; + weight = sd->inventory_data[index]->weight/20; ATK_ADD(weight * skill_lv) skillratio += 50*skill_lv; } @@ -2142,7 +2142,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo { int k = (wflag-1)/3; //+100% every 3 cells of distance if( k > 2 ) k = 2; // ...but hard-limited to 300%. - skillratio += 100 * k; + skillratio += 100 * k; } break; case HT_PHANTASMIC: @@ -2169,7 +2169,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( sd ) { short index = sd->equip_index[EQI_HAND_R]; - if( index >= 0 && sd->inventory_data[index] + if( index >= 0 && sd->inventory_data[index] && sd->inventory_data[index]->type == IT_WEAPON ) skillratio += max(10000 - sd->inventory_data[index]->weight, 0) / 10; skillratio += 50 * pc_checkskill(sd,LK_SPIRALPIERCE); @@ -2349,13 +2349,13 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo RE_LVL_DMOD(100); break; case LG_SHIELDSPELL:// [(Casters Base Level x 4) + (Shield DEF x 10) + (Casters VIT x 2)] % - if( sd ) { + if( sd ) { struct item_data *shield_data = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; skillratio = status_get_lv(src) * 4 + status_get_vit(src) * 2; if( shield_data ) skillratio += shield_data->def * 10; } else - skillratio += 2400; //2500% + skillratio += 2400; //2500% break; case LG_MOONSLASHER: skillratio += -100 + (120 * skill_lv + ((sd) ? pc_checkskill(sd,LG_OVERBRAND) : 5) * 80); @@ -2407,11 +2407,11 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo skillratio += sstatus->int_ * 2; } break; - case SR_FALLENEMPIRE:// ATK [(Skill Level x 150 + 100) x Caster Base Level / 150] % + case SR_FALLENEMPIRE:// ATK [(Skill Level x 150 + 100) x Caster Base Level / 150] % skillratio += 150 *skill_lv; RE_LVL_DMOD(150); break; - case SR_TIGERCANNON:// ATK [((Caster consumed HP + SP) / 4) x Caster Base Level / 100] % + case SR_TIGERCANNON:// ATK [((Caster consumed HP + SP) / 4) x Caster Base Level / 100] % { int hp = sstatus->max_hp * (10 + 2 * skill_lv) / 100, sp = sstatus->max_sp * (6 + skill_lv) / 100; @@ -2442,8 +2442,8 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo skillratio = status_get_lv(src) + sstatus->dex; RE_LVL_DMOD(100); break; - case SR_GATEOFHELL: - if( sc && sc->data[SC_COMBO] + case SR_GATEOFHELL: + if( sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == SR_FALLENEMPIRE ) skillratio += 800 * skill_lv -100; else @@ -2490,7 +2490,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo break; case GN_CARTCANNON: // ATK [{( Cart Remodeling Skill Level x 50 ) x ( INT / 40 )} + ( Cart Cannon Skill Level x 60 )] % - skillratio = 60 * skill_lv; + skillratio = 60 * skill_lv; if( sd ) skillratio += pc_checkskill(sd, GN_REMODELING_CART) * 50 * (sstatus->int_ / 40); break; case GN_SPORE_EXPLOSION: @@ -2599,7 +2599,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo ATK_ADD(4*skill_lv); break; case HT_FREEZINGTRAP: - if(sd) + if(sd) ATK_ADD( 40 * pc_checkskill(sd, RA_RESEARCHTRAP) ); break; case RA_WUGDASH ://(Caster Current Weight x 10 / 8) @@ -2626,7 +2626,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo break; case SR_TIGERCANNON: // (Tiger Cannon skill level x 240) + (Target Base Level x 40) ATK_ADD( skill_lv * 240 + status_get_lv(target) * 40 ); - if( sc && sc->data[SC_COMBO] + if( sc && sc->data[SC_COMBO] && sc->data[SC_COMBO]->val1 == SR_FALLENEMPIRE ) // (Tiger Cannon skill level x 500) + (Target Base Level x 40) ATK_ADD( skill_lv * 500 + status_get_lv(target) * 40 ); break; @@ -2663,7 +2663,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if ( sc ) { if( sc->data[SC_TRUESIGHT] ) ATK_ADDRATE(2*sc->data[SC_TRUESIGHT]->val1); - if( sc->data[SC_GLOOMYDAY_SK] && + if( sc->data[SC_GLOOMYDAY_SK] && ( skill_num == LK_SPIRALPIERCE || skill_num == KN_BRANDISHSPEAR || skill_num == CR_SHIELDBOOMERANG || skill_num == PA_SHIELDCHAIN || skill_num == LG_SHIELDPRESS ) ) @@ -2671,7 +2671,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( sc->data[SC_EDP] ){ switch(skill_num){ case AS_SPLASHER: case AS_VENOMKNIFE: - case AS_GRIMTOOTH: + case AS_GRIMTOOTH: break; #ifndef RENEWAL_EDP case ASC_BREAKER: case ASC_METEORASSAULT: break; @@ -2707,7 +2707,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo ATK_ADDRATE(50); break; } - + if( sd ) { if (skill_num && (i = pc_skillatk_bonus(sd, skill_num))) @@ -2787,7 +2787,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo def1 -= def1 * i / 100; def2 -= def2 * i / 100; } - + if( battle_config.vit_penalty_type && battle_config.vit_penalty_target&target->type ) { unsigned char target_count; //256 max targets should be a sane max target_count = unit_counttargeted(target); @@ -2810,11 +2810,11 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo { //[VIT*0.5] + rnd([VIT*0.3], max([VIT*0.3],[VIT^2/150]-1)) vit_def = def2*(def2-15)/150; vit_def = def2/2 + (vit_def>0?rnd()%vit_def:0); - + if((battle_check_undead(sstatus->race,sstatus->def_ele) || sstatus->race==RC_DEMON) && //This bonus already doesnt work vs players src->type == BL_MOB && (skill=pc_checkskill(tsd,AL_DP)) > 0) vit_def += skill*(int)(3 +(tsd->status.base_level+1)*0.04); // submitted by orn - if( src->type == BL_MOB && (skill=pc_checkskill(tsd,RA_RANGERMAIN))>0 && + if( src->type == BL_MOB && (skill=pc_checkskill(tsd,RA_RANGERMAIN))>0 && (sstatus->race == RC_BRUTE || sstatus->race == RC_FISH || sstatus->race == RC_PLANT) ) vit_def += skill*5; } else { //Mob-Pet vit-eq @@ -2822,7 +2822,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo vit_def = (def2/20)*(def2/20); vit_def = def2 + (vit_def>0?rnd()%vit_def:0); } - + if (battle_config.weapon_defense_type) { vit_def += def1*battle_config.weapon_defense_type; def1 = 0; @@ -2857,7 +2857,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo #ifndef RENEWAL && skill_num != LK_SPIRALPIERCE && skill_num != ML_SPIRALPIERCE #endif - ){ + ){ int lv = sc->data[SC_AURABLADE]->val1; #ifdef RENEWAL lv *= ((skill_num == LK_SPIRALPIERCE || skill_num == ML_SPIRALPIERCE)?wd.div_:1); // +100 per hit in lv 5 @@ -2912,7 +2912,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if (sc && sc->data[SC_MIRACLE]) i = 2; //Star anger else ARR_FIND(0, MAX_PC_FEELHATE, i, t_class == sd->hate_mob[i]); - if (i < MAX_PC_FEELHATE && (skill=pc_checkskill(sd,sg_info[i].anger_id))) + if (i < MAX_PC_FEELHATE && (skill=pc_checkskill(sd,sg_info[i].anger_id))) { skillratio = sd->status.base_level + sstatus->dex + sstatus->luk; if (i == 2) skillratio += sstatus->str; //Star Anger @@ -2927,9 +2927,9 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo } } //Here ends flag.hit section, the rest of the function applies to both hitting and missing attacks else if(wd.div_ < 0) //Since the attack missed... - wd.div_ *= -1; + wd.div_ *= -1; - if(sd && (skill=pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0) + if(sd && (skill=pc_checkskill(sd,BS_WEAPONRESEARCH)) > 0) ATK_ADD(skill*2); if(skill_num==TF_POISON) @@ -3115,7 +3115,7 @@ static struct Damage battle_calc_weapon_attack(struct block_list *src,struct blo if( cardfix != 1000 || cardfix_ != 1000 ) ATK_RATE2(cardfix/10, cardfix_/10); //What happens if you use right-to-left and there's no right weapon, only left? } - + if( skill_num == CR_SHIELDBOOMERANG || skill_num == PA_SHIELDCHAIN ) { //Refine bonus applies after cards and elements. short index= sd->equip_index[EQI_HAND_L]; @@ -3382,13 +3382,13 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list //, - so i duplicated this code. make yourself comfortable to fix if you have any better ideas. //Initialize variables that will be used afterwards s_ele = skill_get_ele(skill_num, skill_lv); - + if (s_ele == -1) // pl=-1 : the skill takes the weapon's element s_ele = sstatus->rhw.ele; else if (s_ele == -2) //Use status element s_ele = status_get_attack_sc_element(src,status_get_sc(src)); else if( s_ele == -3 ) //Use random element - s_ele = rnd()%ELE_MAX; + s_ele = rnd()%ELE_MAX; } } else { //Initialize variables that will be used afterwards @@ -3521,7 +3521,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list #ifdef RENEWAL skillratio += 20*skill_lv; #else - skillratio += skill_lv*10-30; + skillratio += skill_lv*10-30; #endif break; case MG_SOULSTRIKE: @@ -3562,7 +3562,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list skillratio += skillratio * sc->data[SC_PYROTECHNIC_OPTION]->val3 / 100; } } - break; + break; case MG_LIGHTNINGBOLT: { struct status_change *sc = status_get_sc(src); if ( sc && sc->count ) { @@ -3661,7 +3661,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list { int interval = 0, per = interval , ratio = per; while( (per++) < skill_lv ){ - ratio += interval; + ratio += interval; if(per%3==0) interval += 20; } if( skill_lv > 9 ) @@ -3672,7 +3672,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list case NJ_HUUJIN: skillratio += 50; break; - #else + #else case WZ_VERMILION: skillratio += 20*skill_lv-20; break; @@ -3724,7 +3724,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list break; case WL_HELLINFERNO: skillratio = 300 * skill_lv; - RE_LVL_DMOD(100); + RE_LVL_DMOD(100); // Shadow: MATK [{( Skill Level x 300 ) x ( Caster Base Level / 100 ) x 4/5 }] % // Fire : MATK [{( Skill Level x 300 ) x ( Caster Base Level / 100 ) /5 }] % if( mflag&ELE_DARK ){ skillratio *= 4; s_ele = ELE_DARK; } @@ -3771,10 +3771,10 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list RE_LVL_DMOD(100); break; case LG_SHIELDSPELL:// [(Casters Base Level x 4) + (Shield MDEF x 100) + (Casters INT x 2)] % - if( sd ) { + if( sd ) { skillratio = status_get_lv(src) * 4 + sd->bonus.shieldmdef * 100 + status_get_int(src) * 2; } else - skillratio += 1900; //2000% + skillratio += 1900; //2000% break; case WM_METALICSOUND: skillratio += 120 * skill_lv + 60 * ( sd? pc_checkskill(sd, WM_LESSON) : 10 ) - 100; @@ -3897,7 +3897,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list } MATK_RATE(skillratio); - + //Constant/misc additions from skills if (skill_num == WZ_FIREPILLAR) MATK_ADD(50); @@ -3934,10 +3934,10 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list #ifdef RENEWAL /** * RE MDEF Reduction (from doddler:?title=Renewal_Changes#MDEF) - * Damage from magic = Magic Attack * 111.5/(111.5+eMDEF) - * Damage = Magic Attack * 111.5/(111.5+eMDEF) - sMDEF + * Damage from magic = Magic Attack * 111.5/(111.5+eMDEF) + * Damage = Magic Attack * 111.5/(111.5+eMDEF) - sMDEF **/ - if(mdef < -111) mdef = -111; // value smaller -111 brings back the damage to origin up to -223. + if(mdef < -111) mdef = -111; // value smaller -111 brings back the damage to origin up to -223. ad.damage = ad.damage * 1115 / (1115 + mdef * 10) - mdef2; #else if(battle_config.magic_defense_type) @@ -3946,7 +3946,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list ad.damage = ad.damage * (100-mdef)/100 - mdef2; #endif } - + if (skill_num == NPC_EARTHQUAKE) { //Adds atk2 to the damage, should be influenced by number of hits and skill-ratio, but not mdef reductions. [Skotlex] //Also divide the extra bonuses from atk2 based on the number in range [Kevin] @@ -4044,7 +4044,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list } damage_div_fix(ad.damage, ad.div_); - + if (flag.infdef && ad.damage) ad.damage = ad.damage>0?1:-1; @@ -4053,7 +4053,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list ad.damage=battle_calc_gvg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); else if( map[target->m].flag.battleground ) ad.damage=battle_calc_bg_damage(src,target,ad.damage,ad.div_,skill_num,skill_lv,ad.flag); - + switch( skill_num ) { /* post-calc modifiers */ case SO_VARETYR_SPEAR: { // Physical damage. struct Damage wd = battle_calc_weapon_attack(src,target,skill_num,skill_lv,mflag); @@ -4062,7 +4062,7 @@ struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list } //case HM_ERASER_CUTTER: } - + return ad; } @@ -4096,10 +4096,10 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.flag=BF_MISC|BF_SKILL; nk = skill_get_nk(skill_num); - + sd = BL_CAST(BL_PC, src); tsd = BL_CAST(BL_PC, target); - + if(sd) { sd->state.arrow_atk = 0; md.blewcount += battle_blewcount_bonus(sd, skill_num); @@ -4145,12 +4145,12 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * md.damage=(sstatus->dex/10+sstatus->int_/2+skill*3+40)*2; if(mflag > 1) //Autocasted Blitz. nk|=NK_SPLASHSPLIT; - + if (skill_num == SN_FALCONASSAULT) { //Div fix of Blitzbeat skill = skill_get_num(HT_BLITZBEAT, 5); - damage_div_fix(md.damage, skill); + damage_div_fix(md.damage, skill); //Falcon Assault Modifier md.damage=md.damage*(150+70*skill_lv)/100; @@ -4251,7 +4251,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * break; case GN_HELLS_PLANT_ATK: //[{( Hell Plant Skill Level x Casters Base Level ) x 10 } + {( Casters INT x 7 ) / 2 } x { 18 + ( Casters Job Level / 4 )] x ( 5 / ( 10 - Summon Flora Skill Level )) - md.damage = ( skill_lv * status_get_lv(src) * 10 ) + ( sstatus->int_ * 7 / 2 ) * ( 18 + (sd?sd->status.job_level:0) / 4 ) * ( 5 / (10 - (sd?pc_checkskill(sd,AM_CANNIBALIZE):0)) ); + md.damage = ( skill_lv * status_get_lv(src) * 10 ) + ( sstatus->int_ * 7 / 2 ) * ( 18 + (sd?sd->status.job_level:0) / 4 ) * ( 5 / (10 - (sd?pc_checkskill(sd,AM_CANNIBALIZE):0)) ); break; case KO_HAPPOKUNAI: { @@ -4274,7 +4274,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * } damage_div_fix(md.damage, md.div_); - + if (!(nk&NK_IGNORE_FLEE)) { struct status_change *sc = status_get_sc(target); @@ -4444,7 +4444,7 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int sd = BL_CAST(BL_PC, bl); sc = status_get_sc(bl); - + if( sc && sc->data[SC_REFLECTDAMAGE] ) { int max_damage = status_get_max_hp(bl) * status_get_lv(bl) / 100; rdamage = (*dmg) * sc->data[SC_REFLECTDAMAGE]->val2 / 100; @@ -4455,7 +4455,7 @@ int battle_calc_return_damage(struct block_list* bl, struct block_list *src, int if (ratio > 5000) ratio = 5000; // Maximum of 5000% ATK rdamage = rdamage * ratio / 100 + (*dmg) * (10 + sc->data[SC_CRESCENTELBOW]->val1 * 20 / 10) / 10; skill_blown(bl, src, skill_get_blewcount(SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1), unit_getdir(src), 0); - clif_skill_damage(bl, src, gettick(), status_get_amotion(src), 0, rdamage, + clif_skill_damage(bl, src, gettick(), status_get_amotion(src), 0, rdamage, 1, SR_CRESCENTELBOW_AUTOSPELL, sc->data[SC_CRESCENTELBOW]->val1, 6); // This is how official does clif_damage(src, bl, gettick(), status_get_amotion(src)+1000, 0, rdamage/10, 1, 0, 0); status_damage(src, bl, status_damage(bl, src, rdamage, 0, 0, 1)/10, 0, 0, 1); @@ -4508,11 +4508,11 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage, else { wd = &sd->left_weapon; damage = &ldamage; } if (*damage <= 0) continue; //First and Third iterations: race, other two boss/nonboss state - if (i == 0 || i == 2) + if (i == 0 || i == 2) type = race; else type = boss?RC_BOSS:RC_NONBOSS; - + hp = wd->hp_drain[type].value; if (wd->hp_drain[type].rate) hp += battle_calc_drain(*damage, wd->hp_drain[type].rate, wd->hp_drain[type].per); @@ -4520,7 +4520,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage, sp = wd->sp_drain[type].value; if (wd->sp_drain[type].rate) sp += battle_calc_drain(*damage, wd->sp_drain[type].rate, wd->sp_drain[type].per); - + if (hp) { if (wd->hp_drain[type].type) rhp += hp; @@ -4544,7 +4544,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage, if (!thp && !tsp) return; status_heal(&sd->bl, thp, tsp, battle_config.show_hp_sp_drain?3:1); - + if (rhp || rsp) status_zap(tbl, rhp, rsp); } @@ -4555,7 +4555,7 @@ int battle_damage_area( struct block_list *bl, va_list ap) { struct block_list *src; nullpo_ret(bl); - + tick=va_arg(ap, unsigned int); src=va_arg(ap,struct block_list *); amotion=va_arg(ap,int); @@ -4575,7 +4575,7 @@ int battle_damage_area( struct block_list *bl, va_list ap) { skill_additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); map_freeblock_unlock(); } - + return 0; } /*========================================== @@ -4608,7 +4608,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t sc = NULL; if (tsc && !tsc->count) tsc = NULL; - + if (sd) { sd->state.arrow_atk = (sd->status.weapon == W_BOW || (sd->status.weapon >= W_REVOLVER && sd->status.weapon <= W_GRENADE)); @@ -4738,7 +4738,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t tsc->data[SC_KAAHI]->val4 = add_timer(tick + skill_get_time2(SL_KAAHI,tsc->data[SC_KAAHI]->val1), kaahi_heal_timer, target->id, SC_KAAHI); //Activate heal. wd = battle_calc_attack(BF_WEAPON, src, target, 0, 0, flag); - + if( sc && sc->count ) { if (sc->data[SC_EXEEDBREAK]) { wd.damage = wd.damage * sc->data[SC_EXEEDBREAK]->val1 / 100; @@ -4753,7 +4753,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t } if( sc->data[SC_GIANTGROWTH] && (wd.flag&BF_SHORT) && rnd()%100 < sc->data[SC_GIANTGROWTH]->val2 ) wd.damage *= 3; // Triple Damage - + if( sd && sc->data[SC_FEARBREEZE] && sc->data[SC_FEARBREEZE]->val4 > 0 && sd->status.inventory[sd->equip_index[EQI_AMMO]].amount >= sc->data[SC_FEARBREEZE]->val4 && battle_config.arrow_decrement){ pc_delitem(sd,sd->equip_index[EQI_AMMO],sc->data[SC_FEARBREEZE]->val4,0,1,LOG_TYPE_CONSUME); sc->data[SC_FEARBREEZE]->val4 = 0; @@ -4779,7 +4779,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t if( rdamage > 0 ) { if( tsc && tsc->data[SC_REFLECTDAMAGE] ) { if( src != target )// Don't reflect your own damage (Grand Cross) - map_foreachinshootrange(battle_damage_area,target,skill_get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd.amotion,wd.dmotion,rdamage,tstatus->race,0); + map_foreachinshootrange(battle_damage_area,target,skill_get_splash(LG_REFLECTDAMAGE,1),BL_CHAR,tick,target,wd.amotion,wd.dmotion,rdamage,tstatus->race,0); } else { rdelay = clif_damage(src, src, tick, wd.amotion, sstatus->dmotion, rdamage, 1, 4, 0); //Use Reflect Shield to signal this kind of skill trigger. [Skotlex] @@ -4830,8 +4830,8 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t clif_damage(src, target, tick, wd.amotion, wd.dmotion, damage, wd.div_, wd.type, wd.damage2 ); map_freeblock_unlock(); return ATK_NONE; - } - } + } + } } if (sc && sc->data[SC_AUTOSPELL] && rnd()%100 < sc->data[SC_AUTOSPELL]->val4) { int sp = 0; @@ -4931,7 +4931,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t } if (tsc) { - if (tsc->data[SC_POISONREACT] && + if (tsc->data[SC_POISONREACT] && (rnd()%100 < tsc->data[SC_POISONREACT]->val3 || sstatus->def_ele == ELE_POISON) && // check_distance_bl(src, target, tstatus->rhw.range+1) && Doesn't checks range! o.O; @@ -4996,7 +4996,7 @@ struct block_list* battle_get_master(struct block_list *src) case BL_ELEM: if (((TBL_ELEM*)src)->master) src = (struct block_list*)((TBL_ELEM*)src)->master; - break; + break; case BL_SKILL: if (((TBL_SKILL*)src)->group && ((TBL_SKILL*)src)->group->src_id) src = map_id2bl(((TBL_SKILL*)src)->group->src_id); @@ -5049,7 +5049,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f break; } } - + switch( target->type ) { // Checks on actual target case BL_PC: { struct status_change* sc = status_get_sc(src); @@ -5248,9 +5248,9 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f state |= BCT_ENEMY; break; } //end switch on src master - + if( (flag&BCT_ALL) == BCT_ALL ) - { //All actually stands for all attackable chars + { //All actually stands for all attackable chars if( target->type&BL_CHAR ) return 1; else @@ -5258,7 +5258,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f } if( flag == BCT_NOONE ) //Why would someone use this? no clue. return -1; - + if( t_bl == s_bl ) { //No need for further testing. state |= BCT_SELF|BCT_PARTY|BCT_GUILD; @@ -5266,7 +5266,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f state&=~BCT_ENEMY; return (flag&state)?1:-1; } - + if( map_flag_vs(m) ) { //Check rivalry settings. int sbg_id = 0, tbg_id = 0; @@ -5324,7 +5324,7 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f state |= BCT_GUILD; } } //end non pvp/gvg chk rivality - + if( !state ) //If not an enemy, nor a guild, nor party, nor yourself, it's neutral. state = BCT_NEUTRAL; //Alliance state takes precedence over enemy one. @@ -5651,7 +5651,7 @@ static const struct _battle_data { { "attack_walk_delay", &battle_config.attack_walk_delay, BL_ALL, BL_NUL, BL_ALL, }, { "require_glory_guild", &battle_config.require_glory_guild, 0, 0, 1, }, { "idle_no_share", &battle_config.idle_no_share, 0, 0, INT_MAX, }, - { "party_even_share_bonus", &battle_config.party_even_share_bonus, 0, 0, INT_MAX, }, + { "party_even_share_bonus", &battle_config.party_even_share_bonus, 0, 0, INT_MAX, }, { "delay_battle_damage", &battle_config.delay_battle_damage, 1, 0, 1, }, { "hide_woe_damage", &battle_config.hide_woe_damage, 0, 0, 1, }, { "display_version", &battle_config.display_version, 1, 0, 1, }, @@ -5745,7 +5745,7 @@ static const struct _battle_data { **/ { "max_third_parameter", &battle_config.max_third_parameter, 120, 10, 10000, }, { "max_baby_third_parameter", &battle_config.max_baby_third_parameter, 108, 10, 10000, }, - { "atcommand_max_stat_bypass", &battle_config.atcommand_max_stat_bypass, 0, 0, 100, }, + { "atcommand_max_stat_bypass", &battle_config.atcommand_max_stat_bypass, 0, 0, 100, }, { "skill_amotion_leniency", &battle_config.skill_amotion_leniency, 90, 0, 100 }, { "mvp_tomb_enabled", &battle_config.mvp_tomb_enabled, 1, 0, 1 }, { "feature.atcommand_suggestions", &battle_config.atcommand_suggestions_enabled, 0, 0, 1 }, @@ -5783,23 +5783,23 @@ void rAthena_report(char* date, char *time_c) { C_SQL_DBS = 0x2000, C_SQL_LOGS = 0x4000, }; - + if( (rev_str = get_svn_revision()) != 0 ) rev = atoi(rev_str); - + /* we get the current time */ time(&curtime); strftime(timestring, 24, "%Y-%m-%d %H:%M:%S", localtime(&curtime)); - - + + #ifdef CIRCULAR_AREA config |= C_CIRCULAR_AREA; #endif - + #ifdef CELL_NOSTACK config |= C_CELLNOSTACK; #endif - + #ifdef BETA_THREAD_TEST config |= C_BETA_THREAD_TEST; #endif @@ -5815,7 +5815,7 @@ void rAthena_report(char* date, char *time_c) { #ifdef RENEWAL config |= C_RENEWAL; #endif - + #ifdef RENEWAL_CAST config |= C_RENEWAL_CAST; #endif @@ -5827,7 +5827,7 @@ void rAthena_report(char* date, char *time_c) { #ifdef RENEWAL_EXP config |= C_RENEWAL_EXP; #endif - + #ifdef RENEWAL_LVDMG config |= C_RENEWAL_LVDMG; #endif @@ -5835,11 +5835,11 @@ void rAthena_report(char* date, char *time_c) { #ifdef RENEWAL_EDP config |= C_RENEWAL_EDP; #endif - + #ifdef RENEWAL_ASPD config |= C_RENEWAL_ASPD; #endif - + /* not a ifdef because SECURE_NPCTIMEOUT is always defined, but either as 0 or higher */ #if SECURE_NPCTIMEOUT config |= C_SECURE_NPCTIMEOUT; @@ -5847,14 +5847,14 @@ void rAthena_report(char* date, char *time_c) { /* non-define part */ if( db_use_sqldbs ) config |= C_SQL_DBS; - + if( log_config.sql_logs ) config |= C_SQL_LOGS; - + #define BFLAG_LENGTH 35 - + CREATE(buf, char, 6 + 12 + 9 + 24 + 4 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) + 1 ); - + /* build packet */ WBUFW(buf,0) = 0x3000; @@ -5864,22 +5864,22 @@ void rAthena_report(char* date, char *time_c) { safestrncpy((char*)WBUFP(buf,6), date, 12); safestrncpy((char*)WBUFP(buf,6 + 12), time_c, 9); safestrncpy((char*)WBUFP(buf,6 + 12 + 9), timestring, 24); - + WBUFL(buf,6 + 12 + 9 + 24) = rev; WBUFL(buf,6 + 12 + 9 + 24 + 4) = map_getusers(); - + WBUFL(buf,6 + 12 + 9 + 24 + 4 + 4) = config; WBUFL(buf,6 + 12 + 9 + 24 + 4 + 4 + 4) = bd_size; - + for( i = 0; i < bd_size; i++ ) { safestrncpy((char*)WBUFP(buf,6 + 12 + 9+ 24 + 4 + 4 + 4 + 4 + ( i * ( BFLAG_LENGTH + 4 ) ) ), battle_data[i].str, 35); WBUFL(buf,6 + 12 + 9 + 24 + 4 + 4 + 4 + 4 + BFLAG_LENGTH + ( i * ( BFLAG_LENGTH + 4 ) ) ) = *battle_data[i].val; } - + chrif_send_report(buf, 6 + 12 + 9 + 24 + 4 + 4 + 4 + 4 + ( bd_size * ( BFLAG_LENGTH + 4 ) ) ); - + aFree(buf); - + #undef BFLAG_LENGTH } static int rAthena_report_timer(int tid, unsigned int tick, int id, intptr_t data) { @@ -5933,16 +5933,16 @@ void battle_adjust_conf() battle_config.max_third_aspd = 2000 - battle_config.max_third_aspd*10; battle_config.max_walk_speed = 100*DEFAULT_WALK_SPEED/battle_config.max_walk_speed; battle_config.max_cart_weight *= 10; - + if(battle_config.max_def > 100 && !battle_config.weapon_defense_type) // added by [Skotlex] battle_config.max_def = 100; if(battle_config.min_hitrate > battle_config.max_hitrate) battle_config.min_hitrate = battle_config.max_hitrate; - + if(battle_config.pet_max_atk1 > battle_config.pet_max_atk2) //Skotlex battle_config.pet_max_atk1 = battle_config.pet_max_atk2; - + if (battle_config.day_duration && battle_config.day_duration < 60000) // added by [Yor] battle_config.day_duration = 60000; if (battle_config.night_duration && battle_config.night_duration < 60000) // added by [Yor] @@ -6012,7 +6012,7 @@ void do_init_battle(void) { delay_damage_ers = ers_new(sizeof(struct delay_damage),"battle.c::delay_damage_ers",ERS_OPT_CLEAR); add_timer_func_list(battle_delay_damage_sub, "battle_delay_damage_sub"); - + #ifndef STATS_OPT_OUT add_timer_func_list(rAthena_report_timer, "rAthena_report_timer"); add_timer_interval(gettick()+30000, rAthena_report_timer, 0, 0, 60000 * 30); diff --git a/src/map/clif.c b/src/map/clif.c index 07e2591c5..2b9bb886c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -191,9 +191,6 @@ int map_fd; static int clif_parse (int fd); /*========================================== - * map�I��ip�ݒ� - *------------------------------------------*/ -/*========================================== * Ip setting of map-server *------------------------------------------*/ int clif_setip(const char* ip) @@ -357,7 +354,7 @@ static int clif_send_sub(struct block_list *bl, va_list ap) /*========================================== * Packet Delegation (called on all packets that require data to be sent to more than one client) - * functions that are sent solely to one use whose ID it posses use WFIFOSET + * functions that are sent solely to one use whose ID it posses use WFIFOSET *------------------------------------------*/ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target type) { @@ -470,7 +467,7 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target case PARTY_SAMEMAP_WOS: if (sd && sd->status.party_id) p = party_search(sd->status.party_id); - + if (p) { for(i=0;i<MAX_PARTY;i++){ if( (sd = p->data[i].sd) == NULL ) @@ -481,13 +478,13 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target if( sd->bl.id == bl->id && (type == PARTY_WOS || type == PARTY_SAMEMAP_WOS || type == PARTY_AREA_WOS) ) continue; - + if( type != PARTY && type != PARTY_WOS && bl->m != sd->bl.m ) continue; - + if( (type == PARTY_AREA || type == PARTY_AREA_WOS) && (sd->bl.x < x0 || sd->bl.y < y0 || sd->bl.x > x1 || sd->bl.y > y1) ) continue; - + if( packet_db[sd->packet_ver][RBUFW(buf,0)].len ) { // packet must exist for the client version WFIFOHEAD(fd,len); @@ -560,13 +557,13 @@ int clif_send(const uint8* buf, int len, struct block_list* bl, enum send_target { if( !(fd=sd->fd) ) continue; - + if( type == GUILD_NOBG && sd->bg_id ) continue; if( sd->bl.id == bl->id && (type == GUILD_WOS || type == GUILD_SAMEMAP_WOS || type == GUILD_AREA_WOS) ) continue; - + if( type != GUILD && type != GUILD_NOBG && type != GUILD_WOS && sd->bl.m != bl->m ) continue; @@ -869,7 +866,7 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un *lhand = sd->status.shield; #else if (sd->equip_index[EQI_HAND_R] >= 0 && - sd->inventory_data[sd->equip_index[EQI_HAND_R]]) + sd->inventory_data[sd->equip_index[EQI_HAND_R]]) { struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_R]]; if (id->view_id > 0) @@ -881,7 +878,7 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un if (sd->equip_index[EQI_HAND_L] >= 0 && sd->equip_index[EQI_HAND_L] != sd->equip_index[EQI_HAND_R] && - sd->inventory_data[sd->equip_index[EQI_HAND_L]]) + sd->inventory_data[sd->equip_index[EQI_HAND_L]]) { struct item_data* id = sd->inventory_data[sd->equip_index[EQI_HAND_L]]; if (id->view_id > 0) @@ -1272,7 +1269,7 @@ static void clif_talisman_single(int fd, struct map_session_data *sd, short type static void clif_weather_check(struct map_session_data *sd) { int m = sd->bl.m, fd = sd->fd; - + if (map[m].flag.snow || map[m].flag.clouds || map[m].flag.fog @@ -1337,13 +1334,13 @@ int clif_spawn(struct block_list *bl) vd = status_get_viewdata(bl); if( !vd || vd->class_ == INVISIBLE_CLASS ) return 0; - + /** * Hide NPC from maya purple card. **/ if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE)) return 0; - + len = clif_set_unit_idle(bl, buf,true); clif_send(buf, len, bl, AREA_WOS); if (disguised(bl)) @@ -1351,7 +1348,7 @@ int clif_spawn(struct block_list *bl) if (vd->cloth_color) clif_refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); - + switch (bl->type) { case BL_PC: @@ -1380,7 +1377,7 @@ int clif_spawn(struct block_list *bl) #endif #if PACKETVER <= 20120207 if (sd->status.robe) - clif_refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); + clif_refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); #endif } break; @@ -1417,7 +1414,7 @@ void clif_hominfo(struct map_session_data *sd, struct homun_data *hd, int flag) struct status_data *status; unsigned char buf[128]; int m_class; - + nullpo_retv(hd); status = &hd->battle_status; @@ -1500,7 +1497,7 @@ int clif_homskillinfoblock(struct map_session_data *sd) WFIFOHEAD(fd, 4+37*MAX_HOMUNSKILL); hd = sd->hd; - if ( !hd ) + if ( !hd ) return 0 ; WFIFOW(fd,0)=0x235; @@ -1575,12 +1572,12 @@ static void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_ { uint8 buf[128]; int len; - + len = clif_set_unit_walking(bl,ud,buf); clif_send(buf,len,bl,AREA_WOS); if (disguised(bl)) clif_setdisguise(bl, buf, len); - + if(vd->cloth_color) clif_refreshlook(bl,bl->id,LOOK_CLOTHES_COLOR,vd->cloth_color,AREA_WOS); @@ -1608,7 +1605,7 @@ static void clif_move2(struct block_list *bl, struct view_data *vd, struct unit_ case BL_PET: if( vd->head_bottom ) {// needed to display pet equip properly - clif_pet_equip_area((TBL_PET*)bl); + clif_pet_equip_area((TBL_PET*)bl); } break; } @@ -1627,13 +1624,13 @@ void clif_move(struct unit_data *ud) vd = status_get_viewdata(bl); if (!vd || vd->class_ == INVISIBLE_CLASS) return; //This performance check is needed to keep GM-hidden objects from being notified to bots. - + /** * Hide NPC from maya purple card. **/ if(bl->type == BL_NPC && !((TBL_NPC*)bl)->chat_id && (((TBL_NPC*)bl)->sc.option&OPTION_INVISIBLE)) return; - + if (ud->state.speed_changed) { // Since we don't know how to update the speed of other objects, // use the old walk packet to update the data. @@ -1997,7 +1994,7 @@ void clif_scriptinput(struct map_session_data *sd, int npcid) bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 || bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1)))) clif_sendfakenpc(sd, npcid); - + fd=sd->fd; WFIFOHEAD(fd, packet_len(0x142)); WFIFOW(fd,0)=0x142; @@ -2077,8 +2074,8 @@ void clif_viewpoint(struct map_session_data *sd, int npc_id, int type, int x, in /// 4 = middle of screen, movable with a close button, chrome-less void clif_cutin(struct map_session_data* sd, const char* image, int type) { - int fd; - + int fd; + nullpo_retv(sd); fd=sd->fd; @@ -2255,9 +2252,9 @@ void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) int fd; nullpo_retv(sd); - + fd=sd->fd; - + WFIFOHEAD(fd, packet_len(0x7fa)); WFIFOW(fd,0)=0x7fa; WFIFOW(fd,2)=reason; @@ -2269,7 +2266,7 @@ void clif_delitem(struct map_session_data *sd,int n,int amount, short reason) // Simplifies inventory/cart/storage packets by handling the packet section relevant to items. [Skotlex] -// Equip is >= 0 for equippable items (holds the equip-point, is 0 for pet +// Equip is >= 0 for equippable items (holds the equip-point, is 0 for pet // armor/egg) -1 for stackable items, -2 for stackable items where arrows must send in the equip-point. void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data *id, int equip) { @@ -2279,7 +2276,7 @@ void clif_item_sub(unsigned char *buf, int n, struct item *i, struct item_data * WBUFW(buf,n)=i->nameid; WBUFB(buf,n+2)=itemtype(id->type); WBUFB(buf,n+3)=i->identify; - if (equip >= 0) { //Equippable item + if (equip >= 0) { //Equippable item WBUFW(buf,n+4)=equip; WBUFW(buf,n+6)=i->equip; WBUFB(buf,n+8)=i->attribute; @@ -2318,7 +2315,7 @@ void clif_inventorylist(struct map_session_data *sd) buf = (unsigned char*)aMalloc(MAX_INVENTORY * s + 4); bufe = (unsigned char*)aMalloc(MAX_INVENTORY * se + 4); - + for( i = 0, n = 0, ne = 0; i < MAX_INVENTORY; i++ ) { if( sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL ) @@ -2385,12 +2382,12 @@ void clif_inventorylist(struct map_session_data *sd) for( i = 0; i < MAX_INVENTORY; i++ ) { if( sd->status.inventory[i].nameid <= 0 || sd->inventory_data[i] == NULL ) continue; - + if ( sd->status.inventory[i].favorite ) clif_favorite_item(sd, i); } #endif - + if( buf ) aFree(buf); if( bufe ) aFree(bufe); } @@ -2413,9 +2410,9 @@ void clif_equiplist(struct map_session_data *sd) for(i=0,n=0;i<MAX_INVENTORY;i++){ if (sd->status.inventory[i].nameid <=0 || sd->inventory_data[i] == NULL) - continue; - - if(itemdb_isstackable2(sd->inventory_data[i])) + continue; + + if(itemdb_isstackable2(sd->inventory_data[i])) continue; //Equippable WBUFW(buf,n*cmd+4)=i+2; @@ -2547,7 +2544,7 @@ void clif_cartlist(struct map_session_data *sd) buf = (unsigned char*)aMalloc(MAX_CART * s + 4); bufe = (unsigned char*)aMalloc(MAX_CART * cmd + 4); - + for( i = 0, n = 0, ne = 0; i < MAX_CART; i++ ) { if( sd->status.cart[i].nameid <= 0 ) @@ -2823,8 +2820,8 @@ void clif_updatestatus(struct map_session_data *sd,int type) //negative check (in case you have something like Berserk active) int mdef2 = pc_rightside_mdef(sd); - WFIFOL(fd,4)= -#ifndef RENEWAL + WFIFOL(fd,4)= +#ifndef RENEWAL ( mdef2 < 0 ) ? 0 : #endif mdef2; @@ -3175,11 +3172,11 @@ void clif_initialstatus(struct map_session_data *sd) WBUFW(buf,26) = pc_rightside_def(sd); WBUFW(buf,28) = pc_leftside_mdef(sd); mdef2 = pc_rightside_mdef(sd); - WBUFW(buf,30) = + WBUFW(buf,30) = #ifndef RENEWAL ( mdef2 < 0 ) ? 0 : //Negative check for Frenzy'ed characters. #endif - mdef2; + mdef2; WBUFW(buf,32) = sd->battle_status.hit; WBUFW(buf,34) = sd->battle_status.flee; WBUFW(buf,36) = sd->battle_status.flee2/10; @@ -3391,7 +3388,7 @@ void clif_changeoption(struct block_list* bl) sc = status_get_sc(bl); if (!sc) return; //How can an option change if there's no sc? sd = BL_CAST(BL_PC, bl); - + #if PACKETVER >= 7 WBUFW(buf,0) = 0x229; WBUFL(buf,2) = bl->id; @@ -3434,7 +3431,7 @@ void clif_changeoption2(struct block_list* bl) { unsigned char buf[20]; struct status_change *sc; - + sc = status_get_sc(bl); if (!sc) return; //How can an option change if there's no sc? @@ -3749,7 +3746,7 @@ void clif_traderequest(struct map_session_data* sd, const char* name) #else struct map_session_data* tsd = map_id2sd(sd->trade_partner); if( !tsd ) return; - + WFIFOHEAD(fd,packet_len(0x1f4)); WFIFOW(fd,0) = 0x1f4; safestrncpy((char*)WFIFOP(fd,2), name, NAME_LENGTH); @@ -4080,11 +4077,11 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) struct unit_data *ud; struct view_data *vd; int len; - + vd = status_get_viewdata(bl); if (!vd || vd->class_ == INVISIBLE_CLASS) return; - + /** * Hide NPC from maya purple card. **/ @@ -4167,14 +4164,14 @@ static int clif_calc_walkdelay(struct block_list *bl,int delay, int type, int da { if (type == 4 || type == 9 || damage <=0) return 0; - + if (bl->type == BL_PC) { if (battle_config.pc_walk_delay_rate != 100) delay = delay*battle_config.pc_walk_delay_rate/100; } else if (battle_config.walk_delay_rate != 100) delay = delay*battle_config.walk_delay_rate/100; - + if (div_ > 1) //Multi-hit skills mean higher delays. delay += battle_config.multihit_delay*(div_-1); @@ -4422,6 +4419,8 @@ static void clif_getareachar_skillunit(struct map_session_data *sd, struct skill WFIFOW(fd,12)=unit->bl.y; if (battle_config.traps_setting&1 && skill_get_inf2(unit->group->skill_id)&INF2_TRAP) WFIFOB(fd,14)=UNT_DUMMYSKILL; //Use invisible unit id for traps. + else if (skill_get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT)) + WFIFOB(fd,14)=UNT_DUMMYSKILL; //Use invisible unit id for traps. else WFIFOB(fd,14)=unit->group->unit_id; WFIFOB(fd,15)=1; // ignored by client (always gets set to 1) @@ -4573,7 +4572,7 @@ int clif_insight(struct block_list *bl,va_list ap) tbl=va_arg(ap,struct block_list*); if (bl == tbl) return 0; - + sd = BL_CAST(BL_PC, bl); tsd = BL_CAST(BL_PC, tbl); @@ -4643,7 +4642,7 @@ void clif_skillinfoblock(struct map_session_data *sd) if( (id = sd->status.skill[i].id) != 0 ) { clif_addskill(sd, id); - clif_skillinfo(sd, id, 0); + clif_skillinfo(sd, id, 0); } } } @@ -4829,11 +4828,11 @@ void clif_skill_fail(struct map_session_data *sd,int skill_id,enum useskill_fail { int fd; - if (!sd) { //Since this is the most common nullpo.... + if (!sd) { //Since this is the most common nullpo.... ShowDebug("clif_skill_fail: Error, received NULL sd for skill %d\n", skill_id); return; } - + fd=sd->fd; if (!fd) return; @@ -4842,7 +4841,7 @@ void clif_skill_fail(struct map_session_data *sd,int skill_id,enum useskill_fail if(cause==USESKILL_FAIL_SKILLINTERVAL && !sd->state.showdelay) return; //Disable delay failed messages - + if(skill_id == RG_SNATCHER && battle_config.display_skill_fail&4) return; @@ -4921,7 +4920,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int if(disguised(src)) { WBUFL(buf,4)=-src->id; - if (disguised(dst)) + if (disguised(dst)) WBUFL(buf,8)=dst->id; if(damage > 0) WBUFW(buf,24)=-1; @@ -5116,6 +5115,8 @@ void clif_skill_setunit(struct skill_unit *unit) WBUFW(buf,12)=unit->bl.y; if (unit->group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE) WBUFB(buf,14)=unit->val2&UF_SONG?UNT_DISSONANCE:UNT_UGLYDANCE; + else if (skill_get_unit_flag(unit->group->skill_id) & UF_RANGEDSINGLEUNIT && !(unit->val2 & UF_RANGEDSINGLEUNIT)) + WBUFB(buf, 14) = UNT_DUMMYSKILL; // Only display the unit at center. else WBUFB(buf,14)=unit->group->unit_id; WBUFB(buf,15)=1; // ignored by client (always gets set to 1) @@ -5289,32 +5290,32 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, int skill_id, i int fd; int i, c; int view; - + nullpo_retv(sd); fd = sd->fd; - + WFIFOHEAD(fd, 6 + 2 * MAX_SKILL_PRODUCE_DB); WFIFOW(fd,0) = 0x25a; WFIFOW(fd,4) = list_type; // list type - + c = 0; for( i = 0; i < MAX_SKILL_PRODUCE_DB; i++ ) { if( !skill_can_produce_mix(sd,skill_produce_db[i].nameid,trigger, qty) ) continue; - + if( (view = itemdb_viewid(skill_produce_db[i].nameid)) > 0 ) WFIFOW(fd, 6 + 2 * c) = view; else WFIFOW(fd, 6 + 2 * c) = skill_produce_db[i].nameid; - + c++; } - + if( skill_id == AM_PHARMACY ) { // Only send it while Cooking else check for c. WFIFOW(fd,2) = 6 + 2 * c; WFIFOSET(fd,WFIFOW(fd,2)); } - + if( c > 0 ) { sd->menuskill_id = skill_id; sd->menuskill_val = trigger; @@ -5386,7 +5387,7 @@ void clif_status_change(struct block_list *bl,int type,int flag,int tick,int val void clif_displaymessage(const int fd, const char* mes) { nullpo_retv(mes); - + //Scrapped, as these are shared by disconnected players =X [Skotlex] if (fd == 0) ; @@ -5398,7 +5399,7 @@ void clif_displaymessage(const int fd, const char* mes) while(line != NULL) { // Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client) int len = strnlen(line, 255); - + if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line. WFIFOHEAD(fd, 5 + len); WFIFOW(fd,0) = 0x8e; @@ -5427,7 +5428,7 @@ void clif_broadcast(struct block_list* bl, const char* mes, int len, int type, e WBUFL(buf,4) = 0x73737373; //If there's "ssss", game client will recognize message as 'WoE broadcast'. memcpy(WBUFP(buf, 4 + lp), mes, len); clif_send(buf, WBUFW(buf,2), bl, target); - + if (buf) aFree(buf); } @@ -5469,10 +5470,10 @@ void clif_MainChatMessage(const char* message) { uint8 buf[200]; int len; - + if(!message) return; - + len = strlen(message)+1; if (len+8 > sizeof(buf)) { ShowDebug("clif_MainChatMessage: Received message too long (len %d): %s\n", len, message); @@ -5723,7 +5724,7 @@ void clif_use_card(struct map_session_data *sd,int idx) if (!sd->inventory_data[idx] || sd->inventory_data[idx]->type != IT_CARD) return; //Avoid parsing invalid item indexes (no card/no item) - + ep=sd->inventory_data[idx]->equip; WFIFOHEAD(fd,MAX_INVENTORY * 2 + 4); WFIFOW(fd,0)=0x17b; @@ -5875,7 +5876,7 @@ void clif_item_repaireffect(struct map_session_data *sd,int idx,int flag) WFIFOW(fd, 2)=idx+2; WFIFOB(fd, 4)=flag; WFIFOSET(fd,packet_len(0x1fe)); - + } @@ -6865,7 +6866,7 @@ void clif_devotion(struct block_list *src, struct map_session_data *tsd) { unsigned char buf[56]; int i; - + nullpo_retv(src); memset(buf,0,packet_len(0x1cf)); @@ -7097,23 +7098,23 @@ void clif_guild_memberlogin_notice(struct guild *g,int idx,int flag) // But at the 1st time (after a player login or map changing) // the client won't show the message. // So I suggest use this function for sending "first-time-info" -// to some player on entering the game or changing location. +// to some player on entering the game or changing location. // At next time the client would always show the message. -// The function sends all the statuses in the single packet +// The function sends all the statuses in the single packet // to economize traffic. [LuzZza] void clif_guild_send_onlineinfo(struct map_session_data *sd) { struct guild *g; unsigned char buf[14*128]; int i, count=0, p_len; - + nullpo_retv(sd); p_len = packet_len(0x16d); if(!(g = guild_search(sd->status.guild_id))) return; - + for(i=0; i<g->max_member; i++) { if(g->member[i].account_id > 0 && @@ -7126,7 +7127,7 @@ void clif_guild_send_onlineinfo(struct map_session_data *sd) count++; } } - + clif_send(buf, p_len*count, &sd->bl, SELF); } @@ -7434,7 +7435,7 @@ void clif_guild_skillinfo(struct map_session_data* sd) { int id = g->skill[i].id; int p = 6 + c*37; - WFIFOW(fd,p+0) = id; + WFIFOW(fd,p+0) = id; WFIFOL(fd,p+2) = skill_get_inf(id); WFIFOW(fd,p+6) = g->skill[i].lv; WFIFOW(fd,p+8) = skill_get_sp(id, g->skill[i].lv); @@ -7462,7 +7463,7 @@ void clif_guild_notice(struct map_session_data* sd, struct guild* g) if ( !session_isActive(fd) ) return; - + if(g->mes1[0] == '\0' && g->mes2[0] == '\0') return; @@ -7966,7 +7967,7 @@ void clif_manner_message(struct map_session_data* sd, uint32 type) { int fd; nullpo_retv(sd); - + fd = sd->fd; WFIFOHEAD(fd,packet_len(0x14a)); WFIFOW(fd,0) = 0x14a; @@ -8300,7 +8301,7 @@ void clif_charnameack (int fd, struct block_list *bl) struct map_session_data *ssd = (struct map_session_data *)bl; struct party_data *p = NULL; struct guild *g = NULL; - + //Requesting your own "shadow" name. [Skotlex] if (ssd->fd == fd && ssd->disguise) WBUFL(buf,2) = -bl->id; @@ -8334,13 +8335,13 @@ void clif_charnameack (int fd, struct block_list *bl) if (p == NULL && g == NULL) break; - + WBUFW(buf, 0) = cmd = 0x195; if (p) memcpy(WBUFP(buf,30), p->party.name, NAME_LENGTH); else WBUFB(buf,30) = 0; - + if (g && ps >= 0 && ps < MAX_GUILDPOSITION) { memcpy(WBUFP(buf,54), g->name,NAME_LENGTH); @@ -8405,7 +8406,7 @@ void clif_charnameack (int fd, struct block_list *bl) return; case BL_ELEM: memcpy(WBUFP(buf,6), ((TBL_ELEM*)bl)->db->name, NAME_LENGTH); - break; + break; default: ShowError("clif_charnameack: bad type %d(%d)\n", bl->type, bl->id); return; @@ -8440,7 +8441,7 @@ void clif_charnameupdate (struct map_session_data *ssd) WBUFL(buf,2) = ssd->bl.id; memcpy(WBUFP(buf,6), ssd->status.name, NAME_LENGTH); - + if (!battle_config.display_party_name) { if (ssd->status.party_id > 0 && ssd->status.guild_id > 0 && (g = guild_search(ssd->status.guild_id)) != NULL) p = party_search(ssd->status.party_id); @@ -8523,13 +8524,13 @@ void clif_disp_overhead(struct map_session_data *sd, const char* mes) // send back message to the speaker WBUFW(buf,0) = 0x8e; WBUFW(buf, 2) = len_mes + 4; - safestrncpy((char*)WBUFP(buf,4), mes, len_mes); + safestrncpy((char*)WBUFP(buf,4), mes, len_mes); clif_send(buf, WBUFW(buf,2), &sd->bl, SELF); } /*========================== * Minimap fix [Kevin] - * Remove dot from minimap + * Remove dot from minimap *--------------------------*/ void clif_party_xy_remove(struct map_session_data *sd) { @@ -8715,7 +8716,7 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts nullpo_retv(sd); nullpo_retv(tsd); fd = sd->fd; - + WFIFOHEAD(fd, MAX_INVENTORY * s + 43); buf = WFIFOP(fd,0); @@ -8738,14 +8739,14 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts WBUFW(buf,38) = tsd->vd.hair_color; WBUFW(buf,40) = tsd->vd.cloth_color; WBUFB(buf,42) = tsd->vd.sex; - + for(i=0,n=0; i < MAX_INVENTORY; i++) { if (tsd->status.inventory[i].nameid <= 0 || tsd->inventory_data[i] == NULL) // Item doesn't exist continue; if (!itemdb_isequip2(tsd->inventory_data[i])) // Is not equippable continue; - + // Inventory position WBUFW(buf, n*s+43) = i + 2; // Add refine, identify flag, element, etc. @@ -8979,7 +8980,7 @@ static int clif_guess_PacketVer(int fd, int get_previous, int *error) //define CHECK_PACKET_VER CHECK_PACKET_VER();//Default packet version found. - + for (packet_ver = MAX_PACKET_VER; packet_ver > 0; packet_ver--) { //Start guessing the version, giving priority to the newer ones. [Skotlex] CHECK_PACKET_VER(); @@ -9056,7 +9057,7 @@ void clif_parse_WantToConnection(int fd, TBL_PC* sd) return; } - if (bl || + if (bl || ((node=chrif_search(account_id)) && //An already existing node is valid only if it is for this login. !(node->account_id == account_id && node->char_id == char_id && node->state == ST_LOGIN))) { @@ -9092,7 +9093,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) { if(sd->bl.prev != NULL) return; - + if (!sd->state.active) { //Character loading is not complete yet! //Let pc_reg_received reinvoke this when ready. @@ -9106,7 +9107,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_changemap(sd, sd->mapindex, sd->bl.x, sd->bl.y); return; } - + sd->state.warping = 0; // look @@ -9123,7 +9124,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) // item clif_inventorylist(sd); // inventory list first, otherwise deleted items in pc_checkitem show up as 'unknown item' pc_checkitem(sd); - + // cart if(pc_iscarton(sd)) { clif_cartlist(sd); @@ -9158,7 +9159,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) instance_check_idle(map[sd->bl.m].instance_id); } sd->state.debug_remove_map = 0; // temporary state to track double remove_map's [FlavioJS] - + // reset the callshop flag if the player changes map sd->state.callshop = 0; @@ -9248,7 +9249,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_hpmeter_single(sd->fd,sd->ed->bl.id,sd->ed->battle_status.hp,sd->ed->battle_status.matk_max); clif_elemental_updatestatus(sd,SP_SP); } - + if(sd->state.connect_new) { int lv; sd->state.connect_new = 0; @@ -9290,7 +9291,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) sd->state.night = 1; clif_status_load(&sd->bl, SI_NIGHT, 1); } - + // Notify everyone that this char logged in [Skotlex]. map_foreachpc(clif_friendslist_toggle_sub, sd->status.account_id, sd->status.char_id, 1); @@ -9304,7 +9305,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_updatestatus(sd,SP_INT); clif_updatestatus(sd,SP_DEX); clif_updatestatus(sd,SP_LUK); - + // abort currently running script sd->state.using_fake_npc = 0; sd->state.menu_or_input = 0; @@ -9355,7 +9356,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) map_iwall_get(sd); // Updates Walls Info on this Map to Client sd->state.changemap = false; } - + mail_clear(sd); /* Guild Aura Init */ @@ -9370,7 +9371,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_openvending(sd,sd->bl.id,sd->vending); clif_showvendingboard(&sd->bl,sd->message,0); } - + if(map[sd->bl.m].flag.loadevent) // Lance npc_script_event(sd, NPCE_LOADMAP); @@ -9381,7 +9382,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_changeoption(&sd->bl); clif_weather_check(sd); - + // For automatic triggering of NPCs after map loading (so you don't need to walk 1 step first) if (map_getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC)) npc_touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); @@ -9536,7 +9537,7 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) //Set last idle time... [Skotlex] sd->idletime = last_tick; - + unit_walktoxy(&sd->bl, x, y, 4); } @@ -9572,7 +9573,7 @@ void clif_parse_GetCharNameRequest(int fd, struct map_session_data *sd) int id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); struct block_list* bl; //struct status_change *sc; - + if( id < 0 && -id == sd->bl.id ) // for disguises [Valaris] id = sd->bl.id; @@ -9623,7 +9624,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) if( is_atcommand(fd, sd, message, 1) ) return; - if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) + if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; if( battle_config.min_chat_delay ) @@ -9792,7 +9793,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, (sd->sc.data[SC_TRICKDEAD] || sd->sc.data[SC_AUTOCOUNTER] || sd->sc.data[SC_BLADESTOP] || - sd->sc.data[SC__MANHOLE] || + sd->sc.data[SC__MANHOLE] || sd->sc.data[SC_CURSEDCIRCLE_ATKER] || sd->sc.data[SC_CURSEDCIRCLE_TARGET] )) return; @@ -9860,7 +9861,7 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type, return; } pc_setstand(sd); - skill_sit(sd,0); + skill_sit(sd,0); clif_standing(&sd->bl); break; } @@ -9934,7 +9935,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) if ( is_atcommand(fd, sd, message, 1) ) return; - if (sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)) + if (sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)) return; if (battle_config.min_chat_delay) { //[Skotlex] @@ -9975,12 +9976,12 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) safestrncpy(split_data[i], str, ARRAYLENGTH(split_data[i])); str = split+1; } - + for( i = 0; i < NUM_WHISPER_VAR; ++i ) { sprintf(output, "@whispervar%d$", i); set_var(sd,output,(char *) split_data[i]); } - + sprintf(output, "%s::OnWhisperGlobal", npc->exname); npc_event(sd,output,0); // Calls the NPC label @@ -10009,7 +10010,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) intif_wis_message(sd, target, message, messagelen); return; } - + // if player ignores everyone if (dstsd->state.ignoreAll) { if (dstsd->sc.option & OPTION_INVISIBLE && pc_get_group_level(sd) < pc_get_group_level(dstsd)) @@ -10018,7 +10019,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) clif_wis_end(fd, 3); // 3: everyone ignored by target return; } - + // if player is autotrading if( dstsd->state.autotrade == 1 ) { char output[256]; @@ -10026,14 +10027,14 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd) clif_wis_message(fd, wisp_server_name, output, strlen(output) + 1); return; } - + // if player ignores the source character ARR_FIND(0, MAX_IGNORE_LIST, i, dstsd->ignore[i].name[0] == '\0' || strcmp(dstsd->ignore[i].name, sd->status.name) == 0); if(i < MAX_IGNORE_LIST && dstsd->ignore[i].name[0] != '\0') { // source char present in ignore list clif_wis_end(fd, 2); // 2: ignored by target return; } - + // notify sender of success clif_wis_end(fd, 0); // 0: success to send wisper @@ -10052,7 +10053,7 @@ void clif_parse_Broadcast(int fd, struct map_session_data* sd) { // as the length varies depending on the command used, just block unreasonably long strings mes_len_check(msg, len, CHAT_SIZE_MAX); - + sprintf(command, "%ckami %s", atcommand_symbol, msg); is_atcommand(fd, sd, command, 1); } @@ -10068,7 +10069,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) int map_object_id; map_object_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); - + fitem = (struct flooritem_data*)map_id2bl(map_object_id); do { @@ -10082,7 +10083,7 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) if( sd->sc.cant.pickup ) break; - + if (pc_cant_act(sd)) break; @@ -10145,7 +10146,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) if (sd->sc.opt1 > 0 && sd->sc.opt1 != OPT1_STONEWAIT && sd->sc.opt1 != OPT1_BURNING) return; - + //This flag enables you to use items while in an NPC. [Skotlex] if (sd->npc_id) { if (sd->npc_id != sd->npc_item_flag) @@ -10157,7 +10158,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd) //Whether the item is used or not is irrelevant, the char ain't idle. [Skotlex] sd->idletime = last_tick; n = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0])-2; - + if(n <0 || n >= MAX_INVENTORY) return; if (!pc_useitem(sd,n)) @@ -10175,10 +10176,10 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) clif_clearunit_area(&sd->bl,CLR_DEAD); return; } - index = RFIFOW(fd,2)-2; + index = RFIFOW(fd,2)-2; if (index < 0 || index >= MAX_INVENTORY) return; //Out of bounds check. - + if(sd->npc_id) { if (sd->npc_id != sd->npc_item_flag) return; @@ -10199,7 +10200,7 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd) pet_equipitem(sd,index); return; } - + //Client doesn't send the position for ammo. if(sd->inventory_data[index]->type == IT_AMMO) pc_equipitem(sd,index,EQP_AMMO); @@ -10320,7 +10321,7 @@ void clif_parse_NpcSellListSend(int fd,struct map_session_data *sd) fail = 1; else fail = npc_selllist(sd,n,item_list); - + sd->npc_shopid = 0; //Clear shop data. WFIFOHEAD(fd,packet_len(0xcb)); @@ -10427,7 +10428,7 @@ void clif_parse_ChatLeave(int fd, struct map_session_data* sd) //Handles notifying asker and rejecter of what has just ocurred. //Type is used to determine the correct msg_txt to use: -//0: +//0: static void clif_noask_sub(struct map_session_data *src, struct map_session_data *target, int type) { const char* msg; @@ -10446,7 +10447,7 @@ static void clif_noask_sub(struct map_session_data *src, struct map_session_data void clif_parse_TradeRequest(int fd,struct map_session_data *sd) { struct map_session_data *t_sd; - + t_sd = map_id2sd(RFIFOL(fd,2)); if(!sd->chatID && pc_cant_act(sd)) @@ -10463,7 +10464,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd) clif_skill_fail(sd,1,USESKILL_FAIL_LEVEL,0); return; } - + trade_traderequest(sd,t_sd); } @@ -10557,7 +10558,7 @@ void clif_parse_RemoveOption(int fd,struct map_session_data *sd) #ifdef NEW_CARTS pc_setoption(sd,sd->sc.option&~(OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); if( sd->sc.data[SC_PUSH_CART] ) - pc_setcart(sd,0); + pc_setcart(sd,0); #else pc_setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON|OPTION_DRAGON|OPTION_MADOGEAR)); #endif @@ -10583,7 +10584,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd) (type == 4 && sd->status.base_level > 80) || (type == 3 && sd->status.base_level > 65) || (type == 2 && sd->status.base_level > 40) || - (type == 1)) + (type == 1)) #else if( (type == 5 && sd->status.base_level > 90) || (type == 4 && sd->status.base_level > 80) || @@ -10650,7 +10651,7 @@ static void clif_parse_UseSkillToPos_homun(struct homun_data *hd, struct map_ses if( skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST ) return; } else if( DIFF_TICK(tick, hd->ud.canact_tick) < 0 ) return; - + if( hd->sc.data[SC_BASILICA] ) return; lv = merc_hom_checkskill(hd, skillnum); @@ -10754,10 +10755,10 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( sd->bl.id != target_id && tmp&INF_SELF_SKILL ) target_id = sd->bl.id; // never trust the client - + if( target_id < 0 && -target_id == sd->bl.id ) // for disguises [Valaris] target_id = sd->bl.id; - + if( sd->ud.skilltimer != INVALID_TIMER ) { if( skillnum != SA_CASTCANCEL && skillnum != SO_SPELLFIST ) @@ -10821,7 +10822,7 @@ static void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, sho if( !(skill_get_inf(skillnum)&INF_GROUND_SKILL) ) return; //Using a target skill on the ground? WRONG. - + if( skillnum >= HM_SKILLBASE && skillnum < HM_SKILLBASE + MAX_HOMUNSKILL ) { clif_parse_UseSkillToPos_homun(sd->hd, sd, tick, skillnum, skilllv, x, y, skillmoreinfo); return; @@ -10921,7 +10922,7 @@ void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) return; if (pc_issit(sd)) return; - + clif_parse_UseSkillToPosSub(fd, sd, RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]), //Skill lv RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]), //Skill num @@ -10940,7 +10941,7 @@ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) char map_name[MAP_NAME_LENGTH]; mapindex_getmapname((char*)RFIFOP(fd,4), map_name); - if(skill_num != sd->menuskill_id) + if(skill_num != sd->menuskill_id) return; if( pc_cant_act(sd) ) { @@ -11002,7 +11003,7 @@ void clif_parse_Cooking(int fd,struct map_session_data *sd) { int amount = sd->menuskill_val2?sd->menuskill_val2:1; if( type == 6 && sd->menuskill_id != GN_MIX_COOKING && sd->menuskill_id != GN_S_PHARMACY ) return; - + if (pc_istrading(sd)) { //Make it fail to avoid shop exploits where you sell something different than you see. clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0); @@ -11104,7 +11105,7 @@ void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) int message_len = RFIFOW(fd,2)-8; int npcid = RFIFOL(fd,4); const char* message = (char*)RFIFOP(fd,8); - + if( message_len <= 0 ) return; // invalid input @@ -11118,7 +11119,7 @@ void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) { if (!sd->npc_id) //Avoid parsing anything when the script was done with. [Skotlex] - return; + return; npc_scriptcont(sd,RFIFOL(fd,2)); } @@ -11226,7 +11227,7 @@ void clif_parse_SolveCharName(int fd, struct map_session_data *sd) /// 1 = skill void clif_parse_ResetChar(int fd, struct map_session_data *sd) { char cmd[15]; - + if( RFIFOW(fd,2) ) sprintf(cmd,"%cresetskill",atcommand_symbol); else @@ -11244,7 +11245,7 @@ void clif_parse_LocalBroadcast(int fd, struct map_session_data* sd) char command[CHAT_SIZE_MAX+16]; char* msg = (char*)RFIFOP(fd,4); unsigned int len = RFIFOW(fd,2)-4; - + // as the length varies depending on the command used, just block unreasonably long strings mes_len_check(msg, len, CHAT_SIZE_MAX); @@ -11263,7 +11264,7 @@ void clif_parse_MoveToKafra(int fd, struct map_session_data *sd) if (pc_istrading(sd)) return; - + item_index = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0])-2; item_amount = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]); if (item_index < 0 || item_index >= MAX_INVENTORY || item_amount < 1) @@ -11445,7 +11446,7 @@ void clif_parse_CreateParty2(int fd, struct map_session_data *sd) void clif_parse_PartyInvite(int fd, struct map_session_data *sd) { struct map_session_data *t_sd; - + if(map[sd->bl.m].flag.partylock) {// Party locked. clif_displaymessage(fd, msg_txt(227)); @@ -11459,7 +11460,7 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) clif_noask_sub(sd, t_sd, 1); return; } - + party_invite(sd, t_sd); } @@ -11482,7 +11483,7 @@ void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) clif_noask_sub(sd, t_sd, 1); return; } - + party_invite(sd, t_sd); } @@ -11578,7 +11579,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd) if( is_atcommand(fd, sd, message, 1) ) return; - if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) + if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; if( battle_config.min_chat_delay ) @@ -11611,7 +11612,7 @@ void clif_parse_PartyBookingRegisterReq(int fd, struct map_session_data* sd) short mapid = RFIFOW(fd,4); short job[PARTY_BOOKING_JOBS]; int i; - + for(i=0; i<PARTY_BOOKING_JOBS; i++) job[i] = RFIFOB(fd,6+i*2); @@ -11712,7 +11713,7 @@ void clif_parse_PartyBookingUpdateReq(int fd, struct map_session_data* sd) { short job[PARTY_BOOKING_JOBS]; int i; - + for(i=0; i<PARTY_BOOKING_JOBS; i++) job[i] = RFIFOW(fd,2+i*2); @@ -11737,7 +11738,7 @@ void clif_PartyBookingInsertNotify(struct map_session_data* sd, struct party_boo WBUFW(buf,36) = pb_ad->p_detail.mapid; for(i=0; i<PARTY_BOOKING_JOBS; i++) WBUFW(buf,38+i*2) = pb_ad->p_detail.job[i]; - + clif_send(buf, packet_len(0x809), &sd->bl, ALL_CLIENT); } @@ -11767,7 +11768,7 @@ void clif_PartyBookingDeleteNotify(struct map_session_data* sd, int index) WBUFW(buf,0) = 0x80b; WBUFL(buf,2) = index; - + clif_send(buf, packet_len(0x80b), &sd->bl, ALL_CLIENT); // Now UPDATE all client. } @@ -11904,22 +11905,22 @@ void clif_parse_GuildRequestInfo(int fd, struct map_session_data *sd) switch( RFIFOL(fd,2) ) { - case 0: // �M���h��{���A�����G�Ώ�� + case 0: // Basic Information Guild, hostile alliance information clif_guild_basicinfo(sd); clif_guild_allianceinfo(sd); break; - case 1: // �����o�[���X�g�A��E�����X�g + case 1: // Members list, list job title clif_guild_positionnamelist(sd); clif_guild_memberlist(sd); break; - case 2: // ��E�����X�g�A��E��X�g + case 2: // List job title, title information list clif_guild_positionnamelist(sd); clif_guild_positioninfolist(sd); break; - case 3: // �X�L�����X�g + case 3: // Skill list clif_guild_skillinfo(sd); break; - case 4: // �Ǖ�X�g + case 4: // Expulsion list clif_guild_expulsionlist(sd); break; default: @@ -11949,7 +11950,7 @@ void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd) void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd) { int i; - + if(!sd->state.gmaster_flag) return; @@ -12034,7 +12035,7 @@ void clif_parse_GuildChangeNotice(int fd, struct map_session_data* sd) void clif_parse_GuildInvite(int fd,struct map_session_data *sd) { struct map_session_data *t_sd; - + if(map[sd->bl.m].flag.guildlock) { //Guild locked. clif_displaymessage(fd, msg_txt(228)); @@ -12113,7 +12114,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd) if( is_atcommand(fd, sd, message, 1) ) return; - if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) + if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; if( battle_config.min_chat_delay ) @@ -12135,7 +12136,7 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd) void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) { struct map_session_data *t_sd; - + if(!sd->state.gmaster_flag) return; @@ -12152,7 +12153,7 @@ void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) clif_noask_sub(sd, t_sd, 3); return; } - + guild_reqalliance(sd,t_sd); } @@ -12209,7 +12210,7 @@ void clif_parse_GuildOpposition(int fd, struct map_session_data *sd) clif_noask_sub(sd, t_sd, 4); return; } - + guild_opposition(sd,t_sd); } @@ -12388,7 +12389,7 @@ void clif_parse_GMShift(int fd, struct map_session_data *sd) player_name = (char*)RFIFOP(fd,2); player_name[NAME_LENGTH-1] = '\0'; - + sprintf(command, "%cjumpto %s", atcommand_symbol, player_name); is_atcommand(fd, sd, command, 1); } @@ -12426,7 +12427,7 @@ void clif_parse_GMRecall(int fd, struct map_session_data *sd) player_name = (char*)RFIFOP(fd,2); player_name[NAME_LENGTH-1] = '\0'; - + sprintf(command, "%crecall %s", atcommand_symbol, player_name); is_atcommand(fd, sd, command, 1); } @@ -12485,9 +12486,9 @@ void clif_parse_GM_Monster_Item(int fd, struct map_session_data *sd) /// TODO: Any OPTION_* ? void clif_parse_GMHide(int fd, struct map_session_data *sd) { char cmd[6]; - + sprintf(cmd,"%chide",atcommand_symbol); - + is_atcommand(fd, sd, cmd, 1); } @@ -12601,7 +12602,7 @@ void clif_parse_PMIgnore(int fd, struct map_session_data* sd) WFIFOHEAD(fd,packet_len(0xd1)); WFIFOW(fd,0) = 0x0d1; WFIFOB(fd,2) = type; - + if( type == 0 ) { // Add name to ignore list (block) if (strcmp(wisp_server_name, nick) == 0) { @@ -12783,7 +12784,7 @@ void clif_friendslist_toggle(struct map_session_data *sd,int account_id, int cha WFIFOW(fd, 0) = 0x206; WFIFOL(fd, 2) = sd->status.friends[i].account_id; WFIFOL(fd, 6) = sd->status.friends[i].char_id; - WFIFOB(fd,10) = !online; //Yeah, a 1 here means "logged off", go figure... + WFIFOB(fd,10) = !online; //Yeah, a 1 here means "logged off", go figure... WFIFOSET(fd, packet_len(0x206)); } @@ -12805,7 +12806,7 @@ int clif_friendslist_toggle_sub(struct map_session_data *sd,va_list ap) void clif_friendslist_send(struct map_session_data *sd) { int i = 0, n, fd = sd->fd; - + // Send friends list WFIFOHEAD(fd, MAX_FRIENDS * 32 + 4); WFIFOW(fd, 0) = 0x201; @@ -12820,7 +12821,7 @@ void clif_friendslist_send(struct map_session_data *sd) WFIFOW(fd,2) = 4 + 32 * i; WFIFOSET(fd, WFIFOW(fd,2)); } - + for (n = 0; n < i; n++) { //Sending the online players if (map_charid2sd(sd->status.friends[n].char_id)) @@ -12938,7 +12939,7 @@ void clif_parse_FriendsListReply(int fd, struct map_session_data *sd) f_sd = map_id2sd(account_id); //The account id is the same as the bl.id of players. if (f_sd == NULL) return; - + if (reply == 0 || !( sd->friend_req == f_sd->status.char_id && f_sd->friend_req == sd->status.char_id ) ) clif_friendslist_reqack(f_sd, sd, 1); else { @@ -13365,7 +13366,7 @@ void clif_parse_AutoRevive(int fd, struct map_session_data *sd) if (!status_revive(&sd->bl, 100, 100)) return; - + clif_skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1); pc_delitem(sd, item_position, 1, 0, 1, LOG_TYPE_CONSUME); } @@ -13705,7 +13706,7 @@ void clif_parse_Mail_getattach(int fd, struct map_session_data *sd) clif_Mail_getattachment(fd, 1); return; } - + if( sd->mail.inbox.msg[i].item.nameid > 0 ) { struct item_data *data; @@ -13767,7 +13768,7 @@ void clif_parse_Mail_delete(int fd, struct map_session_data *sd) clif_Mail_delete(sd->fd, mail_id, 1); return; } - + intif_Mail_delete(sd->status.char_id, mail_id); } } @@ -13867,12 +13868,12 @@ void clif_parse_Mail_send(int fd, struct map_session_data *sd) safestrncpy(msg.send_name, sd->status.name, NAME_LENGTH); safestrncpy(msg.dest_name, (char*)RFIFOP(fd,4), NAME_LENGTH); safestrncpy(msg.title, (char*)RFIFOP(fd,28), MAIL_TITLE_LENGTH); - + if (body_len) safestrncpy(msg.body, (char*)RFIFOP(fd,69), body_len + 1); else memset(msg.body, 0x00, MAIL_BODY_LENGTH); - + msg.timestamp = time(NULL); if( !intif_Mail_send(sd->status.account_id, &msg) ) mail_deliveryfail(sd, &msg); @@ -14008,14 +14009,14 @@ void clif_parse_Auction_setitem(int fd, struct map_session_data *sd) clif_Auction_setitem(sd->fd, idx, true); return; } - + if( !pc_can_give_items(sd) || sd->status.inventory[idx].expire_time || !sd->status.inventory[idx].identify || !itemdb_canauction(&sd->status.inventory[idx],pc_get_group_level(sd)) ) { // Quest Item or something else clif_Auction_setitem(sd->fd, idx, true); return; } - + sd->auction.index = idx; sd->auction.amount = amount; clif_Auction_setitem(fd, idx + 2, false); @@ -14203,7 +14204,7 @@ void clif_parse_Auction_search(int fd, struct map_session_data* sd) int price = RFIFOL(fd,4); // FIXME: bug #5071 clif_parse_Auction_cancelreg(fd, sd); - + safestrncpy(search_text, (char*)RFIFOP(fd,8), sizeof(search_text)); intif_Auction_requestlist(sd->status.char_id, type, price, search_text, page); } @@ -14326,7 +14327,7 @@ void clif_parse_cashshop_buy(int fd, struct map_session_data *sd) fail = npc_cashshop_buylist(sd,points,count,item_list); #endif } - + clif_cashshop_ack(sd,fail); } @@ -14463,7 +14464,7 @@ void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) { int charid = RFIFOL(fd, 2); struct map_session_data* tsd = map_id2sd(charid); - + if (!tsd) return; @@ -14790,7 +14791,7 @@ void clif_mercenary_skillblock(struct map_session_data *sd) if( sd == NULL || (md = sd->md) == NULL ) return; - + fd = sd->fd; WFIFOHEAD(fd,4+37*MAX_MERCSKILL); WFIFOW(fd,0) = 0x29d; @@ -14978,7 +14979,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd) if( is_atcommand(fd, sd, message, 1) ) return; - if( sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) + if( sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT) ) return; if( battle_config.min_chat_delay ) @@ -15256,20 +15257,20 @@ void clif_parse_ItemListWindowSelected(int fd, struct map_session_data* sd) { int type = RFIFOL(fd,4); int flag = RFIFOL(fd,8); // Button clicked: 0 = Cancel, 1 = OK unsigned short* item_list = (unsigned short*)RFIFOP(fd,12); - + if( sd->state.trading || sd->npc_shopid ) return; - + if( flag == 0 || n == 0) { clif_menuskill_clear(sd); return; // Canceled by player. } - - if( sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL ) { + + if( sd->menuskill_id != SO_EL_ANALYSIS && sd->menuskill_id != GN_CHANGEMATERIAL ) { clif_menuskill_clear(sd); return; // Prevent hacking. } - + switch( type ) { case 0: // Change Material skill_changematerial(sd,n,item_list); @@ -15280,7 +15281,7 @@ void clif_parse_ItemListWindowSelected(int fd, struct map_session_data* sd) { break; } clif_menuskill_clear(sd); - + return; } @@ -15291,10 +15292,10 @@ void clif_elemental_updatestatus(struct map_session_data *sd, int type) { struct elemental_data *ed; struct status_data *status; int fd; - + if( sd == NULL || (ed = sd->ed) == NULL ) return; - + fd = sd->fd; status = &ed->battle_status; WFIFOHEAD(fd,8); @@ -15321,13 +15322,13 @@ void clif_elemental_info(struct map_session_data *sd) { int fd; struct elemental_data *ed; struct status_data *status; - + if( sd == NULL || (ed = sd->ed) == NULL ) return; - + fd = sd->fd; status = &ed->battle_status; - + WFIFOHEAD(fd,22); WFIFOW(fd, 0) = 0x81d; WFIFOL(fd, 2) = ed->bl.id; @@ -15868,7 +15869,7 @@ void clif_parse_debug(int fd,struct map_session_data *sd) *------------------------------------------*/ int clif_elementalconverter_list(struct map_session_data *sd) { int i,c,view,fd; - + nullpo_ret(sd); @@ -15929,12 +15930,12 @@ int clif_spellbook_list(struct map_session_data *sd) for( i = 0, c = 0; i < MAX_INVENTORY; i ++ ) { if( itemdb_is_spellbook(sd->status.inventory[i].nameid) ) - { + { WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid; c ++; } } - + if( c > 0 ) { WFIFOW(fd,2) = c * 2 + 4; @@ -15966,7 +15967,7 @@ int clif_magicdecoy_list(struct map_session_data *sd, int skill_lv, short x, sho WFIFOW(fd,0) = 0x1ad; // This is the official packet. [pakpil] for( i = 0, c = 0; i < MAX_INVENTORY; i ++ ) { - if( itemdb_is_element(sd->status.inventory[i].nameid) ) { + if( itemdb_is_element(sd->status.inventory[i].nameid) ) { WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid; c ++; } @@ -16002,7 +16003,7 @@ int clif_poison_list(struct map_session_data *sd, int skill_lv) { WFIFOW(fd,0) = 0x1ad; // This is the official packet. [pakpil] for( i = 0, c = 0; i < MAX_INVENTORY; i ++ ) { - if( itemdb_is_poison(sd->status.inventory[i].nameid) ) { + if( itemdb_is_poison(sd->status.inventory[i].nameid) ) { WFIFOW(fd, c * 2 + 4) = sd->status.inventory[i].nameid; c ++; } @@ -16059,26 +16060,26 @@ int clif_skill_itemlistwindow( struct map_session_data *sd, int skill_id, int sk { #if PACKETVER >= 20090922 int fd; - + nullpo_ret(sd); - + sd->menuskill_id = skill_id; // To prevent hacking. sd->menuskill_val = skill_lv; - + if( skill_id == GN_CHANGEMATERIAL ) skill_lv = 0; // Changematerial - + fd = sd->fd; WFIFOHEAD(fd,packet_len(0x7e3)); WFIFOW(fd,0) = 0x7e3; WFIFOL(fd,2) = skill_lv; WFIFOL(fd,4) = 0; WFIFOSET(fd,packet_len(0x7e3)); - + #endif - + return 1; - + } /** * Sends a new status without a tick (currently used by the new mounts) @@ -16139,7 +16140,7 @@ void clif_msgtable_num(int fd, int line, int num) { * RFIFOL(fd,2) - flag (currently not used) *------------------------------------------*/ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { - + if( sd->menuskill_id != SC_AUTOSHADOWSPELL ) return; @@ -16148,9 +16149,9 @@ void clif_parse_SkillSelectMenu(int fd, struct map_session_data *sd) { clif_menuskill_clear(sd); return; } - + skill_select_menu(sd,RFIFOW(fd,6)); - + clif_menuskill_clear(sd); } /*========================================== @@ -16178,24 +16179,24 @@ void clif_talisman(struct map_session_data *sd,short type) void clif_parse_MoveItem(int fd, struct map_session_data *sd) { #if PACKETVER >= 20111122 int index; - + /* can't move while dead. */ if(pc_isdead(sd)) { return; } - + index = RFIFOW(fd,2)-2; - + if (index < 0 || index >= MAX_INVENTORY) return; - + if ( sd->status.inventory[index].favorite && RFIFOB(fd, 4) == 1 ) sd->status.inventory[index].favorite = 0; else if( RFIFOB(fd, 4) == 0 ) sd->status.inventory[index].favorite = 1; else return;/* nothing to do. */ - + clif_favorite_item(sd, index); #endif } @@ -16205,7 +16206,7 @@ void clif_parse_MoveItem(int fd, struct map_session_data *sd) { /// 0900 <index>.W <favorite>.B void clif_favorite_item(struct map_session_data* sd, unsigned short index) { int fd = sd->fd; - + WFIFOHEAD(fd,packet_len(0x908)); WFIFOW(fd,0) = 0x908; WFIFOW(fd,2) = index+2; @@ -16220,19 +16221,19 @@ void clif_snap( struct block_list *bl, short x, short y ) { WBUFL(buf,2) = bl->id; WBUFW(buf,6) = x; WBUFW(buf,8) = y; - + clif_send(buf,packet_len(0x8d2),bl,AREA); } void clif_monster_hp_bar( struct mob_data* md, int fd ) { -#if PACKETVER >= 20120404 +#if PACKETVER >= 20120404 WFIFOHEAD(fd,packet_len(0x977)); - + WFIFOW(fd,0) = 0x977; WFIFOL(fd,2) = md->bl.id; WFIFOL(fd,6) = md->status.hp; WFIFOL(fd,10) = md->status.max_hp; - + WFIFOSET(fd,packet_len(0x977)); #endif } @@ -16303,11 +16304,11 @@ static int clif_parse(int fd) WFIFOW(fd,0) = 0x6a; WFIFOB(fd,2) = 3; // Rejected from Server WFIFOSET(fd,packet_len(0x6a)); - + #ifdef DUMP_INVALID_PACKET ShowDump(RFIFOP(fd,0), RFIFOREST(fd)); #endif - + RFIFOSKIP(fd, RFIFOREST(fd)); set_eof(fd); return 0; @@ -16342,7 +16343,7 @@ static int clif_parse(int fd) } if ((int)RFIFOREST(fd) < packet_len) return 0; // not enough data received to form the packet - + if( packet_db[packet_ver][cmd].func == clif_parse_debug ) packet_db[packet_ver][cmd].func(fd, sd); else if( packet_db[packet_ver][cmd].func != NULL ) { @@ -16355,7 +16356,7 @@ static int clif_parse(int fd) if( sd && session[sd->fd]->flag.eof ) ; //No more packets accepted else - packet_db[packet_ver][cmd].func(fd, sd); + packet_db[packet_ver][cmd].func(fd, sd); } #ifdef DUMP_UNKNOWN_PACKET else { @@ -16422,7 +16423,7 @@ static int packetdb_readdb(void) #endif #if PACKETVER < 2 3, 28, 19, 11, 3, -1, 9, 5, 52, 51, 56, 58, 41, 2, 6, 6, -#elif PACKETVER < 20071106 // 78-7b �T���ȍ~ lv99�G�t�F�N�g�p +#elif PACKETVER < 20071106 // 78-7b Lv99 effect for later Kameshima 3, 28, 19, 11, 3, -1, 9, 5, 54, 53, 58, 60, 41, 2, 6, 6, #elif PACKETVER <= 20081217 // change in 0x78 and 0x7c 3, 28, 19, 11, 3, -1, 9, 5, 55, 53, 58, 60, 42, 2, 6, 6, @@ -16457,7 +16458,7 @@ static int packetdb_readdb(void) 6, 3,106, 10, 10, 34, 0, 6, 8, 4, 4, 4, 29, -1, 10, 6, #if PACKETVER < 1 90, 86, 24, 6, 30,102, 8, 4, 8, 4, 14, 10, -1, 6, 2, 6, -#else // 196 comodo�ȍ~ ��ԕ\���A�C�R���p +#else // 196 comodo icon status display for later 90, 86, 24, 6, 30,102, 9, 4, 8, 4, 14, 10, -1, 6, 2, 6, #endif #if PACKETVER < 20081126 @@ -16905,7 +16906,7 @@ static int packetdb_readdb(void) clif_config.packet_db_ver = MAX_PACKET_VER; else // to manually set the packet DB version clif_config.packet_db_ver = cap_value(atoi(w2), 0, MAX_PACKET_VER); - + continue; } } @@ -16948,7 +16949,7 @@ static int packetdb_readdb(void) // set the identifying cmd for the packet_db version if (strcmp(str[2],"wanttoconnection")==0) clif_config.connect_cmd[packet_ver] = cmd; - + if(str[3]==NULL){ ShowError("packet_db: packet error\n"); exit(EXIT_FAILURE); @@ -16979,7 +16980,7 @@ static int packetdb_readdb(void) if (!clif_config.connect_cmd[clif_config.packet_db_ver]) { //Locate the nearest version that we still support. [Skotlex] for(j = clif_config.packet_db_ver; j >= 0 && !clif_config.connect_cmd[j]; j--); - + clif_config.packet_db_ver = j?j:MAX_PACKET_VER; } ShowStatus("Done reading packet database from '"CL_WHITE"%s"CL_RESET"'. Using default packet version: "CL_WHITE"%d"CL_RESET".\n", "packet_db.txt", clif_config.packet_db_ver); @@ -17017,7 +17018,7 @@ int do_init_clif(void) { add_timer_func_list(clif_delayquit, "clif_delayquit"); delay_clearunit_ers = ers_new(sizeof(struct block_list),"clif.c::delay_clearunit_ers",ERS_OPT_CLEAR); - + return 0; } diff --git a/src/map/map.c b/src/map/map.c index e1e252a07..de7b34d93 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -243,11 +243,11 @@ int map_freeblock_timer(int tid, unsigned int tick, int id, intptr_t data) } // -// block��?�� +// blocklist // /*========================================== - * map[]��block_list����?�����Ă���ꍇ�� - * bl->prev��bl_head�̃A�h���X����Ă��� + * Handling of map_bl[] + * The adresse of bl_heal is set in bl->prev *------------------------------------------*/ static struct block_list bl_head; @@ -318,7 +318,7 @@ int map_addblock(struct block_list* bl) #ifdef CELL_NOSTACK map_addblcell(bl); #endif - + return 0; } @@ -342,12 +342,13 @@ int map_delblock(struct block_list* bl) #ifdef CELL_NOSTACK map_delblcell(bl); #endif - + pos = bl->x/BLOCK_SIZE+(bl->y/BLOCK_SIZE)*map[bl->m].bxs; if (bl->next) bl->next->prev = bl->prev; if (bl->prev == &bl_head) { + //Since the head of the list, update the block_list map of [] if (bl->type == BL_MOB) { map[bl->m].block_mob[pos] = bl->next; } else { @@ -383,7 +384,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) //TODO: Perhaps some outs of bounds checking should be placed here? if (bl->type&BL_CHAR) { sc = status_get_sc(bl); - + skill_unit_move(bl,tick,2); status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER); status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER); @@ -431,18 +432,18 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) skill_unit_move_unit_group(skill_id2group(sc->data[SC_WARM]->val4), bl->m, x1-x0, y1-y0); if (sc->data[SC_BANDING]) skill_unit_move_unit_group(skill_id2group(sc->data[SC_BANDING]->val4), bl->m, x1-x0, y1-y0); - + if (sc->data[SC_NEUTRALBARRIER_MASTER]) skill_unit_move_unit_group(skill_id2group(sc->data[SC_NEUTRALBARRIER_MASTER]->val2), bl->m, x1-x0, y1-y0); else if (sc->data[SC_STEALTHFIELD_MASTER]) skill_unit_move_unit_group(skill_id2group(sc->data[SC_STEALTHFIELD_MASTER]->val2), bl->m, x1-x0, y1-y0); - + if( sc->data[SC__SHADOWFORM] ) {//Shadow Form Caster Moving struct block_list *d_bl; if( (d_bl = map_id2bl(sc->data[SC__SHADOWFORM]->val2)) == NULL || bl->m != d_bl->m || !check_distance_bl(bl,d_bl,10) ) - status_change_end(bl,SC__SHADOWFORM,INVALID_TIMER); + status_change_end(bl,SC__SHADOWFORM,INVALID_TIMER); } - + if (sc->data[SC_PROPERTYWALK] && sc->data[SC_PROPERTYWALK]->val3 < skill_get_maxcount(sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2) && map_find_skill_unit_oncell(bl,bl->x,bl->y,SO_ELECTRICWALK,NULL,0) == NULL @@ -450,8 +451,8 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) && skill_unitsetting(bl,sc->data[SC_PROPERTYWALK]->val1,sc->data[SC_PROPERTYWALK]->val2,x0, y0,0)) { sc->data[SC_PROPERTYWALK]->val3++; } - - + + } /* Guild Aura Moving */ if( bl->type == BL_PC && ((TBL_PC*)bl)->state.gmaster_flag ) { @@ -471,7 +472,7 @@ int map_moveblock(struct block_list *bl, int x1, int y1, unsigned int tick) return 0; } - + /*========================================== * Counts specified number of objects on given cell. *------------------------------------------*/ @@ -491,7 +492,7 @@ int map_count_oncell(int m, int x, int y, int type) for( bl = map[m].block[bx+by*map[m].bxs] ; bl != NULL ; bl = bl->next ) if(bl->x == x && bl->y == y && bl->type&type) count++; - + if (type&BL_MOB) for( bl = map[m].block_mob[bx+by*map[m].bxs] ; bl != NULL ; bl = bl->next ) if(bl->x == x && bl->y == y) @@ -545,7 +546,7 @@ int map_foreachinrange(int (*func)(struct block_list*,va_list), struct block_lis y0 = max(center->y-range, 0); x1 = min(center->x+range, map[m].xs-1); y1 = min(center->y+range, map[m].ys-1); - + if (type&~BL_MOB) for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) { for(bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) { @@ -671,7 +672,7 @@ int map_foreachinshootrange(int (*func)(struct block_list*,va_list),struct block /*========================================== * range = map m (x0,y0)-(x1,y1) * Apply *func with ... arguments for the range. - * @type = BL_PC/BL_MOB etc.. + * @type = BL_PC/BL_MOB etc.. *------------------------------------------*/ int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, int y0, int x1, int y1, int type, ...) { @@ -698,7 +699,7 @@ int map_foreachinarea(int (*func)(struct block_list*,va_list), int m, int x0, in if (y0 < 0) y0 = 0; if (x1 >= map[m].xs) x1 = map[m].xs-1; if (y1 >= map[m].ys) y1 = map[m].ys-1; - + if (type&~BL_MOB) for(by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) for(bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) @@ -748,7 +749,7 @@ int map_forcountinrange(int (*func)(struct block_list*,va_list), struct block_li y0 = max(center->y-range, 0); x1 = min(center->x+range, map[m].xs-1); y1 = min(center->y+range, map[m].ys-1); - + if (type&~BL_MOB) for (by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) { for(bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) { @@ -825,7 +826,7 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int m, int x0, i if (y0 < 0) y0 = 0; if (x1 >= map[m].xs) x1 = map[m].xs-1; if (y1 >= map[m].ys) y1 = map[m].ys-1; - + if (type&~BL_MOB) for(by = y0 / BLOCK_SIZE; by <= y1 / BLOCK_SIZE; by++) for(bx = x0 / BLOCK_SIZE; bx <= x1 / BLOCK_SIZE; bx++) @@ -863,11 +864,9 @@ int map_forcountinarea(int (*func)(struct block_list*,va_list), int m, int x0, i } /*========================================== - * ��`(x0,y0)-(x1,y1)��(dx,dy)�ړ������b? - * �̈�O�ɂȂ�̈�(��`��L���`)?��obj�� - * ?����func���Ă� - * - * dx,dy��-1,0,1�݂̂Ƃ���i�ǂ�Ȓl�ł��������ۂ��H�j + * For what I get + * Move bl and do func* with va_list while moving. + * Mouvement is set by dx dy wich are distance in x and y *------------------------------------------*/ int map_foreachinmovearea(int (*func)(struct block_list*,va_list), struct block_list* center, int range, int dx, int dy, int type, ...) { @@ -1067,19 +1066,19 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y // x // S ////////////////////////////////////////////////////////////// -// Methodology: -// My trigonometrics and math are a little rusty... so the approach I am writing -// here is basicly do a double for to check for all targets in the square that -// contains the initial and final positions (area range increased to match the -// radius given), then for each object to test, calculate the distance to the +// Methodology: +// My trigonometrics and math are a little rusty... so the approach I am writing +// here is basicly do a double for to check for all targets in the square that +// contains the initial and final positions (area range increased to match the +// radius given), then for each object to test, calculate the distance to the // path and include it if the range fits and the target is in the line (0<k<1, // as they call it). -// The implementation I took as reference is found at -// http://astronomy.swin.edu.au/~pbourke/geometry/pointline/ +// The implementation I took as reference is found at +// http://astronomy.swin.edu.au/~pbourke/geometry/pointline/ // (they have a link to a C implementation, too) -// This approach is a lot like #2 commented on this function, which I have no +// This approach is a lot like #2 commented on this function, which I have no // idea why it was commented. I won't use doubles/floats, but pure int math for -// speed purposes. The range considered is always the same no matter how +// speed purposes. The range considered is always the same no matter how // close/far the target is because that's how SharpShooting works currently in // kRO. @@ -1091,10 +1090,10 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y int magnitude2, len_limit; //The square of the magnitude int k, xi, yi, xu, yu; int mx0 = x0, mx1 = x1, my0 = y0, my1 = y1; - + //Avoid needless calculations by not getting the sqrt right away. #define MAGNITUDE2(x0, y0, x1, y1) (((x1)-(x0))*((x1)-(x0)) + ((y1)-(y0))*((y1)-(y0))) - + if (m < 0) return 0; @@ -1141,14 +1140,14 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y my1 = my0; my0 = k; } - + if (mx0 < 0) mx0 = 0; if (my0 < 0) my0 = 0; if (mx1 >= map[m].xs) mx1 = map[m].xs-1; if (my1 >= map[m].ys) my1 = map[m].ys-1; - + range*=range<<8; //Values are shifted later on for higher precision using int math. - + if (type & ~BL_MOB) for (by = my0 / BLOCK_SIZE; by <= my1 / BLOCK_SIZE; by++) { for(bx=mx0/BLOCK_SIZE;bx<=mx1/BLOCK_SIZE;bx++){ @@ -1158,11 +1157,11 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y { xi = bl->x; yi = bl->y; - + k = (xi-x0)*(x1-x0) + (yi-y0)*(y1-y0); if (k < 0 || k > len_limit) //Since more skills use this, check for ending point as well. continue; - + if (k > magnitude2 && !path_search_long(NULL,m,x0,y0,xi,yi,CELL_CHKWALL)) continue; //Targets beyond the initial ending point need the wall check. @@ -1174,7 +1173,7 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y xu= (x0<<4) +k*(x1-x0); yu= (y0<<4) +k*(y1-y0); k = MAGNITUDE2(xi, yi, xu, yu); - + //If all dot coordinates were <<4 the square of the magnitude is <<8 if (k > range) continue; @@ -1197,17 +1196,17 @@ int map_foreachinpath(int (*func)(struct block_list*,va_list),int m,int x0,int y k = (xi-x0)*(x1-x0) + (yi-y0)*(y1-y0); if (k < 0 || k > len_limit) continue; - + if (k > magnitude2 && !path_search_long(NULL,m,x0,y0,xi,yi,CELL_CHKWALL)) continue; //Targets beyond the initial ending point need the wall check. - + k = (k<<4)/magnitude2; //k will be between 1~16 instead of 0~1 xi<<=4; yi<<=4; xu= (x0<<4) +k*(x1-x0); yu= (y0<<4) +k*(y1-y0); k = MAGNITUDE2(xi, yi, xu, yu); - + //If all dot coordinates were <<4 the square of the magnitude is <<8 if (k > range) continue; @@ -1379,8 +1378,8 @@ static int map_count_sub(struct block_list *bl,va_list ap) } /*========================================== - * Locates a random spare cell around the object given, using range as max - * distance from that spot. Used for warping functions. Use range < 0 for + * Locates a random spare cell around the object given, using range as max + * distance from that spot. Used for warping functions. Use range < 0 for * whole map range. * Returns 1 on success. when it fails and src is available, x/y are set to src's * src can be null as long as flag&1 @@ -1417,7 +1416,7 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx *y = by; return map_getcell(m,*x,*y,CELL_CHKREACH); } - + if (rx >= 0 && ry >= 0) { tries = rx2*ry2; if (tries > 100) tries = 100; @@ -1425,14 +1424,14 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx tries = map[m].xs*map[m].ys; if (tries > 500) tries = 500; } - + while(tries--) { *x = (rx >= 0)?(rnd()%rx2-rx+bx):(rnd()%(map[m].xs-2)+1); *y = (ry >= 0)?(rnd()%ry2-ry+by):(rnd()%(map[m].ys-2)+1); - + if (*x == bx && *y == by) continue; //Avoid picking the same target tile. - + if (map_getcell(m,*x,*y,CELL_CHKREACH)) { if(flag&2 && !unit_can_reach_pos(src, *x, *y, 1)) @@ -1456,7 +1455,7 @@ int map_search_freecell(struct block_list *src, int m, short *x,short *y, int rx /*========================================== * Add an item to location (m,x,y) - * Parameters + * Parameters * @item_data item attributes * @amount quantity * @m, @x, @y mapid,x,y @@ -1597,7 +1596,7 @@ void map_reqnickdb(struct map_session_data * sd, int charid) } /*========================================== - * id_db��bl��lj� + * add bl to id_db *------------------------------------------*/ void map_addiddb(struct block_list *bl) { @@ -1625,7 +1624,7 @@ void map_addiddb(struct block_list *bl) } /*========================================== - * id_db����bl���폜 + * remove bl from id_db *------------------------------------------*/ void map_deliddb(struct block_list *bl) { @@ -1654,7 +1653,7 @@ void map_deliddb(struct block_list *bl) *------------------------------------------*/ int map_quit(struct map_session_data *sd) { int i; - + if(!sd->state.active) { //Removing a player that is not active. struct auth_node *node = chrif_search(sd->status.account_id); if (node && node->char_id == sd->status.char_id && @@ -1678,7 +1677,7 @@ int map_quit(struct map_session_data *sd) { npc_script_event(sd, NPCE_LOGOUT); - //Unit_free handles clearing the player related data, + //Unit_free handles clearing the player related data, //map_quit handles extra specific data which is related to quitting normally //(changing map-servers invokes unit_free but bypasses map_quit) if( sd->sc.count ) { @@ -1687,6 +1686,7 @@ int map_quit(struct map_session_data *sd) { status_change_end(&sd->bl, SC_AUTOTRADE, INVALID_TIMER); status_change_end(&sd->bl, SC_SPURT, INVALID_TIMER); status_change_end(&sd->bl, SC_BERSERK, INVALID_TIMER); + status_change_end(&sd->bl, SC__BLOODYLUST, INVALID_TIMER); status_change_end(&sd->bl, SC_TRICKDEAD, INVALID_TIMER); status_change_end(&sd->bl, SC_LEADERSHIP, INVALID_TIMER); status_change_end(&sd->bl, SC_GLORYWOUNDS, INVALID_TIMER); @@ -1696,6 +1696,7 @@ int map_quit(struct map_session_data *sd) { status_change_end(&sd->bl, SC_ENDURE, INVALID_TIMER); //No need to save infinite endure. status_change_end(&sd->bl, SC_WEIGHT50, INVALID_TIMER); status_change_end(&sd->bl, SC_WEIGHT90, INVALID_TIMER); + status_change_end(&sd->bl, SC_SATURDAYNIGHTFEVER, INVALID_TIMER); status_change_end(&sd->bl, SC_KYOUGAKU, INVALID_TIMER); if (battle_config.debuff_on_logout&1) { status_change_end(&sd->bl, SC_ORCISH, INVALID_TIMER); @@ -1722,13 +1723,13 @@ int map_quit(struct map_session_data *sd) { status_change_end(&sd->bl, SC_SPIRIT, INVALID_TIMER); } } - + for( i = 0; i < EQI_MAX; i++ ) { if( sd->equip_index[ i ] >= 0 ) if( !pc_isequip( sd , sd->equip_index[ i ] ) ) pc_unequipitem( sd , sd->equip_index[ i ] , 2 ); } - + // Return loot to owner if( sd->pd ) pet_lootitem_drop(sd->pd, sd); @@ -1738,9 +1739,9 @@ int map_quit(struct map_session_data *sd) { elemental_clean_effect(sd->ed); unit_remove_map(&sd->ed->bl,CLR_TELEPORT); } - + unit_remove_map_pc(sd,CLR_TELEPORT); - + if( map[sd->bl.m].instance_id ) { // Avoid map conflicts and warnings on next login int m; @@ -2189,7 +2190,7 @@ bool mapit_exists(struct s_mapiterator* mapit) } /*========================================== - * map.npc�֒lj� (warp���̗̈掝���̂�) + * Add npc-bl to id_db, basically register npc to map *------------------------------------------*/ bool map_addnpc(int m,struct npc_data *nd) { @@ -2270,7 +2271,7 @@ int map_removemobs_sub(struct block_list *bl, va_list ap) // is a mvp if( md->db->mexp > 0 ) return 0; - + unit_free(&md->bl,CLR_OUTSIGHT); return 1; @@ -2299,7 +2300,7 @@ int map_removemobs_timer(int tid, unsigned int tick, int id, intptr_t data) if (battle_config.etc_log && count > 0) ShowStatus("Map %s: Removed '"CL_WHITE"%d"CL_RESET"' mobs.\n",map[m].name, count); - + return 1; } @@ -2312,7 +2313,7 @@ void map_removemobs(int m) } /*========================================== - * map������map��?��?�� + * Hookup, get map_id from map_name *------------------------------------------*/ int map_mapname2mapid(const char* name) { @@ -2329,10 +2330,10 @@ int map_mapname2mapid(const char* name) int map_mapindex2mapid(unsigned short mapindex) { struct map_data *md=NULL; - + if (!mapindex) return -1; - + md = (struct map_data*)uidb_get(map_db,(unsigned int)mapindex); if(md==NULL || md->cell==NULL) return -1; @@ -2340,7 +2341,7 @@ int map_mapindex2mapid(unsigned short mapindex) } /*========================================== - * ���Imap������ip,port?�� + * Switching Ip, port ? (like changing map_server) get ip/port from map_name *------------------------------------------*/ int map_mapname2ipport(unsigned short name, uint32* ip, uint16* port) { @@ -2381,9 +2382,9 @@ uint8 map_calc_dir(struct block_list* src, int x, int y) { unsigned char dir = 0; int dx, dy; - + nullpo_ret(src); - + dx = x-src->x; dy = y-src->y; if( dx == 0 && dy == 0 ) @@ -2414,13 +2415,13 @@ uint8 map_calc_dir(struct block_list* src, int x, int y) if( -dx*2 <= dy ) dir = 0; // up else if( -dx > dy*2 ) dir = 2; // left else dir = 1; // up-left - + } return dir; } /*========================================== - * Randomizes target cell x,y to a random walkable cell that + * Randomizes target cell x,y to a random walkable cell that * has the same distance from object as given coordinates do. [Skotlex] *------------------------------------------*/ int map_random_dir(struct block_list *bl, short *x, short *y) @@ -2431,9 +2432,9 @@ int map_random_dir(struct block_list *bl, short *x, short *y) int dist2 = xi*xi + yi*yi; short dist = (short)sqrt((float)dist2); short segment; - + if (dist < 1) dist =1; - + do { j = 1 + 2*(rnd()%4); //Pick a random diagonal direction segment = 1+(rnd()%dist); //Pick a random interval from the whole vector in that direction @@ -2443,7 +2444,7 @@ int map_random_dir(struct block_list *bl, short *x, short *y) } while ( (map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || !path_search(NULL,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH)) && (++i)<100 ); - + if (i < 100) { *x = xi; *y = yi; @@ -2452,12 +2453,12 @@ int map_random_dir(struct block_list *bl, short *x, short *y) return 0; } -// gat�n +// gat system inline static struct mapcell map_gat2cell(int gat) { struct mapcell cell; - + memset(&cell,0,sizeof(struct mapcell)); - + switch( gat ) { case 0: cell.walkable = 1; cell.shootable = 1; cell.water = 0; break; // walkable ground case 1: cell.walkable = 0; cell.shootable = 0; cell.water = 0; break; // non-walkable ground @@ -2740,14 +2741,14 @@ static DBData create_map_data_other_server(DBKey key, va_list args) } /*========================================== - * ���I�Ǘ��̃}�b�v��db�ɒlj� + * Add mapindex to db of another map server *------------------------------------------*/ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port) { struct map_data_other_server *mdos=NULL; mdos= uidb_ensure(map_db,(unsigned int)mapindex, create_map_data_other_server); - + if(mdos->cell) //Local map,Do nothing. Give priority to our own local maps over ones from another server. [Skotlex] return 0; if(ip == clif_getip() && port == clif_getport()) { @@ -2761,7 +2762,7 @@ int map_setipport(unsigned short mapindex, uint32 ip, uint16 port) } /** - * ���I�Ǘ��̃}�b�v��S�č폜 + * Delete all the other maps server management * @see DBApply */ int map_eraseallipport_sub(DBKey key, DBData *data, va_list va) @@ -2781,7 +2782,7 @@ int map_eraseallipport(void) } /*========================================== - * ���I�Ǘ��̃}�b�v��db����폜 + * Delete mapindex from db of another map server *------------------------------------------*/ int map_eraseipport(unsigned short mapindex, uint32 ip, uint16 port) { @@ -2969,7 +2970,7 @@ int map_waterheight(char* mapname) found = grfio_find_file(fn); if (found) strcpy(fn, found); // replace with real name - + // read & convert fn rsw = (char *) grfio_read (fn); if (rsw) @@ -3019,7 +3020,7 @@ int map_readgat (struct map_data* m) m->cell[xy] = map_gat2cell(type); } - + aFree(gat); return 1; @@ -3179,7 +3180,7 @@ int parse_console(const char* buf) return 0; } sd.bl.m = m; - map_search_freecell(&sd.bl, m, &sd.bl.x, &sd.bl.y, -1, -1, 0); + map_search_freecell(&sd.bl, m, &sd.bl.x, &sd.bl.y, -1, -1, 0); if( x > 0 ) sd.bl.x = x; if( y > 0 ) @@ -3224,7 +3225,7 @@ int parse_console(const char* buf) } /*========================================== - * �ݒ�t�@�C����?��?�� + * Read map server configuration files (conf/map_athena.conf...) *------------------------------------------*/ int map_config_read(char *cfgName) { @@ -3254,7 +3255,7 @@ int map_config_read(char *cfgName) while (--ptr >= w2 && *ptr == ' '); ptr++; *ptr = '\0'; - + if(strcmpi(w1,"timestamp_format")==0) strncpy(timestamp_format, w2, 20); else if(strcmpi(w1,"stdout_with_ansisequence")==0) @@ -3357,7 +3358,7 @@ void map_reloadnpc_sub(char *cfgName) while (--ptr >= w2 && *ptr == ' '); ptr++; *ptr = '\0'; - + if (strcmpi(w1, "npc") == 0) npc_addsrcfile(w2); else if (strcmpi(w1, "import") == 0) @@ -3588,7 +3589,7 @@ static int cleanup_db_sub(DBKey key, DBData *data, va_list va) } /*========================================== - * map�I�I���E�� + * map destructor *------------------------------------------*/ void do_final(void) { @@ -3603,10 +3604,10 @@ void do_final(void) for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) map_quit(sd); mapit_free(iter); - + /* prepares npcs for a faster shutdown process */ do_clear_npc(); - + // remove all objects on maps for (i = 0; i < map_num; i++) { ShowStatus("Cleaning up maps [%d/%d]: %s..."CL_CLL"\r", i+1, map_num, map[i].name); @@ -3640,9 +3641,9 @@ void do_final(void) do_final_battleground(); do_final_duel(); do_final_elemental(); - + map_db->destroy(map_db, map_db_final); - + for (i=0; i<map_num; i++) { if(map[i].cell) aFree(map[i].cell); if(map[i].block) aFree(map[i].block); @@ -3886,7 +3887,7 @@ int do_init(int argc, char *argv[]) map_config_read(MAP_CONF_NAME); /* only temporary until sirius's datapack patch is complete */ - + // loads npcs map_reloadnpc(false); @@ -3966,7 +3967,7 @@ int do_init(int argc, char *argv[]) do_init_unit(); do_init_battleground(); do_init_duel(); - + npc_event_do_oninit(); // Init npcs (OnInit) if( console ) @@ -3978,7 +3979,7 @@ int do_init(int argc, char *argv[]) ShowNotice("Server is running on '"CL_WHITE"PK Mode"CL_RESET"'.\n"); ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map_port); - + if( runflag != CORE_ST_STOP ) { shutdown_callback = do_shutdown; diff --git a/src/map/map.h b/src/map/map.h index 423f5d501..f46a28ca4 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -44,12 +44,24 @@ enum E_MAPSERVER_ST #define MAX_IGNORE_LIST 20 // official is 14 #define MAX_VENDING 12 #define MAX_MAP_SIZE 512*512 // Wasn't there something like this already? Can't find it.. [Shinryo] -#define MOBID_EMPERIUM 1288 + // Added definitions for WoESE objects. [L0ne_W0lf] -#define MOBID_BARRICADE1 1905 -#define MOBID_BARRICADE2 1906 -#define MOBID_GUARIDAN_STONE1 1907 -#define MOBID_GUARIDAN_STONE2 1908 +enum MOBID { + MOBID_EMPERIUM = 1288, + MOBID_TREAS01 = 1324, + MOBID_TREAS40 = 1363, + MOBID_BARRICADE1 = 1905, + MOBID_BARRICADE2, + MOBID_GUARIDAN_STONE1, + MOBID_GUARIDAN_STONE2, + MOBID_FOOD_STOR, + MOBID_BLUE_CRYST = 1914, + MOBID_PINK_CRYST, + MOBID_TREAS41 = 1938, + MOBID_TREAS49 = 1946, + MOBID_SILVERSNIPER = 2042, + MOBID_MAGICDECOY_WIND = 2046, +}; //The following system marks a different job ID system used by the map server, //which makes a lot more sense than the normal one. [Skotlex] @@ -220,9 +232,9 @@ enum { // No Kill Steal Protection #define map_flag_ks(m) (map[m].flag.town || map[m].flag.pvp || map[m].flag.gvg || map[m].flag.battleground) -//This stackable implementation does not means a BL can be more than one type at a time, but it's +//This stackable implementation does not means a BL can be more than one type at a time, but it's //meant to make it easier to check for multiple types at a time on invocations such as map_foreach* calls [Skotlex] -enum bl_type { +enum bl_type { BL_NUL = 0x000, BL_PC = 0x001, BL_MOB = 0x002, @@ -234,7 +246,7 @@ enum bl_type { BL_NPC = 0x080, BL_CHAT = 0x100, BL_ELEM = 0x200, - + BL_ALL = 0xFFF, }; @@ -351,7 +363,7 @@ enum _sp { // Mercenaries SP_MERCFLEE=165, SP_MERCKILLS=189, SP_MERCFAITH=190, - + // original 1000- SP_ATTACKRANGE=1000, SP_ATKELE,SP_DEFELE, // 1000-1002 SP_CASTRATE, SP_MAXHPRATE, SP_MAXSPRATE, SP_SPRATE, // 1003-1006 @@ -441,7 +453,7 @@ typedef enum { CELL_CHKREACH, // Same as PASS, but ignores the cell-stacking mod. CELL_CHKNOPASS, // non-passable cell (gat types 1 and 5) CELL_CHKNOREACH, // Same as NOPASS, but ignores the cell-stacking mod. - CELL_CHKSTACK, // whether cell is full (reached cell stacking limit) + CELL_CHKSTACK, // whether cell is full (reached cell stacking limit) CELL_CHKNPC, CELL_CHKBASILICA, @@ -706,7 +718,7 @@ bool mapit_exists(struct s_mapiterator* mapit); #define mapit_geteachnpc() mapit_alloc(MAPIT_NORMAL,BL_NPC) #define mapit_geteachiddb() mapit_alloc(MAPIT_NORMAL,BL_ALL) -// ̑ +// ���̑� int map_check_dir(int s_dir,int t_dir); unsigned char map_calc_dir( struct block_list *src,int x,int y); int map_random_dir(struct block_list *bl, short *x, short *y); // [Skotlex] diff --git a/src/map/mob.c b/src/map/mob.c index e423f7548..50a9397da 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -135,13 +135,13 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time) CREATE(nd, struct npc_data, 1); nd->bl.id = md->tomb_nid = npc_get_new_npc_id(); - + nd->ud.dir = md->ud.dir; nd->bl.m = md->bl.m; nd->bl.x = md->bl.x; nd->bl.y = md->bl.y; nd->bl.type = BL_NPC; - + safestrncpy(nd->name, msg_txt(656), sizeof(nd->name)); nd->class_ = 565; @@ -150,7 +150,7 @@ void mvptomb_create(struct mob_data *md, char *killer, time_t time) nd->u.tomb.md = md; nd->u.tomb.kill_time = time; - + if (killer) safestrncpy(nd->u.tomb.killer_name, killer, NAME_LENGTH); else @@ -172,9 +172,9 @@ void mvptomb_destroy(struct mob_data *md) { int m, i; m = nd->bl.m; - + clif_clearunit_area(&nd->bl,CLR_OUTSIGHT); - + map_delblock(&nd->bl); ARR_FIND( 0, map[m].npc_num, i, map[m].npc[i] == nd ); @@ -227,7 +227,7 @@ int mobdb_checkid(const int id) /*========================================== * Returns the view data associated to this mob class. *------------------------------------------*/ -struct view_data * mob_get_viewdata(int class_) +struct view_data * mob_get_viewdata(int class_) { if (mob_db(class_) == mob_dummy) return 0; @@ -248,7 +248,7 @@ int mob_parse_dataset(struct spawn_data *data) data->state.size=SZ_MEDIUM; data->class_ -= MAX_MOB_DB; } - + if ((!mobdb_checkid(data->class_) && !mob_is_clone(data->class_)) || !data->num) return 0; @@ -311,7 +311,7 @@ struct mob_data* mob_spawn_dataset(struct spawn_data *data) status_set_viewdata(&md->bl, md->class_); status_change_init(&md->bl); unit_dataset(&md->bl); - + map_addiddb(&md->bl); return md; } @@ -445,7 +445,7 @@ bool mob_ksprotected (struct block_list *src, struct block_list *target) struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m, short x, short y, const char *mobname, int class_, const char *event) { struct spawn_data data; - + memset(&data, 0, sizeof(struct spawn_data)); data.m = m; data.num = 1; @@ -460,7 +460,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m, short x, short if (event) safestrncpy(data.eventname, event, sizeof(data.eventname)); - + // Locate spot next to player. if (bl && (x < 0 || y < 0)) map_search_freecell(bl, m, &x, &y, 1, 1, 0); @@ -468,7 +468,7 @@ struct mob_data *mob_once_spawn_sub(struct block_list *bl, int m, short x, short // if none found, pick random position on map if (x <= 0 || y <= 0 || map_getcell(m,x,y,CELL_CHKNOREACH)) map_search_freecell(NULL, m, &x, &y, -1, -1, 1); - + data.x = x; data.y = y; @@ -485,7 +485,7 @@ int mob_once_spawn(struct map_session_data* sd, int m, short x, short y, const c { struct mob_data* md = NULL; int count, lv; - + if (m < 0 || amount <= 0) return 0; // invalid input @@ -567,7 +567,7 @@ int mob_once_spawn_area(struct map_session_data* sd,int m,int x0,int y0,int x1,i {// attempt to find an available cell failed if( lx == -1 && ly == -1 ) return 0; // total failure - + // fallback to last good x/y pair x = lx; y = ly; @@ -588,19 +588,19 @@ int mob_once_spawn_area(struct map_session_data* sd,int m,int x0,int y0,int x1,i static int mob_spawn_guardian_sub(int tid, unsigned int tick, int id, intptr_t data) { //Needed because the guild_data may not be available at guardian spawn time. struct block_list* bl = map_id2bl(id); - struct mob_data* md; + struct mob_data* md; struct guild* g; int guardup_lv; if (bl == NULL) //It is possible mob was already removed from map when the castle has no owner. [Skotlex] return 0; - + if (bl->type != BL_MOB) { ShowError("mob_spawn_guardian_sub: Block error!\n"); return 0; } - + md = (struct mob_data*)bl; nullpo_ret(md->guardian_data); g = guild_search((int)data); @@ -670,7 +670,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam ShowError("mob_spawn_guardian: Invalid guardian index %d for guardian %d (castle map %s)\n", guardian, class_, map[m].name); return 0; } - + if((x<=0 || y<=0) && !map_search_freecell(NULL, m, &x, &y, -1,-1, 1)) { ShowWarning("mob_spawn_guardian: Couldn't locate a spawn cell for guardian class %d (index %d) at castle map %s\n",class_, guardian, map[m].name); @@ -682,7 +682,7 @@ int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobnam safestrncpy(data.eventname, event, sizeof(data.eventname)); if (!mob_parse_dataset(&data)) return 0; - + gc=guild_mapname2gc(map[m].name); if (gc == NULL) { @@ -817,7 +817,7 @@ int mob_linksearch(struct block_list *bl,va_list ap) int class_; struct block_list *target; unsigned int tick; - + nullpo_ret(bl); md=(struct mob_data *)bl; class_ = va_arg(ap, int); @@ -978,10 +978,10 @@ int mob_spawn (struct mob_data *md) memset(md->dmglog, 0, sizeof(md->dmglog)); md->tdmg = 0; - + if (md->lootitem) memset(md->lootitem, 0, sizeof(*md->lootitem)); - + md->lootitem_count = 0; if(md->db->option) @@ -1013,7 +1013,7 @@ static int mob_can_changetarget(struct mob_data* md, struct block_list* target, else if (!(battle_config.mob_ai&0x4)) return 0; } - + switch (md->state.skillstate) { case MSS_BERSERK: if (!(mode&MD_CHANGETARGET_MELEE)) @@ -1105,7 +1105,7 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap) return 0; } - + (*target) = bl; md->target_id=bl->id; md->min_chase= dist + md->db->range3; @@ -1151,11 +1151,11 @@ static int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap) static int mob_ai_sub_hard_bg_ally(struct block_list *bl,va_list ap) { struct mob_data *md; struct block_list **target; - + nullpo_ret(bl); md=va_arg(ap,struct mob_data *); target= va_arg(ap,struct block_list**); - + if( status_check_skilluse(&md->bl, bl, 0, 0) && battle_check_target(&md->bl,bl,BCT_ENEMY)<=0 ) { (*target) = bl; } @@ -1175,7 +1175,7 @@ static int mob_ai_sub_hard_lootsearch(struct block_list *bl,va_list ap) target= va_arg(ap,struct block_list**); dist=distance_bl(&md->bl, bl); - if(mob_can_reach(md,bl,dist+1, MSS_LOOT) && + if(mob_can_reach(md,bl,dist+1, MSS_LOOT) && ((*target) == NULL || !check_distance_bl(&md->bl, *target, dist)) //New target closer than previous one. ) { (*target) = bl; @@ -1238,7 +1238,7 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) md->master_dist=distance_bl(&md->bl, bl); // Since the master was in near immediately before, teleport is carried out and it pursues. - if(bl->m != md->bl.m || + if(bl->m != md->bl.m || (old_dist<10 && md->master_dist>18) || md->master_dist > MAX_MINCHASE ){ @@ -1265,13 +1265,13 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick) status_kill(&md->bl); return 1; } - + //Avoid attempting to lock the master's target too often to avoid unnecessary overload. [Skotlex] if (DIFF_TICK(md->last_linktime, tick) < MIN_MOBLINKTIME && !md->target_id) { struct unit_data *ud = unit_bl2ud(bl); md->last_linktime = tick; - + if (ud) { struct block_list *tbl=NULL; if (ud->target && ud->state.attack_continue) @@ -1351,7 +1351,7 @@ int mob_randomwalk(struct mob_data *md,unsigned int tick) !unit_can_move(&md->bl) || !(status_get_mode(&md->bl)&MD_CANMOVE)) return 0; - + d =12-md->move_fail_count; if(d<5) d=5; for(i=0;i<retrycount;i++){ // Search of a movable place @@ -1423,7 +1423,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) if(md->bl.prev == NULL || md->status.hp <= 0) return false; - + if (DIFF_TICK(tick, md->last_thinktime) < MIN_MOBTHINKTIME) return false; @@ -1467,7 +1467,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) tbl = NULL; } } - + // Check for target change. if( md->attacked_id && mode&MD_CANATTACK ) { @@ -1538,7 +1538,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) //Clear it since it's been checked for already. md->attacked_id = 0; } - + // Processing of slave monster if (md->master_id > 0 && mob_ai_sub_hard_slavemob(md, tick)) return true; @@ -1564,7 +1564,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) if (!tbl) { //No targets available. if (mode&MD_ANGRY && !md->state.aggressive) md->state.aggressive = 1; //Restore angry state when no targets are available. - + /* bg guardians follow allies when no targets nearby */ if( md->bg_id && mode&MD_CANATTACK ) { if( md->ud.walktimer != INVALID_TIMER ) @@ -1575,12 +1575,12 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) return true;/* we're moving or close enough don't unlock the target. */ } } - + //This handles triggering idle walk/skill. mob_unlocktarget(md, tick); return true; } - + //Target exists, attack or loot as applicable. if (tbl->type == BL_ITEM) { //Loot time. @@ -1637,7 +1637,7 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) //At this point we know the target is attackable, we just gotta check if the range matches. if (md->ud.target == tbl->id && md->ud.attacktimer != INVALID_TIMER) //Already locked. return true; - + if (battle_check_range (&md->bl, tbl, md->status.rhw.range)) { //Target within range, engage @@ -1683,7 +1683,7 @@ static int mob_ai_sub_hard_timer(struct block_list *bl,va_list ap) { struct mob_data *md = (struct mob_data*)bl; unsigned int tick = va_arg(ap, unsigned int); - if (mob_ai_sub_hard(md, tick)) + if (mob_ai_sub_hard(md, tick)) { //Hard AI triggered. if(!md->state.spotted) md->state.spotted = 1; @@ -1948,7 +1948,7 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) switch( src->type ) { - case BL_PC: + case BL_PC: { struct map_session_data *sd = (TBL_PC*)src; char_id = sd->status.char_id; @@ -2013,11 +2013,11 @@ void mob_log_damage(struct mob_data *md, struct block_list *src, int damage) if( damage ) md->attacked_id = src->id; break; - } + } default: //For all unhandled types. md->attacked_id = src->id; } - + if( char_id ) { //Log damage... int i,minpos; @@ -2074,10 +2074,10 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) if (battle_config.show_mob_info&3) clif_charnameack (0, &md->bl); - + if (!src) return; - + #if PACKETVER >= 20120404 if( !(md->status.mode&MD_BOSS) ){ int i; @@ -2088,7 +2088,7 @@ void mob_damage(struct mob_data *md, struct block_list *src, int damage) } } #endif - + if( md->special_state.ai == 2 ) {//LOne WOlf explained that ANYONE can trigger the marine countdown skill. [Skotlex] md->state.alchemist = 1; mobskill_use(md, gettick(), MSC_ALCHEMIST); @@ -2104,7 +2104,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) struct status_data *status; struct map_session_data *sd = NULL, *tmpsd[DAMAGELOG_SIZE]; struct map_session_data *mvp_sd = NULL, *second_sd = NULL, *third_sd = NULL; - + struct { struct party_data *p; int id,zeny; @@ -2138,7 +2138,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) if(src && src->type == BL_MOB) mob_unlocktarget((struct mob_data *)src,tick); - + // filter out entries not eligible for exp distribution memset(tmpsd,0,sizeof(tmpsd)); for(i = 0, count = 0, mvp_damage = 0; i < DAMAGELOG_SIZE && md->dmglog[i].id; i++) @@ -2226,7 +2226,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) per = (double)md->dmglog[i].dmg/(double)status->max_hp; if (per > 2) per = 2; // prevents unlimited exp gain } - + if (count>1 && battle_config.exp_bonus_attacker) { //Exp bonus per additional attacker. if (count > battle_config.exp_bonus_max_attacker) @@ -2251,15 +2251,15 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) } if (map[m].flag.nobaseexp || !md->db->base_exp) - base_exp = 0; + base_exp = 0; else base_exp = (unsigned int)cap_value(md->db->base_exp * per * bonus/100. * map[m].bexp/100., 1, UINT_MAX); - + if (map[m].flag.nojobexp || !md->db->job_exp || md->dmglog[i].flag == MDLF_HOMUN) //Homun earned job-exp is always lost. - job_exp = 0; + job_exp = 0; else job_exp = (unsigned int)cap_value(md->db->job_exp * per * bonus/100. * map[m].jexp/100., 1, UINT_MAX); - + if((temp = tmpsd[i]->status.party_id )>0 && !md->dmglog[i].flag == MDLF_HOMUN) //Homun-done damage (flag 1) is not given to party { int j; @@ -2281,12 +2281,12 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) pt[j].base_exp=UINT_MAX; else pt[j].base_exp+=base_exp; - + if (pt[j].job_exp > UINT_MAX - job_exp) pt[j].job_exp=UINT_MAX; else pt[j].job_exp+=job_exp; - + pt[j].zeny+=zeny; // zeny share [Valaris] flag=0; } @@ -2309,12 +2309,12 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) pc_getzeny(tmpsd[i], zeny); } } - + for(i=0;i<pnum;i++) //Party share. party_exp_share(pt[i].p, &md->bl, pt[i].base_exp,pt[i].job_exp,pt[i].zeny); } //End EXP giving. - + if( !(type&1) && !map[m].flag.nomobloot && !md->state.rebirth && ( !md->special_state.ai || //Non special mob battle_config.alchemist_summon_reward == 2 || //All summoned give drops @@ -2361,7 +2361,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) //Drops affected by luk as a fixed increase [Valaris] if (battle_config.drops_by_luk) drop_rate += status_get_luk(src)*battle_config.drops_by_luk/100; - //Drops affected by luk as a % increase [Skotlex] + //Drops affected by luk as a % increase [Skotlex] if (battle_config.drops_by_luk2) drop_rate += (int)(0.5+drop_rate*status_get_luk(src)*battle_config.drops_by_luk2/10000.); } @@ -2430,14 +2430,14 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) else //it's positive, then it goes as it is drop_rate = sd->add_drop[i].rate; - + if (rnd()%10000 >= drop_rate) continue; itemid = (sd->add_drop[i].id > 0) ? sd->add_drop[i].id : itemdb_searchrandomid(sd->add_drop[i].group); mob_item_drop(md, dlist, mob_setdropitem(itemid,1), 0, drop_rate, homkillonly); } } - + // process script-granted zeny bonus (get_zeny_num) [Skotlex] if( sd->bonus.get_zeny_num && rnd()%100 < sd->bonus.get_zeny_rate ) { i = sd->bonus.get_zeny_num > 0 ? sd->bonus.get_zeny_num : -md->level * sd->bonus.get_zeny_num; @@ -2445,7 +2445,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) pc_getzeny(sd, 1+rnd()%i); } } - + // process items looted by the mob if(md->lootitem) { for(i = 0; i < md->lootitem_count; i++) @@ -2474,30 +2474,30 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) unsigned int mexp; struct item item; double exp; - + //mapflag: noexp check [Lorky] if (map[m].flag.nobaseexp || type&2) - exp =1; + exp =1; else { exp = md->db->mexp; if (count > 1) exp += exp*(battle_config.exp_bonus_attacker*(count-1))/100.; //[Gengar] } - + mexp = (unsigned int)cap_value(exp, 1, UINT_MAX); clif_mvp_effect(mvp_sd); clif_mvp_exp(mvp_sd,mexp); pc_gainexp(mvp_sd, &md->bl, mexp,0, false); log_mvp[1] = mexp; - + if( !(map[m].flag.nomvploot || type&1) ) { /* pose them randomly in the list -- so on 100% drop servers it wont always drop the same item */ int mdrop_id[MAX_MVP_DROP]; int mdrop_p[MAX_MVP_DROP]; - + memset(&mdrop_id,0,MAX_MVP_DROP*sizeof(int)); - + for(i = 0; i < MAX_MVP_DROP; i++) { while( 1 ) { int va = rand()%MAX_MVP_DROP; @@ -2508,13 +2508,13 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) } } } - + for(i = 0; i < MAX_MVP_DROP; i++) { if(mdrop_id[i] <= 0) continue; if(!itemdb_exists(mdrop_id[i])) continue; - + temp = mdrop_p[i]; if(temp <= 0 && !battle_config.drop_rate0item) temp = 1; @@ -2526,7 +2526,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) item.identify= itemdb_isidentified(item.nameid); clif_mvp_item(mvp_sd,item.nameid); log_mvp[0] = item.nameid; - + //A Rare MVP Drop Global Announce by Lupus if(temp<=battle_config.rare_drop_announce) { struct item_data *i_data; @@ -2541,7 +2541,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) clif_additem(mvp_sd,0,0,temp); map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1); } - + //Logs items, MVP prizes [Lupus] log_pick_mob(md, LOG_TYPE_MVP, -1, &item); break; @@ -2578,12 +2578,12 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) } pc_setglobalreg(sd,"TK_MISSION_COUNT", sd->mission_count); } - + if( sd->status.party_id ) map_foreachinrange(quest_update_objective_sub,&md->bl,AREA_SIZE,BL_PC,sd->status.party_id,md->class_); else if( sd->avail_quests ) quest_update_objective(sd, md->class_); - + if( sd->md && src && src->type != BL_HOM && mob_db(md->class_)->lv > sd->status.base_level/2 ) mercenary_kills(sd->md); } @@ -2601,7 +2601,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) pc_setparam(mvp_sd, SP_KILLEDRID, md->class_); npc_script_event(mvp_sd, NPCE_KILLNPC); // PCKillNPC [Lance] } - + md->status.hp = 1; } @@ -2614,11 +2614,11 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) **/ if( md->can_summon ) mob_deleteslave(md); - + map_freeblock_unlock(); if( !rebirth ) { - + if( pcdb_checkid(md->vd->class_) ) {//Player mobs are not removed automatically by the client. /* first we set them dead, then we delay the outsight effect */ clif_clearunit_area(&md->bl,CLR_DEAD); @@ -2652,7 +2652,7 @@ void mob_revive(struct mob_data *md, unsigned int hp) md->next_walktime = tick+rnd()%50+5000; md->last_linktime = tick; md->last_pcneartime = 0; - memset(md->dmglog, 0, sizeof(md->dmglog)); // Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris] + memset(md->dmglog, 0, sizeof(md->dmglog)); // Reset the damage done on the rebirthed monster, otherwise will grant full exp + damage done. [Valaris] md->tdmg = 0; if (!md->bl.prev) map_addblock(&md->bl); @@ -2685,7 +2685,7 @@ int mob_guardian_guildchange(struct mob_data *md) } return 0; } - + g = guild_search(md->guardian_data->castle->guild_id); if (g == NULL) { //Properly remove guardian info from Castle data. @@ -2703,7 +2703,7 @@ int mob_guardian_guildchange(struct mob_data *md) return 1; } - + /*========================================== * Pick a random class for the mob *------------------------------------------*/ @@ -2743,7 +2743,7 @@ int mob_class_change (struct mob_data *md, int class_) if (md->guardian_data) return 0; //Guardians/Emperium - if( (md->class_ >= 1324 && md->class_ <= 1363) || (md->class_ >= 1938 && md->class_ <= 1946) ) + if( mob_is_treasure(md) ) return 0; //Treasure Boxes if( md->special_state.ai > 1 ) @@ -2795,7 +2795,7 @@ int mob_class_change (struct mob_data *md, int class_) } /*========================================== - * mob + * mob heal, update display hp info of mob for players *------------------------------------------*/ void mob_heal(struct mob_data *md,unsigned int heal) { @@ -2813,7 +2813,7 @@ int mob_warpslave_sub(struct block_list *bl,va_list ap) short x,y,range=0; master = va_arg(ap, struct block_list*); range = va_arg(ap, int); - + if(md->master_id!=master->id) return 0; @@ -2831,7 +2831,7 @@ int mob_warpslave(struct block_list *bl, int range) { if (range < 1) range = 1; //Min range needed to avoid crashes and stuff. [Skotlex] - + return map_foreachinmap(mob_warpslave_sub, bl->m, BL_MOB, bl, range); } @@ -2843,7 +2843,7 @@ int mob_countslave_sub(struct block_list *bl,va_list ap) int id; struct mob_data *md; id=va_arg(ap,int); - + md = (struct mob_data *)bl; if( md->master_id==id ) return 1; @@ -2891,7 +2891,7 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id) k = rnd()%count; amount+=k; //Increase final value by same amount to preserve total number to summon. } - + if (!battle_config.monster_class_change_recover && (skill_id == NPC_TRANSFORMATION || skill_id == NPC_METAMORPHOSIS)) hp_rate = get_percentage(md2->status.hp, md2->status.max_hp); @@ -2918,14 +2918,14 @@ int mob_summonslave(struct mob_data *md2,int *value,int amount,int skill_id) if (!mob_parse_dataset(&data)) continue; - + md= mob_spawn_dataset(&data); if(skill_id == NPC_SUMMONSLAVE){ md->master_id=md2->bl.id; md->special_state.ai = md2->special_state.ai; } mob_spawn(md); - + if (hp_rate) //Scale HP md->status.hp = md->status.max_hp*hp_rate/100; @@ -2991,12 +2991,12 @@ int mob_getfriendhprate_sub(struct block_list *bl,va_list ap) if ((*fr) != NULL) //A friend was already found. return 0; - + if (battle_check_target(&md->bl,bl,BCT_ENEMY)>0) return 0; - + rate = get_percentage(status_get_hp(bl), status_get_max_hp(bl)); - + if (rate >= min_rate && rate <= max_rate) (*fr) = bl; return 1; @@ -3005,12 +3005,12 @@ static struct block_list *mob_getfriendhprate(struct mob_data *md,int min_rate,i { struct block_list *fr=NULL; int type = BL_MOB; - + nullpo_retr(NULL, md); if (md->special_state.ai) //Summoned creatures. [Skotlex] type = BL_PC; - + map_foreachinrange(mob_getfriendhprate_sub, &md->bl, 8, type,md,min_rate,max_rate,&fr); return fr; } @@ -3104,7 +3104,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) continue; c2 = ms[i].cond2; - + if (ms[i].state != md->state.skillstate) { if (md->state.skillstate != MSS_DEAD && (ms[i].state == MSS_ANY || (ms[i].state == MSS_ANYTARGET && md->target_id && md->state.skillstate != MSS_LOOT) @@ -3115,7 +3115,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) } if (rnd() % 10000 > ms[i].permillage) //Lupus (max value = 10000) continue; - + if (ms[i].cond1 == event) flag = 1; //Trigger skill. else if (ms[i].cond1 == MSC_SKILLUSED) @@ -3176,10 +3176,10 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) break; } } - + if (!flag) continue; //Skill requisite failed to be fulfilled. - + //Execute skill if (skill_get_casttype(ms[i].skill_id) == CAST_GROUND) { //Ground skill. @@ -3198,7 +3198,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) break; case MST_MASTER: bl = &md->bl; - if (md->master_id) + if (md->master_id) bl = map_id2bl(md->master_id); if (bl) //Otherwise, fall through. break; @@ -3210,7 +3210,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) break; } if (!bl) continue; - + x = bl->x; y = bl->y; // Look for an area to cast the spell around... @@ -3240,7 +3240,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) break; case MST_MASTER: bl = &md->bl; - if (md->master_id) + if (md->master_id) bl = map_id2bl(md->master_id); if (bl) //Otherwise, fall through. break; @@ -3257,7 +3257,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) break; } if (!bl) continue; - + md->skillidx = i; map_freeblock_lock(); if( !battle_check_range(&md->bl,bl,skill_get_range2(&md->bl, ms[i].skill_id,ms[i].skill_lv)) || @@ -3267,7 +3267,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) continue; } } - //Skill used. Post-setups... + //Skill used. Post-setups... if ( ms[ i ].msg_id ){ //Display color message [SnakeDrak] struct mob_chat *mc = mob_chat(ms[i].msg_id); char temp[CHAT_SIZE_MAX]; @@ -3303,7 +3303,7 @@ int mobskill_event(struct mob_data *md, struct block_list *src, unsigned int tic target_id = md->target_id; if (!target_id || battle_config.mob_changetarget_byskill) md->target_id = src->id; - + if (flag == -1) res = mobskill_use(md, tick, MSC_CASTTARGETED); else if ((flag&0xffff) == MSC_SKILLUSED) @@ -3312,14 +3312,14 @@ int mobskill_event(struct mob_data *md, struct block_list *src, unsigned int tic res = mobskill_use(md, tick, MSC_CLOSEDATTACKED); else if (flag&BF_LONG && !(flag&BF_MAGIC)) //Long-attacked should not include magic. res = mobskill_use(md, tick, MSC_LONGRANGEATTACKED); - + if (!res) //Restore previous target only if skill condition failed to trigger. [Skotlex] md->target_id = target_id; //Otherwise check if the target is an enemy, and unlock if needed. else if (battle_check_target(&md->bl, src, BCT_ENEMY) <= 0) md->target_id = target_id; - + return res; } @@ -3367,9 +3367,9 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char status->lhw.atk = status->dex; //Min ATK } if (mode) //User provided mode. - status->mode = mode; + status->mode = mode; else if (flag&1) //Friendly Character, remove looting. - status->mode &= ~MD_LOOTER; + status->mode &= ~MD_LOOTER; status->hp = status->max_hp; status->sp = status->max_sp; memcpy(&db->vd, &sd->vd, sizeof(struct view_data)); @@ -3387,7 +3387,7 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char **/ fd = sd->fd; sd->fd = 0; - + //Go Backwards to give better priority to advanced skills. for (i=0,j = MAX_SKILL_TREE-1;j>=0 && i< MAX_MOBSKILL ;j--) { skill_id = skill_tree[pc_class2idx(sd->status.class_)][j].id; @@ -3397,7 +3397,7 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char ) continue; //Normal aggressive mob, disable skills that cannot help them fight - //against players (those with flags UF_NOMOB and UF_NOPC are specific + //against players (those with flags UF_NOMOB and UF_NOPC are specific //to always aid players!) [Skotlex] if (!(flag&1) && skill_get_unit_id(skill_id, 0) && @@ -3408,7 +3408,7 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char **/ if( !skill_check_condition_castbegin(sd,skill_id,sd->status.skill[skill_id].lv) ) continue; - + memset (&ms[i], 0, sizeof(struct mob_skill)); ms[i].skill_id = skill_id; ms[i].skill_lv = sd->status.skill[skill_id].lv; @@ -3472,7 +3472,7 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char ms[i].delay += -5000 +(skill_get_time(skill_id, ms[i].skill_lv) + skill_get_time2(skill_id, ms[i].skill_lv))/2; if (ms[i].delay < 2000) ms[i].delay = 2000; //With a minimum of 2 secs. - + if (i+1 < MAX_MOBSKILL) { //duplicate this so it also triggers on self. memcpy(&ms[i+1], &ms[i], sizeof(struct mob_skill)); db->maxskill = ++i; @@ -3498,10 +3498,10 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char ms[i].permillage = ms[i].permillage*battle_config.mob_skill_rate/100; if (battle_config.mob_skill_delay != 100) ms[i].delay = ms[i].delay*battle_config.mob_skill_delay/100; - + db->maxskill = ++i; } - + /** * We grant the session it's fd value back. **/ @@ -3510,9 +3510,9 @@ int mob_clone_spawn(struct map_session_data *sd, int m, int x, int y, const char //Finally, spawn it. md = mob_once_spawn_sub(&sd->bl, m, x, y, "--en--",class_,event); if (!md) return 0; //Failed? - + md->special_state.clone = 1; - + if (master_id || flag || duration) { //Further manipulate crafted char. if (flag&1) //Friendly Character md->special_state.ai = 1; @@ -3547,7 +3547,7 @@ int mob_clone_delete(struct mob_data *md) } // -// +// Initialization // /*========================================== * Since un-setting [ mob ] up was used, it is an initial provisional value setup. @@ -3641,9 +3641,9 @@ static bool mob_parse_dbrow(char** str) int class_, i, k; double exp, maxhp; struct mob_data data; - + class_ = atoi(str[0]); - + if (class_ <= 1000 || class_ > MAX_MOB_DB) { ShowError("mob_parse_dbrow: Invalid monster ID %d, must be in range %d-%d.\n", class_, 1000, MAX_MOB_DB); return false; @@ -3652,17 +3652,17 @@ static bool mob_parse_dbrow(char** str) ShowError("mob_parse_dbrow: Invalid monster ID %d, reserved for player classes.\n", class_); return false; } - + if (class_ >= MOB_CLONE_START && class_ < MOB_CLONE_END) { ShowError("mob_parse_dbrow: Invalid monster ID %d. Range %d-%d is reserved for player clones. Please increase MAX_MOB_DB (%d).\n", class_, MOB_CLONE_START, MOB_CLONE_END-1, MAX_MOB_DB); return false; } memset(&entry, 0, sizeof(entry)); - + db = &entry; status = &db->status; - + db->vd.class_ = class_; safestrncpy(db->sprite, str[1], sizeof(db->sprite)); safestrncpy(db->jname, str[2], sizeof(db->jname)); @@ -3671,13 +3671,13 @@ static bool mob_parse_dbrow(char** str) db->lv = cap_value(db->lv, 1, USHRT_MAX); status->max_hp = atoi(str[5]); status->max_sp = atoi(str[6]); - + exp = (double)atoi(str[7]) * (double)battle_config.base_exp_rate / 100.; db->base_exp = (unsigned int)cap_value(exp, 0, UINT_MAX); - + exp = (double)atoi(str[8]) * (double)battle_config.job_exp_rate / 100.; db->job_exp = (unsigned int)cap_value(exp, 0, UINT_MAX); - + status->rhw.range = atoi(str[9]); status->rhw.atk = atoi(str[10]); status->rhw.atk2 = atoi(str[11]); @@ -3696,7 +3696,7 @@ static bool mob_parse_dbrow(char** str) if (status->int_< 1) status->int_= 1; if (status->dex < 1) status->dex = 1; if (status->luk < 1) status->luk = 1; - + db->range2 = atoi(str[20]); db->range3 = atoi(str[21]); if (battle_config.view_range_rate != 100) { @@ -3709,10 +3709,10 @@ static bool mob_parse_dbrow(char** str) if (db->range3 < db->range2) db->range3 = db->range2; } - + status->size = atoi(str[22]); status->race = atoi(str[23]); - + i = atoi(str[24]); //Element status->def_ele = i%10; status->ele_lv = i/20; @@ -3724,11 +3724,11 @@ static bool mob_parse_dbrow(char** str) ShowError("mob_parse_dbrow: Invalid element level %d for monster ID %d, must be in range 1-4.\n", status->ele_lv, class_); return false; } - + status->mode = (int)strtol(str[25], NULL, 0); if (!battle_config.monster_active_enable) status->mode &= ~MD_AGGRESSIVE; - + status->speed = atoi(str[26]); status->aspd_rate = 1000; i = atoi(str[27]); @@ -3748,28 +3748,28 @@ static bool mob_parse_dbrow(char** str) data.level = db->lv; memcpy(&data.status, status, sizeof(struct status_data)); status_calc_misc(&data.bl, status, db->lv); - + // MVP EXP Bonus: MEXP // Some new MVP's MEXP multipled by high exp-rate cause overflow. [LuzZza] exp = (double)atoi(str[30]) * (double)battle_config.mvp_exp_rate / 100.; db->mexp = (unsigned int)cap_value(exp, 0, UINT_MAX); - + //Now that we know if it is an mvp or not, apply battle_config modifiers [Skotlex] maxhp = (double)status->max_hp; if (db->mexp > 0) { //Mvp - if (battle_config.mvp_hp_rate != 100) + if (battle_config.mvp_hp_rate != 100) maxhp = maxhp * (double)battle_config.mvp_hp_rate / 100.; } else //Normal mob - if (battle_config.monster_hp_rate != 100) + if (battle_config.monster_hp_rate != 100) maxhp = maxhp * (double)battle_config.monster_hp_rate / 100.; - + status->max_hp = (unsigned int)cap_value(maxhp, 1, UINT_MAX); if(status->max_sp < 1) status->max_sp = 1; - + //Since mobs always respawn with full life... status->hp = status->max_hp; status->sp = status->max_sp; - + // MVP Drops: MVP1id,MVP1per,MVP2id,MVP2per,MVP3id,MVP3per for(i = 0; i < MAX_MVP_DROP; i++) { struct item_data *id; @@ -3781,7 +3781,7 @@ static bool mob_parse_dbrow(char** str) } item_dropratio_adjust(db->mvpitem[i].nameid, class_, &rate_adjust); db->mvpitem[i].p = mob_drop_adjust(atoi(str[32+i*2]), rate_adjust, battle_config.item_drop_mvp_min, battle_config.item_drop_mvp_max); - + //calculate and store Max available drop chance of the MVP item if (db->mvpitem[i].p) { id = itemdb_search(db->mvpitem[i].nameid); @@ -3791,7 +3791,7 @@ static bool mob_parse_dbrow(char** str) } } } - + for(i = 0; i < MAX_MOB_DROP; i++) { int rate = 0, rate_adjust, type; unsigned short ratemin, ratemax; @@ -3844,7 +3844,7 @@ static bool mob_parse_dbrow(char** str) } item_dropratio_adjust(id->nameid, class_, &rate_adjust); db->dropitem[i].p = mob_drop_adjust(rate, rate_adjust, ratemin, ratemax); - + //calculate and store Max available drop chance of the item if( db->dropitem[i].p && (class_ < 1324 || class_ > 1363) && (class_ < 1938 || class_ > 1946) ) { //Skip treasure chests. @@ -3857,7 +3857,7 @@ static bool mob_parse_dbrow(char** str) } if (k == MAX_SEARCH) continue; - + if (id->mob[k].id != class_) memmove(&id->mob[k+1], &id->mob[k], (MAX_SEARCH-k-1)*sizeof(id->mob[0])); id->mob[k].chance = db->dropitem[i].p; @@ -3890,7 +3890,7 @@ static void mob_readdb(void) DBPATH"mob_db.txt", "mob_db2.txt" }; int fi; - + for( fi = 0; fi < ARRAYLENGTH(filename); ++fi ) { char path[256]; @@ -3915,16 +3915,16 @@ static int mob_read_sqldb(void) { const char* mob_db_name[] = { mob_db_db, mob_db2_db }; int fi; - + for( fi = 0; fi < ARRAYLENGTH(mob_db_name); ++fi ) { uint32 lines = 0, count = 0; - + // retrieve all rows from the mob database if( SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", mob_db_name[fi]) ) { Sql_ShowDebug(mmysql_handle); continue; } - + // process rows one by one while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ) { // wrap the result into a TXT-compatible format @@ -3932,28 +3932,28 @@ static int mob_read_sqldb(void) char* str[31+2*MAX_MVP_DROP+2*MAX_MOB_DROP]; char* p; int i; - + lines++; for(i = 0, p = line; i < 31+2*MAX_MVP_DROP+2*MAX_MOB_DROP; i++) { char* data; size_t len; Sql_GetData(mmysql_handle, i, &data, &len); - + strcpy(p, data); str[i] = p; p+= len + 1; } - + if (!mob_parse_dbrow(str)) continue; - + count++; } - + // free the query result Sql_FreeResult(mmysql_handle); - + ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, mob_db_name[fi]); } return 0; @@ -4135,14 +4135,14 @@ static void mob_readchatdb(void) char line[1024], path[256]; int i, tmp=0; FILE *fp; - sprintf(path, "%s/%s", db_path, arc); + sprintf(path, "%s/%s", db_path, arc); fp=fopen(path, "r"); if(fp == NULL) { ShowWarning("mob_readchatdb: File not found \"%s\", skipping.\n", path); return; } - + while(fgets(line, sizeof(line), fp)) { char *str[3], *p, *np; @@ -4379,17 +4379,17 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current) //Cond2 // numeric value ms->cond2 = atoi(str[11]); - // or special constant + // or special constant ARR_FIND( 0, ARRAYLENGTH(cond2), j, strcmp(str[11],cond2[j].str) == 0 ); if( j < ARRAYLENGTH(cond2) ) ms->cond2 = cond2[j].id; - + ms->val[0]=(int)strtol(str[12],NULL,0); ms->val[1]=(int)strtol(str[13],NULL,0); ms->val[2]=(int)strtol(str[14],NULL,0); ms->val[3]=(int)strtol(str[15],NULL,0); ms->val[4]=(int)strtol(str[16],NULL,0); - + if(ms->skill_id == NPC_EMOTION && mob_id>0 && ms->val[1] == mob_db(mob_id)->status.mode) { @@ -4399,7 +4399,7 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current) if(ms->skill_id == NPC_EMOTION_ON && mob_id>0 && ms->val[1]) { //Adds a mode to the mob. //Remove aggressive mode when the new mob type is passive. - if (!(ms->val[1]&MD_AGGRESSIVE)) + if (!(ms->val[1]&MD_AGGRESSIVE)) ms->val[3]|=MD_AGGRESSIVE; ms->val[2]|= ms->val[1]; //Add the new mode. ms->val[1] = 0; //Do not "set" it. @@ -4409,7 +4409,7 @@ static bool mob_parse_row_mobskilldb(char** str, int columns, int current) ms->emotion=atoi(str[17]); else ms->emotion=-1; - + if(str[18]!=NULL && mob_chat_db[atoi(str[18])]!=NULL) ms->msg_id=atoi(str[18]); else @@ -4484,7 +4484,7 @@ static int mob_read_sqlskilldb(void) { const char* mob_skill_db_name[] = { mob_skill_db_db, mob_skill_db2_db }; int fi; - + if( battle_config.mob_skill_rate == 0 ) { ShowStatus("Mob skill use disabled. Not reading mob skills.\n"); return 0; @@ -4493,13 +4493,13 @@ static int mob_read_sqlskilldb(void) for( fi = 0; fi < ARRAYLENGTH(mob_skill_db_name); ++fi ) { uint32 lines = 0, count = 0; - + // retrieve all rows from the mob skill database if( SQL_ERROR == Sql_Query(mmysql_handle, "SELECT * FROM `%s`", mob_skill_db_name[fi]) ) { Sql_ShowDebug(mmysql_handle); continue; } - + // process rows one by one while( SQL_SUCCESS == Sql_NextRow(mmysql_handle) ) { // wrap the result into a TXT-compatible format @@ -4512,16 +4512,16 @@ static int mob_read_sqlskilldb(void) Sql_GetData(mmysql_handle, i, &str[i], NULL); if( str[i] == NULL ) str[i] = dummy; // get rid of NULL columns } - + if (!mob_parse_row_mobskilldb(str, 19, count)) continue; - + count++; } - + // free the query result Sql_FreeResult(mmysql_handle); - + ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, mob_skill_db_name[fi]); } return 0; diff --git a/src/map/mob.h b/src/map/mob.h index c33d82501..797d2484b 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -92,7 +92,7 @@ struct spawn_info { unsigned short mapindex; unsigned short qty; }; - + struct mob_db { char sprite[NAME_LENGTH],name[NAME_LENGTH],jname[NAME_LENGTH]; unsigned int base_exp,job_exp; @@ -143,7 +143,7 @@ struct mob_data { unsigned char attacked_count; //For rude attacked. int provoke_flag; // Celest } state; - struct guardian_data* guardian_data; + struct guardian_data* guardian_data; struct { int id; unsigned int dmg; @@ -163,7 +163,7 @@ struct mob_data { short move_fail_count; short lootitem_count; short min_chase; - + int deletetimer; int master_id,master_dist; @@ -268,7 +268,9 @@ void mob_heal(struct mob_data *md,unsigned int heal); #define mob_stop_walking(md, type) unit_stop_walking(&(md)->bl, type) #define mob_stop_attack(md) unit_stop_attack(&(md)->bl) -#define mob_is_battleground(md) ( map[(md)->bl.m].flag.battleground && ((md)->class_ == 1906 || ((md)->class_ >= 1909 && (md)->class_ <= 1915)) ) +#define mob_is_battleground(md) ( map[(md)->bl.m].flag.battleground && ((md)->class_ == MOBID_BARRICADE2 || ((md)->class_ >= MOBID_FOOD_STOR && (md)->class_ <= MOBID_PINK_CRYST)) ) +#define mob_is_gvg(md) (map[(md)->bl.m].flag.gvg_castle && ( (md)->class_ == MOBID_EMPERIUM || (md)->class_ == MOBID_BARRICADE1 || (md)->class_ == MOBID_GUARIDAN_STONE1 || (md)->class_ == MOBID_GUARIDAN_STONE2) ) +#define mob_is_treasure(md) (((md)->class_ >= MOBID_TREAS01 && (md)->class_ <= MOBID_TREAS40) || ((md)->class_ >= MOBID_TREAS41 && (md)->class_ <= MOBID_TREAS49)) void mob_clear_spawninfo(); int do_init_mob(void); diff --git a/src/map/pc.c b/src/map/pc.c index 30af7202f..0a48d2b03 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -123,7 +123,7 @@ static int pc_invincible_timer(int tid, unsigned int tick, int id, intptr_t data return 0; } -void pc_setinvincibletimer(struct map_session_data* sd, int val) +void pc_setinvincibletimer(struct map_session_data* sd, int val) { nullpo_retv(sd); @@ -315,7 +315,7 @@ int pc_banding(struct map_session_data *sd, short skill_lv) { // Set average HP. hp = hp / i; - + // If a Royal Guard have full HP, give more HP to others that haven't full HP. for( j = 0; j < i; j++ ) { @@ -372,7 +372,7 @@ void pc_addfame(struct map_session_data *sd,int count) unsigned char pc_famerank(int char_id, int job) { int i; - + switch(job){ case MAPID_BLACKSMITH: // Blacksmith for(i = 0; i < MAX_FAME_LIST; i++){ @@ -517,7 +517,7 @@ int pc_makesavestatus(struct map_session_data *sd) if(!battle_config.save_clothcolor) sd->status.clothes_color=0; - //Only copy the Cart/Peco/Falcon options, the rest are handled via + //Only copy the Cart/Peco/Falcon options, the rest are handled via //status change load/saving. [Skotlex] #ifdef NEW_CARTS sd->status.option = sd->sc.option&(OPTION_FALCON|OPTION_RIDING|OPTION_DRAGON|OPTION_WUG|OPTION_WUGRIDER|OPTION_MADOGEAR|OPTION_MOUNTING); @@ -593,12 +593,12 @@ int pc_equippoint(struct map_session_data *sd,int n) if (!itemdb_isequip2(sd->inventory_data[n])) return 0; //Not equippable by players. - + ep = sd->inventory_data[n]->equip; if(sd->inventory_data[n]->look == W_DAGGER || sd->inventory_data[n]->look == W_1HSWORD || sd->inventory_data[n]->look == W_1HAXE) { - if(ep == EQP_HAND_R && (pc_checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN || + if(ep == EQP_HAND_R && (pc_checkskill(sd,AS_LEFT) > 0 || (sd->class_&MAPID_UPPERMASK) == MAPID_ASSASSIN || (sd->class_&MAPID_UPPERMASK) == MAPID_KAGEROUOBORO))//Kagerou and Oboro can dual wield daggers. [Rytech] return EQP_ARMS; } @@ -706,7 +706,7 @@ static int pc_isAllowedCardOn(struct map_session_data *sd,int s,int eqindex,int int i; struct item *item = &sd->status.inventory[eqindex]; struct item_data *data; - + //Crafted/made/hatched items. if (itemdb_isspecial(item->card[0])) return 1; @@ -714,7 +714,7 @@ static int pc_isAllowedCardOn(struct map_session_data *sd,int s,int eqindex,int /* scan for enchant armor gems */ if( item->card[MAX_SLOTS - 1] && s < MAX_SLOTS - 1 ) s = MAX_SLOTS - 1; - + ARR_FIND( 0, s, i, item->card[i] && (data = itemdb_exists(item->card[i])) != NULL && data->flag.no_equip&flag ); return( i < s ) ? 0 : 1; } @@ -731,7 +731,7 @@ bool pc_isequipped(struct map_session_data *sd, int nameid) if( i == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index ) continue; if( i == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index ) continue; if( i == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index) ) continue; - + if( !sd->inventory_data[index] ) continue; if( sd->inventory_data[index]->nameid == nameid ) @@ -764,7 +764,7 @@ bool pc_can_Adopt(struct map_session_data *p1_sd, struct map_session_data *p2_sd // Parents need to have their ring equipped if( !pc_isequipped(p1_sd, WEDDING_RING_M) && !pc_isequipped(p1_sd, WEDDING_RING_F) ) - return false; + return false; if( !pc_isequipped(p2_sd, WEDDING_RING_M) && !pc_isequipped(p2_sd, WEDDING_RING_F) ) return false; @@ -799,7 +799,7 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, { int job, joblevel; unsigned int jobexp; - + if( !pc_can_Adopt(p1_sd, p2_sd, b_sd) ) return false; @@ -828,7 +828,7 @@ bool pc_adoption(struct map_session_data *p1_sd, struct map_session_data *p2_sd, // Parents Skills pc_skill(p1_sd, WE_CALLBABY, 1, 0); pc_skill(p2_sd, WE_CALLBABY, 1, 0); - + return true; } @@ -876,7 +876,7 @@ int pc_isequip(struct map_session_data *sd,int n) } if (sd->sc.count) { - + if(item->equip & EQP_ARMS && item->type == IT_WEAPON && sd->sc.data[SC_STRIPWEAPON]) // Also works with left-hand weapons [DracoRPG] return 0; if(item->equip & EQP_SHIELD && item->type == IT_ARMOR && sd->sc.data[SC_STRIPSHIELD]) @@ -933,10 +933,10 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim sd->login_id2 = login_id2; sd->group_id = group_id; - + /* load user permissions */ pc_group_pc_load(sd); - + memcpy(&sd->status, st, sizeof(*st)); if (st->sex != sd->status.sex) { @@ -951,7 +951,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim sd->status.class_ = JOB_NOVICE; sd->class_ = MAPID_NOVICE; } else - sd->class_ = i; + sd->class_ = i; // Checks and fixes to character status data, that are required // in case of configuration change or stuff, which cannot be @@ -1011,15 +1011,15 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim sd->state.showexp = 1; if (battle_config.disp_zeny) sd->state.showzeny = 1; - + if (!(battle_config.display_skill_fail&2)) sd->state.showdelay = 1; - + pc_setinventorydata(sd); pc_setequipindex(sd); status_change_init(&sd->bl); - + if (pc_can_use_command(sd, "hide", COMMAND_ATCOMMAND)) sd->status.option &= (OPTION_MASK | OPTION_INVISIBLE); else @@ -1065,7 +1065,7 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim " Packet Ver: '"CL_WHITE"%d"CL_RESET"', IP: '"CL_WHITE"%d.%d.%d.%d"CL_RESET"'," " Group '"CL_WHITE"%d"CL_RESET"').\n", sd->status.name, sd->status.account_id, sd->status.char_id, - sd->packet_ver, CONVIP(ip), sd->group_id); + sd->packet_ver, CONVIP(ip), sd->group_id); // Send friends list clif_friendslist_send(sd); @@ -1122,7 +1122,7 @@ void pc_authfail(struct map_session_data *sd) return; } -//Attempts to set a mob. +//Attempts to set a mob. int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) { int class_; @@ -1154,7 +1154,7 @@ int pc_set_hate_mob(struct map_session_data *sd, int pos, struct block_list *bl) int pc_reg_received(struct map_session_data *sd) { int i,j; - + sd->change_level_2nd = pc_readglobalreg(sd,"jobchange_level"); sd->change_level_3rd = pc_readglobalreg(sd,"jobchange_level_3rd"); sd->die_counter = pc_readglobalreg(sd,"PC_DIE_COUNTER"); @@ -1214,7 +1214,7 @@ int pc_reg_received(struct map_session_data *sd) party_member_joined(sd); if (sd->status.guild_id) guild_member_joined(sd); - + // pet if (sd->status.pet_id > 0) intif_request_petdata(sd->status.account_id, sd->status.char_id, sd->status.pet_id); @@ -1226,12 +1226,12 @@ int pc_reg_received(struct map_session_data *sd) intif_mercenary_request(sd->status.mer_id, sd->status.char_id); if( sd->status.ele_id > 0 ) intif_elemental_request(sd->status.ele_id, sd->status.char_id); - + map_addiddb(&sd->bl); map_delnickdb(sd->status.char_id, sd->status.name); if (!chrif_auth_finished(sd)) ShowError("pc_reg_received: Failed to properly remove player %d:%d from logging db!\n", sd->status.account_id, sd->status.char_id); - + pc_load_combo(sd); status_calc_pc(sd,1); @@ -1295,13 +1295,13 @@ int pc_calc_skilltree(struct map_session_data *sd) c = pc_class2idx(c); for( i = 0; i < MAX_SKILL; i++ ) - { + { if( sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) //Don't touch plagiarized skills sd->status.skill[i].id = 0; //First clear skills. } for( i = 0; i < MAX_SKILL; i++ ) - { + { if( sd->status.skill[i].flag != SKILL_FLAG_PERMANENT && sd->status.skill[i].flag != SKILL_FLAG_PLAGIARIZED ) { // Restore original level of skills after deleting earned skills. sd->status.skill[i].lv = (sd->status.skill[i].flag == SKILL_FLAG_TEMPORARY) ? 0 : sd->status.skill[i].flag - SKILL_FLAG_REPLACED_LV_0; @@ -1405,7 +1405,7 @@ int pc_calc_skilltree(struct map_session_data *sd) (inf2&INF2_SPIRIT_SKILL && !sd->sc.data[SC_SPIRIT]) )) continue; //Cannot be learned via normal means. Note this check DOES allows raising already known skills. - + /* This thing is present in all skill trees (for whatever reason) and it crashes if gm w/o PC_PERM_ALL_SKILL uses @allskills */ if( id == ALL_BUYING_STORE ) continue; @@ -1421,7 +1421,7 @@ int pc_calc_skilltree(struct map_session_data *sd) } } while(flag); - // + // if( c > 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && sd->status.skill_point == 0 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) ) { /* Taekwon Ranger Bonus Skill Tree @@ -1460,7 +1460,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill) if(battle_config.skillfree) return; //Function serves no purpose if this is set - + i = pc_calc_skilltree_normalize_job(sd); c = pc_mapid2jobid(i, sd->status.sex); if (c == -1) { //Unable to normalize job?? @@ -1476,7 +1476,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill) if( sd->status.skill[id].id ) //Already learned continue; - + for( j = 0; j < MAX_PC_SKILL_REQUIRE; j++ ) { if( (k = skill_tree[c][i].need[j].id) ) @@ -1499,7 +1499,7 @@ static void pc_check_skilltree(struct map_session_data *sd, int skill) continue; if( sd->status.job_level < skill_tree[c][i].joblv ) continue; - + j = skill_get_inf2(id); if( !sd->status.skill[id].lv && ( (j&INF2_QUEST_SKILL && !battle_config.quest_skill_learn) || @@ -1540,10 +1540,10 @@ int pc_calc_skilltree_normalize_job(struct map_session_data *sd) { int skill_point, novice_skills; int c = sd->class_; - + if (!battle_config.skillup_limit || pc_has_permission(sd, PC_PERM_ALL_SKILL)) return c; - + skill_point = pc_calc_skillpoint(sd); novice_skills = max_level[pc_class2idx(JOB_NOVICE)][1] - 1; @@ -1728,8 +1728,8 @@ static int pc_bonus_autospell_onskill(struct s_autospell *spell, int max, short if( !rate ) return 0; - for( i = 0; i < max && spell[i].id; i++ ) - { + for( i = 0; i < max && spell[i].id; i++ ) + { ; // each autospell works independently } @@ -1818,7 +1818,7 @@ static int pc_bonus_item_drop(struct s_add_drop *drop, const short max, short id for(i = 0; i < max && (drop[i].id || drop[i].group); i++) { if( ((id && drop[i].id == id) || - (group && drop[i].group == group)) + (group && drop[i].group == group)) && race > 0 ) { drop[i].race |= race; @@ -1991,7 +1991,7 @@ int pc_bonus_addele(struct map_session_data* sd, unsigned char ele, short rate, int pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate, short flag) { int i; - + ARR_FIND(0, MAX_PC_BONUS, i, sd->subele2[i].rate == 0); if (i == MAX_PC_BONUS) @@ -2170,12 +2170,12 @@ int pc_bonus(struct map_session_data *sd,int type,int val) if(sd->state.lr_flag == 2) break; val += (int)status->max_hp; - //Negative bonuses will underflow, this will be handled in status_calc_pc through casting + //Negative bonuses will underflow, this will be handled in status_calc_pc through casting //If this is called outside of status_calc_pc, you'd better pray they do not underflow and end with UINT_MAX max_hp. status->max_hp = (unsigned int)val; break; case SP_MAXSP: - if(sd->state.lr_flag == 2) + if(sd->state.lr_flag == 2) break; val += (int)status->max_sp; status->max_sp = (unsigned int)val; @@ -3091,13 +3091,13 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) sd->skillusesprate[i].id = type2; sd->skillusesprate[i].val = val; } - break; + break; case SP_SKILL_COOLDOWN: if(sd->state.lr_flag == 2) break; ARR_FIND(0, ARRAYLENGTH(sd->skillcooldown), i, sd->skillcooldown[i].id == 0 || sd->skillcooldown[i].id == type2); if (i == ARRAYLENGTH(sd->skillcooldown)) - { + { ShowDebug("run_script: bonus2 bSkillCoolDown reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillcooldown), type2, val); break; } @@ -3113,7 +3113,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; ARR_FIND(0, ARRAYLENGTH(sd->skillfixcast), i, sd->skillfixcast[i].id == 0 || sd->skillfixcast[i].id == type2); if (i == ARRAYLENGTH(sd->skillfixcast)) - { + { ShowDebug("run_script: bonus2 bSkillFixedCast reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillfixcast), type2, val); break; } @@ -3129,7 +3129,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; ARR_FIND(0, ARRAYLENGTH(sd->skillvarcast), i, sd->skillvarcast[i].id == 0 || sd->skillvarcast[i].id == type2); if (i == ARRAYLENGTH(sd->skillvarcast)) - { + { ShowDebug("run_script: bonus2 bSkillVariableCast reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillvarcast), type2, val); break; } @@ -3145,7 +3145,7 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val) break; ARR_FIND(0, ARRAYLENGTH(sd->skillcast), i, sd->skillcast[i].id == 0 || sd->skillcast[i].id == type2); if (i == ARRAYLENGTH(sd->skillcast)) - { + { ShowDebug("run_script: bonus2 bVariableCastrate reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n",ARRAYLENGTH(sd->skillcast), type2, val); break; } @@ -3279,7 +3279,7 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val) if( sd->state.lr_flag != 2 ) pc_bonus_addeff_onskill(sd->addeff3, ARRAYLENGTH(sd->addeff3), (sc_type)type3, val, type2, ATF_TARGET); break; - + case SP_ADDELE: if (type2 > ELE_MAX) { ShowWarning("pc_bonus3 (SP_ADDELE): element %d is out of range.\n", type2); @@ -3768,7 +3768,7 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l return 1; if( amount > MAX_AMOUNT ) return 5; - + data = itemdb_search(item_data->nameid); if( data->stack.inventory && amount > data->stack.amount ) @@ -3813,13 +3813,13 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l clif_additem(sd,i,amount,0); } log_pick_pc(sd, log_type, amount, &sd->status.inventory[i]); - + sd->weight += w; clif_updatestatus(sd,SP_WEIGHT); //Auto-equip if(data->flag.autoequip) pc_equipitem(sd, i, data->equip); - + /* rental item check */ if( item_data->expire_time ) { if( time(NULL) > item_data->expire_time ) { @@ -3895,16 +3895,16 @@ int pc_dropitem(struct map_session_data *sd,int n,int amount) clif_displaymessage (sd->fd, msg_txt(271)); return 0; //Can't drop items in nodrop mapflag maps. } - + if( !pc_candrop(sd,&sd->status.inventory[n]) ) { clif_displaymessage (sd->fd, msg_txt(263)); return 0; } - + if (!map_addflooritem(&sd->status.inventory[n], amount, sd->bl.m, sd->bl.x, sd->bl.y, 0, 0, 0, 2)) return 0; - + pc_delitem(sd, n, amount, 1, 0, LOG_TYPE_PICKDROP_PLAYER); clif_dropitem(sd, n, amount); return 1; @@ -3931,7 +3931,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) if (sd->status.party_id) p = party_search(sd->status.party_id); - + if(fitem->first_get_charid > 0 && fitem->first_get_charid != sd->status.char_id) { first_sd = map_charid2sd(fitem->first_get_charid); @@ -4073,7 +4073,7 @@ int pc_isUseitem(struct map_session_data *sd,int n) case 12243: // Mercenary's Berserk Potion if( sd->md == NULL || sd->md->db == NULL ) return 0; - if( sd->md->sc.data[SC_BERSERK] ) + if (sd->md->sc.data[SC_BERSERK] || sd->md->sc.data[SC_SATURDAYNIGHTFEVER] || sd->md->sc.data[SC__BLOODYLUST]) return 0; if( nameid == 12242 && sd->md->db->lv < 40 ) return 0; @@ -4117,7 +4117,7 @@ int pc_isUseitem(struct map_session_data *sd,int n) //Required level check if(item->elv && sd->status.base_level < (unsigned int)item->elv) return 0; - + #ifdef RENEWAL if(item->elvmax && sd->status.base_level > (unsigned int)item->elvmax) return 0; @@ -4173,7 +4173,7 @@ int pc_useitem(struct map_session_data *sd,int n) return 0; if( sd->sc.count && ( - sd->sc.data[SC_BERSERK] || + sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || (sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) || sd->sc.data[SC_TRICKDEAD] || sd->sc.data[SC_HIDING] || @@ -4334,7 +4334,7 @@ int pc_cart_additem(struct map_session_data *sd,struct item *item_data,int amoun } sd->status.cart[i].favorite = 0;/* clear */ log_pick_pc(sd, log_type, amount, &sd->status.cart[i]); - + sd->cart_weight += w; clif_updatestatus(sd,SP_CARTINFO); @@ -4385,12 +4385,12 @@ int pc_putitemtocart(struct map_session_data *sd,int idx,int amount) if (idx < 0 || idx >= MAX_INVENTORY) //Invalid index check [Skotlex] return 1; - + item_data = &sd->status.inventory[idx]; if( item_data->nameid == 0 || amount < 1 || item_data->amount < amount || sd->state.vending ) return 1; - + if( pc_cart_additem(sd,item_data,amount,LOG_TYPE_NONE) == 0 ) return pc_delitem(sd,idx,amount,0,5,LOG_TYPE_NONE); @@ -4431,7 +4431,7 @@ int pc_getitemfromcart(struct map_session_data *sd,int idx,int amount) if (idx < 0 || idx >= MAX_CART) //Invalid index check [Skotlex] return 1; - + item_data=&sd->status.cart[idx]; if(item_data->nameid==0 || amount < 1 || item_data->amount<amount || sd->state.vending ) @@ -4486,13 +4486,11 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv) if(md->state.steal_flag == UCHAR_MAX || ( md->sc.opt1 && md->sc.opt1 != OPT1_BURNING && md->sc.opt1 != OPT1_CRYSTALIZE ) ) //already stolen from / status change check return 0; - + sd_status= status_get_status_data(&sd->bl); md_status= status_get_status_data(bl); - if( md->master_id || md_status->mode&MD_BOSS || - (md->class_ >= 1324 && md->class_ < 1364) || // Treasure Boxes WoE - (md->class_ >= 1938 && md->class_ < 1946) || // Treasure Boxes WoE SE + if( md->master_id || md_status->mode&MD_BOSS || mob_is_treasure(md) || map[bl->m].flag.nomobloot || // check noloot map flag [Lorky] (battle_config.skill_steal_max_tries && //Reached limit of steal attempts. [Lupus] md->state.steal_flag++ >= battle_config.skill_steal_max_tries) @@ -4504,7 +4502,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv) // base skill success chance (percentual) rate = (sd_status->dex - md_status->dex)/2 + lv*6 + 4; rate += sd->bonus.add_steal_rate; - + if( rate < 1 ) return 0; @@ -4530,13 +4528,13 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, int lv) clif_additem(sd,0,0,flag); return 0; } - + if(battle_config.show_steal_in_same_party) party_foreachsamemap(pc_show_steal,sd,AREA_SIZE,sd,tmp_item.nameid); //Logs items, Stolen from mobs [Lupus] log_pick_mob(md, LOG_TYPE_STEAL, -1, &tmp_item); - + //A Rare Steal Global Announce by Lupus if(md->db->dropitem[i].p<=battle_config.rare_drop_announce) { struct item_data *i_data; @@ -4566,7 +4564,7 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target) if( md->state.steal_coin_flag || md->sc.data[SC_STONE] || md->sc.data[SC_FREEZE] || md->status.mode&MD_BOSS ) return 0; - if( (md->class_ >= 1324 && md->class_ < 1364) || (md->class_ >= 1938 && md->class_ < 1946) ) + if( mob_is_treasure(md) ) return 0; // FIXME: This formula is either custom or outdated. @@ -4706,7 +4704,7 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y } else if(sd->state.active) //Tag player for rewarping after map-loading is done. [Skotlex] sd->state.rewarp = 1; - + sd->mapindex = mapindex; sd->bl.m = m; sd->bl.x = sd->ud.to_x = x; @@ -4894,7 +4892,7 @@ int pc_checkallowskill(struct map_session_data *sd) if(!sd->sc.count) return 0; - + for (i = 0; i < ARRAYLENGTH(scw_list); i++) { // Skills requiring specific weapon types if( scw_list[i] == SC_DANCING && !battle_config.dancing_weaponswitch_fix ) @@ -4903,11 +4901,11 @@ int pc_checkallowskill(struct map_session_data *sd) !pc_check_weapontype(sd,skill_get_weapontype(status_sc2skill(scw_list[i])))) status_change_end(&sd->bl, scw_list[i], INVALID_TIMER); } - + if(sd->sc.data[SC_SPURT] && sd->status.weapon) // Spurt requires bare hands (feet, in fact xD) status_change_end(&sd->bl, SC_SPURT, INVALID_TIMER); - + if(sd->status.shield <= 0) { // Skills requiring a shield for (i = 0; i < ARRAYLENGTH(scs_list); i++) if(sd->sc.data[scs_list[i]]) @@ -5226,7 +5224,7 @@ const char* job_name(int class_) case JOB_MERCHANT: case JOB_THIEF: return msg_txt(550 - JOB_NOVICE+class_); - + case JOB_KNIGHT: case JOB_PRIEST: case JOB_WIZARD: @@ -5234,10 +5232,10 @@ const char* job_name(int class_) case JOB_HUNTER: case JOB_ASSASSIN: return msg_txt(557 - JOB_KNIGHT+class_); - + case JOB_KNIGHT2: return msg_txt(557); - + case JOB_CRUSADER: case JOB_MONK: case JOB_SAGE: @@ -5246,10 +5244,10 @@ const char* job_name(int class_) case JOB_BARD: case JOB_DANCER: return msg_txt(563 - JOB_CRUSADER+class_); - + case JOB_CRUSADER2: return msg_txt(563); - + case JOB_WEDDING: case JOB_SUPER_NOVICE: case JOB_GUNSLINGER: @@ -5276,10 +5274,10 @@ const char* job_name(int class_) case JOB_SNIPER: case JOB_ASSASSIN_CROSS: return msg_txt(582 - JOB_LORD_KNIGHT+class_); - + case JOB_LORD_KNIGHT2: return msg_txt(582); - + case JOB_PALADIN: case JOB_CHAMPION: case JOB_PROFESSOR: @@ -5288,7 +5286,7 @@ const char* job_name(int class_) case JOB_CLOWN: case JOB_GYPSY: return msg_txt(588 - JOB_PALADIN + class_); - + case JOB_PALADIN2: return msg_txt(588); @@ -5300,7 +5298,7 @@ const char* job_name(int class_) case JOB_BABY_MERCHANT: case JOB_BABY_THIEF: return msg_txt(595 - JOB_BABY + class_); - + case JOB_BABY_KNIGHT: case JOB_BABY_PRIEST: case JOB_BABY_WIZARD: @@ -5308,10 +5306,10 @@ const char* job_name(int class_) case JOB_BABY_HUNTER: case JOB_BABY_ASSASSIN: return msg_txt(602 - JOB_BABY_KNIGHT + class_); - + case JOB_BABY_KNIGHT2: return msg_txt(602); - + case JOB_BABY_CRUSADER: case JOB_BABY_MONK: case JOB_BABY_SAGE: @@ -5320,13 +5318,13 @@ const char* job_name(int class_) case JOB_BABY_BARD: case JOB_BABY_DANCER: return msg_txt(608 - JOB_BABY_CRUSADER + class_); - + case JOB_BABY_CRUSADER2: return msg_txt(608); - + case JOB_SUPER_BABY: return msg_txt(615); - + case JOB_TAEKWON: return msg_txt(616); case JOB_STAR_GLADIATOR: @@ -5503,7 +5501,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) { if (!next || sd->status.base_exp < next) return 0; - + do { sd->status.base_exp -= next; //Kyoki pointed out that the max overcarry exp is the exp needed for the previous level -1. [Skotlex] @@ -5518,7 +5516,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) { if (battle_config.pet_lv_rate && sd->pd) //<Skotlex> update pet's level status_calc_pet(sd->pd,0); - + clif_updatestatus(sd,SP_STATUSPOINT); clif_updatestatus(sd,SP_BASELEVEL); clif_updatestatus(sd,SP_BASEEXP); @@ -5543,7 +5541,7 @@ int pc_checkbaselevelup(struct map_session_data *sd) { if(sd->status.party_id) party_send_levelup(sd); - + pc_baselevelchanged(sd); return 1; } @@ -5604,7 +5602,7 @@ static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsi bonus += sd->expaddrace[status->race]; bonus += sd->expaddrace[status->mode&MD_BOSS?RC_BOSS:RC_NONBOSS]; - if (battle_config.pk_mode && + if (battle_config.pk_mode && (int)(status_get_lv(src) - sd->status.base_level) >= 20) bonus += 15; // pk_mode additional exp if monster >20 levels [Valaris] @@ -5642,7 +5640,7 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int nextb = pc_nextbaseexp(sd); nextj = pc_nextjobexp(sd); - + if(sd->state.showexp || battle_config.max_exp_gain_rate){ if (nextb > 0) nextbp = (float) base_exp / (float) nextb; @@ -5664,7 +5662,7 @@ int pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned int } } } - + //Cap exp to the level up requirement of the previous level when you are at max level, otherwise cap at UINT_MAX (this is required for some S. Novice bonuses). [Skotlex] if (base_exp) { nextb = nextb?UINT_MAX:pc_thisbaseexp(sd); @@ -5835,7 +5833,7 @@ int pc_need_status_point(struct map_session_data* sd, int type, int val) #else sp += ( 1 + (low + 9) / 10 ); #endif - + return sp; } @@ -5909,7 +5907,7 @@ int pc_statusup2(struct map_session_data* sd, int type, int val) // set new value max = pc_maxparameter(sd); val = pc_setstat(sd, type, cap_value(pc_getstat(sd,type) + val, 1, max)); - + status_calc_pc(sd,0); // update increase cost indicator @@ -5954,7 +5952,7 @@ int pc_skillup(struct map_session_data *sd,int skill_num) { sd->status.skill[skill_num].lv++; sd->status.skill_point--; - if( !skill_get_inf(skill_num) ) + if( !skill_get_inf(skill_num) ) status_calc_pc(sd,0); // Only recalculate for passive skills. else if( sd->status.skill_point == 0 && (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) ) pc_calc_skilltree(sd); // Required to grant all TK Ranger skills. @@ -6021,7 +6019,7 @@ int pc_allskillup(struct map_session_data *sd) } } status_calc_pc(sd,0); - //Required because if you could level up all skills previously, + //Required because if you could level up all skills previously, //the update will not be sent as only the lv variable changes. clif_skillinfoblock(sd); return 0; @@ -6121,7 +6119,7 @@ int pc_resetlvl(struct map_session_data* sd,int type) int pc_resetstate(struct map_session_data* sd) { nullpo_ret(sd); - + if (battle_config.use_statpoint_table) { // New statpoint table used here - Dexity if (sd->status.base_level > MAX_LEVEL) @@ -6130,7 +6128,7 @@ int pc_resetstate(struct map_session_data* sd) sd->status.account_id, sd->status.char_id, sd->status.base_level, MAX_LEVEL); return 0; } - + sd->status.status_point = statp[sd->status.base_level] + ( sd->class_&JOBL_UPPER ? 52 : 0 ); // extra 52+48=100 stat points } else @@ -6166,7 +6164,7 @@ int pc_resetstate(struct map_session_data* sd) clif_updatestatus(sd,SP_UINT); clif_updatestatus(sd,SP_UDEX); clif_updatestatus(sd,SP_ULUK); // End Addition - + clif_updatestatus(sd,SP_STATUSPOINT); if( sd->mission_mobid ) { //bugreport:2200 @@ -6195,7 +6193,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) return 0; if( !(flag&2) ) { //Remove stuff lost when resetting skills. - + /** * It has been confirmed on official server that when you reset skills with a ranked tweakwon your skills are not reset (because you have all of them anyway) **/ @@ -6242,7 +6240,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) if( inf2&(INF2_WEDDING_SKILL|INF2_SPIRIT_SKILL) ) //Avoid reseting wedding/linker skills. continue; - + // Don't reset trick dead if not a novice/baby if( i == NV_TRICKDEAD && (sd->class_&MAPID_UPPERMASK) != MAPID_NOVICE ) { @@ -6279,7 +6277,7 @@ int pc_resetskill(struct map_session_data* sd, int flag) sd->status.skill[i].flag = 0; } } - + if( flag&2 || !skill_point ) return skill_point; sd->status.skill_point += skill_point; @@ -6349,7 +6347,7 @@ int pc_skillheal_bonus(struct map_session_data *sd, int skill_num) { } ARR_FIND(0, ARRAYLENGTH(sd->skillheal), i, sd->skillheal[i].id == skill_num); - + if( i < ARRAYLENGTH(sd->skillheal) ) bonus += sd->skillheal[i].val; @@ -6360,7 +6358,7 @@ int pc_skillheal2_bonus(struct map_session_data *sd, int skill_num) { int i, bonus = sd->bonus.add_heal2_rate; ARR_FIND(0, ARRAYLENGTH(sd->skillheal2), i, sd->skillheal2[i].id == skill_num); - + if( i < ARRAYLENGTH(sd->skillheal2) ) bonus += sd->skillheal2[i].val; @@ -6400,7 +6398,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h if (sp) clif_updatestatus(sd,SP_SP); if (hp) clif_updatestatus(sd,SP_HP); else return; - + if( !src || src == &sd->bl ) return; @@ -6418,7 +6416,7 @@ void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int h if( sd->status.ele_id > 0 ) elemental_set_target(sd,src); - + sd->canlog_tick = gettick(); } @@ -6429,7 +6427,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) { int i=0,j=0,k=0; unsigned int tick = gettick(); - + for(k = 0; k < 5; k++) if (sd->devotion[k]){ struct map_session_data *devsd = map_id2sd(sd->devotion[k]); @@ -6458,7 +6456,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) if( sd->ed ) elemental_delete(sd->ed, 0); - + // Leave duel if you die [LuzZza] if(battle_config.duel_autoleave_when_die) { if(sd->duel_group > 0) @@ -6469,13 +6467,13 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) pc_setglobalreg(sd,"PC_DIE_COUNTER",sd->die_counter+1); pc_setparam(sd, SP_KILLERRID, src?src->id:0); - + if( sd->bg_id ) { struct battleground_data *bg; if( (bg = bg_team_search(sd->bg_id)) != NULL && bg->die_event[0] ) npc_event(sd, bg->die_event, 0); } - + npc_script_event(sd,NPCE_DIE); /* e.g. not killed thru pc_damage */ @@ -6549,21 +6547,21 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) // note: karma is measured REVERSE, so more karma = more 'evil' / less honourable, // karma going down = more 'good' / more honourable. // The Karma System way... - + if (sd->status.karma > ssd->status.karma) { // If player killed was more evil sd->status.karma--; ssd->status.karma--; } else if (sd->status.karma < ssd->status.karma) // If player killed was more good ssd->status.karma++; - + // or the PK System way... - + if (sd->status.karma > 0) // player killed is dishonourable? ssd->status.karma--; // honour points earned sd->status.karma++; // honour points lost - + // To-do: Receive exp on certain occasions #endif } @@ -6748,7 +6746,7 @@ void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp) { pc_setstand(sd); if(battle_config.pc_invincible_time > 0) pc_setinvincibletimer(sd, battle_config.pc_invincible_time); - + if( sd->state.gmaster_flag ) { guild_guildaura_refresh(sd,GD_LEADERSHIP,guild_checkskill(sd->state.gmaster_flag,GD_LEADERSHIP)); guild_guildaura_refresh(sd,GD_GLORYWOUNDS,guild_checkskill(sd->state.gmaster_flag,GD_GLORYWOUNDS)); @@ -7026,7 +7024,7 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp) hp -= hp * 20 / 100; sp -= sp * 20 / 100; } - + if( sd->sc.data[SC_WATER_INSIGNIA] && sd->sc.data[SC_WATER_INSIGNIA]->val1 == 2 ) { hp += hp / 10; sp += sp / 10; @@ -7069,7 +7067,7 @@ int pc_percentheal(struct map_session_data *sd,int hp,int sp) else status_percent_damage(NULL, &sd->bl, hp, 0, hp==-100); } - + if(sp) { if(sp > 0) status_percent_heal(&sd->bl, 0, sp); @@ -7099,7 +7097,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) return 1; switch (upper) { case 1: - b_class|= JOBL_UPPER; + b_class|= JOBL_UPPER; break; case 2: b_class|= JOBL_BABY; @@ -7110,7 +7108,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) job = pc_mapid2jobid(b_class, sd->status.sex); if (job == -1) return 1; - + if ((unsigned short)b_class == sd->class_) return 1; //Nothing to change. @@ -7136,7 +7134,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) pc_setglobalreg(sd, "CLONE_SKILL", 0); pc_setglobalreg(sd, "CLONE_SKILL_LV", 0); } - + if(sd->reproduceskill_id) { if( sd->status.skill[sd->reproduceskill_id].flag == SKILL_FLAG_PLAGIARIZED ) { sd->status.skill[sd->reproduceskill_id].id = 0; @@ -7148,7 +7146,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) pc_setglobalreg(sd, "REPRODUCE_SKILL",0); pc_setglobalreg(sd, "REPRODUCE_SKILL_LV",0); } - + if ( (b_class&MAPID_UPPERMASK) != (sd->class_&MAPID_UPPERMASK) ) { //Things to remove when changing class tree. const int class_ = pc_class2idx(sd->status.class_); short id; @@ -7159,7 +7157,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) status_change_end(&sd->bl, sc, INVALID_TIMER); } } - + sd->status.class_ = job; fame_flag = pc_famerank(sd->status.char_id,sd->class_&MAPID_UPPERMASK); sd->class_ = (unsigned short)b_class; @@ -7175,7 +7173,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) pc_unequipitem(sd,sd->equip_index[i],2); // unequip invalid item for class } - //Change look, if disguised, you need to undisguise + //Change look, if disguised, you need to undisguise //to correctly calculate new job sprite without if (sd->disguise) pc_disguise(sd, 0); @@ -7215,7 +7213,7 @@ int pc_jobchange(struct map_session_data *sd,int job, int upper) if(merc_is_hom_active(sd->hd) && !pc_checkskill(sd, AM_CALLHOMUN)) merc_hom_vaporize(sd, 0); - + if(sd->status.manner < 0) clif_changestatus(sd,SP_MANNER,sd->status.manner); @@ -7342,7 +7340,7 @@ int pc_setoption(struct map_session_data *sd,int type) clif_status_load(&sd->bl,SI_RIDING,0); status_calc_pc(sd,0); } - + #ifndef NEW_CARTS if( type&OPTION_CART && !( p_type&OPTION_CART ) ) { //Cart On clif_cartlist(sd); @@ -7358,7 +7356,7 @@ int pc_setoption(struct map_session_data *sd,int type) if (type&OPTION_MOUNTING && !(p_type&OPTION_MOUNTING) ) { clif_status_load_notick(&sd->bl,SI_ALL_RIDING,2,1,0,0); - status_calc_pc(sd,0); + status_calc_pc(sd,0); } else if (!(type&OPTION_MOUNTING) && p_type&OPTION_MOUNTING) { clif_status_load_notick(&sd->bl,SI_ALL_RIDING,0,0,0,0); status_calc_pc(sd,0); @@ -7403,7 +7401,7 @@ int pc_setoption(struct map_session_data *sd,int type) new_look = JOB_STAR_GLADIATOR2; else if (!(type&OPTION_FLYING) && p_type&OPTION_FLYING) new_look = -1; - + if (type&OPTION_WEDDING && !(p_type&OPTION_WEDDING)) new_look = JOB_WEDDING; else if (!(type&OPTION_WEDDING) && p_type&OPTION_WEDDING) @@ -7454,9 +7452,9 @@ int pc_setcart(struct map_session_data *sd,int type) { if( type == 0 && pc_iscarton(sd) ) status_change_end(&sd->bl,SC_GN_CARTBOOST,INVALID_TIMER); - + #ifdef NEW_CARTS - + switch( type ) { case 0: if( !sd->sc.data[SC_PUSH_CART] ) @@ -7472,7 +7470,7 @@ int pc_setcart(struct map_session_data *sd,int type) { clif_status_load_notick(&sd->bl, SI_ON_PUSH_CART, 2 , type, 0, 0); break; } - + if(pc_checkskill(sd, MC_PUSHCART) < 10) status_calc_pc(sd,0); //Recalc speed penalty. #else @@ -7482,7 +7480,7 @@ int pc_setcart(struct map_session_data *sd,int type) { option |= cart[type]; // set cart pc_setoption(sd, option); #endif - + return 0; } @@ -7522,7 +7520,7 @@ int pc_setriding(TBL_PC* sd, int flag) int pc_setmadogear(TBL_PC* sd, int flag) { if( flag ){ - if( pc_checkskill(sd,NC_MADOLICENCE) > 0 ) + if( pc_checkskill(sd,NC_MADOLICENCE) > 0 ) pc_setoption(sd, sd->sc.option|OPTION_MADOGEAR); } else if( pc_ismadogear(sd) ){ pc_setoption(sd, sd->sc.option&~OPTION_MADOGEAR); @@ -7682,7 +7680,7 @@ char* pc_readregistry_str(struct map_session_data *sd,const char *reg,int type) { struct global_reg *sd_reg; int i,max; - + nullpo_ret(sd); switch (type) { case 3: //Char reg @@ -7764,7 +7762,7 @@ int pc_setregistry(struct map_session_data *sd,const char *reg,int val,int type) ShowError("pc_setregistry : refusing to set %s (type %d) until vars are received.\n", reg, type); return 1; } - + // delete reg if (val == 0) { ARR_FIND( 0, *max, i, strcmp(sd_reg[i].str, reg) == 0 ); @@ -7836,7 +7834,7 @@ int pc_setregistry_str(struct map_session_data *sd,const char *reg,const char *v ShowError("pc_setregistry_str : refusing to set %s (type %d) until vars are received.\n", reg, type); return 0; } - + // delete reg if (!val || strcmp(val,"")==0) { @@ -7999,7 +7997,7 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { int index, idx, success = 0; for( i = 0; i < data->combos_count; i++ ) { - + /* ensure this isn't a duplicate combo */ if( sd->combos.bonus != NULL ) { int x; @@ -8009,21 +8007,21 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { if( x < sd->combos.count ) continue; } - + for( j = 0; j < data->combos[i]->count; j++ ) { int id = data->combos[i]->nameid[j]; bool found = false; - + for( k = 0; k < EQI_MAX; k++ ) { index = sd->equip_index[k]; if( index < 0 ) continue; if( k == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index ) continue; if( k == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == index ) continue; if( k == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == index || sd->equip_index[EQI_HEAD_LOW] == index) ) continue; - + if(!sd->inventory_data[index]) continue; - + if ( itemdb_type(id) != IT_CARD ) { if ( sd->inventory_data[index]->nameid != id ) continue; @@ -8033,12 +8031,12 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { } else { //Cards if ( sd->inventory_data[index]->slot == 0 || itemdb_isspecial(sd->status.inventory[index].card[0]) ) continue; - + for (z = 0; z < sd->inventory_data[index]->slot; z++) { if (sd->status.inventory[index].card[z] != id) continue; - + // We have found a match found = true; break; @@ -8050,15 +8048,15 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { if( !found ) break;/* we haven't found all the ids for this combo, so we can return */ } - + /* means we broke out of the count loop w/o finding all ids, we can move to the next combo */ if( j < data->combos[i]->count ) continue; - + /* we got here, means all items in the combo are matching */ - + idx = sd->combos.count; - + if( sd->combos.bonus == NULL ) { CREATE(sd->combos.bonus, struct script_code *, 1); CREATE(sd->combos.id, unsigned short, 1); @@ -8067,12 +8065,12 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { RECREATE(sd->combos.bonus, struct script_code *, ++sd->combos.count); RECREATE(sd->combos.id, unsigned short, sd->combos.count); } - + /* we simply copy the pointer */ sd->combos.bonus[idx] = data->combos[i]->script; /* save this combo's id */ sd->combos.id[idx] = data->combos[i]->id; - + success++; } return success; @@ -8081,7 +8079,7 @@ int pc_checkcombo(struct map_session_data *sd, struct item_data *data ) { /* called when a item with combo is removed */ int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { int i, retval = 0; - + if( sd->combos.bonus == NULL ) return 0;/* nothing to do here, player has no combos */ for( i = 0; i < data->combos_count; i++ ) { @@ -8098,12 +8096,12 @@ int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { for( j = 0, cursor = 0; j < sd->combos.count; j++ ) { if( sd->combos.bonus[j] == NULL ) continue; - + if( cursor != j ) { sd->combos.bonus[cursor] = sd->combos.bonus[j]; sd->combos.id[cursor] = sd->combos.id[j]; } - + cursor++; } @@ -8117,7 +8115,7 @@ int pc_removecombo(struct map_session_data *sd, struct item_data *data ) { } } - + return retval; } int pc_load_combo(struct map_session_data *sd) { @@ -8176,7 +8174,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) return 0; } - if( sd->sc.data[SC_BERSERK] ) + if (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_SATURDAYNIGHTFEVER] || sd->sc.data[SC__BLOODYLUST]) { clif_equipitemack(sd,n,0,0); // fail return 0; @@ -8184,7 +8182,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) if(pos == EQP_ACC) { //Accesories should only go in one of the two, pos = req_pos&EQP_ACC; - if (pos == EQP_ACC) //User specified both slots.. + if (pos == EQP_ACC) //User specified both slots.. pos = sd->equip_index[EQI_ACC_R] >= 0 ? EQP_ACC_L : EQP_ACC_R; } @@ -8272,7 +8270,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) } if(pos & EQP_COSTUME_HEAD_TOP) { if(id){ - sd->status.head_top = id->look; + sd->status.head_top = id->look; } else sd->status.head_top = 0; clif_changelook(&sd->bl,LOOK_HEAD_TOP,sd->status.head_top); @@ -8300,7 +8298,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) } pc_checkallowskill(sd); //Check if status changes should be halted. - + /* check for combos (MUST be before status_calc_pc) */ if ( id ) { struct item_data *data; @@ -8319,7 +8317,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) } } } - + status_calc_pc(sd,0); if (flag) //Update skill data clif_skillinfoblock(sd); @@ -8363,7 +8361,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { } // if player is berserk then cannot unequip - if( !(flag&2) && sd->sc.count && sd->sc.data[SC_BERSERK] ) + if (!(flag & 2) && sd->sc.count && (sd->sc.data[SC_BERSERK] || sd->sc.data[SC_SATURDAYNIGHTFEVER] || sd->sc.data[SC__BLOODYLUST])) { clif_unequipitemack(sd,n,0,0); return 0; @@ -8438,7 +8436,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { clif_unequipitemack(sd,n,sd->status.inventory[n].equip,1); - if((sd->status.inventory[n].equip & EQP_ARMS) && + if((sd->status.inventory[n].equip & EQP_ARMS) && sd->weapontype1 == 0 && sd->weapontype2 == 0 && (!sd->sc.data[SC_SEVENWIND] || sd->sc.data[SC_ASPERSIO])) //Check for seven wind (but not level seven!) skill_enchant_elemental_end(&sd->bl,-1); @@ -8456,7 +8454,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { /* check for combos (MUST be before status_calc_pc) */ if ( sd->inventory_data[n] ) { struct item_data *data; - + if( sd->inventory_data[n]->combos_count ) { if( pc_removecombo(sd,sd->inventory_data[n]) ) status_cacl = true; @@ -8475,7 +8473,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { } } } - + if(flag&1 || status_cacl) { pc_checkallowskill(sd); status_calc_pc(sd,0); @@ -8500,7 +8498,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { if( data->unequip_script ) run_script(data->unequip_script,0,sd->bl.id,fake_nd->bl.id); } - + } } } @@ -8787,7 +8785,7 @@ void pc_bleeding (struct map_session_data *sd, unsigned int diff_tick) if(hp >= sd->battle_status.hp) hp = sd->battle_status.hp-1; //Script drains cannot kill you. } - + if (sd->sp_loss.value) { sd->sp_loss.tick += diff_tick; while (sd->sp_loss.tick >= sd->sp_loss.rate) { @@ -8816,7 +8814,7 @@ void pc_regen (struct map_session_data *sd, unsigned int diff_tick) sd->hp_regen.tick -= sd->hp_regen.rate; } } - + if (sd->sp_regen.value) { sd->sp_regen.tick += diff_tick; while (sd->sp_regen.tick >= sd->sp_regen.rate) { @@ -8908,10 +8906,10 @@ int map_day_timer(int tid, unsigned int tick, int id, intptr_t data) if (data == 0 && battle_config.day_duration <= 0) // if we want a day return 0; - + if (!night_flag) return 0; //Already day. - + night_flag = 0; // 0=day, 1=night [Yor] map_foreachpc(pc_daynight_timer_sub); strcpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60)); // The day has arrived! @@ -8929,7 +8927,7 @@ int map_night_timer(int tid, unsigned int tick, int id, intptr_t data) if (data == 0 && battle_config.night_duration <= 0) // if we want a night return 0; - + if (night_flag) return 0; //Already nigth. @@ -9133,7 +9131,7 @@ int pc_level_penalty_mod(struct map_session_data *sd, struct mob_data *md, int t else if( i <= RC_BOSS ) continue; } - + if( (tmp=level_penalty[type][i][diff]) > 0 ){ rate = tmp; break; @@ -9256,7 +9254,7 @@ static bool pc_readdb_levelpenalty(char* fields[], int columns, int current) { int type, race, diff; - type = atoi(fields[0]); + type = atoi(fields[0]); race = atoi(fields[1]); diff = atoi(fields[2]); @@ -9314,7 +9312,7 @@ int pc_readdb(void) continue; if (pc_split_str(line,split,4) < 4) continue; - + job_count = pc_split_atoi(split[1],jobs,':',CLASS_COUNT); if (job_count < 1) continue; @@ -9333,7 +9331,7 @@ int pc_readdb(void) ShowWarning("pc_readdb: Specified max level %u for job %d is beyond server's limit (%u).\n ", maxlv, job_id, MAX_LEVEL); maxlv = MAX_LEVEL; } - + job = jobs[0] = pc_class2idx(job_id); //We send one less and then one more because the last entry in the exp array should hold 0. max_level[job][type] = pc_split_atoui(split[3], exp_table[job][type],',',maxlv-1)+1; @@ -9406,7 +9404,7 @@ int pc_readdb(void) attr_fix_table[i][j][k]=100; sprintf(line, "%s/"DBPATH"attr_fix.txt", db_path); - + fp=fopen(line,"r"); if(fp==NULL){ ShowError("can't read %s\n", line); @@ -9551,7 +9549,7 @@ int pc_read_motd(void) void pc_itemcd_do(struct map_session_data *sd, bool load) { int i,cursor = 0; struct item_cd* cd = NULL; - + if( load ) { if( !(cd = idb_get(itemcd_db, sd->status.char_id)) ) { // no skill cooldown is associated with this character diff --git a/src/map/pc.h b/src/map/pc.h index bbaf5bd7c..6384c292d 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -215,6 +215,7 @@ struct map_session_data { unsigned int canskill_tick; // used to prevent abuse from no-delay ACT files unsigned int cansendmail_tick; // [Mail System Flood Protection] unsigned int ks_floodprotect_tick; // [Kill Steal Protection] + unsigned int bloodylust_tick; // bloodylust player timer [out/in re full-heal protection] struct { short nameid; diff --git a/src/map/skill.c b/src/map/skill.c index 9cf53688c..ae168a1a2 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -153,7 +153,7 @@ int skill_get_index( int id ) || (id >= MC_SKILLRANGEMIN && id <= MC_SKILLRANGEMAX) || (id >= EL_SKILLRANGEMIN && id <= EL_SKILLRANGEMAX) ) return 0; - + // map skill id to skill db index if( id >= GD_SKILLBASE ) id = GD_SKILLRANGEMIN + id - GD_SKILLBASE; @@ -401,7 +401,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, int skill * Renewal Heal Formula (from Doddler) * TODO: whats that( 1+ %Modifier / 100 ) ? currently using 'x1' (100/100) until found out * - Min = ( [ ( BaseLvl + INT ) / 5 ] * 30 ) * (1+( %Modifier / 100)) * (HealLvl * 0.1) + StatusMATK + EquipMATK - [(WeaponMATK * WeaponLvl) / 10] - * - Max = ( [ ( BaseLvl + INT ) / 5 ] * 30 ) * (1+( %Modifier / 100)) * (HealLvl * 0.1) + StatusMATK + EquipMATK + [(WeaponMATK * WeaponLvl) / 10] + * - Max = ( [ ( BaseLvl + INT ) / 5 ] * 30 ) * (1+( %Modifier / 100)) * (HealLvl * 0.1) + StatusMATK + EquipMATK + [(WeaponMATK * WeaponLvl) / 10] **/ hp = ( ( ( ( status_get_lv(src) + status_get_int(src) ) / 5 ) * 3 ) * skill_lv + status_get_matk_min(src) + status_get_matk_max(src) - ( ( status_get_matk_max(src) * status_get_wlv(src) ) / 10 ) ) + rnd()%( ( ( ( status_get_lv(src) + status_get_int(src) ) / 5 ) * 3 ) * skill_lv + status_get_matk_min(src) + status_get_matk_max(src) + ( ( status_get_matk_max(src) * status_get_wlv(src) ) / 10 ) ); #else @@ -419,7 +419,7 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, int skill if( sd && (skill = pc_skillheal_bonus(sd, skill_id)) ) hp += hp*skill/100; - + if( tsd && (skill = pc_skillheal2_bonus(tsd, skill_id)) ) hp += hp*skill/100; @@ -455,8 +455,8 @@ int can_copy (struct map_session_data *sd, int skillid, struct block_list* bl) } //Added so plagarize can't copy agi/bless if you're undead since it damages you - if ((skillid == AL_INCAGI || skillid == AL_BLESSING || - skillid == CASH_BLESSING || skillid == CASH_INCAGI || + if ((skillid == AL_INCAGI || skillid == AL_BLESSING || + skillid == CASH_BLESSING || skillid == CASH_INCAGI || skillid == MER_INCAGI || skillid == MER_BLESSING)) return 0; @@ -589,9 +589,12 @@ int skillnotok (int skillid, struct map_session_data *sd) return 1; } break; - case WM_LULLABY_DEEPSLEEP: + case WM_SIRCLEOFNATURE: - case WM_SATURDAY_NIGHT_FEVER: + case WM_SOUND_OF_DESTRUCTION: + case SC_MANHOLE: + case WM_LULLABY_DEEPSLEEP: + case WM_SATURDAY_NIGHT_FEVER: if( !map_flag_vs(m) ) { clif_skill_teleportmessage(sd,2); // This skill uses this msg instead of skill fails. return 1; @@ -705,13 +708,13 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int rate += sd->addeff[i].arrow_rate; if( !rate ) continue; - if( (sd->addeff[i].flag&(ATF_WEAPON|ATF_MAGIC|ATF_MISC)) != (ATF_WEAPON|ATF_MAGIC|ATF_MISC) ) - { // Trigger has attack type consideration. + if( (sd->addeff[i].flag&(ATF_WEAPON|ATF_MAGIC|ATF_MISC)) != (ATF_WEAPON|ATF_MAGIC|ATF_MISC) ) + { // Trigger has attack type consideration. if( (sd->addeff[i].flag&ATF_WEAPON && attack_type&BF_WEAPON) || (sd->addeff[i].flag&ATF_MAGIC && attack_type&BF_MAGIC) || (sd->addeff[i].flag&ATF_MISC && attack_type&BF_MISC) ) ; else - continue; + continue; } if( (sd->addeff[i].flag&(ATF_LONG|ATF_SHORT)) != (ATF_LONG|ATF_SHORT) ) @@ -865,7 +868,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int sc_start(bl,SC_FREEZE,skilllv*5+33,skilllv,skill_get_time2(skillid,skilllv)); break; #endif - + case WZ_STORMGUST: /** * Storm Gust counter was dropped in renewal @@ -1260,7 +1263,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int else if( dstmd && !is_boss(bl) ) sc_start(bl, SC_STUN, 100, skilllv, 1000 + 1000 * (rnd() %3)); break; - case SR_GENTLETOUCH_QUIET: // [(Skill Level x 5) + (Caster�s DEX + Caster�s Base Level) / 10] + case SR_GENTLETOUCH_QUIET: // [(Skill Level x 5) + (Caster?s DEX + Caster?s Base Level) / 10] sc_start(bl, SC_SILENCE, 5 * skilllv + (sstatus->dex + status_get_lv(src)) / 10, skilllv, skill_get_time(skillid, skilllv)); break; case SR_EARTHSHAKER: @@ -1320,11 +1323,11 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int sc_start(bl, SC_STUN, 100, skilllv, skill_get_time2(GN_SLINGITEM, skilllv)); sc_start(bl, SC_BLEEDING, 100, skilllv, skill_get_time2(GN_SLINGITEM, skilllv)); break; - case 13262: + case 13262: sc_start(bl, SC_MELON_BOMB, 100, skilllv, skill_get_time(GN_SLINGITEM, skilllv)); // Reduces ASPD and moviment speed break; case 13264: - sc_start(bl, SC_BANANA_BOMB, 100, skilllv, skill_get_time(GN_SLINGITEM, skilllv)); // Reduces LUK �?Needed confirm it, may be it's bugged in kRORE? + sc_start(bl, SC_BANANA_BOMB, 100, skilllv, skill_get_time(GN_SLINGITEM, skilllv)); // Reduces LUK ??Needed confirm it, may be it's bugged in kRORE? sc_start(bl, SC_BANANA_BOMB_SITDOWN, 75, skilllv, skill_get_time(GN_SLINGITEM_RANGEMELEEATK,skilllv)); // Sitdown for 3 seconds. break; } @@ -1351,7 +1354,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int break; case MH_LAVA_SLIDE: sc_start4(bl,SC_BURNING,10*skilllv,skilllv,1000,src->id,0,skill_get_time(skillid,skilllv)); - break; + break; case MH_STAHL_HORN: sc_start(bl,SC_STUN,(20 + 4 * skilllv),skilllv,skill_get_time2(skillid,skilllv)); break; @@ -1359,7 +1362,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int sc_start(bl,SC_JYUMONJIKIRI,25,skilllv,skill_get_time(skillid,skilllv)); break; case KO_MAKIBISHI: - sc_start(bl, SC_STUN, 100, skilllv, skill_get_time2(skillid,skilllv)); + sc_start(bl, SC_STUN, 100, skilllv, skill_get_time2(skillid,skilllv)); break; } @@ -2041,7 +2044,7 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in return 0; // ankle snare cannot be knocked back break; } - + if (direction == -1) // <optimized>: do the computation here instead of outside direction = map_calc_dir(target, src->x, src->y); // direction from src to target, reversed @@ -2211,7 +2214,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds damage = dmg.damage + dmg.damage2; - if( (skillid == AL_INCAGI || skillid == AL_BLESSING || + if( (skillid == AL_INCAGI || skillid == AL_BLESSING || skillid == CASH_BLESSING || skillid == CASH_INCAGI || skillid == MER_INCAGI || skillid == MER_BLESSING) && tsd->sc.data[SC_CHANGEUNDEAD] ) damage = 1; @@ -2407,7 +2410,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds break; case EL_STONE_RAIN: dmg.dmotion = clif_skill_damage(dsrc,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,skillid,-1,(flag&1)?8:5); - break; + break; case WM_SEVERE_RAINSTORM_MELEE: dmg.dmotion = clif_skill_damage(src,bl,tick,dmg.amotion,dmg.dmotion,damage,dmg.div_,WM_SEVERE_RAINSTORM,skilllv,5); break; @@ -2474,7 +2477,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds break; case GN_HELLS_PLANT_ATK: copy_skill = GN_HELLS_PLANT; - break; + break; case LG_OVERBRAND_BRANDISH: case LG_OVERBRAND_PLUSATK: copy_skill = LG_OVERBRAND; @@ -2562,7 +2565,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds case LG_OVERBRAND: case SR_KNUCKLEARROW: case GN_WALLOFTHORN: - case EL_FIRE_MANTLE: + case EL_FIRE_MANTLE: direction = unit_getdir(bl);// backwards break; // This ensures the storm randomly pushes instead of exactly a cell backwards per official mechanics. @@ -2592,8 +2595,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds dir_x = dirx[(direction+4)%8]; dir_y = diry[(direction+4)%8]; if( map_getcell(bl->m, bl->x+dir_x, bl->y+dir_y, CELL_CHKNOPASS) != 0 ) - skill_addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag|4); - } + skill_addtimerskill(src, tick + 300 * ((flag&2) ? 1 : 2), bl->id, 0, 0, skillid, skilllv, BF_WEAPON, flag|4); + } break; case GN_WALLOFTHORN: unit_stop_walking(bl,1); @@ -2643,10 +2646,10 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } clif_damage( - ( (devo_flag) ? bl:d_bl), + ( (devo_flag) ? bl:d_bl), ( (devo_flag) ? bl:d_bl), gettick(), 0, 0, damage, 0, 0, 0); status_fix_damage( - ( (devo_flag) ? bl:NULL), + ( (devo_flag) ? bl:NULL), ( (devo_flag) ? bl:d_bl), damage, 0); } else { @@ -2669,7 +2672,7 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds if(skillid == CR_GRANDCROSS || skillid == NPC_GRANDDARKNESS) dmg.flag |= BF_WEAPON; - if( sd && src != bl && damage > 0 && ( dmg.flag&BF_WEAPON || + if( sd && src != bl && damage > 0 && ( dmg.flag&BF_WEAPON || (dmg.flag&BF_MISC && (skillid == RA_CLUSTERBOMB || skillid == RA_FIRINGTRAP || skillid == RA_ICEBOUNDTRAP || skillid == RK_DRAGONBREATH)) ) ) { if (battle_config.left_cardfix_to_right) @@ -2740,12 +2743,9 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds } /*========================================== - * �X�L����??U?�p(map_foreachinarea����Ă��) - * flag�ɂ���?F16?i?���m�F - * MSB <- 00fTffff ->LSB - * T =�^?�Q�b�g�I?�p(BCT_*) - * ffff=���R�Ɏg�p�\ - * 0 =�\��?B0�ɌŒ� + * sub fonction for recursive skill call. + * Checking bl battle flag and display dammage + * then call func with source,target,skillid,skilllv,tick,flag *------------------------------------------*/ typedef int (*SkillFunc)(struct block_list *, struct block_list *, int, int, unsigned int, int); int skill_area_sub (struct block_list *bl, va_list ap) @@ -2826,6 +2826,7 @@ static int skill_check_unit_range_sub (struct block_list *bl, va_list ap) case RA_FIRINGTRAP: case RA_ICEBOUNDTRAP: case SC_DIMENSIONDOOR: + case SC_BLOODYLUST: //Non stackable on themselves and traps (including venom dust which does not has the trap inf2 set) if (skillid != g_skillid && !(skill_get_inf2(g_skillid)&INF2_TRAP) && g_skillid != AS_VENOMDUST && g_skillid != MH_POISON_MIST) return 0; @@ -3109,7 +3110,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) skill_area_temp[2] = 0; map_foreachinrange(skill_area_sub, src, skill_get_splash(skl->skill_id, skl->skill_lv), splash_target(src), src, skl->skill_id, skl->skill_lv, tick, skl->flag, skill_castend_damage_id); break; - case WZ_WATERBALL: + case WZ_WATERBALL: skill_toggle_magicpower(src, skl->skill_id); // only the first hit will be amplify if (!status_isdead(target)) skill_attack(BF_MAGIC,src,src,target,skl->skill_id,skl->skill_lv,tick,skl->flag); @@ -3213,7 +3214,7 @@ static int skill_timerskill(int tid, unsigned int tick, int id, intptr_t data) case GN_SPORE_EXPLOSION: map_foreachinrange(skill_area_sub, target, skill_get_splash(skl->skill_id, skl->skill_lv), BL_CHAR, src, skl->skill_id, skl->skill_lv, 0, skl->flag|1|BCT_ENEMY, skill_castend_damage_id); - break; + break; case CH_PALMSTRIKE: { struct status_change* tsc = status_get_sc(target); @@ -3762,7 +3763,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int default: break; } - + skill_area_temp[0] = 0; skill_area_temp[1] = bl->id; skill_area_temp[2] = 0; @@ -3978,7 +3979,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int case GS_FLING: case NJ_ZENYNAGE: case GN_THORNS_TRAP: - case GN_HELLS_PLANT_ATK: + case GN_HELLS_PLANT_ATK: skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag); break; /** @@ -3988,7 +3989,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int struct status_change *tsc = NULL; if( (tsc = status_get_sc(bl)) && (tsc->data[SC_HIDING] )) { clif_skill_nodamage(src,src,skillid,skilllv,1); - } else + } else skill_attack(BF_MISC,src,src,bl,skillid,skilllv,tick,flag); } break; @@ -4057,7 +4058,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if( battle_check_target(src,bl,BCT_ENEMY) ) skill_attack(BF_WEAPON,src,src,bl,skillid,skilllv,tick,flag); break; - + case RK_STORMBLAST: case RK_CRUSHSTRIKE: if( sd ) { @@ -4151,7 +4152,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int { spheres[j] = i; positions[j] = sc->data[i]->val2; - j++; // + j++; // } if( j < 4 ) @@ -4204,7 +4205,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int i = spell[s==1?0:rand()%s];// Random select of spell to be released. if( s && sc->data[i] ){// Now extract the data from the preserved spell - skill_id = sc->data[i]->val1; + skill_id = sc->data[i]->val1; skill_lv = sc->data[i]->val2; point = sc->data[i]->val3; status_change_end(src, (sc_type)i, INVALID_TIMER); @@ -4213,7 +4214,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if( sc->data[SC_READING_SB]->val2 > point ) sc->data[SC_READING_SB]->val2 -= point; - else // Last spell to be released + else // Last spell to be released status_change_end(src, SC_READING_SB, INVALID_TIMER); clif_skill_nodamage(src, bl, skillid, skilllv, 1); @@ -4256,7 +4257,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int clif_skill_fail(sd,skillid,USESKILL_FAIL_SUMMON_NONE,0); break; } - + // Sphere Sort for( i = 0; i <= j - 2; i++ ) for( k = i + 1; k <= j - 1; k++ ) @@ -4327,7 +4328,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int if( su && (sg=su->group) && skill_get_inf2(sg->skill_id)&INF2_TRAP ) { if( !(sg->unit_id == UNT_USED_TRAPS || (sg->unit_id == UNT_ANKLESNARE && sg->val2 != 0 )) ) - { + { struct item item_tmp; memset(&item_tmp,0,sizeof(item_tmp)); item_tmp.nameid = sg->item_id?sg->item_id:ITEMID_TRAP; @@ -4451,7 +4452,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int clif_skill_fail(sd, skillid, USESKILL_FAIL_LEVEL, 0); } break; - + case GN_SPORE_EXPLOSION: if( flag&1 ) skill_attack(skill_get_type(skillid), src, src, bl, skillid, skilllv, tick, flag); @@ -4460,7 +4461,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int skill_addtimerskill(src, gettick() + skill_get_time(skillid, skilllv) - 1000, bl->id, 0, 0, skillid, skilllv, 0, 0); } break; - + case EL_FIRE_BOMB: case EL_FIRE_WAVE: case EL_WATER_SCREW: @@ -4478,7 +4479,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); } break; - + case EL_ROCK_CRUSHER: clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1); clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); @@ -4487,7 +4488,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int else skill_attack(BF_WEAPON,src,src,bl,EL_ROCK_CRUSHER_ATK,skilllv,tick,flag); break; - + case EL_STONE_RAIN: if( flag&1 ) skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); @@ -4501,7 +4502,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); } break; - + case EL_FIRE_ARROW: case EL_ICE_NEEDLE: case EL_WIND_SLASH: @@ -4510,7 +4511,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); skill_attack(skill_get_type(skillid),src,src,bl,skillid,skilllv,tick,flag); break; - + case EL_TIDAL_WEAPON: if( src->type == BL_ELEM ) { struct elemental_data *ele = BL_CAST(BL_ELEM,src); @@ -4518,7 +4519,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int struct status_change *tsc = status_get_sc(bl); sc_type type = status_skill2sc(skillid), type2; type2 = type-1; - + clif_skill_nodamage(src,battle_get_master(src),skillid,skilllv,1); clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { @@ -4533,8 +4534,8 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int clif_skill_nodamage(src,src,skillid,skilllv,1); } break; - - + + case 0:/* no skill - basic/normal attack */ if(sd) { if (flag & 3){ @@ -4569,7 +4570,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int status_change_end(src,SC_CURSEDCIRCLE_ATKER,INVALID_TIMER); map_freeblock_unlock(); - + if( sd && !(flag&1) ) {// ensure that the skill last-cast tick is recorded sd->canskill_tick = gettick(); @@ -4582,7 +4583,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, int // perform skill requirement consumption skill_consume_requirement(sd,skillid,skilllv,2); } - + return 0; } @@ -4696,7 +4697,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { int heal = skill_calc_heal(src, bl, (skillid == AB_HIGHNESSHEAL)?AL_HEAL:skillid, (skillid == AB_HIGHNESSHEAL)?10:skilllv, true); int heal_get_jobexp; - //Highness Heal: starts at 1.5 boost + 0.5 for each level + //Highness Heal: starts at 1.5 boost + 0.5 for each level if( skillid == AB_HIGHNESSHEAL ) { heal = heal * ( 15 + 5 * skilllv ) / 10; } @@ -4720,8 +4721,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in bl = src; dstsd = sd; } - } else - if (tsc->data[SC_BERSERK]) + } + else if (tsc->data[SC_BERSERK] || tsc->data[SC_SATURDAYNIGHTFEVER] || tsc->data[SC__BLOODYLUST]) heal = 0; //Needed so that it actually displays 0 when healing. } clif_skill_nodamage (src, bl, skillid, heal, 1); @@ -5204,12 +5205,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SR_CRESCENTELBOW: case SR_LIGHTNINGWALK: case SR_GENTLETOUCH_ENERGYGAIN: - case GN_CARTBOOST: + case GN_CARTBOOST: case KO_MEIKYOUSISUI: clif_skill_nodamage(src,bl,skillid,skilllv, sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); break; - + case SO_STRIKING: if (sd) { int bonus = 25 + 10 * skilllv; @@ -5220,8 +5221,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in 0 ); } - break; - + break; + case NPC_STOP: if( clif_skill_nodamage(src,bl,skillid,skilllv, sc_start2(bl,type,100,skilllv,src->id,skill_get_time(skillid,skilllv)) ) ) @@ -5520,7 +5521,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case KO_HAPPOKUNAI: skill_area_temp[1] = 0; clif_skill_nodamage(src,bl,skillid,skilllv,1); - i = map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), + i = map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_damage_id); if( !i && ( skillid == NC_AXETORNADO || skillid == SR_SKYNETBLOW || skillid == KO_HAPPOKUNAI ) ) clif_skill_damage(src,src,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); @@ -5782,7 +5783,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in mob_target(dstmd, src, skill_get_range2(src,skillid,skilllv)); clif_skill_nodamage(src,bl,skillid,skilllv,1); - } + } else clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); } @@ -6032,7 +6033,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SC_STRIPACCESSARY: { unsigned short location = 0; int d = 0; - + //Rate in percent if ( skillid == ST_FULLSTRIP ) { i = 5 + 2*skilllv + (sstatus->dex - tstatus->dex)/5; @@ -6087,7 +6088,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in //Attempts to strip at rate i and duration d if( (i = skill_strip_equip(bl, location, i, skilllv, d)) || (skillid != ST_FULLSTRIP && skillid != GC_WEAPONCRUSH ) ) - clif_skill_nodamage(src,bl,skillid,skilllv,i); + clif_skill_nodamage(src,bl,skillid,skilllv,i); //Nothing stripped. if( sd && !i ) @@ -6321,7 +6322,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in continue; break; } - if(i==SC_BERSERK) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. + if(i==SC_BERSERK || i==SC_SATURDAYNIGHTFEVER) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. status_change_end(bl, (sc_type)i, INVALID_TIMER); } break; @@ -6361,7 +6362,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; case SA_CASTCANCEL: - case SO_SPELLFIST: + case SO_SPELLFIST: clif_skill_nodamage(src,bl,skillid,skilllv,1); unit_skillcastcancel(src,1); if(sd) { @@ -6369,7 +6370,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( skillid == SO_SPELLFIST ){ sc_start4(src,type,100,skilllv+1,skilllv,sd->skillid_old,sd->skilllv_old,skill_get_time(skillid,skilllv)); sd->skillid_old = sd->skilllv_old = 0; - break; + break; } sp = sp * (90 - (skilllv-1)*20) / 100; if(sp < 0) sp = 0; @@ -6695,7 +6696,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in break; case MA_REMOVETRAP: - case HT_REMOVETRAP: + case HT_REMOVETRAP: { struct skill_unit* su; struct skill_unit_group* sg; @@ -7267,7 +7268,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case HFLI_SPEED: case HLIF_CHANGE: case MH_ANGRIFFS_MODUS: - case MH_GOLDENE_FERSE: + case MH_GOLDENE_FERSE: clif_skill_nodamage(src,bl,skillid,skilllv, sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); if (hd) @@ -7324,14 +7325,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case ALL_PARTYFLEE: if( sd && !(flag&1) ) { - if( !sd->status.party_id ) + if( !sd->status.party_id ) { clif_skill_fail(sd,skillid,USESKILL_FAIL_LEVEL,0); break; } party_foreachsamemap(skill_area_sub, sd, skill_get_splash(skillid, skilllv), src, skillid, skilllv, tick, flag|BCT_PARTY|1, skill_castend_nodamage_id); } - else + else clif_skill_nodamage(src,bl,skillid,skilllv,sc_start(bl,type,100,skilllv,skill_get_time(skillid,skilllv))); break; case NPC_TALK: @@ -7552,13 +7553,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { i = skill_calc_heal(src, bl, AL_HEAL, pc_checkskill(sd, AL_HEAL), true); - if( (dstsd && pc_ismadogear(dstsd)) || status_isimmune(bl) || (tsc && tsc->data[SC_BERSERK])) + if( (dstsd && pc_ismadogear(dstsd)) || status_isimmune(bl)) i = 0; // Should heal by 0 or won't do anything?? in iRO it breaks the healing to members.. [malufett] clif_skill_nodamage(bl, bl, skillid, i, 1); if( tsc && tsc->data[SC_AKAITSUKI] && i ) i = ~i + 1; - status_heal(bl, i, 0, 1); + status_heal(bl, i, 0, 0); } } else if( sd ) @@ -7581,7 +7582,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( tsc && (tsc->data[SC_FREEZE] || tsc->data[SC_STONE] || tsc->data[SC_BLIND] || tsc->data[SC_BURNING] || tsc->data[SC_FREEZING] || tsc->data[SC_CRYSTALIZE])) { // Success Chance: (40 + 10 * Skill Level) % - if( rnd()%100 > 40+10*skilllv ) break; + if( rnd()%100 > 40+10*skilllv ) break; status_change_end(bl, SC_FREEZE, INVALID_TIMER); status_change_end(bl, SC_STONE, INVALID_TIMER); status_change_end(bl, SC_BLIND, INVALID_TIMER); @@ -7600,7 +7601,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( flag&1 || sd == NULL ) { if( tsc && (tsc->data[SC_SLEEP] || tsc->data[SC_STUN] || tsc->data[SC_MANDRAGORA] || tsc->data[SC_SILENCE]) ){ // Success Chance: (40 + 10 * Skill Level) % - if( rnd()%100 > 40+10*skilllv ) break; + if( rnd()%100 > 40+10*skilllv ) break; status_change_end(bl, SC_SLEEP, INVALID_TIMER); status_change_end(bl, SC_STUN, INVALID_TIMER); status_change_end(bl, SC_MANDRAGORA, INVALID_TIMER); @@ -7675,7 +7676,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in continue; break; } - if(i==SC_BERSERK /*|| i==SC_SATURDAYNIGHTFEVER*/) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. + if(i==SC_BERSERK || i==SC_SATURDAYNIGHTFEVER) tsc->data[i]->val2=0; //Mark a dispelled berserk to avoid setting hp to 100 by setting hp penalty to 0. status_change_end(bl,(sc_type)i,INVALID_TIMER); } break; @@ -7706,7 +7707,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( (src == bl || battle_check_target(src, bl, BCT_ENEMY)) && !is_boss(bl) )// Should not work with bosses. { int rate = ( sd? sd->status.job_level : 50 ) / 4; - + if(src == bl ) rate = 100; // Success Chance: On self, 100% else if(bl->type == BL_PC) rate += 20 + 10 * skilllv; // On Players, (20 + 10 * Skill Level) % else rate += 40 + 10 * skilllv; // On Monsters, (40 + 10 * Skill Level) % @@ -7728,7 +7729,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_nodamage(src,bl,skillid,skilllv,1); map_foreachinrange(skill_area_sub,bl,skill_get_splash(skillid,skilllv),BL_CHAR|BL_SKILL,src,skillid,skilllv,tick,flag|BCT_ENEMY,skill_castend_damage_id); break; - + case WL_JACKFROST: clif_skill_nodamage(src,bl,skillid,skilllv,1); map_foreachinshootrange(skill_area_sub,bl,skill_get_splash(skillid,skilllv),BL_CHAR|BL_SKILL,src,skillid,skilllv,tick,flag|BCT_ENEMY|1,skill_castend_damage_id); @@ -7941,7 +7942,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { if( bl->type != BL_MOB ) break; md = map_id2md(bl->id); - if( md && md->class_ >= 2042 && md->class_ <= 2046 ) + if( md && md->class_ >= MOBID_SILVERSNIPER && md->class_ <= MOBID_MAGICDECOY_WIND ) status_kill(bl); clif_skill_nodamage(src, bl, skillid, skilllv, 1); } @@ -8152,7 +8153,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_nodamage(src,bl,skillid,skilllv,1); } break; - + case LG_INSPIRATION: if( sd && !map[sd->bl.m].flag.noexppenalty && sd->status.base_level != MAX_LEVEL ) { sd->status.base_exp -= min(sd->status.base_exp, pc_nextbaseexp(sd) * 1 / 100); // 1% penalty. @@ -8188,7 +8189,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case SR_RAISINGDRAGON: if( sd ) { short max = 5 + skilllv; - sc_start(bl, SC_EXPLOSIONSPIRITS, 100, skilllv, skill_get_time(skillid, skilllv)); + sc_start(bl, SC_EXPLOSIONSPIRITS, 100, skilllv, skill_get_time(skillid, skilllv)); for( i = 0; i < max; i++ ) // Don't call more than max available spheres. pc_addspiritball(sd, skill_get_time(skillid, skilllv), max); clif_skill_nodamage(src, bl, skillid, skilllv, sc_start(bl, type, 100, skilllv,skill_get_time(skillid, skilllv))); @@ -8203,7 +8204,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in i = dstsd->spiritball; //1%sp per spiritball. pc_delspiritball(dstsd, dstsd->spiritball, 0); } - if( i ) status_percent_heal(src, 0, i); + if( i ) status_percent_heal(src, 0, i); clif_skill_nodamage(src, bl, skillid, skilllv, i ? 1:0); } else { clif_skill_damage(src,bl,tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); @@ -8227,12 +8228,12 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in { int heal; - if( status_isimmune(bl) ) + if( status_isimmune(bl) ) { clif_skill_nodamage(src,bl,skillid,skilllv,0); break; } - + heal = 120 * skilllv + status_get_max_hp(bl) * (2 + skilllv) / 100; status_heal(bl, heal, 0, 0); clif_skill_nodamage(src, bl, AL_HEAL, heal, 1); @@ -8254,7 +8255,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } break; case SR_GENTLETOUCH_CHANGE: - case SR_GENTLETOUCH_REVITALIZE: + case SR_GENTLETOUCH_REVITALIZE: clif_skill_nodamage(src,bl,skillid,skilllv, sc_start2(bl,type,100,skilllv,src->id,skill_get_time(skillid,skilllv))); break; @@ -8302,7 +8303,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } } break; - + case WM_SIRCLEOFNATURE: flag |= BCT_SELF|BCT_PARTY|BCT_GUILD; case WM_VOICEOFSIREN: @@ -8480,14 +8481,14 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); } break; - + case SO_SUMMON_AGNI: case SO_SUMMON_AQUA: case SO_SUMMON_VENTUS: case SO_SUMMON_TERA: if( sd ) { int elemental_class = skill_get_elemental_type(skillid,skilllv); - + // Remove previous elemental fisrt. if( sd->ed && elemental_delete(sd->ed,0) ) { clif_skill_fail(sd,skillid,0,0); @@ -8501,7 +8502,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_nodamage(src,bl,skillid,skilllv,1); } break; - + case SO_EL_CONTROL: if( sd ) { int mode = EL_MODE_PASSIVE; // Standard mode. @@ -8526,7 +8527,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_nodamage(src,bl,skillid,skilllv,1); } break; - + case SO_EL_ACTION: if( sd ) { if( !sd->ed ) @@ -8535,7 +8536,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_nodamage(src,bl,skillid,skilllv,1); } break; - + case SO_EL_CURE: if( sd ) { struct elemental_data *ed = sd->ed; @@ -8555,7 +8556,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_nodamage(src,&ed->bl,skillid,skilllv,1); } break; - + case GN_CHANGEMATERIAL: case SO_EL_ANALYSIS: if( sd ) { @@ -8563,11 +8564,11 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_itemlistwindow(sd,skillid,skilllv); } break; - + case GN_BLOOD_SUCKER: { struct status_change *sc = status_get_sc(src); - + if( sc && sc->bs_counter < skill_get_maxcount( skillid , skilllv) ) { if( tsc && tsc->data[type] ){ (sc->bs_counter)--; @@ -8582,7 +8583,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } } break; - + case GN_MANDRAGORA: if( flag&1 ) { if ( clif_skill_nodamage(bl, src, skillid, skilllv, @@ -8592,7 +8593,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), BL_CHAR, src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_nodamage_id); break; - + case GN_SLINGITEM: if( sd ) { short ammo_id; @@ -8624,7 +8625,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_nodamage(src,bl,skillid,skilllv,1); clif_skill_nodamage(src,bl,skillid,skilllv,1);// This packet is received twice actually, I think it is to show the animation. break; - + case GN_MIX_COOKING: case GN_MAKEBOMB: case GN_S_PHARMACY: @@ -8661,7 +8662,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in if( ele ) { sc_type type2 = type-1; struct status_change *sc = status_get_sc(&ele->bl); - + if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { elemental_clean_single_effect(ele, skillid); } else { @@ -8675,7 +8676,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } } break; - + case EL_FIRE_MANTLE: case EL_WATER_BARRIER: case EL_ZEPHYR: @@ -8684,13 +8685,13 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in clif_skill_damage(src, src, tick, status_get_amotion(src), 0, -30000, 1, skillid, skilllv, 6); skill_unitsetting(src,skillid,skilllv,bl->x,bl->y,0); break; - + case EL_WATER_SCREEN: { struct elemental_data *ele = BL_CAST(BL_ELEM, src); if( ele ) { struct status_change *sc = status_get_sc(&ele->bl); sc_type type2 = type-1; - + clif_skill_nodamage(src,src,skillid,skilllv,1); if( (sc && sc->data[type2]) || (tsc && tsc->data[type]) ) { elemental_clean_single_effect(ele, skillid); @@ -8733,7 +8734,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in skill_blown(src,bl,skill_get_blewcount(skillid,skilllv),unit_getdir(bl),0); } } - break; + break; case KO_KYOUGAKU: if( dstsd && tsc && !tsc->data[type] && rand()%100 < tstatus->int_/2 ){ @@ -8791,9 +8792,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in case KG_KAGEHUMI: if( flag&1 ){ - if(tsc && ( tsc->option&(OPTION_CLOAK|OPTION_HIDE) || + if(tsc && ( tsc->option&(OPTION_CLOAK|OPTION_HIDE) || tsc->data[SC_CAMOUFLAGE] || tsc->data[SC__SHADOWFORM] || - tsc->data[SC_MARIONETTE] || tsc->data[SC_HARMONIZE])){ + tsc->data[SC_MARIONETTE] || tsc->data[SC_HARMONIZE])){ sc_start(src, type, 100, skilllv, skill_get_time(skillid, skilllv)); sc_start(bl, type, 100, skilllv, skill_get_time(skillid, skilllv)); status_change_end(bl, SC_HIDING, INVALID_TIMER); @@ -8810,7 +8811,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in } }else{ skill_area_temp[2] = 0; - map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_nodamage_id); + map_foreachinrange(skill_area_sub, bl, skill_get_splash(skillid, skilllv), splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY|SD_SPLASH|1, skill_castend_nodamage_id); } break; default: @@ -8935,7 +8936,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) ud->skillx = target->x; ud->skilly = target->y; ud->skilltimer = tid; - return skill_castend_pos(tid,tick,id,data); + return skill_castend_pos(tid,tick,id,data); } if(ud->skillid == RG_BACKSTAP) { @@ -9050,7 +9051,7 @@ int skill_castend_id(int tid, unsigned int tick, int id, intptr_t data) status_change_end(src, SC_RUN, INVALID_TIMER); flag = 1; } - + if (ud->walktimer != INVALID_TIMER && ud->skillid != TK_RUN && ud->skillid != RA_WUGDASH) unit_stop_walking(src,1); @@ -9410,7 +9411,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case SR_RIDEINLIGHTNING: i = skill_get_splash(skillid, skilllv); - map_foreachinarea(skill_area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR, + map_foreachinarea(skill_area_sub, src->m, x-i, y-i, x+i, y+i, BL_CHAR, src, skillid, skilllv, tick, flag|BCT_ENEMY|1, skill_castend_damage_id); break; @@ -9512,7 +9513,6 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk case SC_MANHOLE: case SC_DIMENSIONDOOR: case SC_CHAOSPANIC: - case SC_BLOODYLUST: case SC_MAELSTROM: case WM_REVERBERATION: case WM_SEVERE_RAINSTORM: @@ -9572,7 +9572,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk flag|=(skillid == SO_WARMER)?8:4; skill_unitsetting(src,skillid,skilllv,x,y,0); break; - + case WZ_METEOR: { int area = skill_get_splash(skillid, skilllv); short tmpx = 0, tmpy = 0, x1 = 0, y1 = 0; @@ -9932,7 +9932,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk map_foreachinarea( skill_ative_reverberation, src->m, x-i, y-i, x+i,y+i,BL_SKILL); break; - + case WM_GREAT_ECHO: flag|=1; // Should counsume 1 item per skill usage. map_foreachinrange(skill_area_sub, src, skill_get_splash(skillid,skilllv),splash_target(src), src, skillid, skilllv, tick, flag|BCT_ENEMY, skill_castend_damage_id); @@ -9947,17 +9947,17 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk skill_addtimerskill(src,tick+i*150,0,x1,y1,GN_CRAZYWEED_ATK,skilllv,-1,0); } } - break; + break; case GN_FIRE_EXPANSION: { int i; struct unit_data *ud = unit_bl2ud(src); - + if( !ud ) break; - + for( i = 0; i < MAX_SKILLUNITGROUP && ud->skillunit[i]; i ++ ) { if( ud->skillunit[i]->skill_id == GN_DEMONIC_FIRE && distance_xy(x, y, ud->skillunit[i]->unit->bl.x, ud->skillunit[i]->unit->bl.y) < 4 ) { - switch( skilllv ) { + switch( skilllv ) { case 3: ud->skillunit[i]->unit_id = UNT_FIRE_EXPANSION_SMOKE_POWDER; clif_changetraplook(&ud->skillunit[i]->unit->bl, UNT_FIRE_EXPANSION_SMOKE_POWDER); @@ -9982,7 +9982,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk } } break; - + case SO_FIREWALK: case SO_ELECTRICWALK: if( sc && sc->data[type] ) @@ -9991,6 +9991,10 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk sc_start2(src, type, 100, skillid, skilllv, skill_get_time(skillid, skilllv))); break; + case SC_BLOODYLUST: //set in another group so instance will move if recasted + flag |= 33; + skill_unitsetting(src, skillid, skilllv, x, y, 0); + break; default: if( skillid >= HM_SKILLBASE && skillid <= HM_SKILLBASE + MAX_HOMUNSKILL ) { if( src->type == BL_HOM && ((TBL_HOM*)src)->master->fd ) @@ -10046,7 +10050,7 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char sd->sc.data[SC_AUTOCOUNTER] || sd->sc.data[SC_STEELBODY] || (sd->sc.data[SC_DANCING] && skill_num < RK_ENCHANTBLADE && !pc_checkskill(sd, WM_LESSON)) || - sd->sc.data[SC_BERSERK] || + sd->sc.data[SC_BERSERK] || sd->sc.data[SC__BLOODYLUST] || sd->sc.data[SC_BASILICA] || sd->sc.data[SC_MARIONETTE] || sd->sc.data[SC_WHITEIMPRISON] || @@ -10141,7 +10145,7 @@ int skill_castend_map (struct map_session_data *sd, short skill_num, const char skill_failed(sd); return 0; } - + group->val1 = (group->val1<<16)|(short)0; // record the destination coordinates group->val2 = (x<<16)|y; @@ -10264,7 +10268,7 @@ static int skill_icewall_block(struct block_list *bl,va_list ap) { nullpo_ret(md); if( !md->target_id || ( target = map_id2bl(md->target_id) ) == NULL ) return 0; - + if( path_search_long(NULL,bl->m,bl->x,bl->y,target->x,target->y,CELL_CHKICEWALL) ) return 0; @@ -10575,12 +10579,16 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli break; case SO_VACUUM_EXTREME: range++; + + break; + case SC_BLOODYLUST: + skill_clear_group(src, 32); break; case GN_WALLOFTHORN: if( flag&1 ) limit = 3000; val3 = (x<<16)|y; - break; + break; case KO_ZENKAI: if( sd ){ ARR_FIND(1, 6, i, sd->talisman[i] > 0); @@ -10699,12 +10707,14 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, short skilli break; case GN_WALLOFTHORN: val1 = 1000 * skilllv; // Need official value. [LimitLine] - break; + break; default: if (group->state.song_dance&0x1) val2 = unit_flag&(UF_DANCE|UF_SONG); //Store whether this is a song/dance break; } + if (skill_get_unit_flag(skillid) & UF_RANGEDSINGLEUNIT && i == (layout->count / 2)) + val2 |= UF_RANGEDSINGLEUNIT; // center. if( range <= 0 ) map_foreachincell(skill_cell_overlap,src->m,ux,uy,BL_SKILL,skillid, &alive, src); @@ -10790,7 +10800,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un int sec = skill_get_time2(sg->skill_id,sg->skill_lv); if( status_change_start(bl,type,10000,sg->skill_lv,1,sg->group_id,0,sec,8) ) { - const struct TimerData* td = sc->data[type]?get_timer(sc->data[type]->timer):NULL; + const struct TimerData* td = sc->data[type]?get_timer(sc->data[type]->timer):NULL; if( td ) sec = DIFF_TICK(td->tick, tick); map_moveblock(bl, src->bl.x, src->bl.y, tick); @@ -10813,6 +10823,19 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un if (!sce) sc_start4(bl,type,100,sg->skill_lv,sg->group_id,0,0,sg->limit); break; + case UNT_BLOODYLUST: + if (sg->src_id == bl->id) + break; //Does not affect the caster. + if (!sce) { + TBL_PC *sd = BL_CAST(BL_PC, bl); //prevent fullheal exploit + if (sd && sd->bloodylust_tick && DIFF_TICK(gettick(), sd->bloodylust_tick) < skill_get_time2(SC_BLOODYLUST, 1)) + sc_start4(bl, type, 100, sg->skill_lv, 1, 0, 0, skill_get_time(LK_BERSERK, sg->skill_lv)); //do not refull heal + else { + if (sd) sd->bloodylust_tick = gettick(); + sc_start4(bl, type, 100, sg->skill_lv, 0, 0, 0, skill_get_time(LK_BERSERK, sg->skill_lv)); + } + } + break; case UNT_WARP_WAITING: { int working = sg->val1&0xffff; @@ -10829,12 +10852,12 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un if( --count <= 0 ) skill_delunitgroup(sg); - + if ( map_mapindex2mapid(sg->val3) == sd->bl.m && x == sd->bl.x && y == sd->bl.y ) working = 1;/* we break it because officials break it, lovely stuff. */ sg->val1 = (count<<16)|working; - + pc_setpos(sd,m,x,y,CLR_TELEPORT); } } else if(bl->type == BL_MOB && battle_config.mob_warp&2) { @@ -10940,7 +10963,7 @@ static int skill_unit_onplace (struct skill_unit *src, struct block_list *bl, un if( map_flag_vs(bl->m) || bl->id == src->bl.id || battle_check_target(&src->bl,bl, BCT_ENEMY) == 1 ) skill_attack(skill_get_type(sg->skill_id), ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0); break; - + case UNT_GD_LEADERSHIP: case UNT_GD_GLORYWOUNDS: case UNT_GD_SOULCOLD: @@ -10977,7 +11000,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns nullpo_ret(ss=map_id2bl(sg->src_id)); tsd = BL_CAST(BL_PC, bl); tsc = status_get_sc(bl); - + if ( tsc && tsc->data[SC_HOVERING] ) return 0; //Under hovering characters are immune to trap and ground target skills. @@ -11016,10 +11039,10 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns { int count=0; const int x = bl->x, y = bl->y; - + if( sg->skill_id == GN_WALLOFTHORN && !map_flag_vs(bl->m) ) break; - + //Take into account these hit more times than the timer interval can handle. do skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0); @@ -11120,7 +11143,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns **/ #ifndef RENEWAL case WZ_STORMGUST: //SG counter does not reset per stormgust. IE: One hit from a SG and two hits from another will freeze you. - if (tsc) + if (tsc) tsc->sg_counter++; //SG hit counter. if (skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0) <= 0 && tsc) tsc->sg_counter=0; //Attack absorbed. @@ -11135,7 +11158,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns struct skill_unit *su = (struct skill_unit *)bl; if( su && !(skill_get_inf2(su->group->skill_id)&INF2_TRAP) ) break; - } + } default: skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); } @@ -11160,7 +11183,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( sg->val2 == 0 && tsc && (sg->unit_id == UNT_ANKLESNARE || bl->id != sg->src_id) ) { int sec = skill_get_time2(sg->skill_id,sg->skill_lv); if( status_change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,sec, 8) ) { - const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL; + const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL; if( td ) sec = DIFF_TICK(td->tick, tick); unit_movepos(bl, src->bl.x, src->bl.y, 0, 0); @@ -11191,20 +11214,20 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns map_moveblock(bl, src->bl.x, src->bl.y, tick); clif_fixpos(bl); - + } - + map_foreachinrange(skill_trap_splash, &src->bl, skill_get_splash(sg->skill_id, sg->skill_lv), sg->bl_flag, &src->bl, tick); sg->unit_id = UNT_USED_TRAPS; //Changed ID so it does not invoke a for each in area again. - } + } break; - + case UNT_VENOMDUST: if(tsc && !tsc->data[type]) status_change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),0); break; - + case UNT_MAGENTATRAP: case UNT_COBALTTRAP: case UNT_MAIZETRAP: @@ -11493,7 +11516,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( !sg->val2 ) { int sec = skill_get_time2(sg->skill_id, sg->skill_lv); if( sc_start(bl, type, 100, sg->skill_lv, sec) ) { - const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL; + const struct TimerData* td = tsc->data[type]?get_timer(tsc->data[type]->timer):NULL; if( td ) sec = DIFF_TICK(td->tick, tick); ///map_moveblock(bl, src->bl.x, src->bl.y, tick); // in official server it doesn't behave like this. [malufett] @@ -11506,7 +11529,7 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns skill_attack(skill_get_type(GN_THORNS_TRAP), ss, ss, bl, sg->skill_id, sg->skill_lv, tick, SD_LEVEL|SD_ANIMATION); } break; - + case UNT_DEMONIC_FIRE: { TBL_PC* sd = BL_CAST(BL_PC, ss); switch( sg->val2 ) { @@ -11522,32 +11545,32 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns skill_attack(skill_get_type(CR_ACIDDEMONSTRATION), ss, &src->bl, bl, CR_ACIDDEMONSTRATION, sd ? pc_checkskill(sd, CR_ACIDDEMONSTRATION) : sg->skill_lv, tick, 0); break; - + } } break; - + case UNT_FIRE_EXPANSION_SMOKE_POWDER: sc_start(bl, status_skill2sc(GN_FIRE_EXPANSION_SMOKE_POWDER), 100, sg->skill_lv, 1000); break; - + case UNT_FIRE_EXPANSION_TEAR_GAS: sc_start(bl, status_skill2sc(GN_FIRE_EXPANSION_TEAR_GAS), 100, sg->skill_lv, 1000); break; - + case UNT_HELLS_PLANT: if( battle_check_target(&src->bl,bl,BCT_ENEMY) > 0 ) skill_attack(skill_get_type(GN_HELLS_PLANT_ATK), ss, &src->bl, bl, GN_HELLS_PLANT_ATK, sg->skill_lv, tick, 0); if( ss != bl) //The caster is the only one who can step on the Plants, without destroying them sg->limit = DIFF_TICK(tick, sg->tick) + 100; break; - + case UNT_CLOUD_KILL: if(tsc && !tsc->data[type]) status_change_start(bl,type,10000,sg->skill_lv,sg->group_id,0,0,skill_get_time2(sg->skill_id,sg->skill_lv),8); skill_attack(skill_get_type(sg->skill_id),ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); break; - + case UNT_WARMER: if( bl->type == BL_PC && !battle_check_undead(tstatus->race, tstatus->def_ele) && tstatus->race != RC_DEMON ) { int hp = 125 * sg->skill_lv; // Officially is 125 * skill_lv. @@ -11562,35 +11585,34 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns sc_start(bl, SC_WARMER, 100, sg->skill_lv, skill_get_time2(sg->skill_id,sg->skill_lv)); } break; - + case UNT_FIRE_INSIGNIA: case UNT_WATER_INSIGNIA: case UNT_WIND_INSIGNIA: case UNT_EARTH_INSIGNIA: case UNT_ZEPHYR: sc_start(bl,type, 100, sg->skill_lv, sg->interval); - if (!battle_check_undead(tstatus->race, tstatus->def_ele)) { - int hp = tstatus->max_hp / 100; //+1% each 5s - if ((sg->val3) % 5) { //each 5s - if (tstatus->def_ele == skill_get_ele(sg->skill_id,sg->skill_lv)){ - status_heal(bl, hp, 0, 2); - } else if((sg->unit_id == UNT_FIRE_INSIGNIA && tstatus->def_ele == ELE_EARTH) - ||(sg->unit_id == UNT_WATER_INSIGNIA && tstatus->def_ele == ELE_FIRE) - ||(sg->unit_id == UNT_WIND_INSIGNIA && tstatus->def_ele == ELE_WATER) - ||(sg->unit_id == UNT_EARTH_INSIGNIA && tstatus->def_ele == ELE_WIND) - ){ - status_heal(bl, -hp, 0, 0); - } - } - } - sg->val3++; //timer - if (sg->val3 > 5) - sg->val3 = 0; - break; - + if (sg->unit_id != UNT_ZEPHYR && !battle_check_undead(tstatus->race, tstatus->def_ele)) { + int hp = tstatus->max_hp / 100; //+1% each 5s + if ((sg->val3) % 5) { //each 5s + if (tstatus->def_ele == skill_get_ele(sg->skill_id,sg->skill_lv)){ + status_heal(bl, hp, 0, 2); + } else if((sg->unit_id == UNT_FIRE_INSIGNIA && tstatus->def_ele == ELE_EARTH) + ||(sg->unit_id == UNT_WATER_INSIGNIA && tstatus->def_ele == ELE_FIRE) + ||(sg->unit_id == UNT_WIND_INSIGNIA && tstatus->def_ele == ELE_WATER) + ||(sg->unit_id == UNT_EARTH_INSIGNIA && tstatus->def_ele == ELE_WIND) + ){ + status_heal(bl, -hp, 0, 0); + } + } + sg->val3++; //timer + if (sg->val3 > 5) sg->val3 = 0; + } + break; + case UNT_VACUUM_EXTREME: {// TODO: official behavior in gvg area. [malufett] - int sec = sg->limit - DIFF_TICK(tick, sg->tick); + int sec = sg->limit - DIFF_TICK(tick, sg->tick); int range = skill_get_unit_range(sg->skill_id, sg->skill_lv); if( tsc && !tsc->data[type] && @@ -11599,28 +11621,28 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( unit_is_walking(bl) && // wait until target stop walking ( tsc && tsc->data[type] && tsc->data[type]->val4 >= tsc->data[type]->val3-range )) - break; + break; if( tsc && ( !tsc->data[type] || (tsc->data[type] && tsc->data[type]->val4 < 1 ) ) ) break; - if( unit_is_walking(bl) && + if( unit_is_walking(bl) && distance_xy(src->bl.x, src->bl.y, bl->x, bl->y) > range )// going outside of boundaries? then force it to stop unit_stop_walking(bl,1); - if( !unit_is_walking(bl) && + if( !unit_is_walking(bl) && distance_xy(src->bl.x, src->bl.y, bl->x, bl->y) <= range && // only snap if the target is inside the range or src->bl.x != bl->x && src->bl.y != bl->y){// diagonal position parallel to VE's center unit_movepos(bl, src->bl.x, src->bl.y, 0, 0); clif_fixpos(bl); - } + } } break; - + case UNT_FIRE_MANTLE: if( battle_check_target(&src->bl, bl, BCT_ENEMY) ) skill_attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick,0); - break; + break; case UNT_ZENKAI_WATER: case UNT_ZENKAI_LAND: @@ -11629,27 +11651,27 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns if( battle_check_target(&src->bl,bl,BCT_ENEMY) > 0 ){ switch( sg->unit_id ){ case UNT_ZENKAI_WATER: - sc_start(bl, SC_CRYSTALIZE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_FREEZE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_FREEZING, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_CRYSTALIZE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_FREEZE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_FREEZING, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_ZENKAI_LAND: - sc_start(bl, SC_STONE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_POISON, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_STONE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_POISON, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_ZENKAI_FIRE: - sc_start(bl, SC_BURNING, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_BURNING, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); break; case UNT_ZENKAI_WIND: - sc_start(bl, SC_SILENCE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_SLEEP, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); - sc_start(bl, SC_DEEPSLEEP, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_SILENCE, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_SLEEP, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); + sc_start(bl, SC_DEEPSLEEP, sg->val1*5, sg->skill_lv, skill_get_time2(sg->skill_id, sg->skill_lv)); break; } }else sc_start2(bl,type,100,sg->val1,sg->val2,skill_get_time2(sg->skill_id, sg->skill_lv)); break; - + } if (bl->type == BL_MOB && ss != bl) @@ -11673,7 +11695,7 @@ int skill_unit_onout (struct skill_unit *src, struct block_list *bl, unsigned in sc = status_get_sc(bl); type = status_skill2sc(sg->skill_id); sce = (sc && type != -1)?sc->data[type]:NULL; - + if( bl->prev==NULL || (status_isdead(bl) && sg->unit_id != UNT_ANKLESNARE && sg->unit_id != UNT_SPIDERWEB) ) //Need to delete the trap if the source died. return 0; @@ -11763,17 +11785,22 @@ static int skill_unit_onleft (int skill_id, struct block_list *bl, unsigned int case HW_GRAVITATION: case NJ_SUITON: case SC_MAELSTROM: - case SC_BLOODYLUST: case EL_WATER_BARRIER: case EL_ZEPHYR: - case EL_POWER_OF_GAIA: + case EL_POWER_OF_GAIA: case SO_FIRE_INSIGNIA: case SO_WATER_INSIGNIA: case SO_WIND_INSIGNIA: - case SO_EARTH_INSIGNIA: + case SO_EARTH_INSIGNIA: if (sce) status_change_end(bl, type, INVALID_TIMER); break; + case SC_BLOODYLUST: + if (sce) { + status_change_end(bl, type, INVALID_TIMER); + status_set_sp(bl, 0, 0); //set sp to 0 when quitting zone + } + break; case BA_POEMBRAGI: case BA_WHISTLE: @@ -11983,7 +12010,7 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) } break; } - + } return 0; } @@ -12095,7 +12122,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh int i; nullpo_ret(sd); - + if (lv <= 0 || sd->chatID) return 0; if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill ) @@ -12212,15 +12239,15 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh //Can only update state when weapon/arrow info is checked. sd->state.arrow_atk = require.ammo?1:0; - + // perform skill-specific checks (and actions) switch( skill ) { - case SO_SPELLFIST: + case SO_SPELLFIST: if(sd->skillid_old != MG_FIREBOLT && sd->skillid_old != MG_COLDBOLT && sd->skillid_old != MG_LIGHTNINGBOLT){ clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; } - case SA_CASTCANCEL: + case SA_CASTCANCEL: if(sd->ud.skilltimer == INVALID_TIMER) { clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; @@ -12696,7 +12723,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; } - break; + break; case LG_REFLECTDAMAGE: case CR_REFLECTSHIELD: if( sc && sc->data[SC_KYOMU] && rand()%100 < 30){ @@ -12708,7 +12735,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh case KO_HYOUHU_HUBUKI: case KO_KAZEHU_SEIRAN: case KO_DOHU_KOUKAI: - { + { int ttype = skill_get_ele(skill, lv); ARR_FIND(1, 5, i, sd->talisman[i] > 0 && i != ttype); if( (i < 5 && i != ttype) || sd->talisman[ttype] >= 10 ){ @@ -12720,7 +12747,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh case KO_KAIHOU: case KO_ZENKAI: ARR_FIND(1, 6, i, sd->talisman[i] > 0); - if( i > 4 ) { + if( i > 4 ) { clif_skill_fail(sd,skill,USESKILL_FAIL_LEVEL,0); return 0; } @@ -12865,7 +12892,7 @@ int skill_check_condition_castbegin(struct map_session_data* sd, short skill, sh clif_skill_fail(sd, skill, USESKILL_FAIL_CONDITION, 0); return 0; } - break; + break; } if(require.mhp > 0 && get_percentage(status->hp, status->max_hp) > require.mhp) { @@ -12937,7 +12964,7 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor return 0; break; } - + if( sd->skillitem == skill ) // Casting finished (Item skill or Hocus-Pocus) return 1; @@ -13015,7 +13042,7 @@ int skill_check_condition_castend(struct map_session_data* sd, short skill, shor clif_skill_fail(sd,skill,USESKILL_FAIL_THIS_WEAPON,0); return 0; } - + if( require.ammo ) { //Skill requires stuff equipped in the arrow slot. if((i=sd->equip_index[EQI_AMMO]) < 0 || !sd->inventory_data[i] ) { clif_arrow_fail(sd,0); @@ -13163,16 +13190,16 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short req.sp += (status->max_sp * (-sp_rate))/100; if( sd->dsprate != 100 ) req.sp = req.sp * sd->dsprate / 100; - + ARR_FIND(0, ARRAYLENGTH(sd->skillusesprate), i, sd->skillusesprate[i].id == skill); if( i < ARRAYLENGTH(sd->skillusesprate) ) sp_skill_rate_bonus += sd->skillusesprate[i].val; ARR_FIND(0, ARRAYLENGTH(sd->skillusesp), i, sd->skillusesp[i].id == skill); if( i < ARRAYLENGTH(sd->skillusesp) ) req.sp -= sd->skillusesp[i].val; - + req.sp = cap_value(req.sp * sp_skill_rate_bonus / 100, 0, SHRT_MAX); - + if( sc ) { if( sc->data[SC__LAZINESS] ) req.sp += req.sp + sc->data[SC__LAZINESS]->val1 * 10; @@ -13265,7 +13292,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short } if( skill >= HT_SKIDTRAP && skill <= HT_TALKIEBOX && pc_checkskill(sd, RA_RESEARCHTRAP) > 0){ if( (j=pc_search_inventory(sd,req.itemid[i])) < 0 || ( j >= 0 && sd->status.inventory[j].amount < req.amount[i] ) ){ - req.itemid[i] = ITEMID_TRAP_ALLOY; + req.itemid[i] = ITEMID_TRAP_ALLOY; req.amount[i] = 1; } break; @@ -13288,7 +13315,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short req.amount[lv-1] = skill_db[j].amount[lv-1]; break; } - + // Check for cost reductions due to skills & SCs switch(skill) { case MC_MAMMONITE: @@ -13364,7 +13391,7 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, short req.sp -= req.sp * (5 + 5 * pc_checkskill(sd,SO_EL_SYMPATHY)) / 100; break; } - + return req; } @@ -13405,7 +13432,7 @@ int skill_castfix (struct block_list *bl, int skill_id, int skill_lv) { } } } - + } #endif // config cast time multiplier @@ -13413,7 +13440,7 @@ int skill_castfix (struct block_list *bl, int skill_id, int skill_lv) { time = time * battle_config.cast_rate / 100; // return final cast time time = max(time, 0); - + // ShowInfo("Castime castfix = %d\n",time); return time; } @@ -13441,12 +13468,12 @@ int skill_castfix_sc (struct block_list *bl, int time) status_change_end(bl, SC_MEMORIZE, INVALID_TIMER); } if (sc->data[SC_POEMBRAGI]) - time -= time * sc->data[SC_POEMBRAGI]->val2 / 100; + time -= time * sc->data[SC_POEMBRAGI]->val2 / 100; if (sc->data[SC_IZAYOI]) time -= time * 50 / 100; } time = max(time, 0); - + // ShowInfo("Castime castfix_sc = %d\n",time); return time; } @@ -13469,7 +13496,7 @@ int skill_vfcastfix (struct block_list *bl, double time, int skill_id, int skill if(sd && !(skill_get_castnodex(skill_id, skill_lv)&4) ){ // Increases/Decreases fixed/variable cast time of a skill by item/card bonuses. if( sd->bonus.varcastrate < 0 ) VARCAST_REDUCTION(sd->bonus.varcastrate); - for (i = 0; i < ARRAYLENGTH(sd->skillfixcast) && sd->skillfixcast[i].id; i++) + for (i = 0; i < ARRAYLENGTH(sd->skillfixcast) && sd->skillfixcast[i].id; i++) if (sd->skillfixcast[i].id == skill_id){ // bonus2 bSkillFixedCast fixed += sd->skillfixcast[i].val; break; @@ -13519,7 +13546,7 @@ int skill_vfcastfix (struct block_list *bl, double time, int skill_id, int skill if( sc->data[SC_MANDRAGORA] && (skill_id >= SM_BASH && skill_id <= RETURN_TO_ELDICASTES) ) fixed += sc->data[SC_MANDRAGORA]->val1 * 1000 / 2; if (sc->data[SC_IZAYOI] && (skill_id >= NJ_TOBIDOUGU && skill_id <= NJ_ISSEN)) - fixed = 0; + fixed = 0; } if( sd && !(skill_get_castnodex(skill_id, skill_lv)&4) ){ @@ -13533,7 +13560,7 @@ int skill_vfcastfix (struct block_list *bl, double time, int skill_id, int skill time = (1 - sqrt( ((float)(status_get_dex(bl)*2 + status_get_int(bl)) / battle_config.vcast_stat_scale) )) * time; // underflow checking/capping time = max(time, 0) + (1 - (float)min(fixcast_r, 100) / 100) * fixed; - + // ShowInfo("Casttime vfcastfix = %d\n",time); return (int)time; } @@ -13617,7 +13644,7 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv) if (sc->data[SC_WIND_INSIGNIA] && sc->data[SC_WIND_INSIGNIA]->val1 == 3 && (skill_get_ele(skill_id, skill_lv) == ELE_WIND)) time /= 2; // After Delay of Wind element spells reduced by 50%. } - + } if( !(delaynodex&4) && sd && sd->delayrate != 100 ) @@ -13629,7 +13656,7 @@ int skill_delayfix (struct block_list *bl, int skill_id, int skill_lv) //min delay time = max(time, status_get_amotion(bl)); // Delay can never be below amotion [Playtester] time = max(time, battle_config.min_skill_delay_limit); - + // ShowInfo("Delay delayfix = %d\n",time); return time; } @@ -13826,7 +13853,7 @@ void skill_repairweapon (struct map_session_data *sd, int idx) { if ( !( target_sd = map_id2sd(sd->menuskill_val) ) ) //Failed.... return; - + if( idx == 0xFFFF ) // No item selected ('Cancel' clicked) return; if( idx < 0 || idx >= MAX_INVENTORY ) @@ -13849,17 +13876,17 @@ void skill_repairweapon (struct map_session_data *sd, int idx) { clif_skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0); return; } - + clif_skill_nodamage(&sd->bl,&target_sd->bl,sd->menuskill_id,1,1); - + item->attribute = 0;/* clear broken state */ - + clif_equiplist(target_sd); - + pc_delitem(sd,pc_search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME); - + clif_item_repaireffect(sd,idx,0); - + if( sd != target_sd ) clif_item_repaireffect(target_sd,idx,0); } @@ -13913,7 +13940,7 @@ void skill_weaponrefine (struct map_session_data *sd, int idx) pc_delitem(sd, i, 1, 0, 0, LOG_TYPE_OTHER); if (per > rnd() % 100) { - log_pick_pc(sd, LOG_TYPE_OTHER, -1, item); + log_pick_pc(sd, LOG_TYPE_OTHER, -1, item); item->refine++; log_pick_pc(sd, LOG_TYPE_OTHER, 1, item); if(item->equip) { @@ -14216,7 +14243,11 @@ int skill_clear_group (struct block_list *bl, int flag) case SO_WARMER: if( flag&8 ) group[count++]= ud->skillunit[i]; - break; + break; + case SC_BLOODYLUST: + if (flag & 32) + group[count++] = ud->skillunit[i]; + break; default: if (flag&2 && skill_get_inf2(ud->skillunit[i]->skill_id)&INF2_TRAP) group[count++]= ud->skillunit[i]; @@ -14247,7 +14278,8 @@ struct skill_unit_group *skill_locate_element_field(struct block_list *bl) case SA_LANDPROTECTOR: case NJ_SUITON: case SO_WARMER: - case SO_CLOUD_KILL: + case SO_CLOUD_KILL: + case SC_BLOODYLUST: return ud->skillunit[i]; } } @@ -14321,7 +14353,7 @@ int skill_detonator(struct block_list *bl, va_list ap) clif_changetraplook(bl,unit_id == UNT_FIRINGTRAP ? UNT_DUMMYSKILL : UNT_USED_TRAPS); unit->group->unit_id = UNT_USED_TRAPS; - unit->group->limit = DIFF_TICK(gettick(),unit->group->tick) + + unit->group->limit = DIFF_TICK(gettick(),unit->group->tick) + (unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : 1500) ); break; } @@ -14603,7 +14635,7 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s if( i == 8 ) wall = false; } - + if( sce ) { if( !wall ) @@ -14722,7 +14754,7 @@ int skill_delunit (struct skill_unit* unit) case RA_ELECTRICSHOCKER: { struct block_list* target = map_id2bl(group->val2); if( target ) - status_change_end(target, SC_ELECTRICSHOCKER, INVALID_TIMER); + status_change_end(target, SC_ELECTRICSHOCKER, INVALID_TIMER); } break; case SC_MAELSTROM: @@ -14849,7 +14881,7 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li struct block_list* src; struct unit_data *ud; int i,j; - + if( group == NULL ) { ShowDebug("skill_delunitgroup: group is NULL (source=%s:%d, %s)! Please report this! (#3504)\n", file, line, func); @@ -15184,7 +15216,7 @@ static int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) skill_delunit(unit); break; } - + case UNT_BANDING: { struct block_list *src = map_id2bl(group->src_id); @@ -15461,7 +15493,7 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int m, int dx, i if( group->unit_id == UNT_ICEWALL || group->unit_id == UNT_WALLOFTHORN ) return 0; //Icewalls and Wall of Thorns don't get knocked back - + m_flag = (int *) aCalloc(group->unit_count, sizeof(int)); // m_flag // 0: Neither of the following (skill_unit_onplace & skill_unit_onout are needed) @@ -15552,7 +15584,7 @@ int skill_can_produce_mix (struct map_session_data *sd, int nameid, int trigger, break; } } - + if( i >= MAX_SKILL_PRODUCE_DB ) return 0; @@ -15606,7 +15638,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in nullpo_ret(sd); status = status_get_status_data(&sd->bl); - + if( sd->skillid_old == skill_id ) skilllv = sd->skilllv_old; @@ -15648,11 +15680,11 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in if( skill_id == RK_RUNEMASTERY ) { int temp_qty, skill_lv = pc_checkskill(sd,skill_id); data = itemdb_search(nameid); - + if( skill_lv == 10 ) temp_qty = 1 + rnd()%3; else if( skill_lv > 5 ) temp_qty = 1 + rnd()%2; else temp_qty = 1; - + if (data->stack.inventory) { for( i = 0; i < MAX_INVENTORY; i++ ) { if( sd->status.inventory[i].nameid == nameid ) { @@ -15790,35 +15822,35 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in make_per = 3000 + 500 * pc_checkskill(sd,GC_RESEARCHNEWPOISON); qty = 1+rnd()%pc_checkskill(sd,GC_RESEARCHNEWPOISON); break; - case GN_CHANGEMATERIAL: + case GN_CHANGEMATERIAL: for(i=0; i<MAX_SKILL_PRODUCE_DB; i++) if( skill_changematerial_db[i].itemid == nameid ){ make_per = skill_changematerial_db[i].rate * 10; break; } - break; + break; case GN_S_PHARMACY: { int difficulty = 0; - + difficulty = (620 - 20 * skilllv);// (620 - 20 * Skill Level) - make_per = status->int_ + status->dex/2 + status->luk + sd->status.job_level + (30+rnd()%120) + // (Caster�s INT) + (Caster�s DEX / 2) + (Caster�s LUK) + (Caster�s Job Level) + Random number between (30 ~ 150) + - (sd->status.base_level-100) + pc_checkskill(sd, AM_LEARNINGPOTION) + pc_checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster�s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10) - + make_per = status->int_ + status->dex/2 + status->luk + sd->status.job_level + (30+rnd()%120) + // (Caster?s INT) + (Caster?s DEX / 2) + (Caster?s LUK) + (Caster?s Job Level) + Random number between (30 ~ 150) + + (sd->status.base_level-100) + pc_checkskill(sd, AM_LEARNINGPOTION) + pc_checkskill(sd, CR_FULLPROTECTION)*(4+rnd()%6); // (Caster?s Base Level - 100) + (Potion Research x 5) + (Full Chemical Protection Skill Level) x (Random number between 4 ~ 10) + switch(nameid){// difficulty factor - case 12422: case 12425: + case 12422: case 12425: case 12428: difficulty += 10; break; case 6212: case 12426: difficulty += 15; break; - case 13264: case 12423: + case 13264: case 12423: case 12427: case 12436: difficulty += 20; break; - case 6210: case 6211: + case 6210: case 6211: case 12437: difficulty += 30; break; @@ -15844,8 +15876,8 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in case GN_MIX_COOKING: { int difficulty = 30 + rnd()%120; // Random number between (30 ~ 150) - - make_per = sd->status.job_level / 4 + status->luk / 2 + status->dex / 3; // (Caster�s Job Level / 4) + (Caster�s LUK / 2) + (Caster�s DEX / 3) + + make_per = sd->status.job_level / 4 + status->luk / 2 + status->dex / 3; // (Caster?s Job Level / 4) + (Caster?s LUK / 2) + (Caster?s DEX / 3) qty = ~(5 + rnd()%5) + 1; switch(nameid){// difficulty factor @@ -15860,7 +15892,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in case 13263: difficulty += 15; break; - case 13264: + case 13264: difficulty += 20; break; } @@ -15875,7 +15907,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in ;// Food/Bomb creation fails. else if( make_per >= 30 && make_per < difficulty) qty = 5; - + if( qty < 0 || (skilllv == 1 && make_per < difficulty)){ qty = ~qty + 1; make_per = 0; @@ -15949,7 +15981,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in case AM_PHARMACY: case AM_TWILIGHT1: case AM_TWILIGHT2: - case AM_TWILIGHT3: + case AM_TWILIGHT3: flag = battle_config.produce_item_name_input&0x2; break; case AL_HOLYWATER: @@ -16043,7 +16075,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in case GC_CREATENEWPOISON: clif_produceeffect(sd,2,nameid); clif_misceffect(&sd->bl,5); - break; + break; default: //Those that don't require a skill? if( skill_produce_db[idx].itemlv > 10 && skill_produce_db[idx].itemlv <= 20) { //Cooking items. @@ -16071,7 +16103,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in break; } if( k ){ - clif_msg_skill(sd,skill_id,0x627); + clif_msg_skill(sd,skill_id,0x627); return 1; } } else if (tmp_item.amount) { //Success @@ -16080,7 +16112,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } if( skill_id == GN_MIX_COOKING || skill_id == GN_MAKEBOMB || skill_id == GN_S_PHARMACY ) - clif_msg_skill(sd,skill_id,0x627); + clif_msg_skill(sd,skill_id,0x627); return 1; } } @@ -16138,7 +16170,7 @@ int skill_produce_mix (struct map_session_data *sd, int skill_id, int nameid, in case GN_S_PHARMACY: case GN_CHANGEMATERIAL: clif_msg_skill(sd,skill_id,0x628); - break; + break; default: if( skill_produce_db[idx].itemlv > 10 && skill_produce_db[idx].itemlv <= 20 ) { //Cooking items. @@ -16285,21 +16317,21 @@ int skill_magicdecoy(struct map_session_data *sd, int nameid) { int skill_spellbook (struct map_session_data *sd, int nameid) { int i, max_preserve, skill_id, point; struct status_change *sc; - + nullpo_ret(sd); sc = status_get_sc(&sd->bl); status_change_end(&sd->bl, SC_STOP, INVALID_TIMER); for(i=SC_SPELLBOOK1; i <= SC_MAXSPELLBOOK; i++) if( sc && !sc->data[i] ) break; - if( i > SC_MAXSPELLBOOK ) - { + if( i > SC_MAXSPELLBOOK ) + { clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_READING, 0); return 0; } ARR_FIND(0,MAX_SKILL_SPELLBOOK_DB,i,skill_spellbook_db[i].nameid == nameid); // Search for information of this item - if( i == MAX_SKILL_SPELLBOOK_DB ) return 0; + if( i == MAX_SKILL_SPELLBOOK_DB ) return 0; if( !pc_checkskill(sd, (skill_id = skill_spellbook_db[i].skillid)) ) { // User don't know the skill @@ -16313,7 +16345,7 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { if( sc && sc->data[SC_READING_SB] ){ if( (sc->data[SC_READING_SB]->val2 + point) > max_preserve ) - { + { clif_skill_fail(sd, WL_READING_SB, USESKILL_FAIL_SPELLBOOK_PRESERVATION_POINT, 0); return 0; } @@ -16334,7 +16366,7 @@ int skill_spellbook (struct map_session_data *sd, int nameid) { int skill_select_menu(struct map_session_data *sd,int skill_id) { int id, lv, prob, aslvl = 0; nullpo_ret(sd); - + if (sd->sc.data[SC_STOP]) { aslvl = sd->sc.data[SC_STOP]->val1; status_change_end(&sd->bl,SC_STOP,INVALID_TIMER); @@ -16354,29 +16386,29 @@ int skill_select_menu(struct map_session_data *sd,int skill_id) { } int skill_elementalanalysis(struct map_session_data* sd, int n, int skill_lv, unsigned short* item_list) { int i; - + nullpo_ret(sd); nullpo_ret(item_list); - + if( n <= 0 ) return 1; - + for( i = 0; i < n; i++ ) { int nameid, add_amount, del_amount, idx, product, flag; struct item tmp_item; - + idx = item_list[i*2+0]-2; del_amount = item_list[i*2+1]; - + if( skill_lv == 2 ) del_amount -= (del_amount % 10); add_amount = (skill_lv == 1) ? del_amount * (5 + rnd()%5) : del_amount / 10 ; - + if( (nameid = sd->status.inventory[idx].nameid) <= 0 || del_amount > sd->status.inventory[idx].amount ) { clif_skill_fail(sd,SO_EL_ANALYSIS,USESKILL_FAIL_LEVEL,0); return 1; } - + switch( nameid ) { // Level 1 case 994: product = 990; break; // Flame Heart -> Red Blood. @@ -16402,8 +16434,8 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, int skill_lv, un clif_skill_fail(sd,SO_EL_ANALYSIS,USESKILL_FAIL_LEVEL,0); return 1; } - - + + memset(&tmp_item,0,sizeof(tmp_item)); tmp_item.nameid = product; tmp_item.amount = add_amount; @@ -16415,15 +16447,15 @@ int skill_elementalanalysis(struct map_session_data* sd, int n, int skill_lv, un map_addflooritem(&tmp_item,tmp_item.amount,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0); } } - + } - + return 0; } int skill_changematerial(struct map_session_data *sd, int n, unsigned short *item_list) { int i, j, k, c, p = 0, nameid, amount; - + nullpo_ret(sd); nullpo_ret(item_list); @@ -16474,7 +16506,7 @@ static int skill_destroy_trap( struct block_list *bl, va_list ap ) { struct skill_unit *su = (struct skill_unit *)bl; struct skill_unit_group *sg; unsigned int tick; - + nullpo_ret(su); tick = va_arg(ap, unsigned int); @@ -16643,13 +16675,13 @@ void skill_usave_add(struct map_session_data * sd, int skill_num, int skill_lv) if( idb_exists(skillusave_db,sd->status.char_id) ) { idb_remove(skillusave_db,sd->status.char_id); } - + CREATE( sus, struct skill_usave, 1 ); idb_put( skillusave_db, sd->status.char_id, sus ); sus->skill_num = skill_num; sus->skill_lv = skill_lv; - + return; } void skill_usave_trigger(struct map_session_data *sd) { @@ -16658,11 +16690,11 @@ void skill_usave_trigger(struct map_session_data *sd) { if( ! (sus = idb_get(skillusave_db,sd->status.char_id)) ) { return; } - + skill_unitsetting(&sd->bl,sus->skill_num,sus->skill_lv,sd->bl.x,sd->bl.y,0); idb_remove(skillusave_db,sd->status.char_id); - + return; } /* @@ -16767,7 +16799,7 @@ void skill_init_unit_layout (void) memcpy(skill_unit_layout[pos].dx,dx,sizeof(dx)); memcpy(skill_unit_layout[pos].dy,dy,sizeof(dy)); } - } else { + } else { switch (i) { case MG_FIREWALL: case WZ_ICEWALL: @@ -17011,7 +17043,7 @@ void skill_init_unit_layout (void) int skill_block_check(struct block_list *bl, sc_type type , int skillid) { int inf = 0; - struct status_change *sc = status_get_sc(bl); + struct status_change *sc = status_get_sc(bl); if( !sc || !bl || skillid < 1 ) return 0; // Can do it @@ -17071,16 +17103,16 @@ int skill_block_check(struct block_list *bl, sc_type type , int skillid) { int skill_get_elemental_type( int skill_id , int skill_lv ) { int type = 0; - + switch( skill_id ) { case SO_SUMMON_AGNI: type = 2114; break; case SO_SUMMON_AQUA: type = 2117; break; case SO_SUMMON_VENTUS: type = 2120; break; case SO_SUMMON_TERA: type = 2123; break; } - + type += skill_lv - 1; - + return type; } @@ -17100,7 +17132,7 @@ void skill_cooldown_load(struct map_session_data * sd) {// no skill cooldown is associated with this character return; } - + // process each individual cooldown associated with the character for( i = 0; i < cd->cursor; i++ ) { @@ -17451,7 +17483,7 @@ static bool skill_parse_row_magicmushroomdb(char* split[], int column, int curre static bool skill_parse_row_reproducedb(char* split[], int column, int current) { int skillid = atoi(split[0]); - + skillid = skill_get_index(skillid); if( !skillid ) return false; diff --git a/src/map/skill.h b/src/map/skill.h index 5250af1f6..78d83e100 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -194,6 +194,7 @@ enum { UF_ENSEMBLE = 0x0200, // Duet UF_SONG = 0x0400, // Song UF_DUALMODE = 0x0800, // Spells should trigger both ontimer and onplace/onout/onleft effects. + UF_RANGEDSINGLEUNIT = 0x2000 // hack for ranged layout, only display center }; // Create Database item diff --git a/src/map/status.c b/src/map/status.c index 695548e88..e8bc3bc5e 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -174,13 +174,13 @@ static void set_sc(int skill, sc_type sc, int icon, unsigned int flag) void initChangeTables(void) { int i; - + for (i = 0; i < SC_MAX; i++) StatusIconChangeTable[i] = SI_BLANK; - + for (i = 0; i < MAX_SKILL; i++) SkillStatusChangeTable[i] = SC_NONE; - + for (i = 0; i < SI_MAX; i++) StatusRelevantBLTypes[i] = BL_PC; @@ -394,9 +394,9 @@ void initChangeTables(void) { set_sc( TK_READYCOUNTER , SC_READYCOUNTER , SI_READYCOUNTER , SCB_NONE ); set_sc( TK_DODGE , SC_DODGE , SI_DODGE , SCB_NONE ); set_sc( TK_SPTIME , SC_EARTHSCROLL , SI_EARTHSCROLL , SCB_NONE ); - add_sc( TK_SEVENWIND , SC_SEVENWIND ); - set_sc( TK_SEVENWIND , SC_GHOSTWEAPON , SI_GHOSTWEAPON , SCB_ATK_ELE ); - set_sc( TK_SEVENWIND , SC_SHADOWWEAPON , SI_SHADOWWEAPON , SCB_ATK_ELE ); + add_sc( TK_SEVENWIND , SC_SEVENWIND ); + set_sc( TK_SEVENWIND , SC_GHOSTWEAPON , SI_GHOSTWEAPON , SCB_ATK_ELE ); + set_sc( TK_SEVENWIND , SC_SHADOWWEAPON , SI_SHADOWWEAPON , SCB_ATK_ELE ); set_sc( SG_SUN_WARM , SC_WARM , SI_WARM , SCB_NONE ); add_sc( SG_MOON_WARM , SC_WARM ); add_sc( SG_STAR_WARM , SC_WARM ); @@ -521,7 +521,7 @@ void initChangeTables(void) { set_sc( GD_BATTLEORDER , SC_BATTLEORDERS , SI_BLANK , SCB_STR|SCB_INT|SCB_DEX ); set_sc( GD_REGENERATION , SC_REGENERATION , SI_BLANK , SCB_REGEN ); - + /** * Rune Knight **/ @@ -624,7 +624,7 @@ void initChangeTables(void) { set_sc( SC_STRIPACCESSARY , SC__STRIPACCESSORY , SI_STRIPACCESSARY , SCB_DEX|SCB_INT|SCB_LUK ); set_sc_with_vfx( SC_MANHOLE , SC__MANHOLE , SI_MANHOLE , SCB_NONE ); add_sc( SC_CHAOSPANIC , SC_CONFUSION ); - set_sc( SC_BLOODYLUST , SC__BLOODYLUST , SI_BLOODYLUST , SCB_DEF|SCB_DEF2|SCB_BATK|SCB_WATK ); + set_sc_with_vfx( SC_BLOODYLUST , SC__BLOODYLUST , SI_BLOODYLUST , SCB_DEF | SCB_DEF2 | SCB_MDEF | SCB_MDEF2 | SCB_FLEE | SCB_SPEED | SCB_ASPD | SCB_MAXHP | SCB_REGEN ); /** * Sura **/ @@ -673,7 +673,7 @@ void initChangeTables(void) { set_sc( SO_FIRE_INSIGNIA , SC_FIRE_INSIGNIA , SI_FIRE_INSIGNIA , SCB_MATK | SCB_BATK | SCB_WATK | SCB_ATK_ELE | SCB_REGEN ); set_sc( SO_WATER_INSIGNIA , SC_WATER_INSIGNIA , SI_WATER_INSIGNIA , SCB_WATK | SCB_ATK_ELE | SCB_REGEN ); set_sc( SO_WIND_INSIGNIA , SC_WIND_INSIGNIA , SI_WIND_INSIGNIA , SCB_WATK | SCB_ATK_ELE | SCB_REGEN ); - set_sc( SO_EARTH_INSIGNIA , SC_EARTH_INSIGNIA , SI_EARTH_INSIGNIA , SCB_MDEF|SCB_DEF|SCB_MAXHP|SCB_MAXSP|SCB_WATK | SCB_ATK_ELE | SCB_REGEN ); + set_sc( SO_EARTH_INSIGNIA , SC_EARTH_INSIGNIA , SI_EARTH_INSIGNIA , SCB_MDEF|SCB_DEF|SCB_MAXHP|SCB_MAXSP|SCB_WATK | SCB_ATK_ELE | SCB_REGEN ); /** * Genetic **/ @@ -727,14 +727,14 @@ void initChangeTables(void) { set_sc( OB_ZANGETSU , SC_ZANGETSU , SI_ZANGETSU , SCB_MATK|SCB_BATK ); set_sc_with_vfx( OB_AKAITSUKI , SC_AKAITSUKI , SI_AKAITSUKI , SCB_NONE ); set_sc( OB_OBOROGENSOU , SC_GENSOU , SI_GENSOU , SCB_NONE ); - + add_sc( MH_STAHL_HORN , SC_STUN ); set_sc( MH_ANGRIFFS_MODUS , SC_ANGRIFFS_MODUS , SI_ANGRIFFS_MODUS , SCB_BATK|SCB_WATK|SCB_DEF|SCB_FLEE ); set_sc( MH_GOLDENE_FERSE , SC_GOLDENE_FERSE , SI_GOLDENE_FERSE , SCB_SPEED|SCB_FLEE|SCB_ATK_ELE ); add_sc( MH_LAVA_SLIDE , SC_BURNING ); add_sc( MH_POISON_MIST , SC_BLIND ); set_sc( MH_ERASER_CUTTER , SC_ERASER_CUTTER , SI_BLANK , SCB_NONE ); - + // Storing the target job rather than simply SC_SPIRIT simplifies code later on. SkillStatusChangeTable[SL_ALCHEMIST] = (sc_type)MAPID_ALCHEMIST, SkillStatusChangeTable[SL_MONK] = (sc_type)MAPID_MONK, @@ -889,7 +889,7 @@ void initChangeTables(void) { StatusIconChangeTable[SC_CURSED_SOIL] = SI_CURSED_SOIL; StatusIconChangeTable[SC_UPHEAVAL] = SI_UPHEAVAL; StatusIconChangeTable[SC_PUSH_CART] = SI_ON_PUSH_CART; - + //Other SC which are not necessarily associated to skills. StatusChangeFlagTable[SC_ASPDPOTION0] = SCB_ASPD; StatusChangeFlagTable[SC_ASPDPOTION1] = SCB_ASPD; @@ -968,16 +968,16 @@ void initChangeTables(void) { StatusChangeFlagTable[SC_LIFE_FORCE_F] |= SCB_MAXSP; StatusChangeFlagTable[SC_EXTRACT_WHITE_POTION_Z] |= SCB_REGEN; StatusChangeFlagTable[SC_VITATA_500] |= SCB_REGEN; - StatusChangeFlagTable[SC_EXTRACT_SALAMINE_JUICE] |= SCB_ASPD; + StatusChangeFlagTable[SC_EXTRACT_SALAMINE_JUICE] |= SCB_ASPD; #ifdef RENEWAL_EDP // renewal EDP increases your weapon atk StatusChangeFlagTable[SC_EDP] |= SCB_WATK; #endif - + if( !battle_config.display_hallucination ) //Disable Hallucination. StatusIconChangeTable[SC_HALLUCINATION] = SI_BLANK; - + /* StatusChangeState (SCS_) NOMOVE */ StatusChangeStateTable[SC_ANKLE] |= SCS_NOMOVE; StatusChangeStateTable[SC_AUTOCOUNTER] |= SCS_NOMOVE; @@ -1004,7 +1004,7 @@ void initChangeTables(void) { StatusChangeStateTable[SC_CAMOUFLAGE] |= SCS_NOMOVE|SCS_NOMOVECOND; StatusChangeStateTable[SC_MEIKYOUSISUI] |= SCS_NOMOVE; StatusChangeStateTable[SC_KAGEHUMI] |= SCS_NOMOVE; - + /* StatusChangeState (SCS_) NOPICKUPITEMS */ StatusChangeStateTable[SC_HIDING] |= SCS_NOPICKITEM; StatusChangeStateTable[SC_CLOAKING] |= SCS_NOPICKITEM; @@ -1022,6 +1022,7 @@ void initChangeTables(void) { StatusChangeStateTable[SC_SILENCE] |= SCS_NOCAST; StatusChangeStateTable[SC_STEELBODY] |= SCS_NOCAST; StatusChangeStateTable[SC_BERSERK] |= SCS_NOCAST; + StatusChangeStateTable[SC__BLOODYLUST] |= SCS_NOCAST; StatusChangeStateTable[SC_OBLIVIONCURSE] |= SCS_NOCAST; StatusChangeStateTable[SC_WHITEIMPRISON] |= SCS_NOCAST; StatusChangeStateTable[SC__INVISIBILITY] |= SCS_NOCAST; @@ -1031,15 +1032,15 @@ void initChangeTables(void) { StatusChangeStateTable[SC_SATURDAYNIGHTFEVER] |= SCS_NOCAST; StatusChangeStateTable[SC_CURSEDCIRCLE_TARGET] |= SCS_NOCAST; StatusChangeStateTable[SC_SILENCE] |= SCS_NOCAST; - + } static void initDummyData(void) { memset(&dummy_status, 0, sizeof(dummy_status)); - dummy_status.hp = - dummy_status.max_hp = - dummy_status.max_sp = + dummy_status.hp = + dummy_status.max_hp = + dummy_status.max_sp = dummy_status.str = dummy_status.agi = dummy_status.vit = @@ -1063,7 +1064,7 @@ static inline void status_cpy(struct status_data* a, const struct status_data* b } //Sets HP to given value. Flag is the flag passed to status_heal in case -//final value is higher than current (use 2 to make a healing effect display +//final value is higher than current (use 2 to make a healing effect display //on players) It will always succeed (overrides Berserk block), but it can't kill. int status_set_hp(struct block_list *bl, unsigned int hp, int flag) { @@ -1081,7 +1082,7 @@ int status_set_hp(struct block_list *bl, unsigned int hp, int flag) } //Sets SP to given value. Flag is the flag passed to status_heal in case -//final value is higher than current (use 2 to make a healing effect display +//final value is higher than current (use 2 to make a healing effect display //on players) int status_set_sp(struct block_list *bl, unsigned int sp, int flag) { @@ -1214,6 +1215,8 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s status_change_end(target, SC_RAISINGDRAGON, INVALID_TIMER); if (sc->data[SC_SATURDAYNIGHTFEVER] && status->hp <= 100) status_change_end(target, SC_SATURDAYNIGHTFEVER, INVALID_TIMER); + if (sc->data[SC__BLOODYLUST] && status->hp <= 100) + status_change_end(target, SC__BLOODYLUST, INVALID_TIMER); } switch (target->type) { @@ -1272,7 +1275,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s memset(®en->ssregen->tick, 0, sizeof(regen->ssregen->tick)); } } - + if( sc && sc->data[SC_KAIZEL] && !map_flag_gvg(target->m) ) { //flag&8 = disable Kaizel int time = skill_get_time2(SL_KAIZEL,sc->data[SC_KAIZEL]->val1); @@ -1285,7 +1288,7 @@ int status_damage(struct block_list *src,struct block_list *target,int hp, int s clif_skill_nodamage(target,target,ALL_RESURRECTION,1,1); sc_start(target,status_skill2sc(PR_KYRIE),100,10,time); - if( target->type == BL_MOB ) + if( target->type == BL_MOB ) ((TBL_MOB*)target)->state.rebirth = 1; return hp+sp; @@ -1343,7 +1346,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag) } if(hp) { - if( sc && sc->data[SC_BERSERK] ) { + if( sc && (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) ) { if( flag&1 ) flag &= ~2; else @@ -1405,7 +1408,7 @@ int status_percent_change(struct block_list *src,struct block_list *target,signe //Change the equation when the values are high enough to discard the //imprecision in exchange of overflow protection [Skotlex] - //Also add 100% checks since those are the most used cases where we don't + //Also add 100% checks since those are the most used cases where we don't //want aproximation errors. if (hp_rate > 99) hp = status->hp; @@ -1476,7 +1479,7 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per hp = status->max_hp - status->hp; else if (per_hp && !hp) hp = 1; - + if(sp > status->max_sp - status->sp) sp = status->max_sp - status->sp; else if (per_sp && !sp) @@ -1503,7 +1506,7 @@ int status_revive(struct block_list *bl, unsigned char per_hp, unsigned char per * 1 - Cast bar is done. * 2 - Skill already pulled off, check is due to ground-based skills or splash-damage ones. * src MAY be null to indicate we shouldn't check it, this is a ground-based skill attack. - * target MAY Be null, in which case the checks are only to see + * target MAY Be null, in which case the checks are only to see * whether the source can cast or not the skill on the ground. *------------------------------------------*/ int status_check_skilluse(struct block_list *src, struct block_list *target, int skill_num, int flag) @@ -1520,12 +1523,12 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if (!skill_num) { //Normal attack checks. if (!(status->mode&MD_CANATTACK)) return 0; //This mode is only needed for melee attacking. - //Dead state is not checked for skills as some skills can be used + //Dead state is not checked for skills as some skills can be used //on dead characters, said checks are left to skill.c [Skotlex] if (target && status_isdead(target)) return 0; if( src && (sc = status_get_sc(src)) && sc->data[SC_CRYSTALIZE] && src->type != BL_MOB) - return 0; + return 0; } switch( skill_num ) { @@ -1555,9 +1558,9 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if ( src ) sc = status_get_sc(src); if( sc && sc->count ) { - + if( sc->opt1 >0 && (sc->opt1 != OPT1_CRYSTALIZE && src->type != BL_MOB) && sc->opt1 != OPT1_BURNING && skill_num != SR_GENTLETOUCH_CURE ) { //Stuned/Frozen/etc - if (flag != 1) //Can't cast, casted stuff can't damage. + if (flag != 1) //Can't cast, casted stuff can't damage. return 0; if (!(skill_get_inf(skill_num)&INF_GROUND_SKILL)) return 0; //Targetted spells can't come off. @@ -1676,7 +1679,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int return 1; tsc = status_get_sc(target); - + if(tsc && tsc->count) { /* attacks in invincible are capped to 1 damage and handled in batte.c; allow spell break and eske for sealed shrine GDB when in INVINCIBLE state. */ if( tsc->data[SC_INVINCIBLE] && !tsc->data[SC_INVINCIBLEOFF] && skill_num && !(skill_num&(SA_SPELLBREAKER|SL_SKE)) ) @@ -1692,11 +1695,11 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int //If targetting, cloak+hide protect you, otherwise only hiding does. hide_flag = flag?OPTION_HIDE:(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK); - + //You cannot hide from ground skills. if( skill_get_ele(skill_num,1) == ELE_EARTH ) //TODO: Need Skill Lv here :/ hide_flag &= ~OPTION_HIDE; - + switch( target->type ) { case BL_PC: { struct map_session_data *sd = (TBL_PC*) target; @@ -1719,7 +1722,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if (status->mode&MD_LOOTER) return 1; return 0; - case BL_HOM: + case BL_HOM: case BL_MER: case BL_ELEM: if( target->type == BL_HOM && skill_num && battle_config.hom_setting&0x1 && skill_get_inf(skill_num)&INF_SUPPORT_SKILL && battle_get_master(target) != src ) @@ -1734,7 +1737,7 @@ int status_check_skilluse(struct block_list *src, struct block_list *target, int if( tsc->option&hide_flag && !(status->mode&(MD_BOSS|MD_DETECTOR))) return 0; if( tsc->data[SC_STEALTHFIELD] && !(status->mode&MD_BOSS) ) - return 0; + return 0; } } return 1; @@ -1790,10 +1793,10 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat switch( sd->weapontype2 ){ // adjustment for dual weilding case W_DAGGER: mod = 0; break; // 0, 1, 1 - case W_1HSWORD: + case W_1HSWORD: case W_1HAXE: mod = 1; if( (sd->class_&MAPID_THIRDMASK) == MAPID_GUILLOTINE_CROSS ) // 0, 2, 3 - mod = sd->weapontype2 / W_1HSWORD + W_1HSWORD / sd->weapontype2 ; + mod = sd->weapontype2 / W_1HSWORD + W_1HSWORD / sd->weapontype2 ; } amotion = ( sd->status.weapon < MAX_WEAPON_TYPE && mod < 0 ) @@ -1801,7 +1804,7 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat : ((aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2] // dual-wield + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2]) * 6 / 10 + 10 * mod - aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2] - + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype1]); + + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype1]); if ( sd->status.shield ) amotion += ( 2000 - aspd_base[pc_class2idx(sd->status.class_)][W_FIST] ) + @@ -1812,7 +1815,7 @@ int status_base_amotion_pc(struct map_session_data* sd, struct status_data* stat amotion = (sd->status.weapon < MAX_WEAPON_TYPE) ? (aspd_base[pc_class2idx(sd->status.class_)][sd->status.weapon]) // single weapon : (aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype1] + aspd_base[pc_class2idx(sd->status.class_)][sd->weapontype2])*7/10; // dual-wield - + // percentual delay reduction from stats amotion -= amotion * (4*status->agi + status->dex)/1000; #endif @@ -1837,7 +1840,7 @@ static unsigned short status_base_atk(const struct block_list *bl, const struct if (bl->type == BL_PC) switch(((TBL_PC*)bl)->status.weapon){ case W_BOW: - case W_MUSICAL: + case W_MUSICAL: case W_WHIP: case W_REVOLVER: case W_RIFLE: @@ -1866,7 +1869,7 @@ static unsigned short status_base_atk(const struct block_list *bl, const struct str += dstr*dstr; if (bl->type == BL_PC) #ifdef RENEWAL - str = (rstr*10 + dex*10/5 + status->luk*10/3 + ((TBL_PC*)bl)->status.base_level*10/4)/10; + str = (rstr*10 + dex*10/5 + status->luk*10/3 + ((TBL_PC*)bl)->status.base_level*10/4)/10; #else str+= dex/5 + status->luk/5; #endif @@ -1902,7 +1905,7 @@ void status_calc_misc(struct block_list *bl, struct status_data *status, int lev { //Non players get the value set, players need to stack with previous bonuses. if( bl->type != BL_PC ) - status->batk = + status->batk = status->hit = status->flee = status->def2 = status->mdef2 = status->cri = status->flee2 = 0; @@ -1977,7 +1980,7 @@ int status_calc_mob_(struct mob_data* md, bool first) //Check if we need custom base-status if (battle_config.mobs_level_up && md->level > md->db->lv) flag|=1; - + if (md->special_state.size) flag|=2; @@ -2186,7 +2189,7 @@ int status_calc_pet_(struct pet_data *pd, bool first) if (!battle_config.pet_lv_rate && pd->pet.level != pd->db->lv) pd->pet.level = pd->db->lv; } - + //Support rate modifier (1000 = 100%) pd->rate_fix = 1000*(pd->pet.intimate - battle_config.pet_support_min_friendly)/(1000- battle_config.pet_support_min_friendly) +500; if(battle_config.pet_support_rate != 100) @@ -2280,7 +2283,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) b_max_weight = sd->max_weight; b_cart_weight_max = sd->cart_weight_max; - pc_calc_skilltree(sd); // �X�L���c��?�̌v�Z + pc_calc_skilltree(sd); // SkillTree calculation sd->max_weight = max_weight_base[pc_class2idx(sd->status.class_)]+sd->status.str*300; @@ -2333,7 +2336,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) + sizeof(sd->weapon_coma_race) + sizeof(sd->weapon_atk) + sizeof(sd->weapon_atk_rate) - + sizeof(sd->arrow_addele) + + sizeof(sd->arrow_addele) + sizeof(sd->arrow_addrace) + sizeof(sd->arrow_addsize) + sizeof(sd->magic_addele) @@ -2404,9 +2407,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first) + sizeof(sd->skillfixcast) + sizeof(sd->skillvarcast) ); - + memset (&sd->bonus, 0,sizeof(sd->bonus)); - + // Autobonus pc_delautobonus(sd,sd->autobonus,ARRAYLENGTH(sd->autobonus),true); pc_delautobonus(sd,sd->autobonus2,ARRAYLENGTH(sd->autobonus2),true); @@ -2447,7 +2450,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) int r,wlv = sd->inventory_data[index]->wlv; struct weapon_data *wd; struct weapon_atk *wa; - if (wlv >= REFINE_TYPE_MAX) + if (wlv >= REFINE_TYPE_MAX) wlv = REFINE_TYPE_MAX - 1; if(i == EQI_HAND_L && sd->status.inventory[index].equip == EQP_HAND_L) { wd = &sd->left_weapon; // Left-hand weapon @@ -2468,7 +2471,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) {// renewal magic attack refine bonus status->matk_max += refine_info[wlv].bonus[r-1] / 100; } - + // record the weapon level for future usage status->wlv = wlv; #endif @@ -2495,7 +2498,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) if(wd->star >= 15) wd->star = 40; // 3 Star Crumbs now give +40 dmg if(pc_famerank(MakeDWord(sd->status.inventory[index].card[2],sd->status.inventory[index].card[3]) ,MAPID_BLACKSMITH)) wd->star += 10; - + if (!wa->ele) //Do not overwrite element from previous bonuses. wa->ele = (sd->status.inventory[index].card[1]&0x0f); } @@ -2528,7 +2531,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) return 1; } } - + /* we've got combos to process */ if( sd->combos.count ) { for( i = 0; i < sd->combos.count; i++ ) { @@ -2537,13 +2540,13 @@ int status_calc_pc_(struct map_session_data* sd, bool first) return 1; } } - - //Store equipment script bonuses + + //Store equipment script bonuses memcpy(sd->param_equip,sd->param_bonus,sizeof(sd->param_equip)); memset(sd->param_bonus, 0, sizeof(sd->param_bonus)); status->def += (refinedef+50)/100; - + #ifdef RENEWAL // increment the weapon ATK using the MATK max value status->matk_max += sd->bonus.sp_weapon_matk; @@ -2590,7 +2593,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) continue; if(map[sd->bl.m].flag.pvp && data->flag.no_equip&2) continue; - if(map_flag_gvg(sd->bl.m) && data->flag.no_equip&4) + if(map_flag_gvg(sd->bl.m) && data->flag.no_equip&4) continue; if(map[sd->bl.m].flag.battleground && data->flag.no_equip&8) continue; @@ -2644,7 +2647,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) if(pc_isriding(sd) && (sd->status.weapon==W_1HSPEAR || sd->status.weapon==W_2HSPEAR)) - { //When Riding with spear, damage modifier to mid-class becomes + { //When Riding with spear, damage modifier to mid-class becomes //same as versus large size. sd->right_weapon.atkmods[1] = sd->right_weapon.atkmods[2]; sd->left_weapon.atkmods[1] = sd->left_weapon.atkmods[2]; @@ -2772,23 +2775,23 @@ int status_calc_pc_(struct map_session_data* sd, bool first) status->max_sp = 1; // ----- RESPAWN HP/SP ----- -// +// //Calc respawn hp and store it on base_status if (sd->special_state.restart_full_recover) { status->hp = status->max_hp; status->sp = status->max_sp; } else { - if((sd->class_&MAPID_BASEMASK) == MAPID_NOVICE && !(sd->class_&JOBL_2) - && battle_config.restart_hp_rate < 50) + if((sd->class_&MAPID_BASEMASK) == MAPID_NOVICE && !(sd->class_&JOBL_2) + && battle_config.restart_hp_rate < 50) status->hp=status->max_hp>>1; - else + else status->hp=status->max_hp * battle_config.restart_hp_rate/100; if(!status->hp) status->hp = 1; status->sp = status->max_sp * battle_config.restart_sp_rate /100; - + if( !status->sp ) /* the minimum for the respawn setting is SP:1 */ status->sp = 1; } @@ -2825,7 +2828,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) if(sd->mdef2_rate != 100) status->mdef2 = status->mdef2 * sd->mdef2_rate/100; - if(sd->critical_rate < 0) + if(sd->critical_rate < 0) sd->critical_rate = 0; if(sd->critical_rate != 100) status->cri = status->cri * sd->critical_rate/100; @@ -2958,7 +2961,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) sd->max_weight += 2000*skill; sd->cart_weight_max = battle_config.max_cart_weight + (pc_checkskill(sd, GN_REMODELING_CART)*5000); - + if (pc_checkskill(sd,SM_MOVINGRECOVERY)>0) sd->regen.state.walk = 1; else @@ -3082,9 +3085,9 @@ int status_calc_pc_(struct map_session_data* sd, bool first) if( b_cart_weight_max != sd->cart_weight_max ) { clif_updatestatus(sd,SP_CARTINFO); } - + calculating = 0; - + return 0; } @@ -3192,17 +3195,17 @@ int status_calc_elemental_(struct elemental_data *ed, bool first) { struct status_data *status = &ed->base_status; struct s_elemental *ele = &ed->elemental; struct map_session_data *sd = ed->master; - + if( !sd ) return 0; - + status->str = ele->str; status->agi = ele->agi; status->vit = ele->vit; status->dex = ele->dex; status->int_ = ele->int_; status->luk = ele->luk; - + if( first ) { memcpy(status, &ed->db->status, sizeof(struct status_data)); status->mode = MD_CANMOVE|MD_CANATTACK; @@ -3216,14 +3219,14 @@ int status_calc_elemental_(struct elemental_data *ed, bool first) { status->int_ += sd->base_status.int_ * 25 / 100; status->def += sd->base_status.dex * 25 / 100; status->luk += sd->base_status.luk * 25 / 100; - + status_calc_misc(&ed->bl, status, ed->db->lv); memcpy(&ed->battle_status,status,sizeof(struct status_data)); } else { status_calc_misc(&ed->bl, status, ed->db->lv); status_cpy(&ed->battle_status, status); } - + return 0; } @@ -3350,7 +3353,7 @@ void status_calc_regen(struct block_list *bl, struct status_data *status, struct } else if( bl->type == BL_ELEM ) { val = (status->max_hp * status->vit / 10000 + 1) * 6; regen->hp = cap_value(val, 1, SHRT_MAX); - + val = (status->max_sp * (status->int_ + 10) / 750) + 1; regen->sp = cap_value(val, 1, SHRT_MAX); } @@ -3389,7 +3392,7 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str if ( (sc->data[SC_POISON] && !sc->data[SC_SLOWPOISON]) || (sc->data[SC_DPOISON] && !sc->data[SC_SLOWPOISON]) - || sc->data[SC_BERSERK] + || sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST] || sc->data[SC_TRICKDEAD] || sc->data[SC_BLEEDING] || sc->data[SC_MAGICMUSHROOM] @@ -3441,13 +3444,13 @@ void status_calc_regen_rate(struct block_list *bl, struct regen_data *regen, str } void status_calc_state( struct block_list *bl, struct status_change *sc, enum scs_flag flag, bool start ) { - + /* no sc at all, we can zero without any extra weight over our conciousness */ if( !sc->count ) { memset(&sc->cant, 0, sizeof (sc->cant)); return; } - + /* can move? */ if( flag&SCS_NOMOVE ) { if( !(flag&SCS_NOMOVECOND) ) { @@ -3457,13 +3460,13 @@ void status_calc_state( struct block_list *bl, struct status_change *sc, enum sc || (sc->data[SC_BASILICA] && sc->data[SC_BASILICA]->val4 == bl->id) // Basilica caster cannot move || (sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 == BCT_SELF) || (sc->data[SC_CRYSTALIZE] && bl->type != BL_MOB) - || (sc->data[SC_CAMOUFLAGE] && sc->data[SC_CAMOUFLAGE]->val1 < 3 + || (sc->data[SC_CAMOUFLAGE] && sc->data[SC_CAMOUFLAGE]->val1 < 3 && !(sc->data[SC_CAMOUFLAGE]->val3&1)) ) { sc->cant.move += ( start ? 1 : -1 ); } } - + /* can't use skills */ if( flag&SCS_NOCAST ) { if( !(flag&SCS_NOCASTCOND) ) { @@ -3472,10 +3475,10 @@ void status_calc_state( struct block_list *bl, struct status_change *sc, enum sc sc->cant.cast += ( start ? 1 : -1 ); } } - + /* player-only states */ if( bl->type == BL_PC ) { - + /* can pick items? */ if( flag&SCS_NOPICKITEM ) { if( !(flag&SCS_NOPICKITEMCOND) ) { @@ -3484,7 +3487,7 @@ void status_calc_state( struct block_list *bl, struct status_change *sc, enum sc sc->cant.pickup += ( start ? 1 : -1 ); } } - + /* can drop items? */ if( flag&SCS_NODROPITEM ) { if( !(flag&SCS_NODROPITEMCOND) ) { @@ -3494,7 +3497,7 @@ void status_calc_state( struct block_list *bl, struct status_change *sc, enum sc } } } - + return; } /// Recalculates parts of an object's battle status according to the specified flags. @@ -3630,11 +3633,11 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) if(flag&SCB_MDEF) { status->mdef = status_calc_mdef(bl, sc, b_status->mdef); - + if( bl->type&BL_HOM ) status->mdef += (status->int_/5 - b_status->int_/5); } - + if(flag&SCB_MDEF2) { if (status->int_ == b_status->int_ && status->vit == b_status->vit) status->mdef2 = status_calc_mdef2(bl, sc, b_status->mdef2); @@ -3772,7 +3775,7 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) #endif status->matk_min = status->matk_min * sd->matk_rate/100; } - + status->matk_min = status_calc_matk(bl, sc, status->matk_min); #ifndef RENEWAL // only changed in non-renewal [Ind] @@ -3797,20 +3800,20 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) #else // aspd = baseaspd + floor(sqrt((agi^2/2) + (dex^2/5))/4 + (potskillbonus*agi/200)) amotion -= (int)(sqrt( (pow(status->agi, 2) / 2) + (pow(status->dex, 2) / 5) ) / 4 + (status_calc_aspd(bl, sc, 1) * status->agi / 200)) * 10; - + if( (status_calc_aspd(bl, sc, 2) + status->aspd_rate2) != 0 ) // RE ASPD percertage modifier - amotion -= ( amotion - ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd) ) + amotion -= ( amotion - ((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd) ) * (status_calc_aspd(bl, sc, 2) + status->aspd_rate2) / 100; if(status->aspd_rate != 1000) // absolute percentage modifier amotion = ( 200 - (200-amotion/10) * status->aspd_rate / 1000 ) * 10; -#endif +#endif //fixed value added if( sc && sc->data[SC_FIGHTINGSPIRIT] && sc->data[SC_FIGHTINGSPIRIT]->val2 ) amotion -= (sd?pc_checkskill(sd, RK_RUNEMASTERY):10) / 10 * 40; status->amotion = cap_value(amotion,((sd->class_&JOBL_THIRD) ? battle_config.max_third_aspd : battle_config.max_aspd),2000); - + status->adelay = 2*status->amotion; } else @@ -3818,24 +3821,24 @@ void status_calc_bl_main(struct block_list *bl, /*enum scb_flag*/int flag) { amotion = (1000 -4*status->agi -status->dex) * ((TBL_HOM*)bl)->homunculusDB->baseASPD/1000; status->aspd_rate = status_calc_aspd_rate(bl, sc, b_status->aspd_rate); - + if(status->aspd_rate != 1000) amotion = amotion*status->aspd_rate/1000; - + status->amotion = cap_value(amotion,battle_config.max_aspd,2000); - + status->adelay = status->amotion; } else // mercenary and mobs { amotion = b_status->amotion; status->aspd_rate = status_calc_aspd_rate(bl, sc, b_status->aspd_rate); - + if(status->aspd_rate != 1000) amotion = amotion*status->aspd_rate/1000; - + status->amotion = cap_value(amotion, battle_config.monster_max_aspd, 2000); - + temp = b_status->adelay*status->aspd_rate/1000; status->adelay = cap_value(temp, battle_config.monster_max_aspd*2, 4000); } @@ -4032,7 +4035,7 @@ void status_calc_bl_(struct block_list* bl, enum scb_flag flag, bool first) clif_elemental_updatestatus(ed->master, SP_HP); if( b_status.sp != status->sp ) clif_mercenary_updatestatus(ed->master, SP_SP); - } + } } /*========================================== @@ -4382,8 +4385,6 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan batk += 100; if(sc->data[SC__ENERVATION]) batk -= batk * sc->data[SC__ENERVATION]->val2 / 100; - if(sc->data[SC__BLOODYLUST]) - batk += batk * 32 / 100; if(sc->data[SC_RUSHWINDMILL]) batk += batk * sc->data[SC_RUSHWINDMILL]->val2/100; if(sc->data[SC_SATURDAYNIGHTFEVER]) @@ -4400,7 +4401,7 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan || (sc->data[SC_WIND_INSIGNIA] && sc->data[SC_WIND_INSIGNIA]->val1 == 1) || (sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 1)) ) - batk += batk / 5; + batk += batk / 5; if(sc->data[SC_FULL_SWING_K]) batk += sc->data[SC_FULL_SWING_K]->val1; if(sc->data[SC_ODINS_POWER]) @@ -4447,8 +4448,6 @@ static unsigned short status_calc_watk(struct block_list *bl, struct status_chan } if(sc->data[SC__ENERVATION]) watk -= watk * sc->data[SC__ENERVATION]->val2 / 100; - if(sc->data[SC__BLOODYLUST]) - watk += watk * 32 / 100; if(sc->data[SC_FLEET]) watk += watk * sc->data[SC_FLEET]->val3/100; if(sc->data[SC_CURSE]) @@ -4461,8 +4460,6 @@ static unsigned short status_calc_watk(struct block_list *bl, struct status_chan watk += sc->data[SC_FIGHTINGSPIRIT]->val1; if(sc->data[SC__ENERVATION]) watk -= watk * sc->data[SC__ENERVATION]->val2 / 100; - if(sc->data[SC__BLOODYLUST]) - watk += watk * 32 / 100; if(sc->data[SC_STRIKING]) watk += sc->data[SC_STRIKING]->val2; if(sc->data[SC_SHIELDSPELL_DEF] && sc->data[SC_SHIELDSPELL_DEF]->val1 == 3) @@ -4527,9 +4524,9 @@ static unsigned short status_calc_matk(struct block_list *bl, struct status_chan if(sc->data[SC_WATER_BARRIER]) matk -= sc->data[SC_WATER_BARRIER]->val3; if(sc->data[SC_FIRE_INSIGNIA] && sc->data[SC_FIRE_INSIGNIA]->val1 == 3) - matk += 50; + matk += 50; if(sc->data[SC_ODINS_POWER]) - matk += 70; + matk += 70; if(sc->data[SC_IZAYOI]) matk += 50 * sc->data[SC_IZAYOI]->val1; if( sc->data[SC_ZANGETSU] ) @@ -4569,7 +4566,7 @@ static signed short status_calc_critical(struct block_list *bl, struct status_ch static signed short status_calc_hit(struct block_list *bl, struct status_change *sc, int hit) { - + if(!sc || !sc->count) return cap_value(hit,1,SHRT_MAX); @@ -4634,7 +4631,7 @@ static signed short status_calc_flee(struct block_list *bl, struct status_change flee += 10; if(sc->data[SC_SPIDERWEB] && sc->data[SC_SPIDERWEB]->val1) flee -= flee * 50/100; - if(sc->data[SC_BERSERK]) + if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) flee -= flee * 50/100; if(sc->data[SC_BLIND]) flee -= flee * 25/100; @@ -4697,11 +4694,11 @@ static signed short status_calc_flee2(struct block_list *bl, struct status_chang return (short)cap_value(flee2,10,SHRT_MAX); } static defType status_calc_def(struct block_list *bl, struct status_change *sc, int def) { - + if(!sc || !sc->count) return (defType)cap_value(def,DEFTYPE_MIN,DEFTYPE_MAX); - if(sc->data[SC_BERSERK]) + if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) return 0; if(sc->data[SC_SKA]) return sc->data[SC_SKA]->val3; @@ -4750,8 +4747,6 @@ static defType status_calc_def(struct block_list *bl, struct status_change *sc, def -= def * ( 6 + 6 * sc->data[SC_MARSHOFABYSS]->val3/10 + (bl->type == BL_MOB ? 5 : 3) * sc->data[SC_MARSHOFABYSS]->val2/36 ) / 100; if( sc->data[SC_ANALYZE] ) def -= def * ( 14 * sc->data[SC_ANALYZE]->val1 ) / 100; - if( sc->data[SC__BLOODYLUST] ) - def -= def * 55 / 100; if( sc->data[SC_FORCEOFVANGUARD] ) def += def * 2 * sc->data[SC_FORCEOFVANGUARD]->val1 / 100; if(sc->data[SC_SATURDAYNIGHTFEVER]) @@ -4765,12 +4760,12 @@ static defType status_calc_def(struct block_list *bl, struct status_change *sc, if( sc->data[SC_PRESTIGE] ) def += def * sc->data[SC_PRESTIGE]->val1 / 100; if(sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 2) - def += 50; + def += 50; if(sc->data[SC_ODINS_POWER]) def -= 20; if( sc->data[SC_ANGRIFFS_MODUS] ) def -= def * sc->data[SC_ANGRIFFS_MODUS]->val4 / 100; - + return (defType)cap_value(def,DEFTYPE_MIN,DEFTYPE_MAX);; } @@ -4782,8 +4777,8 @@ static signed short status_calc_def2(struct block_list *bl, struct status_change #else return (short)cap_value(def2,1,SHRT_MAX); #endif - - if(sc->data[SC_BERSERK]) + + if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) return 0; if(sc->data[SC_ETERNALCHAOS]) return 0; @@ -4837,11 +4832,11 @@ static signed short status_calc_def2(struct block_list *bl, struct status_change static defType status_calc_mdef(struct block_list *bl, struct status_change *sc, int mdef) { - + if(!sc || !sc->count) return (defType)cap_value(mdef,DEFTYPE_MIN,DEFTYPE_MAX); - if(sc->data[SC_BERSERK]) + if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) return 0; if(sc->data[SC_BARRIER]) return 100; @@ -4878,7 +4873,7 @@ static defType status_calc_mdef(struct block_list *bl, struct status_change *sc, if(sc->data[SC_WATER_BARRIER]) mdef += sc->data[SC_WATER_BARRIER]->val2; if(sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 3) - mdef += 50; + mdef += 50; if(sc->data[SC_ODINS_POWER]) mdef -= 20; @@ -4895,7 +4890,7 @@ static signed short status_calc_mdef2(struct block_list *bl, struct status_chang #endif - if(sc->data[SC_BERSERK]) + if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) return 0; if(sc->data[SC_SKA]) return 90; @@ -5041,7 +5036,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha val = max( val, 1 * pc_checkskill(sd,TF_MISS) ); if( sc->data[SC_CLOAKING] && (sc->data[SC_CLOAKING]->val4&1) == 1 ) val = max( val, sc->data[SC_CLOAKING]->val1 >= 10 ? 25 : 3 * sc->data[SC_CLOAKING]->val1 - 3 ); - if( sc->data[SC_BERSERK] ) + if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) val = max( val, 25 ); if( sc->data[SC_RUN] ) val = max( val, 55 ); @@ -5054,7 +5049,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha if( sc->data[SC_HOVERING] ) val = max( val, 10 ); if( sc->data[SC_GN_CARTBOOST] ) - val = max( val, sc->data[SC_GN_CARTBOOST]->val2 ); + val = max( val, sc->data[SC_GN_CARTBOOST]->val2 ); if( sc->data[SC_SWINGDANCE] ) val = max( val, sc->data[SC_SWINGDANCE]->val2 ); if( sc->data[SC_WIND_STEP_OPTION] ) @@ -5122,16 +5117,16 @@ static short status_calc_aspd(struct block_list *bl, struct status_change *sc, s if(sc->data[SC_ADRENALINE2] && skills1 < 6) skills1 = 6; - + if(sc->data[SC_ADRENALINE] && skills1 < 7) skills1 = 7; - + if(sc->data[SC_SPEARQUICKEN] && skills1 < 7) skills1 = 7; if(sc->data[SC_GATLINGFEVER] && skills1 < 9) // needs more info skills1 = 9; - + if(sc->data[SC_FLEET] && skills1 < 5) skills1 = 5; @@ -5156,7 +5151,7 @@ static short status_calc_aspd(struct block_list *bl, struct status_change *sc, s } } - if(sc->data[SC_BERSERK] && skills1 < 15) + if((sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) && skills1 < 15) skills1 = 15; else if(sc->data[SC_MADNESSCANCEL] && skills1 < 15) // needs more info skills1 = 15; @@ -5249,7 +5244,7 @@ static short status_calc_aspd_rate(struct block_list *bl, struct status_change * if(sc->data[SC_ADRENALINE] && max < sc->data[SC_ADRENALINE]->val3) max = sc->data[SC_ADRENALINE]->val3; - + if(sc->data[SC_SPEARQUICKEN] && max < sc->data[SC_SPEARQUICKEN]->val2) max = sc->data[SC_SPEARQUICKEN]->val2; @@ -5257,14 +5252,14 @@ static short status_calc_aspd_rate(struct block_list *bl, struct status_change * if(sc->data[SC_GATLINGFEVER] && max < sc->data[SC_GATLINGFEVER]->val2) max = sc->data[SC_GATLINGFEVER]->val2; - + if(sc->data[SC_FLEET] && max < sc->data[SC_FLEET]->val2) max = sc->data[SC_FLEET]->val2; - + if( sc->data[SC_GOLDENE_FERSE] && max < sc->data[SC_GOLDENE_FERSE]->val3 ) max = sc->data[SC_GOLDENE_FERSE]->val3; - + if(sc->data[SC_ASSNCROS] && max < sc->data[SC_ASSNCROS]->val2) { @@ -5286,7 +5281,7 @@ static short status_calc_aspd_rate(struct block_list *bl, struct status_change * } aspd_rate -= max; - if(sc->data[SC_BERSERK]) + if((sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST])) aspd_rate -= 300; else if(sc->data[SC_MADNESSCANCEL]) aspd_rate -= 200; @@ -5384,7 +5379,7 @@ static unsigned int status_calc_maxhp(struct block_list *bl, struct status_chang maxhp += maxhp * sc->data[SC_APPLEIDUN]->val2/100; if(sc->data[SC_DELUGE]) maxhp += maxhp * sc->data[SC_DELUGE]->val2/100; - if(sc->data[SC_BERSERK]) + if (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST]) maxhp += maxhp * 2; if(sc->data[SC_MARIONETTE]) maxhp -= 1000; @@ -5420,7 +5415,7 @@ static unsigned int status_calc_maxhp(struct block_list *bl, struct status_chang maxhp -= sc->data[SC_MYSTERIOUS_POWDER]->val1 / 100; if(sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 2) maxhp += 500; - + return cap_value(maxhp,1,UINT_MAX); } @@ -5442,7 +5437,7 @@ static unsigned int status_calc_maxsp(struct block_list *bl, struct status_chang if(sc->data[SC_LIFE_FORCE_F]) maxsp += maxsp * sc->data[SC_LIFE_FORCE_F]->val1/100; if(sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 3) - maxsp += 50; + maxsp += 50; return cap_value(maxsp,1,UINT_MAX); } @@ -5501,13 +5496,13 @@ unsigned char status_calc_attack_element(struct block_list *bl, struct status_ch if(sc->data[SC_WATERWEAPON] || (sc->data[SC_WATER_INSIGNIA] && sc->data[SC_WATER_INSIGNIA]->val1 == 2) ) return ELE_WATER; - if(sc->data[SC_EARTHWEAPON] + if(sc->data[SC_EARTHWEAPON] || (sc->data[SC_EARTH_INSIGNIA] && sc->data[SC_EARTH_INSIGNIA]->val1 == 2) ) return ELE_EARTH; - if(sc->data[SC_FIREWEAPON] + if(sc->data[SC_FIREWEAPON] || (sc->data[SC_FIRE_INSIGNIA] && sc->data[SC_FIRE_INSIGNIA]->val1 == 2) ) return ELE_FIRE; - if(sc->data[SC_WINDWEAPON] + if(sc->data[SC_WINDWEAPON] || (sc->data[SC_WIND_INSIGNIA] && sc->data[SC_WIND_INSIGNIA]->val1 == 2) ) return ELE_WIND; if(sc->data[SC_ENCPOISON]) @@ -5553,8 +5548,10 @@ const char* status_get_name(struct block_list *bl) { } /*========================================== - * �Ώۂ�Class��Ԃ�(�ėp) - * �߂�͐�����0�ȏ� + * Get the class of the current bl + * return + * 0 = fail + * class_id = success *------------------------------------------*/ int status_get_class(struct block_list *bl) { nullpo_ret(bl); @@ -5570,8 +5567,10 @@ int status_get_class(struct block_list *bl) { return 0; } /*========================================== - * �Ώۂ̃��x����Ԃ�(�ėp) - * �߂�͐�����0�ȏ� + * Get the base level of the current bl + * return + * 1 = fail + * level = success *------------------------------------------*/ int status_get_lv(struct block_list *bl) { nullpo_ret(bl); @@ -5830,7 +5829,7 @@ void status_set_viewdata(struct block_list *bl, int class_) else if (merc_class(class_)) vd = merc_get_viewdata(class_); else if (elemental_class(class_)) - vd = elemental_get_viewdata(class_); + vd = elemental_get_viewdata(class_); else vd = NULL; @@ -5943,7 +5942,7 @@ void status_set_viewdata(struct block_list *bl, int class_) else ShowError("status_set_viewdata (ELEMENTAL): No view data for class %d\n", class_); } - break; + break; } vd = status_get_viewdata(bl); if (vd && vd->cloth_color && ( @@ -6019,9 +6018,10 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti case SC__LAZINESS: case SC__UNLUCKY: case SC__WEAKNESS: + case SC__BLOODYLUST: return 0; } - + sd = BL_CAST(BL_PC,bl); status = status_get_status_data(bl); sc = status_get_sc(bl); @@ -6083,9 +6083,9 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti if( tick == 5000 ) // 100% on caster break; if( bl->type == BL_PC ) - tick -= (status_get_lv(bl) / 5 + status->vit / 4 + status->agi / 10)*100; + tick -= (status_get_lv(bl) / 5 + status->vit / 4 + status->agi / 10)*100; else - tick -= (status->vit + status->luk) / 20 * 1000; + tick -= (status->vit + status->luk) / 20 * 1000; break; case SC_BURNING: // From iROwiki : http://forums.irowiki.org/showpost.php?p=577240&postcount=583 @@ -6097,9 +6097,9 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti tick = max(tick,10000); // Minimum Duration 10s. break; case SC_OBLIVIONCURSE: // 100% - (100 - 0.8 x INT) - sc_def = 100 - ( 100 - status->int_* 8 / 10 ); + sc_def = 100 - ( 100 - status->int_* 8 / 10 ); sc_def = max(sc_def, 5); // minimum of 5% - break; + break; case SC_BITE: // {(Base Success chance) - (Target's AGI / 4)} rate -= status->agi*1000/4; rate = max(rate,50000); // minimum of 50% @@ -6123,7 +6123,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti return 0; return tick?tick:1; } - + if (sd) { if (battle_config.pc_sc_def_rate != 100) @@ -6156,7 +6156,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti tick_def = tick_def*battle_config.mob_sc_def_rate/100; } } - + if (sc) { if (sc->data[SC_SCRESIST]) sc_def += sc->data[SC_SCRESIST]->val1; //Status resist @@ -6184,7 +6184,7 @@ int status_get_sc_def(struct block_list *bl, enum sc_type type, int rate, int ti if (!(rnd()%10000 < rate)) return 0; - //Why would a status start with no duration? Presume it has + //Why would a status start with no duration? Presume it has //duration defined elsewhere. if (!tick) return 1; @@ -6232,15 +6232,17 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val if( !sc ) return 0; //Unable to receive status changes - + if( status_isdead(bl) && type != SC_NOCHAT ) // SC_NOCHAT should work even on dead characters return 0; - if( bl->type == BL_MOB && type != SC_SAFETYWALL && type != SC_PNEUMA ) + if( bl->type == BL_MOB) { struct mob_data *md = BL_CAST(BL_MOB,bl); - if( md->class_ == MOBID_EMPERIUM || mob_is_battleground(md) ) + if(md && (md->class_ == MOBID_EMPERIUM || mob_is_battleground(md)) && type != SC_SAFETYWALL && type != SC_PNEUMA) return 0; //Emperium/BG Monsters can't be afflicted by status changes + // if(md && mob_is_gvg(md) && status_sc2scb_flag(type)&SCB_MAXHP) + // return 0; //prevent status addinh hp to gvg mob (like bloodylust=hp*3 etc... } if( sc->data[SC_REFRESH] ) { @@ -6320,7 +6322,17 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val if((type == SC_FREEZE || type == SC_FREEZING || type == SC_CRYSTALIZE) && sc->data[SC_WARMER]) return 0; //Immune to Frozen and Freezing status if under Warmer status. [Jobbie] break; - + + //There all like berserk, do not everlap each other + case SC__BLOODYLUST: + if(!sd) return 0; //should only affect player + case SC_BERSERK: + if (((type == SC_BERSERK) && (sc->data[SC_SATURDAYNIGHTFEVER] || sc->data[SC__BLOODYLUST])) + || ((type == SC__BLOODYLUST) && (sc->data[SC_SATURDAYNIGHTFEVER] || sc->data[SC_BERSERK])) + ) + return 0; + break; + case SC_BURNING: if(sc->opt1 || sc->data[SC_FREEZING]) return 0; @@ -6372,12 +6384,12 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_TWOHANDQUICKEN: if(sc->data[SC_DECREASEAGI]) return 0; - + case SC_INCREASEAGI: - if(sd && pc_issit(sd)){ + if(sd && pc_issit(sd)){ pc_setstand(sd); } - + case SC_CONCENTRATE: case SC_SPEARQUICKEN: case SC_TRUESIGHT: @@ -6569,6 +6581,10 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val if(sc->data[i]) return 0; } break; + case SC_SATURDAYNIGHTFEVER: + if (sc->data[SC_BERSERK] || sc->data[SC_INSPIRATION] || sc->data[SC__BLOODYLUST]) + return 0; + break; case SC_INTRAVISION: if(sd && sd->special_state.intravision) return 0; //we already have the status by maya P break; @@ -6671,6 +6687,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val status_change_end(bl, SC_CLOSECONFINE, INVALID_TIMER); status_change_end(bl, SC_CLOSECONFINE2, INVALID_TIMER); break; + case SC__BLOODYLUST: case SC_BERSERK: if(battle_config.berserk_cancels_buffs) { status_change_end(bl, SC_ONEHAND, INVALID_TIMER); @@ -6789,7 +6806,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_BEYONDOFWARCRY: case SC_UNLIMITEDHUMMINGVOICE: if( sc->data[type] ) // Don't remove same sc. - break; + break; //FIXME this is wrong as it'll prevent other being remove as well status_change_end(bl, SC_SONGOFMANA, INVALID_TIMER); status_change_end(bl, SC_DANCEWITHWUG, INVALID_TIMER); status_change_end(bl, SC_LERADSDEW, INVALID_TIMER); @@ -6803,7 +6820,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_REFLECTDAMAGE: status_change_end(bl, SC_REFLECTSHIELD, INVALID_TIMER); break; - case SC_SHIELDSPELL_DEF: + case SC_SHIELDSPELL_DEF: case SC_SHIELDSPELL_MDEF: case SC_SHIELDSPELL_REF: status_change_end(bl, SC_MAGNIFICAT, INVALID_TIMER); @@ -6873,9 +6890,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC__IGNORANCE: case SC__LAZINESS: case SC__WEAKNESS: - case SC__UNLUCKY: + case SC__UNLUCKY: return 0; - case SC_COMBO: + case SC_COMBO: case SC_DANCING: case SC_DEVOTION: case SC_ASPDPOTION0: @@ -6916,7 +6933,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val4 = sce->val4; break; case SC_LERADSDEW: - if( sc && sc->data[SC_BERSERK] ) + if (sc && (sc->data[SC_BERSERK] || sc->data[SC__BLOODYLUST])) return 0; case SC_SHAPESHIFT: case SC_PROPERTYWALK: @@ -7095,7 +7112,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val #ifndef RENEWAL if(status->def_ele != ELE_WATER) val2 = 0; -#endif +#endif break; case SC_SUITON: if (!val2 || (sd && (sd->class_&MAPID_UPPERMASK) == MAPID_NINJA)) { @@ -7175,10 +7192,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_STONE: val3 = tick/1000; //Petrified HP-damage iterations. - if(val3 < 1) val3 = 1; + if(val3 < 1) val3 = 1; tick = val4; //Petrifying time. - if (tick < 1000) - tick = 1000; //Min time + tick = max(tick, 1000); //Min time calc_flag = 0; //Actual status changes take effect on petrified state. break; @@ -7189,14 +7205,14 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val if (status->hp - diff < status->max_hp>>2) diff = status->hp - (status->max_hp>>2); if( val2 && bl->type == BL_MOB ) { - struct block_list* src = map_id2bl(val2); - if( src ) - mob_log_damage((TBL_MOB*)bl,src,diff); - } + struct block_list* src = map_id2bl(val2); + if( src ) + mob_log_damage((TBL_MOB*)bl,src,diff); + } status_zap(bl, diff, 0); } // fall through - case SC_POISON: /* �� */ + case SC_POISON: val3 = tick/1000; //Damage iterations if(val3 < 1) val3 = 1; tick_time = 1000; // [GodLesZ] tick time @@ -7205,7 +7221,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val4 = (type == SC_DPOISON) ? 3 + status->max_hp/50 : 3 + status->max_hp*3/200; else val4 = (type == SC_DPOISON) ? 3 + status->max_hp/100 : 3 + status->max_hp/200; - + break; case SC_CONFUSION: clif_emotion(bl,E_WHAT); @@ -7269,7 +7285,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val else val4 |= battle_config.monster_cloak_check_type&7; break; - case SC_SIGHT: /* �T�C�g/���A�t */ + case SC_SIGHT: /* splash status */ case SC_RUWACH: case SC_SIGHTBLASTER: val3 = skill_get_splash(val2, val1); //Val2 should bring the skill-id. @@ -7325,7 +7341,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val { val2 = 5 + 15*val1; //Damage reduction val3 = 0; // unused, previously speed adjustment - val4 = 250 - 50*val1; //Aspd adjustment + val4 = 250 - 50*val1; //Aspd adjustment if (sd) { @@ -7364,6 +7380,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val sc_start(bl,SC_BLEEDING,100,val1,skill_get_time2(status_sc2skill(type),val1)); break; + case SC__BLOODYLUST: case SC_BERSERK: if (!sc->data[SC_ENDURE] || !sc->data[SC_ENDURE]->val4) sc_start4(bl, SC_ENDURE, 100,10,0,0,2, tick); @@ -7536,7 +7553,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; case SC_KAAHI: val2 = 200*val1; //HP heal - val3 = 5*val1; //SP cost + val3 = 5*val1; //SP cost val4 = INVALID_TIMER; //Kaahi Timer. break; case SC_BLESSING: @@ -7645,7 +7662,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val2 = 20 + 10*val1; //flee val3 = 10 + 4*val1; //aspd val4 = 2 + 2*val1; //chance to issue holy-ele attack - break; + break; case SC_FLEET: val2 = 30*val1; //Aspd change val3 = 5+5*val1; //bAtk/wAtk rate change @@ -7654,11 +7671,11 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val2 = 20*val1; //matk increase. val3 = 12*val1; //mdef2 reduction. break; - case SC_SKA: - val2 = tick/1000; - val3 = rnd()%100; //Def changes randomly every second... + case SC_SKA: + val2 = tick/1000; + val3 = rnd()%100; //Def changes randomly every second... tick_time = 1000; // [GodLesZ] tick time - break; + break; case SC_JAILED: //Val1 is duration in minutes. Use INT_MAX to specify 'unlimited' time. tick = val1>0?1000:250; @@ -7987,12 +8004,10 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC__WEAKNESS: val2 = 10 * val1; val_flag |= 1|2; - // bypasses coating protection and MADO + // bypasses coating protection and MADO sc_start(bl,SC_STRIPWEAPON,100,val1,tick); sc_start(bl,SC_STRIPSHIELD,100,val1,tick); break; - case SC__BLOODYLUST: - val_flag |= 1|2; break; case SC_GN_CARTBOOST: if( val1 < 3 ) @@ -8071,7 +8086,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val3 = 15 + 5 * val1; // ASPD reduction. if( rand()%100 < val1 ){ // (Skill Lv) % val4 = 1; // reduce walk speed by half. - if( pc_isriding(sd) ) pc_setriding(sd, 0); + if( pc_isriding(sd) ) pc_setriding(sd, 0); if( pc_isridingdragon(sd) ) pc_setoption(sd, sd->sc.option&~OPTION_DRAGON); } break; @@ -8128,7 +8143,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val val1 += 15 * (sd ? sd->status.job_level:50) + 100; } else // Mobs - val1 += (400 * status_get_lv(bl) / 100) + (15 * (status_get_lv(bl) / 2)); // About 1138% at mob_lvl 99. Is an aproximation to a standard weapon. [pakpil] + val1 += (400 * status_get_lv(bl) / 100) + (15 * (status_get_lv(bl) / 2)); // About 1138% at mob_lvl 99. Is an aproximation to a standard weapon. [pakpil] break; case SC_PRESTIGE: // Bassed on suggested formula in iRO Wiki and some test, still need more test. [pakpil] val2 = ((status->int_ + status->luk) / 6) + 5; // Chance to evade magic damage. @@ -8179,9 +8194,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_GT_CHANGE: {// take note there is no def increase as skill desc says. [malufett] struct block_list * src; - val3 = status->agi * val1 / 60; // ASPD increase: [(Target�s AGI x Skill Level) / 60] % + val3 = status->agi * val1 / 60; // ASPD increase: [(Target AGI x Skill Level) / 60] % if( (src = map_id2bl(val2)) ) - val4 = ( 200/status_get_int(src) ) * val1;// MDEF decrease: MDEF [(200 / Caster�s INT) x Skill Level] + val4 = ( 200/status_get_int(src) ) * val1;// MDEF decrease: MDEF [(200 / Caster INT) x Skill Level] } break; case SC_GT_REVITALIZE: @@ -8189,7 +8204,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val struct block_list * src; val3 = val1 * 30 + 150; // Natural HP recovery increase: [(Skill Level x 30) + 50] % if( (src = map_id2bl(val2)) ) // the stat def is not shown in the status window and it is process differently - val4 = ( status_get_vit(src)/4 ) * val1; // STAT DEF increase: [(Caster�s VIT / 4) x Skill Level] + val4 = ( status_get_vit(src)/4 ) * val1; // STAT DEF increase: [(Caster VIT / 4) x Skill Level] } break; case SC_PYROTECHNIC_OPTION: @@ -8276,7 +8291,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val tick_time = 2000; // [GodLesZ] tick time break; case SC_WATER_BARRIER: - val2 = 40; // Increasement. Mdef1 ??? + val2 = 40; // Increasement. Mdef1 ??? val3 = 20; // Reductions. Atk2, Flee1, Matk1 ???? val_flag |= 1|2|4; break; @@ -8321,7 +8336,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val break; default: if( calc_flag == SCB_NONE && StatusSkillChangeTable[type] == 0 && StatusIconChangeTable[type] == 0 ) - { //Status change with no calc, no icon, and no skill associated...? + { //Status change with no calc, no icon, and no skill associated...? ShowError("UnknownStatusChange [%d]\n", type); return 0; } @@ -8408,11 +8423,11 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_POISON: sc->opt2 |= OPT2_POISON; break; case SC_CURSE: sc->opt2 |= OPT2_CURSE; break; case SC_SILENCE: sc->opt2 |= OPT2_SILENCE; break; - + case SC_SIGNUMCRUCIS: sc->opt2 |= OPT2_SIGNUMCRUCIS; break; - + case SC_BLIND: sc->opt2 |= OPT2_BLIND; break; case SC_ANGELUS: sc->opt2 |= OPT2_ANGELUS; break; case SC_BLEEDING: sc->opt2 |= OPT2_BLEEDING; break; @@ -8460,6 +8475,7 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val sc->opt3 |= OPT3_AURABLADE; opt_flag = 0; break; +// case SC__BLOODYLUST: case SC_BERSERK: sc->opt3 |= OPT3_BERSERK; opt_flag = 0; @@ -8588,20 +8604,22 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val if (calc_flag) status_calc_bl(bl,calc_flag); - + if ( sc_isnew && StatusChangeStateTable[type] ) /* non-zero */ status_calc_state(bl,sc,( enum scs_flag ) StatusChangeStateTable[type],true); - + if(sd && sd->pd) pet_sc_check(sd, type); //Skotlex: Pet Status Effect Healing - switch( type ) - { + switch (type) { + case SC__BLOODYLUST: case SC_BERSERK: - sce->val2 = 5*status->max_hp/100; - status_heal(bl, status->max_hp, 0, 1); //Do not use percent_heal as this healing must override BERSERK's block. - status_set_sp(bl, 0, 0); //Damage all SP + if (!(sce->val2)) { //don't heal if already set + status_heal(bl, status->max_hp, 0, 1); //Do not use percent_heal as this healing must override BERSERK's block. + status_set_sp(bl, 0, 0); //Damage all SP + } + sce->val2 = 5 * status->max_hp / 100; break; case SC_CHANGE: status_percent_heal(bl, 100, 100); @@ -8678,12 +8696,14 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val return 1; } + /*========================================== - * �X�e�[�^�X�ُ�S���� + * Ending all status except those listed. + * @TODO maybe usefull for dispel instead reseting a liste there. * type: - * 0 - ??? - * 1 - ??? - * 2 - ??? + * 0 - PC killed -> Place here statuses that do not dispel on death. + * 1 - If for some reason status_change_end decides to still keep the status when quitting. + * 2 - Do clif *------------------------------------------*/ int status_change_clear(struct block_list* bl, int type) { @@ -8778,7 +8798,7 @@ int status_change_clear(struct block_list* bl, int type) } /*========================================== - * �X�e�[�^�X�ُ�I�� + * Special condition we want to effectuate, check before ending a status. *------------------------------------------*/ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const char* file, int line) { @@ -8790,7 +8810,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const int opt_flag=0, calc_flag; nullpo_ret(bl); - + sc = status_get_sc(bl); status = status_get_status_data(bl); @@ -8811,7 +8831,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if (sc->opt1) switch (type) { //"Ugly workaround" [Skotlex] - //delays status change ending so that a skill that sets opt1 fails to + //delays status change ending so that a skill that sets opt1 fails to //trigger when it also removed one case SC_STONE: sce->val3 = 0; //Petrify time counter. @@ -8832,8 +8852,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const (sc->count)--; if ( StatusChangeStateTable[type] ) - status_calc_state(bl,sc,( enum scs_flag ) StatusChangeStateTable[type],false); - + status_calc_state(bl,sc,( enum scs_flag ) StatusChangeStateTable[type],false); + sc->data[type] = NULL; vd = status_get_viewdata(bl); @@ -8967,9 +8987,9 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const if(sce->val4 && sce->val4 != BCT_SELF && (dsd=map_id2sd(sce->val4))) {// end status on partner as well dsc = dsd->sc.data[SC_DANCING]; - if(dsc) { + if(dsc) { - //This will prevent recursive loops. + //This will prevent recursive loops. dsc->val2 = dsc->val4 = 0; status_change_end(&dsd->bl, SC_DANCING, INVALID_TIMER); @@ -9033,7 +9053,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const int range = 1 +skill_get_range2(bl, status_sc2skill(type), sce->val1) +skill_get_range2(bl, TF_BACKSLIDING, 1); //Since most people use this to escape the hold.... - map_foreachinarea(status_change_timer_sub, + map_foreachinarea(status_change_timer_sub, bl->m, bl->x-range, bl->y-range, bl->x+range,bl->y+range,BL_CHAR,bl,sce,type,gettick()); } break; @@ -9066,7 +9086,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const enum sc_type type2 = (type == SC_MARIONETTE) ? SC_MARIONETTE2 : SC_MARIONETTE; struct block_list *pbl = map_id2bl(sce->val1); struct status_change* sc2 = pbl?status_get_sc(pbl):NULL; - + if (sc2 && sc2->data[type2]) { sc2->data[type2]->val1 = 0; @@ -9075,11 +9095,12 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const } break; + case SC__BLOODYLUST: case SC_BERSERK: case SC_SATURDAYNIGHTFEVER: //If val2 is removed, no HP penalty (dispelled?) [Skotlex] - if(status->hp > 100 && sce->val2) - status_set_hp(bl, 100, 0); + if (status->hp > 100 && sce->val2 && type != SC__BLOODYLUST) + status_set_hp(bl, 100, 0); if(sc->data[SC_ENDURE] && sc->data[SC_ENDURE]->val4 == 2) { sc->data[SC_ENDURE]->val4 = 0; @@ -9096,7 +9117,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const skill_delunitgroup(group); } break; - case SC_HERMODE: + case SC_HERMODE: if(sce->val3 == BCT_SELF) skill_clear_unitgroup(bl); break; @@ -9212,7 +9233,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const break; case SC_CURSEDCIRCLE_ATKER: if( sce->val2 ) // used the default area size cause there is a chance the caster could knock back and can't clear the target. - map_foreachinrange(status_change_timer_sub, bl, battle_config.area_size,BL_CHAR, bl, sce, SC_CURSEDCIRCLE_TARGET, gettick()); + map_foreachinrange(status_change_timer_sub, bl, battle_config.area_size,BL_CHAR, bl, sce, SC_CURSEDCIRCLE_TARGET, gettick()); break; case SC_RAISINGDRAGON: if( sd && sce->val2 && !pc_isdead(sd) ) { @@ -9362,6 +9383,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const sc->opt3 &= ~OPT3_AURABLADE; opt_flag = 0; break; +// case SC__BLOODYLUST: case SC_BERSERK: sc->opt3 &= ~OPT3_BERSERK; opt_flag = 0; @@ -9475,7 +9497,8 @@ int kaahi_heal_timer(int tid, unsigned int tick, int id, intptr_t data) } /*========================================== - * �X�e�[�^�X�ُ�I���^�C�}�[ + * For recusive status, like for each 5s we drop sp etc. + * Reseting the end timer. *------------------------------------------*/ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { @@ -9494,7 +9517,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) } sc = status_get_sc(bl); status = status_get_status_data(bl); - + if(!(sc && (sce = sc->data[type]))) { ShowDebug("status_change_timer: Null pointer id: %d data: %d bl-type: %d\n", id, data, bl->type); @@ -9528,7 +9551,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) case SC_CHASEWALK: if(!status_charge(bl, 0, sce->val4)) break; //Not enough SP to continue. - + if (!sc->data[SC_INCSTR]) { sc_start(bl, SC_INCSTR,100,1<<(sce->val1-1), (sc->data[SC_SPIRIT] && sc->data[SC_SPIRIT]->val2 == SL_ROGUE?10:1) //SL bonus -> x10 duration @@ -9538,20 +9561,20 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) return 0; break; - case SC_SKA: - if(--(sce->val2)>0){ - sce->val3 = rnd()%100; //Random defense. - sc_timer_next(1000+tick, status_change_timer,bl->id, data); - return 0; - } + case SC_SKA: + if(--(sce->val2)>0){ + sce->val3 = rnd()%100; //Random defense. + sc_timer_next(1000+tick, status_change_timer,bl->id, data); + return 0; + } break; case SC_HIDING: if(--(sce->val2)>0){ - + if(sce->val2 % sce->val4 == 0 && !status_charge(bl, 0, 1)) break; //Fail if it's time to substract SP and there isn't. - + sc_timer_next(1000+tick, status_change_timer,bl->id, data); return 0; } @@ -9563,12 +9586,12 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) map_foreachinrange( status_change_timer_sub, bl, sce->val3, BL_CHAR, bl, sce, type, tick); if( --(sce->val2)>0 ){ - sce->val4 += 250; // use for Shadow Form 2 seconds checking. + sce->val4 += 250; // use for Shadow Form 2 seconds checking. sc_timer_next(250+tick, status_change_timer, bl->id, data); return 0; } break; - + case SC_PROVOKE: if(sce->val2) { //Auto-provoke (it is ended in status_heal) sc_timer_next(1000*60+tick,status_change_timer, bl->id, data ); @@ -9602,9 +9625,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) if (--(sce->val3) > 0) { if (!sc->data[SC_SLOWPOISON]) { if( sce->val2 && bl->type == BL_MOB ) { - struct block_list* src = map_id2bl(sce->val2); - if( src ) - mob_log_damage((TBL_MOB*)bl,src,sce->val4); + struct block_list* src = map_id2bl(sce->val2); + if( src ) + mob_log_damage((TBL_MOB*)bl,src,sce->val4); } map_freeblock_lock(); status_zap(bl, sce->val4, 0); @@ -9681,7 +9704,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) } break; - case SC_DANCING: //�_���X�X�L���̎���SP���� + case SC_DANCING: //SP consumption by time of dancing skills { int s = 0; int sp = 1; @@ -9737,7 +9760,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) return 0; } break; - + case SC__BLOODYLUST: case SC_BERSERK: // 5% every 10 seconds [DracoRPG] if( --( sce->val3 ) > 0 && status_charge(bl, sce->val2, 0) && status->hp > 100 ) @@ -9797,7 +9820,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) return 0; } break; - + case SC_JAILED: if(sce->val1 == INT_MAX || --(sce->val1) > 0) { @@ -9807,7 +9830,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) break; case SC_BLIND: - if(sc->data[SC_FOGWALL]) + if(sc->data[SC_FOGWALL]) { //Blind lasts forever while you are standing on the fog. sc_timer_next(5000+tick, status_change_timer, bl->id, data); return 0; @@ -9815,8 +9838,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) break; case SC_ABUNDANCE: if(--(sce->val4) > 0) { - if( !sc->data[SC_BERSERK] ) - status_heal(bl,0,60,0); + status_heal(bl,0,60,0); sc_timer_next(10000+tick, status_change_timer, bl->id, data); } break; @@ -9838,7 +9860,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) if( --(sce->val4) >= 0 ) { int damage = status->max_hp/100; // {Target VIT x (New Poison Research Skill Level - 3)} + (Target HP/100) damage += status->vit * (sce->val1 - 3); - unit_skillcastcancel(bl,2); + unit_skillcastcancel(bl,2); map_freeblock_lock(); status_damage(bl, bl, damage, 0, clif_damage(bl,bl,tick,status_get_amotion(bl),status_get_dmotion(bl)+500,damage,1,0,0), 1); if( sc->data[type] ) { @@ -9864,7 +9886,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) } if( !flag ) { // Random Skill Cast - if( sd ) { + if (sd && !pc_issit(sd)) { //can't cast if sit int mushroom_skillid = 0, i; unit_stop_attack(bl); unit_skillcastcancel(bl,1); @@ -9899,7 +9921,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { //Damage is every 10 seconds including 3%sp drain. map_freeblock_lock(); clif_damage(bl,bl,tick,status_get_amotion(bl),1,1,0,0,0); - status_damage(NULL,bl,1,status->max_sp*3/100,0,16); + status_damage(NULL, bl, 1, status->max_sp * 3 / 100, 0, 0); //cancel dmg only if cancelable if( sc->data[type] ) { sc_timer_next(10000 + tick, status_change_timer, bl->id, data ); } @@ -9949,7 +9971,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) if( --(sce->val4) >= 0 ) { struct block_list *src = map_id2bl(sce->val3); - int damage = 1000 + 3 * status_get_max_hp(bl) / 100; // Deals fixed (1000 + 3%*MaxHP) + int damage = 1000 + 3 * status_get_max_hp(bl) / 100; // Deals fixed (1000 + 3%*MaxHP) map_freeblock_lock(); clif_damage(bl,bl,tick,0,0,damage,1,9,0); //damage is like endure effect with no walk delay @@ -10116,7 +10138,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) } break; - + case SC_SATURDAYNIGHTFEVER: // 1% HP/SP drain every val4 seconds [Jobbie] if( --(sce->val3) >= 0 ) @@ -10154,7 +10176,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) return 0; } break; - + case SC_REFLECTDAMAGE: if( --(sce->val4) >= 0 ) { if( !status_charge(bl,0,sce->val3) ) @@ -10208,9 +10230,9 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) { int hp = status->max_hp * (7-sce->val1) / 100; int sp = status->max_sp * (9-sce->val1) / 100; - + if( !status_charge(bl,hp,sp) ) break; - + sc_timer_next(1000+tick,status_change_timer,bl->id, data); return 0; } @@ -10269,7 +10291,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) return 0; case SC_MEIKYOUSISUI: if( --(sce->val4) > 0 ) - { + { status_heal(bl, status->max_hp * (sce->val1+1) / 100, status->max_sp * sce->val1 / 100, 0); sc_timer_next(1000 + tick, status_change_timer, bl->id, data); return 0; @@ -10278,7 +10300,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) case SC_IZAYOI: case SC_KAGEMUSYA: if( --(sce->val2) > 0 ) - { + { if(!status_charge(bl, 0, 1)) break; sc_timer_next(1000+tick, status_change_timer, bl->id, data); @@ -10293,7 +10315,7 @@ int status_change_timer(int tid, unsigned int tick, int id, intptr_t data) } /*========================================== - * �X�e�[�^�X�ُ�^�C�}�[�͈͏��� + * Foreach iteration of repetitive status *------------------------------------------*/ int status_change_timer_sub(struct block_list* bl, va_list ap) { @@ -10310,7 +10332,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) tsc = status_get_sc(bl); switch( type ) { - case SC_SIGHT: /* �T�C�g */ + case SC_SIGHT: /* Reveal hidden ennemy on 3*3 range */ if( tsc && tsc->data[SC__SHADOWFORM] && (sce && sce->val4 >0 && sce->val4%2000 == 0) && // for every 2 seconds do the checking rnd()%100 < 100-tsc->data[SC__SHADOWFORM]->val1*10 ) // [100 - (Skill Level x 10)] % status_change_end(bl, SC__SHADOWFORM, INVALID_TIMER); @@ -10321,7 +10343,7 @@ int status_change_timer_sub(struct block_list* bl, va_list ap) status_change_end(bl, SC_CAMOUFLAGE, INVALID_TIMER); status_change_end(bl, SC__INVISIBILITY, INVALID_TIMER); break; - case SC_RUWACH: /* ���A�t */ + case SC_RUWACH: /* Reveal hidden target and deal little dammages if ennemy */ if (tsc && (tsc->data[SC_HIDING] || tsc->data[SC_CLOAKING] || tsc->data[SC_CAMOUFLAGE] || tsc->data[SC_CLOAKINGEXCEED] || tsc->data[SC__INVISIBILITY])) { @@ -10384,7 +10406,7 @@ int status_change_clear_buffs (struct block_list* bl, int type) { if(!sc->data[i]) continue; - + switch (i) { //Stuff that cannot be removed case SC_WEIGHT50: @@ -10439,7 +10461,7 @@ int status_change_clear_buffs (struct block_list* bl, int type) case SC_CURSEDCIRCLE_ATKER: case SC_CURSEDCIRCLE_TARGET: continue; - + //Debuffs that can be removed. case SC_HALLUCINATION: case SC_QUAGMIRE: @@ -10465,11 +10487,12 @@ int status_change_clear_buffs (struct block_list* bl, int type) continue; break; //The rest are buffs that can be removed. + case SC__BLOODYLUST: case SC_BERSERK: case SC_SATURDAYNIGHTFEVER: if (!(type&1)) continue; - sc->data[i]->val2 = 0; + sc->data[i]->val2 = 0; break; default: if (!(type&1)) @@ -10490,14 +10513,14 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) { if( !sc || !sc->count ) return 0; - + tick = gettick(); for( i = SC_COMMON_MIN; i < SC_MAX; i++ ) { if( !sc->data[i] || i == SC_COMMON_MAX ) continue; - - switch( i ) { + + switch( i ) { //Debuffs that can be spreaded. // NOTE: We'll add/delte SCs when we are able to confirm it. case SC_CURSE: @@ -10567,7 +10590,7 @@ int status_change_spread( struct block_list *src, struct block_list *bl ) { flag = 1; } } - + return flag; } @@ -10679,11 +10702,11 @@ static int status_natural_heal(struct block_list* bl, va_list args) rate = natural_heal_diff_tick*(regen->rate.hp+bonus); if (ud && ud->walktimer != INVALID_TIMER) rate/=2; - // Homun HP regen fix (they should regen as if they were sitting (twice as fast) + // Homun HP regen fix (they should regen as if they were sitting (twice as fast) if(bl->type==BL_HOM) rate *=2; regen->tick.hp += rate; - + if(regen->tick.hp >= (unsigned int)battle_config.natural_healhp_interval) { val = 0; @@ -10700,11 +10723,11 @@ static int status_natural_heal(struct block_list* bl, va_list args) if(flag&RGN_SP) { rate = natural_heal_diff_tick*(regen->rate.sp+bonus); - // Homun SP regen fix (they should regen as if they were sitting (twice as fast) + // Homun SP regen fix (they should regen as if they were sitting (twice as fast) if(bl->type==BL_HOM) rate *=2; regen->tick.sp += rate; - + if(regen->tick.sp >= (unsigned int)battle_config.natural_healsp_interval) { val = 0; @@ -10726,7 +10749,7 @@ static int status_natural_heal(struct block_list* bl, va_list args) if(flag&RGN_SHP) { //Skill HP regen sregen->tick.hp += natural_heal_diff_tick * sregen->rate.hp; - + while(sregen->tick.hp >= (unsigned int)battle_config.natural_heal_skill_interval) { sregen->tick.hp -= battle_config.natural_heal_skill_interval; @@ -10779,7 +10802,7 @@ static int status_natural_heal_timer(int tid, unsigned int tick, int id, intptr_ * @return The chance to refine the item, in percent (0~100) **/ int status_get_refine_chance(enum refine_type wlv, int refine) { - + if ( refine < 0 || refine >= MAX_REFINE) return 0; @@ -10930,7 +10953,7 @@ int status_readdb(void) // read databases // - + #ifdef RENEWAL_ASPD sv_readdb(db_path, "re/job_db1.txt", ',', 6+MAX_WEAPON_TYPE, 6+MAX_WEAPON_TYPE, -1, &status_readdb_job1); #else |