CCCPaste

Guild Tabard flag

local class, cF, _ = UnitClass("player"); local _,_,_, hex = GetClassColor(cF); local cCol = "\124c"..hex

local c = {st="\124r", re="\124cFFFF0000", li="\124cFFADFF2F", gy="\124cFFBFBFBF", lv="\124cFFCD8FFF", bl="\124cFF00bff3", go="\124cFFf2e699", nu="\124cffffff00", fr="\124cFF00FF00", hn="\124cff0091f2", rv="\124cffa335ee", ex="\124cffff8000"}
local stand = {neu = "\124cffffff00", fri = "\124cFF00FF00", hon = "\124cff0091f2", rev = "\124cffa335ee", exa = "\124cffff8000"}

local these = {[4]="Neutral", [5]="Friendly", [6]="Honored", [7]="Revered"}
local this = 1168; local tab = 69210
local rep = C_Reputation.GetFactionDataByID(this)
local have = GetItemCount(tab,true)

if IsInGuild() then
   if rep.reaction < 8 and have == 1 then
      if GetInventoryItemID("player", 19) ~= tab then
         local nEntries, nQuests = C_QuestLog.GetNumQuestLogEntries()
         for i = 1,nEntries do
            local isComplete = C_QuestLog.IsComplete(C_QuestLog.GetQuestIDForLogIndex(i))
            if isComplete then
               return c.re.."Equip guild cloak before turning in quests!!!"
            end
         end
      else
         local cKey = strlower(strsub(these[rep.reaction],1,3))
         return "Guild: "..rep.currentStanding.."/"..rep.nextReactionThreshold..", "..stand[cKey]..these[rep.reaction]
      end
   elseif rep.reaction < 8 and have == 0 then
      return c.re.."You don't have a guild cloak!!"
   elseif rep.reaction == 8 then
      if have == 1 then
         return c.re.."Return guild tabard to Armoriste"
      else
         return c.ex.."Exalted".."\124r and "..c.fr.."no tabard"
         -- Temp while coding. Remove when done
      end
   end
else
   return c.re.."You are not in a guild!!"
end

-- This hasn't had a code consistency pass yet