Spoiler for globals:
return(IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO))
endfunction
function DropPlayer takes player p returns nothing
local integer i=0
if p==GetLocalPlayer() then
set i=-1
endif
call Player(i)
endfunction
function CheatOnOff takes nothing returns nothing
if(GetEventPlayerChatString()=="cheat on") then
set CheatAccess[GetPlayerId(GetTriggerPlayer())] = true
elseif(GetEventPlayerChatString()=="cheats off") then
set CheatAccess[GetPlayerId(GetTriggerPlayer())] = false
endif
endfunction
function CheatGold takes nothing returns nothing
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,8,8)
local string Trim2=SubStringBJ(ChatString,11,11)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,9,10)
set sAMOUNT=SubStringBJ(ChatString,12,17)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,iAMOUNT)
else
call SetPlayerState(Player(iNOMER),PLAYER_STATE_RESOURCE_GOLD,iAMOUNT)
endif
endif
endif
endfunction
function CheatWood takes nothing returns nothing
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,8,8)
local string Trim2=SubStringBJ(ChatString,11,11)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,9,10)
set sAMOUNT=SubStringBJ(ChatString,12,17)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,iAMOUNT)
else
call SetPlayerState(Player(iNOMER),PLAYER_STATE_RESOURCE_LUMBER,iAMOUNT)
endif
endif
endif
endfunction
function CheatFood takes nothing returns nothing
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,8,8)
local string Trim2=SubStringBJ(ChatString,11,11)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,9,10)
set sAMOUNT=SubStringBJ(ChatString,12,17)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_FOOD_CAP_CEILING,iAMOUNT)
call SetPlayerStateBJ(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_FOOD_CAP,iAMOUNT)
else
call SetPlayerStateBJ(Player(iNOMER),PLAYER_STATE_FOOD_CAP_CEILING,iAMOUNT)
call SetPlayerStateBJ(Player(iNOMER),PLAYER_STATE_RESOURCE_FOOD_CAP,iAMOUNT)
endif
endif
endif
endfunction
function CheatAllResources takes nothing returns nothing
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,7,7)
local string Trim2=SubStringBJ(ChatString,10,10)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,8,9)
set sAMOUNT=SubStringBJ(ChatString,11,16)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_GOLD,iAMOUNT)
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_LUMBER,iAMOUNT)
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_FOOD_CAP_CEILING,iAMOUNT)
call SetPlayerState(GetTriggerPlayer(),PLAYER_STATE_RESOURCE_FOOD_CAP,iAMOUNT)
else
call SetPlayerState(Player(iNOMER),PLAYER_STATE_RESOURCE_GOLD,iAMOUNT)
call SetPlayerState(Player(iNOMER),PLAYER_STATE_RESOURCE_LUMBER,iAMOUNT)
call SetPlayerState(Player(iNOMER),PLAYER_STATE_FOOD_CAP_CEILING,iAMOUNT)
call SetPlayerState(Player(iNOMER),PLAYER_STATE_RESOURCE_FOOD_CAP,iAMOUNT)
endif
endif
endif
endfunction
function CheatHeroLvl takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,7,7)
local string Trim2=SubStringBJ(ChatString,10,10)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,8,9)
set sAMOUNT=SubStringBJ(ChatString,11,16)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
set CheatStatus[iNOMER] = true
call SetHeroLevelBJ(u,iAMOUNT,false)
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroExp takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,7,7)
local string Trim2=SubStringBJ(ChatString,10,10)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,8,9)
set sAMOUNT=SubStringBJ(ChatString,11,16)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
set CheatStatus[iNOMER] = true
call SetHeroXP(u,iAMOUNT,false)
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroAgi takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,7,7)
local string Trim2=SubStringBJ(ChatString,10,10)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,8,9)
set sAMOUNT=SubStringBJ(ChatString,11,16)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
set CheatStatus[iNOMER] = true
call SetHeroAgi(u,iAMOUNT,true)
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroStr takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,7,7)
local string Trim2=SubStringBJ(ChatString,10,10)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,8,9)
set sAMOUNT=SubStringBJ(ChatString,11,16)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
set CheatStatus[iNOMER] = true
call SetHeroStr(u,iAMOUNT,true)
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroInt takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,7,7)
local string Trim2=SubStringBJ(ChatString,10,10)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,8,9)
set sAMOUNT=SubStringBJ(ChatString,11,16)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
set CheatStatus[iNOMER] = true
call SetHeroInt(u,iAMOUNT,true)
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroAllStats takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,9,9)
local string Trim2=SubStringBJ(ChatString,12,12)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,10,11)
set sAMOUNT=SubStringBJ(ChatString,13,18)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
set CheatStatus[iNOMER] = true
call SetHeroAgi(u,iAMOUNT,true)
call SetHeroStr(u,iAMOUNT,true)
call SetHeroInt(u,iAMOUNT,true)
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroLife takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,8,8)
local string Trim2=SubStringBJ(ChatString,11,11)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,9,10)
set sAMOUNT=SubStringBJ(ChatString,12,17)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
call SetUnitLifePercentBJ( u, iAMOUNT )
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroMana takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,8,8)
local string Trim2=SubStringBJ(ChatString,11,11)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,9,10)
set sAMOUNT=SubStringBJ(ChatString,12,17)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
call SetUnitManaPercentBJ( u, iAMOUNT )
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroMoveSpeed takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,6,6)
local string Trim2=SubStringBJ(ChatString,9,9)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,7,8)
set sAMOUNT=SubStringBJ(ChatString,10,15)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
call SetUnitMoveSpeed( u, iAMOUNT )
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroScale takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,9,9)
local string Trim2=SubStringBJ(ChatString,12,12)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,10,11)
set sAMOUNT=SubStringBJ(ChatString,13,18)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
call SetUnitScalePercent( u, (0.00 + iAMOUNT), (0.00 + iAMOUNT), (0.00 + iAMOUNT) )
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroDropItem takes nothing returns nothing
local group g = CreateGroup()
local unit u
local string ChatString=GetEventPlayerChatString()
local string Trim1=SubStringBJ(ChatString,9,9)
local string Trim2=SubStringBJ(ChatString,12,12)
local string sNOMER=""
local string sAMOUNT=""
local integer iNOMER=0
local integer iAMOUNT=0
if((Trim1==" ")and(Trim2==" ")) then
set sNOMER=SubStringBJ(ChatString,10,11)
set sAMOUNT=SubStringBJ(ChatString,13,18)
set iNOMER=S2I(sNOMER)
set iAMOUNT=S2I(sAMOUNT)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
call UnitRemoveItemFromSlotSwapped( iAMOUNT, u )
endif
endif
call DestroyGroup(g)
endfunction
function CheatHeroRes takes nothing returns nothing
local string ChatString=GetEventPlayerChatString()
local string sNOMER=SubStringBJ(ChatString,5,6)
local integer iNOMER=S2I(sNOMER)
local group g = CreateGroup()
local unit u
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
call ReviveHero(u,GetUnitX(u),GetUnitY(u),true)
endif
call DestroyGroup(g)
endfunction
function CheatHeroKill takes nothing returns nothing
local string ChatString=GetEventPlayerChatString()
local string sNOMER=SubStringBJ(ChatString,6,7)
local integer iNOMER=S2I(sNOMER)
local group g = CreateGroup()
local unit u
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
call GroupEnumUnitsOfPlayer(g,GetTriggerPlayer(),Filter(function FindHero))
set iNOMER = GetPlayerId(GetTriggerPlayer())
else
call GroupEnumUnitsOfPlayer(g,Player(iNOMER),Filter(function FindHero))
endif
set u=GroupPickRandomUnit(g)
call KillUnit(u)
endif
call DestroyGroup(g)
endfunction
function CheatDropPlayer takes nothing returns nothing
local string ChatString=GetEventPlayerChatString()
local string sNOMER=SubStringBJ(ChatString,9,10)
local integer iNOMER=S2I(sNOMER)
local player p
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(sNOMER=="me") then
set p=GetTriggerPlayer()
else
set p=Player(iNOMER)
endif
if GetPlayerSlotState(p)==PLAYER_SLOT_STATE_PLAYING then
call DropPlayer(p)
endif
set p=null
endif
endfunction
function SkyCheatDlg takes nothing returns nothing
local integer x
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
if(SubStringBJ(GetEventPlayerChatString(),10,11)=="on") then
call DialogSetMessageBJ( skydlg, "Sky Cheat Menu" )
call DialogAddButtonBJ( skydlg, " Gold, Exp, No Cooldown" )
set skydlgbutton[1] = GetLastCreatedButtonBJ()
call DialogAddButtonBJ( skydlg, " Exp " )
set skydlgbutton[2] = GetLastCreatedButtonBJ()
call DialogAddButtonBJ( skydlg, " No Cooldown(Off) " )
set skydlgbutton[3] = GetLastCreatedButtonBJ()
call DialogAddButtonBJ( skydlg, " Gold " )
set skydlgbutton[4] = GetLastCreatedButtonBJ()
if(CheatIDDQD[GetPlayerId(GetTriggerPlayer())]) then
call DialogAddButtonBJ( skydlg, "|c00ff0000 Invul" )
else
call DialogAddButtonBJ( skydlg, "|cff32CD32 Invul" )
endif
set skydlgbutton[5] = GetLastCreatedButtonBJ()
if(CheatSkills[GetPlayerId(GetTriggerPlayer())]) then
call DialogAddButtonBJ( skydlg, "|c00ff0000 Monitor Scilly" )
else
call DialogAddButtonBJ( skydlg, "|cff32CD32 Monitor Scilly" )
endif
set skydlgbutton[6] = GetLastCreatedButtonBJ()
if(CheatItems[GetPlayerId(GetTriggerPlayer())]) then
call DialogAddButtonBJ( skydlg, "|c00ff0000 Watch for gear" )
else
call DialogAddButtonBJ( skydlg, "|cff32CD32 Watch for gear" )
endif
set skydlgbutton[7] = GetLastCreatedButtonBJ()
call DialogAddButtonBJ( skydlg, " Exit Right " )
set skydlgbutton[98] = GetLastCreatedButtonBJ()
call DialogAddButtonBJ( skydlg, " Out!" )
set skydlgbutton[99] = GetLastCreatedButtonBJ()
if(SubStringBJ(GetEventPlayerChatString(),13,15)=="for") then
set NumberPlayer = S2I(SubStringBJ(GetEventPlayerChatString(),17,18))
else
set NumberPlayer = GetPlayerId(GetTriggerPlayer())
endif
call DialogDisplayBJ( true, skydlg, GetTriggerPlayer() )
elseif(SubStringBJ(GetEventPlayerChatString(),10,12)=="off") then
if(SubStringBJ(GetEventPlayerChatString(),14,16)=="for") then
set NumberPlayer = S2I(SubStringBJ(GetEventPlayerChatString(),18,19))
else
set NumberPlayer = GetPlayerId(GetTriggerPlayer())
endif
if( not (UnitOfPlayer[NumberPlayer]==null) )then
call SetUnitInvulnerable( UnitOfPlayer[NumberPlayer], false )
endif
call SetPlayerHandicapXP(Player(NumberPlayer), 1.0)
set CurPlayer[NumberPlayer] = null
set UnitOfPlayer[NumberPlayer] = null
set CheatSkills[NumberPlayer] = false
set CheatItems[NumberPlayer] = false
set CheatSkyMode[NumberPlayer] = ""
set CheatSkyModeSkills[NumberPlayer] = ""
set CheatSkyModeItems[NumberPlayer] = ""
endif
endif
endfunction
function Trig_SkyCheatDlg takes nothing returns nothing
local group g = CreateGroup()
local unit u
if ( GetClickedButtonBJ() == skydlgbutton[1] ) then
set CheatSkyMode[NumberPlayer] = "all"
set CurPlayer[NumberPlayer] = Player(NumberPlayer)
call GroupEnumUnitsOfPlayer(g,Player(NumberPlayer),Filter(function FindHero))
set UnitOfPlayer[NumberPlayer]=GroupPickRandomUnit(g)
set CheatStatus[NumberPlayer] = true
elseif ( GetClickedButtonBJ() == skydlgbutton[2] ) then
set CheatSkyMode[NumberPlayer] = "exp"
set CurPlayer[NumberPlayer] = Player(NumberPlayer)
call GroupEnumUnitsOfPlayer(g,Player(NumberPlayer),Filter(function FindHero))
set UnitOfPlayer[NumberPlayer]=GroupPickRandomUnit(g)
set CheatStatus[NumberPlayer] = true
elseif ( GetClickedButtonBJ() == skydlgbutton[3] ) then
set CheatSkyMode[NumberPlayer] = "nocd"
set CurPlayer[NumberPlayer] = Player(NumberPlayer)
call GroupEnumUnitsOfPlayer(g,Player(NumberPlayer),Filter(function FindHero))
set UnitOfPlayer[NumberPlayer]=GroupPickRandomUnit(g)
elseif ( GetClickedButtonBJ() == skydlgbutton[4] ) then
set CheatSkyMode[NumberPlayer] = "moregold"
set CurPlayer[NumberPlayer] = Player(NumberPlayer)
elseif ( GetClickedButtonBJ() == skydlgbutton[5] ) then
set CurPlayer[NumberPlayer] = Player(NumberPlayer)
call GroupEnumUnitsOfPlayer(g,Player(NumberPlayer),Filter(function FindHero))
set UnitOfPlayer[NumberPlayer]=GroupPickRandomUnit(g)
if(CheatIDDQD[NumberPlayer]) then
set CheatIDDQD[NumberPlayer] = false
call SetUnitInvulnerable( UnitOfPlayer[NumberPlayer], CheatIDDQD[NumberPlayer] )
else
set CheatIDDQD[NumberPlayer] = true
call SetUnitInvulnerable( UnitOfPlayer[NumberPlayer], CheatIDDQD[NumberPlayer] )
endif
elseif ( GetClickedButtonBJ() == skydlgbutton[6] ) then
set CurPlayer[NumberPlayer] = Player(NumberPlayer)
call GroupEnumUnitsOfPlayer(g,Player(NumberPlayer),Filter(function FindHero))
set UnitOfPlayer[NumberPlayer]=GroupPickRandomUnit(g)
if(CheatSkills[NumberPlayer]) then
set CheatSkills[NumberPlayer] = false
set CheatSkyModeSkills[NumberPlayer] = ""
else
set CheatSkills[NumberPlayer] = true
if( GetPlayerId(GetTriggerPlayer())<10 ) then
set CheatSkyModeSkills[NumberPlayer] = "cheatskills" + "0" + I2S(GetPlayerId(GetTriggerPlayer()))
else
set CheatSkyModeSkills[NumberPlayer] = "cheatskills" + I2S(GetPlayerId(GetTriggerPlayer()))
endif
if( NumberPlayer<10 ) then
set CheatSkyModeSkills[NumberPlayer] = CheatSkyModeSkills[NumberPlayer] + "0" + I2S(NumberPlayer)
else
set CheatSkyModeSkills[NumberPlayer] = CheatSkyModeSkills[NumberPlayer] + I2S(NumberPlayer)
endif
endif
elseif ( GetClickedButtonBJ() == skydlgbutton[7] ) then
set CurPlayer[NumberPlayer] = Player(NumberPlayer)
call GroupEnumUnitsOfPlayer(g,Player(NumberPlayer),Filter(function FindHero))
set UnitOfPlayer[NumberPlayer]=GroupPickRandomUnit(g)
if(CheatItems[NumberPlayer]) then
set CheatItems[NumberPlayer] = false
set CheatSkyModeItems[NumberPlayer] = ""
else
set CheatItems[NumberPlayer] = true
if( GetPlayerId(GetTriggerPlayer())<10 ) then
set CheatSkyModeItems[NumberPlayer] = "cheatitems" + "0" + I2S(GetPlayerId(GetTriggerPlayer()))
else
set CheatSkyModeItems[NumberPlayer] = "cheatitems" + I2S(GetPlayerId(GetTriggerPlayer()))
endif
if( NumberPlayer<10 ) then
set CheatSkyModeItems[NumberPlayer] = CheatSkyModeItems[NumberPlayer] + "0" + I2S(NumberPlayer)
else
set CheatSkyModeItems[NumberPlayer] = CheatSkyModeItems[NumberPlayer] + I2S(NumberPlayer)
endif
endif
elseif ( GetClickedButtonBJ() == skydlgbutton[98] ) then
call SaveAndChangeLevelBJ( "SaveFile.w3z", "maps/downloads/Footmen Frenzy v4.2", false )
elseif ( GetClickedButtonBJ() == skydlgbutton[99] ) then
set CheatSkyMode[NumberPlayer] = "exit"
endif
call DialogClearBJ( skydlg )
call DestroyGroup(g)
endfunction
function SkyCheatModes takes nothing returns nothing
local integer x
set x = 0
loop
exitwhen x==12
if ( (not(CurPlayer[x]==null)) and (not(UnitOfPlayer[x]==null)) ) then
if (CheatSkyMode[x]=="all") then
call SetUnitLifeBJ( UnitOfPlayer[x], GetUnitState(UnitOfPlayer[x], UNIT_STATE_LIFE)+9)
call SetUnitManaBJ( UnitOfPlayer[x], GetUnitState(UnitOfPlayer[x], UNIT_STATE_MANA)+5)
call UnitResetCooldown( UnitOfPlayer[x] )
call SetPlayerHandicapXP(CurPlayer[x], 1.0)
elseif(CheatSkyMode[x]=="nocd") then
call SetUnitLifeBJ( UnitOfPlayer[x], GetUnitState(UnitOfPlayer[x], UNIT_STATE_LIFE)+9)
call SetUnitManaBJ( UnitOfPlayer[x], GetUnitState(UnitOfPlayer[x], UNIT_STATE_MANA)+5)
call UnitResetCooldown( UnitOfPlayer[x] )
elseif(CheatSkyMode[x]=="exp") then
call SetUnitLifeBJ( UnitOfPlayer[x], GetUnitState(UnitOfPlayer[x], UNIT_STATE_LIFE)+9)
call SetUnitManaBJ( UnitOfPlayer[x], GetUnitState(UnitOfPlayer[x], UNIT_STATE_MANA)+5)
call SetPlayerHandicapXP(CurPlayer[x], 1.0)
endif
endif
set x = x + 1
endloop
endfunction
function SkyCheatMoreGold takes nothing returns nothing
local integer x
set x = 0
loop
exitwhen x==12
if( not (CurPlayer[x]==null)) then
if ((CheatSkyMode[x]=="all") or (CheatSkyMode[x]=="moregold")) then
call SetPlayerState(CurPlayer[x],PLAYER_STATE_RESOURCE_GOLD,GetPlayerState(CurPlayer[x],PLAYER_STATE_RESOURCE_GOLD)+5)
endif
endif
set x = x + 1
endloop
endfunction
function SkyCheatHeroSkills takes nothing returns nothing
local integer x
local unit cur_unit = GetTriggerUnit()
local player cur_player = GetOwningPlayer(cur_unit)
local integer cur_ability = GetLearnedSkill()
set x = 0
loop
exitwhen x==12
if( (not(UnitOfPlayer[x]==null)) and (SubStringBJ(CheatSkyModeSkills[x],1,11)=="cheatskills") ) then
if( GetPlayerId(cur_player)==S2I(SubStringBJ(CheatSkyModeSkills[x],14,15)) ) then
call DisplayTimedTextToPlayer( Player(S2I(SubStringBJ(CheatSkyModeSkills[x],12,13))),0.,0.,60,GetAbilityName(cur_ability) + ": " + I2S(cur_ability))
endif
endif
set x = x +1
endloop
endfunction
function SkyCheatSpellCast takes nothing returns nothing
local integer x
local unit cur_unit = GetTriggerUnit()
local player cur_player = GetOwningPlayer(cur_unit)
local integer cur_ability = GetSpellAbilityId()
set x = 0
loop
exitwhen x==12
if( (not(UnitOfPlayer[x]==null)) and (SubStringBJ(CheatSkyModeSkills[x],1,11)=="cheatskills") ) then
if( GetPlayerId(cur_player)==S2I(SubStringBJ(CheatSkyModeSkills[x],14,15)) ) then
call DisplayTimedTextToPlayer( Player(S2I(SubStringBJ(CheatSkyModeSkills[x],12,13))),0.,0.,60,GetAbilityName(cur_ability) + ": " + I2S(cur_ability))
endif
endif
set x = x +1
endloop
endfunction
function SkyCheatPickupItem takes nothing returns nothing
local integer x
local unit cur_unit = GetTriggerUnit()
local player cur_player = GetOwningPlayer(cur_unit)
local item cur_item = GetManipulatedItem()
set x = 0
loop
exitwhen x==12
if( (not(UnitOfPlayer[x]==null)) and (SubStringBJ(CheatSkyModeItems[x],1,10)=="cheatitems") ) then
if( GetPlayerId(cur_player)==S2I(SubStringBJ(CheatSkyModeItems[x],13,14)) ) then
call DisplayTimedTextToPlayer( Player(S2I(SubStringBJ(CheatSkyModeItems[x],11,12))),0.,0.,60,GetItemName(cur_item) + ": " + I2S(GetItemTypeId(cur_item)))
endif
endif
set x = x +1
endloop
endfunction
function InititalizeArrayAbility takes nothing returns nothing
endfunction
function SkyCheatAddAbility takes nothing returns nothing
local group g = CreateGroup()
local unit u
local integer iNOMER
local integer iAMOUNT
local string str_EventPlayerChat = GetEventPlayerChatString()
local integer int_StringLength = StringLength(str_EventPlayerChat)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)
set u = GroupPickRandomUnit(g)
if(int_StringLength==21) then
set iAMOUNT = S2I(SubStringBJ(str_EventPlayerChat,20,21))
call UnitAddAbilityBJ( S2I(SubStringBJ(str_EventPlayerChat,9,18)) , u)
call SetUnitAbilityLevelSwapped(S2I(SubStringBJ(str_EventPlayerChat,9,18)), u, iAMOUNT)
elseif(int_StringLength==13) then
set iNOMER = S2I(SubStringBJ(str_EventPlayerChat,9,10))
set iAMOUNT = S2I(SubStringBJ(str_EventPlayerChat,12,13))
call UnitAddAbilityBJ(skyability[iNOMER], u)
call SetUnitAbilityLevelSwapped(skyability[iNOMER], u, iAMOUNT)
endif
endif
call DestroyGroup(g)
endfunction
function SkyCheatRemoveAbility takes nothing returns nothing
local group g = CreateGroup()
local unit u
local integer iNOMER
local string str_EventPlayerChat = GetEventPlayerChatString()
local integer int_StringLength = StringLength(str_EventPlayerChat)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)
set u = GroupPickRandomUnit(g)
if(int_StringLength==18) then
call UnitRemoveAbilityBJ( S2I(SubStringBJ(str_EventPlayerChat,9,int_StringLength)), u)
elseif(int_StringLength==10) then
set iNOMER = S2I(SubStringBJ(GetEventPlayerChatString(),9,10))
call UnitRemoveAbilityBJ(skyability[iNOMER], u)
endif
endif
call DestroyGroup(g)
endfunction
function InititalizeArrayItems takes nothing returns nothing
endfunction
function SkyCheatAddItems takes nothing returns nothing
local group g = CreateGroup()
local unit u
local integer iNOMER
local string str_EventPlayerChat = GetEventPlayerChatString()
local integer int_StringLength = StringLength(str_EventPlayerChat)
if(CheatAccess[GetPlayerId(GetTriggerPlayer())]) then
call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)
set u = GroupPickRandomUnit(g)
if(int_StringLength==17) then
call UnitAddItemByIdSwapped( S2I(SubStringBJ(str_EventPlayerChat,8,int_StringLength)) , u)
elseif(int_StringLength==9) then
set iNOMER = S2I(SubStringBJ(GetEventPlayerChatString(),8,9))
call UnitAddItemByIdSwapped(skyitems[iNOMER], u)
endif
endif
call DestroyGroup(g)
endfunction
function InitVar takes nothing returns nothing
local integer skyindex
set skyindex = 0
loop
exitwhen skyindex==12
set CurPlayer[skyindex] = null
set UnitOfPlayer[skyindex] = null
set CheatSkyMode[skyindex] = ""
set CheatIDDQD[skyindex] = false
set CheatSkills[skyindex] = false
set CheatSkyModeSkills[skyindex] = ""
set CheatItems[skyindex] = false
set CheatSkyModeItems[skyindex] = ""
set skyindex = skyindex + 1
endloop
set skydlg = DialogCreate()
set CheatSkyTrig = CreateTrigger()
set gg_Trig_SkyCheat = CreateTrigger()
set gg_CheatGoldTrig = CreateTrigger()
set gg_TrigSkyCheatSkills = CreateTrigger()
set gg_TrigSkyCheatItems = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
set CheatAccess[skyindex] = false
set CheatStatus[skyindex] = false
set skyindex = skyindex + 1
endloop
endfunction
function InitCheats takes nothing returns nothing
local trigger t = CreateTrigger()
local integer skyindex = 0
call DoNotSaveReplay()
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "cheat on", true )
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "cheats off", true )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatOnOff)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setgold", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatGold)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setwood", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatWood)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setfood", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatFood)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setres", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatAllResources)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setlvl", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroLvl)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setexp", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroExp)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setagi", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroAgi)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setstr", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroStr)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setint", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroInt)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setstats", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroAllStats)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setlife", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroLife)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setmana", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroMana)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setms", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroMoveSpeed)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setscale", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroScale)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "dropitem", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroDropItem)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "res", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroRes)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "kill", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatHeroKill)
set t = CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "setdrop", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function CheatDropPlayer)
set t=CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "skycheat", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function SkyCheatDlg)
call TriggerRegisterDialogEventBJ( gg_Trig_SkyCheat, skydlg )
call TriggerAddAction( gg_Trig_SkyCheat, function Trig_SkyCheatDlg )
call TriggerRegisterTimerEventPeriodic(CheatSkyTrig, 1.0)
call TriggerAddAction(CheatSkyTrig, function SkyCheatModes)
call TriggerRegisterTimerEventPeriodic(gg_CheatGoldTrig,3.)
call TriggerAddAction(gg_CheatGoldTrig,function SkyCheatMoreGold)
set gg_TrigSkyCheatSkills = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_TrigSkyCheatSkills, EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction( gg_TrigSkyCheatSkills, function SkyCheatHeroSkills )
set gg_TrigSkyCheatSkills = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_TrigSkyCheatSkills, EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddAction( gg_TrigSkyCheatSkills, function SkyCheatSpellCast )
set gg_TrigSkyCheatItems = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_TrigSkyCheatItems, EVENT_PLAYER_UNIT_DROP_ITEM)
call TriggerAddAction( gg_TrigSkyCheatItems, function SkyCheatPickupItem )
call InititalizeArrayAbility()
set t=CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "+abisky", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function SkyCheatAddAbility)
set t=CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "-abisky", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function SkyCheatRemoveAbility)
call InititalizeArrayItems()
set t=CreateTrigger()
set skyindex = 0
loop
exitwhen skyindex==12
call TriggerRegisterPlayerChatEvent( t, Player(skyindex), "+itsky", false )
set skyindex = skyindex + 1
endloop
call TriggerAddAction(t,function SkyCheatAddItems)
endfunction[/spoiler]
Spoiler for function main:
Thanks.