当前位置: 首页 > news >正文

SpeedyAutoLoot

SpeedyAutoLoot自动拾取插件

SpeedyAutoLoot.lua

local AutoLoot = CreateFrame('Frame')SpeedyAutoLootDB = SpeedyAutoLootDB or {}
SpeedyAutoLootDB.global = SpeedyAutoLootDB.global or {}local BACKPACK_CONTAINER = BACKPACK_CONTAINER
local LOOT_SLOT_CURRENCY = LOOT_SLOT_CURRENCY
local LOOT_SLOT_ITEM = LOOT_SLOT_ITEM
local LOOT_SLOT_MONEY = LOOT_SLOT_MONEY
local NUM_BAG_SLOTS = NUM_BAG_SLOTS
local GetContainerNumFreeSlots = GetContainerNumFreeSlots
local GetCVarBool = GetCVarBool
local GetItemCount = GetItemCount
local GetItemInfo = GetItemInfo
local GetLootSlotInfo = GetLootSlotInfo
local GetLootSlotLink = GetLootSlotLink
local GetLootSlotType = GetLootSlotType
local GetNumLootItems = GetNumLootItems
local GetCursorPosition = GetCursorPosition
local IsFishingLoot = IsFishingLoot
local IsModifiedClick = IsModifiedClick
local LootSlot = LootSlot
local PlaySound = PlaySound
local SetCVar = SetCVar
local find = string.find
local select = select
local tContains = tContains
local errorList = { ERR_INV_FULL, ERR_ITEM_MAX_COUNT }
local fishingChannel = 'Master'function AutoLoot:PlayFishingSound()if IsFishingLoot() thenreturn (fishingChannel and PlaySound(SOUNDKIT.FISHING_REEL_IN, fishingChannel)) or PlaySound(SOUNDKIT.FISHING_REEL_IN)end
endfunction AutoLoot:PlayInventoryFullSound()if SpeedyAutoLootDB.global.enableSound and not self.isItemLocked thenPlaySound(SpeedyAutoLootDB.global.InventoryFullSound, 'Master')end
endfunction AutoLoot:LootUnderMouse(self, parent)if(GetCVar('lootUnderMouse') == '1') thenlocal x, y = GetCursorPosition()x = x / self:GetEffectiveScale()y = y / self:GetEffectiveScale()self:ClearAllPoints()self:SetPoint('TOPLEFT', UIParent, 'BOTTOMLEFT', x - 40, y + 20)self:GetCenter()self:Raise()elseself:ClearAllPoints()self:SetPoint('TOPLEFT', parent, 'TOPLEFT')end
endfunction AutoLoot:CalculateFreeSlots()local numTotalFree, numFreeSlots, bagFamily = 0for i = BACKPACK_CONTAINER, NUM_BAG_SLOTS donumFreeSlots, bagFamily = GetContainerNumFreeSlots(i)if bagFamily == 0 thennumTotalFree = numTotalFree + numFreeSlotsendendreturn numTotalFree
endfunction AutoLoot:ProcessLoot(itemLink, quantity, slotType)if slotType == LOOT_SLOT_MONEY thenreturn trueelseif slotType == LOOT_SLOT_CURRENCY thenreturn trueelseif slotType == LOOT_SLOT_ITEM thenif self:CalculateFreeSlots() > 0 thenreturn trueendlocal have = (GetItemCount(itemLink) or 0)if have > 0 thenlocal itemStackCount = (select(8,GetItemInfo(itemLink)) or 0)if itemStackCount > 1 thenwhile have > itemStackCount dohave = have - itemStackCountendlocal remain = itemStackCount - haveif remain >= quantity thenreturn trueendendendend
endfunction AutoLoot:ShowLootFrame(show)if self.XLoot thenif show thenself:LootUnderMouse(XLootFrame, UIParent)XLootFrame:SetParent(UIParent)XLootFrame:SetFrameStrata('DIALOG')self.isHidden = falseelseXLootFrame:SetParent(self)self.isHidden = trueendelseif self.ElvUI thenif show thenself:LootUnderMouse(ElvLootFrame, ElvLootFrameHolder)ElvLootFrame:SetParent(ElvLootFrameHolder)ElvLootFrame:SetFrameStrata('HIGH')self.isHidden = falseelseElvLootFrame:SetParent(self)self.isHidden = trueendelseif LootFrame:IsEventRegistered('LOOT_SLOT_CLEARED') thenLootFrame.page = 1;if show thenself:LootUnderMouse(LootFrame, UIParent)LootFrame_Show(LootFrame)self.isHidden = falseelseself.isHidden = trueendendself:PlayFishingSound()
endfunction AutoLoot:LootItems()local numItems = GetNumLootItems() or 0if numItems > 0 thenfor i = numItems, 1, -1 dolocal itemLink = GetLootSlotLink(i)local slotType = GetLootSlotType(i)local quantity, _, _, locked, isQuestItem = select(3, GetLootSlotInfo(i))if locked thenself.isItemLocked = lockedelseif isQuestItem or self:ProcessLoot(itemLink, quantity, slotType) thennumItems = numItems - 1LootSlot(i)endendif numItems > 0 thenself:ShowLootFrame(true)self:PlayInventoryFullSound()endend
endfunction AutoLoot:OnEvent(e, ...)if e == 'PLAYER_LOGIN' thenif XLootFrame thenself.XLoot = trueelseif ElvUI and ElvUI[1].private.general.loot thenself.ElvUI = trueendif SpeedyAutoLootDB.global.alwaysEnableAutoLoot thenSetCVar('autoLootDefault',1)endLootFrame:UnregisterEvent('LOOT_OPENED')self:ShowLootFrame(false)elseif (e == 'LOOT_READY' or e == 'LOOT_OPENED') and not self.isLooting thenself.isLooting = truelocal autoLoot = ...if autoLoot or GetCVarBool('autoLootDefault') ~= IsModifiedClick('AUTOLOOTTOGGLE') thenself:LootItems()elseself:ShowLootFrame(true)endelseif e == 'LOOT_CLOSED' thenself.isLooting = falseself.isHidden  = falseself.isItemLocked = nilself:ShowLootFrame(false)elseif e == 'UI_ERROR_MESSAGE' and tContains(errorList, select(2,...)) thenif self.isLooting and self.isHidden thenself:ShowLootFrame(true)self:PlayInventoryFullSound()endend
endSLASH_SPEEDYAUTOLOOT1, SLASH_SPEEDYAUTOLOOT2, SLASH_SPEEDYAUTOLOOT3  = '/sal', '/speedyloot', '/speedyautoloot'
function SlashCmdList.SPEEDYAUTOLOOT(msg)local _, _, cmd, args = find(msg, '%s?(%w+)%s?(.*)')if not cmd or cmd == '' or cmd == 'help' thenprint('|cffEEE4AESpeedy AutoLoot:|r |cffEF6D6D/sal /speedyautoloot /speedyloot|r')print('  |cffEF6D6D/sal auto              -|r  |cffFAD1D1Enable Auto Looting for new/all characters|r')print('  |cffEF6D6D/sal sound            -|r  |cffFAD1D1Play a Sound when Inventory is full while looting|r')print('  |cffEF6D6D/sal set (SoundID) -|r  |cffFAD1D1Set a Sound (SoundID), Example: /sal set 139|r')elseif cmd == 'auto' thenif SpeedyAutoLootDB.global.alwaysEnableAutoLoot thenSpeedyAutoLootDB.global.alwaysEnableAutoLoot = falseprint('|cffEEE4AESpeedy AutoLoot:|r |cffB6B6B6Auto Loot for all Characters disabled.')elseSpeedyAutoLootDB.global.alwaysEnableAutoLoot = trueprint('|cffEEE4AESpeedy AutoLoot:|r |cff37DB33Auto Loot for all Characters enabled.')endelseif cmd == 'sound' thenif SpeedyAutoLootDB.global.enableSound thenSpeedyAutoLootDB.global.enableSound = falseprint('|cffEEE4AESpeedy AutoLoot:|r |cffB6B6B6Don\'t play a sound when inventory is full.')elseif not SpeedyAutoLootDB.global.InventoryFullSound thenSpeedyAutoLootDB.global.InventoryFullSound = 139endSpeedyAutoLootDB.global.enableSound = trueprint('|cffEEE4AESpeedy AutoLoot:|r |cff37DB33Play a sound when inventory is full.')endelseif cmd == 'set' and args ~= '' thenlocal SoundID = tonumber(args:match('%d+'))if SoundID thenSpeedyAutoLootDB.global.InventoryFullSound = tonumber(args:match('%d+'))PlaySound(SoundID, 'Master')print('|cffEEE4AESpeedy AutoLoot: Set Sound|r |cff37DB33'..SoundID..'|r')endend
endfunction AutoLoot:OnLoad()self:SetToplevel(true)self:Hide()self:SetScript('OnEvent', function(_, ...)self:OnEvent(...)end)for _,e in next, ({	'PLAYER_LOGIN','LOOT_READY','LOOT_OPENED','LOOT_CLOSED','UI_ERROR_MESSAGE' }) doself:RegisterEvent(e)end
end
AutoLoot:OnLoad()

