From b44e5e11f2c34c9182780c41395314fb1503ca90 Mon Sep 17 00:00:00 2001 From: aleos89 Date: Tue, 10 Jun 2014 12:24:19 -0400 Subject: [PATCH] Bug Fixes * Fixed characters moving to unavailable slots using Character Moving System. Thanks to Napster. (bugreport:8987) * Implemented MD_RANDOMTARGET. (bugreport:8781) (Hercules 10e6f1a) * Implemented a new define for renewal status point calculation to separate from default renewal define. Thanks to @cydh. (bugreport:8784) * Follow up to f511107 to fix a compile warning. * Forcefully save characters before opening a Vending Shop to prevent invalid data from saving. (bugreport:8955) * Fixed 2013-12-23 client from disconnecting after executing /limitedsale command. Thanks to Napster. (bugreport:9011) * Fixed Elemental Shield displaying a warning to the console. (bugreport:9016) * Elemental Shield requires a Blue Gemstone to cast. * Adjusted Flash Combo to only consume 65 SP. * Added missing skill_require_db defines for Episode 14.3 Part 2 skills in the pre-renewal database. --- conf/map_athena.conf | 2 +- db/packet_db.txt | 1 + db/pre-re/skill_require_db.txt | 20 ++++++++++++++++++++ db/re/skill_require_db.txt | 4 ++-- doc/mob_db_mode_list.txt | 3 +-- src/char/char_clif.c | 6 +++--- src/config/renewal.h | 6 ++++++ src/map/mob.c | 26 +++++++++++++++++--------- src/map/pc.c | 4 ++-- src/map/skill.c | 4 ++++ src/map/status.c | 2 +- src/map/vending.c | 5 ++++- 12 files changed, 62 insertions(+), 21 deletions(-) diff --git a/conf/map_athena.conf b/conf/map_athena.conf index 45ed4cf289..de550e88fd 100644 --- a/conf/map_athena.conf +++ b/conf/map_athena.conf @@ -95,7 +95,7 @@ minsave_time: 100 // Apart from the autosave_time, players will also get saved when involved // in the following (add as needed): // 1: after every successful trade -// 2: after every vending transaction +// 2: after opening vending/every vending transaction // 4: after closing storage/guild storage. // 8: After hatching/returning to egg a pet. // 16: After successfully sending a mail with attachment diff --git a/db/packet_db.txt b/db/packet_db.txt index 7975f9c919..045cc83d6e 100644 --- a/db/packet_db.txt +++ b/db/packet_db.txt @@ -2275,6 +2275,7 @@ packet_ver: 46 0x09D8,2,dull,0 //npcmarketclosed 0x09D6,-1,dull,0 //npcmarketpurchase 0x09DF,7 +0x09B4,6,dull,0 // Cash Shop - Special Tab //Add new packets here //packet_ver: 47 diff --git a/db/pre-re/skill_require_db.txt b/db/pre-re/skill_require_db.txt index 447f01191e..1e4b971d1b 100644 --- a/db/pre-re/skill_require_db.txt +++ b/db/pre-re/skill_require_db.txt @@ -940,6 +940,26 @@ 3027,0,0,55:60:65:70:75 ,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //OB_OBOROGENSOU 3029,0,0,20:30:40:50:60,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //OB_AKAITSUKI +// EP 14.3 Part 2 3rd Job Skills +5001,0,0,22:34:46:58:70,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GC_DARKCROW +5002,0,0,100:120:140:160:180,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //RA_UNLIMIT +5003,0,0,60:70:80:90:100,0,0,0,99,0,0,none,0,0,970,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GN_ILLUSIONDOPING +5004,0,0,30:35:40:45:50:55:60:65:70:75,0,0,0,99,0,0,dragon,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //RK_DRAGONBREATH_WATER +5005,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //RK_LUXANIMA +5006,0,0,60:70:80:90:100,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_MAGMA_ERUPTION +5007,0,0,200:230:260:290:320,0,0,0,13:14,0,0,none,0,0,6144,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //WM_FRIGG_SONG +5008,0,0,120,0,0,0,99,0,0,elementalspirit,0,0,717,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SO_ELEMENTAL_SHIELD +5009,0,0,65,0,0,0,99,0,0,none,0,5:5:4:4:3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SR_FLASHCOMBO +5010,0,0,30:26:22:18:14,0,0,0,99,0,0,none,0,0,7940,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SC_ESCAPE +5011,0,0,30:60:90:120:150,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //AB_OFFERTORIUM +5012,0,0,100:150:200:250:300,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //WL_TELEKINESIS_INTENSE +5013,0,0,200:180:160:140:120,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //LG_KINGS_GRACE +5014,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //ALL_FULL_THROTTLE +5015,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SR_FLASHCOMBO_ATK_STEP1 //All 4 steps are using temp req SP values for now. +5016,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SR_FLASHCOMBO_ATK_STEP2 +5017,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SR_FLASHCOMBO_ATK_STEP3 +5018,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SR_FLASHCOMBO_ATK_STEP4 + // Copied Bard / Dancer Skills //3036,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //BA_POEMBRAGI2 //3037,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //DC_FORTUNEKISS2 diff --git a/db/re/skill_require_db.txt b/db/re/skill_require_db.txt index 1153c09c7b..f3fd26310e 100644 --- a/db/re/skill_require_db.txt +++ b/db/re/skill_require_db.txt @@ -963,8 +963,8 @@ 5005,0,0,1,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //RK_LUXANIMA 5006,0,0,60:70:80:90:100,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //NC_MAGMA_ERUPTION 5007,0,0,200:230:260:290:320,0,0,0,13:14,0,0,none,0,0,6144,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //WM_FRIGG_SONG -5008,0,0,120,0,0,0,99,0,0,elementalspirit,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SO_ELEMENTAL_SHIELD -5009,0,0,75:65:55:45:35,0,0,0,99,0,0,none,0,5:5:4:4:3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SR_FLASHCOMBO +5008,0,0,120,0,0,0,99,0,0,elementalspirit,0,0,717,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SO_ELEMENTAL_SHIELD +5009,0,0,65,0,0,0,99,0,0,none,0,5:5:4:4:3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SR_FLASHCOMBO 5010,0,0,30:26:22:18:14,0,0,0,99,0,0,none,0,0,7940,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //SC_ESCAPE 5011,0,0,30:60:90:120:150,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //AB_OFFERTORIUM 5012,0,0,100:150:200:250:300,0,0,0,99,0,0,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //WL_TELEKINESIS_INTENSE diff --git a/doc/mob_db_mode_list.txt b/doc/mob_db_mode_list.txt index 09e41fc890..f919b0639a 100644 --- a/doc/mob_db_mode_list.txt +++ b/doc/mob_db_mode_list.txt @@ -26,7 +26,7 @@ MD_ANGRY | 0x000800 | 2048 MD_CHANGETARGET_MELEE | 0x001000 | 4096 MD_CHANGETARGET_CHASE | 0x002000 | 8192 MD_TARGETWEAK | 0x004000 | 16384 -MD_RANDOMTARGET | 0x008000 | 32768 (not implemented) +MD_RANDOMTARGET | 0x008000 | 32768 MD_IGNOREMELEE | 0x010000 | 65536 MD_IGNOREMAGIC | 0x020000 | 131072 MD_IGNORERANGED | 0x040000 | 262144 @@ -81,7 +81,6 @@ Target Weak: Allows aggressive monsters to only be aggressive against For example, a monster of level 104 will not pick fights with a level 99. Random Target: Picks a new random target in range on each attack / skill. - (not implemented) Ignore Melee: The mob will take 1 HP damage from physical attacks. diff --git a/src/char/char_clif.c b/src/char/char_clif.c index 035b7947aa..c4d60b9a79 100644 --- a/src/char/char_clif.c +++ b/src/char/char_clif.c @@ -57,8 +57,8 @@ int chclif_parse_moveCharSlot( int fd, struct char_session_data* sd){ return 1; } - // We dont even have a character on the chosen slot? - if( sd->found_char[from] <= 0 ){ + // We don't even have a character on the chosen slot? + if( sd->found_char[from] <= 0 || to >= sd->char_slots ){ chclif_moveCharSlotReply( fd, sd, from, 1 ); return 1; } @@ -78,7 +78,7 @@ int chclif_parse_moveCharSlot( int fd, struct char_session_data* sd){ return 1; } }else{ - // Admin doesnt allow us to + // Admin doesn't allow us to chclif_moveCharSlotReply( fd, sd, from, 1 ); return 1; } diff --git a/src/config/renewal.h b/src/config/renewal.h index 659170b24a..332d31254f 100644 --- a/src/config/renewal.h +++ b/src/config/renewal.h @@ -63,6 +63,12 @@ /// - some skill/item ASPD bonuses won't stack #define RENEWAL_ASPD +/// renewal stat calculations +/// (disable by commenting the line) +/// +/// leave this line to enable renewal calculation for increasing status/parameter points +#define RENEWAL_STAT + #endif #endif // _CONFIG_RENEWAL_H_ diff --git a/src/map/mob.c b/src/map/mob.c index 325c667548..69bda70538 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1637,10 +1637,16 @@ static bool mob_ai_sub_hard(struct mob_data *md, unsigned int tick) if(tbl->type == BL_PC) mob_log_damage(md, tbl, 0); //Log interaction (counts as 'attacker' for the exp bonus) - if( !(md->sc.option&OPTION_HIDE) ) + + if( !(mode&MD_RANDOMTARGET) ) unit_attack(&md->bl,tbl->id,1); - else - mobskill_use(md, tick, -1); + else { // Attack once and find a new random target + int search_size = (view_range < md->status.rhw.range) ? view_range : md->status.rhw.range; + unit_attack(&md->bl, tbl->id, 0); + tbl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md), search_size); + md->target_id = tbl->id; + md->min_chase = md->db->range3; + } return true; } @@ -3122,6 +3128,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) struct block_list *bl; struct mob_data *fmd = NULL; int i,j,n; + short skill_target; nullpo_ret(md); nullpo_ret(ms = md->db->skill); @@ -3221,10 +3228,11 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) continue; //Skill requisite failed to be fulfilled. //Execute skill + skill_target = (md->db->status.mode&MD_RANDOMTARGET) ? MST_RANDOM : ms[i].target; if (skill_get_casttype(ms[i].skill_id) == CAST_GROUND) { //Ground skill. short x, y; - switch (ms[i].target) { + switch (skill_target) { case MST_RANDOM: //Pick a random enemy within skill range. bl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md), skill_get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv)); @@ -3254,10 +3262,10 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) x = bl->x; y = bl->y; // Look for an area to cast the spell around... - if (ms[i].target >= MST_AROUND1 || ms[i].target >= MST_AROUND5) { - j = ms[i].target >= MST_AROUND1? - (ms[i].target-MST_AROUND1) +1: - (ms[i].target-MST_AROUND5) +1; + if (skill_target >= MST_AROUND1 || skill_target >= MST_AROUND5) { + j = skill_target >= MST_AROUND1? + (skill_target-MST_AROUND1) +1: + (skill_target-MST_AROUND5) +1; map_search_freecell(&md->bl, md->bl.m, &x, &y, j, j, 3); } md->skill_idx = i; @@ -3270,7 +3278,7 @@ int mobskill_use(struct mob_data *md, unsigned int tick, int event) } } else { //Targetted skill - switch (ms[i].target) { + switch (skill_target) { case MST_RANDOM: //Pick a random enemy within skill range. bl = battle_getenemy(&md->bl, DEFAULT_ENEMY_TYPE(md), skill_get_range2(&md->bl, ms[i].skill_id, ms[i].skill_lv)); diff --git a/src/map/pc.c b/src/map/pc.c index 9ec431fd87..ca2ae8a417 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6384,7 +6384,7 @@ int pc_need_status_point(struct map_session_data* sd, int type, int val) swap(low, high); for ( ; low < high; low++ ) -#ifdef RENEWAL // renewal status point cost formula +#ifdef RENEWAL_STAT // renewal status point cost formula sp += (low < 100) ? (2 + (low - 1) / 10) : (16 + 4 * ((low - 100) / 5)); #else sp += ( 1 + (low + 9) / 10 ); @@ -6408,7 +6408,7 @@ int pc_maxparameterincrease(struct map_session_data* sd, int type) base = final_val = pc_getstat(sd, type); while (final_val <= pc_maxparameter(sd, (enum e_params)(type-SP_STR)) && status_points >= 0) { -#ifdef RENEWAL // renewal status point cost formula +#ifdef RENEWAL_STAT // renewal status point cost formula status_points -= (final_val < 100) ? (2 + (final_val - 1) / 10) : (16 + 4 * ((final_val - 100) / 5)); #else status_points -= ( 1 + (final_val + 9) / 10 ); diff --git a/src/map/skill.c b/src/map/skill.c index 647f521b6a..020dd9ac1a 100755 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -10114,6 +10114,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui skill_attack(skill_get_type(RL_QD_SHOT),src,src,bl,skill_id,skill_lv,tick,flag|BCT_ENEMY|SD_LEVEL|SD_ANIMATION); break; + case SO_ELEMENTAL_SHIELD: + // Used to avoid displaying the warning below. + break; + default: ShowWarning("skill_castend_nodamage_id: Unknown skill used:%d\n",skill_id); clif_skill_nodamage(src,bl,skill_id,skill_lv,1); diff --git a/src/map/status.c b/src/map/status.c index fd2f9ea815..85332516c6 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2022,7 +2022,7 @@ int status_check_visibility(struct block_list *src, struct block_list *target) return 0; if (tsc->data[SC_CLOAKINGEXCEED] && !(status->mode&MD_BOSS) && (tsd->special_state.perfect_hiding || (status->mode&MD_DETECTOR))) return 0; - if (tsc && tsc->data[SC__FEINTBOMB] && !(status->mode&MD_BOSS|MD_DETECTOR)) + if (tsc && tsc->data[SC__FEINTBOMB] && !(status->mode&(MD_BOSS|MD_DETECTOR))) return 0; } break; diff --git a/src/map/vending.c b/src/map/vending.c index c420147678..d127422364 100755 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -271,7 +271,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, int uid, const ui } vsd->vend_num = cursor; - //Always save BOTH: buyer and customer + //Always save BOTH: customer (buyer) and vender if( save_settings&2 ) { chrif_save(sd,0); chrif_save(vsd,0); @@ -322,6 +322,9 @@ bool vending_openvending(struct map_session_data* sd, const char* message, const return false; } + if (save_settings&2) // Avoid invalid data from saving + chrif_save(sd, 0); + // filter out invalid items i = 0; for( j = 0; j < count; j++ ) {