Advertisement
H3stia

Jungle.lua

Feb 22nd, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.61 KB | None | 0 0
  1. --[[
  2.         Script: minimapTimers v0.1
  3.         Author: SurfaceS
  4.        
  5.         In replacement of my Jungle Display v0.2
  6.        
  7.         UPDATES :
  8.         v0.1                    initial release
  9. ]]
  10. do
  11.     --[[      GLOBAL      ]]
  12.     monsters = {
  13.         summonerRift = {
  14.             {   -- baron
  15.                 name = "baron",
  16.                 spawn = 900,
  17.                 respawn = 420,
  18.                 advise = true,
  19.                 camps = {
  20.                     {
  21.                         pos = { x = 4600, y = 60, z = 10250 },
  22.                         name = "monsterCamp_12",
  23.                         creeps = { { { name = "Worm12.1.1" }, }, },
  24.                         team = TEAM_NEUTRAL,
  25.                     },
  26.                 },
  27.             },
  28.             {   -- dragon
  29.                 name = "dragon",
  30.                 spawn = 150,
  31.                 respawn = 360,
  32.                 advise = true,
  33.                 camps = {
  34.                     {
  35.                         pos = { x = 9459, y = 60, z = 4193 },
  36.                         name = "monsterCamp_6",
  37.                         creeps = { { { name = "Dragon6.1.1" }, }, },
  38.                         team = TEAM_NEUTRAL,
  39.                     },
  40.                 },
  41.             },
  42.             {   -- blue
  43.                 name = "blue",
  44.                 spawn = 115,
  45.                 respawn = 300,
  46.                 advise = true,
  47.                 camps = {
  48.                     {
  49.                         pos = { x = 3632, y = 60, z = 7600 },
  50.                         name = "monsterCamp_1",
  51.                         creeps = { { { name = "AncientGolem1.1.1" }, { name = "YoungLizard1.1.2" }, { name = "YoungLizard1.1.3" }, }, },
  52.                         team = TEAM_BLUE,
  53.                     },
  54.                     {
  55.                         pos = { x = 10386, y = 60, z = 6811 },
  56.                         name = "monsterCamp_7",
  57.                         creeps = { { { name = "AncientGolem7.1.1" }, { name = "YoungLizard7.1.2" }, { name = "YoungLizard7.1.3" }, }, },
  58.                         team = TEAM_RED,
  59.                     },
  60.                 },
  61.             },
  62.             {   -- red
  63.                 name = "red",
  64.                 spawn = 115,
  65.                 respawn = 300,
  66.                 advise = true,
  67.                 camps = {
  68.                     {
  69.                         pos = { x = 7455, y = 60, z = 3890 },
  70.                         name = "monsterCamp_4",
  71.                         creeps = { { { name = "LizardElder4.1.1" }, { name = "YoungLizard4.1.2" }, { name = "YoungLizard4.1.3" }, }, },
  72.                         team = TEAM_BLUE,
  73.                     },
  74.                     {
  75.                         pos = { x = 6504, y = 60, z = 10584 },
  76.                         name = "monsterCamp_10",
  77.                         creeps = { { { name = "LizardElder10.1.1" }, { name = "YoungLizard10.1.2" }, { name = "YoungLizard10.1.3" }, }, },
  78.                         team = TEAM_RED,
  79.                     },
  80.                 },
  81.             },
  82.             {   -- wolves
  83.                 name = "wolves",
  84.                 spawn = 100,
  85.                 respawn = 60,
  86.                 advise = false,
  87.                 camps = {
  88.                     {
  89.                         name = "monsterCamp_2",
  90.                         creeps = { { { name = "GiantWolf2.1.3" }, { name = "wolf2.1.1" }, { name = "wolf2.1.2" }, }, },
  91.                         team = TEAM_BLUE,
  92.                     },
  93.                     {
  94.                         name = "monsterCamp_8",
  95.                         creeps = { { { name = "GiantWolf8.1.3" }, { name = "wolf8.1.1" }, { name = "wolf8.1.2" }, }, },
  96.                         team = TEAM_RED,
  97.                     },
  98.                 },
  99.             },
  100.             {   -- wraiths
  101.                 name = "wraiths",
  102.                 spawn = 100,
  103.                 respawn = 50,
  104.                 advise = false,
  105.                 camps = {
  106.                     {
  107.                         name = "monsterCamp_3",
  108.                         creeps = { { { name = "Wraith3.1.3" }, { name = "LesserWraith3.1.1" }, { name = "LesserWraith3.1.2" }, { name = "LesserWraith3.1.4" }, }, },
  109.                         team = TEAM_BLUE,
  110.                     },
  111.                     {
  112.                         name = "monsterCamp_9",
  113.                         creeps = { { { name = "Wraith9.1.3" }, { name = "LesserWraith9.1.1" }, { name = "LesserWraith9.1.2" }, { name = "LesserWraith9.1.4" }, }, },
  114.                         team = TEAM_RED,
  115.                     },
  116.                 },
  117.             },
  118.             {   -- Golems
  119.                 name = "Golems",
  120.                 spawn = 100,
  121.                 respawn = 60,
  122.                 advise = false,
  123.                 camps = {
  124.                     {
  125.                         name = "monsterCamp_5",
  126.                         creeps = { { { name = "Golem5.1.2" }, { name = "SmallGolem5.1.1" }, }, },
  127.                         team = TEAM_BLUE,
  128.                     },
  129.                     {
  130.                         name = "monsterCamp_11",
  131.                         creeps = { { { name = "Golem11.1.2" }, { name = "SmallGolem11.1.1" }, }, },
  132.                         team = TEAM_RED,
  133.                     },
  134.                 },
  135.             },
  136.         },
  137.         twistedTreeline = {
  138.             {   -- Wraith
  139.                 name = "Wraith",
  140.                 spawn = 100,
  141.                 respawn = 50,
  142.                 advise = false,
  143.                 camps = {
  144.                     {
  145.                         --pos = { x = 4414, y = 60, z = 5774 },
  146.                         name = "monsterCamp_1",
  147.                         creeps = {
  148.                             { { name = "TT_NWraith1.1.1" }, { name = "TT_NWraith21.1.2" }, { name = "TT_NWraith21.1.3" }, },
  149.                         },
  150.                         team = TEAM_BLUE,
  151.                     },
  152.                     {
  153.                         --pos = { x = 11008, y = 60, z = 5775 },
  154.                         name = "monsterCamp_4",
  155.                         creeps = {
  156.                             { { name = "TT_NWraith4.1.1" }, { name = "TT_NWraith24.1.2" }, { name = "TT_NWraith24.1.3" }, },
  157.                         },
  158.                         team = TEAM_RED,
  159.                     },
  160.                 },
  161.             },
  162.             {   -- Golems
  163.                 name = "Golems",
  164.                 respawn = 50,
  165.                 spawn = 100,
  166.                 advise = false,
  167.                 camps = {
  168.                     {
  169.                         --pos = { x = 5088, y = 60, z = 8065 },
  170.                         name = "monsterCamp_2",
  171.                         creeps = {
  172.                             { { name = "TT_NGolem2.1.1" }, { name = "TT_NGolem22.1.2" } },
  173.                         },
  174.                         team = TEAM_BLUE,
  175.                     },
  176.                     {
  177.                         --pos = { x = 10341, y = 60, z = 8084 },
  178.                         name = "monsterCamp_5",
  179.                         creeps = {
  180.                             { { name = "TT_NGolem5.1.1" }, { name = "TT_NGolem25.1.2" } },
  181.                         },
  182.                         team = TEAM_RED,
  183.                     },
  184.                 },
  185.             },
  186.             {   -- Wolves
  187.                 name = "Wolves",
  188.                 respawn = 50,
  189.                 spawn = 100,
  190.                 advise = false,
  191.                 camps = {
  192.                     {
  193.                         --pos = { x = 6148, y = 60, z = 5993 },
  194.                         name = "monsterCamp_3",
  195.                         creeps = { { { name = "TT_NWolf3.1.1" }, { name = "TT_NWolf23.1.2" }, { name = "TT_NWolf23.1.3" } }, },
  196.                         team = TEAM_BLUE,
  197.                     },
  198.                     {
  199.                         --pos = { x = 9239, y = 60, z = 6022 },
  200.                         name = "monsterCamp_6",
  201.                         creeps = { { { name = "TT_NWolf6.1.1" }, { name = "TT_NWolf26.1.2" }, { name = "TT_NWolf26.1.3" } }, },
  202.                         team = TEAM_RED,
  203.                     },
  204.                 },
  205.             },
  206.             {   -- Heal
  207.                 name = "Heal",
  208.                 spawn = 115,
  209.                 respawn = 90,
  210.                 advise = true,
  211.                 camps = {
  212.                     {
  213.                         pos = { x = 7711, y = 60, z = 6722 },
  214.                         name = "monsterCamp_7",
  215.                         creeps = { { { name = "TT_Relic7.1.1" }, }, },
  216.                         team = TEAM_NEUTRAL,
  217.                     },
  218.                 },
  219.             },
  220.             {   -- Vilemaw
  221.                 name = "Vilemaw",
  222.                 spawn = 600,
  223.                 respawn = 300,
  224.                 advise = true,
  225.                 camps = {
  226.                     {
  227.                         pos = { x = 7711, y = 60, z = 10080 },
  228.                         name = "monsterCamp_8",
  229.                         creeps = { { { name = "TT_Spiderboss8.1.1" }, }, },
  230.                         team = TEAM_NEUTRAL,
  231.                     },
  232.                 },
  233.             },
  234.         },
  235.         crystalScar = {},
  236.         provingGrounds = {
  237.             {   -- Heal
  238.                 name = "Heal",
  239.                 spawn = 190,
  240.                 respawn = 40,
  241.                 advise = false,
  242.                 camps = {
  243.                     {
  244.                         pos = { x = 8922, y = 60, z = 7868 },
  245.                         name = "monsterCamp_1",
  246.                         creeps = { { { name = "OdinShieldRelic1.1.1" }, }, },
  247.                         team = TEAM_NEUTRAL,
  248.                     },
  249.                     {
  250.                         pos = { x = 7473, y = 60, z = 6617 },
  251.                         name = "monsterCamp_2",
  252.                         creeps = { { { name = "OdinShieldRelic2.1.1" }, }, },
  253.                         team = TEAM_NEUTRAL,
  254.                     },
  255.                     {
  256.                         pos = { x = 5929, y = 60, z = 5190 },
  257.                         name = "monsterCamp_3",
  258.                         creeps = { { { name = "OdinShieldRelic3.1.1" }, }, },
  259.                         team = TEAM_NEUTRAL,
  260.                     },
  261.                     {
  262.                         pos = { x = 4751, y = 60, z = 3901 },
  263.                         name = "monsterCamp_4",
  264.                         creeps = { { { name = "OdinShieldRelic4.1.1" }, }, },
  265.                         team = TEAM_NEUTRAL,
  266.                     },
  267.                 },
  268.             },
  269.         }
  270.     }
  271.    
  272.     altars = {
  273.         summonerRift = {},
  274.         twistedTreeline = {
  275.             {
  276.                 name = "Left Altar",
  277.                 spawn = 180,
  278.                 respawn = 90,
  279.                 advise = true,
  280.                 objectName = "TT_Buffplat_L",
  281.                 locked = false,
  282.                 lockNames = {"TT_Lock_Blue_L.troy", "TT_Lock_Red_L.troy", "TT_Lock_Neutral_L.troy", },
  283.                 unlockNames = {"TT_Unlock_Blue_L.troy", "TT_Unlock_Red_L.troy", "TT_Unlock_Neutral_L.troy", },
  284.             },
  285.             {
  286.                 name = "Right Altar",
  287.                 spawn = 180,
  288.                 respawn = 90,
  289.                 advise = true,
  290.                 objectName = "TT_Buffplat_R",
  291.                 locked = false,
  292.                 lockNames = {"TT_Lock_Blue_R.troy", "TT_Lock_Red_R.troy", "TT_Lock_Neutral_R.troy", },
  293.                 unlockNames = {"TT_Unlock_Blue_R.troy", "TT_Unlock_Red_R.troy", "TT_Unlock_Neutral_R.troy", },
  294.             },
  295.         },
  296.         crystalScar = {},
  297.         provingGrounds = {},
  298.     }
  299.    
  300.     relics = {
  301.         summonerRift = {},
  302.         twistedTreeline = {},
  303.         crystalScar = {
  304.             {
  305.                 pos = { x = 5500, y = 60, z = 6500 },
  306.                 name = "Relic",
  307.                 team = TEAM_BLUE,
  308.                 spawn = 180,
  309.                 respawn = 180,
  310.                 advise = true,
  311.                 locked = false,
  312.                 precenceObject = (player.team == TEAM_BLUE and "Odin_Prism_Green.troy" or "Odin_Prism_Red.troy"),
  313.             },
  314.             {
  315.                 pos = { x = 7550, y = 60, z = 6500 },
  316.                 name = "Relic",
  317.                 team = TEAM_RED,
  318.                 spawn = 180,
  319.                 respawn = 180,
  320.                 advise = true,
  321.                 locked = false,
  322.                 precenceObject = (player.team == TEAM_RED and "Odin_Prism_Green.troy" or "Odin_Prism_Red.troy"),
  323.             },
  324.         },
  325.         provingGrounds = {},
  326.     }
  327.  
  328.     heals = {
  329.         summonerRift = {},
  330.         twistedTreeline = {},
  331.         provingGrounds = {},
  332.         crystalScar = {
  333.             {
  334.                 name = "Heal",
  335.                 objectName = "OdinShieldRelic",
  336.                 respawn = 30,
  337.                 objects = {},
  338.             },
  339.         },
  340.     }
  341.    
  342.     function addCampCreepAltar(object)
  343.         if object ~= nil and object.name ~= nil then
  344.             for i,monster in pairs(monsters[mapName]) do
  345.                 for j,camp in pairs(monster.camps) do
  346.                     if camp.name == object.name then
  347.                         camp.object = object
  348.                         return
  349.                     end
  350.                     if object.type == "obj_AI_Minion" then
  351.                         for k,creepPack in ipairs(camp.creeps) do
  352.                             for l,creep in ipairs(creepPack) do
  353.                                 if object.name == creep.name then
  354.                                     creep.object = object
  355.                                     return
  356.                                 end
  357.                             end
  358.                         end
  359.                     end
  360.                 end
  361.             end
  362.             for i,altar in pairs(altars[mapName]) do
  363.                 if altar.objectName == object.name then
  364.                     altar.object = object
  365.                     altar.minimap = GetMinimap(object)
  366.                 end
  367.                 if altar.locked then
  368.                     for j,lockName in pairs(altar.unlockNames) do
  369.                         if lockName == object.name then
  370.                             altar.locked = false
  371.                             return
  372.                         end
  373.                     end
  374.                 else
  375.                     for j,lockName in pairs(altar.lockNames) do
  376.                         if lockName == object.name then
  377.                             altar.drawColor = 0
  378.                             altar.drawText = ""
  379.                             altar.locked = true
  380.                             altar.advised = false
  381.                             altar.advisedBefore = false
  382.                             return
  383.                         end
  384.                     end
  385.                 end
  386.             end
  387.             for i,relic in pairs(relics[mapName]) do
  388.                 if relic.precenceObject == object.name then
  389.                     relic.object = object
  390.                     relic.locked = false
  391.                     return
  392.                 end
  393.             end
  394.             for i,heal in pairs(heals[mapName]) do
  395.                 if heal.objectName == object.name then
  396.                     for j,healObject in pairs(heal.objects) do
  397.                         if (GetDistance(healObject, object) < 50) then
  398.                             healObject.object = object
  399.                             healObject.found = true
  400.                             healObject.locked = false
  401.                             return
  402.                         end
  403.                     end
  404.                     local k = #heal.objects + 1
  405.                     heals[mapName][i].objects[k] = {found = true, locked = false, object = object, x = object.x, y = object.y, z = object.z, minimap = GetMinimap(object), }
  406.                     return
  407.                 end
  408.             end
  409.         end
  410.     end
  411.  
  412.     function removeCreep(object)
  413.         if object ~= nil and object.type == "obj_AI_Minion" and object.name ~= nil then
  414.             for i,monster in pairs(monsters[mapName]) do
  415.                 for j,camp in pairs(monster.camps) do
  416.                     for k,creepPack in ipairs(camp.creeps) do
  417.                         for l,creep in ipairs(creepPack) do
  418.                             if object.name == creep.name then
  419.                                 creep.object = nil
  420.                                 return
  421.                             end
  422.                         end
  423.                     end
  424.                 end
  425.             end
  426.         end
  427.     end
  428.  
  429.     function OnLoad()
  430.         mapName = GetMap().shortName
  431.         if monsters[mapName] == nil then
  432.             mapName = nil
  433.             monsters = nil
  434.             addCampCreepAltar = nil
  435.             removeCreep = nil
  436.             addAltarObject = nil
  437.             return
  438.         else
  439.             startTick = GetStart().tick
  440.             gameState = GameState()
  441.             -- CONFIG
  442.             MMTConfig = scriptConfig("Timers 0.2", "minimapTimers")
  443.             MMTConfig:addParam("pingOnRespawn", "Ping on respawn", SCRIPT_PARAM_ONOFF, false) -- ping location on respawn
  444.             MMTConfig:addParam("pingOnRespawnBefore", "Ping before respawn", SCRIPT_PARAM_ONOFF, false) -- ping location before respawn
  445.             MMTConfig:addParam("textOnRespawn", "Chat on respawn", SCRIPT_PARAM_ONOFF, true) -- print chat text on respawn
  446.             MMTConfig:addParam("textOnRespawnBefore", "Chat before respawn", SCRIPT_PARAM_ONOFF, false) -- print chat text before respawn
  447.             MMTConfig:addParam("adviceEnemyMonsters", "Advice enemy monster", SCRIPT_PARAM_ONOFF, true) -- advice enemy monster, or just our monsters
  448.             MMTConfig:addParam("adviceBefore", "Advice Time", SCRIPT_PARAM_SLICE, 20, 1, 40, 0) -- time in second to advice before monster respawn
  449.             for i,monster in pairs(monsters[mapName]) do
  450.                 monster.isSeen = false
  451.                 for j,camp in pairs(monster.camps) do
  452.                     camp.enemyTeam = (camp.team == TEAM_ENEMY)
  453.                     camp.status = 0
  454.                     camp.drawText = ""
  455.                     camp.drawColor = 0xFF00FF00
  456.                 end
  457.             end
  458.             for i = 1, objManager.maxObjects do
  459.                 local object = objManager:getObject(i)
  460.                 if object ~= nil then
  461.                     addCampCreepAltar(object)
  462.                 end
  463.             end
  464.             AddCreateObjCallback(addCampCreepAltar)
  465.             AddDeleteObjCallback(removeCreep)
  466.            
  467.             function OnTick()
  468.                 if gameState:gameIsOver() then return end
  469.                 local GameTime = (GetTickCount()-startTick) / 1000
  470.                 local monsterCount = 0
  471.                 for i,monster in pairs(monsters[mapName]) do
  472.                     for j,camp in pairs(monster.camps) do
  473.                         local campStatus = 0
  474.                         for k,creepPack in ipairs(camp.creeps) do
  475.                             for l,creep in ipairs(creepPack) do
  476.                                 if creep.object ~= nil and creep.object.valid and creep.object.dead == false then
  477.                                     if l == 1 then
  478.                                         campStatus = 1
  479.                                     elseif campStatus ~= 1 then
  480.                                         campStatus = 2
  481.                                     end
  482.                                 end
  483.                             end
  484.                         end
  485.                         --[[  Not used until camp.showOnMinimap work
  486.                         if (camp.object and camp.object.showOnMinimap == 1) then
  487.                             -- camp is here
  488.                             if campStatus == 0 then campStatus = 3 end
  489.                         elseif camp.status == 3 then                        -- empty not seen when killed
  490.                             campStatus = 5
  491.                         elseif campStatus == 0 and (camp.status == 1 or camp.status == 2) then
  492.                             campStatus = 4
  493.                             camp.deathTick = tick
  494.                         end
  495.                         ]]
  496.                         -- temp fix until camp.showOnMinimap work
  497.                         -- not so good
  498.                         if camp.object ~= nil and camp.object.valid then
  499.                             camp.minimap = GetMinimap(camp.object)
  500.                             if campStatus == 0 then
  501.                                 if (camp.status == 1 or camp.status == 2) then
  502.                                     campStatus = 4
  503.                                     camp.advisedBefore = false
  504.                                     camp.advised = false
  505.                                     camp.respawnTime = math.ceil(GameTime) + monster.respawn
  506.                                     camp.respawnText = (camp.enemyTeam and "Enemy " or "")..monster.name.." respawn at "..TimerText(camp.respawnTime)
  507.                                 elseif (camp.status == 4) then
  508.                                     campStatus = 4
  509.                                 else
  510.                                     campStatus = 3
  511.                                 end
  512.                             end
  513.                         elseif camp.pos ~= nil then
  514.                             camp.minimap = GetMinimap(camp.pos)
  515.                             if (GameTime < monster.spawn) then
  516.                                 campStatus = 4
  517.                                 camp.advisedBefore = true
  518.                                 camp.advised = true
  519.                                 camp.respawnTime = monster.spawn
  520.                                 camp.respawnText = (camp.enemyTeam and "Enemy " or "")..monster.name.." spawn at "..TimerText(camp.respawnTime)
  521.                             end
  522.                         end
  523.                         if camp.status ~= campStatus or campStatus == 4 then
  524.                             if campStatus ~= 0 then
  525.                                 if monster.isSeen == false then monster.isSeen = true end
  526.                                 camp.status = campStatus
  527.                             end
  528.                             if camp.status == 1 then                -- ready
  529.                                 camp.drawText = "ready"
  530.                                 camp.drawColor = 0xFF00FF00
  531.                             elseif camp.status == 2 then            -- ready, master creeps dead
  532.                                 camp.drawText = "stolen"
  533.                                 camp.drawColor = 0xFFFF0000
  534.                             elseif camp.status == 3 then            -- ready, not creeps shown
  535.                                 camp.drawText = "   ?"
  536.                                 camp.drawColor = 0xFF00FF00
  537.                             elseif camp.status == 4 then            -- empty from creeps kill
  538.                                 local secondLeft = math.ceil(math.max(0, camp.respawnTime - GameTime))
  539.                                 if monster.advise == true and (MMTConfig.adviceEnemyMonsters == true or camp.enemyTeam == false) then
  540.                                     if secondLeft == 0 and camp.advised == false then
  541.                                         camp.advised = true
  542.                                         if MMTConfig.textOnRespawn then PrintChat("<font color='#00FFCC'>"..(camp.enemyTeam and "Enemy " or "")..monster.name.."</font><font color='#FFAA00'> has respawned</font>") end
  543.                                         if MMTConfig.pingOnRespawn then PingSignal(PING_FALLBACK,camp.object.x,camp.object.y,camp.object.z,2) end
  544.                                     elseif secondLeft <= MMTConfig.adviceBefore and camp.advisedBefore == false then
  545.                                         camp.advisedBefore = true
  546.                                         if MMTConfig.textOnRespawnBefore then PrintChat("<font color='#00FFCC'>"..(camp.enemyTeam and "Enemy " or "")..monster.name.."</font><font color='#FFAA00'> will respawn in </font><font color='#00FFCC'>"..secondLeft.." sec</font>") end
  547.                                         if MMTConfig.pingOnRespawnBefore then PingSignal(PING_FALLBACK,camp.object.x,camp.object.y,camp.object.z,2) end
  548.                                     end
  549.                                 end
  550.                                 -- temp fix until camp.showOnMinimap work
  551.                                 if secondLeft == 0 then
  552.                                     camp.status = 0
  553.                                 end
  554.                                 camp.drawText = " "..TimerText(secondLeft)
  555.                                 camp.drawColor = 0xFFFFFF00
  556.                             elseif camp.status == 5 then            -- camp found empty (not using yet)
  557.                                 camp.drawText = "   -"
  558.                                 camp.drawColor = 0xFFFF0000
  559.                             end
  560.                         end
  561.                         -- shift click
  562.                         if IsKeyDown(16) and camp.status == 4 then
  563.                             camp.drawText = " "..(camp.respawnTime ~= nil and TimerText(camp.respawnTime) or "")
  564.                             camp.textUnder = (CursorIsUnder(camp.minimap.x - 9, camp.minimap.y - 5, 20, 8))
  565.                         else
  566.                             camp.textUnder = false
  567.                         end
  568.                     end
  569.                 end
  570.            
  571.                 -- altars
  572.                 for i,altar in pairs(altars[mapName]) do
  573.                     if altar.object and altar.object.valid then
  574.                         if altar.locked then
  575.                             local tmpTime = ((altar.object.maxMana - altar.object.mana) / 20100)
  576.                             if GameTime < altar.spawn then
  577.                                 altar.secondLeft = math.ceil(math.max(0, altar.spawn - GameTime))
  578.                             else
  579.                                 altar.secondLeft = math.ceil(math.max(0, altar.respawn - (tmpTime * altar.respawn)))
  580.                             end
  581.                             altar.unlockTime = math.ceil(GameTime + altar.secondLeft)
  582.                             altar.unlockText = altar.name.." unlock at "..TimerText(altar.unlockTime)
  583.                             altar.drawColor = 0xFFFFFF00
  584.                             if altar.advise == true then
  585.                                 if altar.secondLeft == 0 and altar.advised == false then
  586.                                     altar.advised = true
  587.                                     if MMTConfig.textOnRespawn then PrintChat("<font color='#00FFCC'>"..altar.name.."</font><font color='#FFAA00'> is unlocked</font>") end
  588.                                     if MMTConfig.pingOnRespawn then PingSignal(PING_FALLBACK,altar.object.x,altar.object.y,altar.object.z,2) end
  589.                                 elseif altar.secondLeft <= MMTConfig.adviceBefore and altar.advisedBefore == false then
  590.                                     altar.advisedBefore = true
  591.                                     if MMTConfig.textOnRespawnBefore then PrintChat("<font color='#00FFCC'>"..altar.name.."</font><font color='#FFAA00'> will unlock in </font><font color='#00FFCC'>"..altar.secondLeft.." sec</font>") end
  592.                                     if MMTConfig.pingOnRespawnBefore then PingSignal(PING_FALLBACK,altar.object.x,altar.object.y,altar.object.z,2) end
  593.                                 end
  594.                             end
  595.                             -- shift click
  596.                             if IsKeyDown(16) then
  597.                                 altar.drawText = " "..(altar.unlockTime ~= nil and TimerText(altar.unlockTime) or "")
  598.                                 altar.textUnder = (CursorIsUnder(altar.minimap.x - 9, altar.minimap.y - 5, 20, 8))
  599.                             else
  600.                                 altar.drawText = " "..(altar.secondLeft ~= nil and TimerText(altar.secondLeft) or "")
  601.                                 altar.textUnder = false
  602.                             end
  603.                         end
  604.                     end
  605.                 end
  606.            
  607.                 -- relics
  608.                 for i,relic in pairs(relics[mapName]) do
  609.                     if (not relic.locked and (not relic.object or not relic.object.valid or relic.dead)) then
  610.                         if GameTime < relic.spawn then
  611.                             relic.unlockTime = relic.spawn - GameTime
  612.                         else
  613.                             relic.unlockTime = math.ceil(GameTime + relic.respawn)
  614.                         end
  615.                         relic.advised = false
  616.                         relic.advisedBefore = false
  617.                         relic.drawText = ""
  618.                         relic.unlockText = relic.name.." respawn at "..TimerText(relic.unlockTime)                         
  619.                         relic.drawColor = 4288610048
  620.                         --FF9EFF00
  621.                         relic.minimap = GetMinimap(relic.pos)
  622.                         relic.locked = true
  623.                     end
  624.                     if relic.locked then
  625.                         relic.secondLeft = math.ceil(math.max(0, relic.unlockTime - GameTime))
  626.                         if relic.advise == true then
  627.                             if relic.secondLeft == 0 and relic.advised == false then
  628.                                 relic.advised = true
  629.                                 if MMTConfig.textOnRespawn then PrintChat("<font color='#00FFCC'>"..relic.name.."</font><font color='#FFAA00'> has respawned</font>") end
  630.                                 if MMTConfig.pingOnRespawn then PingSignal(PING_FALLBACK,relic.pos.x,relic.pos.y,relic.pos.z,2) end
  631.                             elseif relic.secondLeft <= MMTConfig.adviceBefore and relic.advisedBefore == false then
  632.                                 relic.advisedBefore = true
  633.                                 if MMTConfig.textOnRespawnBefore then PrintChat("<font color='#00FFCC'>"..relic.name.."</font><font color='#FFAA00'> will respawn in </font><font color='#00FFCC'>"..relic.secondLeft.." sec</font>") end
  634.                                 if MMTConfig.pingOnRespawnBefore then PingSignal(PING_FALLBACK,relic.pos.x,relic.pos.y,relic.pos.z,2) end
  635.                             end
  636.                         end
  637.                         -- shift click
  638.                         if IsKeyDown(16) then
  639.                             relic.drawText = " "..(relic.unlockTime ~= nil and TimerText(relic.unlockTime) or "")
  640.                             relic.textUnder = (CursorIsUnder(relic.minimap.x - 9, relic.minimap.y - 5, 20, 8))
  641.                         else
  642.                             relic.drawText = " "..(relic.secondLeft ~= nil and TimerText(relic.secondLeft) or "")
  643.                             relic.textUnder = false
  644.                         end
  645.                     end
  646.                 end
  647.            
  648.                 for i,heal in pairs(heals[mapName]) do
  649.                     for j,healObject in pairs(heal.objects) do
  650.                         if (not healObject.locked and healObject.found and (not healObject.object or not healObject.object.valid or healObject.object.dead)) then
  651.                             healObject.drawColor = 0xFF00FF04
  652.                             healObject.unlockTime = math.ceil(GameTime + heal.respawn)
  653.                             healObject.drawText = ""
  654.                             healObject.found = false
  655.                             healObject.locked = true
  656.                         end
  657.                         if healObject.locked then
  658.                             -- shift click
  659.                             local secondLeft = math.ceil(math.max(0, healObject.unlockTime - GameTime))
  660.                             if IsKeyDown(16) then
  661.                                 healObject.drawText = " "..(healObject.unlockTime ~= nil and TimerText(healObject.unlockTime) or "")
  662.                                 healObject.textUnder = (CursorIsUnder(healObject.minimap.x - 9, healObject.minimap.y - 5, 20, 8))
  663.                             else
  664.                                 healObject.drawText = " "..(secondLeft ~= nil and TimerText(secondLeft) or "")
  665.                                 healObject.textUnder = false
  666.                             end
  667.                             if secondLeft == 0 then healObject.locked = false end
  668.                         end
  669.                     end
  670.                 end
  671.             end
  672.  
  673.             --[[
  674.             function OnDraw()
  675.                 if gameState:gameIsOver() then return end
  676.                 for i,monster in pairs(monsters[mapName]) do
  677.                     if monster.isSeen == true then
  678.                         for j,camp in pairs(monster.camps) do
  679.                             if camp.status == 2 then
  680.                                 DrawText("X",16,camp.minimap.x - 4, camp.minimap.y - 5, camp.drawColor)
  681.                             elseif camp.status == 4 then
  682.                                 DrawText(camp.drawText,16,camp.minimap.x - 9, camp.minimap.y - 5, camp.drawColor)
  683.                             end
  684.                         end
  685.                     end
  686.                 end
  687.                 for i,altar in pairs(altars[mapName]) do
  688.                     if altar.locked then
  689.                         DrawText(altar.drawText,16,altar.minimap.x - 9, altar.minimap.y - 5, altar.drawColor)
  690.                     end
  691.                 end
  692.                 for i,relic in pairs(relics[mapName]) do
  693.                     if relic.locked then
  694.                         DrawText(relic.drawText,16,relic.minimap.x - 9, relic.minimap.y - 5, relic.drawColor)
  695.                     end
  696.                 end
  697.                 for i,heal in pairs(heals[mapName]) do
  698.                     for j,healObject in pairs(heal.objects) do
  699.                         if healObject.locked then
  700.                             DrawText(healObject.drawText,16,healObject.minimap.x - 9, healObject.minimap.y - 5, healObject.drawColor)
  701.                         end
  702.                     end
  703.                 end
  704.             end
  705.             ]]--
  706.  
  707.             function OnWndMsg(msg,key)
  708.                 if msg == WM_LBUTTONDOWN and IsKeyDown(16) then
  709.                     for i,monster in pairs(monsters[mapName]) do
  710.                         if monster.isSeen == true then
  711.                             if monster.iconUnder then
  712.                                 monster.advise = not monster.advise
  713.                                 break
  714.                             else
  715.                                 for j,camp in pairs(monster.camps) do
  716.                                     if camp.textUnder then
  717.                                         if camp.respawnText ~= nil then SendChat(""..camp.respawnText) end
  718.                                         break
  719.                                     end
  720.                                 end
  721.                             end
  722.                         end
  723.                     end
  724.                     for i,altar in pairs(altars[mapName]) do
  725.                         if altar.locked and altar.textUnder then
  726.                             if altar.unlockText ~= nil then SendChat(""..altar.unlockText) end
  727.                             break
  728.                         end
  729.                     end
  730.                 end
  731.             end
  732.        
  733.         end
  734.     end
  735. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement