--[[ ## Author: Hrazmadul ## Version: 1.6.28
Pepe Collection 1.6.28 by Hrazmadul
Created 2019-12-17
Updated 2025-11-24

2025/12/25更新：由电视卫士汉化，免费且随意分享，所有权利属于原作者
汉化版发布于NGA插件区、新手盒子、网易DD、黑盒工坊，请勿用于任何其他盈利用途

1.6.28 Updated TOC for 11.2.5
1.6.27 Updated TOC for 11.2.0
1.6.26 Updated TOC for 11.1.7
1.6.25 Updated TOC for 11.1.5
1.6.24 Updated TOC for 11.1.0
1.6.23 Updated TOC for 11.0.7
1.6.22 Updated TOC for 11.0.5
1.6.21 Updated TOC for 11.0.2
1.6.20 Updated TOC for 11.0.0
1.6.19 Updated TOC for 10.2.7
1.6.18 Added Plunderstorm Pepe
1.6.17 Updated TOC for 10.2.6
1.6.16 Updated TOC for 10.2.5 Added Dragon,Explorer,Tuskarr Pepes
1.6.15 Added Festive Trans-Dimensional Bird Whistle
1.6.14 Updated TOC for 10.2.0
1.6.13 Updated TOC for 10.1.7
1.6.12 Small fixes
1.6.11 Updated TOC for 10.1.5
1.6.10 Added an icon to the TOC
1.6.9 Updated TOC for 10.1.0
1.6.8 Updated TOC for 10.0.7
1.6.7 Updated TOC for 10.0.5
1.6.6 Updated TOC for 10.0.2
1.6.5 Updated TOC for 10.0.0
1.6.4 Updated TOC for 9.2.7
1.6.3 Updated TOC for 9.2.5
1.6.2 Updated TOC for 9.2
1.6.1 Updated TOC for 9.1.5
1.6.0 Changed reading of the players covenant
1.5.9 Added Renown 56 Pepes
1.5.8 Updated TOC for 9.1.0
1.5.7 Updated TOC for 9.0.5
1.5.6 Updated the Winter Pepe Coords
1.5.5 Updated TOC for 9.0.2 and shortened Pin text a bit.
1.5.4 Added the new Map Pins from 9.0.1 to some pepes, you can only have one pin active.
1.5.3 Updated TOC to Shadowlands Prepatch
1.5.2 Separated horde and alliance waypoints for clearer output.
1.5.1 Updated to handle list of coordinates for Traveller Pepe.
]]--

local version="1.6.28"
local updated="2025-11-24"
local creator="Hrazmadul"

local f = CreateFrame("Frame");

local col_heirloom	= "cff00ccff"
local col_artifact	= "cffe6cc80"
local col_legendary	= "cffff8000"
local col_epic	= "cffa335ee"
local col_rare	= "cff0070dd"
local col_uncommon	= "cff1eff00"
local col_common	= "cffffffff"
local col_poor	= "cff9d9d9d"

local col_mogit	= "cffcc99ff"
local col_pepe	= col_mogit
local col_zonetext	= "cff8080ff"	-- cff8080ff purple
local col_title	= "cffffb200"	-- cffffb200 orange
local col_b		= "|"
local col_e		= "|r"

local col_name	= col_b..col_common
local col_loadname	= col_b..col_mogit
local col_version	= col_b..col_uncommon
local col_creator	= col_b..col_mogit

local playerCovenantID = 0

local lastAddedWaypoint = nil;
local function addPepeTomTomWaypoint(map, zone, coordX, coordY, text)
	if (TomTom) then
		local mapzonename = map
		local slask, mapid, coordlist
	
		if (map:find("LIST")) then -- coord list
			slask, mapid = map:match("(%d*);(%d*)");
			coordlist = { strsplit("/", zone) }
			for i=1,table.getn(coordlist) do
				local tempx, tempy = coordlist[i]:match("([^:]*),([^:]*)");

				lastAddedWaypoint = TomTom:AddWaypoint(tonumber(mapid), tonumber(tempx)/100, tonumber(tempy)/100, {
					title = "佩佩大全 - " .. date("%H:%M").. " - " .. text,
					from = "佩佩大全",
					persistent = nil,
					minimap = true,
					world = true
				})
			end
			print("已添加至TomTom：坐标列表（地图："..mapid.."）- "..text)
		elseif  (map:find("MAP")) then -- special map coord
			slask, mapid = map:match("(%d*);(%d*)");
			
			lastAddedWaypoint = TomTom:AddWaypoint(tonumber(mapid), tonumber(coordX)/100, tonumber(coordY)/100, {
				title = "佩佩大全 - " .. date("%H:%M").. " - " .. text,
				from = "佩佩大全",
				persistent = nil,
				minimap = true,
				world = true
			})
			print("已添加至TomTom：地图："..mapid.." "..zone.." "..coordX.." "..coordY.." "..text)
		elseif (map=="MZCW") then -- special map zone continent world coord
			local idmap, idzone, idcontinent, idworld = zone:match("(%d*)/(%d*)/(%d*)/(%d*)");
			mapzonename = "M:"..idmap.." Z:"..idzone.." C:"..idcontinent.." W:"..idworld
			print("已添加至TomTom："..mapzonename.." "..coordX.." "..coordY.." "..text)

			lastAddedWaypoint = TomTom:AddWaypoint(tonumber(idmap), tonumber(coordX)/100, tonumber(coordY)/100, {
				title = "佩佩大全 - " .. date("%H:%M").. " - " .. text,
				from = "佩佩大全",
				persistent = nil,
				minimap = true,
				world = true
			})
		else -- ordinary coord
			if not (zone=="") then
				mapzonename = mapzonename..":"..zone
			end
			print("已添加至TomTom："..mapzonename.." "..coordX.." "..coordY.." "..text)
			lastAddedWaypoint = TomTom:AddWaypoint(TomTom.NameToMapId[mapzonename], tonumber(coordX)/100, tonumber(coordY)/100, {
				title = "佩佩大全 - " .. date("%H:%M").. " - " .. text,
				from = "佩佩大全",
				persistent = nil,
				minimap = true,
				world = true
			})
		end
	else -- no tomtom
		print "TomTom未加载"
	end
end

local function LinkToVar(link)
	local set = {};
	-- local items, race, gender, enchant = strsplit(":", link:match("MogIt:(.+)"));
    local map, zone, cx, cy, tttext = link:match("PEPETOMTOM:([^:]*):([^:]*):([^:]*):([^:]*):([^|]*)");
	return map, zone, cx, cy, tttext;
end

local function filter(self, event, msg, ...)
	msg = msg:gsub("%[(PEPETOMTOM[^%]]+)%]","|"..col_pepe.."|H%1|h[TomTom]|h|r");
	return false, msg, ...;
end
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", filter);

local SetHyperlink = ItemRefTooltip.SetHyperlink;
function ItemRefTooltip:SetHyperlink(link)
  if link:find("^PEPETOMTOM") then
    if IsModifiedClick("CHATLINK") then
      ChatEdit_InsertLink("["..link.."]")
    else
      local map, zone, cx, cy, tttext = LinkToVar(link);

      if (TomTom) then
        addPepeTomTomWaypoint(map, zone, cx, cy, tttext)
      else
        -- StaticPopup_Show("CLICK_LINK_CLICKURL", "", "", d)
      end
    end
    else
      SetHyperlink(self, link);
    end
end

StaticPopupDialogs["CLICK_LINK_CLICKURL"] = {
    text = "复制并粘贴至TomTom导航",
    button1 = "关闭",
    OnAccept = function()
    end,
    timeout = 0,
    whileDead = true,
    hideOnEscape = true,
    preferredIndex = 3, 
    OnShow = 
        function (self, data)
            self.editBox:SetText(data.tomtom)
            self.editBox:HighlightText()
        end,
    hasEditBox = true
}

