BITS 32
ORG 0h

;/* Parameter Count */
DB 1

;/* External Functions */
xf_STRCAT equ 4
xf_STRCMP equ 8
xf_STRFORMAT equ 12
xf_STR equ 224
xf_STRLEN equ 696
xf_INSTR equ 280
xf_VAL equ 376
xf_RANDOM equ 16
xf_ABS equ 232
xf_SQR equ 236
xf_DIVIDE equ 700
xf_FINDPLAYER equ 372
xf_GETPLAYERIP equ 384
xf_GETPLAYERACCESS equ 20
xf_GETPLAYERMAP equ 24
xf_GETPLAYERX equ 28
xf_GETPLAYERY equ 32
xf_GETPLAYERSPRITE equ 36
xf_GETPLAYERCLASS equ 40
xf_GETPLAYERGENDER equ 44
xf_GETPLAYERBANK equ 88
xf_GETPLAYEREXPERIENCE equ 92
xf_GETPLAYERLEVEL equ 96
xf_GETPLAYERSTATUS equ 100
xf_GETPLAYERGUILD equ 104
xf_GETPLAYERINVOBJECT equ 108
xf_GETPLAYERINVVALUE equ 112
xf_GETPLAYEREQUIPPED equ 116
xf_GETPLAYERDIRECTION equ 404
xf_GETPLAYERARMOR equ 436
xf_GETPLAYERMAGICARMOR equ 456
xf_GETPLAYERDAMAGE equ 504
xf_GETPLAYERNAME equ 120
xf_GETPLAYERUSER equ 124
xf_GETPLAYERDESC equ 128
xf_GETPLAYERGUILDRANK equ 480
xf_GETPLAYERISDEAD equ 492
xf_GIVEPLAYEREXP equ 400
xf_GIVEPLAYERELITEEXP equ 780
xf_HASOBJ equ 184
xf_TAKEOBJ equ 188
xf_GIVEOBJ equ 192
xf_ISPLAYING equ 244
xf_CANATTACKPLAYER equ 240
xf_CANATTACKMONSTER equ 256
xf_ATTACKPLAYER equ 248
xf_MAGICATTACKPLAYER equ 460
xf_ATTACKMONSTER equ 252
xf_MAGICATTACKMONSTER equ 464
xf_SETPLAYERCLASS equ 668
xf_SETPLAYERSPRITE equ 228
xf_SETPLAYERSTATUS equ 396
xf_SETPLAYERGUILD equ 304
xf_SETPLAYERISDEAD equ 496
xf_SETPLAYERDIRECTION equ 672
xf_SETPLAYERNAME equ 360
xf_SETPLAYERBANK equ 364
xf_BOOTPLAYER equ 352
xf_BANPLAYER equ 356
xf_PLAYERMESSAGE equ 144
xf_PLAYERWARP equ 148
xf_GETPLAYERFLAG equ 316
xf_SETPLAYERFLAG equ 320
xf_GETGUILDHALL equ 160
xf_GETGUILDBANK equ 164
xf_GETGUILDMEMBERCOUNT equ 168
xf_GETGUILDNAME equ 172
xf_GETGUILDSPRITE equ 296
xf_SETGUILDBANK equ 368
xf_GETMAPNAME equ 692
xf_GETMAPPLAYERCOUNT equ 176
xf_GETMAPISFRIENDLY equ 720
xf_GETMAPISPK equ 724
xf_GETMAPISARENA equ 728
xf_GETMAPOBJVAL equ 732
xf_GETBOOTLOCATIONMAP equ 756
xf_GETBOOTLOCATIONX equ 760
xf_GETBOOTLOCATIONY equ 764
xf_SETMAPOBJVAL equ 736
xf_OPENDOOR equ 220
xf_MAPMESSAGEALLBUT equ 180
xf_MAPMESSAGE equ 152
xf_NPCSAY equ 288
xf_NPCTELL equ 292
xf_SPAWNMONSTER equ 392
xf_DESPAWNMONSTER equ 776
xf_SPAWNOBJECT equ 284
xf_DESTROYOBJECT equ 348
xf_GETOBJX equ 332
xf_GETOBJY equ 336
xf_GETOBJNUM equ 340
xf_GETOBJVAL equ 344
xf_GETOBJECTNAME equ 412
xf_GETOBJECTDATA equ 416
xf_GETOBJECTTYPE equ 420
xf_DISPLAYOBJDUR equ 424
xf_SETINVOBJECTVAL equ 428
xf_SETINVOBJDUR equ 860
xf_SETMAPOBJDUR equ 864
xf_GETMAPOBJDUR equ 868
xf_GETPERCENT equ 872
xf_GETITEMMAXDUR equ 876
xf_GETINVITEMDUR equ 880
xf_GETMONSTERTYPE equ 260
xf_GETMONSTERX equ 264
xf_GETMONSTERY equ 268
xf_GETMONSTERHP equ 704
xf_GETMONSTERDIRECTION equ 500
xf_GETMONSTERTARGET equ 272
xf_SETMONSTERTARGET equ 276
xf_SETMONSTERHP equ 708
xf_MONSTERATTACKPLAYER equ 712
xf_MONSTERMAGICATTACKPLAYER equ 716
xf_CREATEMAPFLOATTEXT equ 472
xf_CREATEPLAYERFLOATTEXT equ 476
xf_CREATEMAPSTATICTEXT equ 676
xf_GETFLAG equ 308
xf_SETFLAG equ 312
xf_GLOBALMESSAGE equ 156
xf_GETTIME equ 196
xf_GETMAXUSERS equ 200
xf_RUNSCRIPT0 equ 204
xf_RUNSCRIPT1 equ 208
xf_RUNSCRIPT2 equ 212
xf_RUNSCRIPT3 equ 216
xf_RUNSCRIPT4 equ 388
xf_GETTILEATT equ 380
xf_GETTILEATT2 equ 680
xf_GETTILEISVACANT equ 684
xf_GETTILENODIRECTIONALWALLS equ 688
xf_PLAYCUSTOMWAV equ 432
xf_TIMER equ 300
xf_GLOBALMICROTIMER equ 812
xf_MICROTIMER equ 816
xf_RESETMAP equ 468
xf_CREATETILEEFFECT equ 440
xf_CREATECHARACTEREFFECT equ 444
xf_CREATEMONSTEREFFECT equ 448
xf_CREATEPLAYEREFFECT equ 452
xf_CREATEPLAYERPROJECTILEMAX equ 800
xf_CREATEPLAYERMAGICPROJECTILEMAX equ 804
xf_CREATEPLAYERPROJECTILE equ 484
xf_CREATEPLAYERMAGICPROJECTILE equ 488
xf_SETITEMSUFFIX equ 508
xf_GETITEMSUFFIX equ 512
xf_SETEQUIPPEDITEMSUFFIX equ 516
xf_GETEQUIPPEDITEMSUFFIX equ 520
xf_SETITEMPREFIX equ 524
xf_GETITEMPREFIX equ 528
xf_SETEQUIPPEDITEMPREFIX equ 532
xf_GETEQUIPPEDITEMPREFIX equ 536
xf_GETPREFIXNAME equ 540
xf_GETSUFFIXNAME equ 544
xf_GETPLAYERHP equ 48
xf_GETPLAYERENERGY equ 52
xf_GETPLAYERMANA equ 56
xf_GETPLAYERMAXHP equ 60
xf_GETPLAYERMAXENERGY equ 64
xf_GETPLAYERMAXMANA equ 68
xf_SETPLAYERHP equ 132
xf_SETPLAYERENERGY equ 136
xf_SETPLAYERMANA equ 140
xf_SETPLAYERMAXHP equ 548
xf_SETPLAYERMAXENERGY equ 552
xf_SETPLAYERMAXMANA equ 556
xf_GETPLAYERSTRENGTH equ 72
xf_GETPLAYERENDURANCE equ 76
xf_GETPLAYERINTELLIGENCE equ 80
xf_GETPLAYERAGILITY equ 84
xf_GETPLAYERCONCENTRATION equ 560
xf_GETPLAYERCONSTITUTION equ 564
xf_GETPLAYERSTAMINA equ 568
xf_GETPLAYERWISDOM equ 572
xf_GETPLAYERBASESTRENGTH equ 576
xf_GETPLAYERBASEENDURANCE equ 580
xf_GETPLAYERBASEINTELLIGENCE equ 584
xf_GETPLAYERBASEAGILITY equ 588
xf_GETPLAYERBASECONCENTRATION equ 592
xf_GETPLAYERBASECONSTITUTION equ 596
xf_GETPLAYERBASESTAMINA equ 600
xf_GETPLAYERBASEWISDOM equ 604
xf_SETPLAYERSTRENGTH equ 608
xf_SETPLAYERENDURANCE equ 612
xf_SETPLAYERINTELLIGENCE equ 616
xf_SETPLAYERAGILITY equ 620
xf_SETPLAYERCONCENTRATION equ 624
xf_SETPLAYERCONSTITUTION equ 628
xf_SETPLAYERSTAMINA equ 632
xf_SETPLAYERWISDOM equ 636
xf_GETPLAYERSKILLLEVEL equ 740
xf_GIVEPLAYERSKILLEXP equ 744
xf_SETPLAYERSKILLLEVEL equ 768
xf_GETPLAYERMAGICLEVEL equ 748
xf_GIVEPLAYERMAGICEXP equ 752
xf_SETPLAYERMAGICLEVEL equ 772
xf_CALCULATESTATS equ 640
xf_READINIINT equ 644
xf_READINISTR equ 648
xf_WRITEINISTR equ 652
xf_PLAYERQUESTPROMPT equ 784
xf_MONSTERSCRIPTTIMER equ 788
xf_PRINTBATTLECHAT equ 792
xf_SETMONSTERFLAG equ 660
xf_GETMONSTERFLAG equ 664
xf_SETOUTDOORLIGHT equ 656
xf_SENDPLAYERFROZEN equ 808
xf_GETMAPTILE equ 824
xf_SENDTILETOMAP equ 828
xf_SENDTILETOPLAYER equ 832
xf_RESETPLAYERMAPTILE equ 836
xf_RESETMAPTILE equ 840
xf_RESETMAPPLAYER equ 844
xf_RESETSCRIPTMAP equ 848
xf_SENDPLAYERRAWMAP equ 852
xf_SENDRAWMAP equ 856
xf_ZEROMEMORY equ 796
pv_PLAYER@MAIN equ -8

