SHARE
TWEET

Dreadmote.mac

gSe7eN Apr 18th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. | Dreadmote.mac
  2. | Dreadmotes Macro by Eqmule April 17 2015
  3. |
  4. | This is a macro that will turn in dreadmotes for rk. ii spells in shards landing
  5. |
  6. | Instructions:
  7. | Place your char infront of Kerkaz in shards landing
  8. | Make sure you have some dreadmotes
  9. | it doesnt matter if u have enough or which kind
  10. | macro will figure it out, and get as
  11. | many spells as it can by turning in the dreadmotes you have
  12. |
  13. | Version 1.0 by Eqmule April 17 2015
  14. | - Initial Version
  15. | Version 1.1 by Eqmule April 18 2015
  16. | - Added spellmeming...
  17.  
  18. #turbo 120
  19.  
  20. Sub Main
  21.     /declare TurnInTarget       string  outer  Kerkaz
  22.     /declare SpellsNeeded[100] string outer NULL
  23.     /declare SpellsNeededCounter int outer 1
  24.     /declare Dreadmotes[5] string outer NULL
  25.     /varset Dreadmotes[1] Minor Dreadmote
  26.     /varset Dreadmotes[2] Lesser Dreadmote
  27.     /varset Dreadmotes[3] Median Dreadmote
  28.     /varset Dreadmotes[4] Greater Dreadmote
  29.     /varset Dreadmotes[5] Glowing Dreadmote
  30.     /declare i int local 1
  31.     /declare j int local 1
  32.     /declare tempspellid int local 0
  33.     /keypress OPEN_INV_BAGS
  34.     |CheckNeed is a function that takes a list index as a parameter
  35.     | Minor Dreadmote is 1 Glowing is 5
  36.    
  37.     |the loop:
  38.     /for i 1 to 5
  39.         |lets first make sure we have at least 1 dreadmote
  40.         /if (${FindItemCount[${Dreadmotes[${i}]}]}>=1) {
  41.             /call CheckNeed ${i}
  42.             /if (${SpellsNeededCounter}>=1) {
  43.                 /echo there are ${SpellsNeededCounter} available spells/tomes for ${Dreadmotes[${i}]}
  44.                 /for j 1 to ${SpellsNeededCounter}
  45.                     /call DoWeHaveTheSpell "${SpellsNeeded[${j}]}"
  46.                     /if (${Macro.Return}==0) {
  47.                         /call GetSpells ${i} "${SpellsNeeded[${j}]}"
  48.                     }
  49.                 /next j
  50.                 |ok lets mem them:
  51.                 /for j 1 to ${SpellsNeededCounter}
  52.                     /varset tempspellid ${FindItem[${SpellsNeeded[${j}]}].ID}
  53.                     /if (${Bool[${tempspellid}]}==TRUE) {
  54.                         /keypress OPEN_INV_BAGS
  55.                         /itemnotify "${FindItem[${SpellsNeeded[${j}]}].Name}" rightmouseup
  56.                         /echo waiting for cursor to get the spell
  57.                         /delay 3s ${Cursor.ID}==${tempspellid}
  58.                         /echo wating for cursor to be empty
  59.                         /delay 60s ${Cursor.ID}==0
  60.                         /echo finished scribing ${SpellsNeeded[${j}]}
  61.                         /delay 5s
  62.                         /echo doing next one
  63.                     }
  64.                 /next j
  65.             } else {
  66.                 /echo we didnt need any ${Dreadmotes[${i}]} spells/tomes
  67.             }
  68.         } else {
  69.             /echo you are out of ${Dreadmotes[${i}]} moving on to next one
  70.         }
  71.         /call ClearSpellsNeeded
  72.     /next i
  73.     /keypress CLOSE_INV_BAGS
  74. /return
  75.  
  76. Sub ClearSpellsNeeded
  77.     /declare i int local 1
  78.     /for i 1 to 20
  79.         /varset SpellsNeeded[${i}] NULL
  80.     /next i
  81.     /varset SpellsNeededCounter 1
  82. /return
  83. Sub CheckNeed(int listindex)
  84.     /declare spellname string local ""
  85.     /declare spellnametwo string local ""
  86.     /declare pdest int local 0
  87.     /declare nummotes int local 0
  88.     /declare numitems int local 0
  89.     /declare i int local 0
  90.  
  91.     /if (${Window[SpellBookWnd].Open}==TRUE) {
  92.         /squelch /windowstate SpellBookWnd close
  93.         /delay 3s ${Window[SpellBookWnd].Open}==FALSE
  94.         /if (${Me.Standing}==FALSE) {
  95.             /stand
  96.             /delay 2s ${Me.Standing}==TRUE
  97.         }
  98.     }
  99.     /call SafeTarget ${TurnInTarget}
  100.     /if (${Window[TaskSelectWnd].Open}==FALSE) {
  101.         /say Dreadmote
  102.         /delay 3s ${Window[TaskSelectWnd].Open}==TRUE
  103.     }
  104.     /notify TaskSelectWnd TSEL_TaskList listselect ${listindex}
  105.     /delay 1s ${Window[TaskSelectWnd].Child[TSEL_TaskList].GetCurSel}==${listindex}
  106.     /notify TaskSelectWnd TSEL_PreviewRewardButton leftmouseup
  107.     /delay 3s ${Window[RewardSelectionWnd].Open}==TRUE
  108.     /delay 5s ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].Items}>=1
  109.     /echo well it seems like we need to wait for the list a little longer
  110.     /delay 5s
  111.     /varset numitems ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].Items}
  112.     /if (${numitems}==0) {
  113.         /echo please reload your ui and then run this macro again, I needed a real list and its screwed up
  114.         /beep
  115.         /end
  116.     }
  117.     /echo list populated numitems is ${numitems}
  118.     /for i 1 to ${numitems}
  119.         /if (${Bool[${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].List[${i},1].Find[: ]}]}==TRUE) {
  120.             |/echo ok it looks like we found a spell we need?
  121.             |/echo lets make sure
  122.             /varset pdest ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].List[${i},1].Find[: ]}
  123.             /varset spellname ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].List[${i},1].Right[-${pdest}]}
  124.             /if (${Bool[${spellname.Find[;]}]}==TRUE) {
  125.                 |ok, uhm its a reward that gives 2 spells/tomes
  126.                 /varset pdest ${spellname.Find[;]}
  127.                 /varset spellnametwo ${spellname.Right[-${pdest}]}
  128.                 /varset pdest ${spellnametwo.Find[: ]}
  129.                 /varset spellnametwo ${spellnametwo.Right[-${pdest}]}
  130.                 /call DoWeHaveTheSpell "${spellnametwo}"
  131.                 /if (${Macro.Return}==0) {
  132.                     /varset SpellsNeeded[${SpellsNeededCounter}] ${spellnametwo}
  133.                     /varcalc SpellsNeededCounter ${SpellsNeededCounter}+1
  134.                 }
  135.                 /varset pdest ${spellname.Find[;]}
  136.                 /varcalc pdest ${pdest}-1
  137.                 /varset spellname ${spellname.Mid[1,${pdest}]}
  138.                 /call DoWeHaveTheSpell "${spellname}"
  139.                 /if (${Macro.Return}==0) {
  140.                     /varset SpellsNeeded[${SpellsNeededCounter}] ${spellname}
  141.                     /varcalc SpellsNeededCounter ${SpellsNeededCounter}+1
  142.                 }
  143.             } else {
  144.                 /call DoWeHaveTheSpell "${spellname}"
  145.                 /if (${Macro.Return}==0) {
  146.                     /varset SpellsNeeded[${SpellsNeededCounter}] ${spellname}
  147.                     /varcalc SpellsNeededCounter ${SpellsNeededCounter}+1
  148.                 }
  149.             }
  150.         }
  151.     /next i
  152.     /varcalc SpellsNeededCounter ${SpellsNeededCounter}-1
  153. /return
  154.  
  155. Sub GetSpells(int theindex, string spellname)
  156.     /declare spellindex int local 0
  157.     /echo Im looking for ${spellname} in the list
  158.     /if (${Window[TaskSelectWnd].Open}==FALSE) {
  159.         /say Dreadmote
  160.         /delay 3s ${Window[TaskSelectWnd].Open}==TRUE
  161.     }
  162.     /notify TaskSelectWnd TSEL_TaskList listselect ${theindex}
  163.     /delay 1s ${Window[TaskSelectWnd].Child[TSEL_TaskList].GetCurSel}==${theindex}
  164.    
  165.     /notify TaskSelectWnd TSEL_AcceptButton leftmouseup
  166.     /delay 3s ${Window[TaskSelectWnd].Open}==FALSE
  167.     /if (${Window[RewardSelectionWnd].Open}==TRUE) {
  168.         /squelch /windowstate RewardSelectionWnd close
  169.         /delay 3s ${Window[RewardSelectionWnd].Open}==FALSE
  170.     }
  171.     /echo ok we have the quest, now im giving him a ${Dreadmotes[${theindex}]}
  172.     /if (${FindItemCount[${Dreadmotes[${theindex}]}]}>=1) {
  173.         /ctrl /itemnotify "${Dreadmotes[${theindex}]}" leftmouseup
  174.         /delay 3s ${Cursor.ID}==${FindItem[${Dreadmotes[${theindex}]}].ID}
  175.         /call SafeTarget "${TurnInTarget}"
  176.         /if (${Target.ID} && ${Target.ID}==${Spawn[npc ${TurnInTarget}].ID}) {
  177.             /click left target
  178.             /delay 5s ${Window[GiveWnd].Child[GVW_MyItemSlot0].Tooltip.Equal[${Dreadmotes[${theindex}]}]}==TRUE
  179.             /if (${Window[GiveWnd].Open}) {
  180.                 /notify GiveWnd GVW_Give_Button leftmouseup
  181.                 /delay 3s ${Window[GiveWnd].Open}==FALSE
  182.             } else {
  183.                 /echo give window not up im ending
  184.                 /end
  185.             }
  186.         } else {
  187.             /echo couldnt target ${TurnInTarget} will end
  188.             /end
  189.         }
  190.     } else {
  191.         /echo you are out of ${Dreadmotes[${theindex}]}s ending
  192.         /end
  193.     }
  194.     /delay 60s ${Window[RewardSelectionWnd].Open}==TRUE
  195.     /if (${Window[RewardSelectionWnd].Open}) {
  196.         |/echo window is up, select a spell, and click accept
  197.         |/echo calling GetSpellIndex
  198.         /call GetSpellIndex "${spellname}"
  199.         /varset spellindex ${Macro.Return}
  200.         /if (${spellindex}>0) {
  201.             /notify ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].Address} listselect ${spellindex}
  202.             /delay 3s ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].GetCurSel}==${spellindex}
  203.             |/echo u can click accept now...
  204.             /notify ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionChooseButton].Address} leftmouseup
  205.             /delay 3s ${Window[RewardSelectionWnd].Open}==FALSE
  206.             /echo all done u got your ${spellname}
  207.         }
  208.     } else {
  209.         /echo you didnt give him a ${Dreadmotes[${theindex}]}...
  210.     }
  211. /return
  212.  
  213. Sub GetSpellIndex(string spellname)
  214.     /echo trying to find ${spellname} index in the list waiting 30 secs max for list to populate
  215.     /delay 10s ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].Items}>0
  216.     /echo list populated!
  217.     /declare numitems int local 0
  218.     /declare i int local 1
  219.     /varset numitems ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].Items}
  220.     /for i 1 to ${numitems}
  221.         |/echo ${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].List[${i},1]}
  222.         /if (${Bool[${Window[RewardSelectionWnd].FirstChild.FirstChild.Next.Child[RewardSelectionOptionList].List[${i},1].Find[${spellname}]}]}==TRUE) {
  223.             /varcalc i ${i}-1
  224.             /echo we found the index that has ${spellname} its: ${i}
  225.             /return ${i}
  226.         }
  227.     /next i
  228.     /beep
  229.     /beep
  230.     /echo no index found aborting!
  231.     /end
  232. /return 0
  233.  
  234. Sub SafeTarget(string targ)
  235.     /declare targid int local 0
  236. :retarget
  237.     /if (${Target.ID} && ${Target.ID}==${Spawn[${targ}].ID}) /return
  238.     /if (${Spawn[${targ}].ID}) {
  239.         /varset targid ${Spawn[${targ}].ID}
  240.         /if (${Spawn[${targ}].Distance}<100) {
  241.             /echo Targeting ${Spawn[${targ}]}
  242.             /target id ${targid}
  243.             /delay 1s
  244.         }
  245.     }
  246.     /if (!${Target.ID}) {
  247.         /echo [SafeTarget] couldnt find a target, retrying
  248.         /delay 1s
  249.         /goto :retarget
  250.     }
  251. /return
  252.  
  253. Sub DoWeHaveTheSpell(string spellname)
  254.     /if (${Bool[${FindItem[${spellname}]}]}==TRUE) /return 1
  255.     /if (${Bool[${Me.Book[${spellname}]}]}==TRUE) /return 1
  256.     /if (${Bool[${Me.CombatAbility[${spellname}]}]}==TRUE) /return 1
  257. /return 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top