Преглед изворни кода

Fixed getinventorylist documentation

Fixes #1497.
Thanks to @Darkelfen for reporting it.

Additionally exported the EQP_* constants into the script engine.
Replaced some hardcoded equip positions with their respective constants.
Lemongrass3110 пре 8 година
родитељ
комит
a87d86cb11

+ 3 - 2
doc/script_commands.txt

@@ -2736,7 +2736,8 @@ recreate these items perfectly if they are destroyed. Here's what you get:
 
 @inventorylist_id[]        - array of item ids.
 @inventorylist_amount[]    - their corresponding item amounts.
-@inventorylist_equip[]     - whether the item is equipped or not.
+@inventorylist_equip[]     - on which position the item is equipped (see EQP_* constants)
+                             It will contain 0 if the item is not equipped.
 @inventorylist_refine[]    - for how much it is refined.
 @inventorylist_identify[]  - whether it is identified.
 @inventorylist_attribute[] - whether it is broken.
@@ -2746,7 +2747,7 @@ recreate these items perfectly if they are destroyed. Here's what you get:
 @inventorylist_card4[]       if the character owns an item made by a specific 
                              craftsman.
 @inventorylist_expire[]    - expire time (Unix time stamp). 0 means never expires.
-@inventorylist_bound[]     - whether it is bound to the character
+@inventorylist_bound[]     - the bound type of the items (see BOUND_* constants)
 @inventorylist_count       - the number of items in these lists.
 
 This could be handy to save/restore a character's inventory, since no other 

+ 1 - 1
npc/custom/quests/quest_shop.txt

@@ -127,7 +127,7 @@ OnBuyItem:
 		mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1]*.@q[1])+((.ShowID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+(.@q[.@i+1]*.@q[1])+")^000000";
 	next;
 	setarray @qe[1], getiteminfo(.@q[0],5), getiteminfo(.@q[0],11);
-	if (@qe[2] > 0 && ((@qe[1] & 1) || (@qe[1] & 256) || (@qe[1] & 512) || (@qe[1] & 1024) || (@qe[1] & 2048) || (@qe[1] & 4096) || (@qe[1] & 4) || (@qe[1] & 8192)))
+	if (@qe[2] > 0 && ((@qe[1] & EQP_HEAD_LOW) || (@qe[1] & EQP_HEAD_TOP) || (@qe[1] & EQP_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_TOP) || (@qe[1] & EQP_COSTUME_HEAD_MID) || (@qe[1] & EQP_COSTUME_HEAD_LOW) || (@qe[1] & EQP_GARMENT) || (@qe[1] & EQP_COSTUME_GARMENT)))
 		set .@preview,1;
 	addtimer 1000, strnpcinfo(0)+"::OnEnd";
 	while(1) {

+ 1 - 1
npc/merchants/socket_enchant.txt

@@ -259,7 +259,7 @@ function	script	Func_Socket	{
 	mes "Ah, and don't forget to bring that "+ getitemname(.@item_id) +"!";
 	next;
 	mes "[Seiyablem]";
-	if (getiteminfo(.@item_id,5) == 2) // EQP_HAND_R = 2, it's a weapon
+	if (getiteminfo(.@item_id,5) & EQP_HAND_R) // weapon
 	{
 		mes "I can try to add a slot now if you have the required items and zeny.";
 		mes "However, you should know that there's a chance that I might fail.";

+ 2 - 2
npc/merchants/socket_enchant2.txt

@@ -411,8 +411,8 @@ function	script	Func_Socket2	{
 	mes "[Leablem]";
 	mes "Did you already bring all of them?";
 	mes "For your information, if you fail to create a slot,";
-	mes "you will lose all the item requirement as well as the target "+ (getiteminfo(.@item_id,5) == 2 ? "weapon" : "armor") +".";// EQP_HAND_R = 2, it's a weapon, otherwise armor
-	mes "Also remember, if the "+ (getiteminfo(.@item_id,5) == 2 ? "weapon" : "armor") +" has been upgraded, and has been inserted with a card,";
+	mes "you will lose all the item requirement as well as the target "+ ((getiteminfo(.@item_id,5)&EQP_HAND_R) ? "weapon" : "armor") +".";
+	mes "Also remember, if the "+ ((getiteminfo(.@item_id,5)&EQP_HAND_R) ? "weapon" : "armor") +" has been upgraded, and has been inserted with a card,";
 	mes "you will lose them even if you succeed in creating a slot.";
 	next;
 	switch(select("Ask for slot creation.:Try next time."))

+ 44 - 25
npc/other/Global_Functions.txt

@@ -292,32 +292,51 @@ function	script	F_GetWeaponType	{
 }
 function	script	F_GetArmorType	{
 	switch(getiteminfo(getarg(0),5)) {
-		case 001: return "Lower Headgear"; break;
-		case 2: return callfunc("F_GetWeaponType",getarg(0)); break;
-		case 4: return "Garment"; break;
-		case 8: return "Accessory"; break;
-		case 16: return "Armor"; break;
-		case 32: return "Shield"; break;
-		case 64: return "Shoes"; break;
-		case 128: return "Accessory"; break;
-		case 136: return "Accessory"; break; //8+128
-		case 256: return "Upper Headgear"; break;
-		case 512: return "Middle Headgear"; break;
-		case 1024: return "Costume Upper Headgear"; break;
-		case 2048: return "Costume Midle Headgear"; break;
-		case 4096: return "Costume Lower Headgear"; break;
-		case 8192: return "Costume Garment"; break;
-		case 32768: return "Ammo"; break;
-		case 65536: return "Shadow Armor"; break;
-		case 131072: return "Shadow Weapon"; break;
-		case 262144: return "Shadow Shield"; break;
-		case 524288: return "Shadow Shoes"; break;
-		case 1048576: return "Shadow Accessory"; break;
-		case 2097152: return "Shadow Accessory"; break;
-		case 3145728: return "Shadow Accessory"; break; //1048576+2097152
-		default: return "Unknown Equip"; break;
+		case EQP_HEAD_LOW:
+			return "Lower Headgear";
+		case EQP_HAND_R:
+			return callfunc("F_GetWeaponType",getarg(0));
+		case EQP_GARMENT:
+			return "Garment";
+		case EQP_ACC_L:
+		case EQP_ACC_R:
+		case EQP_ACC_RL:
+			return "Accessory";
+		case EQP_ARMOR:
+			return "Armor";
+		case EQP_HAND_L:
+			return "Shield";
+		case EQP_SHOES:
+			return "Shoes";
+		case EQP_HEAD_TOP:
+			return "Upper Headgear";
+		case EQP_HEAD_MID:
+			return "Middle Headgear";
+		case EQP_COSTUME_HEAD_TOP:
+			return "Costume Upper Headgear";
+		case EQP_COSTUME_HEAD_MID:
+			return "Costume Midle Headgear";
+		case EQP_COSTUME_HEAD_LOW:
+			return "Costume Lower Headgear";
+		case EQP_COSTUME_GARMENT:
+			return "Costume Garment";
+		case EQP_AMMO:
+			return "Ammo";
+		case EQP_SHADOW_ARMOR:
+			return "Shadow Armor";
+		case EQP_SHADOW_WEAPON:
+			return "Shadow Weapon";
+		case EQP_SHADOW_SHIELD:
+			return "Shadow Shield";
+		case EQP_SHADOW_SHOES:
+			return "Shadow Shoes";
+		case EQP_SHADOW_ACC_R:
+		case EQP_SHADOW_ACC_L:
+		case EQP_SHADOW_ACC_RL:
+			return "Shadow Accessory";
+		default:
+			return "Unknown Equip";
 	}
-	end;
 }
 
 

+ 4 - 0
src/common/mmo.h

@@ -215,6 +215,10 @@ enum equip_pos {
 	EQP_SHADOW_SHOES     = 0x080000, // 524288
 	EQP_SHADOW_ACC_R     = 0x100000, // 1048576
 	EQP_SHADOW_ACC_L     = 0x200000, // 2097152
+
+	// Combined
+	EQP_ACC_RL			= EQP_ACC_R|EQP_ACC_L,
+	EQP_SHADOW_ACC_RL	= EQP_SHADOW_ACC_R|EQP_SHADOW_ACC_L,
 };
 
 struct point {

+ 26 - 1
src/map/script_constants.h

@@ -664,7 +664,7 @@
 	script_set_constant("bDropAddClass", SP_DROP_ADDCLASS, false);
 	script_set_constant("bNoMadoFuel", SP_NO_MADO_FUEL, false);
 
-	/* equip positions */
+	/* equip indices */
 	export_constant(EQI_HEAD_TOP);
 	export_constant(EQI_ARMOR);
 	export_constant(EQI_HAND_L);
@@ -687,6 +687,31 @@
 	export_constant(EQI_SHADOW_ACC_R);
 	export_constant(EQI_SHADOW_ACC_L);
 
+	/* equip positions */
+	export_constant(EQP_ACC_L);
+	export_constant(EQP_ACC_R);
+	export_constant(EQP_SHOES);
+	export_constant(EQP_GARMENT);
+	export_constant(EQP_HEAD_LOW);
+	export_constant(EQP_HEAD_MID);
+	export_constant(EQP_HEAD_TOP);
+	export_constant(EQP_ARMOR);
+	export_constant(EQP_HAND_L);
+	export_constant(EQP_HAND_R);
+	export_constant(EQP_COSTUME_HEAD_TOP);
+	export_constant(EQP_COSTUME_HEAD_MID);
+	export_constant(EQP_COSTUME_HEAD_LOW);
+	export_constant(EQP_COSTUME_GARMENT);
+	export_constant(EQP_AMMO);
+	export_constant(EQP_SHADOW_ARMOR);
+	export_constant(EQP_SHADOW_WEAPON);
+	export_constant(EQP_SHADOW_SHIELD);
+	export_constant(EQP_SHADOW_SHOES);
+	export_constant(EQP_SHADOW_ACC_R);
+	export_constant(EQP_SHADOW_ACC_L);
+	export_constant(EQP_ACC_RL);
+	export_constant(EQP_SHADOW_ACC_RL);
+
 	/* looks */
 	export_constant(LOOK_BASE);
 	export_constant(LOOK_HAIR);