Advertisement
Guest User

Untitled

a guest
Mar 30th, 2022
882
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.42 KB | None | 0 0
  1. -- Wowmimic api documentation 1.0
  2. ---------------------------------------------------------------------------------
  3. -- General scripting usage related: 
  4. function GeneralScriptingUsage()
  5.     -- this is just to for Symbols
  6. end
  7. api_LoadScript(path)
  8. -- Arguments: 
  9. -- path; type string
  10. -- include the script from argument to the current lua project. path root is Bot folder>Script folder.
  11. -- api_LoadScript("lib\\timer.lua") includes timer.lua file from Bot folder>Script folder> lib folder into the curreny lua project.
  12.  
  13. api_StopScript()
  14. -- by default it returns false. by press F7 it will make it return true and end the current lua thread,and then it will reset its return value back to false once thread end.
  15. -- this function could be used to break while loop and end the current lua thread. 
  16. -- example: while not api_StopScript() do MyLogic() end; so when player fress F7 it breaks this while loop and end curent lua thread. Once press it again it restart the lua thread and reset the return value to default.
  17.  
  18. api_IsEnteredWorld() 
  19. -- return type: Bool
  20. -- return true if already entered game world, otherwise return false
  21.  
  22. api_IsLoadingScreen()
  23. -- return type: Bool
  24. -- return true if game is in loading screen, otherwise return false
  25.  
  26. api_TitlePrint(str)
  27. -- Arguments:
  28. -- str; type string
  29. -- change game window titile name to argument's content.
  30. -- example: api_TitlePrint("Hello World!")
  31.  
  32. api_LoadCurrentStatus()
  33. -- return type: string
  34. -- return whatever saved string by api_SaveCurrentStatus(str) function
  35.  
  36. api_SaveCurrentStatus(str)
  37. -- Arguments: 
  38. -- str; type:string
  39. -- save the string content into current season window's config files. 
  40.  
  41. api_MathRandom(n1,n2)
  42. --  Arguments:
  43. -- n1,n2; type:number
  44. -- return type:number 
  45. -- same usage as lua native math.random(n1,n2) function
  46.  
  47. api_CloseGame()
  48. -- Close current season window.
  49.  
  50. api_KeyDown(keyASCII)
  51. -- Arguments:
  52. -- keyASCII: number
  53. -- Press key down by the key's ASCII value input. function works even game running background.
  54. -- example: Key_W's ASCII = 87, api_KeyDown(87) will keep W key pressed until release it.
  55.  
  56. api_KeyUp(keyASCII)
  57. -- Arguments:
  58. -- keyASCII: number
  59. -- Press key down by the key's ASCII value input. function works even game running background.
  60. -- example: Key_W's ASCII = 87, api_KeyUp(87) will release W key.
  61.  
  62. api_GetTime()
  63. -- return type: number
  64. -- return tickcount since PC started, same as GetTickCount() from windows api. 
  65.  
  66. ---------------------------------------------------------------------------------
  67. -- GUI related --
  68. function GuiRelated()
  69.     -- this is just to for Symbols
  70. end
  71. api_GetSelectedRotation() 
  72. -- return selected rotation script path as string. could use api_LoadScript(api_GetSelectedRotation()) to include the Rotation script in your lua project.
  73.  
  74. ---------------------------------------------------------------------------------
  75. -- Entity list/Grind/Gather related: 
  76. function EntityListGrindGather()
  77.     -- this is just to for Symbols
  78. end
  79. api_FaceTarget()
  80. -- Usage: make player face towards selected object.
  81.  
  82. api_AggrMobNumByName(name)
  83. -- Arguments:
  84. -- name;type string
  85. -- return type: Number
  86. -- return amount of the mobs whose name match the argument's content and has aggro on player within current scence
  87. -- example: api_AggrMobNumByName("Beetle")
  88.  
  89. api_GroundAggrNum(range)
  90. -- Arguments:
  91. -- range;type string
  92. -- return type: number
  93. -- return amount of mob that has aggro on player within range of argument.
  94.  
  95. api_HasTarget()
  96. -- return type: bool
  97. -- return true if player has object selected, else false
  98.  
  99. api_HasBuffId(BuffID)
  100. -- Arguments: 
  101. -- BuffID; type:number
  102. -- return type:Bool 
  103. -- return true if player has BuffID otherwise false. the BuffID could be a buff or debuff. could easlier find buff id by searching buff's name in wow data base website such as wowhead. keep in mind same buff with different rank has different id
  104. -- example: api_HasBuffId(33405) , this will return if player has Ice Barrier Rank 6 on.
  105.  
  106. api_GetStance()
  107.  
  108. api_GetWalkStatus()
  109. -- return 1 if player is walking otherwise 0
  110.  
  111. api_ForwardCastState()
  112. -- return type:number
  113. -- return 0 if player is not casting any forward load spells such as Frostbolt( it loads from left to right in castbar), otherwise it returns the spell's id
  114. -- example: if api_ForwardCastState() == 0 then print("player is not casting any forward cast spell") else print("forward cast spell found") end
  115.  
  116. api_BackwardCastState()
  117. -- return type: number
  118. -- return 0 if player is not casting any backward load spells such as Blizzard( it loads from right to left in castbar), otherwise it returns the spell's id
  119. -- example: if api_BackwardCastState() == 0 then print("player is not casting any Backward cast spell") else print("Backward cast spell found") end
  120.  
  121. api_GetFaceAngle(x,y)
  122. -- Arguments:
  123. -- x; type:number
  124. -- y; type:number
  125. -- returns: angle 
  126. -- angle; type:number
  127. -- if calculate the angle from player's current position to face the argument's x y postion, and return angle value
  128.  
  129. api_SetFaceAngle(angle)
  130. -- Arguments: 
  131. -- angle; type:number
  132. -- change player's face direction by the angle given
  133.  
  134. api_FacePos(x,y)
  135. -- Arguments:
  136. -- x; type:number
  137. -- y; type:number
  138. -- Usage: make player face to x,y position.
  139.  
  140. api_GetMyLv()
  141. api_GetMyMoney()
  142. api_GetMyHp()
  143. api_GetMyMaxHp()
  144. api_GetMyMp()
  145. api_GetMyMaxMp()
  146. api_GetMyX()
  147. api_GetMyY()
  148. api_GetMyZ()
  149. api_GetMySpeed()
  150. api_GetMyMaxSpeed()
  151. -- return type: number 
  152. -- the above functions returns character info by its literal meaning. no Agruments needed. 
  153. -- it all returns 0 if not entered world or game in loading screen.
  154.  
  155. api_GetObjectFaceAngle(actor) 
  156. -- Arguments: 
  157. -- actor; type:number 
  158. -- it returns the Object's current face angle by object's actor
  159.  
  160. api_CastSpell(str,x,y,z)
  161. -- Arguments: 
  162. -- str; type:string
  163. -- x,y,z; type:number
  164. -- str is a marco command, x,y,z is the postion xyz you want the spell been cast. 
  165. -- example: api_CastSpell("/cast Blizzard(Rank 1)",api_GetMyX(),api_GetMyY(),api_GetMyZ()) , this will make player cast Blizzard(Rank 1) at its current position.
  166.  
  167. api_CastSpell2(str,x,y,z)
  168. -- Arguments: 
  169. -- str; type:string
  170. -- x,y,z; type:number
  171. -- str is in game lua command,could be protected command such as "CastSpell(spellId)", CastSpellByName(spellName),x,y,z is the postion xyz you want the spell been cast. 
  172. -- example: api_CastSpell("CastSpell(10)",x,y,z); api_CastSpell("CastSpellByName(Blizzard(Rank 1))",x,y,z), both could make player cast Blizzard(Rank 1) at xyz position.
  173.  
  174. api_GatherObjName(actor)
  175. -- Arguments: 
  176. -- actor; type:number
  177. -- return type: string 
  178. -- returns the gathering object name by the engtity's actor 
  179.  
  180. api_GatherObjX(actor)
  181. api_GatherObjY(actor)
  182. api_GatherObjZ(actor)
  183. -- Arguments: 
  184. -- actor; type:number
  185. -- return type:number
  186. -- returns the postion info x,y,z number by the entity's actor
  187.  
  188. api_GatherObjExist(actor)
  189. -- Arguments: 
  190. -- actor; type:number
  191. -- return type:bool
  192. -- return true if the Gather object still exist by its actor, else return false
  193.  
  194. api_dw_HasLoot(actor)
  195. -- Arguments: 
  196. -- actor; type:number
  197. -- return type:bool
  198. -- return true if the object still has loot by its actor, else return false
  199.  
  200. api_CorpseX()
  201. api_CorpseY()
  202. api_CorpseZ()
  203. -- return type:number
  204. -- returns 0 when player is alive, returns player's corpse x,y,z info if player is dead/ghost
  205. -- in most cases, when player die inside instance, the corpse xyz are unique for each unique instance. 
  206. -- could use this to check if player's corpse inside instance. 
  207. -- example: 
  208. function IsCorpseInSFKInstance()
  209.     if math.floor(api_CorpseX()) == -231 and math.floor(api_CorpseY()) == 1571 and math.floor(api_CorpseZ()) == 76 then 
  210.         print("corpse inside SFK instance") 
  211.         return true
  212.     else 
  213.         print("corpse not inside instance") 
  214.         return false
  215.     end
  216. end
  217.  
  218. api_Interact(name)
  219. -- Arguments: 
  220. -- name; type:string
  221. -- interact by entity's name around player, player must stand close to the entity.
  222. -- example: api_Interact("Morgum") will open dialog with Morgum in Orgrimmar when player stand next to it.
  223. -- example2: api_Interact("Mailbox") will open the mail box dialog when player stand next to it.
  224.  
  225. api_RightClick(id1,id2)
  226. -- Arguments: 
  227. -- id1,id2; type:number
  228. -- it is same as player right click Object by Object's id1,id2 from entity list. it could triggers auto attack/loot/moveto objects just like what it does when player right click object.
  229.  
  230. api_SelectObject(id1,id2)
  231. -- Arguments: 
  232. -- id1,id2; type:number
  233. -- it is same as player left click Object by Object's id1,id2 from entity list. it only triggers select the object.
  234.  
  235. api_AIGatherInfo(x,y,z,height,range,X_CoordinateBlackList,herb,mini)
  236. -- Usage: it returrns the closest gatherable object info base on current herb/mining skill rank at xyz position with scan height and within range, it also consider object's X coordinate to filter objects.
  237. -- this function only returns object that is gatherable under current Herbalism/Mining rank.
  238. -- Arguments: 
  239. -- x,y,z,height,range; type:number
  240. -- X_CoordinateBlackList; type:table
  241. -- herb,mini; type:number
  242. -- returns: actor,mx,my,mz,id1,id2,name
  243. -- actor,mx,my,mz,id1,id2; type:number 
  244. -- name; type:string
  245. -- actor is gatherable's actor from entitylist; mx,my,mz is its position; name is the gatherable's name
  246. -- id1,id2 could be used by api_RightClick(objid1,objid2) and it will makes character do the same as player manually right click on the gather object.
  247. -- if no gatherable fits the condition found, all returns will be 0
  248. -- example: 
  249. function StandGather(x,y,z,height,range)
  250.     local X_CoordinateBlackList = {}
  251.     while not api_StopScript() and api_GetMyHp() > 0 do
  252.         local herb,mini = GetGatherSkillRank()
  253.         local objactor,objx,objy,objz,objid1,objid2,objname = api_AIGatherInfo(x,y,z,height,range,X_CoordinateBlackList,herb,mini)
  254.         if objactor ~= 0 then -- found gatherable object fits its condition
  255.             if not table.find(X_CoordinateBlackList,objx) then
  256.                 table.insert(X_CoordinateBlackList,objx) -- insert object's x coordinate so api_AIGatherInfo will filter this object in next scan. just in case have to give up this object and do a new scan.
  257.             end
  258.             -- could add your navigation logic here.
  259.             api_RightClick(objid1,objid2) -- player right click object
  260.         else
  261.             print("no gatherable obj found. break function!")
  262.             break
  263.         end
  264.     end
  265. end
  266.  
  267. api_GroundGatherInfo(x,y,z,height,range,gatherObjectNametable,gatherObjectBlackList,X_CoordinateBlackList)
  268. -- Usage: it returrns the closest gatherable object info based on gatherObjectNametable,gatherObjectBlackList at xyz position with scan height and within range, it also consider object's X coordinate to filter objects.
  269. -- both gatherObjectNametable,gatherObjectBlackList are fuzzy matching
  270. -- this function doesnt take Herbalism and Mining skill rank into consideration.
  271. -- Arguments: 
  272. -- x,y,z,height,range; type:number
  273. -- gatherObjectNametable,gatherObjectBlackList,X_CoordinateBlackList; type:table
  274. -- herb,mini; type:number
  275. -- returns: actor,mx,my,mz,id1,id2,name
  276. -- actor,mx,my,mz,id1,id2; type:number 
  277. -- name; type:string
  278. -- actor is gatherable's actor from entitylist; mx,my,mz is its position; name is the gatherable's name
  279. -- id1,id2 could be used by api_RightClick(objid1,objid2) and it will makes character do the same as player manually right click on the gather object.
  280. -- if no gatherable fits the condition found, all returns will be 0
  281.  
  282. api_GroundMobInfo(x,y,z,height,range,MobNametable,ActorFilter)
  283. -- Arguments: 
  284. -- x,y,z,height,range; type:number
  285. -- MobNametable,actorfilter; type:table 
  286. -- Usage: this function returns the closest mob info that at xyz position within height,range and also match the MobNametable, and whose actor not in the ActorFilter table. 
  287. -- MobNametable is fuzzy matching
  288. -- returns: actor,mx,my,mz,id1,id2,name 
  289. -- actor,mx,my,mz,id1,id2; type:number 
  290. -- actor is mob's actor from entitylist; mx,my,mz is its position; name is the mob's name
  291. -- id1,id2 could be used by api_SelectObject(id1,id2) to select the mob
  292. -- if no mob fits the condition found, all returns will be 0
  293. -- example: 
  294. function StandGrind(x,y,z,height,range)
  295.     local ActorFilter = {}
  296.     local MobNametable = {"Wolf"}
  297.     while not api_StopScript() and api_GetMyHp() > 0 do
  298.         local actor,mx,my,mz,id1,id2,name = api_GroundMobInfo(x,y,z,height,range,MobNametable,ActorFilter)
  299.         if actor ~= 0 then -- found mob that fits condition
  300.             if not table.find(ActorFilter,actor) then
  301.                 table.insert(ActorFilter,actor) -- insert mob's actor in ActorFilter so it will filter this mob in next scan. just in case have to give up this mob and do a new scan.
  302.             end
  303.             api_SelectObject(id1,id2) -- player select the mob
  304.             -- could add your navigation/combat logic here.
  305.         else
  306.             print("no mob found. break function!")
  307.             break
  308.         end
  309.     end
  310. end
  311.  
  312. api_BlackListMobInfo(x,y,z,height,range,MobNameBlackList,ActorFilter)
  313. -- this function is similar as api_GroundMobInfo() but instead of returning what matches MobNametable, it returns whose name is not in the MobNameBlackList
  314. -- usage, argument, and return detail could take api_GroundMobInfo(x,y,z,height,range,MobNametable,ActorFilter) as reference.
  315.  
  316. api_GroundClick(height,range,name)
  317. -- Arguments: 
  318. -- height,range; type:number
  319. -- name; type:string 
  320. -- Usage: it right clicks every interactable object that fuzzy matches name within height and range at current player's position in a split second.
  321. -- it also right clicks corpse that is lootable within height and range at current player's position in a split second. could use this for looting
  322. -- example: 
  323. -- api_GroundClick(5,5,"Shallow Grave") will make character click every Shallow Grave at 5 height and 5 range. this is useful in  Zul'Farrak.
  324.  
  325. api_MobNumInList(x,y,z,height,range,nametable,MatchOrFilter)
  326. --Arguments: 
  327. -- x,y,z,height,range; type:number
  328. -- nametable; type:table
  329. -- MatchOrFilter; type:number( accept 0 and 1 only, 0 means mobname matches nametable and 1 means mobname that filter out by nametable.)
  330. -- returns type: number
  331. -- Usage: this function could be used to return the amount of mob at position xyz wthin height and range and whose name Match/FilterOut by MatchOrFilter arguments. 
  332. -- function auto filter out small creatures that has very little HP.
  333. -- example: 
  334. -- local x,y,z = api_GetMyX(),api_GetMyY(),api_GetMyZ()
  335. -- local amount = api_MobNumInList(x,y,z,20,35,{"Cabal Acolyte"},0)
  336. -- this will return amount of mob whose name matches "Cabal Acolyte" at player current position within 20 height and 35 range.
  337.  
  338. api_MobDensity(x,y,z,height,range)
  339. -- Arguments: 
  340. -- x,y,z,height,range; type:number 
  341. -- function auto filter out small creatures that has very little HP. 
  342. -- Usage: this function returns amount of mob at xyz position within height and range without considering mob's name.
  343.  
  344. api_BlackListMobTotalHp(x,y,z,height,range,MobNameBlackList)
  345. -- Arguments: 
  346. -- x,y,z,height,range; type:number 
  347. -- MobNameBlackList; type:table
  348. -- function auto filter out small creatures that has very little HP. 
  349. -- returns: count,totalHp
  350. -- count,totalHp; type:number 
  351. -- Usage: this function returns amount of mob and their currrent Hp sum at xyz position within height and range whose name is not in the MobNameBlackList.
  352.  
  353. api_AggrMobTotalHp(x,y,z,height,range)
  354. -- Arguments: 
  355. -- x,y,z,height,range; type:number 
  356. -- returns: count,totalHp
  357. -- count,totalHp; type:number 
  358. -- Usage: this function returns amount of mob and their currrent Hp sum at xyz position within height and range who has aggro to player.
  359.  
  360. api_AggrMobList()
  361. -- returns: actor,mx,my,mz,id1,id2,name 
  362. -- actor,mx,my,mz,id1,id2; type:number 
  363. -- name ; type:string
  364. -- id1,id2 could be used by api_SelectObject(id1,id2) to select the mob
  365. -- Usage: this function could return the closest mob info who has aggro on player
  366. -- if no mob fits the condition found, all returns will be 0
  367.  
  368. api_AggrNum()
  369. -- returns: amount 
  370. -- amount; type:number 
  371. -- Usage: this function returns amount of mob who has aggro on player within the scene
  372. api_GroundCorpseNum(height,range)
  373. -- Arguments: 
  374. -- height,range; type:number 
  375. -- returns: amount
  376. -- amount; type:number
  377. -- Usage: this function returns the amount of corpse who is still lootable within height and range at player's current position
  378.  
  379. api_InteractNpcList(x,y,z,height,range,nametable)
  380. -- Arguments: 
  381. -- x,y,z,height,range; type:number 
  382. -- nametable; type:table 
  383. -- returns: actor,mx,my,mz,id1,id2,name 
  384. -- actor,mx,my,mz,id1,id2; type:number 
  385. -- actor is npc's actor from entitylist; mx,my,mz is its position; name is the npc's name
  386. -- id1,id2 could be used by api_SelectObject(id1,id2) to select the mob
  387. -- if no npc fits the condition found, all returns will be 0
  388. -- Usage: this function returns the closest npc info at position xyz within height and range whose name fuzzy matchese whatever inside nametable. 
  389.  
  390. ---------------------------------------------------------------------------------
  391. -- Pathing related:
  392. function Pathing()
  393.     -- this is just to for Symbols
  394. end
  395. api_Walk(x,y,z)
  396. -- Arguments: 
  397. -- x,y,z; type:number
  398. -- characte move to x,y,z postion by CTM
  399.  
  400. api_KeyBoardWalk(x,y,z)
  401. -- Arguments: 
  402. -- x,y,z; type:number
  403. -- characte move to x,y,z postion by KeyPress W key 
  404.  
  405. api_GetNaviMeshPath(x,y,z,mapid)
  406. -- Arguments: 
  407. -- x,y,z,id; type:number 
  408. -- return type:string
  409. -- return waypoint string from current location to x,y,z position in mapID
  410. -- example: 
  411. function CurrentMapID()
  412. local code = string.format([[
  413. /run 
  414. ret = -1
  415. local _, _, _, _, _, _, _, mapid = GetInstanceInfo()
  416. ret = mapid
  417. ]])
  418.     api_Macro(code)
  419.     local id = tonumber(api_GetLua())
  420.     return id
  421. end
  422.  
  423. function GetWayPoints(x,y,z,id)
  424.     local a = api_GetNaviMeshPath(x,y,z,mapid) -- request waypoint string from server.
  425.     if mapid == nil then
  426.         mapid = CurrentMapID() -- if didnt provide mapid, it will use current mapid.
  427.     end
  428.     if a ~= nil and a ~= "" and a ~= " " and a ~= "{ }" and a ~= "{}" then
  429.         a = string.gsub(a,'"','')
  430.         a = string.gsub(a,':','=')
  431.         local b = load("return " .. a)
  432.         a = b() -- convert string into table
  433.         return a -- return the navi mesh waypoint table.
  434.     else
  435.         return {} -- request navi mesh waypoint failed from server, return empty table.
  436.     end
  437. end
  438. -- if player is too far or too close to x,y,z or if waypoint from current position to x,y,z is invalid, it will only return 2 waypoints string( current xyz and destination xyz).
  439.  
  440. ---------------------------------------------------------------------------------
  441. --Wow's Lua and Marco related:
  442. function WowLuaUsage()
  443.     -- this is just to for Symbols
  444. end
  445. RunLua(str)
  446. -- Arguments: 
  447. -- str; type:string
  448. -- Usage: this function could execute all wow's ingame lua functions including protected functions. 
  449. -- example: RunLua('JumpOrAscendStart()') will make player jump.
  450.  
  451. api_Macro(str)
  452. -- Arguments: 
  453. -- str; type:string
  454. -- this is the in game macro function call. could use it to execute in game marco command or unprotected lua command. protected lua command wont work.
  455. -- example: api_Marco("/cast Ice Armor"); api_Marco("/p leave party!"); api_Marco("/run LeaveParty()")
  456.  
  457. api_SetLua(str)
  458. -- Arguments: 
  459. -- str; type:string
  460. -- this command usually could be used with api_GetLua() and api_Macro(str) to get return string from wow's lua call. 
  461. -- check api_GetLua() to get the example of usage. 
  462.  
  463. api_GetLua()
  464. -- return type: string
  465. -- this command must be used with api_SetLua(str) and api_Macro(str) in order to get return strings from wow's lua call. 
  466. -- example: 
  467. function IsPlayerInGroup()
  468.     local code = "/run ret = tostring(IsInGroup())"
  469.     api_Macro(code)
  470.     local str = api_GetLua()
  471.     if str == "true" then
  472.         return true
  473.     else
  474.         return false
  475.     end
  476. end
  477. -- must use specific string "ret" to save the return value as string in the marco code execution.
  478. -- after marco code executed, GetLua() will return whatever is restored in "ret" variable by format of string. 
  479. -- by  comparing the return string you could tell function to return bool value base on need.
  480.  
  481. -- example2:
  482. function GetInstanceID()
  483.     local code = string.format([[
  484. /run
  485. ret = 0
  486. local name, instanceType, difficultyID, difficultyName, maxPlayers, dynamicDifficulty, isDynamic, instanceID, instanceGroupSize, LfgDungeonID = GetInstanceInfo()
  487. if instanceID then
  488.     ret = instanceID
  489. end
  490. ]])
  491.     api_Macro(code)
  492.     local str = api_GetLua()
  493.     return tonumber(str)
  494. end
  495. -- must use specific string "ret" to save the return value as string in the marco code execution.
  496. -- after marco code executed, GetLua() will return whatever is restored in "ret" variable by format of string. 
  497. -- by convert the return string to data type needed could easliy get whatever info you want from wow's lua api. 
  498.  
  499.  
  500. ---------------------------------------------------------------------------------
  501. -- InGame function calls related:
  502. function InGameFunctionCalls()
  503.     -- this is just to for Symbols
  504. end
  505. api_DestoryItemPos(bag,slot)
  506. -- Arguments: 
  507. -- bag,slot; type:number
  508. -- instantly throw away item at bag, slot. could get item's bag/slot position by lua returns.
  509.  
  510. ---------------------------------------------------------------------------------
  511. -- Hack features related:  
  512. function HackFeatures()
  513.     -- this is just to for Symbols
  514. end
  515.  
  516. api_NoClipOnObject(name)
  517. -- Arguments: 
  518. -- name; type:string
  519. -- gives player ability to pass the entity by its name. 
  520. -- example: api_NoClipOnObject("Karazhan Gatehouse Portcullis") will allow player enter Karazhan without open its gate.
  521. -- since this feature is a locale modification, itself wont cause player getting banned.
  522. -- but if ppl sees this and report player, player could still getting banned. please use this at your own risk.
  523.  
  524. api_WallClimb(n)
  525. -- Arguments: 
  526. -- n; type:number
  527. -- change player's wall climb level to n. by default wall climb level is 1, if higher number player could climb more steep walls. it doesnt makes any difference if goes above 100.
  528. -- Please notice this feature could cause player getting banned. different server has different ban rules. use this at your own risk.
  529.  
  530.  
  531. ---------------------------------------------------------------------------------
  532. -- Commonly used lua functions: 
  533. -- Notice the following commands are not native api from bot, in order to use it you will have to copy the function itself to your own lua script. 
  534. function CommonUseLuafunctions()
  535.     -- this is just to for Symbols
  536. end
  537.  
  538. function Dist2P(x,y)  -- returns floor value of distance between player and the x,y position 
  539.     local i = math.abs(math.sqrt((api_GetMyX() - x)^2 +  (api_GetMyY() - y)^2))
  540.     return math.floor(i)
  541. end
  542.  
  543. function Dist2PExact(x,y) -- returns value of distance between player and the x,y position 
  544.     local i = math.abs(math.sqrt((api_GetMyX() - x)^2 +  (api_GetMyY() - y)^2))
  545.     return i-i%0.01
  546. end
  547.  
  548. function Dist2PExact3D(x,y,z) -- returns value of distance between player and the x,y,z position 
  549.     local i = math.abs(math.sqrt((api_GetMyX() - x)^2 + (api_GetMyY() - y)^2 + (api_GetMyZ() - z)^2))
  550.     return i-i%0.01
  551. end
  552.  
  553. function Dist2DCal(x1,y1,x2,y2) -- returns value of distance between x1,y1 and the x2,y2
  554.     local i = math.abs(math.sqrt((x1 - x2)^2 +  (y1 - y2)^2))
  555.     return math.floor(i)
  556. end
  557.  
  558. function Dist3DCal(x1,y1,z1,x2,y2,z2) -- returns value of distance between x1,y1,z1 and the x2,y2,z2
  559.     local i =math.abs(math.sqrt((x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2))
  560.     return i
  561. end
  562.  
  563. function GetGatherSkillRank() -- returns current Herbalism and Mining skill rank.
  564.     local code = string.format([[
  565. /run
  566. ret = 0
  567. local num = GetNumSkillLines()
  568. local herb,min = 0,0
  569. local shit = {"Mining","Herbalism"}
  570. for i = 1,num do 
  571.     local skillName, header, isExpanded, skillRank, numTempPoints, skillModifier, skillMaxRank, isAbandonable, stepCost, rankCost, minLevel, skillCostType = GetSkillLineInfo(i)
  572.     if skillName then
  573.         if skillName == "Mining" then
  574.             min = skillRank
  575.         elseif  skillName == "Herbalism" then
  576.             herb = skillRank
  577.         end
  578.     end
  579. end
  580. ret = tostring(herb..","..min)
  581. ]])
  582.     api_Macro(code)
  583.     local str = tostring(api_GetLua())
  584.     if str ~= "0" then
  585.         local start = string.find(str,',')
  586.         local shit = string.sub(str,1,start-1)
  587.         local shit2 = string.sub(str,start+1,string.len(str))
  588.         return tonumber(shit),tonumber(shit2)
  589.     else
  590.         return 0,0
  591.     end
  592. end
  593.  
  594. --- questing Lua related---
  595. function GetQuestNameById(id) 
  596.     local code = string.format([[/run ret = tostring(C_QuestLog.GetQuestInfo(%i))]],id)
  597.     api_Macro(code)
  598.     local str = api_GetLua()
  599.     return tostring(str)
  600. end
  601.  
  602. function HaveQuestToDoById(id)
  603.     local code = string.format([[/run ret = 0 if C_QuestLog.IsOnQuest(%i) then ret = 1 end ]],id)
  604.     api_Macro(code)
  605.     local str = api_GetLua()
  606.     if tonumber(str) == 1 then
  607.         return true
  608.     else
  609.         return false
  610.     end
  611. end
  612.  
  613. function QuestIsAbletoTurnInById(id)
  614.     local code = string.format([[/run ret = tostring(C_QuestLog.ReadyForTurnIn(%i))]],id)
  615.     api_Macro(code)
  616.     str = api_GetLua()
  617.     if str == "true" then
  618.         return true
  619.     else
  620.         return false
  621.     end    
  622. end
  623.  
  624. function QuestIsCompletedById(id)
  625.     local code = string.format([[/run ret = tostring(IsQuestComplete(%i))]],id)
  626.     api_Macro(code)
  627.     str = api_GetLua()
  628.     if str == "true" then
  629.         return true
  630.     else
  631.         return false
  632.     end    
  633. end
  634.  
  635. function QuestHadAlreadyBeenDoneById(id)
  636.     local code = string.format([[/run ret = tostring(C_QuestLog.IsQuestFlaggedCompleted(%i))]],id)
  637.     api_Macro(code)
  638.     str = api_GetLua()
  639.     if str == "true" then
  640.         return true
  641.     else
  642.         return false
  643.     end    
  644. end
  645.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement