;;==============================
[@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]/@PK赛EI执行>\




[@进入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!\
Please get rid of your pots 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=============================================================

[@PK赛EI执行]
#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=============================================================