Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library WexgenStreak initializer Int uses ExortKit, WexgenMultiboard
- globals
- private constant integer BONUS_GOLD_IN_STREAK = 180 //Gold bonus 180 in starter
- private boolean FirstBlood = true //FirstBlood!
- private integer array ComboCount[12]
- private constant integer key = 0x01284341//key hash
- trigger WexgenStreakINT
- timer WexgenStreakIME
- endglobals
- //! textmacro STREAKFUNC2 takes NAME,FUNC,VALUE,TYPE,CODE
- private struct $NAME$
- $TYPE$ $VALUE$
- endstruct
- private function Timed_$NAME$ takes nothing returns nothing
- local $NAME$ this = getRT()
- if not (GameEnd) then
- call $CODE$
- endif
- call this.destroy()
- call breakRT()
- endfunction
- function $FUNC$ takes $TYPE$ $VALUE$, real time returns nothing
- local $NAME$ this = $NAME$.create()
- set this.$VALUE$ = $VALUE$
- call addRT(this,time,false,function Timed_$NAME$ )
- endfunction
- //! endtextmacro
- //! runtextmacro STREAKFUNC2("STRING","StringDelayTimed","st","string","Print(this.st, WS_STRING_DURATION)")
- //! runtextmacro STREAKFUNC2("SOUND","SoundDelayTimed","so","sound","StartSound(this.so)")
- function HaveComboTimed takes player p returns boolean
- if ComboCount[GetPlayerId(p)] > 0 then
- return true
- endif
- return false
- endfunction
- private function ComboCounting takes nothing returns nothing
- local integer i = 0
- loop
- exitwhen i > 11
- if IsPlayerOnline(Player(i)) and HaveComboTimed(Player(i)) then
- set ComboCount[i] = ComboCount[i] - 1
- if HaveComboTimed(Player(i)) == false then
- call SaveInteger(ht, key, GetHandleId(Player(i)), 0)//reset combo streak
- endif
- endif
- set i = i + 1
- endloop
- endfunction
- private function AddComboTimed takes unit u returns nothing
- set ComboCount[GetPlayerId(GetOwningPlayer(u))] = 20
- endfunction
- private function LoadComboStreak takes unit u returns integer
- return LoadInteger(ht, key, GetHandleId(GetOwningPlayer(u)))
- endfunction
- private function LoadExtraStreak takes unit u returns integer
- return LoadInteger(ht, key + 0x10, GetHandleId(GetOwningPlayer(u)))
- endfunction
- private function AddExtraStreak takes unit u returns nothing
- call SaveInteger(ht, key + 0x10, GetHandleId(GetOwningPlayer(u)), LoadInteger(ht, key + 0x10, GetHandleId(GetOwningPlayer(u))) + 1)
- endfunction
- private function AddComboStreak takes unit u returns nothing
- call SaveInteger(ht, key, GetHandleId(GetOwningPlayer(u)), LoadInteger(ht, key, GetHandleId(GetOwningPlayer(u))) + 1)
- endfunction
- private constant function ComboStreakEcho takes integer i returns string
- if i == 1 then
- return "|cff0028ffDouble Kill!!|r"
- endif
- if i ==2 then
- return "|cff80ff00Hat Trick!!|r"
- endif
- if i ==3 then
- return "|cff00bfffQuad Kill!!!|r"
- endif
- return "|cff00ced1Rampage!!!!|r"
- endfunction
- private constant function ExtraStreakEcho takes integer i returns string
- if i == 0 then
- return " "
- endif
- if i == 1 then
- return " "
- endif
- if i == 2 then
- return " "
- endif
- if i == 3 then
- return "|cff7ebff1Serial Killer!|r"
- endif
- if i ==4 then
- return "|cffffff00Ultimate Warrior!|r"
- endif
- if i ==5 then
- return "|cff0080ffAnnihilation!|r"
- endif
- if i ==6 then
- return "|cff00ff00Legendary!|r"
- endif
- if i ==7 then
- return "|cff800080Onslaught!|r"
- endif
- if i ==8 then
- return "|cffff80ffSavage Sick!|r"
- endif
- if i ==9 then
- return "|cffff8000Dominating!|r"
- endif
- if i ==10 then
- return "|cffff0000Bloodbath!|r"
- endif
- return "|cffffa500Immortal!|r"
- endfunction
- private constant function ComboStreakSound takes integer i returns sound
- if i == 1 then
- return gg_snd_DoubleKill
- endif
- if i ==2 then
- return gg_snd_HatTrick
- endif
- if i ==3 then
- return gg_snd_QuadKill
- endif
- return null
- endfunction
- private constant function ExtraStreakSound takes integer i returns sound
- if i == 1 then
- return null
- endif
- if i == 1 then
- return null
- endif
- if i == 2 then
- return null
- endif
- if i == 3 then
- return gg_snd_SerialKiller
- endif
- if i ==4 then
- return gg_snd_UltimateWarrior
- endif
- if i ==5 then
- return gg_snd_Annihilation
- endif
- if i ==6 then
- return gg_snd_Legendary
- endif
- if i ==7 then
- return gg_snd_Onslaught
- endif
- if i ==8 then
- return gg_snd_SavageSick
- endif
- if i ==9 then
- return gg_snd_Dominating
- endif
- if i ==10 then
- return gg_snd_Bloodbath
- endif
- return gg_snd_Immortal
- endfunction
- private constant function StreakGold takes integer i returns integer
- if i == 0 then
- return 0
- endif
- if i == 1 then
- return 0
- endif
- if i == 2 then
- return 0
- endif
- if i == 3 then
- return 50
- endif
- if i == 4 then
- return 100
- endif
- if i == 5 then
- return 150
- endif
- if i == 6 then
- return 200
- endif
- if i == 7 then
- return 250
- endif
- if i == 8 then
- return 300
- endif
- if i == 9 then
- return 350
- endif
- return 400
- endfunction
- private constant function D2R takes integer i returns real
- if i > 2 then
- return 1.00
- endif
- return 0.30
- endfunction
- //! textmacro STREAKFUNC
- call AddComboStreak(k)
- call AddExtraStreak(k)
- call SaveInteger(ht, key + 0x10, GetHandleId(GetOwningPlayer(d)), 0)//reset extra!
- call AddComboTimed(k)
- set d = null
- set k = null
- //! endtextmacro
- private function f takes nothing returns nothing
- local unit d = GetDyingUnit()
- local unit k = GetKillingUnit()
- local integer DID = GetPlayerId(GetOwningPlayer(d))
- local integer KID = GetPlayerId(GetOwningPlayer(k))
- local integer i = LoadComboStreak(k)
- local integer x = LoadExtraStreak(k)
- local integer gold = StreakGold(LoadExtraStreak(d)) + BONUS_GOLD_IN_STREAK + (GetHeroLevel(d) * 5)
- if GetOwningPlayer(d) == PLAYER_RED_LEADER then
- call Print(PlayerColorName[KID] + "(|cffc60000Team Leader|r) has killed " + PlayerColorName[DID] + " received |cffffcc00" + I2S(gold) + " |rgold.", WS_STRING_DURATION)
- elseif GetOwningPlayer(d) == PLAYER_BLUE_LEADER then
- call Print(PlayerColorName[KID] + "(|cff0066ccTeam Leader|r) has killed " + PlayerColorName[DID] + " received |cffffcc00" + I2S(gold) + " |rgold.", WS_STRING_DURATION)
- else
- call Print(PlayerColorName[KID] + " has killed " + PlayerColorName[DID] + " received |cffffcc00" + I2S(gold) + " |rgold.", WS_STRING_DURATION)
- endif
- call AddGoldInUnit(GetOwningPlayer(k), gold, d)
- if (FirstBlood) then
- set FirstBlood = false
- call AddGoldInUnit(GetOwningPlayer(k), 800, k)
- call StringDelayTimed(PlayerColorName[KID] + "|r has been |r|cffff0000First Blood!!!|r (|cffffcc00+800 |rgold)", 0.03)
- call SoundDelayTimed(gg_snd_firstblood, 0.01)
- //! runtextmacro STREAKFUNC()
- return
- endif
- if x > 2 then
- call StringDelayTimed(PlayerColorName[KID] + " is " + ExtraStreakEcho(x), 0.03)
- call SoundDelayTimed(ExtraStreakSound(x), 0.01)
- endif
- if i > 0 then
- call StringDelayTimed(PlayerColorName[KID] + " was " + ComboStreakEcho(i), 0.03)
- call SoundDelayTimed(ComboStreakSound(i), D2R(x))
- endif
- //! runtextmacro STREAKFUNC()
- endfunction
- private function c takes nothing returns boolean
- set TempUnit = GetDyingUnit()
- set TempUnit2 = GetKillingUnit()
- return IsUnitType(TempUnit, UNIT_TYPE_HERO) /*
- */and not IsUnitType(TempUnit, UNIT_TYPE_PEON) /*
- */and not IsUnitIllusion(TempUnit) /*
- */and not (GetOwningPlayer(TempUnit) == Player(PLAYER_NEUTRAL_AGGRESSIVE)) /*
- */and not (GetOwningPlayer(TempUnit) == Player(PLAYER_NEUTRAL_PASSIVE)) /*
- */and not (GetOwningPlayer(TempUnit2) == Player(PLAYER_NEUTRAL_AGGRESSIVE)) /*
- */and not (GetOwningPlayer(TempUnit2) == Player(PLAYER_NEUTRAL_PASSIVE)) /*
- */and not (GetOwningPlayer(TempUnit) == GetOwningPlayer(TempUnit2)) /*
- */and not (GetOwningPlayer(TempUnit) == Player(0)) /*
- */and not (GetOwningPlayer(TempUnit) == Player(6)) /*
- */and not (GetOwningPlayer(TempUnit2) == Player(0)) /*
- */and not (GetOwningPlayer(TempUnit2) == Player(6))
- endfunction
- //===========================================================================
- private function Int takes nothing returns nothing
- set WexgenStreakINT = CreateTrigger()
- set WexgenStreakIME = CreateTimer()
- call AddEvent(WexgenStreakINT, EVENT_PLAYER_UNIT_DEATH )
- call TriggerAddCondition(WexgenStreakINT, Condition( function c) )
- call TriggerAddAction(WexgenStreakINT, function f )
- call TimerStart(WexgenStreakIME, 1.0, true, function ComboCounting)
- endfunction
- endlibrary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement