在 tgs1000\init\npc.sdb里加
% ?% O6 k/ p u2 C奖品兑换员,奖品兑换员,0,,,,,,,,,,62,81,235,0,0,,,,20000,0,0,0,0,,0,,,,,,,,,,,,,,,TRUE,: c: v; W. g! I/ G. [& N
在tgs1000\script文件加里创建一个文本 名字:奖品兑换员
( e/ a' [0 a$ [3 k------------------------------------------------1 d" ?& y% z9 `6 @: c8 N S
unit 奖品兑换员;
+ E% }2 H0 q) z4 R* u( n M9 ]7 C$ f, {! b$ o
interface- y- r7 N6 N4 Y+ {
. E( _# m# U2 v; s! E" e' b# I
function GetToken (aStr, aToken, aSep : String) : String;
0 x3 `1 N- f! e J/ V* R9 Sfunction CompareStr (aStr1, aStr2 : String) : Boolean;8 ^' r Q5 a2 P3 {
function callfunc (aText: string): string;
9 Y5 N2 q( y1 Mprocedure print (aText: string);
4 g. H, p) [, _5 V2 pfunction Random (aScope: integer): integer;) O* Q/ @! \: c% v$ x( \% [$ Z
function Length (aText: string): integer;+ ]" U. G0 g" a* \7 c' r' K
procedure Inc (aInt: integer);
7 ^% D0 h) S! c) h7 d& G' Jprocedure Dec (aInt: integer);
6 B: L( d2 I4 G$ S) D3 x( e$ M4 }function StrToInt (astr: string): integer;
, T2 \* f0 l6 }5 O- v' Zfunction IntToStr (aInt: integer): string;
- s; {% x' ?8 `1 {# D' T( u& P9 o* `procedure exit;& f3 Y! ~" H% {4 }$ _: @
procedure OnGetResult (aStr : String);. m7 \: u. K5 ?! d j
procedure OnLeftClick (aStr : String);2 ^; e- x; g d) k
procedure OnApproach (aStr : String);
2 W1 ^; b- ^! R5 P# Oprocedure OnAway (aStr : String); e3 o/ o; D! w# A
procedure OnArrival (aStr : String);5 L; d5 @( j" i0 S
var
- n N! M+ b6 W+ H* V8 M3 [; \% EiCallCount : Integer = 0;
8 T6 |* b; Y5 O7 u1 g& Dimplementation4 `6 r% ?" w0 K$ H6 g, v h+ a
procedure OnAway (aStr : String);% t: ?6 |7 F/ e: v* r4 d, a
var( @) I4 E& C) x; H% y( w
Str : String;9 z) N3 G @ K' y9 Q
Race : Integer;
1 T9 j- Q( I9 X. I3 j- kbegin
- P% U2 a0 t1 c) bStr := callfunc ('getsenderrace'); d& n7 J- b, U' u
Race := StrToInt (Str);$ |4 `/ v1 P) `7 b8 x
if Race = 1 then begin" E' K K' a1 S7 e* t: E2 y! K: h
print ('say 拉拉拉拉,贪财老人来喽...');
. [( I, G( M" H( K# Fexit;4 C' }) `# l' i+ s$ r
end;
- Z8 M! a2 ?& o- hend;1 L) e+ z b! K+ n: \
procedure OnApproach (aStr : String);
$ P4 p0 F* S, o$ d2 F$ j8 Bvar1 l& e5 x; L7 C& x
Str : String;+ C$ i3 R* q9 v5 o4 S& p/ [9 l0 z
Race : Integer;6 b% k& Y& q6 c% \- h. C( F
begin
3 Q1 B: e9 F9 J1 r6 }Str := callfunc ('getsenderrace');2 |$ v$ I3 I) z9 \+ N
Race := StrToInt (Str);3 ~$ u. D) h; F1 H8 B2 C
if Race = 1 then begin
! j+ ~4 [7 [7 F9 A$ D) J/ P% L print ('say 各位节日快乐...');6 J) n; R" k5 ^! b! O
exit;
) ~7 J) `* N7 ?. Tend;- u* _: g. \' {' G) r$ O
end;+ @) `+ R7 u" \1 u& y
procedure OnLeftClick (aStr : String);1 d3 }$ l' [0 w; c1 l3 P
var
4 i% }! s7 B; d9 l& e0 }Str : String;& G) p; a9 R( b7 t# C) e
begin
1 s4 e" E) R, v) E. F- e- e8 FStr := 'showwindow .\help\奖品兑换员.txt 1';+ F8 _3 }$ D b- `! e- L
print (Str);
$ b; L* Z6 Z/ sexit;
, O. Q+ Z% v. _3 Pend;
L2 u5 v. E& q) X% J8 Iprocedure OnGetResult (aStr : String);
: H/ z6 j+ `/ b* ^var1 u: B$ c. b, h& O# T
Str, Name : String;7 t9 H5 I3 I. D! \$ D* @ w
iRandom, iKind : Integer;/ w4 a; h8 p) }+ [9 g
begin
' t D8 }6 x* N6 n3 tif aStr = 'jinyuan' then begin
/ F2 @; c" r9 v; j6 w; m Str := callfunc ('getsenderitemexistence 金元:5');# u$ G! A& T4 M M9 w
if Str = 'false' then begin
' E' M+ M; z8 ^6 S1 H$ V Str := 'say 哪有免费的午餐?拿5个金元来!';
) z7 c" R) g7 K+ A4 W, d9 k* J+ z print (Str);5 w' p8 [3 Q' O6 q
exit;
% _; t& B- @- D- L9 b# J# ^ end;
) _. |: \4 ^. d8 N3 x: ]% ? if Str = 'true' then begin
# v R1 \) N/ \& p1 i9 H( m Str := 'getsenderitem 金元:5';
$ R5 ^% P/ f3 S: o! m print (Str);
, r3 M1 L& b/ e Str := 'say 小子,你的金子是假的!哈哈哈!';
' w! ?* }, U- u3 f X) T print (str);
. f5 j0 d% e( U. k, r6 t6 [* G, B( L. b iRandom := Random (5);0 O0 _" {- \6 l! A' a# J* a
if iRandom = 1 then begin
; f+ F( \: \7 r! H. D Str := callfunc ('checkenoughspace');( m K% [. R3 o" j
if Str = 'false' then begin7 @; B1 j" v4 I) q3 c% z4 M
print ('say 物品栏已满~');
! [. [$ f0 W- D9 ]& c exit;
6 o2 {% C: Y! y! y end;3 a9 A$ a) P" G8 x
iKind := Random (29);4 \- X2 y8 p- f) O
if iKind = 0 then begin& N) j/ Z! D, Z7 @/ ~; ~# u
Str := 'putsendermagicitem 男子英雄铠甲 @奖品兑换员 4';
b. s. q5 T4 p9 O1 l print (Str);
$ s% L2 H3 d- W end;+ p5 W C5 H! }& E. v# }
if iKind = 1 then begin7 |0 t* g: s- a' n
Str := 'putsendermagicitem 女子英雄铠甲 @奖品兑换员 4';+ g; ^( ~9 i, e
print (Str);; ]$ A J0 y6 {# ?, P
end;: J0 d0 D2 R3 j+ W5 _6 i
if iKind = 2 then begin! T. ]( l: v [
Str := 'putsendermagicitem 男子英雄头盔 @奖品兑换员 4';4 h. b- _+ a8 e$ R
print (Str);2 Z2 N& S. h! [2 D) `! _0 n1 Q0 L
end;
( \0 w( ~; D0 c) M0 h) t if iKind = 3 then begin
1 ~# g G3 O$ d Str := 'putsendermagicitem 女子英雄头盔 @奖品兑换员 4';
" M5 X Z U+ M$ M print (Str);
5 v$ |0 Q: C6 F8 ]" d end;; H6 ^) Y" R* R W* k7 t. D
if iKind = 4 then begin- R- Q5 v8 g% l+ ~' h* h" Y
Str := 'putsendermagicitem 男子英雄护腕 @奖品兑换员 4';
$ ~0 e- \8 f6 U/ V2 } print (Str);
" U' ^! k& d. D O5 { end;
: v% |9 Y6 I3 { if iKind = 5 then begin; H% S) r `2 E
Str := 'putsendermagicitem 女子英雄护腕 @奖品兑换员 4';7 }. f$ [5 [! g4 |2 i
print (Str);* O3 d- o% [& A9 ]; k& ~
end;* E$ P) ?) _) c$ C$ j9 L
if iKind = 6 then begin; B5 H, |$ @$ J6 O7 K
Str := 'putsendermagicitem 男子英雄战靴 @奖品兑换员 4';5 h, S: f+ K8 }7 Y5 a& b, F3 q
print (Str);
8 ?- h2 B3 T; Z* X" I2 @7 x end;( @" P; O- s$ `9 B" M# G
if iKind = 7 then begin8 L4 e. w w$ N& L1 ]
Str := 'putsendermagicitem 女子英雄战靴 @奖品兑换员 4';# v+ _! ?& g* h2 \& _9 E. O6 ?
print (Str);
, r) O! ?$ b7 n/ R! k end;
u# P+ u* n% ~, h# p; t if iKind = 8 then begin
& g; ?5 X1 e( C5 O, } Str := 'putsendermagicitem 百炼三*戟 @奖品兑换员 4';. G+ `. g# i* f0 S
print (Str);- q4 `( V3 P8 B& R7 j
end;8 y' J& ]+ H) e( g7 V# I
if iKind = 9 then begin4 W. F' ?+ o: U# f& ]! V
Str := 'putsendermagicitem 百炼日本刀 @奖品兑换员 4';
6 i, i% X, f: A print (Str);1 d, e$ Q: F; l2 p }1 @
end;) G: s1 W z: t; h" m
if iKind = 10 then begin; L+ G8 u, A5 V0 H K# x: t
Str := 'putsendermagicitem 百炼忍者剑 @奖品兑换员 4';
6 N7 A5 E& Y+ z% E print (Str);
. n# b# O4 g0 J. P) D end;
Q7 ^9 d# \8 ^) |3 e$ O+ { if iKind = 11 then begin
/ d/ k: S4 y4 r7 j- f( Z% S Str := 'putsendermagicitem 白骨魔棒 @奖品兑换员 4';
s9 G8 B% b. q( {8 C% I print (Str);4 H6 O2 ^6 ]$ I* X5 L/ _! q" I
end;
4 w* b1 i8 [6 U if iKind = 12 then begin
/ t% S" X/ r3 h. ? Str := 'putsendermagicitem 生
& a/ i' {) X* F& k |