在 tgs1000\init\npc.sdb里加
7 S7 ?) S* w" r3 d奖品兑换员,奖品兑换员,0,,,,,,,,,,62,81,235,0,0,,,,20000,0,0,0,0,,0,,,,,,,,,,,,,,,TRUE,. Q7 D y5 k- F& n3 z) r6 w
在tgs1000\script文件加里创建一个文本 名字:奖品兑换员5 A' V$ U4 j& }# h5 D" v6 `
------------------------------------------------ W* z) Z! I$ M" B
unit 奖品兑换员;
! `/ w: B! { i. f# v* r ^8 M* w7 J2 w3 c9 f
interface- ^$ I! A" C4 V s5 F9 p; L c! x
/ r, O, I5 m" X* w( m5 C) I
function GetToken (aStr, aToken, aSep : String) : String;
* X, v& V9 \5 r+ [5 cfunction CompareStr (aStr1, aStr2 : String) : Boolean;+ Z$ ^3 l+ P) r5 [
function callfunc (aText: string): string;) b( M; D* }4 }: g7 I
procedure print (aText: string);
: T+ S3 H. E! H4 Ufunction Random (aScope: integer): integer;. q$ E0 `0 X$ @# a( Z+ w, u* L4 l
function Length (aText: string): integer;
8 O9 U: p, x- _, _; q4 Oprocedure Inc (aInt: integer);
; ^0 F* g1 A0 W. }' l3 j; sprocedure Dec (aInt: integer);2 `+ I2 n, L# _3 Q3 E, m
function StrToInt (astr: string): integer;! s, F& v/ X# V
function IntToStr (aInt: integer): string;
9 c! W* c; z( [. pprocedure exit;9 ]% _, _; M) z! ^8 c
procedure OnGetResult (aStr : String);
/ J2 A5 h5 Q/ w S0 N: q' _procedure OnLeftClick (aStr : String);3 U- n) a; O. ?
procedure OnApproach (aStr : String);) t5 r! o) v+ {. n" y" o8 d7 k: w
procedure OnAway (aStr : String);
3 a% k1 p) z0 \1 R: t$ c7 sprocedure OnArrival (aStr : String);# K `/ z0 |+ ^+ ^. K' h
var2 U7 x, h, L7 H
iCallCount : Integer = 0;
# f8 Q3 R- s) _" `! @; k+ Aimplementation/ y3 V& }9 K! w' N- g
procedure OnAway (aStr : String);
# I. {/ y2 I9 @var) M6 C- y, \$ E0 G; M
Str : String;
- V0 d" p' x6 m" eRace : Integer;
7 H) P1 I) \1 L% y/ _1 Bbegin
" b# k h$ u! X1 W/ Q& t" W3 v% Z! tStr := callfunc ('getsenderrace');+ ], y( J; L A' {2 q
Race := StrToInt (Str);# d) F8 U2 }& [6 S! p9 T
if Race = 1 then begin
# O6 d+ @- A; a0 m2 y; H/ A5 } print ('say 拉拉拉拉,贪财老人来喽...');
" t& C8 c( b4 x1 M% L2 `3 B' ^exit;
' r; b: \. T: A! R- gend;! _0 v. q0 N. Y# P
end;
7 j& K* U! b7 f3 K& u: oprocedure OnApproach (aStr : String);
6 s! I$ b) E1 o5 l2 evar
3 c1 `" D$ B CStr : String;
& X$ L6 E* d* H! j8 QRace : Integer;
! h" r' w8 \1 s+ lbegin0 y5 X: Y9 w6 I. S
Str := callfunc ('getsenderrace');5 w1 @- ~( R; t4 e8 o
Race := StrToInt (Str);5 D+ Y0 m# B4 n7 o
if Race = 1 then begin& a# E7 l2 _0 [( S ~. U7 D
print ('say 各位节日快乐...');
2 s. r& T- c$ T& ^exit;
- x) D. D, c" I4 {- iend;8 F) U+ }7 S1 a, A4 e. A
end;
: [* o" o2 A' ?2 B u# Qprocedure OnLeftClick (aStr : String);9 Y7 m7 d: T. M+ v' M
var! N0 x5 C1 z. ?- m6 T0 o
Str : String;3 y+ Q- X# Q e3 k0 [, k
begin
$ D: O6 m8 J0 D% x& _3 pStr := 'showwindow .\help\奖品兑换员.txt 1';
# @- `+ [. x: L6 m4 A* R7 ?# zprint (Str);
& u: T1 } W, J7 z: D6 @1 X+ Uexit;/ T% p1 I1 X$ U2 n% V% U5 j
end;
" Z$ o" M, ^0 W+ i1 nprocedure OnGetResult (aStr : String);
~+ V; W0 ]8 T; ~: @ Z, ovar
3 u& Q9 k/ G9 p$ AStr, Name : String;7 n! i! m" Q x1 w
iRandom, iKind : Integer;+ B+ h" i$ _9 C; \6 y/ K: ~
begin
! U5 E K, ]7 A6 Jif aStr = 'jinyuan' then begin: c9 V; {7 U5 O" q0 U6 b& n/ n. g
Str := callfunc ('getsenderitemexistence 金元:5');0 x# v6 ~. p$ l: e/ W
if Str = 'false' then begin
* X5 s0 t. X" w* @" m% x: ] Str := 'say 哪有免费的午餐?拿5个金元来!';
$ a) d9 Q6 M8 [' K/ T/ X print (Str);
K9 G- R9 b1 t4 `6 P exit;
. w$ C* v' n7 v! Y( T3 n end;- q- E! r' `4 W. Y/ Q9 y' d& P
if Str = 'true' then begin
0 m/ [! n7 M. ^ Str := 'getsenderitem 金元:5';2 q0 g- U# V1 E/ Y& A( Z) f# ]
print (Str);# u/ p/ s! p5 V) D* Q' e) U5 g( J
Str := 'say 小子,你的金子是假的!哈哈哈!';6 h3 P/ s8 u( t+ s( Q. W
print (str);
Q% B- W0 q. B3 k; V- P- { iRandom := Random (5);
1 H3 p! ]1 W3 M h' l. y if iRandom = 1 then begin1 K7 B% E* ?! v9 O, [8 R0 D
Str := callfunc ('checkenoughspace');5 b" O7 {& _# c! D8 a D
if Str = 'false' then begin, a( j7 g! C; K( l% S5 |! F
print ('say 物品栏已满~');( l' Q- I- \" l, s
exit;
4 J/ \% I8 Q4 X0 k end;
8 g) [# u. e! }* F# Q& l( _ iKind := Random (29);3 L @7 n6 O2 ~/ u; }& C
if iKind = 0 then begin4 q) e( Q/ U; {% @. ~3 i: d
Str := 'putsendermagicitem 男子英雄铠甲 @奖品兑换员 4';9 u( c& I. A+ b& B. T
print (Str);
, b4 k' F7 ]+ E6 n, F end;
2 N f& D" r+ f3 C5 z/ @3 ~ if iKind = 1 then begin
+ o( {1 O5 \3 Q9 o! x' ` Str := 'putsendermagicitem 女子英雄铠甲 @奖品兑换员 4';$ ?5 l; S0 l' Q+ h
print (Str);
9 H2 g; w* ]" q: v" F/ t end;
% s. M7 A& h+ _" b if iKind = 2 then begin
, z$ b8 j0 N5 D: B, k) D; f Str := 'putsendermagicitem 男子英雄头盔 @奖品兑换员 4';3 ]7 h1 z6 @8 c* T7 P( W. F
print (Str);
$ u& a+ ~/ J* A0 J end;! s: d6 D; S* S; S. Y5 D' m
if iKind = 3 then begin9 T6 M9 c+ O) v* U3 y
Str := 'putsendermagicitem 女子英雄头盔 @奖品兑换员 4';
# a2 T' D8 a5 |& Y3 J print (Str);% ?5 N/ }3 J3 T% f1 g
end;
) ]# }0 h) [ S3 o7 v6 Q) X if iKind = 4 then begin" ?: p( c: n7 [- { F# P9 I) u
Str := 'putsendermagicitem 男子英雄护腕 @奖品兑换员 4';
' F, n5 C4 k% w, q) O1 u m print (Str);
0 T1 p9 n b V end;
' J- ?8 i6 ?3 z, t4 W# i if iKind = 5 then begin) |- J2 z) ~9 D' ]4 D
Str := 'putsendermagicitem 女子英雄护腕 @奖品兑换员 4';, N; n, V# |' Z+ K7 ^0 E( l, I
print (Str);6 G" D& u& k6 Y* o) N9 ?
end;% Z+ H1 y4 z; y3 i2 b- J6 _
if iKind = 6 then begin
d- t/ F+ p0 |) P( _ Str := 'putsendermagicitem 男子英雄战靴 @奖品兑换员 4';
8 m/ F1 }2 x/ u2 w. O print (Str);* _$ s7 }- ]6 Q# k1 ?4 w
end;3 _+ `7 F) s7 t5 j% O
if iKind = 7 then begin$ b, T) [0 u5 Z1 ?0 T
Str := 'putsendermagicitem 女子英雄战靴 @奖品兑换员 4';
: t4 C: q2 P) i0 q9 c2 M print (Str);
7 ^2 U3 q5 I0 W3 H9 C4 p2 A end;
" }/ C9 g' u# T- ^ if iKind = 8 then begin4 H. k$ X2 f, V" z9 ^( @( _) V
Str := 'putsendermagicitem 百炼三*戟 @奖品兑换员 4';9 p/ o5 V* R# I' h% m+ I) D
print (Str);( b( R" r5 f, k4 z9 v z
end;- `! ~3 m5 V) B* V; O
if iKind = 9 then begin1 W4 w( R; N G) B) Y0 N
Str := 'putsendermagicitem 百炼日本刀 @奖品兑换员 4';
' b% }. `$ y& I9 h print (Str);& ]+ E+ D' D( a0 A O8 k
end;
% y( C! p& j) |0 D* W if iKind = 10 then begin# s* \( _- ?7 _+ J
Str := 'putsendermagicitem 百炼忍者剑 @奖品兑换员 4';8 r) B) ~/ ~+ f5 M u2 o. L7 e
print (Str);
p6 ~( c' U( O$ G end; a2 D# t+ b/ L* b1 K8 p( d
if iKind = 11 then begin
2 R( ^8 T$ r/ z# d. r Str := 'putsendermagicitem 白骨魔棒 @奖品兑换员 4';8 w/ t9 D4 V% q2 l! k5 A5 u
print (Str);) w5 g9 w* H L7 Y
end; \( Z. Y6 O; `# Q$ ? x
if iKind = 12 then begin8 w( W* O' X w) S$ I. Y5 r: M
Str := 'putsendermagicitem 生
+ n+ ?) n' x3 G8 A. { |