FreeMountCD.lua 16.9 KB
Newer Older
fgprodigal's avatar
Update  
fgprodigal committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
local RayUI, E, _, V, P, G = unpack(select(2, ...))
local FMC = RayUI:NewModule('RayUIFreeMountCD', 'AceHook-3.0', 'AceEvent-3.0', 'AceTimer-3.0')

if GetCVar("portal") ~= "CN" then return end

local _G, pairs = _G, pairs
local GameTooltip = _G.GameTooltip
local CreateFrame = CreateFrame
local SetRaidDifficultyID = SetRaidDifficultyID
local SetLegacyRaidDifficultyID = SetLegacyRaidDifficultyID
local SendChatMessage = SendChatMessage
local GameTooltip_Hide = GameTooltip_Hide

local faction = UnitFactionGroup("player")
local NOT_FOUND_MATCH = ERR_CHAT_PLAYER_NOT_FOUND_S:format('(.+)')

local QueueMessage
local SpecialQueueMessage
local KarazhanQueueMessage
local IllidanQueueMessage
local OrgrimmarQueueMessage

if faction == "Alliance" then
    QueueMessage = {
        ["永夜绽放之薇-艾森娜"] = "9",
        ["LMCD-战歌"] = "组",
        ["林荫下的乞丐-安苏"] = "44296",
        ["波雅丶汉库克-埃雷达尔"] = "1",
        ["聖殤-通灵学院"] = "1",
        ["蚊飙-奥蕾莉亚"] = "1",
        ["氺手-国王之谷"] = "1",
        ["哞第三仙-轻风之语"] = "1",
        ["子瓜-诺兹多姆"] = "1",
        ["千山云影-雷霆号角"] = "1",
        ["蛋总的徒弟-刺骨利刃"] = "1",
        ["甜果冻-阿古斯"] = "1",
        ["古南泉-白银之手"] = "1",
    }
    SpecialQueueMessage = {
        ["永夜绽放之薇-艾森娜"] = "9",
        ["LMCD-战歌"] = "组",
        ["林荫下的乞丐-安苏"] = "44296",
        ["波雅丶汉库克-埃雷达尔"] = "1",
        ["聖殤-通灵学院"] = "1",
        ["蚊飙-奥蕾莉亚"] = "1",
        ["子瓜-诺兹多姆"] = "1",
    }
    KarazhanQueueMessage = {
        ["永夜绽放之薇-艾森娜"] = "9",
        ["LMCD-战歌"] = "组",
        ["波雅丶汉库克-埃雷达尔"] = "1",
        ["子瓜-诺兹多姆"] = "1",
        ["古南泉-白银之手"] = "1",
    }
    IllidanQueueMessage = QueueMessage
    OrgrimmarQueueMessage = QueueMessage
else
    QueueMessage = {
        ["郑矢娜-战歌"] = "9",
        ["BLCDX-战歌"] = "组",
        ["月色下的乞丐-辛达苟萨"] = "44296",
        ["阿焦大做饭-希尔瓦娜斯"] = "1",
        ["月娜-战歌"] = "1",
        ["哞哞呜呜-瓦里安"] = "1",
        ["假中医-死亡之翼"] = "1",
        ["Lau-太阳之井"] = "1",
        ["红了眼眶-血色十字军"] = "1",
        ["罐子-冬寒"] = "1",
        ["噬魔者-图拉扬"] = "1",
        ["丿长空-凤凰之神"] = "1",
        ["九筱妖-布兰卡德"] = "1",
        ["演员壹号-影之哀伤"] = "1",
        ["想静静-贫瘠之地"] = "1",
        ["亻壬忄生-安苏"] = "1",
        ["王权富贵-海加尔"] = "1",
        ["颜老师-风暴之鳞"] = "1",
        ["溟炎-洛丹伦"] = "1",
        ["时丶光-地狱咆哮"] = "1",
        ["随心而遇-战歌"] = "1",
        ["谎言-加尔"] = "1",
    }
    SpecialQueueMessage = {
        ["郑矢娜-战歌"] = "9",
        ["BLCDX-战歌"] = "组",
        ["月色下的乞丐-辛达苟萨"] = "44296",
        ["月娜-战歌"] = "1",
        ["噬魔者-图拉扬"] = "1",
        ["亻壬忄生-安苏"] = "1",
        ["溟炎-洛丹伦"] = "1",
        ["时丶光-地狱咆哮"] = "1",
        ["随心而遇-战歌"] = "1",
        ["谎言-加尔"] = "1",
    }
    KarazhanQueueMessage = {
        ["郑矢娜-战歌"] = "9",
        ["BLCDX-战歌"] = "组",
        ["月色下的乞丐-辛达苟萨"] = "44296",
        ["假中医-死亡之翼"] = "1",
        ["Lau-太阳之井"] = "1",
        ["噬魔者-图拉扬"] = "1",
        ["想静静-贫瘠之地"] = "1",
        ["亻壬忄生-安苏"] = "1",
        ["时丶光-地狱咆哮"] = "1",
        ["随心而遇-战歌"] = "1",
        ["谎言-加尔"] = "1",
    }
    IllidanQueueMessage = QueueMessage
    OrgrimmarQueueMessage = QueueMessage