-------------------------------------------------------------------
-- Command line processing
-------------------------------------------------------------------
-- traveller pepe coords
--TomTom: You are at (56.85, 50.61) in 'Dalaran' (map: 627)
--TomTom: Dalaran: (map: 627, zone: 627, continent: 619, world: 947)
--TomTom:    TomTom waypoint - 49.97, 33.76 627 * *
--49.12,32.40/39.15,33.36/39.25,25.10/51.27,53.49/57.12,53.05/36.84,37.06/48.65,40.20/32.25,31.66/55.39,44.14/50.59,57.19/36.17,27.70/57.87,42.28/59.87,52.53/59.87,52.53/41.88,33.03

-- Name						ItemID	Quest	X1		Y1		X2		Y2
-- A Tiny Viking Helmet		127865	39265	80.18	50.36	TomTom: You are at (80.18, 50.36) in '纳格兰' (map: 550)
-- A Tiny Ninja Shroud		127867	39267	47.50	41.30	TomTom: You are at (47.50, 41.30) in 'Gorgrond' (map: 543)
-- A Tiny Plated Helm		127869	39266	50.97	63.30	TomTom: You are at (50.97, 63.30) in 'Talador' (map: 535)
-- A Tiny Pirate Hat		127870	39268	54.12	83.61	TomTom: You are at (54.12, 83.61) in 'Spires of Arak' (map: 542)
-- A Tiny Scarecrow Costume	128874	39865	H50.89	H70.40	A29.40	A19.70  problems setting a waypoint with tomtom
-- A Tiny Pair of Goggles	139632	43695	*	*	too many points
-- A Tiny Voodoo Mask		161443	52269	39.04	16.04	TomTom: You are at (39.04, 16.04) in 'Dazar'alor' (map: 1165)
-- A Tiny Diving Helmet		161451	52277	54.40	72.61	TomTom: You are at (54.40, 72.61) in 'Boralus' (map: 1161)
-- A Tiny Clockwork Key		170151	56911	68.47	47.85	TomTom: You are at (68.47, 47.85) in 'Mechagon Island' (map: 1462)
-- A Tiny Winter Hat		174865	58901	H52.9	H77.5	A34.3	A68.5	org(map 85)/if(map 87)
-- /tway list
-- Winter Pepe TomTom: You are at (33.95, 68.21) in 'Ironforge' (map: 87)
-- Winter Pepe TomTom: You are at (52.98, 77.43) in 'Orgrimmar' (map: 85)
-- TomTom: You are at (---) in 'Unnamed Map' (map: nil)
-- TomTom: Lunarfall: (map: 582, zone: 539, continent: 572, world: 572)
-- TomTom: Frostwall: (map: 590, zone: 525, continent: 572, world: 572)
-- Name						ItemID	Quest	X1		Y1		X2		Y2
-- A Tiny Winter Staff		186473	64078					https://www.wowhead.com/item=186473/a-tiny-winter-staff
-- A Tiny Vial of Slime		186524	64098					https://www.wowhead.com/item=186524/a-tiny-vial-of-slime
-- A Tiny Sinstone			186580	64132					https://www.wowhead.com/item=186580/a-tiny-sinstone
-- A Tiny Pair of Wings		186593	64136					https://www.wowhead.com/item=186593/a-tiny-pair-of-wings

-- /tway 14.78 23.9				Add a new waypoint at 14.78, 23.90	 
-- /tway 纳格兰 45 50			Add a new waypoint in 纳格兰 at 45, 50	 
-- /tway 14.78 23.90 This is a waypoint!	Add a new waypoint with a description	 
-- /tway reset all				Remove ALL current waypoints	 
-- /tway reset 纳格兰			Remove all waypoints in 纳格兰	 
-- /wayb or /wayback				Sets a waypoint at the current location	 
-- /cway or /closestway			Set the crazy arrow to the closest waypoint
-- /tway list					List the current known waypoints
-- /tway arrow				Print the status of the Crazy Arrow

