WoWInterface SVN _GautrReply

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 13 to Rev 14
    Reverse comparison

Rev 13 → Rev 14

_GautrReply/readme.txt New file
0,0 → 1,46
How to use the addon
 
Have someone whisper the chosen or default prefix, like "!exp"
then you will whisper the person the experience you need to level
 
Slashcommands
 
/Gautr
/gr
/gautrreply
 
All of them work, if they interfere with some other addon, please report it.
 
Commands
 
bars
barscurrent
exp
expcurrent
percent
percentcurrent
position
help
 
Prefix
 
Default is set to "!"
You can change it to anything, but its better to keep it simple.
To change it, simply type "/gr prefix <Some character>"
 
 
Debug
 
To enable the Debug, type "/gr debug on"
To disable it, type "/gr debug off"
Debug mode should not save between sessions.
 
Debug mode will print all incoming party and whisper messages
It will print 4 lines like this
 
[20:03:18] To [Conchúr]: !exp
Event: CHAT_MSG_WHISPER
Player: Conchúr
Message: !exp
Filtered Incoming Command: EXP in CHAT_MSG_WHISPER
 
_GautrReply/_GautrReply.lua New file
0,0 → 1,193
local loaded = CreateFrame("FRAME", "Loaded")
local messages = CreateFrame("FRAME", "Messages")
 
loaded:RegisterEvent("ADDON_LOADED")
messages:RegisterEvent("CHAT_MSG_WHISPER")
messages:RegisterEvent("CHAT_MSG_PARTY")
messages:RegisterEvent("CHAT_MSG_PARTY_LEADER")
 
local Player = UnitName("player")
 
if Defaults == nil then
Defaults =
{
Prefix = "!",
Debug = false,
}
end
 
local C =
{
Player = "player",
W = "whisper",
 
Addon = {
Author = GetAddOnMetadata("_GautrReply", "author"),
Version = GetAddOnMetadata("_GautrReply", "version"),
Notes = GetAddOnMetadata("_GautrReply", "notes"),
Title = GetAddOnMetadata("_GautrReply", "title"),
Prefix = "|cffffd700_GautrReply|r: ",
},
Command = {
Percent = {
Current = "percentcurrent",
Left = "percent",
CurrentTwo = "%current",
LeftTwo = "%",
},
Experience = {
Current = "expcurrent",
Left = "exp",
},
Bars = {
Current = "barscurrent",
Left = "bars",
},
Help = {
Text = "help",
},
Position = {
Text = "position",
},
},
}
 
local function messagesHandler(self, event, msg, sender)
local coordX, coordY = GetPlayerMapPosition(Player)
 
local Messages =
{
Percent = {
Current = (format("Currently at: %d%s", (floor(UnitXP(Player) / UnitXPMax(Player) * 100)), "%")),
Left = (format("%d%s Left to Level", (100 - floor(UnitXP(Player) / UnitXPMax(Player) * 100)), "%")),
},
Experience = {
Current = (format("Current Experience: %d / %d", (UnitXP(Player)), (UnitXPMax(Player)))),
Left = (format("Experience Left to Level: %d / %d ", (UnitXPMax(Player) - UnitXP(Player)), UnitXPMax(Player))),
},
Bars = {
Current = (format("%s %d/20", "Bars ", (math.floor(20*UnitXP(Player)/UnitXPMax(Player)+0.5)))),
Left = (format("%s %d", "Bars Left", (20 - math.floor(20*UnitXP(Player)/UnitXPMax(Player)+0.5)))),
},
Help = {
Text = (format("%s%s%s", "Type ", Defaults.Prefix, " followed by any of the following commands 'bars, barscurrent, exp, expcurrent, position, percent, percentcurrent")),
},
Position = {
Text = (format("I'm in %s @ %d,%d", GetRealZoneText(), (coordX*100 ), (coordY*100)))
},
}
 
