From c699304bd95b5c3bf9dddcca1dd2fe842169c650 Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Thu, 7 Jan 2016 00:54:57 +0700 Subject: [PATCH 1/3] Gunslinger Fixes * Fixed #879. Added check while equiping Gun-type weapon X Ammo (bullets and grenades). * Fixed Gunslinger's Spread Shot can be used by equipping Shotgun + Bullet or Grenade Launcher + Grenade. * Fixed Gunslinger's Mine (Ground Drift) must cannot be casted on target's foot and must cannot be stacked. Signed-off-by: Cydh Ramdh --- db/re/skill_require_db.txt | 2 +- db/re/skill_unit_db.txt | 2 +- src/map/pc.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/db/re/skill_require_db.txt b/db/re/skill_require_db.txt index b6b6c1ae69..9a51e13975 100644 --- a/db/re/skill_require_db.txt +++ b/db/re/skill_require_db.txt @@ -502,7 +502,7 @@ 517,0,0,30:32:34:36:38:40:42:44:46:48,0,0,0,19,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 //GS_GATLINGFEVER 518,0,0,3:6:9:12:15:18:21:24:27:30,0,0,0,20,3,1,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GS_DUST 519,0,0,20:25:30:35:40:45:50:55:60:65,0,0,0,20,3,2:2:4:4:6:6:8:8:10:10,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GS_FULLBUSTER -520,0,0,15:20:25:30:35:40:45:50:55:60,0,0,0,20:21,3,5,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0//GS_SPREADATTACK +520,0,0,15:20:25:30:35:40:45:50:55:60,0,0,0,20:21,3:5,5,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0//GS_SPREADATTACK 521,0,0,4:8:12:16:20:24:28:32:36:40,0,0,0,21,5,1,none,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 //GS_GROUNDDRIFT //**** diff --git a/db/re/skill_unit_db.txt b/db/re/skill_unit_db.txt index 464c95cabb..12fb096518 100644 --- a/db/re/skill_unit_db.txt +++ b/db/re/skill_unit_db.txt @@ -97,7 +97,7 @@ 484,0xb8, , 2, 0, 500,enemy, 0x8808 //HW_GRAVITATION 488,0xb9, , 3, 0, -1,all, 0x200 //CG_HERMODE 516,0x86, , 3, 0, 100,enemy, 0x000 //GS_DESPERADO -521,0xbe, , 0, 1,1000,enemy, 0x000 //GS_GROUNDDRIFT +521,0xbe, , 0, 1,1000,enemy, 0x006 //GS_GROUNDDRIFT 525,0x86, , 0, 2,1000,enemy, 0x018 //NJ_HUUMA 527,0xbc, , -1, 0,2000,enemy, 0x018 //NJ_TATAMIGAESHI 535,0xbd, , -1, 0, 20,enemy, 0x8010 //NJ_KAENSIN diff --git a/src/map/pc.c b/src/map/pc.c index 68e9d67bd0..604c803fbf 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9306,6 +9306,38 @@ bool pc_equipitem(struct map_session_data *sd,short n,int req_pos) return false; } + if ((sd->class_&MAPID_BASEMASK) == MAPID_GUNSLINGER && (id->type == IT_AMMO || (id->type == IT_WEAPON && id->look >= W_REVOLVER && id->look <= W_GRENADE))) { + /** Failing condition: + * 1. Always failed to equip ammo if no weapon equipped yet + * 2. Grenade only can be equipped if weapon is Grenade Launcher + * 3. Bullet cannot be equipped if the weapon is Grenade Launcher + * (4. The rest is relying on item job/class restriction). + **/ + if (id->type == IT_AMMO) { + int w_idx = sd->equip_index[EQI_HAND_R]; + enum weapon_type w_type = (w_idx != -1) ? (enum weapon_type)sd->inventory_data[w_idx]->look : W_FIST; + if (w_idx == -1 || + (id->look == A_GRENADE && w_type != W_GRENADE) || + (id->look != A_GRENADE && w_type == W_GRENADE)) + { + clif_equipitemack(sd, 0, 0, ITEM_EQUIP_ACK_FAIL); + return false; + } + } + else { + int a_idx = sd->equip_index[EQI_AMMO]; + if (a_idx != -1) { + enum ammo_type a_type = (enum ammo_type)sd->inventory_data[a_idx]->look; + if ((a_type == A_GRENADE && id->look != W_GRENADE) || + (a_type != A_GRENADE && id->look == W_GRENADE)) + { + clif_equipitemack(sd, 0, 0, ITEM_EQUIP_ACK_FAIL); + return false; + } + } + } + } + if (id->flag.bindOnEquip && !sd->status.inventory[n].bound) { sd->status.inventory[n].bound = (char)battle_config.default_bind_on_equip; clif_notify_bindOnEquip(sd,n); From 0ffbc20fd41a45cf8ac5649d561329de2ef3b79b Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Thu, 7 Jan 2016 06:18:38 +0700 Subject: [PATCH 2/3] Follow up c699304bd95b5c3bf9dddcca1dd2fe842169c650, removed redundant check. Thank @Lemongrass3110 Signed-off-by: Cydh Ramdh --- src/map/pc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/map/pc.c b/src/map/pc.c index 604c803fbf..962d37ba6e 100755 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9306,7 +9306,7 @@ bool pc_equipitem(struct map_session_data *sd,short n,int req_pos) return false; } - if ((sd->class_&MAPID_BASEMASK) == MAPID_GUNSLINGER && (id->type == IT_AMMO || (id->type == IT_WEAPON && id->look >= W_REVOLVER && id->look <= W_GRENADE))) { + if ((sd->class_&MAPID_BASEMASK) == MAPID_GUNSLINGER) { /** Failing condition: * 1. Always failed to equip ammo if no weapon equipped yet * 2. Grenade only can be equipped if weapon is Grenade Launcher @@ -9324,7 +9324,7 @@ bool pc_equipitem(struct map_session_data *sd,short n,int req_pos) return false; } } - else { + else if (id->type == IT_WEAPON && id->look >= W_REVOLVER && id->look <= W_GRENADE) { int a_idx = sd->equip_index[EQI_AMMO]; if (a_idx != -1) { enum ammo_type a_type = (enum ammo_type)sd->inventory_data[a_idx]->look; From 68ab3d89fb55b08991de071baf60c75baf6b7f0b Mon Sep 17 00:00:00 2001 From: Cydh Ramdh Date: Thu, 7 Jan 2016 11:37:01 +0700 Subject: [PATCH 3/3] Reverted Ground Drift changes on c699304bd95b5c3bf9dddcca1dd2fe842169c650 Signed-off-by: Cydh Ramdh --- db/re/skill_unit_db.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/re/skill_unit_db.txt b/db/re/skill_unit_db.txt index 12fb096518..464c95cabb 100644 --- a/db/re/skill_unit_db.txt +++ b/db/re/skill_unit_db.txt @@ -97,7 +97,7 @@ 484,0xb8, , 2, 0, 500,enemy, 0x8808 //HW_GRAVITATION 488,0xb9, , 3, 0, -1,all, 0x200 //CG_HERMODE 516,0x86, , 3, 0, 100,enemy, 0x000 //GS_DESPERADO -521,0xbe, , 0, 1,1000,enemy, 0x006 //GS_GROUNDDRIFT +521,0xbe, , 0, 1,1000,enemy, 0x000 //GS_GROUNDDRIFT 525,0x86, , 0, 2,1000,enemy, 0x018 //NJ_HUUMA 527,0xbc, , -1, 0,2000,enemy, 0x018 //NJ_TATAMIGAESHI 535,0xbd, , -1, 0, 20,enemy, 0x8010 //NJ_KAENSIN