end

local function ChatMsgFilter(self, event, msg, sender)
    for player in pairs(QueueMessage) do
        if msg:match(NOT_FOUND_MATCH) == player then
            return true
        end
    end
end

function FMC:Queue_NormalCD()
    SetRaidDifficultyID(14)
    SetLegacyRaidDifficultyID(4)
    for player, message in pairs(QueueMessage) do
        SendChatMessage(message, "WHISPER", nil, player)
    end
end

function FMC:StopQueue()
    for player in pairs(QueueMessage) do
        SendChatMessage("0", "WHISPER", nil, player)
    end
end

function FMC:Queue_SpecialCD()
    SetRaidDifficultyID(14)
    SetLegacyRaidDifficultyID(4)
    for player, message in pairs(SpecialQueueMessage) do
        SendChatMessage(message, "WHISPER", nil, player)
    end
end

function FMC:Queue_KarazhanCD()
    SetRaidDifficultyID(14)
    SetLegacyRaidDifficultyID(4)
    for player, message in pairs(KarazhanQueueMessage) do
        SendChatMessage(message, "WHISPER", nil, player)
    end
end

function FMC:Queue_IllidanCD()
    SetRaidDifficultyID(14)
    SetLegacyRaidDifficultyID(4)
    for player, message in pairs(IllidanQueueMessage) do
        SendChatMessage(message, "WHISPER", nil, player)
    end
end

function FMC:Queue_OrgrimmarCD()
    SetRaidDifficultyID(14)
    SetLegacyRaidDifficultyID(4)
    for player, message in pairs(OrgrimmarQueueMessage) do
        SendChatMessage(message, "WHISPER", nil, player)
    end
end

function FMC:Switch_Heroic()
    SetRaidDifficultyID(15)
    SendChatMessage("YX10", "PARTY")
end

function FMC:Switch_Raid10()
    SendChatMessage("10", "PARTY")
end

