summaryrefslogtreecommitdiff
path: root/npc/merchants/ammo_dealer.txt
blob: a839508780d11993b1e3fbf45b544f4b16335c40 (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
//===== Athena Script =====================================
//= Bullet Merchant Tony
//===== By ================================================
//= Paradox924X
//===== Version ===========================================
//= 1.5 - Replaced @input with .@input
//= 1.4 - Fixed item id for Lightning Sphere from the id for a Lightning Sphere Pack
//= 1.3 - Minor Optimizations
//= 1.2 - Majorly reduced script length by using a function
//= 1.1 - Minor Optimizations
//= 1.0 - First Release
//===== Compatible With ===================================
//= eAthena
//===== Description =======================================
//= A simple bullet trader.
//===== Comments ==========================================
//= Converted from Aegis Script.
//=========================================================
que_ng,187,156,3	script	Bullet Merchant Tony	86,{
	if (BaseJob == JOB_GUNSLINGER) {
		mes "[Tony]";
		mes "I'm Bullet-tooth Tony!";
		mes "Whenever your out of bullets,";
		mes "Visit me!!!";
		next;
		mes "[Tony]";
		mes "Now~! Friend~Companion~ Buddy~";
		mes "What do you need?!";
		mes "Choose anything~!";
		mes "And pay money~!";
		next;
		switch(select("Poison Sphere:Flare Sphere:Lighting Sphere:Blind Sphere:Freezing Sphere:Cancel")) {
			case 1:
				callfunc "Bullet_Trade",937,10,13205;
			case 2:
				callfunc "Bullet_Trade",7097,2,13203;
			case 3:
				callfunc "Bullet_Trade",7053,3,13204;
			case 4:
				callfunc "Bullet_Trade",1024,5,13206;
			case 5:
				callfunc "Bullet_Trade",7054,2,13207;
			case 6:
				mes "[Tony]";
				mes "Mmm~ Okay~";
				mes "Please visit again~";
				mes "I, Bullet-tooth Tony,";
				mes "Will always be here~!!!";
				close;
		}
	} else {
		mes "[Tony]";
		mes "I'm a trader who supplies";
		mes "Gunslingers with trade items.";
		mes "I am called Bullet-tooth Tony.";
		next;
		mes "[Tony]";
		mes "I don't think you are a Gunslinger";
		mes "So just look around";
		mes "and go.";
		close;
	}
}

function	script	Bullet_Trade	{
	mes "[Tony]";
	mes "Input the amount you wish to purchase.";
	next;
	mes "[Tony]";
	mes "We trade 30 "+getitemname(getarg(2))+"s for";
	mes "1 Phracon,";
	mes "1 Emveretarcon,";
	mes "and "+getarg(1)+" "+getitemname(getarg(0))+".";
	next;
	mes "[Tony]";
	mes "The maximum number you can trade is 500.";
	mes "If you want to cancel, input 0.";
	next;
	input .@input;
	set @tony,.@input;
	set @tony1,.@input;
	set @tony2,.@input * getarg(1);
	if (.@input < 1 || .@input > 500) {
		mes "[Tony]";
		mes "Invalid Amount!";
		mes "Enter again~!";
		close;
	} else if ((countitem(1010) >= @tony) && (countitem(1011) >= @tony1) && (countitem(getarg(0)) >= @tony2)) {
		if (checkweight(getarg(2),.@input * 30) == 0) {
			mes "[Tony]";
			mes "I cannot give it to you because your inventory is full. Come back after your inventory has more space.";
			close;
		} else {
			mes "[Tony]";
			mes "Oh~ Good!";
			mes "Trade number checked!";
			mes "I'll trade immediately.";
			delitem 1010,@tony;
			delitem 1011,@tony1;
			delitem getarg(0),@tony2;
			getitem getarg(2),.@input * 30;
			close;
		}
	} else {
		mes "[Tony]";
		mes "Tsk Tsk~";
		mes "You do not have";
		mes "enough items for the";
		mes "items you want to trade.";
		mes "Prepare again and come back.";
		close;
	}
}