-- Could not find any matches for zone "The Azure Span".
-- Found multiple matches for zone 'The Azure Span'.  Did you mean: The Azure Span:Dragon Isles, The Azure Span:The Azure Span


local function ItemLink(color,id,idtext)
  linktext = "|"..color.."|Hitem:"..id.."::::::::120:::::|h["..idtext.."]|h|r"
return linktext
end

local function PepeTomTomLink(map, zone, x, y, text)
  local tomtomstring = ""
  local mapzone = map
  if not (zone=="") then
     mapzone = mapzone..","..zone
  end
  if (TomTom) then
    tomtomstring = format("|%s|HPEPETOMTOM:%s:%s:%s:%s:%s|h[TomTom]|h|r",col_pepe, map, zone, x, y, text)
  else
  	if (map:find("LIST")) then
		tomtomstring = "坐标点过多，无法展示"
  	elseif (map:find("MAP")) then
	    local slask, mapid = map:match("(%d*);(%d*)");
		tomtomstring = format("地图：%s %s (%s,%s) %s", mapid, zone, x, y, text)
	else
		tomtomstring = format("%s (%s,%s) %s", mapzone, x, y, text)
	end
  end
 return tomtomstring
end

  -- https://wow.gamepedia.com/API_C_Map.SetUserWaypoint
  -- C_Map.SetUserWaypoint(point)
  -- uiMapPoint = UiMapPoint.CreateFromCoordinates(mapID, x, y, z)
  -- uiMapPoint = UiMapPoint.CreateFromVector2D(mapID, position, z)
  -- uiMapPoint = UiMapPoint.CreateFromVector3D(mapID, position)
  -- local uiMapPoint = { uiMapID = mapID, position = CreateVector2D(x, y), z = z };
  -- 1161 map 51,64
  -- C_Map.SetUserWaypoint(UiMapPoint.CreateFromCoordinates(1161, tonumber(51)/100, tonumber(64)/100, tonumber(0)/100))
  -- below work to set a map pin
  -- C_Map.SetUserWaypoint(UiMapPoint.CreateFromCoordinates(1161, tonumber(51)/100, tonumber(64)/100, tonumber(0)/100))
  -- "|cffffff00|Hworldmap:84:7222:2550|h[|A:Waypoint-MapPin-ChatIcon:13:13:0:0|a Map Pin Location]|h|r"
  -- print(MapPinLink(1161,51,64,"mappy"))

local function MapPinLink(mapid,x,y, pintext)
  local coordx=tonumber(x)*100
  local coordy=tonumber(y)*100
  return format("|cffffff00|Hworldmap:%s:%s:%s|h[|A:Waypoint-MapPin-ChatIcon:13:13:0:0|a %s]|h|r", mapid, coordx, coordy, pintext)
end

local function factionHalloween()
	local fac
	local englishFaction, localizedFaction = UnitFactionGroup("player")
	--" (H)"..TomTomLink("MAP;590","590","70.7","90.1","Scarecrow Pepe").." (A)"..TomTomLink("MAP;582","582","40.08","69.60","Scarecrow Pepe")},
	if (englishFaction=="Horde") then
		fac="（部落）"..PepeTomTomLink("MAP;590","霜寒晶壁","70.7","90.1","稻草人佩佩") -- ..MapPinLink(590,70.7,90.1,"Scarecrow Pepe") -- doesnt work in garr
	elseif (englishFaction=="Alliance") then
		fac="（联盟）"..PepeTomTomLink("MAP;582","坠落之月","40.08","69.60","稻草人佩佩") -- ..MapPinLink(582,40.08,69.60,"Scarecrow Pepe") -- doesnt work in garr
	end
	return fac
end

