在 tgs1000\init\npc.sdb里加
3 L5 A4 J% A, u. l奖品兑换员,奖品兑换员,0,,,,,,,,,,62,81,235,0,0,,,,20000,0,0,0,0,,0,,,,,,,,,,,,,,,TRUE,6 g/ B" z+ _, n* c
在tgs1000\script文件加里创建一个文本 名字:奖品兑换员# o4 q& m* F9 |: B
------------------------------------------------$ U6 m! M/ ]/ t6 Y/ P5 K6 P
unit 奖品兑换员;
# M: _& X/ W- @# e6 d2 h1 h$ U7 ]! S& k0 J; h5 a
interface
- e8 o0 W) T! h4 ^/ K
; R3 O6 _, T- O+ H- |% n. D" ffunction GetToken (aStr, aToken, aSep : String) : String;
8 Z/ @# w8 z+ V& ?5 Qfunction CompareStr (aStr1, aStr2 : String) : Boolean;6 c8 D( T g0 N4 a2 N
function callfunc (aText: string): string;
% J: h% H4 [$ y6 [ u7 qprocedure print (aText: string); _/ [0 H( X# z8 U& O
function Random (aScope: integer): integer;5 K* J/ C& e2 U" v1 n Q: u+ x0 Q' R0 K
function Length (aText: string): integer;" |7 s5 t" Q8 x7 @" E
procedure Inc (aInt: integer);
?) q& \$ k. q. b5 r& nprocedure Dec (aInt: integer);2 @2 ]: F' a! X2 J# |
function StrToInt (astr: string): integer;
8 j! v) r! X$ p k6 o1 u0 O) Afunction IntToStr (aInt: integer): string;/ V( Q' X% C4 a- l
procedure exit;" T' ^2 z' X" j7 [
procedure OnGetResult (aStr : String);
G. L# a5 }" Y2 Rprocedure OnLeftClick (aStr : String);
" S1 Q' |7 F+ D* T9 X2 `procedure OnApproach (aStr : String);
0 [4 s7 t4 J n, h9 S2 q2 V- eprocedure OnAway (aStr : String);
" g) \* j" u0 C, l C. d2 yprocedure OnArrival (aStr : String);; m9 K5 Q Z8 p5 Z$ A
var
; Y* [' h7 s; @( R; N3 k# {, t& T. c3 siCallCount : Integer = 0;
: j$ y8 I" I& J' _implementation
: `: J/ s$ m2 R4 dprocedure OnAway (aStr : String);' e2 p9 S, M5 Z5 u
var% H7 O/ H, B- u4 E2 E
Str : String;
) |7 `$ E7 E5 I2 }( V, Z) g6 L4 r1 K4 |Race : Integer;
: K: e4 y+ v9 I. D" @% tbegin
, O p. [- u9 B- k3 p7 x+ u( DStr := callfunc ('getsenderrace');
: X- h2 z' V) C z) u& w3 a0 B' TRace := StrToInt (Str);1 M" f; U& J& D. u9 ]0 w7 g7 J
if Race = 1 then begin' ^3 F& b2 n$ @
print ('say 拉拉拉拉,贪财老人来喽...');6 w8 b5 O5 C {% T2 Q
exit;5 B/ D8 p' J% ~0 }, h; q+ e- n
end;
/ r- N- n+ B N4 z7 nend;/ ]: o) ]6 f: `5 u4 [! O
procedure OnApproach (aStr : String);9 n3 A9 O0 |1 a
var% f8 e4 t6 I6 `" Q1 `, P
Str : String;/ A) I1 I* v9 Q7 b3 V
Race : Integer;: W& {5 d! F7 s8 M0 i' c, t
begin8 _- F. p5 [" p2 r J6 e9 G1 C
Str := callfunc ('getsenderrace');
+ N0 P5 N2 i* W. q7 Z% y3 kRace := StrToInt (Str);) B- N7 K# u$ w4 t5 M# h
if Race = 1 then begin
/ w! ~% |+ L. t' r+ [! b print ('say 各位节日快乐...');
' l3 b2 {- ]; H& \7 uexit;
, P3 ]( f( ^/ F7 `4 wend;
: Y. {& c5 C4 r2 ]end;6 t3 q3 D7 ^* d* Q; ~! H. C5 _
procedure OnLeftClick (aStr : String);
- A# K- E) h1 T. zvar1 p% {% T1 J( }/ r2 q
Str : String;
1 r. j. k9 Y- ]" a0 ?4 e2 b" nbegin8 A8 ^4 v( y3 s1 A7 D' Z/ O& V
Str := 'showwindow .\help\奖品兑换员.txt 1';: n% p& N$ b- L# o! a
print (Str);6 _. ~! y8 `' p' }% ?$ w4 ~
exit;8 o* B3 C/ _; u* Y" X: g1 h
end;% L4 ?, U5 U- d6 O
procedure OnGetResult (aStr : String);
+ }% C P+ l6 I2 |var( C+ R! g( m R
Str, Name : String;
6 y0 O- G$ h0 b0 f* x7 ZiRandom, iKind : Integer;
1 Z1 S9 q4 z; K) C5 I7 ?begin: l1 z4 T/ r% s, v
if aStr = 'jinyuan' then begin, C, Q; ^8 C! z% f& y5 a& X* c
Str := callfunc ('getsenderitemexistence 金元:5');
9 o$ m* v4 o' T8 L6 C/ [ if Str = 'false' then begin
# S5 h' T5 M C Str := 'say 哪有免费的午餐?拿5个金元来!';( [& j' ^9 P* O* g p
print (Str);
" R' m# b/ `# |* I exit;
. t8 ]$ U% n5 p+ s ?% P# X" p end;
: \/ P) [+ c( C: h9 A9 O. Q' j if Str = 'true' then begin
" g% A" T" G# r6 Z e+ R$ o Str := 'getsenderitem 金元:5';
. I% H6 O( K9 ]/ ]# Y! X7 Z! R print (Str);* ^4 f7 H( O& L6 d0 G
Str := 'say 小子,你的金子是假的!哈哈哈!';$ i8 z: u; [ ?$ I" v. m. d
print (str); ~7 T8 K- P$ P1 q1 t
iRandom := Random (5);+ ~2 J+ ~8 s& C' S" M- I
if iRandom = 1 then begin
8 t% }; ~$ c5 N& [( W4 |9 E; ^ Str := callfunc ('checkenoughspace');1 e4 k# L' Z# n! v8 J P; O. M' c y
if Str = 'false' then begin! K/ o1 w" {5 G" ^
print ('say 物品栏已满~');
; M Q. n3 u0 A exit;
6 K# [0 Z( p! X# w& Z/ ]$ z end;
0 N4 z% F. a$ M9 B2 F- H* q iKind := Random (29);/ I y) l& t5 Y
if iKind = 0 then begin
/ ~3 X: b8 w; e Str := 'putsendermagicitem 男子英雄铠甲 @奖品兑换员 4';
4 |" m" w B5 z4 z# t! a print (Str);
4 h& V1 G* L& k* l! X8 u end;
& I& h, F6 n5 t0 l- C* l; ? if iKind = 1 then begin
s) x+ u$ t, j* j8 ~; E Str := 'putsendermagicitem 女子英雄铠甲 @奖品兑换员 4';
: O, H" O5 l$ A: i$ l" ~ print (Str);
! l5 A$ b$ }# i end;
" j& `2 X( ~0 O0 b" @ if iKind = 2 then begin2 B& N% v+ m" S6 j, o
Str := 'putsendermagicitem 男子英雄头盔 @奖品兑换员 4';, t. C: Q. w" R8 v. k
print (Str);
9 Z$ h* o& O$ z2 z& O; z4 o H end;
% A! P0 x2 W8 `7 F+ ~" Q if iKind = 3 then begin
: u, z5 u7 B* @* D, l Str := 'putsendermagicitem 女子英雄头盔 @奖品兑换员 4';6 e/ c: @. `9 P4 M
print (Str);
3 G) \: ?; y0 Z4 t! s& J end;
* f. Z$ ^3 J4 B- ?4 O) i* K if iKind = 4 then begin1 ?4 v2 e6 F3 O8 h4 W3 W) P
Str := 'putsendermagicitem 男子英雄护腕 @奖品兑换员 4';! f( x; O, a' G' s, d2 Y" o2 j5 F
print (Str);
; K4 t6 V# p6 s2 C' B' P7 Z end;$ z3 B9 C2 D! i$ R9 K
if iKind = 5 then begin
; u1 n2 g2 {+ v3 I. R Str := 'putsendermagicitem 女子英雄护腕 @奖品兑换员 4';2 l- g* d) B- w( @4 k
print (Str);$ n, s$ g @+ a% |2 B' J8 v5 f
end;
4 `- L8 V; x: [' \8 _ if iKind = 6 then begin
# M8 S! R7 l9 s, y$ \ Str := 'putsendermagicitem 男子英雄战靴 @奖品兑换员 4';( @1 b |; n( _* u+ H2 X3 p4 f& a
print (Str);
$ L. r# W9 z! `2 f1 T( T7 l. Y4 D end;
* z& }" g/ Q9 p$ s if iKind = 7 then begin/ c# L: k' Z: @: @* {: o" N9 T( G
Str := 'putsendermagicitem 女子英雄战靴 @奖品兑换员 4';
- @/ I) n5 A( \ ^; T; J# \" Q print (Str);
- I3 f9 _* V8 B& b e: T* x end;
: x& Q8 o# C# m if iKind = 8 then begin
. K6 O% x0 ?, f1 d Str := 'putsendermagicitem 百炼三*戟 @奖品兑换员 4';
$ c ?$ ^) F) p& z$ C- y; j print (Str);
6 R, q- q; K5 R end;; m- D+ z( r: D, |
if iKind = 9 then begin
# n! s" E$ ^, `4 z. M% _2 f Str := 'putsendermagicitem 百炼日本刀 @奖品兑换员 4';
& l) c% C. B/ [7 n1 j, I+ k- ^/ F# e print (Str);; U+ `* M$ x9 N
end;* I: \, U( O/ j# P. f6 K+ t" v' j
if iKind = 10 then begin
8 P" e3 l [. W. C; |" t4 C: E Str := 'putsendermagicitem 百炼忍者剑 @奖品兑换员 4';
8 B( {! q4 D0 h print (Str);
/ A6 Z9 ^) @! ?, m. e, Q# v end;' L! z: Z" D; {5 T! W1 i8 g* f
if iKind = 11 then begin* y) ?2 X7 r; a4 W* ^: ]
Str := 'putsendermagicitem 白骨魔棒 @奖品兑换员 4';
) F- o9 r: C) w% U+ D print (Str);# \6 R6 ^6 q( E7 I* y8 P, u
end;- h! M6 M# n# b
if iKind = 12 then begin
/ V/ Y, i+ [- L Str := 'putsendermagicitem 生
0 e+ S! ~1 l; D: m M |