Skip to content

Commit

Permalink
LookingForGroup : update version
Browse files Browse the repository at this point in the history
  • Loading branch information
YellowDi committed Aug 7, 2017
1 parent 5f1f67f commit 4a05b8d
Show file tree
Hide file tree
Showing 29 changed files with 790 additions and 404 deletions.
6 changes: 3 additions & 3 deletions Interface/AddOns/LookingForGroup/CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
------------------------------------------------------------------------
r305 | euloanty@live.com | 2017-07-31 10:49:11 -0500 (Mon, 31 Jul 2017) | 1 line
r335 | euloanty@live.com | 2017-08-06 13:51:45 -0500 (Sun, 06 Aug 2017) | 1 line
Changed paths:
M /trunk/Options/options/Core.lua
M /trunk/Core/Core.lua

bug fixing
lfg core color fixing
------------------------------------------------------------------------

3 changes: 3 additions & 0 deletions Interface/AddOns/LookingForGroup/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ function LookingForGroup:OnEnable()
if profile.enable_av then
LoadAddOn("LookingForGroup_AV")
end
if profile.hook_quick_join then
QuickJoinToastButton:Hide()
end
end

function LookingForGroup.Search(callback,category,terms,filters,preferredfilters,delay)
Expand Down
2 changes: 1 addition & 1 deletion Interface/AddOns/LookingForGroup/LookingForGroup.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 70200
## Author: cqwrteur
## Title: LookingForGroup
## Version: 306
## Version: 336
## SavedVariables: LookingForGroupDB

#@no-lib-strip@
Expand Down
8 changes: 5 additions & 3 deletions Interface/AddOns/LookingForGroup_AV/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ function LookingForGroup_AV:OnInitialize()
{
role = 0,
parties =
{
},
{},
potentials =
{},
status =
{}
-- raid_leader = nil
}
},true)
Expand All @@ -28,9 +29,10 @@ end
function LookingForGroup_AV:OnEnable()
if LookingForGroup.db.profile.enable_av then
self:RegisterEvent("GROUP_ROSTER_UPDATE")
self:RegisterEvent("UPDATE_BATTLEFIELD_STATUS")
self:RegisterChatCommand("v","ChatCommand")
else
self:UnregisterEvent("GROUP_ROSTER_UPDATE")
self:UnregisterAllEvents()
self:UnregisterChatCommand("v","ChatCommand")
end
end
Expand Down
2 changes: 1 addition & 1 deletion Interface/AddOns/LookingForGroup_AV/LookingForGroup_AV.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Author: cqwrteur
## Title: LookingForGroup Alterac Valley
## Dependencies: LookingForGroup
## Version: 306
## Version: 336
## SavedVariablesPerCharacter: LookingForGroup_AVCharacterDB
## LoadOnDemand: 1

Expand Down
76 changes: 39 additions & 37 deletions Interface/AddOns/LookingForGroup_AV/party_leader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,29 @@ local function isrl(rl)
return LookingForGroup_AV.db.profile.raid_leader == rl
end

party_leader[1] = function(rl,name)-- party_leader.invite(rl,name)
party_leader[1] = function(rl,name) -- party_leader.invite(rl,name)
if isp() and isrl(rl) then
InviteUnit(name)
end
end

local invite_temp

local function cinvite()
LookingForGroup_AV.SetRole(1)
local i
for i = 1,#invite_temp do
InviteUnit(nms[i])
end
end

party_leader[2] = function(rl,...)-- party_leader.create_invite(rl,...)
party_leader[2] = function(rl,...) -- party_leader.create_invite(rl,...)
if isrl(rl) then
invite_temp = {...}
if UnitInParty("player") then
LeaveParty()
LookingForGroup_AV:ScheduleTimer(cinvite,3)
else
cinvite()
end
local invite_temp = {...}
LeaveParty()
LookingForGroup_AV:ScheduleTimer(function()
LookingForGroup_AV.SetRole(1)
local i
for i = 1,#invite_temp do
InviteUnit(invite_temp[i])
end
end,1)
end
end

--[[function LookingForGroup_AV.party_leave_raid()
if isp() then
LookingForGroup_AV.SetRole(0)
local profile = LookingForGroup_AV.db.profile
local raid_leader = profile.raid_leader
LookingForGroup_AV:SendCommand(serialize,"WHISPER",raid_leader)
profile.raid_leader = nil
end
end]]