local function factionWinter()
	local fac
	local englishFaction, localizedFaction = UnitFactionGroup("player")
	--" (H)"..TomTomLink("Orgrimmar","","52.9","77.5","Greatfather Winter Pepe").." (A)"..TomTomLink("Ironforge","","34.3","68.5","Greatfather Winter Pepe")
	if (englishFaction=="Horde") then
		fac="（部落）"..PepeTomTomLink("奥格瑞玛","","52.98","77.43","冬天爷爷佩佩")..MapPinLink(85, 52.98, 77.43, "佩佩爷爷")
	elseif (englishFaction=="Alliance") then
		fac="（联盟）"..PepeTomTomLink("铁炉堡","","33.95","68.21","冬天爷爷佩佩")..MapPinLink(87, 33.95, 68.21,"佩佩爷爷")
	end
	return fac
end

-- https://wowpedia.fandom.com/wiki/Category:API_namespaces/C_Covenants
-- 0	None
-- 1	Kyrian
-- 2	Venthyr
-- 3	NightFae
-- 4	Necrolord
-- https://wowpedia.fandom.com/wiki/API_C_Covenants.GetActiveCovenantID
-- some issues info not available until reload or similar
local function covenantUser()
	local covenantID
	covenantID = C_Covenants.GetActiveCovenantID()
	return covenantID
end

local function covenantText(checkcov)
    local covt
	if (checkcov==0) then
	  covt="无"
	elseif (checkcov==1) then
	  covt="格里恩"
	elseif (checkcov==2) then
	  covt="温西尔"
	elseif (checkcov==3) then
	  covt="法夜"	
	elseif (checkcov==4) then
	  covt="通灵领主"
	end
	return covt
end

-- nagrand draenor 550 gorgrond ?? talador ?? spires 542 dazalor ?? boralus ?? mecha
-- kept for reference
--{"A Tiny Scarecrow Costume",	"L3 Garrison Halloween",		39865,	"128874",	col_uncommon,	" (H)"..TomTomLink("Frostfire Ridge","","50.89","70.40","Scarecrow Pepe").." (A)"..TomTomLink("Shadowmoon Valley","德拉诺","29.40","19.70","Scarecrow Pepe")},
--{"A Tiny Scarecrow Costume",	"L3 Garrison Halloween",		39865,	"128874",	col_uncommon,	" (H)"..TomTomLink("MZCW","590/525/572/572","70.7","90.1","Scarecrow Pepe").." (A)"..TomTomLink("MZCW","582/539/572/572","40.08","69.60","Scarecrow Pepe")},
--{"A Tiny Scarecrow Costume",	"L3 Garrison Halloween",		39865,	"128874",	col_uncommon,	" (H)"..TomTomLink("MAP;590","590","70.7","90.1","Scarecrow Pepe").." (A)"..TomTomLink("MAP;582","582","40.08","69.60","Scarecrow Pepe")},
--{"A Tiny Pair of Goggles",	"Legion Dalaran",				43695,	"139632",	col_uncommon,	" Too many points to link all"},
--{"A Tiny Winter Hat",			"Winters Veil Vendor Wagon",	58901,	"174865",	col_uncommon,	" (H)"..TomTomLink("Orgrimmar","","52.9","77.5","Greatfather Winter Pepe").." (A)"..TomTomLink("Ironforge","","34.3","68.5","Greatfather Winter Pepe")}

-- A Tiny Winter Staff		186473	64078					https://www.wowhead.com/item=186473/a-tiny-winter-staff
-- A Tiny Vial of Slime		186524	64098					https://www.wowhead.com/item=186524/a-tiny-vial-of-slime
-- A Tiny Sinstone			186580	64132					https://www.wowhead.com/item=186580/a-tiny-sinstone
-- A Tiny Pair of Wings		186593	64136					https://www.wowhead.com/item=186593/a-tiny-pair-of-wings


