Browse Source

Item DB update and script command adjustment (#1739)

* Made getequipid script command accept EQI_COMPOUND_ON (-1) for current equipment slot when running in item script.
* Added new equipment index for current item in item script context.
* Fixed typo in Fulbuk_Card item script.
* Fixed typo in Lich_Lord_Card effect.
Jittapan Pluemsumran 8 năm trước cách đây
mục cha
commit
887efa4ea4
5 tập tin đã thay đổi với 26 bổ sung24 xóa
  1. 6 0
      db/re/item_db.txt
  2. 5 6
      doc/script_commands.txt
  3. 1 0
      src/map/pc.h
  4. 13 18
      src/map/script.c
  5. 1 0
      src/map/script_constants.h

+ 6 - 0
db/re/item_db.txt

@@ -11394,6 +11394,12 @@
 27018,GC109_Card,GC109 Card,6,20,,10,,,,,0xFFFFFFFF,63,2,136,,,,,{ bonus bDelayrate,-(1+(BaseLevel>=90)+(BaseLevel>=120)); },{},{}
 27019,DR815_Card,DR815 Card,6,20,,10,,,,,0xFFFFFFFF,63,2,136,,,,,{ bonus bHit,1+(BaseLevel>=90)+(BaseLevel>=120); },{},{}
 27020,T_W_O_Card,T W O Card,6,20,,10,,,,,0xFFFFFFFF,63,2,2,,,,,{ bonus bAtkRate,10; bonus3 bAutoSpell,"NPC_WIDESOULDRAIN",2,50+((getrefine()/3)*10); },{},{}
+27025,Lich_Lord_Card,Lich Lord Card,6,20,,10,,,,,0xFFFFFFFF,63,2,136,,,,,{ bonus bDef,30; bonus bMdef,10; bonus2 bAddEff,Eff_Silence,900; if(getequipid() == 28483){ bonus bAtkRate,5; bonus bMatkRate,5; } /* TODO: Confirm Mob ID to transform */ autobonus "{ bonus bIgnoreDefClass,Class_All; bonus bIgnoreMdefRace,RC_All; }",20,7000,BF_WEAPON|BF_MAGIC,"{ active_transform 1875,7000; }"; },{},{}
+27026,Fire_Condor_Card,Fire Condor Card,6,20,,10,,,,,0xFFFFFFFF,63,2,136,,,,,{ bonus2 bVariableCastRate,"MG_FIREBALL",-50; bonus2 bSkillAtk,"MG_FIREBALL",100; },{},{}
+27027,Fire_Sandman_Card,Fire Sandman Card,6,20,,10,,,,,0xFFFFFFFF,63,2,16,,,,,{ bonus bDef,50; bonus2 bSubDefEle,Ele_Fire,10; },{},{}
+27028,Fire_Frilldora_Card,Fire Frilldora Card,6,20,,10,,,,,0xFFFFFFFF,63,2,2,,,,,{ .@r = getrefine(); bonus2 bMagicAddEle,Ele_Earth,3+((.@r>=7)*5)+((.@r>=9)*7); },{},{}
+27029,Fire_Golem_Card,Fire Golem Card,6,20,,10,,,,,0xFFFFFFFF,63,2,32,,,,,{ bonus2 bSubEle,Ele_Fire,20; bonus2 bAddEle,Ele_Fire,5; },{},{}
+27030,Fulbuk_Card,Fulbuk Card,6,20,,10,,,,,0xFFFFFFFF,63,2,769,,,,,{ bonus3 bAddEff,Eff_Burning,700,ATF_WEAPON|ATF_MAGIC; },{},{}
 //===================================================================
 // New Katars
 //===================================================================

+ 5 - 6
doc/script_commands.txt

@@ -2517,12 +2517,14 @@ Note: SECURE_NPCTIMEOUT must be enabled for this to work.
 \\
 ---------------------------------------
 
-*getequipid(<equipment slot>{,<char_id>})
+*getequipid({<equipment slot>,<char_id>})
 
-This function returns the item ID of the item equipped in the equipment slot 
-specified on the invoking character. If nothing is equipped there, it returns -1. 
+This function returns the item ID of the item slot that calls the script
+on the invoking character or the specified equipment slot. If nothing is
+equipped there, it returns -1.
 Valid equipment slots are:
 
+EQI_COMPOUND_ON (-1)      - Item slot that calls this script (In context of item script)
 EQI_ACC_L (0)             - Accessory 1
 EQI_ACC_R (1)             - Accessory 2
 EQI_SHOES (2)             - Footgear (shoes, boots)
@@ -2682,9 +2684,6 @@ This function returns the weapon level for the weapon equipped in the specified
 equipment slot on the invoking character. For a list of equipment slots see 
 'getequipid'.
 
-If -1 is passed as the equipment slot argument then the weapon level for the item calling this function, 
-assuming it is called by an item script, will be returned. Otherwise, 0 will be returned.
-
 Only EQI_HAND_L and EQI_HAND_R normally make sense, since only weapons have
 a weapon level. You can, however, probably, use this field for other equippable
 custom items as a flag or something.

+ 1 - 0
src/map/pc.h

@@ -45,6 +45,7 @@
 //Equip indexes constants. (eg: sd->equip_index[EQI_AMMO] returns the index
 //where the arrows are equipped)
 enum equip_index {
+	EQI_COMPOUND_ON = -1,
 	EQI_ACC_L = 0,
 	EQI_ACC_R,
 	EQI_SHOES,

+ 13 - 18
src/map/script.c

@@ -8514,39 +8514,34 @@ BUILDIN_FUNC(strnpcinfo)
 }
 
 /**
- * getequipid(<equipment slot>{,<char_id>})
+ * getequipid({<equipment slot>,<char_id>})
  **/
 BUILDIN_FUNC(getequipid)
 {
-	int i, num;
+	int i, num = EQI_COMPOUND_ON;
 	TBL_PC* sd;
-	struct item_data* item;
 
 	if (!script_charid2sd(3, sd)) {
 		script_pushint(st,-1);
 		return SCRIPT_CMD_FAILURE;
 	}
 
-	num = script_getnum(st,2);
-	if( !equip_index_check(num) )
-	{
-		script_pushint(st,-1);
-		return SCRIPT_CMD_FAILURE;
-	}
+	if (script_hasdata(st, 2))
+		num = script_getnum(st, 2);
 
-	// get inventory position of item
-	i = pc_checkequip(sd,equip_bitmask[num]);
-	if( i < 0 )
-	{
+	if (num == EQI_COMPOUND_ON)
+		i = current_equip_item_index;
+	else if (equip_index_check(num)) // get inventory position of item
+		i = pc_checkequip(sd, equip_bitmask[num]);
+	else {
 		script_pushint(st,-1);
 		return SCRIPT_CMD_SUCCESS;
 	}
 
-	item = sd->inventory_data[i];
-	if( item != 0 )
-		script_pushint(st,item->nameid);
+	if (i >= EQI_ACC_L && sd->inventory_data[i])
+		script_pushint(st, sd->inventory_data[i]->nameid);
 	else
-		script_pushint(st,0);
+		script_pushint(st, 0);
 
 	return SCRIPT_CMD_SUCCESS;
 }
@@ -23218,7 +23213,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(getguildmasterid,"i"),
 	BUILDIN_DEF(strcharinfo,"i?"),
 	BUILDIN_DEF(strnpcinfo,"i"),
-	BUILDIN_DEF(getequipid,"i?"),
+	BUILDIN_DEF(getequipid,"??"),
 	BUILDIN_DEF(getequipuniqueid,"i?"),
 	BUILDIN_DEF(getequipname,"i?"),
 	BUILDIN_DEF(getbrokenid,"i?"), // [Valaris]

+ 1 - 0
src/map/script_constants.h

@@ -708,6 +708,7 @@
 	export_constant2("bRegenPercentSP", SP_REGEN_PERCENT_SP);
 
 	/* equip indices */
+	export_constant(EQI_COMPOUND_ON);
 	export_constant(EQI_HEAD_TOP);
 	export_constant(EQI_ARMOR);
 	export_constant(EQI_HAND_L);