local confirm_instruction = LookingForGroup_AV:Serialize(1,4)

party_leader[3] = function(rl)-- party_leader.roleconfirm(rl)
party_leader[3] = function(rl) -- party_leader.roleconfirm(rl)
if isrl(rl) then
LookingForGroup_AV_SendCommand(LookingForGroup_AV,confirm_instruction,"PARTY")
LookingForGroup_AV_SendCommand(LookingForGroup_AV,LookingForGroup_AV:Serialize(1,4),"PARTY")
end
end

Expand All @@ -74,21 +54,43 @@ party_leader[5] = function(rl,...) -- party_leader.broadcast_chat_message(rl,...
end
end

local members = {}
party_leader[6] = function(rl)
if isrl(rl) then
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(1,5),"PARTY")
end
end

function LookingForGroup_AV:GROUP_ROSTER_UPDATE()
if isp() then
local profile = LookingForGroup_AV.db.profile
local raid_leader = profile.raid_leader
local numgm = GetNumGroupMembers()
wipe(members)
local members = {}
local i
for i = 1,numgm do
local name = UnitName("party"..i)
table_insert(members,name)
local unit = "player"
if 1 < i then
unit = "party"..i-1
end
local name,server = UnitFullName(unit)
table_insert(members,{name..'-'..server,UnitGroupRolesAssigned(unit),select(2,UnitClass(unit))})
end
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(3,1,members),"WHISPER",raid_leader)
end
end

function LookingForGroup_AV:UPDATE_BATTLEFIELD_STATUS(event,index,...)
if isp() then
local raid_leader = LookingForGroup_AV.db.profile.raid_leader
local status = GetBattlefieldStatus(index)
if status == "none" then
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(3,3),"WHISPER",raid_leader)
elseif status == "queued" then
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(3,3,0,GetBattlefieldEstimatedWaitTime(index),GetBattlefieldTimeWaited(index)),"WHISPER",raid_leader)
elseif status == "confirm" then
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(3,3,1,GetBattlefieldPortExpiration(index)),"WHISPER",raid_leader)
end
end
end

LookingForGroup_AV.member[2] = party_leader
106 changes: 67 additions & 39 deletions Interface/AddOns/LookingForGroup_AV/raid_leader.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
local LookingForGroup_AV = LibStub("AceAddon-3.0"):GetAddon("LookingForGroup_AV")
local AceAddon = LibStub("AceAddon-3.0")
local LookingForGroup_AV = AceAddon:GetAddon("LookingForGroup_AV")
local LookingForGroup_AV_SendCommand = LookingForGroup_AV.SendCommand

local string_find = string.find
local table_insert = table.insert
local table_remove = table.remove
local next = next
local pairs = pairs
local UnitName = UnitName
local C_LFGList_GetApplicantInfo = C_LFGList.GetApplicantInfo
local C_LFGList_GetApplicantMemberInfo = C_LFGList.GetApplicantMemberInfo

local function name_is_same_realm(name)
if string_find(name,'-') == nil then
return false
return true
end
return true
end

local function isr()
Expand All @@ -23,33 +18,49 @@ end

