struct TestMap extends array
static unit hero = null
static real camDist = 0.
static timer camDistLocker = CreateTimer()
static real camX = 0.
static real camY = 0.
static timer camXYLocker = CreateTimer()
static trigger restartTrig = CreateTrigger()
static integer continue = 1
static method tryCrash takes nothing returns integer
return 1/continue
endmethod
static method print takes string s returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 5, s)
endmethod
static method printEx takes string s, real d returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, d, s)
endmethod
static method wait takes real time returns nothing
call TriggerSleepAction(time)
endmethod
static method randomEnemy takes nothing returns player
return Player(GetRandomInt(3,5))
endmethod
static method randomAlly takes nothing returns player
return Player(GetRandomInt(1,2))
endmethod
static method makeEnemy takes real x, real y returns unit
return CreateUnit(randomEnemy(), 'Hamg', x, y, 270)
endmethod
static method makeAlly takes real x, real y returns unit
return CreateUnit(randomAlly(), 'Hmkg', x, y, 270)
endmethod
static method makeStrongAlly takes real x, real y returns unit
return CreateUnit(randomAlly(), 'H000', x, y, 270)
endmethod
static method makeStrongEnemy takes real x, real y returns unit
return CreateUnit(randomEnemy(), 'H000', x, y, 270)
endmethod
static method damage takes unit source, unit target, real amount returns nothing
call UnitDamageTarget(source, target, amount, false, false, null, null, null)
endmethod
static method ally takes player p1, player p2 returns nothing
call SetPlayerAlliance(p1, p2, ALLIANCE_PASSIVE, true)
call SetPlayerAlliance(p1, p2, ALLIANCE_HELP_REQUEST, true)
call SetPlayerAlliance(p1, p2, ALLIANCE_HELP_RESPONSE, true)
call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_XP, true)
call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_SPELLS, true)
call SetPlayerAlliance(p2, p1, ALLIANCE_PASSIVE, true)
call SetPlayerAlliance(p2, p1, ALLIANCE_HELP_REQUEST, true)
call SetPlayerAlliance(p2, p1, ALLIANCE_HELP_RESPONSE, true)
call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_XP, true)
call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_SPELLS, true)
call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_VISION, true)
call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_VISION, true)
call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_VISION, false)
call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_CONTROL, false)
call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_CONTROL, false)
call SetPlayerAlliance(p1, p2, ALLIANCE_SHARED_ADVANCED_CONTROL, false)
call SetPlayerAlliance(p2, p1, ALLIANCE_SHARED_ADVANCED_CONTROL, false)
endmethod
static method giveVision takes nothing returns nothing
call FogModifierStart(CreateFogModifierRect(Player(0),FOG_OF_WAR_VISIBLE,bj_mapInitialPlayableArea,true,true))
endmethod
static method lockDist takes nothing returns nothing
call SetCameraField(CAMERA_FIELD_TARGET_DISTANCE, camDist, 0)
endmethod
static method lockXY takes nothing returns nothing
call SetCameraPosition(camX, camY)
endmethod
static method lockCamDistance takes real distance returns nothing
set camDist = distance
call TimerStart(camDistLocker, 0.05, true, function thistype.lockDist)
endmethod
static method lockCamXY takes real x, real y returns nothing
set camX = x
set camY = y
call TimerStart(camXYLocker, 0.05, true, function thistype.lockXY)
endmethod
static method unlockCamDistance takes nothing returns nothing
call PauseTimer(camDistLocker)
endmethod
static method unlockCamXY takes nothing returns nothing
call PauseTimer(camXYLocker)
endmethod
static method revive takes nothing returns nothing
call ReviveHero(hero, GetUnitX(hero), GetUnitY(hero), false)
endmethod
static multiboard board = null
static method setTitle takes integer col, string val returns nothing
call MultiboardSetItemValue(MultiboardGetItem(board, 0, col), val)
endmethod
static method setBox takes integer col, integer val returns nothing
call MultiboardSetItemValue(MultiboardGetItem(board, 1, col), I2S(val))
endmethod
static method multiboardUpdate takes nothing returns nothing
if board==null then
set board=CreateMultiboard()
call MultiboardClear(board)
call MultiboardSetColumnCount(board, 15)
call MultiboardSetRowCount(board, 2)
call MultiboardSetItemsStyle(board, true, false)
call MultiboardDisplay(board, true)
call MultiboardMinimize(board, false)
call MultiboardSetItemsWidth(board, 0.02)
call setTitle(0, "K")
call setTitle(1, "Dt")
call setTitle(2, "A")
call setTitle(3, "Dn")
call setTitle(4, "S")
call setTitle(5, "St")
call setTitle(6, "S3")
call setTitle(7, "S4")
call setTitle(8, "S5")
call setTitle(9, "Mt")
call setTitle(10, "M2")
call setTitle(11, "M3")
call setTitle(12, "M4")
call setTitle(13, "M5")
call setTitle(14, "CB")
endif
call setBox(0, StreakSystem.getKillsById(0))
call setBox(1, StreakSystem.getDeathsById(0))
call setBox(2, StreakSystem.getAssistsById(0))
call setBox(3, StreakSystem.getDeniesById(0))
call setBox(4, StreakSystem.getSuicidesById(0))
call setBox(5, StreakSystem.getStreaksById(0))
call setBox(6, StreakSystem.getStreaksOfTypeById(0,3))
call setBox(7, StreakSystem.getStreaksOfTypeById(0,4))
call setBox(8, StreakSystem.getStreaksOfTypeById(0,5))
call setBox(9, StreakSystem.getMultikillsById(0))
call setBox(10, StreakSystem.getMultikillsOfTypeById(0,2))
call setBox(11, StreakSystem.getMultikillsOfTypeById(0,3))
call setBox(12, StreakSystem.getMultikillsOfTypeById(0,4))
call setBox(13, StreakSystem.getMultikillsOfTypeById(0,5))
call setBox(14, StreakSystem.getCombobreakersById(0))
endmethod
static method startMultiboard takes nothing returns nothing
call TimerStart(CreateTimer(), 0.01, true, function thistype.multiboardUpdate)
endmethod
static method createLeEnemies takes nothing returns nothing
if GetRandomInt(0,1) == 0 then
call makeEnemy(GetRandomReal(-1000,1000), GetRandomReal(-1000,1000))
else
call makeAlly(GetRandomReal(-1000,1000), GetRandomReal(-1000,1000))
endif
endmethod
static boolean running = false
private static method stop takes nothing returns nothing
local unit u
set continue = 0
call DestroyTrigger(restartTrig)
call GroupEnumUnitsInRange(bj_lastCreatedGroup, 0, 0, 9001, null)
loop
set u = FirstOfGroup(bj_lastCreatedGroup)
exitwhen u == null
call GroupRemoveUnit(bj_lastCreatedGroup, u)
call RemoveUnit(u)
endloop
call CreateUnit(Player(0), 'H000', 0, 0, 0)
call TimerStart(CreateTimer(), 1, true, function thistype.createLeEnemies)
endmethod
private static method do takes nothing returns nothing
local integer i = 0
local unit u
local unit v
local unit u1
local unit u2
local unit u3
local unit u4
if not running then
set running = true
set hero = CreateUnit(Player(0), 'H000', 0, 0, 270)
call wait(2)
call print("Testing suicide.")
call tryCrash()
call wait(1)
call tryCrash()
call damage(hero, hero, 100000)
call wait(2)
call tryCrash()
call print("Testing Denial.")
call revive()
call wait(1)
call tryCrash()
set u = makeAlly(0, -256)
call IssueTargetOrder(hero, "attack", u)
call wait(2)
call RemoveUnit(u)
call tryCrash()
call print("Testing Streaks and Multikills.")
loop
set u = makeEnemy(0, -256)
call IssueTargetOrder(hero, "attack", u)
call wait(3)
call tryCrash()
call RemoveUnit(u)
set i = i + 1
exitwhen i == 5
endloop
call print("Testing Combobreaker")
call PauseUnit(hero, true)
set u = makeStrongEnemy(0, -256)
call IssueTargetOrder(hero, "attack", u)
call wait(5)
call RemoveUnit(u)
call tryCrash()
call print("Testing Assists.")
call ReviveHero(hero, 0, 0, false)
call PauseUnit(hero, true)
set u = makeAlly(256, 0)
set v = makeEnemy(0, -256)
call IssueTargetOrder(u, "attack", v)
call wait(2)
call tryCrash()
call PauseUnit(hero, false)
call IssueTargetOrder(hero, "attack", v)
call wait(3)
call tryCrash()
call RemoveUnit(u)
call RemoveUnit(v)
call print("Testing Assists Again.")
call PauseUnit(hero, true)
set u1 = makeAlly(0,0)
set u2 = makeAlly(0,0)
set u3 = makeAlly(0,0)
set u4 = makeAlly(0,0)
set v = makeEnemy(0, -256)
call IssueTargetOrder(u1, "attack", v)
call IssueTargetOrder(u2, "attack", v)
call IssueTargetOrder(u3, "attack", v)
call IssueTargetOrder(u4, "attack", v)
call wait(3)
call tryCrash()
call PauseUnit(hero, false)
call IssueTargetOrder(hero, "attack", v)
call wait(2)
call tryCrash()
call RemoveUnit(u1)
call RemoveUnit(u2)
call RemoveUnit(u3)
call RemoveUnit(u4)
call RemoveUnit(v)
call print("Random Tests")
call print("Watch Carefully")
set u = makeStrongAlly(256,256)
call SetUnitTimeScale(u, 0.3)
set u = makeStrongAlly(-256,256)
call SetUnitTimeScale(u, 0.3)
set u = makeStrongEnemy(-256,-256)
call SetUnitTimeScale(u, 0.3)
set u = makeStrongEnemy(256,-256)
call SetUnitTimeScale(u, 0.3)
set u = makeEnemy(0,0)
call SetUnitTimeScale(u, 0.3)
set u = makeAlly(0,0)
call SetUnitTimeScale(u, 0.3)
set u = makeEnemy(0,0)
call SetUnitTimeScale(u, 0.3)
set u = makeAlly(0,0)
call SetUnitTimeScale(u, 0.3)
call wait(6)
call tryCrash()
call GroupEnumUnitsInRange(bj_lastCreatedGroup, 0, 0, 8000, null)
loop
set u = FirstOfGroup(bj_lastCreatedGroup)
exitwhen u == null
call GroupRemoveUnit(bj_lastCreatedGroup, u)
call RemoveUnit(u)
endloop
set running = false
endif
endmethod
static method run takes nothing returns nothing
local trigger t
call startMultiboard()
call giveVision()
call lockCamDistance(2500)
call lockCamXY(0,0)
call ally(Player(0), Player(1))
call ally(Player(0), Player(2))
call ally(Player(1), Player(2))
call ally(Player(4), Player(5))
call ally(Player(4), Player(6))
call ally(Player(5), Player(6))
call do()
call TriggerRegisterPlayerChatEvent(restartTrig, Player(0), "restart", true)
call TriggerAddAction(restartTrig, function thistype.do)
call DestroyTrigger(GetTriggeringTrigger())
call ClearTextMessages()
call printEx("Type 'restart' to restart the entire demonstration.", 60)
set t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0), "stop", true)
call TriggerAddAction(t, function thistype.stop)
call printEx("Type 'stop' to start the user trial. You can type 'stop' while a restart has been done and it will skip to the user trial just fine", 60)
set t = null
endmethod
private static method config takes nothing returns nothing
//Configuration:
call StreakSystem.setFirstBloodSound("Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.setComboBreakerSound("Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.setMinimumStreak(3)
call StreakSystem.newStreak("|cff80ff80killing spree|r", "is on a |cff80ff80killing spree|r!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newStreak("|cffff80c0dominating|r", "is |cffff80c0dominating|r!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newStreak("|cffffff80mega-kill|r", "has a |cffffff80mega-kill|r!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newStreak("|cffff8000unstoppable|r", "is |cffff8000unstoppable|r!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newStreak("|cff00ffa2wicked sick|r", "is |cff00ffa2wicked sick|r!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newStreak("|cffff0080monster kill|r", "has a |cffff0080monster kill|r!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newStreak("|cffff0000GODLIKE|r", "is |cffff0000GODLIKE|r!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newStreak("|cffffa500beyond Godlike|r", "is |cffffa500beyond Godlike. SOMEONE KILL HIM|r!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newMultikill("got a |cff0028ffDouble Kill|r!!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newMultikill("got a |cff40ff40Triple Kill|r!!!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newMultikill("got an |cff00bfffUltra-Kill|r!!!!", "Sound\\Interface\\GoodJob.wav", 2548)
call StreakSystem.newMultikill("is on a |cff00ced1Rampage|r!!!!!", "Sound\\Interface\\GoodJob.wav", 2548)
endmethod
private static method onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerChatEvent(t, Player(0), "start", true)
call TriggerAddAction(t, function thistype.run)
call config()
set t = null
call print("Type 'start' to begin.")
endmethod
endstruct