Advertisement
Guest User

Untitled

a guest
Jul 24th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.11 KB | None | 0 0
  1. library WexgenStreak initializer Int uses ExortKit, WexgenMultiboard
  2. globals
  3. private constant integer BONUS_GOLD_IN_STREAK = 180 //Gold bonus 180 in starter
  4. private boolean FirstBlood = true //FirstBlood!
  5. private integer array ComboCount[12]
  6. private constant integer key = 0x01284341//key hash
  7. trigger WexgenStreakINT
  8. timer WexgenStreakIME
  9. endglobals
  10. //! textmacro STREAKFUNC2 takes NAME,FUNC,VALUE,TYPE,CODE
  11. private struct $NAME$
  12. $TYPE$ $VALUE$
  13. endstruct
  14. private function Timed_$NAME$ takes nothing returns nothing
  15. local $NAME$ this = getRT()
  16. if not (GameEnd) then
  17. call $CODE$
  18. endif
  19. call this.destroy()
  20. call breakRT()
  21. endfunction
  22. function $FUNC$ takes $TYPE$ $VALUE$, real time returns nothing
  23. local $NAME$ this = $NAME$.create()
  24. set this.$VALUE$ = $VALUE$
  25. call addRT(this,time,false,function Timed_$NAME$ )
  26. endfunction
  27. //! endtextmacro
  28.  
  29. //! runtextmacro STREAKFUNC2("STRING","StringDelayTimed","st","string","Print(this.st, WS_STRING_DURATION)")
  30. //! runtextmacro STREAKFUNC2("SOUND","SoundDelayTimed","so","sound","StartSound(this.so)")
  31.  
  32. function HaveComboTimed takes player p returns boolean
  33. if ComboCount[GetPlayerId(p)] > 0 then
  34. return true
  35. endif
  36. return false
  37. endfunction
  38.  
  39. private function ComboCounting takes nothing returns nothing
  40. local integer i = 0
  41. loop
  42. exitwhen i > 11
  43. if IsPlayerOnline(Player(i)) and HaveComboTimed(Player(i)) then
  44. set ComboCount[i] = ComboCount[i] - 1
  45. if HaveComboTimed(Player(i)) == false then
  46. call SaveInteger(ht, key, GetHandleId(Player(i)), 0)//reset combo streak
  47. endif
  48. endif
  49. set i = i + 1
  50. endloop
  51. endfunction
  52. private function AddComboTimed takes unit u returns nothing
  53. set ComboCount[GetPlayerId(GetOwningPlayer(u))] = 20
  54. endfunction
  55.  
  56. private function LoadComboStreak takes unit u returns integer
  57. return LoadInteger(ht, key, GetHandleId(GetOwningPlayer(u)))
  58. endfunction
  59.  
  60. private function LoadExtraStreak takes unit u returns integer
  61. return LoadInteger(ht, key + 0x10, GetHandleId(GetOwningPlayer(u)))
  62. endfunction
  63.  
  64. private function AddExtraStreak takes unit u returns nothing
  65. call SaveInteger(ht, key + 0x10, GetHandleId(GetOwningPlayer(u)), LoadInteger(ht, key + 0x10, GetHandleId(GetOwningPlayer(u))) + 1)
  66. endfunction
  67.  
  68. private function AddComboStreak takes unit u returns nothing
  69. call SaveInteger(ht, key, GetHandleId(GetOwningPlayer(u)), LoadInteger(ht, key, GetHandleId(GetOwningPlayer(u))) + 1)
  70. endfunction
  71.  
  72. private constant function ComboStreakEcho takes integer i returns string
  73. if i == 1 then
  74. return "|cff0028ffDouble Kill!!|r"
  75. endif
  76. if i ==2 then
  77. return "|cff80ff00Hat Trick!!|r"
  78. endif
  79. if i ==3 then
  80. return "|cff00bfffQuad Kill!!!|r"
  81. endif
  82. return "|cff00ced1Rampage!!!!|r"
  83. endfunction
  84.  
  85. private constant function ExtraStreakEcho takes integer i returns string
  86. if i == 0 then
  87. return " "
  88. endif
  89. if i == 1 then
  90. return " "
  91. endif
  92. if i == 2 then
  93. return " "
  94. endif
  95. if i == 3 then
  96. return "|cff7ebff1Serial Killer!|r"
  97. endif
  98. if i ==4 then
  99. return "|cffffff00Ultimate Warrior!|r"
  100. endif
  101. if i ==5 then
  102. return "|cff0080ffAnnihilation!|r"
  103. endif
  104. if i ==6 then
  105. return "|cff00ff00Legendary!|r"
  106. endif
  107. if i ==7 then
  108. return "|cff800080Onslaught!|r"
  109. endif
  110. if i ==8 then
  111. return "|cffff80ffSavage Sick!|r"
  112. endif
  113. if i ==9 then
  114. return "|cffff8000Dominating!|r"
  115. endif
  116. if i ==10 then
  117. return "|cffff0000Bloodbath!|r"
  118. endif
  119. return "|cffffa500Immortal!|r"
  120. endfunction
  121.  
  122. private constant function ComboStreakSound takes integer i returns sound
  123. if i == 1 then
  124. return gg_snd_DoubleKill
  125. endif
  126. if i ==2 then
  127. return gg_snd_HatTrick
  128. endif
  129. if i ==3 then
  130. return gg_snd_QuadKill
  131. endif
  132. return null
  133. endfunction
  134.  
  135. private constant function ExtraStreakSound takes integer i returns sound
  136. if i == 1 then
  137. return null
  138. endif
  139. if i == 1 then
  140. return null
  141. endif
  142. if i == 2 then
  143. return null
  144. endif
  145. if i == 3 then
  146. return gg_snd_SerialKiller
  147. endif
  148. if i ==4 then
  149. return gg_snd_UltimateWarrior
  150. endif
  151. if i ==5 then
  152. return gg_snd_Annihilation
  153. endif
  154. if i ==6 then
  155. return gg_snd_Legendary
  156. endif
  157. if i ==7 then
  158. return gg_snd_Onslaught
  159. endif
  160. if i ==8 then
  161. return gg_snd_SavageSick
  162. endif
  163. if i ==9 then
  164. return gg_snd_Dominating
  165. endif
  166. if i ==10 then
  167. return gg_snd_Bloodbath
  168. endif
  169. return gg_snd_Immortal
  170. endfunction
  171.  
  172. private constant function StreakGold takes integer i returns integer
  173. if i == 0 then
  174. return 0
  175. endif
  176. if i == 1 then
  177. return 0
  178. endif
  179. if i == 2 then
  180. return 0
  181. endif
  182. if i == 3 then
  183. return 50
  184. endif
  185. if i == 4 then
  186. return 100
  187. endif
  188. if i == 5 then
  189. return 150
  190. endif
  191. if i == 6 then
  192. return 200
  193. endif
  194. if i == 7 then
  195. return 250
  196. endif
  197. if i == 8 then
  198. return 300
  199. endif
  200. if i == 9 then
  201. return 350
  202. endif
  203. return 400
  204. endfunction
  205.  
  206. private constant function D2R takes integer i returns real
  207. if i > 2 then
  208. return 1.00
  209. endif
  210. return 0.30
  211. endfunction
  212.  
  213. //! textmacro STREAKFUNC
  214. call AddComboStreak(k)
  215. call AddExtraStreak(k)
  216. call SaveInteger(ht, key + 0x10, GetHandleId(GetOwningPlayer(d)), 0)//reset extra!
  217. call AddComboTimed(k)
  218. set d = null
  219. set k = null
  220. //! endtextmacro
  221.  
  222. private function f takes nothing returns nothing
  223.  
  224. local unit d = GetDyingUnit()
  225. local unit k = GetKillingUnit()
  226. local integer DID = GetPlayerId(GetOwningPlayer(d))
  227. local integer KID = GetPlayerId(GetOwningPlayer(k))
  228. local integer i = LoadComboStreak(k)
  229. local integer x = LoadExtraStreak(k)
  230. local integer gold = StreakGold(LoadExtraStreak(d)) + BONUS_GOLD_IN_STREAK + (GetHeroLevel(d) * 5)
  231. if GetOwningPlayer(d) == PLAYER_RED_LEADER then
  232. call Print(PlayerColorName[KID] + "(|cffc60000Team Leader|r) has killed " + PlayerColorName[DID] + " received |cffffcc00" + I2S(gold) + " |rgold.", WS_STRING_DURATION)
  233. elseif GetOwningPlayer(d) == PLAYER_BLUE_LEADER then
  234. call Print(PlayerColorName[KID] + "(|cff0066ccTeam Leader|r) has killed " + PlayerColorName[DID] + " received |cffffcc00" + I2S(gold) + " |rgold.", WS_STRING_DURATION)
  235. else
  236. call Print(PlayerColorName[KID] + " has killed " + PlayerColorName[DID] + " received |cffffcc00" + I2S(gold) + " |rgold.", WS_STRING_DURATION)
  237. endif
  238.  
  239.  
  240. call AddGoldInUnit(GetOwningPlayer(k), gold, d)
  241.  
  242.  
  243. if (FirstBlood) then
  244. set FirstBlood = false
  245. call AddGoldInUnit(GetOwningPlayer(k), 800, k)
  246. call StringDelayTimed(PlayerColorName[KID] + "|r has been |r|cffff0000First Blood!!!|r (|cffffcc00+800 |rgold)", 0.03)
  247. call SoundDelayTimed(gg_snd_firstblood, 0.01)
  248. //! runtextmacro STREAKFUNC()
  249. return
  250. endif
  251.  
  252. if x > 2 then
  253. call StringDelayTimed(PlayerColorName[KID] + " is " + ExtraStreakEcho(x), 0.03)
  254. call SoundDelayTimed(ExtraStreakSound(x), 0.01)
  255. endif
  256. if i > 0 then
  257. call StringDelayTimed(PlayerColorName[KID] + " was " + ComboStreakEcho(i), 0.03)
  258. call SoundDelayTimed(ComboStreakSound(i), D2R(x))
  259. endif
  260. //! runtextmacro STREAKFUNC()
  261. endfunction
  262.  
  263.  
  264. private function c takes nothing returns boolean
  265. set TempUnit = GetDyingUnit()
  266. set TempUnit2 = GetKillingUnit()
  267. return IsUnitType(TempUnit, UNIT_TYPE_HERO) /*
  268. */and not IsUnitType(TempUnit, UNIT_TYPE_PEON) /*
  269. */and not IsUnitIllusion(TempUnit) /*
  270. */and not (GetOwningPlayer(TempUnit) == Player(PLAYER_NEUTRAL_AGGRESSIVE)) /*
  271. */and not (GetOwningPlayer(TempUnit) == Player(PLAYER_NEUTRAL_PASSIVE)) /*
  272. */and not (GetOwningPlayer(TempUnit2) == Player(PLAYER_NEUTRAL_AGGRESSIVE)) /*
  273. */and not (GetOwningPlayer(TempUnit2) == Player(PLAYER_NEUTRAL_PASSIVE)) /*
  274. */and not (GetOwningPlayer(TempUnit) == GetOwningPlayer(TempUnit2)) /*
  275. */and not (GetOwningPlayer(TempUnit) == Player(0)) /*
  276. */and not (GetOwningPlayer(TempUnit) == Player(6)) /*
  277. */and not (GetOwningPlayer(TempUnit2) == Player(0)) /*
  278. */and not (GetOwningPlayer(TempUnit2) == Player(6))
  279.  
  280. endfunction
  281. //===========================================================================
  282. private function Int takes nothing returns nothing
  283. set WexgenStreakINT = CreateTrigger()
  284. set WexgenStreakIME = CreateTimer()
  285. call AddEvent(WexgenStreakINT, EVENT_PLAYER_UNIT_DEATH )
  286. call TriggerAddCondition(WexgenStreakINT, Condition( function c) )
  287. call TriggerAddAction(WexgenStreakINT, function f )
  288.  
  289. call TimerStart(WexgenStreakIME, 1.0, true, function ComboCounting)
  290. endfunction
  291. endlibrary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement