summaryrefslogtreecommitdiff
path: root/doc/sample/npc_trader_sample.txt
blob: 24c53330b8ead972c9e06141980a3cfe71e023d3 (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
//===== Hercules Script =======================================
//= Sample: NPC Trader
//===== By: ==================================================
//= Hercules Dev Team
//===== Current Version: =====================================
//= 20131225
//===== Description: ========================================= 
//= Demonstrates NPC Trader.
//============================================================

/* ordinary zeny trader */
prontera,152,151,1	trader	TestTrader	4_F_EDEN_OFFICER,{
	OnInit:
	sellitem Valkyrja's_Shield;
	end;
}
/* ordinary cash trader */
prontera,152,152,1	trader	TestTraderCash	4_F_EDEN_OFFICER,{
	OnInit:
	tradertype(NST_CASH);
	sellitem Valkyrja's_Shield;
	end;
}
/* custom npc trader */
prontera,153,152,1	trader	TestCustom2	4_F_EDEN_OFFICER,{
	OnInit:
	tradertype(NST_CUSTOM);
	sellitem Red_Potion,2;
	end;

/* allows currency to be item 501 and 502 */
OnCountFunds:
	setcurrency(countitem(Red_Potion),countitem(Orange_Potion));
	end;

/* receives @price (total cost) and @points (the secondary input field for cash windows) */
OnPayFunds:
	dispbottom "Hi: price="+@price+" and points="+@points;
	if( countitem(Orange_Potion) < @points || countitem(Red_Potion) < @price-@points )
		end;
	delitem Orange_Potion,@points;
	delitem Red_Potion,@price-@points;
	purchaseok();
	end;
}
/* demonstrates Market Trader */
prontera,150,160,6	trader	HaiMarket	4_F_EDEN_OFFICER,{
OnInit:
	tradertype(NST_MARKET);
	sellitem Red_Potion,-1,49;
	end;

OnClock0000://resupplies red potions on midnight
OnMyResupply:
	if( shopcount(Red_Potion) < 20 )
		sellitem Red_Potion,-1,49;
	end;
}
/* demonstrate barter shop */
prontera,159,284,4	trader	Barter Shop#prt	4_M_KID1,{
OnInit:
	tradertype(NST_BARTER);
	sellitem White_Herb, 100, Red_Potion, 2;
	sellitem Blue_Herb, 200, Orange_Potion, 3;
	end;
}