SpeedyAutoLoot.toc

## Interface: 11302
## Title: |cffEEE4AESpeedy AutoLoot|r
## Notes: |cff58C6FALoot at ludicrous speed!|r
## Author: Yuyuli
## Version: 2.0.9
## SavedVariables: SpeedyAutoLootDBSpeedyAutoLoot.lua

http://www.xdnf.cn/news/188029.html

相关文章:

  • DeepSeek+Dify之五工作流引用API案例
  • 在自动驾驶数据闭环中的特征工程应用
  • VSCode 查看文件的本地修改历史
  • 大模型(LLMs)加速篇
  • Ubuntu 20.04 上安装 最新版CMake 3.31.7 的详细步骤
  • MongoDB的增删改查操作
  • 如何搭建spark yarn模式的集群
  • vite项目tailwindcss4的使用
  • 检查IBM MQ SSL配置是否成功
  • 代码片段存储解决方案ByteStash
  • 每日算法-250428
  • 跨境电商店铺矩阵布局:多账号运营理论到实操全解析
  • JVM 内存分配策略
  • 深海科技服务博客简介
  • 说一下react更新的流程
  • Meta 推出 WebSSL 模型:探索 AI 无语言视觉学习,纯图训练媲美 OpenAI CLIP
  • 详解RabbitMQ工作模式之工作队列模式
  • 盒子模型
  • 图像处理篇---信号与系统的应用
  • Golang|分布式索引架构
  • DDD(领域驱动设计)详解
  • 【C++类与对象高频面试问题总结2】
  • 在VS2022中使用Lua与c交互(二)
  • 读书笔记--华为从偶然到必然之创新与技术开发阅读有感
  • 交换机配置DHCP
  • 使用python实现自动化拉取压缩包并处理流程
  • 深入理解CSS3:Flex/Grid布局、动画与媒体查询实战指南
  • Python初学 有差异的知识点总结(一)
  • 构建“云中”高并发:12306技术改造的系统性启示
  • mac 基于Docker安装minio