Mercurial > wow > crossrealmassist
changeset 29:7267ae761cb9 beta-0.7
* indentation
| author | ShadowTheAge |
|---|---|
| date | Sun, 27 Sep 2015 16:05:33 +0300 |
| parents | 2e9ff79f6969 |
| children | 7a2435d77824 |
| files | CrossRealmAssist.lua |
| diffstat | 1 files changed, 68 insertions(+), 68 deletions(-) [+] |
line wrap: on
line diff
--- a/CrossRealmAssist.lua Sun Sep 27 16:03:59 2015 +0300 +++ b/CrossRealmAssist.lua Sun Sep 27 16:05:33 2015 +0300 @@ -46,7 +46,7 @@ quickJoinHint = true, quickJoin={[6]=1}, allLanguages = true, - stoplist = {"no hop","kick"} + stoplist = {"no hop","kick"} } } @@ -166,18 +166,18 @@ local _, action, caption, desc, voice, ilvl, time, bnetfr, charfr, guild, delisted, fullname, pcount, autoinv = C_LFGList.GetSearchResultInfo(id) if delisted then return 0 end local name,realm = PlayerName(fullname); - local stoplist = db.global.stoplist or {} - local ldesc = string.lower(caption) .. "|" .. string.lower(desc); - local isHopGroup = string.find(ldesc, "realm hop") - for i=1, #stoplist do - if string.find(ldesc, stoplist[i], 1, true) then return 0 end - end + local stoplist = db.global.stoplist or {} + local ldesc = string.lower(caption) .. "|" .. string.lower(desc); + local isHopGroup = string.find(ldesc, "realm hop") + for i=1, #stoplist do + if string.find(ldesc, stoplist[i], 1, true) then return 0 end + end if forAutoJoin then if not autoinv or recentgroups[fullname] or (not isHopGroup and (pcount >= 35 or pcount <= 5)) then return 0 end end local autoinvWeight = autoinv and 5 or 2 - local hopCoef = isHopGroup and 3 or 1 + local hopCoef = isHopGroup and 3 or 1 local visCoef = 1 if recentgroups[fullname] then @@ -194,10 +194,10 @@ end local countWeight = 4 -- count weight - if not isHopGroup then - if pcount >= 39 or pcount <= 1 then countWeight = 1 - elseif pcount >= 35 or pcount <= 5 then countWeight = 2 - elseif pcount >= 30 or pcount <= 10 then countWeight = 3 end + if not isHopGroup then + if pcount >= 39 or pcount <= 1 then countWeight = 1 + elseif pcount >= 35 or pcount <= 5 then countWeight = 2 + elseif pcount >= 30 or pcount <= 10 then countWeight = 3 end end local ageWeight = 2 @@ -369,9 +369,9 @@ homeRealm = GetRealmName() addon:RegisterChatCommand("cra", "Activate") addon:RegisterChatCommand("crossrealmassist", "Activate") - if db.global.autoCreateHopGroup then - addon:RegisterEvent("PLAYER_FLAGS_CHANGED", "PlayerFlagsUpdate") - end + if db.global.autoCreateHopGroup then + addon:RegisterEvent("PLAYER_FLAGS_CHANGED", "PlayerFlagsUpdate") + end end function addon:OnDisable() @@ -767,7 +767,7 @@ local action local function getPartyStat() - local curPartyStat = {} + local curPartyStat = {} if IsInGroup() then if IsInRaid() then for i=1, MAX_RAID_MEMBERS do @@ -779,7 +779,7 @@ end end end - return curPartyStat + return curPartyStat end local LeaveGroup = { @@ -946,16 +946,16 @@ -- Realm hop group local function CreateHopGroup() - if canJoinGroup() then - C_LFGList.CreateListing(16,"Realm hopping - "..homeRealm,0,"","",true) - addon:ScheduleTimer(ConvertToRaid, 5) - end + if canJoinGroup() then + C_LFGList.CreateListing(16,"Realm hopping - "..homeRealm,0,"","",true) + addon:ScheduleTimer(ConvertToRaid, 5) + end end function addon:PlayerFlagsUpdate(event, target) - if target == "player" and UnitIsAFK("player") and C_Garrison.IsOnGarrisonMap() and db.global.autoCreateHopGroup then - CreateHopGroup() - end + if target == "player" and UnitIsAFK("player") and C_Garrison.IsOnGarrisonMap() and db.global.autoCreateHopGroup then + CreateHopGroup() + end end -- Settings @@ -989,7 +989,7 @@ local function toggleCreateHopGroup(btn, arg1, arg2, checked) db.global.autoCreateHopGroup = checked - if checked then addon:RegisterEvent("PLAYER_FLAGS_CHANGED", "PlayerFlagsUpdate") end + if checked then addon:RegisterEvent("PLAYER_FLAGS_CHANGED", "PlayerFlagsUpdate") end end local function ClearJoinHistory() @@ -1000,25 +1000,25 @@ local function QuickJoinStoplist() StaticPopupDialogs["CROSS_REALM_ASSIST_STOPLIST"] = { - OnShow = function (self, data) - self.editBox:SetText(table.concat(db.global.stoplist or {}, ",")) - end, - OnAccept=function(self) - local text = self.editBox:GetText(); - local stoplist = {} - for item in string.gmatch(text, "[^, ][^,]*") do - table.insert(stoplist,string.lower(item)) - end - db.global.stoplist = stoplist - end, - button1 = OKAY, - button2 = CANCEL, - editBoxWidth = 350, - hasEditBox=true, - text = "Ignore groups containing following words:\nSeparated by comma", - preferredIndex = 3 - } - StaticPopup_Show("CROSS_REALM_ASSIST_STOPLIST") + OnShow = function (self, data) + self.editBox:SetText(table.concat(db.global.stoplist or {}, ",")) + end, + OnAccept=function(self) + local text = self.editBox:GetText(); + local stoplist = {} + for item in string.gmatch(text, "[^, ][^,]*") do + table.insert(stoplist,string.lower(item)) + end + db.global.stoplist = stoplist + end, + button1 = OKAY, + button2 = CANCEL, + editBoxWidth = 350, + hasEditBox=true, + text = "Ignore groups containing following words:\nSeparated by comma", + preferredIndex = 3 + } + StaticPopup_Show("CROSS_REALM_ASSIST_STOPLIST") end local function initMenu(self, level) @@ -1026,37 +1026,37 @@ if level == 1 then UIDropDownMenu_AddButton({text="Clear realm history",notCheckable=1,func=ClearRealmHistory}, level) UIDropDownMenu_AddButton({text="Clear join history",notCheckable=1,func=ClearJoinHistory}, level) - - if canJoinGroup() then - UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) - UIDropDownMenu_AddButton({text="Create a group for realm hoppers",notCheckable=1,func=CreateHopGroup}, level) - end - - UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) - UIDropDownMenu_AddButton({text="Show Quick Join Hint",checked=db.global.quickJoinHint, func=toggleQuickJoinHint,keepShownOnClick=true,isNotRadio=true}, level) - UIDropDownMenu_AddButton({text="Settings",notCheckable=1,hasArrow=1,value="settings",keepShownOnClick=true}, level) + + if canJoinGroup() then + UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) + UIDropDownMenu_AddButton({text="Create a group for realm hoppers",notCheckable=1,func=CreateHopGroup}, level) + end + + UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) + UIDropDownMenu_AddButton({text="Show Quick Join Hint",checked=db.global.quickJoinHint, func=toggleQuickJoinHint,keepShownOnClick=true,isNotRadio=true}, level) + UIDropDownMenu_AddButton({text="Settings",notCheckable=1,hasArrow=1,value="settings",keepShownOnClick=true}, level) elseif level == 2 then - if UIDROPDOWNMENU_MENU_VALUE == "settings" then - UIDropDownMenu_AddButton({text="Show Minimap Button",checked=not db.global.minimap.hide, func=toggleMinimapIcon,keepShownOnClick=true,isNotRadio=true}, level) - UIDropDownMenu_AddButton({text="All language groups",checked=db.global.allLanguages, func=toggleAllLanguages,keepShownOnClick=true,isNotRadio=true}, level) - UIDropDownMenu_AddButton({text="Apply to groups as DD only",checked=db.global.applyAsDD, func=toggleApplyAsDD,keepShownOnClick=true,isNotRadio=true}, level) - UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) - UIDropDownMenu_AddButton({text="Quick join categories",notCheckable=1,hasArrow=1,value="qjc",keepShownOnClick=true}, level) - UIDropDownMenu_AddButton({text="Edit Quick Join Stoplist",notCheckable=1,func=QuickJoinStoplist}, level) - UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) - UIDropDownMenu_AddButton({text="Experimental features",notCheckable=1,hasArrow=1,value="experimental",keepShownOnClick=true}, level) - end + if UIDROPDOWNMENU_MENU_VALUE == "settings" then + UIDropDownMenu_AddButton({text="Show Minimap Button",checked=not db.global.minimap.hide, func=toggleMinimapIcon,keepShownOnClick=true,isNotRadio=true}, level) + UIDropDownMenu_AddButton({text="All language groups",checked=db.global.allLanguages, func=toggleAllLanguages,keepShownOnClick=true,isNotRadio=true}, level) + UIDropDownMenu_AddButton({text="Apply to groups as DD only",checked=db.global.applyAsDD, func=toggleApplyAsDD,keepShownOnClick=true,isNotRadio=true}, level) + UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) + UIDropDownMenu_AddButton({text="Quick join categories",notCheckable=1,hasArrow=1,value="qjc",keepShownOnClick=true}, level) + UIDropDownMenu_AddButton({text="Edit Quick Join Stoplist",notCheckable=1,func=QuickJoinStoplist}, level) + UIDropDownMenu_AddButton({disabled=1,notCheckable=1}, level) + UIDropDownMenu_AddButton({text="Experimental features",notCheckable=1,hasArrow=1,value="experimental",keepShownOnClick=true}, level) + end elseif level == 3 then - if UIDROPDOWNMENU_MENU_VALUE == "qjc" then + if UIDROPDOWNMENU_MENU_VALUE == "qjc" then for i=1,#lfgGroups do local groupId = lfgGroups[i] UIDropDownMenu_AddButton({text=(C_LFGList.GetCategoryInfo(groupId)),checked=db.global.quickJoin[groupId],arg1=groupId,func=toggleQuickJoin,keepShownOnClick=true,isNotRadio=true}, level) end elseif UIDROPDOWNMENU_MENU_VALUE == "experimental" then - UIDropDownMenu_AddButton({isTitle=1,text="Use at your own risk!",notCheckable=1}, level) - UIDropDownMenu_AddButton({text="Auto create group for realm hopping when AFK at garrison",checked=db.global.autoCreateHopGroup,keepShownOnClick=true,isNotRadio=true,func=toggleCreateHopGroup}, level) - end - end + UIDropDownMenu_AddButton({isTitle=1,text="Use at your own risk!",notCheckable=1}, level) + UIDropDownMenu_AddButton({text="Auto create group for realm hopping when AFK at garrison",checked=db.global.autoCreateHopGroup,keepShownOnClick=true,isNotRadio=true,func=toggleCreateHopGroup}, level) + end + end end function addon.ShowSettings(frame)
