Advertisement
Ugleh

smart_shrooms.lua

Aug 4th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.28 KB | None | 0 0
  1. require "Utils"
  2.  
  3. local version = "1.0 (by Ugleh)"
  4. -- Template from smart_shrooms.lua by Val
  5.  
  6. red, yellow, green, blue, purple = 0x990000, 0x993300, 0x00FF00, 0x000099, 0x660066
  7.  
  8.     shroomconfig = scriptConfig("Shroom Config", "shroomconf")
  9.    
  10.     shroomconfig:addParam("smartshroom", "Smart Shroom", SCRIPT_PARAM_ONKEYDOWN, false, 99)
  11.         shroomconfig:permaShow("smartshroom")
  12.     shroomconfig:addParam("highEnabled", "High Priority", SCRIPT_PARAM_ONKEYTOGGLE, true, 101)
  13.             shroomconfig:permaShow("highEnabled")
  14.     shroomconfig:addParam("medEnabled", "Medium Priority", SCRIPT_PARAM_ONKEYTOGGLE, true, 102)
  15.             shroomconfig:permaShow("medEnabled")
  16.     shroomconfig:addParam("blueEnabled", "Blue Team Areas", SCRIPT_PARAM_ONKEYTOGGLE, true, 103)
  17.             shroomconfig:permaShow("blueEnabled")
  18.     shroomconfig:addParam("purpEnabled", "Purple Team Areas", SCRIPT_PARAM_ONKEYTOGGLE, true, 104)
  19.             shroomconfig:permaShow("purpEnabled")
  20.  
  21.    
  22.     shroomSpots = {
  23.     -- High priority for both sides
  24.     HighPriority =  {
  25.                         Locations = {
  26.                                         { x = 3316.20,  y = -74.06, z = 9334.85},
  27.                                         { x = 4288.76,  y = -71.71, z = 9902.76},
  28.                                         { x = 3981.86,  y = 39.54,  z = 11603.55},
  29.                                         { x = 6435.51,  y = 47.51,  z = 9076.02},
  30.                                         { x = 9577.91,  y = 45.97,  z = 6634.53},
  31.                                         { x = 7635.25,  y = 45.09,  z = 5126.81},
  32.                                         { x = 10731.51, y = -30.77, z = 5287.01},
  33.                                         { x = 9662.24,  y = -70.79, z = 4536.15},
  34.                                         { x = 10080.45, y = 44.48,  z = 2829.56}  
  35.                                     },
  36.                         Colour = red,
  37.                         Enabled = "highEnabled",
  38.                         Auto = autoShroomHigh
  39.                     },
  40. -- Medium priority for both sides
  41.     MediumPriority ={
  42.                         Locations = {
  43.                                         { x = 3283.18,  y = -69.64, z = 10975.15},
  44.                                         { x = 2595.85,  y = -74.00, z = 11044.66},
  45.                                         { x = 2524.10,  y = 23.36,  z = 11912.28},
  46.                                         { x = 4347.64,  y = 43.34,  z = 7796.28},
  47.                                         { x = 6093.20,  y = -67.90, z = 8067.45},
  48.                                         { x = 7960.99,  y = -73.41, z = 6233.09},
  49.                                         { x = 10652.57, y = -58.96, z = 3507.64},
  50.                                         { x = 11460.14, y = -63.94, z = 3544.83},
  51.                                         { x = 11401.81, y = -11.72, z = 2626.61}  
  52.                                     },
  53.                         Colour = yellow,
  54.                         Enabled = "medEnabled"
  55.                     },
  56. -- Low priority/situational for both sides
  57.     LowPriority =   {
  58.                         Locations = {
  59.                                         { x = 1346.10,  y = 26.56,  z = 11064.81},
  60.                                         { x = 705.87,   y = 26.93,  z = 11359.88},
  61.                                         { x = 762.80,   y = 26.15,  z = 12210.61},
  62.                                         { x = 1355.53,  y = 24.13,  z = 12936.99},
  63.                                         { x = 1926.92,  y = 25.14,  z = 11567.44},
  64.                                         { x = 1752.22,  y = 24.02,  z = 13176.95},
  65.                                         { x = 2512.96,  y = 21.74,  z = 13524.44},
  66.                                         { x = 3577.42,  y = 25.27,  z = 12429.88},
  67.                                         { x = 5246.01,  y = 30.91,  z = 12508.33},
  68.                                         { x = 5549.60,  y = 42.94,  z = 10917.27},
  69.                                         { x = 6552.56,  y = 47.09,  z = 9688.99},
  70.                                         { x = 5806.41,  y = 46.01,  z = 9918.99},
  71.                                         { x = 7112.27,  y = 46.86,  z = 8443.55},
  72.                                         { x = 4896.10,  y = -72.08, z = 8964.81},
  73.                                         { x = 3096.10,  y = 45.41,  z = 8164.81},
  74.                                         { x = 2390.53,  y = 46.57,  z = 5232.34},
  75.                                         { x = 4358.81,  y = 45.83,  z = 5834.64},
  76.                                         { x = 5746.10,  y = 42.52,  z = 4864.81},
  77.                                         { x = 6307.66,  y = 46.07,  z = 7165.92},
  78.                                         { x = 5443.82,  y = 45.64,  z = 7110.85},
  79.                                         { x = 5153.75,  y = 45.41,  z = 3358.76},
  80.                                         { x = 6876.07,  y = 46.44,  z = 5897.48},
  81.                                         { x = 6881.30,  y = 46.08,  z = 6555.85},
  82.                                         { x = 8555.10,  y = 46.36,  z = 7267.04},
  83.                                         { x = 7946.10,  y = 44.19,  z = 7214.81},
  84.                                         { x = 9088.99,  y = -73.12, z = 5441.11},
  85.                                         { x = 7687.96,  y = 46.12,  z = 5203.08},
  86.                                         { x = 8559.97,  y = 47.97,  z = 3477.87},
  87.                                         { x = 8841.04,  y = 52.28,  z = 1944.09},
  88.                                         { x = 10582.93, y = 43.25,  z = 1707.35},
  89.                                         { x = 11046.10, y = 43.26,  z = 964.81},
  90.                                         { x = 11682.20, y = 43.40,  z = 1061.03},
  91.                                         { x = 12420.51, y = 46.87,  z = 1532.34},
  92.                                         { x = 12819.32, y = 45.74,  z = 1931.32},
  93.                                         { x = 13275.52, y = 45.38,  z = 2873.69},
  94.                                         { x = 11978.71, y = 45.49,  z = 2914.69},
  95.                                         { x = 13379.36, y = 45.37,  z = 3499.62},
  96.                                         { x = 12818.08, y = 45.38,  z = 3625.44},
  97.                                         { x = 10985.17, y = 45.69,  z = 6305.81},
  98.                                         { x = 11580.80, y = 41.26,  z = 9214.09},
  99.                                         { x = 9574.88,  y = 44.40,  z = 8679.65},
  100.                                         { x = 8359.96,  y = 44.37,  z = 9595.58},
  101.                                         { x = 8927.12,  y = 48.17,  z = 11175.70}  
  102.                                     },
  103.                         Colour = green,
  104.                         Enabled = "lowEnabled"
  105.                     },
  106. -- blue team areas
  107.     BlueOnly = {
  108.                         Locations = {
  109.                                         { x = 2112.87, y = 43.81, z = 7047.48},
  110.                                         { x = 2646.25, y = 45.84, z = 7545.78},
  111.                                         { x = 1926.95, y = 44.83, z = 9515.71},
  112.                                         { x = 4239.97, y = 44.40, z = 7132.02},
  113.                                         { x = 6149.34, y = 42.51, z = 4481.88},
  114.                                         { x = 6630.28, y = 46.56, z = 2836.88},
  115.                                         { x = 7687.62, y = 45.54, z = 3210.98},
  116.                                         { x = 7050.22, y = 46.46, z = 2351.33}  
  117.                                     },
  118.                         Colour = blue,
  119.                         Enabled = "blueEnabled"
  120.                 },
  121. -- purple team areas
  122.     PurpleOnly =    {
  123.                     Locations = {
  124.                                     { x = 7466.52, y = 41.54, z = 11720.22},
  125.                                     { x = 6945.85, y = 43.53, z = 11901.30},
  126.                                     { x = 6636.28, y = 45.03, z = 11079.65},
  127.                                     { x = 7878.53, y = 43.83, z = 10042.65},
  128.                                     { x = 9701.57, y = 45.72, z = 7298.22},
  129.                                     { x = 11358.86, y = 45.71, z = 6872.10},
  130.                                     { x = 11946.10, y = 45.80, z = 7414.81},
  131.                                     { x = 12169.52, y = 44.03, z = 4858.85}  
  132.                                 },
  133.                     Colour = purple,
  134.                     Enabled = "purpEnabled"
  135.                 }
  136. }
  137.  
  138. function grabShroomConfig(foo)
  139. if(foo == "purpEnabled") then
  140. return shroomconfig.purpEnabled
  141. end
  142. if(foo == "blueEnabled") then
  143. return shroomconfig.blueEnabled
  144. end
  145. if(foo == "lowEnabled") then
  146. return shroomconfig.lowEnabled
  147. end
  148. if(foo == "medEnabled") then
  149. return shroomconfig.medEnabled
  150. end
  151. if(foo == "highEnabled") then
  152. return shroomconfig.highEnabled
  153. end
  154. end
  155.  
  156. function sample_CallBackShroom()
  157.     CLOCK=os.clock()
  158.     if shroomconfig.smartshroom then
  159.         for i,group  in pairs(shroomSpots) do
  160.         for x,shroomSpot in pairs(group.Locations) do
  161.         if(grabShroomConfig(group.Enabled)) then
  162.             shroomColor = group.Colour
  163.                         DrawCircle(shroomSpot.x, shroomSpot.y, shroomSpot.z, 28, shroomColor)
  164.                         DrawCircle(shroomSpot.x, shroomSpot.y, shroomSpot.z, 29, shroomColor)
  165.                         DrawCircle(shroomSpot.x, shroomSpot.y, shroomSpot.z, 30, shroomColor)
  166.                         DrawCircle(shroomSpot.x, shroomSpot.y, shroomSpot.z, 31, shroomColor)
  167.                         DrawCircle(shroomSpot.x, shroomSpot.y, shroomSpot.z, 32, shroomColor)
  168.                         DrawCircle(shroomSpot.x, shroomSpot.y, shroomSpot.z, 200, shroomColor)
  169.                         end
  170.                         end
  171.         end
  172.     end
  173.     if shroomconfig.smartshroom then
  174.         for i,group  in pairs(shroomSpots) do
  175.         for x,shroomSpot in pairs(group.Locations) do
  176.                 if(grabShroomConfig(group.Enabled)) then
  177.         if ((GetDistance(shroomSpot, myHero) <= 200) and (CanUseSpell("R"))) then
  178.             CastSpellXYZ("R",shroomSpot.x,shroomSpot.y,shroomSpot.z)
  179.         end
  180.         end
  181.         end
  182.         end
  183.     end
  184.  
  185. end
  186. SetTimerCallback("sample_CallBackShroom")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement