OK, I am endeavoring to make my first addon. I have noticed that General chat in the garrison is becoming Barens Trade chat. Here is what is suppose to do in a nutshell.
Player enters world or changes zone (no code for the latter yet), checks to see if player is in their garrison. If yes, then leave General Chat, if not join General chat. If you are in General and not in your garrison, do nothing.
Here is what I have so far:
Code:
local frame = CreateFrame("Frame")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent", function(self, event, ...)
local zoneName = GetZoneText();
message(zoneName);
if zoneName=="Lunarfall" then
print("Home");
LeaveChannelByName("General");
else
JoinChannelByName("General");
print("Adding");
end
end)
It works to the point of leaving General when entering the world or reloading. I can not get it to join General chat. Any help or pointers are appreciated.