summaryrefslogtreecommitdiff
path: root/npc/custom/item_signer.txt
blob: a0097bb5527b6c640f5ded7220cc41f710248b83 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//===== Hercules Script ======================================
//= Sign Your Items
//===== By: ==================================================
//= Lupus
//===== Current Version: =====================================
//= 1.1a
//===== Description: =========================================
//= Write you name on your rare equipment or weapon ^_-
//===== Additional Comments: =================================
//= 1.1 Cleaned and edited for general use. [Euphy]
//= 1.1a Added 'disable_items' command. [Euphy]
//============================================================

prt_in,24,61,7	script	Perchik	1_M_01,{
	setarray .@item[0],644,3;	// Item requirements: <ID>,<Count>{,...} (0 to disable)
	setarray .@cost[0],0,5000;	// Zeny requirements: <base price>,<price per refine>

	disable_items;
	mes "[Perchik]";
	mes "I can ^0055FFsign your name^000000 on almost any rare item you hold.";
	next;
	if(select("Tell me more...", "Sign my items, please!") == 1) {
		mes "[Perchik]";
		mes "I can put your name on any slotless equipment or weapon.";
		emotion e_ic;
		next;
		mes "[Perchik]";
		if (getarraysize(.@item) || getarraysize(.@cost)) {
			mes "For my work I accept:";
			if (getarraysize(.@item)) for(set .@i,0; .@i<getarraysize(.@item); set .@i,.@i+2)
				mes " ~ "+.@item[.@i+1]+"x "+getitemname(.@item[.@i]);
			if (.@cost[0]) mes " ~ "+.@cost[0]+" Zeny";
			if (.@cost[1]) mes " ~ "+.@cost[1]+" Zeny per refine";
		}
		else mes "I work for free, but...";
		next;
		emotion e_cry;
		mes "[Perchik]";
		mes "Alas, I have 12 hungry children";
		mes "and a very angry wife.";
		next;
		mes "[Perchik]";
		mes "Or it was 12 angry children";
		mes "and a very hungry wife...";
		emotion e_hmm;
		close;
	}
	mes "[Perchik]";
	mes "Show me your items to sign...";
	next;
	setarray .@pos$[1],"Upper Headgear","Armor","Left hand","Right hand","Garment","Footgear","Left Accessory","Right Accessory","Mid Headgear","Lower Headgear";
	set .@menu$,"";
	for (set .@i,1; .@i<=10; set .@i,.@i+1) {
		if (getequipisequiped(.@i))
			set .@menu$, .@menu$+.@pos$[.@i]+" [^0055FF"+getequipname(.@i)+"^000000]";
		set .@menu$, .@menu$+":";
	}
	set .@part, select(.@menu$);
	set .@id, getequipid(.@part);
	set .@ref, getequiprefinerycnt(.@part);
	mes "[Perchik]";
	if (!getequipisequiped(.@part)) {
		mes "Nothing is equipped there!";
		emotion e_wah;
		close;
	}
	for(set .@i,0; .@i<4; set .@i,.@i+1)
		set .@slot[.@i], getequipcardid(.@part,.@i);
	if (.@slot[0]==255 || .@slot[0]==254 || .@slot[0]<0) {
		mes "Alas, this item's already signed.";
		mes "I would never touch a master's work.";
		emotion e_hmm;
		close;
	}
	if (.@slot[0]>4000 && .@slot[0]<5000) {
		mes "A card? Here?!";
		mes "As I said before, I don't sign items with cards.";
		emotion e_hmm;
		close;
	}
	if (getiteminfo(.@id,10)) {
		mes "Sorry, I don't sign slotted items.";
		emotion e_sry;
		close;
	}
	getinventorylist;
	for(set .@i,0; .@i<@inventorylist_count; set .@i,.@i+1)
		if (@inventorylist_expire[.@i] != 0) {
			mes "Sorry, I don't sign rental items!";
			emotion e_hmm;
			close;
		}
	set .@price, .@cost[0]+(.@cost[1]*.@ref);
	if (getarraysize(.@item) || .@price) {
		mes "I will need:";
		if (getarraysize(.@item)) for(set .@i,0; .@i<getarraysize(.@item); set .@i,.@i+2) {
			mes " ~ "+.@item[.@i+1]+"x "+getitemname(.@item[.@i]);
			if (countitem(.@item[.@i]) < .@item[.@i+1]) set .@nr,1;
		}
		if (.@price) mes " ~ "+.@price+" Zeny";
	}
	mes "Shall I sign your ^0055FF"+getitemname(.@id)+"^000000?";
	next;
	if(select("Ok!", "Leave")==2) {
		mes "[Perchik]";
		mes "See you...";
		emotion e_yawn;
		close;
	}
	mes "[Perchik]";
	if (Zeny < .@price || .@nr) {
		mes "I don't work for 'thanks'.";
		emotion e_sry;
		close;
	}
	if (!countitem2(.@id,1,.@ref,0,.@slot[0],.@slot[1],.@slot[2],.@slot[3])) {
		mes "Where is "+getitemname(@id)+"...?";
		npctalk "You're a snoozy cheater!";
		logmes "CHEATER: Tried to sign an item not having it: "+getitemname(@id);
		emotion e_wah;
		close;
	}
	if (.@price) Zeny -= .@price;
	if (getarraysize(.@item))  for(set .@i,0; .@i<getarraysize(.@item); set .@i,.@i+2)
		delitem .@item[.@i], .@item[.@i+1];
	delitem2 .@id,1,1,.@ref,0,.@slot[0],.@slot[1],.@slot[2],.@slot[3];
	mes "Done!";
	emotion e_proud;
	getitem2 .@id,1,1,.@ref,0,254,0,getcharid(CHAR_ID_CHAR)&0xffff,(getcharid(CHAR_ID_CHAR)>>16)&0xffff;
	equip .@id;
	close;
}