local function potential(potentials,name)
if name_is_same_realm(name) then
table_insert(potentials,name)
potentials[#potentials + 1] = name
end
return name
end

local function party_assign(parties,potentials,name)
local function too_many_healers(v)
local num = 0
for i=1,#v do
if v[i][2] == "HEALER" then
num = num + 1
if 1 < num then
return true
end
end
end
end

local function party_assign(parties,potentials,name,ishealer)
local d = name_is_same_realm(name)
local i
local k,v
for k,v in pairs(parties) do
if #v < 4 then
if #v < 5 and not (ishealer and too_many_healers(v)) then
if d then
table_insert(potentials,name)
potentials[name] = name
end
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(2,1,name),"WHISPER",k)
return
end
end
if d then
table_insert(potentials,name)
potentials[name] = name
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(1,1),"WHISPER",name)
else
local top = potentials[#potentials]
if top ~= nil then
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(2,2,name),"WHISPER",top)
local top = next(potentials)
if top then
parties[name] = {}
table_remove(potentials,#potentials)
LookingForGroup_AV:SendCommand(LookingForGroup_AV:Serialize(2,2,name),"WHISPER",top)
potentials[top] = nil
local ok,LookingForGroup_Options = pcall(AceAddon.GetAddon,AceAddon,"LookingForGroup_Options")
if ok then
LookingForGroup_Options.NotifyChangeIfSelected("av\1status")
end
end
end
end
Expand All @@ -60,9 +71,9 @@ function LookingForGroup_AV.InviteApplicant(app_i)
local parties = profile.parties
local potentials = profile.potentials
local id, status, pendingStatus, numMembers, isNew, comment = C_LFGList_GetApplicantInfo(app_i)
local name = C_LFGList_GetApplicantMemberInfo(id,1)
local name, class, localizedClass, level, itemLevel, honorLevel, tank, healer, damage, assignedRole, relationship = C_LFGList_GetApplicantMemberInfo(id,1)
if numMembers == 1 then
party_assign(parties,potentials,name)
party_assign(parties,potentials,name,assignedRole == "HEALER")
else
if name_is_same_realm(name) then
self:SendCommand(self:Serialize(1,2),"WHISPER",name)
Expand All @@ -72,7 +83,7 @@ function LookingForGroup_AV.InviteApplicant(app_i)
end
end

function LookingForGroup_AV.CreateListing(name,...)
function LookingForGroup_AV.Start()
local profile = LookingForGroup_AV.db.profile
if profile.raid_leader == nil then
local parties = profile.parties
Expand All @@ -81,6 +92,10 @@ function LookingForGroup_AV.CreateListing(name,...)
parties[name]={}
profile.raid_leader = name
end
end

function LookingForGroup_AV.CreateListing(name,...)
LookingForGroup_AV.Start()
if isr() then
C_LFGList.CreateListing(44,"#AV#"..name,...)
end
Expand All @@ -99,40 +114,33 @@ function LookingForGroup_AV.RemoveListing(...)
end

function LookingForGroup_AV.rl_disban()
if isr() then
local profile = LookingForGroup_AV.db.profile
profile.raid_leader = nil
profile.role = 0
wipe(profile.parties)
end
end

function LookingForGroup_AV.rl_roleconfirm()
if isr() then
local serialize = LookingForGroup_AV:Serialize(2,3)
local parties = LookingForGroup_AV.db.profile.parties
local k,v
for k,v in pairs(parties) do
LookingForGroup_AV_SendCommand(LookingForGroup_AV,serialize,"WHISPER",k)
end
end
local profile = LookingForGroup_AV.db.profile
profile.role = 0
wipe(profile.parties)
wipe(profile.potentials)
wipe(profile.status)
profile.raid_leader = nil
end

local raid_leader = {}

raid_leader[1] = function(leader,members) --raid_leader.group_roster_update(leader,members)
if isr() then
local parties = LookingForGroup_AV.db.profile.parties
if parties[leader] ~= nil then
if parties[leader] then
parties[leader] = members
local ok,LookingForGroup_Options = pcall(AceAddon.GetAddon,AceAddon,"LookingForGroup_Options")
if ok then
LookingForGroup_Options.NotifyChangeIfSelected("av\1parties")
end
end
end
end

raid_leader[2] = function(source,...) -- raid_leader.broadcast_chat_message(source,...)
if isr() then
local parties = LookingForGroup_AV.db.profile.parties
if parties[source] ~= nil then
if parties[source] then
local serialize = LookingForGroup_AV:Serialize(2,5,...)
local k,v
for k,v in pairs(parties) do
Expand All @@ -142,4 +150,24 @@ raid_leader[2] = function(source,...) -- raid_leader.broadcast_chat_message(sour
end
end

raid_leader[3] = function(source,status,...) -- raid_leader.update_status(source,...)
if isr() then
local profile = LookingForGroup_AV.db.profile
local parties = profile.parties
if parties[source] then
if status == nil then
profile.status[source] = nil
elseif status == 0 then
profile.status[source] = {0,GetTime(),...}
elseif status == 1 then
profile.status[source] = {1,GetTime(),...}
end
local ok,LookingForGroup_Options = pcall(AceAddon.GetAddon,AceAddon,"LookingForGroup_Options")
if ok then
LookingForGroup_Options.NotifyChangeIfSelected("av\1parties")
end
end
end
end

LookingForGroup_AV.member[3] = raid_leader
Loading

0 comments on commit 4a05b8d

Please sign in to comment.