function FMC:OnEnter_NormalCD()
    GameTooltip:SetOwner(FMC.MainPanel, "ANCHOR_NONE")
    GameTooltip:ClearAllPoints()
    GameTooltip:Point("TOPLEFT", FMC.MainPanel, "TOPRIGHT", 2, 0)
    GameTooltip:AddLine("______________________【 CD清单 】______________________", 1, 2, 0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine(" ▼—冰冠堡垒[无敌](必须25普通难度进本,再点 H 切英雄)", 0, 1,0)
    GameTooltip:AddLine(" ▼—奥杜尔[飞机头](10人难度即可掉落,不要与守护者对话)", 0, 1,0)
    GameTooltip:AddLine(" ▼—风神王座[南风幼龙](不能切H)", 0, 1,0)
    GameTooltip:AddLine(" ▼—火焰之地[纯血火鹰](火乌鸦、鹿盔、大螺丝)(不能切h)", 0, 1,0)
    GameTooltip:AddLine(" ▼—黑翼血环[能量洪流](不能切h)", 0, 1,0)
    GameTooltip:AddLine(" ▼—决战奥格  [谜语人坐骑任务](傲之煞已死,进去拿书)", 0, 1,0)
    GameTooltip:AddLine(" ▼—安其拉神殿[清醒的梦魇步骤] (克苏恩已死)", 0, 1,0)
    GameTooltip:AddLine(" ▼—黑石铸造厂:[黑石之印](10号{黑手} 不能切m刷坐骑)", 0, 1,0)
    GameTooltip:AddLine(" ▼—地狱火堡垒:[血环之印]( 5号{死眼} 不能切m刷坐骑)", 0, 1,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine(" ▼请注意:由于7.35有BUG,巨龙之魂、魔古山宝库、雷神王座、永春台 的CD不能染 ", 1, 0,0)
    GameTooltip:Show()
end

function FMC:OnEnter_KarazhanCD()
    GameTooltip:SetOwner(FMC.MainPanel, "ANCHOR_NONE")
    GameTooltip:ClearAllPoints()
    GameTooltip:Point("TOPLEFT", FMC.MainPanel, "TOPRIGHT", 2, 0)
    GameTooltip:AddLine("__________________【 本CD为5人史诗难度 】__________________", 1, 2, 0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine(" ▼—进入副本后穿过歌剧院,无视圣女和管家", 0, 1,0)
    GameTooltip:AddLine(" ▼—直接击杀阿图门", 0, 1,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine(" ▼—本CD非24小时供应,如无CD君响应报名,请换时间染。", 0, 1,0)
    GameTooltip:AddLine(" ▼—本CD不需要你进行任何操作,CD君的5人本难度已调整为史诗", 0, 1,0)
    GameTooltip:Show()
end

function FMC:OnEnter_SpecialCD()
    GameTooltip:SetOwner(FMC.MainPanel, "ANCHOR_NONE")
    GameTooltip:ClearAllPoints()
    GameTooltip:Point("TOPLEFT", FMC.MainPanel, "TOPRIGHT", 2, 0)
    GameTooltip:AddLine("_____________________【 CD清单 】____________________", 1, 2, 0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("                    ▼—翡翠梦魇[萨维斯]", 0, 1,0)
    GameTooltip:AddLine("                    ▼—暗夜要塞[时空畸体、艾利桑德]", 0, 1,0)
    GameTooltip:AddLine("                    ▼—萨格拉斯之墓[主母]", 0, 1,0)
    GameTooltip:AddLine("                    ▼—燃烧王座[恶犬]", 0, 1,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("                   动态CD,系统强制切10人难度!", 1, 2, 0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("_____________________【!注意!】____________________", 1, 0,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("         ★本按钮CD为双难度CD,普通难度可直接进本!", 0, 1,0)
    GameTooltip:AddLine("         ★英雄难度,进组后点击后面的 切换英雄难度 按钮,再进本!", 0, 1,0)
    GameTooltip:Show()
end

function FMC:OnEnter_IllidanCD()
    GameTooltip:SetOwner(FMC.MainPanel, "ANCHOR_NONE")
    GameTooltip:ClearAllPoints()
    GameTooltip:Point("TOPLEFT", FMC.MainPanel, "TOPRIGHT", 2, 0)
    GameTooltip:AddLine("__________【 本CD依靠时光BUG,不能保证永久有效 】__________", 1, 2, 0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine(" ▼—进入副本后往里走一点,左手边有个破碎者NPC,对话传送", 0, 1,0)
    GameTooltip:AddLine(" ▼—选择传送:命令大厅,一定不要自己往里跑,楼顶门打不开!", 0, 1,0)
    GameTooltip:AddLine(" ▼—与阿卡玛对话,你会被卡在BOSS房间外,不用着急", 0, 1,0)
    GameTooltip:AddLine(" ▼—在BOSS战围栏外耐心等脱战", 0, 1,0)
    GameTooltip:AddLine(" ▼—脱战后再次与阿卡玛对话,就能正常打BOSS了!", 0, 1,0)
    GameTooltip:AddLine(" ▼—如果蛋总跑出来了,直接打BOSS就行了!", 0, 1,0)
    GameTooltip:Show()
end

function FMC:OnEnter_OrgrimmarCD()
    GameTooltip:SetOwner(FMC.MainPanel, "ANCHOR_NONE")
    GameTooltip:ClearAllPoints()
    GameTooltip:Point("TOPLEFT", FMC.MainPanel, "TOPRIGHT", 2, 0)
    GameTooltip:AddLine("_____________________【 CD清单 】____________________", 1, 2, 0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("                    ▼—决战奥格[小吼](H难度)", 0, 1,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("                   动态CD,系统强制切10人难度!", 1, 2, 0)
    GameTooltip:Show()
end

function FMC:OnEnter_StopQueue()
    GameTooltip:SetOwner(FMC.MainPanel, "ANCHOR_NONE")
    GameTooltip:ClearAllPoints()
    GameTooltip:Point("TOPLEFT", FMC.MainPanel, "TOPRIGHT", 2, 0)
    GameTooltip:AddLine("       >>>>>>>★【点击清除 多余队列】★<<<<<<<",  0, 1,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("            请进本后一定要点击此按钮,清除多余的队列!", 1, 2,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("                           可避免您进入云分流死循环!", 1, 1,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine(" 这个按钮不是让CD君退队用的,是清除其他CD君报名序列的", 1, 2,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("★染免费CD,做素质玩家!为他人让路,等于为自己让路!★", 1, 0.4,0.8)
    GameTooltip:Show()
end

function FMC:OnEnter_Heroic()
    GameTooltip:SetOwner(FMC.MainPanel, "ANCHOR_NONE")
    GameTooltip:ClearAllPoints()
    GameTooltip:Point("TOPLEFT", FMC.MainPanel, "TOPRIGHT", 2, 0)
    GameTooltip:AddLine(">>>>>>>>>>>>★【点击切换 英雄 模式】★<<<<<<<<<<<<",0, 1,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("       染 冰冠堡垒  请进本后点击此按钮,切换  H  难度", 1, 2,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("染 决战奥格[H小吼],请进队后点此按钮,提示切换10H后进本", 1, 2,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("_______________________【!注意!】______________________", 1, 0,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("             此按钮仅用于冰冠堡垒和决战奥格H小吼CD", 1, 0.4,0.8)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("             染其他进度严禁使用此按钮,避免损失进度!", 1, 0,0)
    GameTooltip:Show()
end

function FMC:OnEnter_Raid10()
    GameTooltip:SetOwner(FMC.MainPanel, "ANCHOR_NONE")
    GameTooltip:ClearAllPoints()
    GameTooltip:Point("TOPLEFT", FMC.MainPanel, "TOPRIGHT", 2, 0)
    GameTooltip:AddLine(">>>>>>>>>>>>★【点击切换 10人 模式】★<<<<<<<<<<<<",0, 1,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine(" 小号想染10人难度,请进队后点此按钮,提示切换10人后进本", 1, 2,0)
    GameTooltip:AddLine("      坐骑和幻象都是特殊掉率,人数不会影响坐骑掉率", 1, 2,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("_______________________【!注意!】______________________", 1, 0,0)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("                       此按钮严禁用于冰冠堡垒!", 1, 0.4,0.8)
    GameTooltip:AddLine(" ")
    GameTooltip:AddLine("                       这个本的10人难度不给坐骑!", 1, 0.4,0.8)
    GameTooltip:Show()
end

function FMC:ToggleMainPanel()
    local point, relativeto, point2, xOfs, yOfs = FMC.MainPanel:GetPoint()
    local width = FMC.MainPanel:GetWidth()
    if FMC.MainPanel.toggled then
        FMC.MainPanel.anim.out1:SetScript('OnFinished', function() FMC.MainPanel:SetPoint(point, relativeto, point2, xOfs - width, yOfs) end)
        E:SlideOut(FMC.MainPanel)
        FMC.MainPanel.toggled = false
        self:SetText(">")
    else
        FMC.MainPanel:SetPoint(point, relativeto, point2, xOfs + width, yOfs)
        E:SlideIn(FMC.MainPanel)
        FMC.MainPanel.toggled = true
        self:SetText("<")
    end
end

function FMC:CreateButton(parent, width, height, point, relativeto, point2, xOfs, yOfs, text, onclick, onenter)
    local width = width or (self.MainPanel:GetWidth() - 10)
    local height = height or 25

	local b = CreateFrame("Button", nil, parent)
	b:Width(width)
	b:Height(height)
	b:Point(point, relativeto, point2, xOfs, yOfs)

	if text then
		local t = b:CreateFontString(nil, "OVERLAY", b)
		t:FontTemplate()
		t:Point("CENTER", b, 'CENTER', 0, -1)
		t:SetJustifyH("CENTER")
        t:SetText(text)
		b:SetFontString(t)
    end

    b:SetScript("OnClick", onclick)
    b:SetScript("OnEnter", onenter)
    b:SetScript("OnLeave", GameTooltip_Hide)
    E.Skins:HandleButton(b)
    return b
end

function FMC:CreateMenu()
fgprodigal's avatar
fgprodigal committed
348
    self.MainPanel = CreateFrame("Frame", nil, E.UIParent, 'BackdropTemplate')
fgprodigal's avatar
Update  
fgprodigal committed
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
	self.MainPanel:SetTemplate('Transparent')
	self.MainPanel:Width(120)
	self.MainPanel:Height(260)
	self.MainPanel:Point('TOPLEFT', E.UIParent, 'TOPLEFT', -120, -200)
	self.MainPanel:SetFrameLevel(3)
	self.MainPanel.toggled = false
    self.MainPanel:SetFrameStrata("HIGH")
    self.MainPanel:Styling()

    E:SetUpAnimGroup(self.MainPanel, "Slide", -120, 0, 0.5)

    self.MainPanel.ToggleButton = self:CreateButton(self.MainPanel, 15, 40, "LEFT", self.MainPanel, "RIGHT", 0, 0, ">", FMC.ToggleMainPanel)
    self.MainPanel.NormalCDButton = self:CreateButton(self.MainPanel, nil, nil, "TOP", self.MainPanel, "TOP", 0, -10, "常规CD排队", FMC.Queue_NormalCD, FMC.OnEnter_NormalCD)
    self.MainPanel.KarazhanCDButton = self:CreateButton(self.MainPanel, nil, nil, "TOP", self.MainPanel.NormalCDButton, "BOTTOM", 0, -5, "重返卡拉赞CD", FMC.Queue_KarazhanCD, FMC.OnEnter_KarazhanCD)
    self.MainPanel.SpecialCDButton = self:CreateButton(self.MainPanel, nil, nil, "TOP", self.MainPanel.KarazhanCDButton, "BOTTOM", 0, -5, "定向CD", FMC.Queue_SpecialCD, FMC.OnEnter_SpecialCD)
    self.MainPanel.IllidanCDButton = self:CreateButton(self.MainPanel, nil, nil, "TOP", self.MainPanel.SpecialCDButton, "BOTTOM", 0, -5, "蛋刀CD", FMC.Queue_IllidanCD, FMC.OnEnter_IllidanCD)
    self.MainPanel.OrgrimmarCDButton = self:CreateButton(self.MainPanel, nil, nil, "TOP", self.MainPanel.IllidanCDButton, "BOTTOM", 0, -5, "脑残吼CD", FMC.Queue_OrgrimmarCD, FMC.OnEnter_OrgrimmarCD)
    self.MainPanel.HeroicButton = self:CreateButton(self.MainPanel, nil, nil, "TOP", self.MainPanel.OrgrimmarCDButton, "BOTTOM", 0, -5, "切换英雄难度", FMC.Switch_Heroic, FMC.OnEnter_Heroic)
    self.MainPanel.Raid10Button = self:CreateButton(self.MainPanel, nil, nil, "TOP", self.MainPanel.HeroicButton, "BOTTOM", 0, -5, "切换10人模式", FMC.Switch_Raid10, FMC.OnEnter_Raid10)
    self.MainPanel.StopQueueButton = self:CreateButton(self.MainPanel, nil, nil, "TOP", self.MainPanel.Raid10Button, "BOTTOM", 0, -5, "退出队列", FMC.StopQueue, FMC.OnEnter_StopQueue)
end

function FMC:Initialize()
    _G.ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", ChatMsgFilter)

    self:CreateMenu()
end

377
RayUI:RegisterModule(FMC:GetName())