📄 reputation.lua
字号:
ReputationFrame_Update=lOriginal_ReputationFrame_Update;
lOriginal_ReputationFrame_Update=nil;
end
--Reinstall Handlers
for i=1, 14, 1 do
getglobal("ReputationBar"..i):SetScript("OnEnter", function()
if (this.tooltip) then getglobal(this:GetName().."FactionStanding"):SetText(this.tooltip) end
end);
getglobal("ReputationBar"..i):SetScript("OnLeave", function ()
getglobal(this:GetName().."FactionStanding"):SetText(this.standingText);
end);
end
else
Reputations_Enable = 1;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_MOD_ON);
--Hook ReputationFrame
if (not lOriginal_ReputationFrame_Update) then
lOriginal_ReputationFrame_Update=ReputationFrame_Update;
ReputationFrame_Update=ReputationFrame_Update_New;
end
--Remove Handlers
for i=1, 14, 1 do
getglobal("ReputationBar"..i):SetScript("OnEnter", nil);
getglobal("ReputationBar"..i):SetScript("OnLeave", nil);
end
end
end
end
function Reputation_Load_Toggle(toggle)
if (toggle) then
Reputations_Load = toggle;
if (toggle==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_LOAD_ON);
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_LOAD_OFF);
end
else
if (Reputations_Raw == 1) then
Reputations_Load = 0;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_LOAD_OFF);
else
Reputations_Load = 1;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_LOAD_ON);
end
end
end
function Reputation_Debug_Toggle(toggle)
if (toggle) then
Reputations_Debug = toggle;
if (toggle==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_DEBUG_ON);
end
else
if (Reputations_Debug == 1) then
Reputations_Debug = 0;
else
Reputations_Debug = 1;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_DEBUG_ON);
end
end
end
function Reputation_ChatFrame_Change(checked,value) --Checked will always be 0
if (value) then
if (value > 0 and value <= FCF_GetNumActiveChatFrames()) then
Reputations_Frame = value;
REPUTATIONS_CHAT_FRAME = getglobal("ChatFrame"..Reputations_Frame);
REPUTATIONS_CHAT_FRAME:AddMessage(REPUTATION_MOD_FRAME,1.0,1.0,0.0);
else
DEFAULT_CHAT_FRAME:AddMessage(format(REPUTATION_INVALID_FRAME,value));
DEFAULT_CHAT_FRAME:AddMessage(format(REPUTATION_VALID_FRAMES,FCF_GetNumActiveChatFrames()));
end
end
end
function Reputation_Notify_Toggle(toggle)
if (toggle) then
Reputations_Notify = toggle;
if (toggle==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NOTIFY_ON);
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NOTIFY_OFF);
end
else
if (Reputations_Notify == 1) then
Reputations_Notify = 0;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NOTIFY_OFF);
else
Reputations_Notify = 1;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NOTIFY_ON);
end
end
end
function Reputation_Next_Toggle(toggle)
if (toggle) then
Reputations_Next = toggle;
if (toggle==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NEXT_ON);
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NEXT_OFF);
end
else
if (Reputations_Next == 1) then
Reputations_Next = 0;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NEXT_OFF);
else
Reputations_Next = 1;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NEXT_ON);
end
end
end
function Reputation_Repeat_Toggle(toggle)
if (toggle) then
Reputations_Repeat = toggle;
if (toggle==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_REPEAT_ON);
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_REPEAT_OFF);
end
else
if (Reputations_Repeat == 1) then
Reputations_Repeat = 0;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_REPEAT_OFF);
else
Reputations_Repeat = 1;
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_REPEAT_ON);
end
end
end
function Reputation_SlashHandler(msg)
local index, value;
if (not msg or msg == "") then --Show Help
for index, value in REPUTATION_HELP_TEXT do
DEFAULT_CHAT_FRAME:AddMessage(value);
end
else
local command=strlower(msg);
if (command == REPUTATION_LIST) then
local numFactions = GetNumFactions();
local factionIndex, factionStanding, factionBar, factionHeader, color;
local name, standingID, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed;
for factionIndex=1, numFactions, 1 do
name, _, standingID, barMin, barMax, barValue, atWarWith, canToggleAtWar, isHeader, isCollapsed = GetFactionInfo(factionIndex);
if (not isHeader) then
REPUTATIONS_CHAT_FRAME:AddMessage(format(name..":%d/%d",barValue-barMin,barMax-barMin));
end
end
elseif (command == REPUTATION_ON) then
Reputation_Toggle(1);
elseif (command == REPUTATION_OFF) then
Reputation_Toggle(0);
elseif (command == REPUTATION_LOAD) then
Reputation_Load_Toggle();
elseif (command == REPUTATION_STATUS) then
DEFAULT_CHAT_FRAME:AddMessage(format(REPUTATION_VERSION..".",Reputations_Version));
if (Reputations_Enabled==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_MOD_ON);
if (Reputations_Load==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_LOAD_ON);
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_LOAD_OFF);
end
DEFAULT_CHAT_FRAME:AddMessage(format(REPUTATION_SEL_FRAME,Reputations_Frame));
if (Reputations_Notify==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NOTIFY_ON);
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NOTIFY_OFF);
end
if (Reputations_Next==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NEXT_ON);
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_NEXT_OFF);
end
if (Reputations_Repeat==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_REPEAT_ON);
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_REPEAT_OFF);
end
if (Reputations_Debug==1) then
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_DEBUG_ON);
end
else
DEFAULT_CHAT_FRAME:AddMessage(REPUTATION_MOD_OFF);
end
elseif (command == REPUTATION_DEBUG) then
Reputation_Debug_Toggle();
elseif (strfind(command,"^"..REPUTATION_FRAME.." ")) then
local repchannel;
_,_,repchannel = strfind(command,"^"..REPUTATION_FRAME.."%s+(%d+)%s*$");
if (repchannel) then
repchannel = tonumber(repchannel);
Reputation_ChatFrame_Change(0,repchannel);
else
DEFAULT_CHAT_FRAME:AddMessage(format(REPUTATION_INVALID_FRAME,value));
DEFAULT_CHAT_FRAME:AddMessage(format(REPUTATION_VALID_FRAMES,FCF_GetNumActiveChatFrames()));
end
elseif (command == REPUTATION_NOTIFY) then
Reputation_Notify_Toggle();
elseif (command == REPUTATION_NEXT) then
Reputation_Next_Toggle();
elseif (command == REPUTATION_REPEAT) then
Reputation_Repeat_Toggle();
else --Help
for index, value in REPUTATION_HELP_TEXT do
DEFAULT_CHAT_FRAME:AddMessage(value);
end
end
end
end
function ReputationFrame_Update_New()
lOriginal_ReputationFrame_Update();
local numFactions = GetNumFactions();
local factionOffset = FauxScrollFrame_GetOffset(ReputationListScrollFrame);
local factionIndex, factionStanding, standingID, barValue, isHeader;
for i=1, NUM_FACTIONS_DISPLAYED, 1 do
factionIndex = factionOffset + i;
if ( factionIndex <= numFactions ) then
_, _, standingID, barMin, barMax, barValue, _, _, isHeader = GetFactionInfo(factionIndex);
if ( not isHeader ) then
factionStanding = getglobal("FACTION_STANDING_LABEL"..standingID);
getglobal("ReputationBar"..i.."FactionStanding"):SetText( factionStanding.." - "..barValue-barMin.."/"..barMax-barMin);
end
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -