Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 81.27 KB | None | 0 0
  1. LPCONFIG = {
  2. DISMOUNT = true,
  3. CAM = false,
  4. GINV = true,
  5. FINV = true,
  6. SINV = nil,
  7. DINV = true,
  8. SUMM = true,
  9. EBG = true,
  10. LBG = true,
  11. QBG = true,
  12. RBG = true,
  13. SBG = false,
  14. AQUE = true,
  15. LOOT = true,
  16. EPLATE = false,
  17. FPLATE = false,
  18. HPLATE = false,
  19. RIGHT = true,
  20. VIEWDIST = false,
  21. AUTOGREEN = 3,
  22. ZG = 1,
  23. NAXX = 0,
  24. AQ = 3,
  25. AQM = 3,
  26. DUEL = false,
  27. NOSAVE = false,
  28. GREEN = 2,
  29. SPECIALKEY = true,
  30. WORLDDUNGEON = false,
  31. WORLDRAID = false,
  32. WORLDBG = false,
  33. WORLDUNCHECK = nil,
  34. SPAM = true,
  35. SPAM_UNCOMMON = true,
  36. SPAM_RARE = true,
  37. SHIFTSPLIT = true,
  38. REZ = true,
  39. GOSSIP = true,
  40. SALVA = false
  41. }
  42.  
  43. BINDING_HEADER_LP_HEADER = "_LazyPig";
  44. BINDING_NAME_LOGOUT = "Logout";
  45. BINDING_NAME_UNSTUCK = "Unstuck";
  46. BINDING_NAME_RELOAD = "Reaload UI";
  47. BINDING_NAME_DUEL = "Target WSG EFC/Duel Request-Cancel";
  48. BINDING_NAME_WSGDROP = "Drop WSG Flag/Remove Slow Fall";
  49. BINDING_NAME_MENU = "_LazyPig Menu";
  50.  
  51. local Original_SelectGossipActiveQuest = SelectGossipActiveQuest;
  52. local Original_SelectGossipAvailableQuest = SelectGossipAvailableQuest;
  53. local Original_SelectActiveQuest = SelectActiveQuest;
  54. local Original_SelectAvailableQuest = SelectAvailableQuest;
  55. local OriginalLootFrame_OnEvent = LootFrame_OnEvent;
  56. local OriginalLootFrame_Update = LootFrame_Update;
  57. local OriginalUseContainerItem = UseContainerItem;
  58. local Original_SetItemRef = SetItemRef;
  59. local Original_ChatFrame_OnEvent = ChatFrame_OnEvent;
  60. local Original_StaticPopup_OnShow = StaticPopup_OnShow;
  61.  
  62. local roster_task_refresh = 0
  63. local last_click = 0
  64. local delayaction = 0
  65. local tradedelay = 0
  66. local bgstatus = 0
  67. local save_check = 0
  68. local save_time = 0
  69. local tmp_splitval = 1
  70. local passpopup = 0
  71.  
  72. local ctrltime = 0
  73. local alttime = 0
  74. local shift_time = 0
  75. local ctrlalttime = 0
  76. local ctrlshifttime = 0
  77. local altshifttime = 0
  78. local greenrolltime = 0
  79.  
  80. local timer_split = false
  81. local player_summon_confirm = false
  82. local player_summon_message = false
  83. local player_bg_confirm = false
  84. local player_bg_message = false
  85. local afk_active = false
  86. local dnd_active = false
  87. local duel_active = false
  88. local merchantstatus = false
  89. local tradestatus = false
  90. local mailstatus = false
  91. local auctionstatus = false
  92. local auctionbrowse = false
  93. local bankstatus = false
  94. local channelstatus = false
  95. local battleframe = false
  96. local wsgefc = nil
  97.  
  98. local WHITE = "|cffffffff"
  99. local RED = "|cffff0000"
  100. local GREEN = "|cff00ff00"
  101. local BLUE = "|cff00eeee"
  102.  
  103. local ScheduleButton = {}
  104. local ScheduleFunction = {}
  105. local ScheduleSplit = {}
  106. local QuestRecord = {}
  107. local ActiveQuest = {}
  108. local AvailableQuest = {}
  109. local GreySell = {}
  110. local ChatMessage = {{}, {}, INDEX = 1}
  111.  
  112. local ScheduleSplit = {}
  113. local ScheduleSplitCount = {}
  114.  
  115. ScheduleSplit.active = nil
  116. ScheduleSplit.sslot = {}
  117. ScheduleSplit.dbag = {}
  118. ScheduleSplit.dslot = {}
  119. ScheduleSplit.sbag = {}
  120. ScheduleSplit.count = {}
  121.  
  122. local LazyPigMenuObjects = {}
  123. local LazyPigMenuStrings = {
  124. [00]= "Need",
  125. [01]= "Greed",
  126. [02]= "Pass",
  127. [10]= "Need",
  128. [11]= "Greed",
  129. [12]= "Pass",
  130. [13]= "Need",
  131. [14]= "Greed",
  132. [15]= "Pass",
  133. [16]= "Need",
  134. [17]= "Greed",
  135. [18]= "Pass",
  136. [20]= "Dungeon",
  137. [21]= "Raid",
  138. [22]= "Battleground",
  139. [23]= "Mute Permanently",
  140. [30]= "GuildMates",
  141. [31]= "Friends",
  142. [32]= "Strangers",
  143. [33]= "Idle while in BG or Queue",
  144. [40]= "Show Friends",
  145. [41]= "Show Enemies",
  146. [42]= "Hide if Unchecked",
  147. [50]= "Enter BG",
  148. [51]= "Leave BG",
  149. [52]= "Queue BG",
  150. [53]= "Auto Release",
  151. [54]= "Leader Queue Announce",
  152. [55]= "Block BG Quest Sharing",
  153.  
  154. [60]= "Always",
  155. [61]= "Warrior Shield/Druid Bear",
  156.  
  157. [70]= "Players' Spam",
  158. [71]= "Uncommon Roll",
  159. [72]= "Rare Roll",
  160. [73]= "Poor-Common-Money Loot",
  161.  
  162.  
  163. [90]= "Summon Auto Accept",
  164. [91]= "Loot Window Auto Position",
  165. [92]= "Improved Right Click",
  166. [93]= "Easy Split/Merge (Shift+Right_Click)",
  167. [94]= "Extended Camera Distance",
  168. [95]= "Special Key Combinations",
  169. [96]= "Duel Auto Decline (Shift to ByPass)",
  170. [97]= "Instance Resurrection Accept OOC",
  171. [98]= "Gossip Auto Processing",
  172. [99]= "Character Auto-Save",
  173. [100]= "Auto Dismount",
  174. [101]= "Chat Spam Filter",
  175.  
  176. [103]= "Terrain distance while in Naxxramas",
  177. [110]= "Need",
  178. [111]= "Greed",
  179. [112]= "Pass",
  180. [113]= "Need",
  181. [114]= "Greed",
  182. [115]= "Pass",
  183. [116]= "Need",
  184. [117]= "Greed",
  185. [118]= "Pass",
  186. }
  187.  
  188. function LazyPig_OnLoad()
  189. SelectGossipActiveQuest = LazyPig_SelectGossipActiveQuest;
  190. SelectGossipAvailableQuest = LazyPig_SelectGossipAvailableQuest;
  191. SelectActiveQuest = LazyPig_SelectActiveQuest;
  192. SelectAvailableQuest = LazyPig_SelectAvailableQuest;
  193. LootFrame_OnEvent = LazyPig_LootFrame_OnEvent;
  194. LootFrame_Update = LazyPig_LootFrame_Update;
  195. UseContainerItem = LazyPig_UseContainerItem;
  196. SetItemRef = LazyPig_SetItemRef_OnEvent;
  197. ChatFrame_OnEvent = LazyPig_ChatFrame_OnEvent;
  198. StaticPopup_OnShow = LazyPig_StaticPopup_OnShow;
  199.  
  200. SLASH_LAZYPIG1 = "/lp";
  201. SLASH_LAZYPIG2 = "/lazypig";
  202. SlashCmdList["LAZYPIG"] = LazyPig_Command;
  203.  
  204. this:RegisterEvent("ADDON_LOADED");
  205. this:RegisterEvent("PLAYER_LOGIN")
  206. --this:RegisterEvent("PLAYER_ENTERING_WORLD")
  207. end
  208.  
  209. function LazyPig_Command()
  210. if LazyPigOptionsFrame:IsShown() then
  211. LazyPigOptionsFrame:Hide()
  212. LazyPigKeybindsFrame:Hide()
  213. else
  214. LazyPigOptionsFrame:Show()
  215. if getglobal("LazyPigOptionsFrameKeibindsButton"):GetText() == "Hide Keybinds" then
  216. LazyPigKeybindsFrame:Show()
  217. end
  218. end
  219. end
  220.  
  221. function LazyPig_OnUpdate()
  222. local current_time = GetTime();
  223. local shiftstatus = IsShiftKeyDown();
  224. local ctrlstatus = IsControlKeyDown();
  225. local altstatus = IsAltKeyDown();
  226.  
  227. if shiftstatus then
  228. shift_time = current_time
  229. elseif altstatus and not ctrlstatus and current_time > alttime then
  230. alttime = current_time + 0.75
  231. elseif not altstatus and ctrlstatus and current_time > ctrltime then
  232. ctrltime = current_time + 0.75
  233. elseif not altstatus and not ctrlstatus or altstatus and ctrlstatus then
  234. ctrltime = 0
  235. alttime = 0
  236. end
  237. if ctrlstatus and not shiftstatus and altstatus and current_time > ctrlalttime then
  238. ctrlalttime = current_time + 0.75
  239. elseif ctrlstatus and shiftstatus and not altstatus and current_time > ctrlshifttime then
  240. ctrlshifttime = current_time + 0.75
  241. elseif not ctrlstatus and shiftstatus and altstatus and current_time > altshifttime then
  242. altshifttime = current_time + 0.75
  243. elseif ctrlstatus and shiftstatus and altstatus then
  244. ctrlshifttime = 0
  245. ctrlalttime = 0
  246. altshifttime = 0
  247. end
  248.  
  249. if LPCONFIG.SPECIALKEY then
  250. --[[
  251. if shift_time == current_time then
  252. if not (UnitExists("target") and UnitIsUnit("player", "target")) then
  253. --
  254. elseif not battleframe then
  255. battleframe = current_time
  256. elseif (current_time - battleframe) > 3 then
  257. BattlefieldFrame:Show()
  258. battleframe = current_time
  259. end
  260. elseif battleframe then
  261. battleframe = nil
  262. end
  263. --]]
  264. if ctrlstatus and shiftstatus and altstatus and current_time > delayaction then
  265. delayaction = current_time + 1
  266. Logout();
  267. elseif ctrlstatus and not shiftstatus and altstatus and not auctionstatus and not mailstatus and current_time > delayaction then
  268. if tradestatus then
  269. AcceptTrade();
  270. elseif not tradestatus and UnitExists("target") and UnitIsPlayer("target") and UnitIsFriend("target", "player") and not UnitIsUnit("player", "target") and CheckInteractDistance("target", 2) and (current_time + 0.25) > ctrlalttime and current_time > tradedelay then
  271. InitiateTrade("target");
  272. delayaction = current_time + 2
  273. end
  274. elseif ctrlstatus and shiftstatus and not altstatus and UnitIsPlayer("target") and UnitIsFriend("target", "player") and current_time > delayaction and (current_time + 0.25) > ctrlshifttime then
  275. delayaction = current_time + 1.5
  276. FollowUnit("target");
  277. elseif not ctrlstatus and shiftstatus and altstatus and UnitIsPlayer("target") and current_time > delayaction and (current_time + 0.25) > altshifttime then
  278. delayaction = current_time + 1.5
  279. InspectUnit("target");
  280. end
  281.  
  282. if ctrlstatus and not shiftstatus and altstatus or passpopup > current_time then
  283. if current_time > delayaction and not LazyPig_BindLootOpen() and not LazyPig_RollLootOpen() and LazyPig_GreenRoll() then
  284. delayaction = current_time + 1
  285. elseif current_time > delayaction then
  286. for i=1,STATICPOPUP_NUMDIALOGS do
  287. local frame = getglobal("StaticPopup"..i)
  288. if frame:IsShown() then
  289. --DEFAULT_CHAT_FRAME:AddMessage(frame.which)
  290. if frame.which == "DEATH" and HasSoulstone() then
  291. getglobal("StaticPopup"..i.."Button2"):Click();
  292. if passpopup < current_time then delayaction = current_time + 0.5 end
  293. elseif frame.which ~= "CONFIRM_SUMMON" and frame.which ~= "CONFIRM_BATTLEFIELD_ENTRY" and frame.which ~= "CAMP" and frame.which ~= "AREA_SPIRIT_HEAL" then --and release and
  294. getglobal("StaticPopup"..i.."Button1"):Click();
  295. if passpopup < current_time then delayaction = current_time + 0.5 end
  296. end
  297. end
  298. end
  299. end
  300. end
  301.  
  302. if ctrlstatus and not shiftstatus and altstatus then
  303. if current_time > delayaction then
  304. if auctionstatus and AuctionFrameAuctions and AuctionFrameAuctions:IsVisible() and AuctionsCreateAuctionButton then
  305. ScheduleButtonClick(AuctionsCreateAuctionButton, 0);
  306. elseif auctionstatus and AuctionFrameBrowse and AuctionFrameBrowse:IsVisible() and BrowseBuyoutButton then
  307. ScheduleButtonClick(BrowseBuyoutButton, 0.55);
  308. elseif CT_MailFrame and CT_MailFrame:IsVisible() and CT_MailFrame.num > 0 and strlen(CT_MailNameEditBox:GetText()) > 0 and CT_Mail_AcceptSendFrameSendButton then
  309. ScheduleButtonClick(CT_Mail_AcceptSendFrameSendButton, 1.25);
  310. elseif GMailFrame and GMailFrame:IsVisible() and GMailFrame.num > 0 and strlen(GMailSubjectEditBox:GetText()) > 0 and GMailAcceptSendFrameSendButton then
  311. ScheduleButtonClick(GMailAcceptSendFrameSendButton, 1.25);
  312. elseif mailstatus and SendMailFrame and SendMailFrame:IsVisible() and SendMailMailButton then
  313. ScheduleButtonClick(SendMailMailButton, 0);
  314. elseif mailstatus and OpenMailFrame and OpenMailFrame:IsVisible() then
  315. if OpenMailFrame.money and OpenMailMoneyButton then
  316. ScheduleButtonClick(OpenMailMoneyButton, 0);
  317. elseif OpenMailPackageButton then
  318. ScheduleButtonClick(OpenMailPackageButton, 0);
  319. end
  320. end
  321. end
  322. LazyPig_AutoLeaveBG();
  323. elseif not ctrlstatus and shiftstatus and altstatus and current_time > delayaction then
  324. if auctionstatus and AuctionFrameBrowse and AuctionFrameBrowse:IsVisible() and BrowseBidButton then
  325. ScheduleButtonClick(BrowseBidButton, 0.55);
  326. end
  327. end
  328. end
  329.  
  330. if merchantstatus and shiftstatus and current_time > last_click and not CursorHasItem() then
  331. last_click = current_time + 0.25
  332. LazyPig_GreySellRepair();
  333. end
  334.  
  335. if shiftstatus or altstatus then
  336. if QuestFrameDetailPanel:IsVisible() then
  337. AcceptQuest();
  338. end
  339. elseif QuestRecord["details"] and not shiftstatus then
  340. LazyPig_RecordQuest();
  341. end
  342.  
  343. if not afk_active and player_bg_confirm then
  344. Check_Bg_Status();
  345. end
  346.  
  347. if bgstatus ~= 0 and (bgstatus + 0.5) > current_time then
  348. bgstatus = 0
  349. Check_Bg_Status()
  350. LazyPig_AutoLeaveBG()
  351. end
  352.  
  353. if(current_time - roster_task_refresh) > 29 then
  354. roster_task_refresh = current_time
  355. GuildRoster();
  356. ChatSpamClean();
  357. end
  358.  
  359. if save_time ~= 0 and (current_time - save_time) > 3 and not GetBattlefieldWinner() and not UnitAffectingCombat("player") then
  360. save_check = current_time
  361. save_time = 0
  362. SaveData();
  363. end
  364.  
  365. if player_summon_confirm then
  366. LazyPig_AutoSummon();
  367. end
  368.  
  369. LazyPig_CheckSalvation();
  370. ScheduleButtonClick();
  371. ScheduleFunctionLaunch();
  372. ScheduleItemSplit();
  373. LazyPig_WatchSplit();
  374.  
  375. end
  376.  
  377. function ScheduleButtonClick(button, delay)
  378. local current_time = GetTime()
  379. if button and not ScheduleButton[button] then
  380. delay = delay or 0.75
  381. ScheduleButton[button] = current_time + delay
  382. else
  383. for blockindex,blockmatch in pairs(ScheduleButton) do
  384. if current_time < delayaction then
  385. ScheduleButton[blockindex] = nil
  386. elseif current_time >= blockmatch then
  387. blockindex:Click()
  388. passpopup = current_time + 0.75
  389. ScheduleButton[blockindex] = nil
  390. end
  391. end
  392. end
  393. end
  394.  
  395. function ScheduleFunctionLaunch(func, delay)
  396. local current_time = GetTime()
  397. if func and not ScheduleFunction[func] then
  398. delay = delay or 0.75
  399. ScheduleFunction[func] = current_time + delay
  400. else
  401. for blockindex,blockmatch in pairs(ScheduleFunction) do
  402. if current_time >= blockmatch then
  403. blockindex()
  404. ScheduleFunction[blockindex] = nil
  405. end
  406. end
  407. end
  408. end
  409.  
  410. function LazyPig_OnEvent(event)
  411. if (event == "ADDON_LOADED") and (arg1 == "_LazyPig") then
  412. local LP_TITLE = GetAddOnMetadata("_LazyPig", "Title")
  413. local LP_VERSION = GetAddOnMetadata("_LazyPig", "Version")
  414. local LP_AUTHOR = GetAddOnMetadata("_LazyPig", "Author")
  415.  
  416. DEFAULT_CHAT_FRAME:AddMessage(LP_TITLE .. " v" .. LP_VERSION .. " by " .."|cffFF0066".. LP_AUTHOR .."|cffffffff".. " loaded, type".."|cff00eeee".." /lp".."|cffffffff for options")
  417. elseif (event == "PLAYER_LOGIN") then
  418. --if (event == "PLAYER_ENTERING_WORLD") then
  419. -- this:UnregisterEvent("PLAYER_ENTERING_WORLD")
  420. this:RegisterEvent("CHAT_MSG")
  421. this:RegisterEvent("CHAT_MSG_SYSTEM")
  422. this:RegisterEvent("PARTY_INVITE_REQUEST")
  423. this:RegisterEvent("CONFIRM_SUMMON")
  424. this:RegisterEvent("RESURRECT_REQUEST")
  425. this:RegisterEvent("UPDATE_BATTLEFIELD_STATUS")
  426. this:RegisterEvent("CHAT_MSG_BG_SYSTEM_ALLIANCE")
  427. this:RegisterEvent("CHAT_MSG_BG_SYSTEM_HORDE")
  428. this:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
  429. this:RegisterEvent("BATTLEFIELDS_SHOW")
  430. this:RegisterEvent("GOSSIP_SHOW")
  431. this:RegisterEvent("QUEST_GREETING")
  432. this:RegisterEvent("UI_ERROR_MESSAGE")
  433. this:RegisterEvent("CHAT_MSG_LOOT")
  434. --this:RegisterEvent("CHAT_MSG_MONEY")
  435. this:RegisterEvent("QUEST_PROGRESS")
  436. this:RegisterEvent("QUEST_COMPLETE")
  437. this:RegisterEvent("START_LOOT_ROLL")
  438. this:RegisterEvent("DUEL_REQUESTED")
  439. this:RegisterEvent("MERCHANT_SHOW")
  440. this:RegisterEvent("MERCHANT_CLOSED")
  441. this:RegisterEvent("TRADE_SHOW")
  442. this:RegisterEvent("TRADE_CLOSED")
  443. this:RegisterEvent("MAIL_SHOW")
  444. this:RegisterEvent("MAIL_CLOSED")
  445. this:RegisterEvent("AUCTION_HOUSE_SHOW")
  446. this:RegisterEvent("AUCTION_HOUSE_CLOSED")
  447. this:RegisterEvent("BANKFRAME_OPENED")
  448. this:RegisterEvent("BANKFRAME_CLOSED")
  449. this:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  450. this:RegisterEvent("PLAYER_UNGHOST")
  451. this:RegisterEvent("PLAYER_DEAD")
  452. this:RegisterEvent("PLAYER_AURAS_CHANGED")
  453. this:RegisterEvent("UPDATE_BONUS_ACTIONBAR")
  454. this:RegisterEvent("UNIT_INVENTORY_CHANGED")
  455. this:RegisterEvent("UI_INFO_MESSAGE")
  456.  
  457. LazyPigOptionsFrame = LazyPig_CreateOptionsFrame()
  458. LazyPigKeybindsFrame = LazyPig_CreateKeybindsFrame()
  459.  
  460. LazyPig_CheckSalvation();
  461. Check_Bg_Status();
  462. LazyPig_AutoLeaveBG();
  463. LazyPig_AutoSummon();
  464. ScheduleFunctionLaunch(LazyPig_ZoneCheck, 6);
  465. ScheduleFunctionLaunch(LazyPig_ZoneCheck2, 7);
  466. ScheduleFunctionLaunch(LazyPig_RefreshNameplates, 0.25);
  467. MailtoCheck();
  468.  
  469.  
  470.  
  471. if LPCONFIG.CAM then SetCVar("cameraDistanceMax",50) end
  472. if LPCONFIG.LOOT then UIPanelWindows["LootFrame"] = nil end
  473. QuestRecord["index"] = 0
  474.  
  475. elseif (LPCONFIG.SALVA and (event == "PLAYER_AURAS_CHANGED" or event == "UPDATE_BONUS_ACTIONBAR" and LazyPig_PlayerClass("Druid", "player") or event == "UNIT_INVENTORY_CHANGED")) then
  476. LazyPig_CheckSalvation()
  477.  
  478. elseif(event == "DUEL_REQUESTED") then
  479. duel_active = true
  480. if LPCONFIG.DUEL and not IsShiftKeyDown() then --dnd_active and
  481. duel_active = nil
  482. CancelDuel()
  483. UIErrorsFrame:AddMessage(arg1.." - Duel Cancelled")
  484. end
  485.  
  486. elseif(event == "PLAYER_DEAD") then
  487. if LPCONFIG.RBG and LazyPig_BG() then
  488. RepopMe();
  489. end
  490.  
  491. elseif(event == "ZONE_CHANGED_NEW_AREA" or event == "PLAYER_UNGHOST") then
  492. if event == "ZONE_CHANGED_NEW_AREA" then
  493. tradestatus = nil
  494. mailstatus = nil
  495. auctionstatus = nil
  496. bankstatus = nil
  497. wsgefc = nil
  498. end
  499.  
  500. ScheduleFunctionLaunch(LazyPig_RefreshNameplates, 0.25)
  501. ScheduleFunctionLaunch(LazyPig_ZoneCheck, 5)
  502. ScheduleFunctionLaunch(LazyPig_ZoneCheck, 6)
  503. --DEFAULT_CHAT_FRAME:AddMessage(event);
  504.  
  505. elseif(event == "BANKFRAME_OPENED") then
  506. bankstatus = true
  507. tmp_splitval = 1
  508.  
  509. elseif(event == "BANKFRAME_CLOSED") then
  510. bankstatus = false
  511. LazyPig_EndSplit()
  512.  
  513. elseif(event == "AUCTION_HOUSE_SHOW") then
  514. auctionstatus = true
  515. auctionbrowse = nil
  516. tmp_splitval = 1
  517.  
  518. elseif(event == "AUCTION_HOUSE_CLOSED") then
  519. auctionstatus = false
  520. LazyPig_EndSplit()
  521.  
  522. elseif(event == "MAIL_SHOW") then
  523. mailstatus = true
  524. tmp_splitval = 1
  525.  
  526. elseif(event == "MAIL_CLOSED") then
  527. mailstatus = false
  528. LazyPig_EndSplit()
  529.  
  530. elseif(event == "MERCHANT_SHOW") then
  531. merchantstatus = true
  532. GreySell = {}
  533.  
  534. elseif(event == "MERCHANT_CLOSED") then
  535. merchantstatus = false
  536.  
  537. elseif(event == "TRADE_SHOW") then
  538. tradestatus = true
  539. tmp_splitval = 1
  540.  
  541. elseif(event == "TRADE_CLOSED") then
  542. tradedelay = GetTime() + 1
  543. tradestatus = false
  544. LazyPig_EndSplit()
  545.  
  546. elseif(event == "START_LOOT_ROLL") then
  547. LazyPig_RaidLoots(arg1)
  548. LazyPig_GreenAutoRoll(arg1)
  549.  
  550. elseif(event == "CHAT_MSG_LOOT") then
  551. if (string.find(arg1 ,"You won") or string.find(arg1 ,"You receive")) and (string.find(arg1 ,"cffa335e") or string.find(arg1, "cff0070d") or string.find(arg1, "cffff840")) and not string.find(arg1 ,"Bijou") and not string.find(arg1 ,"Idol") and not string.find(arg1 ,"Shard") then
  552. save_time = GetTime()
  553. end
  554.  
  555. elseif(event == "UI_ERROR_MESSAGE") then
  556. if(string.find(arg1, "mounted") or string.find(arg1, "while silenced")) and LPCONFIG.DISMOUNT then
  557. UIErrorsFrame:Clear()
  558. LazyPig_Dismount()
  559. end
  560. elseif (event == "UI_INFO_MESSAGE") then
  561. if string.find(arg1 ,"Duel cancelled") then
  562. duel_active = nil
  563. end
  564. elseif (event == "CHAT_MSG_SYSTEM") then
  565. if arg1 == CLEARED_DND or arg1 == CLEARED_AFK then
  566. dnd_active = false
  567. afk_active = false
  568. Check_Bg_Status()
  569.  
  570. elseif(string.find(arg1, string.sub(MARKED_DND, 1, string.len(MARKED_DND) -3))) then
  571. afk_active = false
  572. dnd_active = true
  573. --if LPCONFIG.DUEL then CancelDuel() UIErrorsFrame:AddMessage("Duel Decline Atctive - DND") end
  574.  
  575. elseif(string.find(arg1, string.sub(MARKED_AFK, 1, string.len(MARKED_AFK) -2))) then
  576. afk_active = true
  577. if LPCONFIG.EBG and not LazyPig_Raid() and not LazyPig_Dungeon() then UIErrorsFrame:AddMessage("Auto Join BG Inactive - AFK") end
  578.  
  579. elseif string.find(arg1, "There is no such command") and (GetTime() - save_check) < 1 then
  580. LPCONFIG.NOSAVE = GetRealmName()
  581. DEFAULT_CHAT_FRAME:AddMessage("LazyPig:"..RED.."Auto Save Disabled - Command not Supported");
  582.  
  583. elseif LPCONFIG.AQUE and string.find(arg1 ,"Queued") and UnitIsPartyLeader("player") then
  584. if UnitInRaid("player") then
  585. SendChatMessage(arg1, "RAID");
  586. elseif GetNumPartyMembers() > 1 then
  587. SendChatMessage(arg1, "PARTY");
  588. end
  589.  
  590. elseif string.find(arg1 ,"completed.") then
  591. LazyPig_FixQuest(arg1)
  592. QuestRecord["progress"] = nil
  593.  
  594. elseif string.find(arg1 ,"Duel starting:") or string.find(arg1 ,"requested a duel") then
  595. duel_active = true
  596. elseif string.find(arg1 ,"in a duel") then
  597. duel_active = nil
  598. end
  599.  
  600. elseif(event == "QUEST_GREETING") then
  601. ActiveQuest = {}
  602. AvailableQuest = {}
  603. for i=1, GetNumActiveQuests() do
  604. ActiveQuest[i] = GetActiveTitle(i).." "..GetActiveLevel(i)
  605. end
  606. for i=1, GetNumAvailableQuests() do
  607. AvailableQuest[i] = GetAvailableTitle(i).." "..GetAvailableLevel(i)
  608. end
  609.  
  610. LazyPig_ReplyQuest(event);
  611.  
  612. --DEFAULT_CHAT_FRAME:AddMessage("active_: "..table.getn(ActiveQuest))
  613. --DEFAULT_CHAT_FRAME:AddMessage("available_: "..table.getn(AvailableQuest))
  614.  
  615. elseif(event == "GOSSIP_SHOW") then
  616. local GossipOptions = {};
  617. local dsc = nil
  618. local gossipnr = nil
  619. local gossipbreak = nil
  620. local processgossip = IsShiftKeyDown() or LPCONFIG.GOSSIP
  621.  
  622. dsc,GossipOptions[1],_,GossipOptions[2],_,GossipOptions[3],_,GossipOptions[4],_,GossipOptions[5] = GetGossipOptions()
  623.  
  624. ActiveQuest = LazyPig_ProcessQuests(GetGossipActiveQuests())
  625. AvailableQuest = LazyPig_ProcessQuests(GetGossipAvailableQuests())
  626.  
  627. if QuestRecord["qnpc"] ~= UnitName("target") then
  628. QuestRecord["index"] = 0
  629. QuestRecord["qnpc"] = UnitName("target")
  630. end
  631.  
  632. if table.getn(AvailableQuest) ~= 0 or table.getn(ActiveQuest) ~= 0 then
  633. gossipbreak = true
  634. end
  635.  
  636. --DEFAULT_CHAT_FRAME:AddMessage("gossip: "..table.getn(GossipOptions))
  637. --DEFAULT_CHAT_FRAME:AddMessage("active: "..table.getn(ActiveQuest))
  638. --DEFAULT_CHAT_FRAME:AddMessage("available: "..table.getn(AvailableQuest))
  639.  
  640. for i=1, getn(GossipOptions) do
  641. if GossipOptions[i] == "binder" then
  642. local bind = GetBindLocation();
  643. if not (bind == GetSubZoneText() or bind == GetZoneText() or bind == GetRealZoneText() or bind == GetMinimapZoneText()) then
  644. gossipbreak = true
  645. end
  646. elseif gossipnr then
  647. gossipbreak = true
  648. elseif (GossipOptions[i] == "trainer" or GossipOptions[i] == "vendor" and processgossip or GossipOptions[i] == "battlemaster" and (LPCONFIG.QBG or processgossip) or GossipOptions[i] == "gossip" and (IsAltKeyDown() or IsShiftKeyDown() or string.find(dsc, "Teleport me to the Molten Core") and processgossip)) then
  649. gossipnr = i
  650. elseif GossipOptions[i] == "taxi" and processgossip then
  651. gossipnr = i
  652. LazyPig_Dismount();
  653. end
  654. end
  655.  
  656. if not gossipbreak and gossipnr then
  657. SelectGossipOption(gossipnr);
  658. else
  659. LazyPig_ReplyQuest(event);
  660. end
  661.  
  662. elseif(event == "QUEST_PROGRESS" or event == "QUEST_COMPLETE") then
  663. LazyPig_ReplyQuest(event);
  664.  
  665. elseif (event == "CHAT_MSG_BG_SYSTEM_ALLIANCE" or event == "CHAT_MSG_BG_SYSTEM_HORDE") then
  666. --DEFAULT_CHAT_FRAME:AddMessage(event.." - "..arg1);
  667. LazyPig_Track_EFC(arg1)
  668.  
  669. elseif(event == "UPDATE_BATTLEFIELD_STATUS" and not afk_active or event == "CHAT_MSG_BG_SYSTEM_NEUTRAL" and arg1 and string.find(arg1, "wins!")) then
  670. bgstatus = GetTime()
  671.  
  672. elseif(event == "BATTLEFIELDS_SHOW") then
  673. LazyPig_QueueBG();
  674.  
  675. elseif (event == "CONFIRM_SUMMON") then
  676. LazyPig_AutoSummon();
  677.  
  678. elseif(event == "PARTY_INVITE_REQUEST") then
  679. local check1 = not LPCONFIG.DINV or LPCONFIG.DINV and not LazyPig_BG() and not LazyPig_Queue()
  680. local check2 = LPCONFIG.GINV and IsGuildMate(arg1) or LPCONFIG.FINV and IsFriend(arg1) or not IsGuildMate(arg1) and not IsFriend(arg1) and LPCONFIG.SINV
  681. if check1 and check2 then
  682. AcceptGroupInvite();
  683. end
  684. elseif(event == "RESURRECT_REQUEST" and LPCONFIG.REZ) then
  685. UIErrorsFrame:AddMessage(arg1.." - Resurrection")
  686. TargetByName(arg1, true)
  687. if GetCorpseRecoveryDelay() == 0 and (LazyPig_Raid() or LazyPig_Dungeon() or LazyPig_BG()) and UnitIsPlayer("target") and UnitIsVisible("target") and not UnitAffectingCombat("target") then
  688. AcceptResurrect()
  689. StaticPopup_Hide("RESURRECT_NO_TIMER");
  690. StaticPopup_Hide("RESURRECT_NO_SICKNESS");
  691. StaticPopup_Hide("RESURRECT");
  692. end
  693. TargetLastTarget();
  694. end
  695. --DEFAULT_CHAT_FRAME:AddMessage(event);
  696. end
  697.  
  698. function LazyPig_StaticPopup_OnShow()
  699. if this.which == "QUEST_ACCEPT" and LazyPig_BG() and LPCONFIG.SBG then
  700. UIErrorsFrame:Clear();
  701. UIErrorsFrame:AddMessage("Quest Blocked Successfully");
  702. this:Hide();
  703.  
  704. else
  705. Original_StaticPopup_OnShow();
  706. end
  707. end
  708.  
  709. function MailtoCheck(msg)
  710. if MailTo_Option then -- to avoid conflicts with mailto addon
  711. local disable = LPCONFIG.RIGHT or LPCONFIG.SHIFT
  712. MailTo_Option.noshift = disable
  713. MailTo_Option.noauction = disable
  714. MailTo_Option.notrade = disable
  715. MailTo_Option.noclick = disable
  716. if msg then DEFAULT_CHAT_FRAME:AddMessage("_LazyPig: Warning Improved Right Click and Easy Split/Merge features may override MailTo addon functionality !") end
  717. end
  718. end
  719.  
  720. function LazyPig_Text(txt)
  721. if txt then
  722. LazyPigText:SetTextColor(0, 1, 0)
  723. LazyPigText:SetText(txt)
  724. LazyPigText:Show()
  725. else
  726. LazyPigText:SetText()
  727. LazyPigText:Hide()
  728. end
  729. end
  730.  
  731. --code taken from quickloot
  732. local function LazyPig_ItemUnderCursor()
  733. if LPCONFIG.LOOT then
  734. local index;
  735. local x, y = GetCursorPosition();
  736. local scale = LootFrame:GetEffectiveScale();
  737. x = x / scale;
  738. y = y / scale;
  739. LootFrame:ClearAllPoints();
  740. for index = 1, LOOTFRAME_NUMBUTTONS, 1 do
  741. local button = getglobal("LootButton"..index);
  742. if( button:IsVisible() ) then
  743. x = x - 42;
  744. y = y + 56 + (40 * index);
  745. LootFrame:SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT", x, y);
  746. return;
  747. end
  748. end
  749. if LootFrameDownButton:IsVisible() then
  750. x = x - 158;
  751. y = y + 223;
  752. else
  753. if GetNumLootItems() == 0 then
  754. HideUIPanel(LootFrame);
  755. return
  756. end
  757. x = x - 173;
  758. y = y + 25;
  759. end
  760. LootFrame:SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT", x, y);
  761. end
  762. end
  763.  
  764. function LazyPig_LootFrame_OnEvent(event)
  765. OriginalLootFrame_OnEvent(event);
  766. if(event == "LOOT_SLOT_CLEARED") then
  767. LazyPig_ItemUnderCursor();
  768. end
  769. end
  770.  
  771. function LazyPig_LootFrame_Update()
  772. OriginalLootFrame_Update();
  773. LazyPig_ItemUnderCursor();
  774. end
  775. function IsFriend(name)
  776. for i = 1, GetNumFriends() do
  777. if GetFriendInfo(i) == name then
  778. return true
  779. end
  780. end
  781. return nil
  782. end
  783.  
  784. function IsGuildMate(name)
  785. if IsInGuild() then
  786. local ngm=GetNumGuildMembers()
  787. for i=1, ngm do
  788. n, rank, rankIndex, level, class, zone, note, officernote, online, status, classFileName = GetGuildRosterInfo(i);
  789. if strlower(n) == strlower(name) then
  790. return true
  791. end
  792. end
  793. end
  794. return nil
  795. end
  796.  
  797. function AcceptGroupInvite()
  798. AcceptGroup();
  799. StaticPopup_Hide("PARTY_INVITE");
  800. PlaySoundFile("Sound\\Doodad\\BellTollNightElf.wav");
  801. UIErrorsFrame:AddMessage("Group Auto Accept");
  802. end
  803.  
  804. function LazyPig_AutoSummon()
  805. local keyenter = IsAltKeyDown() and IsControlKeyDown() and not tradestatus and not mailstatus and not auctionstatus and GetTime() > delayaction and GetTime() > (tradedelay + 0.5)
  806. if LPCONFIG.SUMM then
  807. local expireTime = GetSummonConfirmTimeLeft()
  808. if not player_summon_message and expireTime ~= 0 then
  809. player_summon_message = true
  810. player_summon_confirm = true
  811. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Auto Summon in "..math.floor(expireTime).."s", 1.0, 1.0, 0.0);
  812.  
  813. elseif expireTime <= 3 or keyenter then
  814. player_summon_confirm = false
  815. player_summon_message = false
  816.  
  817. for i=1,STATICPOPUP_NUMDIALOGS do
  818. local frame = getglobal("StaticPopup"..i)
  819. if frame.which == "CONFIRM_SUMMON" and frame:IsShown() then
  820. ConfirmSummon();
  821. delayaction = GetTime() + 0.75
  822. StaticPopup_Hide("CONFIRM_SUMMON");
  823. end
  824. end
  825. elseif expireTime == 0 then
  826. player_summon_confirm = false
  827. player_summon_message = false
  828. end
  829. end
  830. end
  831.  
  832. function Check_Bg_Status()
  833. local bgStatus = {};
  834. local player_bg_active = false
  835. local player_bg_request = false
  836.  
  837. for i=1, MAX_BATTLEFIELD_QUEUES do
  838. local status, mapName, instanceID = GetBattlefieldStatus(i);
  839. bgStatus[i] = {};
  840. bgStatus[i]["status"] = status;
  841. bgStatus[i]["map"] = mapName;
  842. bgStatus[i]["id"] = instanceID;
  843.  
  844. if(status == "confirm" ) then
  845. player_bg_request = true
  846. elseif((status == "active") and not (mapName == "Eastern Kingdoms") and not (mapName == "Kalimdor")) then
  847. player_bg_active = true
  848. end
  849. end
  850.  
  851. player_bg_confirm = player_bg_request
  852.  
  853. if(player_bg_message and not player_bg_active and not player_bg_request) then
  854. player_bg_message = false
  855. end
  856.  
  857. if(not player_bg_active and player_bg_request) then
  858. local index = 1
  859. while bgStatus[index] do
  860. if(bgStatus[index]["status"] == "confirm" ) then
  861. LazyPig_AutoJoinBG(index, bgStatus[index]["map"]);
  862. end
  863. index = index + 1
  864. end
  865. end
  866. end
  867.  
  868. function LazyPig_QueueBG()
  869. if LPCONFIG.QBG then
  870. for i=1, MAX_BATTLEFIELD_QUEUES do
  871. local status = GetBattlefieldStatus(i);
  872. if IsShiftKeyDown() and (status == "queued" or status == "confirm") then
  873. AcceptBattlefieldPort(i,nil);
  874. end
  875. end
  876. if (GetNumPartyMembers() > 0 or GetNumRaidMembers() > 0) and IsPartyLeader() then
  877. JoinBattlefield(0,1);
  878. else
  879. JoinBattlefield(0);
  880. end
  881. ClearTarget();
  882. BattlefieldFrameCancelButton:Click()
  883. end
  884. end
  885.  
  886. function LazyPig_AutoJoinBG(index, map_name)
  887. local keyenter = IsAltKeyDown() and IsControlKeyDown() and not tradestatus and not mailstatus and not auctionstatus and GetTime() > delayaction and GetTime() > (tradedelay + 0.5)
  888. if LPCONFIG.EBG or keyenter then
  889. local expireTime = GetBattlefieldPortExpiration(index)/1000
  890. expireTime = math.floor(expireTime);
  891. if not player_bg_message and expireTime > 3 and GetTime() > delayaction then
  892. player_bg_message = true
  893. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Auto Join ".. map_name.." in "..expireTime.."s", 1.0, 1.0, 0.0)
  894.  
  895. elseif expireTime <= 3 or keyenter then
  896. AcceptBattlefieldPort(index, true);
  897. StaticPopup_Hide("CONFIRM_BATTLEFIELD_ENTRY")
  898. delayaction = GetTime() + 0.75
  899. if player_bg_message then
  900. player_bg_message = false
  901. end
  902. end
  903. end
  904. end
  905.  
  906. function LazyPig_AutoLeaveBG()
  907. local keyenter = IsAltKeyDown() and IsControlKeyDown()
  908. if LPCONFIG.LBG or keyenter then
  909. local bg_winner = GetBattlefieldWinner()
  910. local winner_name = "Alliance"
  911. if bg_winner ~= nil then
  912. save_time = GetTime() + 15
  913. if bg_winner == 0 then winner_name = "Horde" end
  914. UIErrorsFrame:Clear();
  915. UIErrorsFrame:AddMessage(winner_name.." Wins");
  916. LeaveBattlefield();
  917. end
  918. end
  919. end
  920.  
  921. function SaveData()
  922. if LPCONFIG.NOSAVE ~= GetRealmName() then
  923. SendChatMessage(".save", "SAY");
  924. UIErrorsFrame:Clear()
  925. UIErrorsFrame:AddMessage("Character Saved");
  926. end
  927. end
  928.  
  929. function LazyPig_BagReturn(find)
  930. local link = nil
  931. local bagslots = nil
  932. for bag=0,NUM_BAG_FRAMES do
  933. bagslots = GetContainerNumSlots(bag)
  934. if bagslots and bagslots > 0 then
  935. for slot=1,bagslots do
  936. link = GetContainerItemLink(bag, slot)
  937. if not find and not link or find and link and string.find(link, find) then
  938. return bag, slot
  939. end
  940. end
  941. end
  942. end
  943. return nil
  944. end
  945.  
  946. function LazyPig_ZGRoll(id)
  947. RollReturn = function()
  948. local txt = ""
  949. if LPCONFIG.ZG == 1 then
  950. txt = "NEED"
  951. elseif LPCONFIG.ZG == 2 then
  952. txt = "GREED"
  953. elseif LPCONFIG.ZG == 0 then
  954. txt = "PASS"
  955. end
  956. return txt
  957. end
  958. if LPCONFIG.ZG then
  959. local _, name, _, quality = GetLootRollItemInfo(id);
  960. if string.find(name ,"Hakkari Bijou") or string.find(name ,"Coin") then
  961. RollOnLoot(id, LPCONFIG.ZG);
  962. local _, _, _, hex = GetItemQualityColor(quality)
  963. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Auto "..hex..RollReturn().." "..GetLootRollItemLink(id))
  964. return
  965. end
  966. end
  967. end
  968.  
  969. function LazyPig_NAXXRoll(id)
  970. RollReturn = function()
  971. local txt = ""
  972. if LPCONFIG.NAXX == 1 then
  973. txt = "NEED"
  974. elseif LPCONFIG.NAXX == 2 then
  975. txt = "GREED"
  976. elseif LPCONFIG.NAXX == 0 then
  977. txt = "PASS"
  978. end
  979. return txt
  980. end
  981. if LPCONFIG.NAXX then
  982. local _, name, _, quality = GetLootRollItemInfo(id);
  983. if string.find(name ,"Wartorn") then
  984. RollOnLoot(id, LPCONFIG.NAXX);
  985. local _, _, _, hex = GetItemQualityColor(quality)
  986. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Auto "..hex..RollReturn().." "..GetLootRollItemLink(id))
  987. return
  988. end
  989. end
  990. end
  991.  
  992. function LazyPig_AQRoll(id)
  993. RollReturn = function()
  994. local txt = ""
  995. if LPCONFIG.AQ == 1 then
  996. txt = "NEED"
  997. elseif LPCONFIG.AQ == 2 then
  998. txt = "GREED"
  999. elseif LPCONFIG.AQ == 0 then
  1000. txt = "PASS"
  1001. end
  1002. return txt
  1003. end
  1004. if LPCONFIG.AQ then
  1005. local _, name, _, quality = GetLootRollItemInfo(id);
  1006. if string.find(name ,"Stone Scarab") or string.find(name ,"Silver Scarab") or string.find(name ,"Ivory Scarab") or string.find(name ,"Gold Scarab") or string.find(name ,"Crystal Scarab") or string.find(name ,"Bone Scarab") or string.find(name ,"Bronze Scarab") or string.find(name ,"Clay Scarab") or string.find(name ,"Idol of Night") or string.find(name ,"Idol of Death") or string.find(name ,"Idol of the Sage") or string.find(name ,"Idol of Strife") or string.find(name ,"Idol of Rebirth") or string.find(name ,"Idol of War") or string.find(name ,"Idol of the Sun") or string.find(name ,"Idol of Life") or string.find(name ,"Vermillion Idol") or string.find(name ,"Obsidian Idol") or string.find(name ,"Amber Idol") or string.find(name ,"Jasper Idol") or string.find(name ,"Azure Idol") or string.find(name ,"Alabaster Idol") or string.find(name ,"Lambent Idol") or string.find(name ,"Onyx Idol") then
  1007. RollOnLoot(id, LPCONFIG.AQ);
  1008. local _, _, _, hex = GetItemQualityColor(quality)
  1009. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Auto "..hex..RollReturn().." "..GetLootRollItemLink(id))
  1010. return
  1011. end
  1012. end
  1013. end
  1014.  
  1015. function LazyPig_AQmountRoll(id)
  1016. RollReturn = function()
  1017. local txt = ""
  1018. if LPCONFIG.AQM == 1 then
  1019. txt = "NEED"
  1020. elseif LPCONFIG.AQM == 2 then
  1021. txt = "GREED"
  1022. elseif LPCONFIG.AQM == 0 then
  1023. txt = "PASS"
  1024. end
  1025. return txt
  1026. end
  1027. if LPCONFIG.AQM then
  1028. local _, name, _, quality = GetLootRollItemInfo(id);
  1029. if string.find(name ,"Blue Qiraji") or string.find(name ,"Green Qiraji") or string.find(name ,"Yellow Qiraji") then
  1030. RollOnLoot(id, LPCONFIG.AQM);
  1031. local _, _, _, hex = GetItemQualityColor(quality)
  1032. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Auto "..hex..RollReturn().." "..GetLootRollItemLink(id))
  1033. return
  1034. end
  1035.  
  1036. end
  1037. end
  1038.  
  1039. function LazyPig_MCRoll(id)
  1040. RollReturn = function()
  1041. local txt = ""
  1042. if LPCONFIG.MC == 1 then
  1043. txt = "NEED"
  1044. elseif LPCONFIG.MC == 2 then
  1045. txt = "GREED"
  1046. elseif LPCONFIG.MC == 0 then
  1047. txt = "PASS"
  1048. end
  1049. return txt
  1050. end
  1051. if LPCONFIG.MC then
  1052. local _, name, _, quality = GetLootRollItemInfo(id);
  1053. if string.find(name, "Fiery Core") or string.find(name, "Lava Core") then
  1054. RollOnLoot(id, LPCONFIG.MC);
  1055. local _, _, _, hex = GetItemQualityColor(quality)
  1056. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Auto "..hex..RollReturn().." "..GetLootRollItemLink(id))
  1057. return
  1058. end
  1059. end
  1060. end
  1061.  
  1062. function LazyPig_GreenAutoRoll(id)
  1063. RollReturn = function()
  1064. local txt = ""
  1065. if LPCONFIG.AUTOGREEN == 1 then
  1066. txt = "NEED"
  1067. elseif LPCONFIG.AUTOGREEN == 2 then
  1068. txt = "GREED"
  1069. elseif LPCONFIG.AUTOGREEN == 0 then
  1070. txt = "PASS"
  1071. end
  1072. return txt
  1073. end
  1074. if LPCONFIG.AUTOGREEN then
  1075. local _, name, _, quality = GetLootRollItemInfo(id);
  1076. if quality == 2 then
  1077. if not string.find(name ,"Coin") and not string.find(name ,"Stone Scarab") and not string.find(name ,"Silver Scarab") and not string.find(name ,"Ivory Scarab") and not string.find(name ,"Gold Scarab") and not string.find(name ,"Crystal Scarab") and not string.find(name ,"Bone Scarab") and not string.find(name ,"Bronze Scarab") and not string.find(name ,"Clay Scarab") then
  1078. RollOnLoot(id, LPCONFIG.AUTOGREEN);
  1079. local _, _, _, hex = GetItemQualityColor(quality)
  1080. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Auto "..hex..RollReturn().." "..GetLootRollItemLink(id))
  1081. return
  1082. end
  1083. end
  1084. end
  1085. end
  1086.  
  1087. function LazyPig_GreenRoll()
  1088. RollReturn = function()
  1089. local txt = ""
  1090. if LPCONFIG.GREEN == 1 then
  1091. txt = "NEED"
  1092. elseif LPCONFIG.GREEN == 2 then
  1093. txt = "GREED"
  1094. elseif LPCONFIG.GREEN == 0 then
  1095. txt = "PASS"
  1096. end
  1097. return txt
  1098. end
  1099. local pass = nil
  1100. if LPCONFIG.GREEN then
  1101. for i=1, NUM_GROUP_LOOT_FRAMES do
  1102. local frame = getglobal("GroupLootFrame"..i);
  1103. if frame:IsVisible() then
  1104. local id = frame.rollID
  1105. local _, name, _, quality = GetLootRollItemInfo(id);
  1106. if quality == 2 then
  1107. RollOnLoot(id, LPCONFIG.GREEN);
  1108. local _, _, _, hex = GetItemQualityColor(quality)
  1109. greenrolltime = GetTime() + 1
  1110. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: "..hex..RollReturn().."|cffffffff Roll "..GetLootRollItemLink(id))
  1111. pass = true
  1112. end
  1113. end
  1114. end
  1115. end
  1116. return pass
  1117. end
  1118.  
  1119. function LazyPig_GreySellRepair()
  1120. local bag, slot = LazyPig_BagReturn("ff9d9d9d")
  1121. if bag and slot then
  1122. local _, _, locked = GetContainerItemInfo(bag, slot)
  1123. if bag and slot and not locked then
  1124. UseContainerItem(bag,slot)
  1125. if not(GreySell.bag == bag and GreySell.slot == slot) then
  1126. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Selling "..GetContainerItemLink(bag, slot))
  1127. GreySell.bag = bag
  1128. GreySell.slot = slot
  1129. end
  1130. end
  1131. elseif CanMerchantRepair() then
  1132. local rcost = GetRepairAllCost()
  1133. if rcost and rcost ~= 0 then
  1134. if rcost > GetMoney() then
  1135. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Not Enough Money to Repair")
  1136. return
  1137. end
  1138. GreySell.repair = rcost
  1139. RepairAllItems();
  1140. elseif GreySell.repair and rcost == 0 then
  1141. local gold = floor(abs(GreySell.repair / 10000))
  1142. local silver = floor(abs(mod(GreySell.repair / 100, 100)))
  1143. local copper = floor(abs(mod(GreySell.repair, 100)))
  1144. local COLOR_COPPER = "|cffeda55f"
  1145. local COLOR_SILVER = "|cffc7c7cf"
  1146. local COLOR_GOLD = "|cffffd700"
  1147.  
  1148. DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Repairing All Items "..COLOR_GOLD..gold.."g "..COLOR_SILVER..silver.."s "..COLOR_COPPER..copper.."c")
  1149. GreySell.repair = nil
  1150. end
  1151. end
  1152. end
  1153.  
  1154. function LazyPig_ProcessQuests(...)
  1155. local quest = {}
  1156. for i = 1, table.getn(arg), 2 do
  1157. local count, title, level = i, arg[i], arg[i+1]
  1158. if count > 1 then count = (count+1)/2 end
  1159. quest[count] = title.." "..level
  1160. end
  1161. return quest
  1162. end
  1163.  
  1164. function LazyPig_PrepareQuestAutoPickup()
  1165. if IsAltKeyDown() then
  1166. GossipFrameCloseButton:Click();
  1167. ClearTarget();
  1168. end
  1169. end
  1170.  
  1171. function LazyPig_SelectGossipActiveQuest(index, norecord)
  1172. if not ActiveQuest[index] then
  1173. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig_SelectGossipActiveQuest Error");
  1174. elseif not norecord then
  1175. LazyPig_RecordQuest(ActiveQuest[index])
  1176. end
  1177. Original_SelectGossipActiveQuest(index);
  1178. end
  1179.  
  1180. function LazyPig_SelectGossipAvailableQuest(index, norecord)
  1181. if not AvailableQuest[index] then
  1182. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig_SelectGossipAvailableQuest Error");
  1183. elseif not norecord then
  1184. LazyPig_RecordQuest(AvailableQuest[index])
  1185. end
  1186. Original_SelectGossipAvailableQuest(index);
  1187. end
  1188.  
  1189. function LazyPig_SelectActiveQuest(index, norecord)
  1190. if not ActiveQuest[index] then
  1191. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig_SelectActiveQuest Error");
  1192. elseif not norecord then
  1193. LazyPig_RecordQuest(ActiveQuest[index])
  1194. end
  1195. Original_SelectActiveQuest(index);
  1196. end
  1197.  
  1198. function LazyPig_SelectAvailableQuest(index, norecord)
  1199. if not AvailableQuest[index] then
  1200. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig_SelectAvailableQuest Error");
  1201. elseif not norecord then
  1202. LazyPig_RecordQuest(AvailableQuest[index])
  1203. end
  1204. Original_SelectAvailableQuest(index);
  1205. end
  1206.  
  1207. function LazyPig_FixQuest(quest, annouce)
  1208. if not QuestRecord["details"] then
  1209. annouce = true
  1210. end
  1211. if UnitLevel("player") == 60 then
  1212. if string.find(quest, "Fight for Warsong Gulch") then
  1213. QuestRecord["details"] = "Fight for Warsong Gulch 60"
  1214. elseif string.find(quest, "Battle of Warsong Gulch") then
  1215. QuestRecord["details"] = "Battle of Warsong Gulch 60"
  1216. elseif string.find(quest, "Claiming Arathi Basin") then
  1217. QuestRecord["details"] = "Claiming Arathi Basin 60"
  1218. elseif string.find(quest, "Conquering Arathi Basin") then
  1219. QuestRecord["details"] = "Conquering Arathi Basin 60"
  1220. end
  1221. end
  1222. if QuestRecord["details"] and annouce then
  1223. UIErrorsFrame:Clear();
  1224. UIErrorsFrame:AddMessage("Recording: "..QuestRecord["details"])
  1225. end
  1226. end
  1227.  
  1228. function LazyPig_RecordQuest(qdetails)
  1229. if IsShiftKeyDown() and qdetails then
  1230. if QuestRecord["details"] ~= qdetails then
  1231. QuestRecord["details"] = qdetails
  1232. end
  1233. LazyPig_FixQuest(QuestRecord["details"], true)
  1234. elseif not IsShiftKeyDown() and QuestRecord["details"] then
  1235. QuestRecord["details"] = nil
  1236. end
  1237. QuestRecord["progress"] = true
  1238. end
  1239.  
  1240. function LazyPig_ReplyQuest(event)
  1241. if IsShiftKeyDown() or IsAltKeyDown() then
  1242. if QuestRecord["details"] then
  1243. UIErrorsFrame:Clear();
  1244. UIErrorsFrame:AddMessage("Replaying: "..QuestRecord["details"])
  1245. end
  1246.  
  1247. if event == "GOSSIP_SHOW" then
  1248. if QuestRecord["details"] then
  1249. for blockindex,blockmatch in pairs(ActiveQuest) do
  1250. if blockmatch == QuestRecord["details"] then
  1251. Original_SelectGossipActiveQuest(blockindex)
  1252. return
  1253. end
  1254. end
  1255. for blockindex,blockmatch in pairs(AvailableQuest) do
  1256. if blockmatch == QuestRecord["details"] then
  1257. Original_SelectGossipAvailableQuest(blockindex)
  1258. return
  1259. end
  1260. end
  1261. elseif table.getn(ActiveQuest) == 0 and table.getn(AvailableQuest) == 1 or IsAltKeyDown() and table.getn(AvailableQuest) > 0 then
  1262. LazyPig_SelectGossipAvailableQuest(1, true)
  1263. elseif table.getn(ActiveQuest) == 1 and table.getn(AvailableQuest) == 0 or IsAltKeyDown() and table.getn(ActiveQuest) > 0 then
  1264. local nr = table.getn(ActiveQuest)
  1265. if QuestRecord["progress"] and (nr - QuestRecord["index"]) > 0 then
  1266. --DEFAULT_CHAT_FRAME:AddMessage("++quest dec nr - "..nr.." index - "..QuestRecord["index"])
  1267. QuestRecord["index"] = QuestRecord["index"] + 1
  1268. nr = nr - QuestRecord["index"]
  1269. end
  1270. LazyPig_SelectGossipActiveQuest(nr, true)
  1271. end
  1272. elseif event == "QUEST_GREETING" then
  1273. if QuestRecord["details"] then
  1274. for blockindex,blockmatch in pairs(ActiveQuest) do
  1275. if blockmatch == QuestRecord["details"] then
  1276. Original_SelectActiveQuest(blockindex)
  1277. return
  1278. end
  1279. end
  1280. for blockindex,blockmatch in pairs(AvailableQuest) do
  1281. if blockmatch == QuestRecord["details"] then
  1282. Original_SelectAvailableQuest(blockindex)
  1283. return
  1284. end
  1285. end
  1286. elseif table.getn(ActiveQuest) == 0 and table.getn(AvailableQuest) == 1 or IsAltKeyDown() and table.getn(AvailableQuest) > 0 then
  1287. LazyPig_SelectAvailableQuest(1, true)
  1288. elseif table.getn(ActiveQuest) == 1 and table.getn(AvailableQuest) == 0 or IsAltKeyDown() and table.getn(ActiveQuest) > 0 then
  1289. local nr = table.getn(ActiveQuest)
  1290. if QuestRecord["progress"] and (nr - QuestRecord["index"]) > 0 then
  1291. --DEFAULT_CHAT_FRAME:AddMessage("--quest dec nr - "..nr.." index - "..QuestRecord["index"])
  1292. QuestRecord["index"] = QuestRecord["index"] + 1
  1293. nr = nr - QuestRecord["index"]
  1294. end
  1295. LazyPig_SelectActiveQuest(nr, true)
  1296. end
  1297.  
  1298. elseif event == "QUEST_PROGRESS" then
  1299. CompleteQuest()
  1300. elseif event == "QUEST_COMPLETE" and GetNumQuestChoices() == 0 then
  1301. GetQuestReward(0)
  1302. end
  1303. end
  1304. end
  1305.  
  1306. function LazyPig_Dismount()
  1307. local counter = 0
  1308. local tooltipfind = "Increases speed by (.+)%%"
  1309. while GetPlayerBuff(counter) >= 0 do
  1310. local index, untilCancelled = GetPlayerBuff(counter)
  1311. LazyPig_Buff_Tooltip:SetPlayerBuff(index)
  1312. local desc = LazyPig_Buff_TooltipTextLeft2:GetText()
  1313. if desc then
  1314. _, _, speed = string.find(desc, tooltipfind)
  1315. if speed then
  1316. CancelPlayerBuff(counter)
  1317. return
  1318. end
  1319. end
  1320. counter = counter + 1
  1321. end
  1322. end
  1323.  
  1324. function LazyPig_DropWSGFlag_NoggBuff()
  1325. local counter = 0
  1326. local tooltipfind1 = "Warsong Flag"
  1327. local tooltipfind2 = "You feel light"
  1328. local tooltipfind3 = "Slow Fall"
  1329.  
  1330. while GetPlayerBuff(counter) >= 0 do
  1331. local index, untilCancelled = GetPlayerBuff(counter)
  1332. LazyPig_Buff_Tooltip:SetPlayerBuff(index)
  1333. local desc = LazyPig_Buff_TooltipTextLeft1:GetText()
  1334. if string.find(desc, tooltipfind1) or string.find(desc, tooltipfind3) then
  1335. CancelPlayerBuff(counter)
  1336. end
  1337. desc = LazyPig_Buff_TooltipTextLeft2:GetText()
  1338. if string.find(desc, tooltipfind2) then
  1339. CancelPlayerBuff(counter)
  1340. end
  1341. counter = counter + 1
  1342. end
  1343. end
  1344.  
  1345. function LazyPig_ItemIsTradeable(bag, item)
  1346. for i = 1, 29, 1 do
  1347. getglobal("LazyPig_Buff_TooltipTextLeft" .. i):SetText("");
  1348. end
  1349.  
  1350. LazyPig_Buff_Tooltip:SetBagItem(bag, item);
  1351.  
  1352. for i = 1, LazyPig_Buff_Tooltip:NumLines(), 1 do
  1353. local text = getglobal("LazyPig_Buff_TooltipTextLeft" .. i):GetText();
  1354. if ( text == ITEM_SOULBOUND ) then
  1355. return nil
  1356. elseif ( text == ITEM_BIND_QUEST ) then
  1357. return nil
  1358. elseif ( text == ITEM_CONJURED ) then
  1359. return nil
  1360. end
  1361. end
  1362. return true
  1363. end
  1364.  
  1365.  
  1366.  
  1367. function LazyPig_Raid()
  1368. local t = GetRealZoneText()
  1369. if t =="Molten Core" or t =="Blackwing Lair" or t =="Zul'Gurub" or t =="Ahn'Qiraj" or t =="Onyxia's Lair" or t =="Ruins of Ahn'Qiraj" or t =="Temple of Ahn'Qiraj" or t =="Naxxramas" or t =="Blackrock Spire" then
  1370. return true
  1371. end
  1372. return false
  1373. end
  1374.  
  1375. function LazyPig_RaidLoots(arg1)
  1376. local t = GetRealZoneText()
  1377. if t =="Zul'Gurub" then
  1378. LazyPig_ZGRoll(arg1)
  1379. elseif t == "Ahn'Qiraj" or t =="Ruins of Ahn'Qiraj" or t =="Temple of Ahn'Qiraj" then
  1380. LazyPig_AQRoll(arg1)
  1381. LazyPig_AQmountRoll(arg1)
  1382. elseif t =="Naxxramas" then
  1383. LazyPig_NAXXRoll(arg1)
  1384.  
  1385. elseif t=="Molten Core" then
  1386. LazyPig_MCRoll(arg1)
  1387. end
  1388. end
  1389.  
  1390. function LazyPig_Dungeon()
  1391. local t = GetRealZoneText()
  1392. if t =="Dire Maul" or t =="Stratholme" or t =="Scholomance" or t =="Blackrock Depths" or t =="Sunken Temple" or t =="The Stockade" or t =="Zul'Farrak" or t =="Scarlet Monastery" or t =="Gnomeregan" or t =="The Deadmines" or t=="Blackfathom Deeps" or t=="Wailing Caverns" or t=="Razorfen Downs" or t=="Razorfen Kraul" or t=="Ragefire Chasm" or t=="Shadowfang Keep" then
  1393. return true
  1394. end
  1395. return false
  1396. end
  1397.  
  1398. function LazyPig_BG()
  1399. local t = GetRealZoneText()
  1400. if t == "Arathi Basin" or t == "Warsong Gulch" or t == "Alterac Valley" then
  1401. return true
  1402. end
  1403. return false
  1404. end
  1405.  
  1406. function LazyPig_Queue()
  1407. for i=1, MAX_BATTLEFIELD_QUEUES do
  1408. local status, mapName, instanceID = GetBattlefieldStatus(i);
  1409. if(status == "confirm" or status == "active") then
  1410. return true
  1411. end
  1412. end
  1413. return nil
  1414. end
  1415.  
  1416. function LazyPig_EndSplit()
  1417. timer_split = nil
  1418. tmp_splitval = 1
  1419. LazyPig_Text()
  1420. end
  1421.  
  1422. function LazyPig_DecodeItemLink(link)
  1423. if link then
  1424. local found, _, id, name = string.find(link, "item:(%d+):.*%[(.*)%]")
  1425. if found then
  1426. id = tonumber(id)
  1427. return name, id
  1428. end
  1429. end
  1430. return nil
  1431. end
  1432.  
  1433. function LazyPig_WatchSplit(enable)
  1434. local returnval = timer_split
  1435. if LPCONFIG.SHIFTSPLIT then
  1436. local time = GetTime()
  1437. local txt_show = enable
  1438. local ctrl = IsControlKeyDown()
  1439. local alt = IsAltKeyDown()
  1440. local duration = 9
  1441.  
  1442. if enable then
  1443. timer_split = time + duration
  1444. elseif timer_split then
  1445. local boost = -0.006*tmp_splitval + 1
  1446.  
  1447. if auctionstatus then
  1448. if AuctionFrameBrowse:IsVisible() then
  1449. if not auctionbrowse then
  1450. auctionbrowse = true
  1451. LazyPig_EndSplit()
  1452. return
  1453. end
  1454. else
  1455. auctionbrowse = nil
  1456. end
  1457. end
  1458.  
  1459. if time > timer_split or auctionstatus and AuctionFrameAuctions and not (AuctionFrameAuctions:IsVisible() or AuctionFrameBrowse:IsVisible()) or mailstatus and SendMailFrame and not SendMailFrame:IsVisible() and (not CT_MailFrame or CT_MailFrame and not CT_MailFrame:IsVisible()) and (not GMailFrame or GMailFrame and not GMailFrame:IsVisible()) then
  1460. LazyPig_EndSplit()
  1461. elseif (ctrl or alt) and time > last_click then
  1462. local forcepass = (timer_split - duration + 0.6) > time
  1463. if ctrl and alt then
  1464. timer_split = time + duration - 1
  1465. return
  1466. elseif alt and ((time + 0.1) > alttime or forcepass) and tmp_splitval < 100 then
  1467. alttime = time + 0.125
  1468. tmp_splitval = tmp_splitval + 1
  1469. timer_split = time + duration
  1470. last_click = 0.109*boost + time
  1471. txt_show = true
  1472. elseif ctrl and ((time + 0.1) > ctrltime or forcepass) and tmp_splitval > 1 then
  1473. ctrltime = time + 0.125
  1474. tmp_splitval = tmp_splitval - 1
  1475. timer_split = time + duration
  1476. last_click = 0.109*boost + time
  1477. txt_show = true
  1478. end
  1479. end
  1480. elseif auctionstatus and AuctionFrameAuctions and AuctionFrameAuctions:IsVisible() or mailstatus and SendMailFrame and SendMailFrame:IsVisible() or tradestatus or bankstatus or CT_MailFrame and CT_MailFrame:IsVisible() or GMailFrame and GMailFrame:IsVisible() then
  1481. timer_split = time + duration - 1
  1482. txt_show = true
  1483. end
  1484. if txt_show then LazyPig_Text("- Ctrl "..tmp_splitval.." Alt +", duration) end
  1485. end
  1486. return returnval
  1487. end
  1488.  
  1489. function LazyPig_UseContainerItem(ParentID,ItemID)
  1490. if LPCONFIG.SHIFTSPLIT and not CursorHasItem() and not merchantstatus and IsShiftKeyDown() and not IsAltKeyDown() then
  1491. if(GetTime() - last_click) < 0.3 then return end
  1492. local _, itemCount, locked = GetContainerItemInfo(ParentID, ItemID)
  1493. if locked or not itemCount then return end
  1494. if not LazyPig_WatchSplit(true) then return end
  1495. last_click = GetTime()
  1496.  
  1497. local ItemArray = {}
  1498. local name, id = LazyPig_DecodeItemLink(GetContainerItemLink(ParentID,ItemID))
  1499. local _, _, _, _, _, _, maxstack = GetItemInfo(id)
  1500. local out_slpit = tmp_splitval
  1501.  
  1502. if out_slpit > maxstack then
  1503. out_slpit = maxstack
  1504. end
  1505.  
  1506. local dcount = out_slpit
  1507. local dbag = nil
  1508. local dslot = nil
  1509. local cursoritem = nil
  1510.  
  1511. if itemCount < out_slpit then
  1512. dbag, dslot = ParentID, ItemID
  1513. dcount = out_slpit - itemCount
  1514. cursoritem = true
  1515. end
  1516.  
  1517. if name then
  1518. for b=0, NUM_BAG_FRAMES do
  1519. local bagslots = GetContainerNumSlots(b)
  1520. if bagslots and bagslots > 0 then
  1521. for s=1, bagslots do
  1522. local link = GetContainerItemLink(b, s)
  1523. local n, d = LazyPig_DecodeItemLink(link)
  1524. if not cursoritem or cursoritem and not (b == ParentID and s == ItemID) then
  1525. if not link and not dbag and not dslot then
  1526. dbag, dslot = b, s
  1527. --DEFAULT_CHAT_FRAME:AddMessage(b.." "..s.." - scan mode1")
  1528. elseif n then
  1529. if n == name then
  1530. --if (string.find(n, name) or n == name) then
  1531. local _, c, l = GetContainerItemInfo(b, s)
  1532. if not l then
  1533. if not (itemCount < out_slpit) and not dbag and not dslot and c < out_slpit then
  1534. dbag, dslot = b, s
  1535. dcount = out_slpit - c
  1536. --DEFAULT_CHAT_FRAME:AddMessage("b.." "..s.." count - "..c.." - "..scan mode2)
  1537. elseif c ~= out_slpit or cursoritem then
  1538. ItemArray[b.."_"..s] = c
  1539. end
  1540. end
  1541. end
  1542. end
  1543. end
  1544. end
  1545. end
  1546. end
  1547.  
  1548. if not dbag or not dslot or CursorHasItem() then return end
  1549.  
  1550. local escape = 0
  1551. while dcount > 0 do
  1552. local sbag = nil
  1553. local sslot = nil
  1554. local score = nil
  1555. local number = nil
  1556. local index = nil
  1557.  
  1558. for blockindex,blockmatch in pairs(ItemArray) do
  1559. local x = nil
  1560. local y = nil
  1561. x = string.gsub(blockindex,"_(.+)","")
  1562. x = tonumber(x)
  1563. y = string.gsub(blockindex,"(.+)_","")
  1564. y = tonumber(y)
  1565.  
  1566. if not number or number > blockmatch or number == blockmatch and (x*10 + y) > score then
  1567. sbag = x
  1568. sslot = y
  1569. score = 10*sbag + sslot
  1570. number = blockmatch
  1571. index = blockindex
  1572. end
  1573. end
  1574.  
  1575. if sbag and sslot then
  1576. local splitval = nil
  1577. if (number - dcount) >= out_slpit then
  1578. splitval = dcount
  1579. elseif number > out_slpit then
  1580. splitval = number - out_slpit
  1581. elseif number < dcount then
  1582. splitval = number
  1583. else
  1584. splitval = dcount
  1585. end
  1586.  
  1587. dcount = dcount - splitval
  1588. ScheduleItemSplit(sbag, sslot, dbag, dslot, splitval)
  1589. ItemArray[index] = nil
  1590. --DEFAULT_CHAT_FRAME:AddMessage("Dest "..dbag.." - "..dslot.." From "..sbag.." - "..sslot.." - Count "..splitval)
  1591. end
  1592.  
  1593. if escape > 99 then
  1594. --DEFAULT_CHAT_FRAME:AddMessage("LazPig_Split: Loop stop")
  1595. return
  1596. else
  1597. escape = escape + 1
  1598. end
  1599. end
  1600. end
  1601. return
  1602.  
  1603. elseif LPCONFIG.RIGHT and tradestatus and not IsShiftKeyDown() and not IsAltKeyDown() and LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1604. --if not LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1605. -- DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Cannot attach item", 1, 0.5, 0);
  1606. -- return
  1607. --end
  1608. PickupContainerItem(ParentID,ItemID)
  1609. local slot = TradeFrame_GetAvailableSlot()
  1610. if slot then ClickTradeButton(slot) end
  1611. if CursorHasItem() then
  1612. ClearCursor()
  1613. end
  1614. return
  1615.  
  1616. elseif LPCONFIG.RIGHT and GMailFrame and GMailFrame:IsVisible() and not CursorHasItem() and LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1617. --if not LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1618. -- DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Cannot attach item", 1, 0.5, 0);
  1619. -- return
  1620. --end
  1621. local i
  1622. local bag, item = ParentID,ItemID
  1623. for i = 1, GMAIL_NUMITEMBUTTONS, 1 do
  1624. if ( not getglobal("GMailButton" .. i).item ) then
  1625.  
  1626. if ( GMail:ItemIsMailable(bag, item) ) then
  1627. GMail:Print("GMail: Cannot attach item.", 1, 0.5, 0)
  1628. return
  1629. end
  1630. PickupContainerItem(bag, item)
  1631. --GMail.hooks["PickupContainerItem"].orig(bag, item)
  1632. GMail:MailButton_OnClick(getglobal("GMailButton" .. i))
  1633. GMail:UpdateItemButtons()
  1634. return
  1635. end
  1636. end
  1637.  
  1638. elseif LPCONFIG.RIGHT and CT_MailFrame and CT_MailFrame:IsVisible() and not IsShiftKeyDown() and not IsAltKeyDown() and LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1639. --if not LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1640. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Cannot attach item", 1, 0.5, 0);
  1641. --return
  1642. --end
  1643. local bag, item = ParentID,ItemID
  1644. if ( ( CT_Mail_GetItemFrame(bag, item) or ( CT_Mail_addItem and CT_Mail_addItem[1] == bag and CT_Mail_addItem[2] == item ) ) and not special ) then
  1645. return;
  1646. end
  1647. if ( not CursorHasItem() ) then
  1648. CT_MailFrame.bag = bag;
  1649. CT_MailFrame.item = item;
  1650. end
  1651. if ( CT_MailFrame:IsVisible() and not CursorHasItem() ) then
  1652. local i;
  1653. for i = 1, CT_MAIL_NUMITEMBUTTONS, 1 do
  1654. if ( not getglobal("CT_MailButton" .. i).item ) then
  1655.  
  1656. local canMail = CT_Mail_ItemIsMailable(bag, item);
  1657. if ( canMail ) then
  1658. DEFAULT_CHAT_FRAME:AddMessage("<CTMod> Cannot attach item, item is " .. canMail, 1, 0.5, 0);
  1659. return;
  1660. end
  1661.  
  1662. CT_oldPickupContainerItem(bag, item);
  1663. CT_MailButton_OnClick(getglobal("CT_MailButton" .. i));
  1664. CT_Mail_UpdateItemButtons();
  1665. return;
  1666. end
  1667. end
  1668. end
  1669. elseif LPCONFIG.RIGHT and mailstatus and not IsShiftKeyDown() and not IsAltKeyDown() and LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1670. --if not LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1671. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Cannot attach item", 1, 0.5, 0);
  1672. --return
  1673. --end
  1674.  
  1675. if InboxFrame and InboxFrame:IsVisible() then
  1676. MailFrameTab_OnClick(2);
  1677. return
  1678. end
  1679. if SendMailFrame and SendMailFrame:IsVisible() then
  1680. PickupContainerItem(ParentID,ItemID)
  1681. ClickSendMailItemButton()
  1682. if CursorHasItem() then
  1683. ClearCursor()
  1684. end
  1685. return
  1686. end
  1687. elseif LPCONFIG.RIGHT and auctionstatus and not IsShiftKeyDown() and not IsAltKeyDown() and LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1688. --if not LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1689. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Cannot attach item", 1, 0.5, 0);
  1690. --return
  1691. --end
  1692. if not AuctionFrameAuctions:IsVisible() then
  1693. AuctionFrameTab3:Click()
  1694. return
  1695. end
  1696. PickupContainerItem(ParentID,ItemID)
  1697. ClickAuctionSellItemButton()
  1698. if CursorHasItem() then
  1699. ClearCursor()
  1700. end
  1701. return
  1702. elseif LPCONFIG.RIGHT and auctionstatus and IsAltKeyDown() and LazyPig_ItemIsTradeable(ParentID,ItemID)then
  1703. --if not LazyPig_ItemIsTradeable(ParentID,ItemID) then
  1704. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig: Item is not tradeable", 1, 0.5, 0);
  1705. --return
  1706. --end
  1707. if not AuctionFrameBrowse:IsVisible() then
  1708. AuctionFrameTab1:Click()
  1709. return
  1710. end
  1711. if LazyPig_AuctionSearch(GetContainerItemLink(ParentID,ItemID)) then
  1712. return
  1713. end
  1714. end
  1715. OriginalUseContainerItem(ParentID,ItemID)
  1716.  
  1717.  
  1718. end
  1719.  
  1720. function LazyPig_AuctionSearch(link)
  1721. if link and not strfind(link,"item:") then return end
  1722. BrowseMinLevel:SetText('')
  1723. BrowseMaxLevel:SetText('')
  1724. UIDropDownMenu_SetText('',BrowseDropDown)
  1725. UIDropDownMenu_SetSelectedName(BrowseDropDown)
  1726. local name,il,ir,iml,class,sub
  1727. if link then
  1728. local i,j,name = strfind(link,"%[(.+)%]")
  1729. BrowseName:SetText(name)
  1730. BrowseName:HighlightText(0,-1)
  1731. IsUsableCheckButton:SetChecked(false)
  1732. local i,j,item = strfind(link,"(item:%d+:%d+:%d+:%d+)")
  1733. name,il,ir,iml,class,sub = GetItemInfo(item)
  1734. else
  1735. BrowseName:SetText('')
  1736. IsUsableCheckButton:SetChecked(true)
  1737. class = 'Recipe'; sub = class
  1738. end
  1739. AuctionFrameBrowse.selectedClass = class
  1740. for ix,name in CLASS_FILTERS do
  1741. if name==class then
  1742. AuctionFrameBrowse.selectedClassIndex = ix
  1743. i = ix
  1744. break
  1745. end
  1746. end
  1747. if class~=sub then
  1748. AuctionFrameBrowse.selectedSubclass = HIGHLIGHT_FONT_COLOR_CODE..sub..FONT_COLOR_CODE_CLOSE
  1749. for ix,name in {GetAuctionItemSubClasses(i)} do
  1750. if name==sub then
  1751. AuctionFrameBrowse.selectedSubclassIndex = ix
  1752. break
  1753. end
  1754. end
  1755. else
  1756. AuctionFrameBrowse.selectedSubclass = nil
  1757. AuctionFrameBrowse.selectedSubclassIndex = nil
  1758. end
  1759. AuctionFrameBrowse.selectedInvtype = nil
  1760. AuctionFrameBrowse.selectedInvtypeIndex = nil
  1761. AuctionFrameFilters_Update()
  1762. BrowseSearchButton:Click()
  1763. return 1
  1764. end
  1765.  
  1766. function ScheduleItemSplit(sbag, sslot, dbag, dslot, count)
  1767. if sbag and sslot and dbag and dslot and count then
  1768.  
  1769. local number = nil
  1770.  
  1771. for blockindex,blockmatch in pairs(ScheduleSplitCount) do
  1772. if not number or number < blockindex then
  1773. number = blockindex
  1774. end
  1775. end
  1776.  
  1777. if not number then
  1778. number = 1
  1779. else
  1780. number = number + 1
  1781. end
  1782.  
  1783. --DEFAULT_CHAT_FRAME:AddMessage("Task Count - "..number)
  1784.  
  1785. ScheduleSplitCount[number] = true
  1786. ScheduleSplit.sbag[number] = sbag
  1787. ScheduleSplit.sslot[number] = sslot
  1788. ScheduleSplit.dbag[number] = dbag
  1789. ScheduleSplit.dslot[number] = dslot
  1790. ScheduleSplit.count[number] = count
  1791.  
  1792. ScheduleSplit.active = true
  1793.  
  1794. elseif ScheduleSplit.active then
  1795.  
  1796. local number = nil
  1797. for blockindex,blockmatch in pairs(ScheduleSplitCount) do
  1798. if not number or number > blockindex then
  1799. number = blockindex
  1800. end
  1801. end
  1802.  
  1803. if number then
  1804. last_click = GetTime()
  1805. local _, _, lock = GetContainerItemInfo(ScheduleSplit.dbag[number], ScheduleSplit.dslot[number])
  1806. if not lock then
  1807.  
  1808. --DEFAULT_CHAT_FRAME:AddMessage("Dest "..ScheduleSplit.dbag[number].." - "..ScheduleSplit.dslot[number].." From "..ScheduleSplit.sbag[number].." - "..ScheduleSplit.sslot[number].." - Count "..ScheduleSplit.count[number])
  1809.  
  1810. SplitContainerItem(ScheduleSplit.sbag[number], ScheduleSplit.sslot[number], ScheduleSplit.count[number])
  1811. PickupContainerItem(ScheduleSplit.dbag[number], ScheduleSplit.dslot[number])
  1812. ScheduleSplitCount[number] = nil
  1813. end
  1814. else
  1815. ScheduleSplit.active = nil
  1816. end
  1817. end
  1818. end
  1819.  
  1820. function LazyPig_CreateLink(name, count, rgb)
  1821. rgb = rgb or WHITE
  1822. if(name ~= nil) then
  1823. local color = rgb..name.."|r"
  1824. local hlink = "[|Hlazypig:"..count.."|h"..color.."|h]";
  1825. return hlink
  1826. end
  1827. end
  1828.  
  1829. function LazyPig_SetItemRef_OnEvent(link, text, button)
  1830. if link and string.find(link, "lazypig:") then
  1831. --local count = string.gsub(link,"lazypig:","")
  1832. LazyPig_Command()
  1833. else
  1834. Original_SetItemRef(link, text, button)
  1835. end
  1836. end
  1837.  
  1838. function LazyPig_RefreshNameplates()
  1839. if LPCONFIG.EPLATE then
  1840. ShowNameplates();
  1841. elseif LPCONFIG.HPLATE then
  1842. HideNameplates();
  1843. end
  1844. if LPCONFIG.FPLATE then
  1845. ShowFriendNameplates();
  1846. elseif LPCONFIG.HPLATE then
  1847. HideFriendNameplates();
  1848. end
  1849. end
  1850.  
  1851. function LazyPig_GetOption(num)
  1852. local labelString = getglobal(this:GetName().."Text");
  1853. local label = LazyPigMenuStrings[num] or "";
  1854. LazyPigMenuObjects[num] = this
  1855.  
  1856. if num == 00 and LPCONFIG.GREEN == 1
  1857. or num == 01 and LPCONFIG.GREEN == 2
  1858. or num == 02 and LPCONFIG.GREEN == 0
  1859. or num == 10 and LPCONFIG.ZG == 1
  1860. or num == 11 and LPCONFIG.ZG == 2
  1861. or num == 12 and LPCONFIG.ZG == 0
  1862. or num == 13 and LPCONFIG.AQ == 1
  1863. or num == 14 and LPCONFIG.AQ == 2
  1864. or num == 15 and LPCONFIG.AQ == 0
  1865. or num == 16 and LPCONFIG.AQM == 1
  1866. or num == 17 and LPCONFIG.AQM == 2
  1867. or num == 18 and LPCONFIG.AQM == 0
  1868. or num == 20 and LPCONFIG.WORLDDUNGEON
  1869. or num == 21 and LPCONFIG.WORLDRAID
  1870. or num == 22 and LPCONFIG.WORLDBG
  1871. or num == 23 and LPCONFIG.WORLDUNCHECK
  1872. or num == 30 and LPCONFIG.GINV
  1873. or num == 31 and LPCONFIG.FINV
  1874. or num == 32 and LPCONFIG.SINV
  1875. or num == 33 and LPCONFIG.DINV
  1876. or num == 40 and LPCONFIG.FPLATE
  1877. or num == 41 and LPCONFIG.EPLATE
  1878. or num == 42 and LPCONFIG.HPLATE
  1879. or num == 50 and LPCONFIG.EBG
  1880. or num == 51 and LPCONFIG.LBG
  1881. or num == 52 and LPCONFIG.QBG
  1882. or num == 53 and LPCONFIG.RBG
  1883. or num == 54 and LPCONFIG.AQUE
  1884. or num == 55 and LPCONFIG.SBG
  1885.  
  1886. or num == 60 and LPCONFIG.SALVA == 1
  1887. or num == 61 and LPCONFIG.SALVA == 2
  1888. or num == 90 and LPCONFIG.SUMM
  1889.  
  1890. or num == 70 and LPCONFIG.SPAM
  1891. or num == 71 and LPCONFIG.SPAM_UNCOMMON
  1892. or num == 72 and LPCONFIG.SPAM_RARE
  1893. or num == 73 and LPCONFIG.SPAM_LOOT
  1894.  
  1895. or num == 91 and LPCONFIG.LOOT
  1896. or num == 92 and LPCONFIG.RIGHT
  1897. or num == 93 and LPCONFIG.SHIFTSPLIT
  1898. or num == 94 and LPCONFIG.CAM
  1899. or num == 95 and LPCONFIG.SPECIALKEY
  1900. or num == 96 and LPCONFIG.DUEL
  1901. or num == 97 and LPCONFIG.REZ
  1902. or num == 98 and LPCONFIG.GOSSIP
  1903. or num == 99 and LPCONFIG.NOSAVE ~= GetRealmName()
  1904. or num == 100 and LPCONFIG.DISMOUNT
  1905. or num == 101 and LPCONFIG.SPAM
  1906. or num == 103 and LPCONFIG.VIEWDIST
  1907. or num == 110 and LPCONFIG.NAXX == 1
  1908. or num == 111 and LPCONFIG.NAXX == 2
  1909. or num == 112 and LPCONFIG.NAXX == 0
  1910. or num == 113 and LPCONFIG.AUTOGREEN == 1
  1911. or num == 114 and LPCONFIG.AUTOGREEN == 2
  1912. or num == 115 and LPCONFIG.AUTOGREEN == 0
  1913. or num == 116 and LPCONFIG.MC == 1
  1914. or num == 117 and LPCONFIG.MC == 2
  1915. or num == 118 and LPCONFIG.MC == 0
  1916.  
  1917. or nil then
  1918. this:SetChecked(true);
  1919. else
  1920. this:SetChecked(nil);
  1921. end
  1922. labelString:SetText(label);
  1923. end
  1924.  
  1925. function LazyPig_SetOption(num)
  1926. local checked = this:GetChecked()
  1927. if num == 00 then
  1928. LPCONFIG.GREEN = 1
  1929. if not checked then LPCONFIG.GREEN = nil end
  1930. LazyPigMenuObjects[01]:SetChecked(nil)
  1931. LazyPigMenuObjects[02]:SetChecked(nil)
  1932. elseif num == 01 then
  1933. LPCONFIG.GREEN = 2
  1934. if not checked then LPCONFIG.GREEN = nil end
  1935. LazyPigMenuObjects[00]:SetChecked(nil)
  1936. LazyPigMenuObjects[02]:SetChecked(nil)
  1937. elseif num == 02 then
  1938. LPCONFIG.GREEN = 0
  1939. if not checked then LPCONFIG.GREEN = nil end
  1940. LazyPigMenuObjects[00]:SetChecked(nil)
  1941. LazyPigMenuObjects[01]:SetChecked(nil)
  1942. elseif num == 10 then
  1943. LPCONFIG.ZG = 1
  1944. if not checked then LPCONFIG.ZG = nil end
  1945. LazyPigMenuObjects[11]:SetChecked(nil)
  1946. LazyPigMenuObjects[12]:SetChecked(nil)
  1947. elseif num == 11 then
  1948. LPCONFIG.ZG= 2
  1949. if not checked then LPCONFIG.ZG = nil end
  1950. LazyPigMenuObjects[10]:SetChecked(nil)
  1951. LazyPigMenuObjects[12]:SetChecked(nil)
  1952. elseif num == 12 then
  1953. LPCONFIG.ZG = 0
  1954. if not checked then LPCONFIG.ZG = nil end
  1955. LazyPigMenuObjects[10]:SetChecked(nil)
  1956. LazyPigMenuObjects[11]:SetChecked(nil)
  1957.  
  1958. elseif num == 13 then
  1959. LPCONFIG.AQ = 1
  1960. if not checked then LPCONFIG.AQ = nil end
  1961. LazyPigMenuObjects[14]:SetChecked(nil)
  1962. LazyPigMenuObjects[15]:SetChecked(nil)
  1963. elseif num == 14 then
  1964. LPCONFIG.AQ = 2
  1965. if not checked then LPCONFIG.AQ = nil end
  1966. LazyPigMenuObjects[13]:SetChecked(nil)
  1967. LazyPigMenuObjects[15]:SetChecked(nil)
  1968. elseif num == 15 then
  1969. LPCONFIG.AQ = 0
  1970. if not checked then LPCONFIG.AQ = nil end
  1971. LazyPigMenuObjects[13]:SetChecked(nil)
  1972. LazyPigMenuObjects[14]:SetChecked(nil)
  1973.  
  1974. elseif num == 16 then
  1975. LPCONFIG.AQM = 1
  1976. if not checked then LPCONFIG.AQM = nil end
  1977. LazyPigMenuObjects[17]:SetChecked(nil)
  1978. LazyPigMenuObjects[18]:SetChecked(nil)
  1979. elseif num == 17 then
  1980. LPCONFIG.AQM = 2
  1981. if not checked then LPCONFIG.AQM = nil end
  1982. LazyPigMenuObjects[16]:SetChecked(nil)
  1983. LazyPigMenuObjects[18]:SetChecked(nil)
  1984. elseif num == 18 then
  1985. LPCONFIG.AQM = 0
  1986. if not checked then LPCONFIG.AQM = nil end
  1987. LazyPigMenuObjects[16]:SetChecked(nil)
  1988. LazyPigMenuObjects[17]:SetChecked(nil)
  1989.  
  1990. elseif num == 20 then
  1991. LPCONFIG.WORLDDUNGEON = true --fixed
  1992. if not checked then LPCONFIG.WORLDDUNGEON = nil end
  1993. if LPCONFIG.WORLDDUNGEON or LPCONFIG.WORLDRAID or LPCONFIG.WORLDBG then
  1994. LPCONFIG.WORLDUNCHECK = nil
  1995. LazyPigMenuObjects[23]:SetChecked(nil)
  1996. end
  1997. LazyPig_ZoneCheck()
  1998. elseif num == 21 then
  1999. LPCONFIG.WORLDRAID = true
  2000. if not checked then LPCONFIG.WORLDRAID = nil end
  2001. if LPCONFIG.WORLDDUNGEON or LPCONFIG.WORLDRAID or LPCONFIG.WORLDBG then
  2002. LPCONFIG.WORLDUNCHECK = nil
  2003. LazyPigMenuObjects[23]:SetChecked(nil)
  2004. end
  2005. LazyPig_ZoneCheck()
  2006. elseif num == 22 then
  2007. LPCONFIG.WORLDBG = true
  2008. if not checked then LPCONFIG.WORLDBG = nil end
  2009. if LPCONFIG.WORLDDUNGEON or LPCONFIG.WORLDRAID or LPCONFIG.WORLDBG then
  2010. LPCONFIG.WORLDUNCHECK = nil
  2011. LazyPigMenuObjects[23]:SetChecked(nil)
  2012. end
  2013. LazyPig_ZoneCheck()
  2014. elseif num == 23 then
  2015. LPCONFIG.WORLDUNCHECK = true
  2016. if not checked then
  2017. LPCONFIG.WORLDUNCHECK = nil
  2018. else
  2019. LPCONFIG.WORLDDUNGEON = nil
  2020. LPCONFIG.WORLDRAID = nil
  2021. LPCONFIG.WORLDBG = nil
  2022. LazyPigMenuObjects[20]:SetChecked(nil)
  2023. LazyPigMenuObjects[21]:SetChecked(nil)
  2024. LazyPigMenuObjects[22]:SetChecked(nil)
  2025. end
  2026. LazyPig_ZoneCheck()
  2027. elseif num == 30 then --fixed
  2028. LPCONFIG.GINV = true
  2029. if not checked then LPCONFIG.GINV = nil end
  2030. elseif num == 31 then
  2031. LPCONFIG.FINV = true
  2032. if not checked then LPCONFIG.FINV = nil end
  2033. elseif num == 32 then
  2034. LPCONFIG.SINV = true
  2035. if not checked then LPCONFIG.SINV = nil end
  2036. elseif num == 33 then
  2037. LPCONFIG.DINV = true
  2038. if not checked then LPCONFIG.DINV = nil end
  2039. elseif num == 40 then --fixed
  2040. LPCONFIG.FPLATE = true
  2041. if not checked then LPCONFIG.FPLATE = nil end
  2042. if LPCONFIG.EPLATE and LPCONFIG.FPLATE then
  2043. LPCONFIG.HPLATE = nil
  2044. LazyPigMenuObjects[42]:SetChecked(nil)
  2045. end
  2046. LazyPig_RefreshNameplates()
  2047. elseif num == 41 then
  2048. LPCONFIG.EPLATE = true
  2049. if not checked then LPCONFIG.EPLATE = nil end
  2050. if LPCONFIG.EPLATE and LPCONFIG.FPLATE then
  2051. LPCONFIG.HPLATE = nil
  2052. LazyPigMenuObjects[42]:SetChecked(nil)
  2053. end
  2054. LazyPig_RefreshNameplates()
  2055. elseif num == 42 then
  2056. LPCONFIG.HPLATE = true
  2057. if not checked then
  2058. LPCONFIG.HPLATE = nil
  2059. end
  2060. if LPCONFIG.EPLATE and LPCONFIG.FPLATE then
  2061. LPCONFIG.HPLATE = nil
  2062. LazyPigMenuObjects[42]:SetChecked(nil)
  2063. end
  2064. LazyPig_RefreshNameplates()
  2065. elseif num == 50 then --fixed
  2066. LPCONFIG.EBG = true
  2067. if not checked then LPCONFIG.EBG = nil end
  2068. elseif num == 51 then
  2069. LPCONFIG.LBG = true
  2070. if not checked then LPCONFIG.LBG = nil end
  2071. elseif num == 52 then
  2072. LPCONFIG.QBG = true
  2073. if not checked then LPCONFIG.QBG = nil end
  2074. elseif num == 53 then
  2075. LPCONFIG.RBG = true
  2076. if not checked then LPCONFIG.RBG = nil end
  2077. elseif num == 54 then
  2078. LPCONFIG.AQUE = true
  2079. if not checked then LPCONFIG.AQUE = nil end
  2080. elseif num == 55 then
  2081. LPCONFIG.SBG = true
  2082. if not checked then LPCONFIG.SBG = nil end
  2083. elseif num == 60 then
  2084. LPCONFIG.SALVA = 1
  2085. if not checked then LPCONFIG.SALVA = nil end
  2086. LazyPigMenuObjects[61]:SetChecked(nil)
  2087. LazyPig_CheckSalvation()
  2088. elseif num == 61 then
  2089. LPCONFIG.SALVA = 2
  2090. if not checked then LPCONFIG.SALVA = nil end
  2091. LazyPigMenuObjects[60]:SetChecked(nil)
  2092. LazyPig_CheckSalvation()
  2093.  
  2094. elseif num == 70 then --fixed
  2095. LPCONFIG.SPAM = true
  2096. if not checked then LPCONFIG.SPAM = nil end
  2097. elseif num == 71 then
  2098. LPCONFIG.SPAM_UNCOMMON = true
  2099. if not checked then LPCONFIG.SPAM_UNCOMMON = nil end
  2100. elseif num == 72 then
  2101. LPCONFIG.SPAM_RARE = true
  2102. if not checked then LPCONFIG.SPAM_RARE = nil end
  2103. elseif num == 73 then
  2104. LPCONFIG.SPAM_LOOT = true
  2105. if not checked then LPCONFIG.SPAM_LOOT = nil end
  2106.  
  2107. elseif num == 90 then
  2108. LPCONFIG.SUMM = true
  2109. if not checked then LPCONFIG.SUMM = nil end
  2110. elseif num == 91 then
  2111. LPCONFIG.LOOT = true
  2112. if not checked then LPCONFIG.LOOT = nil end
  2113. elseif num == 92 then
  2114. LPCONFIG.RIGHT = true
  2115. if not checked then LPCONFIG.RIGHT = nil end
  2116. MailtoCheck(LPCONFIG.RIGHT)
  2117. elseif num == 93 then--fixed
  2118. LPCONFIG.SHIFTSPLIT = true
  2119. if not checked then LPCONFIG.SHIFTSPLIT = nil end
  2120. MailtoCheck(LPCONFIG.SHIFTSPLIT)
  2121. elseif num == 94 then--fixed
  2122. LPCONFIG.CAM = true
  2123. if not checked then LPCONFIG.CAM = nil end
  2124. if LPCONFIG.CAM then SetCVar("cameraDistanceMax",50) else SetCVar("cameraDistanceMaxFactor",1) SetCVar("cameraDistanceMax",15) end
  2125. elseif num == 95 then
  2126. LPCONFIG.SPECIALKEY = true
  2127. if not checked then LPCONFIG.SPECIALKEY = nil end
  2128. elseif num == 96 then
  2129. LPCONFIG.DUEL = true
  2130. if not checked then LPCONFIG.DUEL = nil end
  2131. if LPCONFIG.DUEL then CancelDuel() end
  2132. elseif num == 97 then
  2133. LPCONFIG.REZ = true
  2134. if not checked then LPCONFIG.REZ = nil end
  2135. elseif num == 98 then
  2136. LPCONFIG.GOSSIP = true
  2137. if not checked then LPCONFIG.GOSSIP = nil end
  2138. elseif num == 99 then
  2139. LPCONFIG.NOSAVE = true
  2140. if not checked then LPCONFIG.NOSAVE = GetRealmName() end
  2141. elseif num == 100 then
  2142. LPCONFIG.DISMOUNT = true
  2143. if not checked then LPCONFIG.DISMOUNT = nil end
  2144. elseif num == 101 then
  2145. LPCONFIG.SPAM = true
  2146. if not checked then LPCONFIG.SPAM = nil end
  2147.  
  2148. elseif num == 103 then
  2149. LPCONFIG.VIEWDIST = true
  2150. if not checked then LPCONFIG.VIEWDIST = nil end
  2151. LazyPig_ZoneCheck()
  2152.  
  2153. elseif num == 110 then
  2154. LPCONFIG.NAXX = 1
  2155. if not checked then LPCONFIG.NAXX = nil end
  2156. LazyPigMenuObjects[111]:SetChecked(nil)
  2157. LazyPigMenuObjects[112]:SetChecked(nil)
  2158. elseif num == 111 then
  2159. LPCONFIG.NAXX= 2
  2160. if not checked then LPCONFIG.NAXX = nil end
  2161. LazyPigMenuObjects[110]:SetChecked(nil)
  2162. LazyPigMenuObjects[112]:SetChecked(nil)
  2163. elseif num == 112 then
  2164. LPCONFIG.NAXX = 0
  2165. if not checked then LPCONFIG.NAXX = nil end
  2166. LazyPigMenuObjects[110]:SetChecked(nil)
  2167. LazyPigMenuObjects[111]:SetChecked(nil)
  2168.  
  2169. elseif num == 113 then
  2170. LPCONFIG.AUTOGREEN = 1
  2171. if not checked then LPCONFIG.AUTOGREEN = nil end
  2172. LazyPigMenuObjects[114]:SetChecked(nil)
  2173. LazyPigMenuObjects[115]:SetChecked(nil)
  2174. elseif num == 114 then
  2175. LPCONFIG.AUTOGREEN= 2
  2176. if not checked then LPCONFIG.AUTOGREEN = nil end
  2177. LazyPigMenuObjects[113]:SetChecked(nil)
  2178. LazyPigMenuObjects[115]:SetChecked(nil)
  2179. elseif num == 115 then
  2180. LPCONFIG.AUTOGREEN = 0
  2181. if not checked then LPCONFIG.AUTOGREEN = nil end
  2182. LazyPigMenuObjects[113]:SetChecked(nil)
  2183. LazyPigMenuObjects[114]:SetChecked(nil)
  2184. elseif num == 116 then
  2185. LPCONFIG.MC = 1
  2186. if not checked then LPCONFIG.MC = nil end
  2187. LazyPigMenuObjects[117]:SetChecked(nil)
  2188. LazyPigMenuObjects[118]:SetChecked(nil)
  2189. elseif num == 117 then
  2190. LPCONFIG.MC= 2
  2191. if not checked then LPCONFIG.MC = nil end
  2192. LazyPigMenuObjects[116]:SetChecked(nil)
  2193. LazyPigMenuObjects[118]:SetChecked(nil)
  2194. elseif num == 118 then
  2195. LPCONFIG.MC = 0
  2196. if not checked then LPCONFIG.MC = nil end
  2197. LazyPigMenuObjects[116]:SetChecked(nil)
  2198. LazyPigMenuObjects[117]:SetChecked(nil)
  2199.  
  2200. else
  2201. --DEFAULT_CHAT_FRAME:AddMessage("DEBUG: No num assigned - "..num)
  2202. end
  2203. --DEFAULT_CHAT_FRAME:AddMessage("DEBUG: Num chosen - "..num)
  2204. end
  2205.  
  2206. function LazyPig_RollLootOpen()
  2207. for i=1,STATICPOPUP_NUMDIALOGS do
  2208. local frame = getglobal("StaticPopup"..i)
  2209. if frame:IsShown() and frame.which == "CONFIRM_LOOT_ROLL" then
  2210. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig_RollLootOpen - TRUE")
  2211. return true
  2212. end
  2213. end
  2214. return nil
  2215. end
  2216.  
  2217. function LazyPig_BindLootOpen()
  2218. for i=1,STATICPOPUP_NUMDIALOGS do
  2219. local frame = getglobal("StaticPopup"..i)
  2220. if frame:IsShown() and frame.which == "LOOT_BIND" then
  2221. --DEFAULT_CHAT_FRAME:AddMessage("LazyPig_BindLootOpen - TRUE")
  2222. return true
  2223. end
  2224. end
  2225. return nil
  2226. end
  2227.  
  2228. function LazyPig_ZoneCheck2()
  2229. LazyPig_ZoneCheck()
  2230. end
  2231.  
  2232. function LazyPig_ZoneCheck()
  2233. local process = function(ChatFrame, name)
  2234. for index, value in ChatFrame.channelList do
  2235. if (strupper(name) == strupper(value)) then
  2236. return true
  2237. end
  2238. end
  2239. return nil
  2240. end
  2241.  
  2242. local t = GetRealZoneText()
  2243. if t =="Naxxramas" and LPCONFIG.VIEWDIST then
  2244. SetCVar("farclip",177)
  2245. elseif LPCONFIG.VIEWDIST then
  2246. SetCVar("farclip",777)
  2247. end
  2248.  
  2249. local leavechat = LPCONFIG.WORLDRAID and LazyPig_Raid() or LPCONFIG.WORLDDUNGEON and LazyPig_Dungeon() or LPCONFIG.WORLDBG and LazyPig_BG() or LPCONFIG.WORLDUNCHECK
  2250. for i = 1, NUM_CHAT_WINDOWS do
  2251. local ChatFrame = getglobal("ChatFrame"..i)
  2252. if ChatFrame:IsVisible() and not UnitIsDeadOrGhost("player") then
  2253. local id, name = GetChannelName("world")
  2254. if id > 0 then
  2255. if leavechat then
  2256. if process(ChatFrame, name) then
  2257. ChatFrame_RemoveChannel(ChatFrame, name)
  2258. channelstatus = true
  2259. UIErrorsFrame:Clear();
  2260. UIErrorsFrame:AddMessage("Leaving World")
  2261. end
  2262. return
  2263. end
  2264. end
  2265. if (LPCONFIG.WORLDRAID or LPCONFIG.WORLDDUNGEON or LPCONFIG.WORLDBG) and not leavechat then
  2266. local framename = ChatFrame:GetName()
  2267. if id == 0 then
  2268. UIErrorsFrame:Clear();
  2269. UIErrorsFrame:AddMessage("Joining World");
  2270. JoinChannelByName("world", nil, ChatFrame:GetID());
  2271. else
  2272. if (not process(ChatFrame, name) or channelstatus) and framename == "ChatFrame1" then
  2273. ChatFrame_AddChannel(ChatFrame, name);
  2274. UIErrorsFrame:Clear();
  2275. UIErrorsFrame:AddMessage("Joining World");
  2276. channelstatus = false
  2277. end
  2278. end
  2279. end
  2280. end
  2281. end
  2282. end
  2283.  
  2284. function LazyPig_PlayerClass(class, unit)
  2285. if class then
  2286. local unit = unit or "player"
  2287. local _, c = UnitClass(unit)
  2288. if c then
  2289. if string.lower(c) == string.lower(class) then
  2290. return true
  2291. end
  2292. end
  2293. end
  2294. return false
  2295. end
  2296.  
  2297. function LazyPig_IsBearForm()
  2298. local i;
  2299. local max = GetNumShapeshiftForms();
  2300. for i = 1 , max do
  2301. local _, name, isActive = GetShapeshiftFormInfo(i);
  2302. if(isActive and LazyPig_PlayerClass("Druid", "player") and (name == "Bear Form" or name == "Dire Bear Form")) then
  2303. return true
  2304. end
  2305. end
  2306. return false
  2307. end
  2308.  
  2309. function LazyPig_IsShieldEquipped()
  2310. local slot = GetInventorySlotInfo("SecondaryHandSlot")
  2311. local link = GetInventoryItemLink("player", slot)
  2312. if link then
  2313. local found, _, id, name = string.find(link, "item:(%d+):.*%[(.*)%]")
  2314. if found then
  2315. local _,_,_,_,_,itemType = GetItemInfo(tonumber(id))
  2316. if(itemType == "Shields") then
  2317. return true
  2318. end
  2319. end
  2320. end
  2321. return false
  2322. end
  2323.  
  2324. function LazyPig_CancelSalvationBuff()
  2325. local buff = {"Spell_Holy_SealOfSalvation", "Spell_Holy_GreaterBlessingofSalvation"}
  2326. local counter = 0
  2327. while GetPlayerBuff(counter) >= 0 do
  2328. local index, untilCancelled = GetPlayerBuff(counter)
  2329. if untilCancelled ~= 1 then
  2330. local i =1
  2331. while buff[i] do
  2332. if string.find(GetPlayerBuffTexture(index), buff[i]) then
  2333. CancelPlayerBuff(index);
  2334. UIErrorsFrame:Clear();
  2335. UIErrorsFrame:AddMessage("Salvation Removed");
  2336. return
  2337. end
  2338. i = i + 1
  2339. end
  2340. end
  2341. counter = counter + 1
  2342. end
  2343. return nil
  2344. end
  2345.  
  2346. function LazyPig_CancelIntBuff()
  2347. local buff = {"Spell_Holy_ArcaneIntellect", "Spell_Holy_MagicalSentry"}
  2348. local counter = 0
  2349. while GetPlayerBuff(counter) >= 0 do
  2350. local index, untilCancelled = GetPlayerBuff(counter)
  2351. if untilCancelled ~= 1 then
  2352. local i =1
  2353. while buff[i] do
  2354. if string.find(GetPlayerBuffTexture(index), buff[i]) then
  2355. CancelPlayerBuff(index);
  2356. UIErrorsFrame:Clear();
  2357. UIErrorsFrame:AddMessage("Int Buff Removed");
  2358. return
  2359. end
  2360. i = i + 1
  2361. end
  2362. end
  2363. counter = counter + 1
  2364. end
  2365. return nil
  2366. end
  2367.  
  2368. function LazyPig_CancelSpiritBuff()
  2369. local buff = {"Spell_Holy_DivineSpirit", "Spell_Holy_PrayerofSpirit"}
  2370. local counter = 0
  2371. while GetPlayerBuff(counter) >= 0 do
  2372. local index, untilCancelled = GetPlayerBuff(counter)
  2373. if untilCancelled ~= 1 then
  2374. local i =1
  2375. while buff[i] do
  2376. if string.find(GetPlayerBuffTexture(index), buff[i]) then
  2377. CancelPlayerBuff(index);
  2378. UIErrorsFrame:Clear();
  2379. UIErrorsFrame:AddMessage("Spirit Buff Removed");
  2380. return
  2381. end
  2382. i = i + 1
  2383. end
  2384. end
  2385. counter = counter + 1
  2386. end
  2387. return nil
  2388. end
  2389.  
  2390. function LazyPig_CheckSalvation()
  2391. if(LPCONFIG.SALVA == 1 or LPCONFIG.SALVA == 2 and (LazyPig_IsShieldEquipped() and LazyPig_PlayerClass("Warrior", "player") or LazyPig_IsBearForm())) then
  2392. LazyPig_CancelSalvationBuff()
  2393. LazyPig_CancelIntBuff()
  2394. LazyPig_CancelSpiritBuff()
  2395. end
  2396. end
  2397.  
  2398. function LazyPig_ShowBindings(bind, fs, desc)
  2399. local bind1, bind2 = GetBindingKey(bind)
  2400. local fsl = getglobal(fs)
  2401.  
  2402. local printout = nil
  2403. if bind1 and bind2 then
  2404. printout = "[" .. bind1 .. "/" .. bind2 .. "]"
  2405. elseif bind1 then
  2406. printout = "[" .. bind1 .. "]"
  2407. elseif bind2 then
  2408. printout = "[" .. bind2 .. "]"
  2409. elseif desc then
  2410. printout = "[" .. desc .. "]"
  2411. else
  2412. printout = "none"
  2413. fsl:SetTextColor(1,1,1,1)
  2414. end
  2415. fsl:SetText(printout)
  2416. end
  2417.  
  2418. function LazyPig_ChatFrame_OnEvent(event)
  2419. if event == "CHAT_MSG_LOOT" or event == "CHAT_MSG_MONEY" then
  2420. local bijou = string.find(arg1 ,"Bijou")
  2421. local coin = string.find(arg1 ,"Coin")
  2422.  
  2423. local green_roll = greenrolltime > GetTime()
  2424. local check_uncommon = LPCONFIG.SPAM_UNCOMMON and string.find(arg1 ,"1eff00")
  2425. local check_rare = LPCONFIG.SPAM_RARE and string.find(arg1 ,"0070dd")
  2426. local check_loot = LPCONFIG.SPAM_LOOT and (string.find(arg1 ,"9d9d9d") or string.find(arg1 ,"ffffff") or string.find(arg1 ,"Your share of the loot"))
  2427. local check_money = LPCONFIG.SPAM_LOOT and string.find(arg1 ,"Your share of the loot")
  2428.  
  2429. local check1 = string.find(arg1 ,"You")
  2430. local check2 = string.find(arg1 ,"won") or string.find(arg1 ,"receive")
  2431. local check3 = LPCONFIG.ZG and (bijou or coin)
  2432. local check5 = LPCONFIG.NAXX and string.find(arg1 ,"Wartorn")
  2433. local check6 = LPCONFIG.AQ and (string.find(arg1 ,"Stone Scarab") or string.find(arg1 ,"Silver Scarab") or string.find(arg1 ,"Ivory Scarab") or string.find(arg1 ,"Gold Scarab") or string.find(arg1 ,"Crystal Scarab") or string.find(arg1 ,"Bone Scarab") or string.find(arg1 ,"Bronze Scarab") or string.find(arg1 ,"Clay Scarab") or string.find(arg1 ,"Idol of Night") or string.find(arg1 ,"Idol of Death") or string.find(arg1 ,"Idol of the Sage") or string.find(arg1 ,"Idol of Strife") or string.find(arg1 ,"Idol of Rebirth") or string.find(arg1 ,"Idol of War") or string.find(arg1 ,"Idol of the Sun") or string.find(arg1 ,"Idol of Life") or string.find(arg1 ,"Vermillion Idol") or string.find(arg1 ,"Obsidian Idol") or string.find(arg1 ,"Amber Idol") or string.find(arg1 ,"Jasper Idol") or string.find(arg1 ,"Azure Idol") or string.find(arg1 ,"Alabaster Idol") or string.find(arg1 ,"Lambent Idol") or string.find(arg1 ,"Onyx Idol"))
  2434. local check7 = LPCONFIG.AQM and (string.find(arg1 ,"Blue Qiraji") or string.find(arg1 ,"Green Qiraji") or string.find(arg1 ,"Yellow Qiraji"))
  2435. local check8 = LPCONFIG.AUTOGREEN and string.find(arg1 ,"1eff00")
  2436. local check9 = LPCONFIG.MC and string.find(arg1 ,"Fiery Core") or string.find(arg1 ,"Lava Core")
  2437. local check4 = check1 and not check3 and not check5 and not check6 and not check7 and not check8 and not green_roll or check2
  2438.  
  2439. if not check4 and (check_uncommon or check_rare) or check_loot and not check1 or check_money then
  2440. return
  2441. end
  2442. end
  2443.  
  2444. if LPCONFIG.SPAM and arg2 and arg2 ~= GetUnitName("player") and (event == "CHAT_MSG_SAY" or event == "CHAT_MSG_CHANNEL" or event == "CHAT_MSG_YELL" or event == "CHAT_MSG_EMOTE" and not (IsGuildMate(arg2) or IsFriend(arg2))) then
  2445. local time = GetTime()
  2446. local index = ChatMessage["INDEX"]
  2447.  
  2448. for blockindex,blockmatch in pairs(ChatMessage[index]) do
  2449. local findmatch1 = (blockmatch + 70) > time --70s delay
  2450. local findmatch2 = blockindex == arg1
  2451. if findmatch1 and findmatch2 then
  2452. return
  2453. end
  2454. end
  2455. ChatMessage[index][arg1] = time
  2456. end
  2457.  
  2458. Original_ChatFrame_OnEvent(event);
  2459. end
  2460.  
  2461. function ChatSpamClean()
  2462. local time = GetTime()
  2463. local index = ChatMessage["INDEX"]
  2464. local newindex = nil
  2465.  
  2466. if index == 1 then
  2467. newindex = 2
  2468. else
  2469. newindex = 1
  2470. end
  2471.  
  2472. for blockindex,blockmatch in pairs(ChatMessage[index]) do
  2473. if (blockmatch + 70) > time then
  2474. ChatMessage[newindex][blockindex] = ChatMessage[index][blockindex]
  2475. end
  2476. end
  2477. ChatMessage[index] = {}
  2478. ChatMessage["INDEX"] = newindex
  2479.  
  2480. --DEFAULT_CHAT_FRAME:AddMessage("ChatSpamClean")
  2481. end
  2482.  
  2483. function LazyPig_Track_EFC(msg)
  2484. if msg then
  2485. msg = strlower(msg)
  2486.  
  2487. local find0 = "captured "
  2488. local find1 = "The "..UnitFactionGroup("player").." Flag"
  2489. local find2 = " was picked up "
  2490. local find3 = " was dropped "
  2491.  
  2492. if string.find(msg, strlower(find1..find2)) then
  2493. _, _, wsgefc = string.find(msg, strlower(find1..find2.."by (.+)%!"))
  2494. --DEFAULT_CHAT_FRAME:AddMessage("ADD EFC - "..wsgefc)
  2495. elseif string.find(msg, strlower(find1..find3)) or string.find(msg, strlower(find0..find1)) then
  2496. wsgefc = nil
  2497. --DEFAULT_CHAT_FRAME:AddMessage("DEL EFC")
  2498. end
  2499. end
  2500. end
  2501.  
  2502. function LazyPig_Target_EFC()
  2503. ClearTarget()
  2504. if wsgefc then
  2505. TargetByName(wsgefc, true)
  2506. UIErrorsFrame:Clear()
  2507. if not UnitExists("target") then
  2508. UIErrorsFrame:AddMessage("OUT OF RANGE - EFC - "..strupper(wsgefc))
  2509. elseif strlower(GetUnitName("target")) == wsgefc then
  2510. local class, classFileName = UnitClass("target")
  2511. local color = RAID_CLASS_COLORS[classFileName]
  2512. UIErrorsFrame:AddMessage(strupper(class.." - EFC - "..wsgefc), color.r, color.g, color.b)
  2513. end
  2514. end
  2515. end
  2516.  
  2517. function LazyPig_Duel_EFC()
  2518. if GetRealZoneText() == "Warsong Gulch" then
  2519. LazyPig_Target_EFC()
  2520. else
  2521. local duel = nil
  2522. for i=1,STATICPOPUP_NUMDIALOGS do
  2523. local frame = getglobal("StaticPopup"..i)
  2524. if frame:IsShown() then
  2525. if frame.which == "DUEL_REQUESTED" then
  2526. duel = true
  2527. end
  2528. end
  2529. end
  2530. if duel_active or duel then
  2531. CancelDuel()
  2532. elseif UnitExists("target") and UnitIsFriend("target", "player") then
  2533. StartDuel(GetUnitName("target"))
  2534. end
  2535. end
  2536. end
  2537.  
  2538.  
  2539. function aaa()
  2540. PlayerFrame:Hide()
  2541.  
  2542.  
  2543. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement