xosski

Tibia MMO Bot

Jan 25th, 2025
7
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.27 KB | None | 0 0
  1. UI.Label("-------Aoe_Spell_Target-------"):setColor("#FFA500")
  2. addTextEdit("AoeSpell", storage.aoeSpell, function(widget, text)
  3. storage.aoeSpell = text
  4. end)
  5. local singleSpell = "exori hur"
  6. macro(100, "Safe UE TARGET", function()
  7. if not g_game.isAttacking() then
  8. return
  9. end
  10. if getMonsters(7, false) ~= 0 and getPlayers(7, false) == 0 then
  11. say(storage.aoeSpell)
  12. elseif getPlayers(7, false) ~= 0 then
  13. say(singleSpell)
  14. end
  15. end)
  16.  
  17.  
  18. macro(100, "Spam UE TARGET", function()
  19. if not g_game.isAttacking() then
  20. return
  21. end
  22. if getMonsters(7, false) ~= 0 then
  23. say(storage.aoeSpell)
  24. end
  25. end)
  26.  
  27. UI.Separator()
  28. UI.Label("-------Aoe_Spell_Spam-------"):setColor("#FFA500")
  29. addTextEdit("AoeSpellSpam", storage.AoeSpellSpam, function(widget, text)
  30. storage.AoeSpellSpam = text
  31. end)
  32. -- UE BEZ TARGET
  33. macro(100, "Spam UE - NO TARGET", function()
  34. if getMonsters(4, false) ~= 0 then
  35. say(storage.AoeSpellSpam)
  36. end
  37. end)
  38.  
  39. UI.Separator()
  40. UI.Separator()
  41. UI.Label("-------------BASIC-------------"):setColor("#FFA500")
  42.  
  43. UI.Label("----------MP %----------"):setColor("#00FF00")
  44. addTextEdit("manaPercent", storage.manaPercent, function(widget, text)
  45. storage.manaPercent = text
  46. end)
  47. macro(100, "Manas", function()
  48. local level = g_game.getLocalPlayer():getLevel()
  49. local manaPotion = 268
  50. if (manapercent() <= tonumber(storage.manaPercent)) then
  51. usewith(manaPotion, player)
  52. end
  53. end)
  54.  
  55. UI.Separator()
  56.  
  57. macro(100, "Healing", function()
  58. local level = g_game.getLocalPlayer():getLevel()
  59. local healingSpellLowLevel = "exura"
  60. local healingSpellHighLevel = "exana mort"
  61. local strongHealthPotion = 236
  62. local greatHealthPotion = 239
  63. local ultimateHealthPotion = 7643
  64. local hpPercentSpell = 96
  65. local hpPercentPotion = 67
  66. if (hppercent() <= hpPercentSpell and level > 8 and level < 30) then
  67. say(healingSpellLowLevel)
  68. elseif (hppercent() <= hpPercentSpell and level > 35) then
  69. say(healingSpellHighLevel)
  70. end
  71. if (hppercent() <= hpPercentPotion and level >= 50 and level < 200 ) then
  72. usewith(strongHealthPotion, player)
  73. elseif (hppercent() <= hpPercentPotion and level >= 200 and level < 400 ) then
  74. usewith(greatHealthPotion, player)
  75. elseif (hppercent() <= hpPercentPotion and level >= 400 ) then
  76. usewith(ultimateHealthPotion, player)
  77. end
  78. end)
  79.  
  80. macro(100, "Haste", function()
  81. local level = g_game.getLocalPlayer():getLevel()
  82. local hasteLowLevel = "utani hur"
  83. local hasteHighLevel = "mega hur"
  84. if (not hasHaste() and level > 20 and level < 200) then
  85. say(hasteLowLevel)
  86. elseif (not hasHaste() and level > 200) then
  87. say(hasteHighLevel)
  88. end
  89. end)
  90.  
  91. -- TASK MAX, TASK LEVEL
  92. local wait = false
  93. macro(100, "Task Commands", function()
  94. if wait then return end
  95.  
  96. say("!task maxpoints")
  97.  
  98. schedule(10000, function()
  99. say("!task level")
  100. end)
  101.  
  102. schedule(20000, function()
  103. wait = false
  104. end)
  105. wait = true
  106. end)
  107.  
  108. local targetID = nil
  109.  
  110. -- escape when attacking will reset hold target
  111. onKeyPress(function(keys)
  112. if keys == "Escape" and targetID then
  113. targetID = nil
  114. end
  115. end)
  116.  
  117. macro(100, "ReAttack", function()
  118. -- if attacking then save it as target, but check pos z in case of marking by mistake on other floor
  119. if target() and target():getPosition().z == posz() and not target():isNpc() then
  120. targetID = target():getId()
  121. elseif not target() then
  122. -- there is no saved data, do nothing
  123. if not targetID then return end
  124.  
  125. -- look for target
  126. for i, spec in ipairs(getSpectators()) do
  127. local sameFloor = spec:getPosition().z == posz()
  128. local oldTarget = spec:getId() == targetID
  129.  
  130. if sameFloor and oldTarget then
  131. attack(spec)
  132. end
  133. end
  134. end
  135. end)
  136.  
  137. macro(100, "ExoriHurSpam", function()
  138. if not g_game.isAttacking() then
  139. return
  140. end
  141. say("exori hur")
  142. end)
  143.  
  144. -- Wymiana platinum na crystal oraz golden ingot
  145. local moneyIds = { 3035, 3043 } -- platinium coin, crystal coin
  146. macro(500, "Wymiana monet", function()
  147. local containers = g_game.getContainers()
  148. for index, container in pairs(containers) do
  149. if not container.lootContainer then
  150. for i, item in ipairs(container:getItems()) do
  151. if item:getCount() == 100 then
  152. for m, moneyId in ipairs(moneyIds) do
  153. if item:getId() == moneyId then
  154. return g_game.use(item)
  155. end
  156. end
  157. end
  158. end
  159. end
  160. end
  161. end)
  162.  
  163.  
  164.  
  165. UI.Separator()
  166. UI.Separator()
  167. UI.Label("---------------EXP--------------"):setColor("#FFA500")
  168. -- POT FRIENDS
  169. macro(100, "Mana on Friends", function()
  170. local friends = string.split(storage.friendNameh, "\n")
  171. for i, spec in pairs(getSpectators()) do
  172. if table.contains(friends, spec:getName(), true) then
  173. if (manapercent() >= 30) and getDistanceBetween(pos(), spec:getPosition()) < 2 and spec:getManaPercent() < 60 then
  174. useWith(tonumber(storage.manauh), spec)
  175. delay(tonumber(storage.delaymana))
  176. end
  177. end
  178. end
  179. end)
  180.  
  181. UI.Button("Friend List Mana Potion", function(newText)
  182. UI.MultilineEditorWindow(storage.friendNameh or "", {title="Friend List ManaUH", description="Friend list UH\nExample:\nPlayer1\nPlayer2\nPlayer3"}, function(text)
  183. storage.friendNameh = text
  184. end)
  185. end)
  186.  
  187. UI.Label("Potion ID")
  188.  
  189. UI.TextEdit(storage.manauh or "238", function(widget, text)
  190. storage.manauh = text
  191. end)
  192.  
  193. UI.Label("Potion Use Delay")
  194.  
  195. UI.TextEdit(storage.delaymana or "1000", function(widget, text)
  196. storage.delaymana = text
  197. end)
  198.  
  199. onTalk(function(name, level, mode, text, channelId, pos)
  200. if name == player:getName() then return end
  201. if mode ~= 1 then return end
  202.  
  203. local friend = getPlayerByName(name)
  204. if string.find(text, "pt") and friend then
  205. g_game.partyInvite(friend:getId())
  206. end
  207. end)
  208.  
  209. UI.Separator()
  210.  
  211. macro(4000, "Exeta Res", function()
  212. say("exeta res")
  213. end)
  214. macro(5000, "Odnowa VestiaBoots", function()
  215. if getFeet():getId() == 9020 then
  216. usewith(676, getFeet())
  217. end
  218. end)
  219.  
  220. UI.Separator()
  221.  
  222. macro(100, "EnableSharedExp", function()
  223. if player:getShield() == 4 then
  224. g_game.partyShareExperience(not player:isPartySharedExperienceActive())
  225. end
  226. end)
  227.  
  228. UI.Separator()
  229. UI.Label("------NICK GRACZA:------"):setColor("#00FF00")
  230. addTextEdit("friendName", storage.friendName, function(widget, text)
  231. storage.friendName = text
  232. end)
  233. onScreen= macro(100,"Stop WP - Lost friend", function()
  234. local spectators = getSpectators(pos(), false)
  235. for i, spec in pairs(spectators) do
  236. if (spec:getName() == storage.friendName) then
  237. if getDistanceBetween(pos(), spec:getPosition()) < 5 then
  238. return CaveBot.setOn()
  239. end
  240. end
  241. end
  242. return CaveBot.setOff()
  243. end)
  244. UI.Separator()
  245. UI.Label("------MIN::------"):setColor("#00FF00")
  246. addTextEdit("minMonsters", storage.minMonsters, function(widget, text)
  247. storage.minMonsters = text
  248. end)
  249. UI.Label("------MAX::------"):setColor("#00FF00")
  250. addTextEdit("maxMonsters", storage.maxMonsters, function(widget, text)
  251. storage.maxMonsters = text
  252. end)
  253. macro(10, "Lure Monsters", function()
  254. if getMonsters(6) >= tonumber(storage.maxMonsters) then
  255. TargetBot.setOn()
  256. else
  257. if getMonsters(4) <= tonumber(storage.minMonsters) then
  258. TargetBot.setOff()
  259. end
  260. end
  261. end)
  262.  
  263. macro(10, "OFF TARGET <= 1 MOB", function()
  264. if getMonsters(6) <= 1 then
  265. TargetBot.setOff()
  266. end
  267. end)
  268.  
  269. UI.Separator()
  270. UI.Separator()
  271. UI.Label("------------INNE------------"):setColor("#FFA500")
  272.  
  273.  
  274.  
  275. -- HOTKEY TOGGLE CAVEBOT
  276. singlehotkey("delete", "SwitchCaveBot", function()
  277. if CaveBot.isOff() or TargetBot.isOff() then
  278. CaveBot.setOn()
  279. TargetBot.setOn()
  280. elseif CaveBot.isOn() or TargetBot.isOn() then
  281. CaveBot.setOff()
  282. TargetBot.setOff()
  283. end
  284. end)
  285.  
  286. local hardcodedItems = {3031, 3035}
  287.  
  288.  
  289.  
  290. macro(100, "AntyPush" ,function()
  291.  
  292. local tile = g_map.getTile(player:getPosition())
  293. if not tile then return end
  294.  
  295. local topItem = tile:getTopUseThing()
  296. if topItem and topItem:isStackable() then
  297. topItem = topItem:getId()
  298. else
  299. topItem = 0
  300. end
  301.  
  302. local candidates = {}
  303. for _, item in pairs(hardcodedItems) do
  304. if item >= 100 and item ~= topItem and findItem(item) then
  305. table.insert(candidates, item)
  306. end
  307. end
  308.  
  309. if #candidates == 0 then return end
  310.  
  311. local lastItem = storage.lastAntiPushItem or 1
  312. if lastItem > #candidates then
  313. lastItem = 1
  314. end
  315.  
  316. local item = findItem(candidates[lastItem])
  317. g_game.move(item, player:getPosition(), 2)
  318. storage.lastAntiPushItem = lastItem + 1
  319. end)
  320.  
  321. -- TRON EVENT
  322. local fragtext = "Wejscie na Tron Event zostalo otwarte! Czekamy na 6 graczy. Teleport do eventu jest na 1 pietrze depo!"
  323. local tronEvent = macro(100, "JoinTronEvent", function() end)
  324.  
  325. onTextMessage(function(mode, text)
  326. if tronEvent.isOff() then return end
  327.  
  328. if text:lower():find(fragtext) then
  329. walk(0)
  330. end
  331. end)
  332.  
  333. macro(10000, "ExpTokeny", function()
  334. useWith(11455, player)
  335. end)
  336.  
  337. macro(100, "Spam MR - Aczek", function()
  338. local level = g_game.getLocalPlayer():getLevel()
  339. local manarune = 3157
  340. if (manapercent() <= 100) then
  341. usewith (manarune, player)
  342. end
  343. end)
  344. UI.Separator()
  345. UI.Separator()
  346.  
  347. onTextMessage(function(mode,text)
  348. if mode~=20 then return end
  349. local itemName = {"Magician's Legs", "magician"}
  350. if string.find(text, "Loot of") then
  351. for _, lootName in pairs(itemName) do
  352. if string.find(text, lootName) then
  353. playAlarm()
  354. end
  355. end
  356. end
  357. end)
  358.  
  359.  
  360. followName = "Name"
  361. if not storage[followName] then storage[followName] = { player = 'name'} end
  362. local toFollowPos = {}
  363.  
  364. UI.Label("Auto Follow")
  365.  
  366. followTE = UI.TextEdit(storage[followName].player or "name", function(widget, newText)
  367. storage[followName].player = newText
  368. end)
  369.  
  370. local followChange = macro(200, "Follow Change", function() end)
  371.  
  372. local followMacro = macro(20, "Follow", function()
  373. local target = getCreatureByName(storage[followName].player)
  374. if target then
  375. local tpos = target:getPosition()
  376. toFollowPos[tpos.z] = tpos
  377. end
  378.  
  379. if player:isWalking() then
  380. return
  381. end
  382.  
  383. local p = toFollowPos[posz()]
  384. if not p then
  385. return
  386. end
  387.  
  388. if autoWalk(p, 20, { ignoreNonPathable = true, precision = 1 }) then
  389. delay(10)
  390. end
  391. end)
  392.  
  393. UI.Separator()
  394. UI.Separator()
  395.  
  396. onPlayerPositionChange(function(newPos, oldPos)
  397. if followChange:isOff() then return end
  398. if g_game.isFollowing() then
  399. local tfollow = g_game.getFollowingCreature()
  400. if tfollow and tfollow:getName() ~= storage[followName].player then
  401. followTE:setText(tfollow:getName())
  402. storage[followName].player = tfollow:getName()
  403. end
  404. end
  405. end)
  406.  
  407. onCreaturePositionChange(function(creature, newPos, oldPos)
  408. if creature:getName() == storage[followName].player and newPos then
  409. toFollowPos[newPos.z] = newPos
  410. end
  411. end)
  412.  
  413. --------------------------------------------------------------------------
  414. local panelName = "ssa"
  415. if not storage[panelName] then
  416. storage[panelName] = {
  417. checkBox1 = false,
  418. checkBox2 = false
  419. }
  420. end
  421.  
  422. local ui = setupUI([[
  423. TestPanel < UIWidget
  424. image-source: /images/ui/window_headless
  425. image-border: 5
  426. padding: 3
  427. height: 45
  428.  
  429. CheckBox
  430. id: check1
  431. anchors.top: parent.top
  432. anchors.left: parent.left
  433. margin-left: 5
  434. margin-top: 5
  435.  
  436. UIWidget
  437. anchors.top: parent.top
  438. anchors.left: check1.right
  439. !text: tr('ssa: 0-Spam, 1-LowMana')
  440. margin-left: 5
  441. margin-top: 4
  442.  
  443. CheckBox
  444. id: check2
  445. anchors.top: prev.bottom
  446. anchors.left: parent.left
  447. margin-left: 5
  448. margin-top: 5
  449. margin-bottom: 5
  450.  
  451. UIWidget
  452. anchors.top: parent.top
  453. anchors.left: check2.right
  454. !text: tr('mr: 0-Spam, 1-LowMana')
  455. margin-left: 5
  456. margin-top: 20
  457.  
  458.  
  459. Panel
  460. id: test
  461. height: 35
  462. padding: 3
  463. ]])
  464.  
  465. local label = UI.createWidget("TestPanel", ui.test)
  466.  
  467. -----------------------------------------------------------------
  468.  
  469. label.check1:setChecked(storage[panelName].checkBox1)
  470. label.check2:setChecked(storage[panelName].checkBox2)
  471.  
  472. label.check1.onClick = function(widget)
  473. storage[panelName].checkBox1 = not storage[panelName].checkBox1
  474. widget:setChecked(storage[panelName].checkBox1)
  475. end
  476.  
  477. label.check2.onClick = function(widget)
  478. storage[panelName].checkBox2 = not storage[panelName].checkBox2
  479. widget:setChecked(storage[panelName].checkBox2)
  480. end
  481.  
  482. ----------------------------------------------------------------
  483.  
  484. macro(100, "SSA", function()
  485. if manapercent() <= 30 and label.check1:isChecked() then
  486. moveToSlot(3081, SlotNeck)
  487. return true
  488. elseif manapercent() > 50 and label.check1:isChecked() then
  489. moveToSlot(3013, SlotNeck)
  490. elseif not label.check1:isChecked() then
  491. moveToSlot(3081, SlotNeck)
  492. return true
  493. end
  494. end)
  495. macro(100, "MRing", function()
  496. if manapercent() <= 25 and label.check2:isChecked() then
  497. moveToSlot(3048, SlotFinger)
  498. return true
  499. elseif manapercent() > 50 and label.check2:isChecked() then
  500. moveToSlot(6539, SlotFinger)
  501. elseif not label.check2:isChecked() then
  502. moveToSlot(3048, SlotFinger)
  503. return true
  504. end
  505. end)
  506.  
  507. -- Lista potworów do sprawdzania
  508. local targetMonsters = {"strong cannibal", "epic cannibal", "godly cannibal"}
  509.  
  510. -- Id przedmiotów
  511. local ringBattle = 3048
  512. local ringDefault = 6539
  513. local amuletSsa = 3081
  514. local amuletJohns = 9802
  515.  
  516. -- Nazwy plecaków, gdzie mają trafić przedmioty
  517. local amuletBpName = "backpack" -- Plecak na amulet
  518. local ringBpName = "backpack" -- Plecak na ring
  519.  
  520. -- Funkcja do sprawdzania, czy na ekranie jest potwór z listy
  521. local function isMonsterNearby(monsterList)
  522. for _, creature in ipairs(getSpectators() or {}) do
  523. if creature and creature:isMonster() then
  524. if table.contains(monsterList, creature:getName():lower()) then
  525. return true
  526. end
  527. end
  528. end
  529. return false
  530. end
  531.  
  532. -- Funkcja do liczenia liczby potworów w odległości <= 2 kratek od gracza
  533. local function countMonstersNearbyWithinDistance(maxDistance)
  534. local count = 0
  535. for _, creature in ipairs(getSpectators() or {}) do
  536. if creature and creature:isMonster() and getDistanceBetween(pos(), creature:getPosition()) <= maxDistance then
  537. count = count + 1
  538. end
  539. end
  540. return count
  541. end
  542.  
  543. local function equipRing(id)
  544. if not getFinger() or getFinger():getId() ~= id then
  545. moveToSlot(id, SlotFinger)
  546. end
  547. end
  548.  
  549. local function equipSsa()
  550. local currentAmulet = getNeck()
  551. if not currentAmulet or currentAmulet:getId() ~= amuletSsa then
  552. local amulet = findItem(amuletSsa)
  553. if amulet then
  554. moveToSlot(amulet, SlotNeck)
  555. end
  556. end
  557. end
  558.  
  559. local function equipJohns()
  560. local currentAmulet = getNeck()
  561. if not currentAmulet or currentAmulet:getId() ~= amuletJohns then
  562. local amulet = findItem(amuletJohns)
  563. if amulet then
  564. moveToSlot(amulet, SlotNeck)
  565. end
  566. end
  567. end
  568.  
  569. -- Makro do automatycznego zakładania i zdejmowania przedmiotów
  570. macro(100, "Auto Equip Amulet & Ring", function()
  571. local monsterNearby = isMonsterNearby(targetMonsters)
  572. local monsterCount = countMonstersNearbyWithinDistance(2) -- Sprawdzamy tylko w odległości <= 2 kratek
  573.  
  574. if monsterNearby or monsterCount > 6 then
  575. equipSsa()
  576. equipRing(ringBattle)
  577. else
  578. equipJohns()
  579. equipRing(ringDefault)
  580. end
  581. end)
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590. --
  591. local ui = setupUI([[
  592. Panel
  593. width: 300
  594. height:300
  595.  
  596. Label
  597. id: targetLabel
  598. x: 205
  599. y: 110
  600. font: verdana-11px-rounded
  601.  
  602. Label
  603. id: caveLabel
  604. x: 205
  605. y: 125
  606. font: verdana-11px-rounded
  607. ]], g_ui.getRootWidget())
  608.  
  609. local function getTargetBotStatus()
  610. return TargetBot.isOn() and "ON" or TargetBot.isOff() and "OFF"
  611. end
  612.  
  613. local function getCaveBotStatus()
  614. return CaveBot.isOn() and "ON" or CaveBot.isOff() and "OFF"
  615. end
  616.  
  617. local function getColorFromStatus(status)
  618. return status == "ON" and "green" or status == "OFF" and "red"
  619. end
  620.  
  621. macro(100, function()
  622. local targetStatus = getTargetBotStatus()
  623. local caveStatus = getCaveBotStatus()
  624. local targetColor = getColorFromStatus(targetStatus)
  625. local caveColor = getColorFromStatus(caveStatus)
  626.  
  627. ui.targetLabel:setColoredText({"Target: ", "white", targetStatus, targetColor})
  628. ui.caveLabel:setColoredText({"Cavebot: ", "white", caveStatus, caveColor})
  629. end)
  630.  
  631.  
  632.  
  633. setDefaultTab("Main")
  634. local mkPanelname = "monsterKill"
  635. if not storage[mkPanelname] then storage[mkPanelname] = { min = false, lastKills = 0 } end
  636.  
  637. local monsterKill = setupUI([[
  638. Panel
  639. margin-top:2
  640. height: 135
  641. Button
  642. id: resetList
  643. anchors.left: parent.left
  644. anchors.top: parent.top
  645. width: 20
  646. height: 17
  647. margin-top: 2
  648. margin-left: 3
  649. text: !
  650. color: red
  651. tooltip: Reset Data
  652. Button
  653. id: showList
  654. anchors.right: parent.right
  655. anchors.top: parent.top
  656. width: 20
  657. height: 17
  658. margin-top: 2
  659. margin-right: 3
  660. text: -
  661. color: red
  662.  
  663. Label
  664. id: title
  665. text: Monster Kills
  666. text-align: center
  667. anchors.top: parent.top
  668. anchors.left: parent.left
  669. anchors.right: parent.right
  670. height: 20
  671.  
  672. Label
  673. id: lastKillLabel
  674. text: Last 10 min kills: 0
  675. text-align: center
  676. anchors.top: title.bottom
  677. anchors.left: parent.left
  678. anchors.right: parent.right
  679. height: 15
  680. margin-top: 3
  681. color: yellow
  682.  
  683. ScrollablePanel
  684. id: content
  685. image-source: /images/ui/menubox
  686. image-border: 4
  687. image-border-top: 17
  688. anchors.top: lastKillLabel.bottom
  689. anchors.left: parent.left
  690. anchors.right: parent.right
  691. margin-top: 5
  692. height: 88
  693. padding: 3
  694. vertical-scrollbar: mkScroll
  695. layout:
  696. type: verticalBox
  697.  
  698. BotSmallScrollBar
  699. id: mkScroll
  700. anchors.top: content.top
  701. anchors.bottom: content.bottom
  702. anchors.right: content.right
  703. margin-top: 2
  704. margin-bottom: 5
  705. margin-right: 5
  706. ]], parent)
  707. monsterKill:setId(mkPanelname)
  708.  
  709. killList = {}
  710. local lbls = {}
  711.  
  712. local function toggleWin(load)
  713. if load then
  714. monsterKill:setHeight(40)
  715. monsterKill.showList:setText("+")
  716. monsterKill.showList:setColor("green")
  717. else
  718. monsterKill:setHeight(135)
  719. monsterKill.showList:setText("-")
  720. monsterKill.showList:setColor("red")
  721. end
  722. end
  723.  
  724. function refreshMK()
  725. if #lbls > 0 and (#killList == #lbls) then
  726. local i = 1
  727. for k, v in pairs(killList) do
  728. lbls[i].name:setText(k .. ':')
  729. lbls[i].count:setText("x"..v)
  730. i = i + 1
  731. end
  732. else
  733. for _, child in pairs(monsterKill.content:getChildren()) do
  734. child:destroy()
  735. end
  736. for k, v in pairs(killList) do
  737. lbls[k] = g_ui.loadUIFromString([[
  738. Panel
  739. height: 16
  740. margin-left: 2
  741.  
  742. Label
  743. id: name
  744. text:
  745. anchors.top: parent.top
  746. anchors.left: parent.left
  747. margin-top: 2
  748. text-auto-resize: true
  749. font: verdana-11px-bold
  750.  
  751. Label
  752. id: count
  753. text:
  754. anchors.top: name.top
  755. anchors.right: parent.right
  756. margin-right: 15
  757. text-auto-resize: true
  758. color: orange
  759. font: verdana-11px-bold
  760.  
  761. ]], monsterKill.content)
  762. if lbls[k] then
  763. lbls[k].name:setText(k .. ':')
  764. lbls[k].count:setText("x"..v)
  765. end
  766. end
  767. end
  768. end
  769. refreshMK()
  770. toggleWin(storage[mkPanelname].min)
  771.  
  772. monsterKill.showList.onClick = function(widget)
  773. storage[mkPanelname].min = (monsterKill:getHeight() == 135)
  774. toggleWin(storage[mkPanelname].min)
  775. end
  776.  
  777. -- Funkcja do resetowania licznika i zapisywania ostatniej sumy
  778. local function resetCounter()
  779. local totalKills = 0
  780. for _, count in pairs(killList) do
  781. totalKills = totalKills + count
  782. end
  783. storage[mkPanelname].lastKills = totalKills -- Zapisujemy sume
  784. monsterKill.lastKillLabel:setText("Last 10 min kills: " .. totalKills)
  785. killList = {}
  786. refreshMK()
  787. warn("Licznik zresetowany. Zabite w ostatnich 10 minutach: " .. totalKills)
  788. end
  789.  
  790. monsterKill.resetList.onClick = function(widget)
  791. resetCounter()
  792. end
  793.  
  794. -- Automatyczne resetowanie co 10 minut (600 sekund)
  795. macro(600000, "Reset Monster Kill Counter", function()
  796. resetCounter()
  797. end)
  798.  
  799. function checkKill(mode, text)
  800. local mobName = nil
  801. local reg = { "Loot of a (.*):", "Loot of an (.*):", "Loot of the (.*):","Loot of (.*):" }
  802. for x = 1, #reg do
  803. _, _, mobName = string.find(text, reg[x])
  804. if mobName then
  805. if killList[mobName] then
  806. killList[mobName] = killList[mobName] + 1
  807. else
  808. killList[mobName] = 1
  809. end
  810. refreshMK()
  811. break
  812. end
  813. end
  814. end
  815.  
  816. onTalk(function(name, level, mode, text, channelId, pos)
  817. if channelId == 11 then checkKill(mode, text) end
  818. end)
  819.  
  820. onTextMessage(function(mode, text)
  821. checkKill(mode, text)
  822. end)
  823.  
  824. function getKills(mobName)
  825. if killList[mobName] then
  826. return killList[mobName]
  827. end
  828. return nil
  829. end
  830.  
  831. function getDumpAllKills()
  832. for k, v in pairs(killList) do
  833. warn(v .. "x " .. k)
  834. end
  835. end
  836.  
  837.  
  838.  
  839. UI.Separator()
  840.  
  841. UI.Label("-------COMBO LEADER-------")
  842. setDefaultTab("Main")
  843.  
  844. local panelName = "CL"
  845. if not storage[panelName] then
  846. storage[panelName] = {
  847. checkBoxSD = false,
  848. checkBoxSpell = false
  849. }
  850. end
  851.  
  852. local ui = setupUI([[
  853. CLPANEL < UIWidget
  854. image-source: /images/ui/window_headless
  855. image-border: 5
  856. padding: 3
  857. height: 45
  858.  
  859. CheckBox
  860. id: checkSD
  861. anchors.top: parent.top
  862. anchors.left: parent.left
  863. margin-left: 5
  864. margin-top: 5
  865.  
  866. UIWidget
  867. anchors.top: parent.top
  868. anchors.left: checkSD.right
  869. !text: tr('SD')
  870. margin-left: 5
  871. margin-top: 4
  872.  
  873. CheckBox
  874. id: checkSpell
  875. anchors.top: prev.bottom
  876. anchors.left: parent.left
  877. margin-left: 5
  878. margin-top: 5
  879. margin-bottom: 5
  880.  
  881. UIWidget
  882. anchors.top: parent.top
  883. anchors.left: checkSpell.right
  884. !text: tr('SPELL')
  885. margin-left: 5
  886. margin-top: 20
  887.  
  888. Panel
  889. id: CL
  890. height: 35
  891. padding: 3
  892. ]])
  893.  
  894. local label = UI.createWidget("CLPANEL", ui.CL)
  895.  
  896. UI.Separator()
  897. UI.Label("Spell:"):setColor("#FFA500")
  898. addTextEdit("SpellCL", storage.spellCL, function(widget, text)
  899. storage.spellCL = text
  900. end)
  901.  
  902. UI.Separator()
  903. -- Synchronizacja z przechowywanymi wartoociami
  904. label:getChildById("checkSD"):setChecked(storage[panelName].checkBoxSD)
  905. label:getChildById("checkSpell"):setChecked(storage[panelName].checkBoxSpell)
  906.  
  907. -- Obs3uga zdarzen dla checkboxów
  908. label:getChildById("checkSD").onClick = function(widget)
  909. local state = not widget:isChecked()
  910. widget:setChecked(state)
  911. storage[panelName].checkBoxSD = state
  912. if state then
  913. label:getChildById("checkSpell"):setChecked(false)
  914. storage[panelName].checkBoxSpell = false
  915. end
  916. end
  917.  
  918. label:getChildById("checkSpell").onClick = function(widget)
  919. local state = not widget:isChecked()
  920. widget:setChecked(state)
  921. storage[panelName].checkBoxSpell = state
  922. if state then
  923. label:getChildById("checkSD"):setChecked(false)
  924. storage[panelName].checkBoxSD = false
  925. end
  926. end
  927.  
  928. UI.Label("Leader:"):setColor("#c934eb")
  929. addTextEdit("leader", storage.comboLeader or "Player name", function(widget, text)
  930. storage.comboLeader = text
  931. end)
  932. addSeparator()
  933.  
  934. -- Makro i logika
  935. local m = macro(1000, "Enable combo", function() end)
  936.  
  937. onMissle(function(missle)
  938. if m.isOff() then return end
  939. local src = missle:getSource()
  940. if src.z ~= posz() then return end
  941.  
  942. local from = g_map.getTile(src)
  943. local to = g_map.getTile(missle:getDestination())
  944. if not from or not to then return end
  945.  
  946. local fromCreatures = from:getCreatures()
  947. local toCreatures = to:getCreatures()
  948. if #fromCreatures ~= 1 or #toCreatures ~= 1 then
  949. return
  950. end
  951.  
  952. local c1 = fromCreatures[1]
  953. local t1 = toCreatures[1]
  954. if c1:getName():lower() == storage.comboLeader:lower() then
  955. if label:getChildById("checkSD"):isChecked() then
  956. if not g_game.isAttacking() then
  957. g_game.attack(t1)
  958. end
  959. useWith(3155, t1)
  960. elseif label:getChildById("checkSpell"):isChecked() then
  961. if not g_game.isAttacking() then
  962. g_game.attack(t1)
  963. end
  964. say(storage.spellCL)
  965. end
  966. end
  967. end)
  968.  
  969.  
  970.  
  971.  
Tags: tibia
Add Comment
Please, Sign In to add comment