瀏覽代碼

Workaround to solve issue with news cards in enchants NPCs (#2795)

* Workaround to solve issue with news cards in enchants NPCs

Thanks to @Lemongrass3110, @Everade !
Atemo 7 年之前
父節點
當前提交
3bcb37bf86

+ 4 - 4
npc/events/RWC_2012.txt

@@ -315,7 +315,7 @@ prontera,147,59,3	script	Goldberg#pron	878,{
 			mes "I'm sorry. But you don't have the RWC Initialization coupon. Can you check your inventory?";
 			close;
 		}
-		if (.@equip_card[3] == 0) {
+		if (callfunc("F_IsCharm",.@equip_card[3]) == false) {
 			mes "[Goldberg]";
 			mes "Hm... this equipment is clean. I cannot initialize it if there's nothing! Check it again.";
 			close;
@@ -327,9 +327,9 @@ prontera,147,59,3	script	Goldberg#pron	878,{
 		delequip .@part;
 	
 //		GetNonSlotItemSock2 .@equip_refine .@equip_id .@equip_card[0] .@equip_card[1] .@equip_card[2] .@equip_card[3]
-		for(set .@i,0; .@i<4; set .@i,.@i+1) {
-			if (.@equip_card[.@i] >= 4700) // Armor Enchant System
-				set .@equip_card[.@i],0;
+		for ( .@i = getiteminfo(.@equip_id,10); .@i < MAX_SLOTS; .@i++ ) {
+			if (callfunc("F_IsCharm",.@equip_card[.@i]) == true)
+				.@equip_card[.@i] = 0;// Armor Enchant System
 		}
 		getitem2 .@equip_id,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];
 		

+ 8 - 0
npc/other/Global_Functions.txt

@@ -759,3 +759,11 @@ function	script	close3	{
 	cutin "",255;
 	end;
 }
+
+//////////////////////////////////////////////////////////////////////////////////
+// Return true if the card is a charm (enchant card), false otherwise.
+//////////////////////////////////////////////////////////////////////////////////
+function	script	F_IsCharm	{
+	.@id = getarg(0);
+	return ((.@id >= 4700 && .@id < 5000) || (.@id >= 29000 && .@id <= 29162));
+}

+ 17 - 15
npc/re/merchants/card_separation.txt

@@ -105,7 +105,8 @@
 		break;
 	}
 
-	setarray .@equip_card[0], getequipcardid(.@equip_num,0),getequipcardid(.@equip_num,1),getequipcardid(.@equip_num,2),getequipcardid(.@equip_num,3);
+	setarray .@check_equip_card[0], getequipcardid(.@equip_num,0),getequipcardid(.@equip_num,1),getequipcardid(.@equip_num,2),getequipcardid(.@equip_num,3);
+	setarray .@equip_card[0], .@check_equip_card[0], .@check_equip_card[1], .@check_equip_card[2], .@check_equip_card[3];
 	set .@mvp_list$,
 		"|4408|4128|4456|4168|4142"+  //Gloom_Under_Night_Card, Golden_Bug_Card, Nidhogg_Shadow_Card, Dark_Lord_Card, Doppelganger_Card
 		"|4134|4137|4386|4407|4357"+  //Dracula_Card, Drake_Card, Detale_Card, Randgris_Card, B_Seyren_Card
@@ -118,9 +119,9 @@
 		"|4363|4324|4361|4330|4342|"; //B_Magaleta_Card, Garm_Card, B_Harword_Card, Dark_Snake_Lord_Card, Rsx_0806_Card
 
 	if (.@Jeremy) {
-		for(set .@i,0; .@i<4; set .@i,.@i+1) {
-			if (.@equip_card[.@i] >= 4700) // Armor Enchant System
-				set .@equip_card[.@i],0;
+		for ( .@i = 0; .@i < MAX_SLOTS; .@i++ ) {
+			if (callfunc("F_IsCharm",.@equip_card[.@i]) == true)
+				.@equip_card[.@i] = 0;// Armor Enchant System
 		}
 		if (!getarraysize(.@equip_card)) {
 			mes .@n$;
@@ -136,7 +137,7 @@
 		// Official "Richard" script uses a hardcoded list including every possible item.
 		//if (!getequipisequiped(.@equip_num)) {
 		//	mes "[Richard]";
-		//	mes "I'm sorry. We don't provide that equipmnet yet.";
+		//	mes "I'm sorry. We don't provide that equipment yet.";
 		//	close;
 		//}
 
@@ -144,11 +145,12 @@
 		mes "Which number socket do you want to separate the card? From the left socket, they are sorted 1,2,3,4.";
 		next;
 		set .@menu$,"";
-		for(set .@i,0; .@i<4; set .@i,.@i+1) {
-			if (.@equip_card[.@i] && .@equip_card[.@i] < 4700) // Armor Enchant System
-				set .@menu$, .@menu$+"Socket "+(.@i+1)+" - "+getitemname(.@equip_card[.@i])+":";
-			else
-				set .@menu$, .@menu$+"^777777Socket "+(.@i+1)+" - No card^000000:";
+		for ( .@i = 0; .@i < MAX_SLOTS; .@i++ ) {
+			if (.@equip_card[.@i] && callfunc("F_IsCharm",.@equip_card[.@i]) == false) // Armor Enchant System
+				.@menu$ = .@menu$ + "Socket " + (.@i+1) + " - " + getitemname(.@equip_card[.@i])+":";
+			else {
+				.@menu$ = .@menu$ + "^777777Socket " + (.@i+1) + " - No card^000000:";
+			}
 		}
 		set .@i, select("Stop the work:"+.@menu$);
 		switch(.@i) {
@@ -158,7 +160,7 @@
 			close;
 		default:
 			set .@slot, .@i-2;
-			if (.@equip_card[.@slot] == 0 || .@equip_card[.@slot] >= 4700) {
+			if (.@equip_card[.@slot] == 0 || callfunc("F_IsCharm",.@equip_card[.@slot]) == true) {
 				mes .@n$;
 				mes "This socket is not equipped with any card. Why don't you check again?";
 				close;
@@ -287,7 +289,7 @@
 	set .@equip_refine, getequiprefinerycnt(.@equip_num);
 
 	// anti-hack
-	if (callfunc("F_IsEquipCardHack", .@equip_num, .@equip_card[0], .@equip_card[1], .@equip_card[2], .@equip_card[3]))
+	if (callfunc("F_IsEquipCardHack", .@equip_num, .@check_equip_card[0], .@check_equip_card[1], .@check_equip_card[2], .@check_equip_card[3]))
 		close;
 
 	delequip .@equip_num;
@@ -314,12 +316,12 @@
 		}
 	} else {
 		set .@card, .@equip_card[.@slot];
-		set .@equip_card[.@slot],0;
+		set .@check_equip_card[.@slot],0;
 
-		// Chance of retaining equipment.
+		// Chance of retaining equipment (all enchantments are preserved).
 		if (rand(1,.@sf_w_num) < 61) {
 			set .@equip_safe,1;
-			getitem2 .@equip_id,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];
+			getitem2 .@equip_id,1,1,.@equip_refine,0,.@check_equip_card[0],.@check_equip_card[1],.@check_equip_card[2],.@check_equip_card[3];
 		}
 
 		// Chance of retaining card.

+ 5 - 5
npc/re/merchants/enchan_ko.txt

@@ -258,15 +258,15 @@ que_ng,75,20,3	script	Artisan Tene#ko	762,{
 
 	// Initialization
 	if (.@select == 2) {
-		if (.@sot03_ck) {
-			if (.@equip_card[2] < 4700) { // Armor Enchant System
+		if (.@sot03_ck) {// reset only 3rd slot
+			if (callfunc("F_IsCharm",.@equip_card[2]) == false) { // Armor Enchant System
 				mes "[Artisan Tene]";
 				mes "The third slot is is not enchanted. Please check again."; //custom translation
 				close;
 			}
 			set .@equip_card[2],0;
 		} else {
-			if (.@equip_card[3] < 4700) { // Armor Enchant System
+			if (callfunc("F_IsCharm",.@equip_card[3]) == false) { // Armor Enchant System
 				mes "[Artisan Tene]";
 				mes "This equipment is is not enchanted. Please check again."; //custom translation
 				close;
@@ -294,8 +294,8 @@ que_ng,75,20,3	script	Artisan Tene#ko	762,{
 	else                           set .@ko_type01,5;
 
 	//custom translations
-	if (.@equip_card[3] >= 4700) { // Armor Enchant System
-		if (.@equip_card[2] >= 4700) {
+	if (callfunc("F_IsCharm",.@equip_card[3]) == true) { // Armor Enchant System
+		if (callfunc("F_IsCharm",.@equip_card[2]) == true) {
 			mes "[Artisan Tene]";
 			mes "This equipment cannot be further enchanted.";
 			next;

+ 3 - 3
npc/re/merchants/enchan_mal.txt

@@ -649,9 +649,9 @@ L_Socket:
 		delequip EQI_HAND_R;
 
 //		GetNonSlotItemSock2 .@equip_refine .@equip_id .@equip_card[0] .@equip_card[1] .@equip_card[2] .@equip_card[3]
-		for(set .@i,0; .@i<4; set .@i,.@i+1) {
-			if (.@equip_card[.@i] >= 4700) // Armor Enchant System
-				set .@equip_card[.@i],0;
+		for ( .@i = getiteminfo(.@equip_id,10); .@i < MAX_SLOTS; .@i++ ) {
+			if (callfunc("F_IsCharm",.@equip_card[.@i]) == true)
+				.@equip_card[.@i] = 0;// Armor Enchant System
 		}
 		getitem2 .@equip_id,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];
 

+ 3 - 3
npc/re/merchants/enchan_mora.txt

@@ -1150,9 +1150,9 @@ L_Socket:
 		delequip .@part;
 
 //		GetNonSlotItemSock2 .@equip_refine .@equip_id .@equip_card[0] .@equip_card[1] .@equip_card[2] .@equip_card[3]
-		for(set .@i,0; .@i<4; set .@i,.@i+1) {
-			if (.@equip_card[.@i] >= 4700) // Armor Enchant System
-				set .@equip_card[.@i],0;
+		for ( .@i = getiteminfo(.@equip_id,10); .@i < MAX_SLOTS; .@i++ ) {
+			if (callfunc("F_IsCharm",.@equip_card[.@i]) == true)
+				.@equip_card[.@i] = 0;// Armor Enchant System
 		}
 		getitem2 .@equip_id,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],.@equip_card[3];
 

+ 1 - 1
npc/re/merchants/enchan_upg.txt

@@ -250,7 +250,7 @@ prt_in,28,73,3	script	Devil Enchant Master#prq	63,{
 			mes "You need to bring some money to initialize!!";
 			close;
 		}
-		if (.@equip_card[3] < 4700) { // Armor Enchant System
+		if (callfunc("F_IsCharm",.@equip_card[3]) == false) {
 			mes "This item is not enchanted!";
 			close;
 		}

+ 2 - 2
npc/re/quests/quests_malangdo.txt

@@ -10662,6 +10662,7 @@ mal_in01,15,16,3	script	Fallen Angel#mal	403,{
 		}
 		specialeffect2 EF_REPAIRWEAPON;
 		progressbar "ffff00",2;
+		setarray .@equip_card[0], getequipcardid(EQI_GARMENT,0),getequipcardid(EQI_GARMENT,1),getequipcardid(EQI_GARMENT,2),getequipcardid(EQI_GARMENT,3);
 		if (getequipisequiped(EQI_GARMENT) == 0) {
 			mes "[Fallen Angel]";
 			mes "The Archangel Wing has been taken out!";
@@ -10677,13 +10678,12 @@ mal_in01,15,16,3	script	Fallen Angel#mal	403,{
 			mes "I can't do it if you can't pay!";
 			close;
 		}
-		if (getequipcardid(EQI_GARMENT,3) < 4700) { // Armor Enchant System
+		if (callfunc("F_IsCharm",.@equip_card[3]) == false) {
 			mes "[Fallen Angel]";
 			mes "This equipment has not been enchanted, please check it again!";
 			close;
 		}
 		set .@equip_refine, getequiprefinerycnt(EQI_GARMENT);
-		setarray .@equip_card[0], getequipcardid(EQI_GARMENT,0),getequipcardid(EQI_GARMENT,1),getequipcardid(EQI_GARMENT,2);
 		delitem 6417,3; //Silvervine
 		delequip EQI_GARMENT;
 		getitem2 2573,1,1,.@equip_refine,0,.@equip_card[0],.@equip_card[1],.@equip_card[2],0; //Archangel_Wing