;;==============================
[@main]
#IF
#ACT
loadvalue A4 "PlayerParam\PK.ini" [PK] PK

#IF
EQUAL A4 %USERNAME
#ACT
goto @main-2
#ELSEACT
take test2(M) 1
takew test2(M) 1
goto @main-2

[@main-2]
#ACT
MOV D1  0
MOV D4  0
MOV D2  0
MOV  A1 ""
loadvalue A1 "PlayerParam\PK.ini" [PK] PK
loadvalue D4 "PlayerParam\PK.ini" [ʤ] %A1
#IF
checkhum E001
#SAY
_________{FCOLOR/1}[{FCOLOR/12} {FCOLOR/14}PK Tournament{FCOLOR/12} {FCOLOR/1}]{FCOLOR/12} {FCOLOR/2}\\

{FCOLOR/2}Winner is: {FCOLOR/10}<$OUTPUT(A1)>{FCOLOR/12}{FCOLOR/2}, Total Wins{FCOLOR/10} <$OUTPUT(D4)> {FCOLOR/12}\\

{FCOLOR/13}Winners are rewarded with:\
{FCOLOR/13}1.{FCOLOR/2}Winner gets {FCOLOR/1}500 Gamepoints{FCOLOR/12}{FCOLOR/2}.\
{FCOLOR/13}2.{FCOLOR/2}Name displayed with {FCOLOR/1}PK Leader{FCOLOR/12}{FCOLOR/2} title.\
{FCOLOR/13}3.{FCOLOR/2}Gets {FCOLOR/1}Online Message{FCOLOR/12}{FCOLOR/2} features,\
__{FCOLOR/13}Show your glory, raise your profile!\\
_______{FCOLOR/1}[{FCOLOR/12} {FCOLOR/14}PK Tournament Rules{FCOLOR/12} {FCOLOR/1}]{FCOLOR/12} {FCOLOR/2}\\

{FCOLOR/2}Max of {FCOLOR/2}80 players{FCOLOR/12}{FCOLOR/2}. {FCOLOR/2}5 minutes{FCOLOR/12}{FCOLOR/2} access time.\
{FCOLOR/2}If less then 5 players, will be canceled.\
No PK level, War cant Beakon, Tao cant res.\
In the arena cant see names of self or others.\
Cant res, cant buy pots but can take pots!\
Every 5 minutes there is arena firewall.\
To win you must be the last standing!\
Exit from tournament will lose...\ 
{FCOLOR/13}Wait for decision after victory appears{FCOLOR/12}\\
<[Agree to Rules and Enter]/@PK>  {FCOLOR/10}(Currently <$OUTPUT(P9)> Players){FCOLOR/12}\  
<[Refresh]/@PK>\\
<[Close]/@exit>\
#IF
IsAdmin
#SAY
<[Start Match]/@PKEIִ>\




[@PK]
#ACT
loadvalue D2 "PlayerParam\PK.ini" [PK] 

#IF
CheckHum "E001" 80 
#SAY
Sorry competition is full, Please wait for next game.\
<[Close]/@exit>\
#ACT
break

#IF
Equal D2 2
#SAY
The game is in progress, can no longer participate.\
<[Close]/@exit>\
#ACT
break

#IF
Equal D2 0
#SAY
The current game has not started.\
<[Close]/@exit>\
#ACT
break

#IF
checkitem HPPotion(S 1
OR checkitem HPPotion(M) 1
OR checkitem HPPotion(L) 1
OR checkitem HPPotion(XL) 1
OR checkitem MPPotion(S) 1
OR checkitem MPPotion(M) 1
OR checkitem MPPotion(L) 1
OR checkitem MPPotion(XL) 1
OR checkitem SunPotion 1
OR checkitem SunPotion(M) 1
OR checkitem Ginseng 1
OR checkitem Test2(M) 1
OR checkitem Ѫ 1
OR checkitem վ 1
#SAY
{FCOLOR/10}Cannot take pots or have Armour!\
Please get rid of your pots or Armour to participate.{FCOLOR/12}\
<[Close]/@exit>\
#ACT
break

#IF
checkmonRecall
#ELSESAY
You cannot bring pets inside but can summon pet inside.\
#ELSEACT
break

#IF
Equal D2 1
#ACT
give Ginseng 20
SYSMSG "Competition is now prepared, Cant use magic until fight starts. If you win referees will apear to the top."
SYSMSG "System gives 20 Ginsengs every 10 minutes do not waste them."
MAPMOVE E001  40 40
break

;;40 14
;;feifan=============================================================

[@PK]
#ACT
loadvalue A1 "PlayerParam\PK.ini" [PK] PK
loadvalue D4 "PlayerParam\PK.ini" [ʤ] %A1

loadvalue D1 "PlayerParam\PK.ini" [ʤ] %USERNAME
loadvalue D2 "PlayerParam\PK.ini" [PK] 
INC D1 1

#IF
Equal D2 0
#ACT
SYSMSG "Competition is not open."
break


#IF
Equal D2 1
#ACT
SYSMSG "Competition has not begun, it is in preparation time."
break

#IF
!CheckHum "E001" 2
#ACT
SAVEVALUE  "PlayerParam\PK.ini" [PK] PK 1
SAVEVALUE  "PlayerParam\PK.ini" [PK] PK %USERNAME
SAVEVALUE  "PlayerParam\PK.ini" [PK]  0
SAVEVALUE  "PlayerParam\PK.ini" [ʤ] %USERNAME %D1
SYSMSG "You have won the tournament, gained 500 Gamepoints, your name is engraved on the list and can be set online message!"
MapTing E001 0 160 230
break

#ELSESAY
{FCOLOR/2}Winner is: {FCOLOR/10}<$OUTPUT(A1)>{FCOLOR/12}{FCOLOR/2}, Total Wins{FCOLOR/10} <$OUTPUT(D4)> {FCOLOR/12}\\
Tournament is not yet over, you want to quit or continue to fight?\\

<[I want out]/@tueichubisai>\\
<[Close]/@exit>\\


[@tueichubisai]
#SAY
Really quit?\\
I will now kick you out!\\
<[Yes, I want out]/@chuqufei>\\
<[Close]/@exit>\

[@chuqufei]
#ACT
MAPMOVE 0 160 230
break

[@getback]
#ACT
close

;;feifan=============================================================

[@PKEIִ]
#IF
#ACT
;;;SendCmd  "E001,40,20" Referee Hide  ;;NPC
ResetMapAttr "E001"   ;;ָĬ
ChangeMapAttr "E001" "SAFE" 
ChangeMapAttr "E001" "NoSpell"
LineMsg "Grobal" "(*) Tournament will start in 5 minutes, to participate visit 'Tournament NPC' In Bichon!"
SAVEVALUE  "PlayerParam\PK.ini" [PK]  1
SAVEVALUE  "PlayerParam\PK.ini" [PK] PK 0
Delaygoto "Grobal" 60 @jingxingPK5 10021
break
#ELSEACT
break

[@jingxingPK5]
#IF
#ACT
LineMsg "Grobal" "(*) Tournament will start in 4 minutes, to participate visit 'Tournament NPC' In Bichon!"
Delaygoto "Grobal" 60 @jingxingPK4 10022
break


[@jingxingPK4]
#IF
#ACT
LineMsg "Grobal" "(*) Tournament will start in 3 minutes, to participate visit 'Tournament NPC' In Bichon!"
Delaygoto "Grobal" 60 @jingxingPK3 10022
break



[@jingxingPK3]
#IF
#ACT
LineMsg "Grobal" "(*) Tournament will start in 2 minutes, to participate visit 'Tournament NPC' In Bichon!"
Delaygoto "Grobal" 60 @jingxingPK2 10023
break

[@jingxingPK2]
#IF
#ACT
LineMsg "Grobal" "(*) Tournament will start in 1 minute, to participate visit 'Tournament NPC' In Bichon! Hurry!"
Delaygoto "Grobal" 60 @jingxingPK1 10023
break

[@jingxingPK1]
#IF
CheckHum "E001" 3 ;;ǷﵽҪ
#ACT
mov  D5 0
mov  D6 0
ResetMapAttr "E001"   ;;ָĬ
SetEventMap "E001"    ;;õͼ
ChangeMapAttr "E001" "NOCHAT"  ;;ֹ˵
LineMsg "Grobal" "(*) Tournament has started, let us look forward to the birth of the PK Leader!"
SAVEVALUE  "PlayerParam\PK.ini" [PK]  2
goto @PK
#ELSEACT
SAVEVALUE  "PlayerParam\PK.ini" [PK]  0
LineMsg "Grobal" "(*) Not enough players, the Tournament has been canceled!"
ResetMapAttr "E001"   ;;ָĬ
MapTing E001 0 160 230
ClearDelaygoto 10021
ClearDelaygoto 10022
ClearDelaygoto 10023
Close

[@PK]
#ACT
loadvalue D3 "PlayerParam\PK.ini" [PK] PK
inc D5  1
inc D6  1

#IF
!CheckHum "E001" 2
#ACT
;;;SendCmd  "E001,40,20" Referee Show  ;;ʾNPC

#IF
!CheckHum "E001" 2
Equal D3 1
#ACT
loadvalue A1 "PlayerParam\PK.ini" [PK] PK
loadvalue D4 "PlayerParam\PK.ini" [ʤ] %A1
LineMsg "Grobal" "(*) Todays PK Leader has been born! It is <$OUTPUT(A1)> total wins <$OUTPUT(D4)>, Congratulations!"
SAVEVALUE  "PlayerParam\PK.ini" [PK] PK 0
SAVEVALUE  "PlayerParam\PK.ini" [PK]  0
ResetMapAttr "E001"   ;;ָĬ
MapTing E001 0 160 230
ClearDelaygoto 10024
break

#ELSEACT
Delaygoto "Grobal" 60 @PK 10024      ;;ظж
GOTO @MAP
break

[@MAP]
#IF
CheckHum "E001" 2
Equal D6 5 ;;ÿ11ӷŻǽ
#ACT
MapSpell [Firewall] "E001,24,11,27,43, +d100, +t30, +h
MapSpell [Firewall] "E001,13,22,40,27, +d100, +t30, +h
MapSpell [Firewall] "E001,29,29,38,38, +d100, +t30, +h
MapSpell [Firewall] "E001,28,13,36,21, +d100, +t30, +h
mov  D6 0
break

#IF
CheckHum "E001" 5
Equal D5 10  ;10ӵƷ
#ACT
DropItemMap "E001,40,40,15" Gingseng 2 50    ;;ͼƷ
mov  D5 0
break


;;feifan=============================================================