local quests = {
-- Text				Location				Quest	ItemID		Color			Waypoint
{"微型维京战盔",		"纳格兰-德拉诺",			39265,	"127865",	col_uncommon,	" "..PepeTomTomLink("纳格兰","德拉诺","80.18","50.36","维京佩佩")..MapPinLink(550,80.18,50.36,"维京")},
{"微型忍者服",		"戈尔隆德-德拉诺",			39267,	"127867",	col_uncommon,	" "..PepeTomTomLink("戈尔隆德","","47.50","41.30","忍者佩佩")..MapPinLink(543, 47.50, 41.30,"忍者")},
{"微型板甲战盔",		"塔拉多-德拉诺",			39266,	"127869",	col_uncommon,	" "..PepeTomTomLink("塔拉多","","50.97","63.30","骑士佩佩")..MapPinLink(535, 50.97, 63.30,"骑士")},
{"微型海盗帽",		"阿兰卡峰林-德拉诺",		39268,	"127870",	col_uncommon,	" "..PepeTomTomLink("阿兰卡峰林","","54.12","83.61","海盗佩佩")..MapPinLink(542, 54.12, 83.61,"海盗")},
{"迷你稻草人装束",	"万圣节3级要塞",		39865,	"128874",	col_uncommon,	" "..factionHalloween()},
{"微型护目镜",		"达拉然-军团",			43695,	"139632",	col_uncommon,	" "..PepeTomTomLink("LIST;627","49.12,32.40/39.15,33.36/39.25,25.10/51.27,53.49/57.12,53.05/36.84,37.06/48.65,40.20/32.25,31.66/55.39,44.14/50.59,57.19/36.17,27.70/57.87,42.28/59.87,52.53/59.87,52.53/41.88,33.03","","","旅行家佩佩")},
{"微型巫毒面具",		"达萨罗-争霸",			52269,	"161443",	col_uncommon,	" "..PepeTomTomLink("达萨罗","祖达萨","39.04","16.04","佩佩金")..MapPinLink(1165, 39.04, 16.04,"佩佩金")},
{"微型潜水盔",		"伯拉勒斯-争霸",			52277,	"161451",	col_uncommon,	" "..PepeTomTomLink("伯拉勒斯","","54.40","72.61","潜水佩佩")..MapPinLink(1161, 54.40, 72.61,"潜水")},
{"袖珍发条钥匙",		"麦卡贡里位面-争霸",		56911,	"170151",	col_uncommon,	" "..PepeTomTomLink("麦卡贡岛","","68.47","47.85","机械鸟佩佩")..MapPinLink(1462, 68.47, 47.85,"机械鸟")},
{"微型冬帽",		"冬幕节商人马车",	58901,	"174865",	col_uncommon,	" "..factionWinter()},
{"微型冬杖",		"暗影界名望56",		64078,	"186473",	col_uncommon,	""},
{"微型软泥瓶",		"暗影界名望56",		64098,	"186524",	col_uncommon,	""},
{"微型罪碑",			"暗影界名望56",		64132,	"186580",	col_uncommon,	""},
{"微型翅膀",		"暗影界名望56",		64136,	"186593",	col_uncommon,	""},
{"微型巨龙高脚杯",		"瓦德拉肯-巨龙",			79547,	"213181",	col_uncommon,	" "..PepeTomTomLink("瓦德拉肯","","50.58","52.95","巨龙佩佩")..MapPinLink(2112, 50.58, 52.95,"巨龙")},
{"微型探索者之帽",		"龙鳞先遣营地-巨龙",		79550,	"213202",	col_uncommon,	" "..PepeTomTomLink("觉醒海岸","","47.32","82.77","探索者佩佩")..MapPinLink(2022, 47.32, 82.77,"探索者")},
{"微型保暖耳罩",		"伊斯卡拉-巨龙",				79551,	"213207",	col_uncommon,	" "..PepeTomTomLink("碧蓝林海","巨龙群岛","12.99","48.59","海象人佩佩")..MapPinLink(2024, 12.99, 48.59,"海象人")},
{"微型羽饰三角帽",		"霸业风暴名望24",		80093,	"216907",	col_uncommon,	""},
}