RETURN@MAIN equ 4
;/* Function MAIN */
f_MAIN:
ENTER 0,0
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_GETPLAYERMAP]
PUSH EAX
PUSH DWORD 210
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_GETPLAYERFLAG]
POP EBX
CMP EAX,EBX
JNE misc1
XOR EAX,EAX
JMP misc2
misc1:
MOV EAX,-1
misc2:
TEST EAX,EAX
JNZ if1
LEA EAX,[ESI+else1]
JMP EAX
if1:
PUSH DWORD 210
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_GETPLAYERFLAG]
CMP EAX,2000
JL misc5
XOR EAX,EAX
JMP misc6
misc5:
MOV EAX,-1
misc6:
PUSH EAX
PUSH DWORD 210
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_GETPLAYERFLAG]
CMP EAX,0
JG misc3
XOR EAX,EAX
JMP misc4
misc3:
MOV EAX,-1
misc4:
POP EBX
AND EAX,EBX
TEST EAX,EAX
JNZ if2
LEA EAX,[ESI+else2]
JMP EAX
if2:
PUSH DWORD 210
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_GETPLAYERFLAG]
CMP EAX,554
JE misc7
XOR EAX,EAX
JMP misc8
misc7:
MOV EAX,-1
misc8:
TEST EAX,EAX
JNZ if3
LEA EAX,[ESI+else3]
JMP EAX
if3:
PUSH DWORD 1960
PUSH DWORD 210
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_SETPLAYERFLAG]
PUSH DWORD 5
PUSH DWORD 211
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_SETPLAYERFLAG]
PUSH DWORD 5
PUSH DWORD 212
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_SETPLAYERFLAG]
else3:
PUSH DWORD 212
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_GETPLAYERFLAG]
PUSH DWORD EAX
PUSH DWORD 211
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_GETPLAYERFLAG]
PUSH DWORD EAX
PUSH DWORD 210
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_GETPLAYERFLAG]
PUSH DWORD EAX
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_PLAYERWARP]
LEA EAX,[ESI+endif2]
JMP EAX
else2:
PUSH DWORD 7
PUSH DWORD 9
PUSH DWORD 8
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_PLAYERWARP]
endif2:
LEA EAX,[ESI+endif1]
JMP EAX
else1:
PUSH DWORD 7
PUSH DWORD 9
PUSH DWORD 8
PUSH DWORD [EBP-pv_PLAYER@MAIN]
CALL [EDI+xf_PLAYERWARP]
endif1:
LEAVE
RET 4

;/* Temporary Variables */