if Defaults.Debug then
print("Event: "..event)
print("Player: "..sender)
print("Message: "..msg)
else
if msg:lower():match(Defaults.Prefix .. C.Command.Percent.Current) or
msg:lower():match(Defaults.Prefix .. C.Command.Percent.CurrentTwo then
if sender ~= Player then wSend(Messages.Percent.Current, sender)
else print(C.Addon.Prefix .. Messages.Percent.Current) end
 
elseif msg:lower():match(Defaults.Prefix .. C.Command.Percent.Left) or
msg:lower():match(Defaults.Prefix .. C.Command.Percent.LeftTwo then
if sender ~= Player then wSend(Messages.Percent.Left, sender)
else print(C.Addon.Prefix .. Messages.Percent.Left) end
 
elseif msg:lower():match(Defaults.Prefix .. C.Command.Experience.Current) then
if sender ~= Player then wSend(Messages.Experience.Current, sender)
else print(C.Addon.Prefix .. Messages.Experience.Current) end
 
elseif msg:lower():match(Defaults.Prefix .. C.Command.Experience.Left) then
if sender ~= Player then wSend(Messages.Experience.Left, sender)
else print(C.Addon.Prefix .. Messages.Experience.Left) end
 
elseif msg:lower():match(Defaults.Prefix .. C.Command.Bars.Current) then
if sender ~= Player then wSend(Messages.Bars.Current, sender)
else print(C.Addon.Prefix .. Messages.Bars.Current) end
 
elseif msg:lower():match(Defaults.Prefix .. C.Command.Bars.Left) then
if sender ~= Player then wSend(Messages.Bars.Left, sender)
else print(C.Addon.Prefix .. Messages.Bars.Left) end
 
elseif msg:lower():match(Defaults.Prefix .. C.Command.Help.Text) then
if sender ~= Player then wSend(Messages.Help.Text, sender)
else print(C.Addon.Prefix .. Messages.Help.Text) end
 
elseif msg:lower():match(Defaults.Prefix .. C.Command.Position.Text) then
if sender ~= Player then wSend(Messages.Position.Text, sender)
else print(C.Addon.Prefix .. Messages.Position.Text) end
end
end
end
 
SLASH_GAUTRREPLY1, SLASH_GAUTRREPLY2, SLASH_GAUTRREPLY3 = '/gautr', '/gr', '/gautrreply';
 
local function handler(msg, editbox)
local command, rest = msg:match("^(%S*)%s*(.-)$");
if command == "prefix" then
if rest == "" then
print("|cffffd700" .. C.Addon.Title .. "|r: Type a symbol, the default is '|cffffd700!|r'. Currently it is "..Defaults.Prefix);
elseif rest ~= nil then
Defaults.Prefix = rest
end
elseif command == "debug" then
if rest == "" then
local check = Defaults.Debug and "ON" or "OFF"
print("|cffffd700" .. C.Addon.Title .. "|r: Type '/gr debug on' to turn on, off to turn off... Its currently " .. tostring(check))
elseif rest == "on" then
Defaults.Debug = true
local check = Defaults.Debug and "ON" or "OFF"
print("|cffffd700" .. C.Addon.Title .. "|r: Debug is now " .. tostring(check))
elseif rest == "off" then
Defaults.Debug = false
local check = Defaults.Debug and "ON" or "OFF"
print("|cffffd700" .. C.Addon.Title .. "|r: Debug is now " .. tostring(check))
end
elseif command == "test" then
wSend("!pos", Player);
else
print("|cffffd700" .. C.Addon.Title .. "|r: Type '/gr', '/gautr' or '/gautrreply' and either prefix or debug for info");
end
end
SlashCmdList["GAUTRREPLY"] = handler;
 
function loaded:OnEvent(event, arg1)
local addonName = "_GautrReply"
Defaults.Debug = false
if event == "ADDON_LOADED" and arg1 == addonName then
print("|cffffd700".. arg1 .. " ".. C.Addon.Version .."|r".. " by " .. "|cffffd700" .. C.Addon.Author .. "|r");
end
end
 
local filterStrings = {
C.Command.Help.Text,
C.Command.Experience.Left,
C.Command.Experience.Current,
C.Command.Position.Text,
C.Command.Percent.Left,
C.Command.Percent.Current,
C.Command.Bars.Left,
C.Command.Bars.Current,
}
 
function wSend(wMsg, wTarget)
SendChatMessage(wMsg, C.W, nil, wTarget)
end
 
--[[ Modified Decount code, Credits goes to Tekkub ]]--
local function filter(self, event, msg)
for _,str in pairs(filterStrings) do
if msg:lower():match(Defaults.Prefix..str) then
if Defaults.Debug then
print("Filtered Incoming Command: " .. "|cffffd700" ..str:upper().."|r in |cffffd700" .. event.."|r")
end
return true end
end
end
 
--for _,event in pairs{"CHAT_MSG_WHISPER", "CHAT_MSG_PARTY", "CHAT_MSG_PARTY_LEADER"} do
for _,event in pairs{"CHAT_MSG_WHISPER"} do
ChatFrame_AddMessageEventFilter(event, filter)
end
 
loaded:SetScript("OnEvent", loaded.OnEvent);
messages:SetScript("OnEvent", messagesHandler);
\ No newline at end of file
_GautrReply/_GautrReply.toc New file
0,0 → 1,8
## Author: Gautr
## Interface: 40300
## Notes: Reply Stuff
## Title: _GautrReply
## Version: 1.1.0.4
## SavedVariablesPerCharacter: Defaults
 
_GautrReply.lua
\ No newline at end of file
_GautrReply/changelog.txt New file
0,0 → 1,45
1.1.0.4
 
BETA RELEASE
 
Toc update
Added two more commands as per user request
!%
!%current
 
Added a wSend function, hopefully its a little bit cleaner (Not really)
 
Added a test function
/gr test
 
This will whisper your character "!position"
1.1.0.3
 
Toc update
Added a readme
Included the changelog
 
1.1.0.2
 
Toc updated
 
Minor fix
 
1.1.0.1
 
Changed version format, I might make more changes, and small ones rising up to version 992.52 does not seem like a good idea.
 
Fixed the filter function, there were some errors left over from the alpha version.
 
1.1
 
Updated TOC
 
Changed the Help message
 
Added a filterfunction credits goes to Tekkub's Decount
You wont see the incoming whispers now
 
1.0
 
Initial Release
\ No newline at end of file
_GautrReply Property changes : Added: svn:ignore + *.ini