--             Text                             	Location		ID		Color
local toys = {{"多维鸟哨",	"德拉诺成就",	"122293",	col_epic},
              {"浮标：木质佩佩",		"军团钓鱼",		"143662",	col_rare},
              {"迷你战刃",			"恶魔猎手职业大厅",	"147537",	col_epic},
              {"节庆多维鸟哨",	"被窃的礼物-2023冬幕节",	"209859",	col_epic}
             }

SLASH_PEPE1 = "/pepe"
SlashCmdList["PEPE"] = function(args)
  local cmd, arg = strsplit(" ",args,2)
  local qdone, qname, tname, tdone, tomtext
  cmd = cmd:lower()

  --print("Pepe Collection "..version.." by Hrazmadul "..updated)
  print(col_name.."PepeCollection 佩佩大全 "..col_e..col_version..version..col_e.." 作者："..col_creator..creator..col_e.." - 更新时间："..updated)


  print(col_b..col_title.."玩具"..col_e)
  for i=1,table.getn(toys) do
    tdone=PlayerHasToy(toys[i][3])
                                                                                --  color      id         text         location
    print(format("%s ("..col_b..col_zonetext.."%s"..col_e.."): %s",ItemLink(toys[i][4],toys[i][3],toys[i][1]), toys[i][2], tdone and "\124cff00ff00已收集\124r" or "\124cffff0000未收集\124r"))
  end
  print(col_b..col_title.."任务"..col_e)
  for i=1,table.getn(quests) do
    qdone=C_QuestLog.IsQuestFlaggedCompleted(quests[i][3])

--  if not qdone then
--    tomtext=quests[i][6]
--  else
--    tomtext=""
--  end
  tomtext = quests[i][6] -- always print out the tomtom link
  --special covenant test
  if ((quests[i][3]==64078) or (quests[i][3]==64098) or (quests[i][3]==64132) or (quests[i][3]==64136)) then

    if (quests[i][3]==64078) then --nightfae
	  if (playerCovenantID==3) then tomtext=" - 你现在是"..covenantText(3) end
	elseif (quests[i][3]==64098) then --necrolord
	  if (playerCovenantID==4) then tomtext=" - 你现在是"..covenantText(4) end
	elseif  (quests[i][3]==64132) then --venthyr
	  if (playerCovenantID==2) then tomtext=" - 你现在是"..covenantText(2) end
	elseif  (quests[i][3]==64136) then --kyrian
	  if (playerCovenantID==1) then tomtext=" - 你现在是"..covenantText(1) end
	end
  end
                                                                                 -- color        id           text           location
    print(format("%s ("..col_b..col_zonetext.."%s"..col_e.."): %s%s",ItemLink(quests[i][5],quests[i][4],quests[i][1]), quests[i][2], qdone and "\124cff00ff00已收集\124r" or "\124cffff0000未收集\124r", tomtext))
  end
end

function Pepe_OnEvent(frame, event, name, ...)
  if (event == "ADDON_LOADED" and name == "OrzUI") then
    --print(col_loadname..ADDON_NAME..col_e.." "..col_version..version..col_e.."：已加载")
    -- had some issues getting the covenant it yielded 0 often
    playerCovenantID = covenantUser()
    -- print("covenant id="..playerCovenantID)  
    --self:UnregisterEvent('ADDON_LOADED')
    frame:UnregisterEvent('ADDON_LOADED')
  elseif event == "PLAYER_LOGOUT" then
  end
end

f:SetScript("OnEvent", Pepe_OnEvent);
-- testing changing from addon loaded to player login
f:RegisterEvent("ADDON_LOADED")
f:RegisterEvent("PLAYER_LOGOUT")
--f:RegisterEvent("PLAYER_LOGIN")
