在 tgs1000\init\npc.sdb里加
4 V- j, x% H' Y F奖品兑换员,奖品兑换员,0,,,,,,,,,,62,81,235,0,0,,,,20000,0,0,0,0,,0,,,,,,,,,,,,,,,TRUE,8 \: b) M8 S z
在tgs1000\script文件加里创建一个文本 名字:奖品兑换员
8 h- ^- ]; B2 p' N4 m) K, @: H0 Y------------------------------------------------& d' G' w" R( ~+ b6 r$ r
unit 奖品兑换员;
" i$ ~/ T: \; e0 W( d- ?. N9 P
# U" v$ _* P3 U. M% N! y: Rinterface
( }: J; _% N6 f* o# w2 O t0 S% N$ o# w. G9 W
function GetToken (aStr, aToken, aSep : String) : String; E/ b C4 x5 W7 |4 F5 m& o4 {# w
function CompareStr (aStr1, aStr2 : String) : Boolean;1 \' J# E: @, S' Z% `9 T6 ]
function callfunc (aText: string): string;
6 P, l8 ^# T% N: p2 z8 Iprocedure print (aText: string);8 {" x/ s4 _8 A8 s! U: c2 x
function Random (aScope: integer): integer;4 o5 h4 @ M% F8 _7 R
function Length (aText: string): integer;
* |) t8 w% z5 A8 `4 R9 fprocedure Inc (aInt: integer);! A0 M: I) v' Z8 n; l) j4 V
procedure Dec (aInt: integer);( P5 q( a$ D& I' {
function StrToInt (astr: string): integer;
% k/ u4 Y I8 vfunction IntToStr (aInt: integer): string;2 t! S+ t: o( c& T) b
procedure exit;) w; ~; e+ H9 `2 J/ e+ m1 Y
procedure OnGetResult (aStr : String);4 a8 f% x) O9 F9 V5 }# _
procedure OnLeftClick (aStr : String);
. B+ U# P7 H, m1 d# Iprocedure OnApproach (aStr : String);
1 r" m8 o& i* ?, Gprocedure OnAway (aStr : String);9 k5 P. S- G2 W
procedure OnArrival (aStr : String);7 a( }# d z( E# Q* J. e/ e& ~
var( s, ]7 r) x# M6 \2 |. p/ M% k
iCallCount : Integer = 0;
& Q# @* d; A& Z) Bimplementation* G- ~9 t" Y4 I2 }( Z: p
procedure OnAway (aStr : String);! k t" J" C3 [' `, c2 m1 g* A
var3 j1 p+ M; F& l# C1 ]
Str : String;
: X" x8 }: u6 f, ~. ~! MRace : Integer; Y# D/ p4 m) t$ q8 p+ ~9 ~' }
begin) J# g6 v; w; S) S
Str := callfunc ('getsenderrace');+ u- A8 s0 V( F; b0 `4 g$ T. W9 p( D4 Z
Race := StrToInt (Str);
7 L) D9 ?6 w, k; h6 _! Zif Race = 1 then begin
& Q+ m5 ~( @# \1 T print ('say 拉拉拉拉,贪财老人来喽...');
# ~3 S6 E8 K0 t' iexit;( @2 f) ~/ e U3 W% q5 u
end;' V7 g0 ^, @2 g H- Z! x
end;5 T) h% N3 t" A7 C
procedure OnApproach (aStr : String);, ~1 w/ x& L9 k/ N3 ]
var$ s8 i+ m* b# W9 ~5 B# j
Str : String;' y% B" S/ ]* T3 z( I4 _1 q6 d- z
Race : Integer;9 T3 O S* G0 ^0 J
begin
; C/ F/ }4 V0 v# f1 ]: cStr := callfunc ('getsenderrace');& \4 B* @, i# I- H# }% M8 }
Race := StrToInt (Str);
7 t; P7 z. g2 x& }* B" e' y% wif Race = 1 then begin
+ X' w" q+ w+ S. n; v print ('say 各位节日快乐...');. H2 q K* j; h; A5 E( d8 T
exit;/ g( L, D+ [. ~. Z% I$ u1 Y: m5 t
end;( }; E. \9 z2 m2 a/ o3 K9 G
end;/ G0 w9 D: }; c0 ?
procedure OnLeftClick (aStr : String);
( r$ t+ N' n6 H9 `. g4 ?. Avar1 Z" |) S5 L) D! W M* q7 p* E
Str : String;5 L! F0 L J, d6 L- V5 v' ]
begin1 V# i1 T; h; N( `
Str := 'showwindow .\help\奖品兑换员.txt 1';$ c/ k' n$ j* w* d9 g
print (Str);' c5 p8 s) y- e; m' z% A
exit;, P" V: f. C( ]7 S* c! i9 ]0 V
end;+ k% O/ \% e# f J
procedure OnGetResult (aStr : String);
) M3 E* q' O7 q- r" y* x% lvar
5 k$ n. b, o" Q6 }, M- UStr, Name : String;
$ @& B) k/ H$ I, M6 TiRandom, iKind : Integer;
; r$ N$ Y$ G* l; o- l% Gbegin
* @" `- M. e* P* Z0 lif aStr = 'jinyuan' then begin$ r( O. r1 ?4 K o$ Y. j2 I7 F1 f
Str := callfunc ('getsenderitemexistence 金元:5');0 a9 t7 ^+ V1 D$ U8 ]. f* z& H. `
if Str = 'false' then begin
1 f4 o& C) E6 S' I Str := 'say 哪有免费的午餐?拿5个金元来!';
/ l' w. y/ G, g! l8 N print (Str);4 Y( ~/ s$ {: o2 x V+ h
exit;
0 r5 C1 L% J: I* Q) C* [ end;( b* W! s" k8 C" Z
if Str = 'true' then begin- @2 z |4 J/ G: k( w
Str := 'getsenderitem 金元:5';+ b, `. C g/ E1 N1 I
print (Str);
/ g# z& u/ V4 \ Str := 'say 小子,你的金子是假的!哈哈哈!';
$ ?9 v* i; X& f1 [$ G; ?- T2 @ N print (str);
; n3 ] [9 g( @( h# x iRandom := Random (5);: x; R! R6 j: N8 {+ u; a! t
if iRandom = 1 then begin3 m) r: T$ L5 _: \( S
Str := callfunc ('checkenoughspace');
2 x+ ]+ ~; y5 P! t. O: v! y/ e if Str = 'false' then begin
/ I, r R R- I1 i* \3 I B# o print ('say 物品栏已满~');0 P. q- m) W4 G' |2 t- e# x
exit;
/ y! k5 X5 `6 F end;
5 { J( X8 j! w4 W2 k iKind := Random (29);
" x3 G% ]) n; _3 y if iKind = 0 then begin/ E7 \5 M8 D# W7 q
Str := 'putsendermagicitem 男子英雄铠甲 @奖品兑换员 4';
5 n2 c" U5 w+ G& L- { `3 g+ Q, d print (Str);
7 L% K2 Q* t2 l" O0 i; Q4 E end;
7 P" w; v& `1 N: d0 a. m: f P if iKind = 1 then begin: |0 V& W1 [! `2 \! u2 c8 d
Str := 'putsendermagicitem 女子英雄铠甲 @奖品兑换员 4'; R Z7 b0 y9 o* d. L) E* l8 ]) G
print (Str);0 W9 r* Y- ]( c5 j
end;
5 I; @3 [- e' r/ _ if iKind = 2 then begin. D: x' b1 V% r) N3 y& P& h& B1 z
Str := 'putsendermagicitem 男子英雄头盔 @奖品兑换员 4';
) c8 }6 M9 l8 J* M* V' l& n( a6 n" g print (Str);
4 u* R c/ z5 r end;- Q; ~+ q! d# n
if iKind = 3 then begin; z4 ^$ x: ?5 _
Str := 'putsendermagicitem 女子英雄头盔 @奖品兑换员 4';$ c2 h4 X; [( Z* g1 O5 Y# Q
print (Str);# l/ G* d ~0 X0 O e7 n
end;2 l. x' y, p3 ]
if iKind = 4 then begin
& d. N5 e* D9 E4 t$ e6 K Str := 'putsendermagicitem 男子英雄护腕 @奖品兑换员 4';" }+ a3 Q0 U) Z& r1 H* n+ y9 g
print (Str);. L% W& i2 j& Z% x0 g% n
end;
/ h. S0 A9 j- o$ b8 {1 O9 m if iKind = 5 then begin0 r& r. g0 j( }3 z2 J8 J
Str := 'putsendermagicitem 女子英雄护腕 @奖品兑换员 4';
. E3 s0 v9 }6 C" @3 j print (Str);% d' w: T/ @8 Y- t& N* B
end;
5 b6 f6 q3 k8 w/ C" n* [ if iKind = 6 then begin
1 @, a8 }6 d' W5 {6 z6 Y+ v Str := 'putsendermagicitem 男子英雄战靴 @奖品兑换员 4';
1 U* R! J$ o" G& U0 R; |. q print (Str);
6 D. d3 V+ @4 `6 I3 q' P% \ end;; l/ X3 h' [; W: E8 \
if iKind = 7 then begin/ }. F% Y; K# q$ M
Str := 'putsendermagicitem 女子英雄战靴 @奖品兑换员 4';/ s4 ^ \( |6 J9 P6 x
print (Str);
, u% x7 @. Q# h( m0 w2 s+ E end;) Y& {: ?) h+ t+ o$ U
if iKind = 8 then begin! [1 G3 L7 T- M6 t
Str := 'putsendermagicitem 百炼三*戟 @奖品兑换员 4';
1 V& K3 i& L; w: V0 X4 c- h print (Str);' R) N5 @& V# W- O8 h
end; V8 l4 n' U: r' a
if iKind = 9 then begin
t8 {) O/ ]8 T# v( B& w4 W Str := 'putsendermagicitem 百炼日本刀 @奖品兑换员 4';& M6 n7 B1 s9 J
print (Str);2 U; W G9 U4 F, M6 J# r4 j9 i, Z# T' Y
end;$ K: E g0 N: f. i N2 Z
if iKind = 10 then begin
( R( f( n& @2 m Str := 'putsendermagicitem 百炼忍者剑 @奖品兑换员 4';
) L/ i0 ]1 s6 Z print (Str);0 \* e, R; V7 V0 z: n
end;: e# K7 ]; _9 b+ v# U# _1 g
if iKind = 11 then begin
3 K( ?5 g! A: O6 W8 g# ^0 ?: H Str := 'putsendermagicitem 白骨魔棒 @奖品兑换员 4';
1 K' Q* {( L" Y3 c% f' p print (Str);
; n/ D# w7 X- R: ]4 N" E; C end;, l7 {7 h: R+ S1 m% G
if iKind = 12 then begin# w; k6 \: E" C+ a6 }5 O: u/ @
Str := 'putsendermagicitem 生
7 l- e- T& C2 L) b$ Y6 B0 e |