Ver Fonte

Merge pull request #891 from rathena/hotfix/issue879

* Fixed #879. Added check while equipping Gun-type weapon X Ammo (bullets and grenades).
* Fixed Gunslinger's Spread Shot can be used by equipping Shotgun + Bullet or Grenade Launcher + Grenade.
Cydh Ramdh há 9 anos atrás
pai
commit
7426c4bf2f
2 ficheiros alterados com 33 adições e 1 exclusões
  1. 1 1
      db/re/skill_require_db.txt
  2. 32 0
      src/map/pc.c

+ 1 - 1
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
 
 //****

+ 32 - 0
src/map/pc.c

@@ -9323,6 +9323,38 @@ bool pc_equipitem(struct map_session_data *sd,short n,int req_pos)
 		return false;
 	}
 
+	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
+		 * 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 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;
+				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);